diff --git a/resources/views/form/rapport-team3/partials/survey-preview-helpers.blade.php b/resources/views/form/rapport-team3/partials/survey-preview-helpers.blade.php deleted file mode 100644 index 5249a75b..00000000 --- a/resources/views/form/rapport-team3/partials/survey-preview-helpers.blade.php +++ /dev/null @@ -1,39 +0,0 @@ -@php - $byCode = []; - foreach ($questions ?? [] as $question) { - if (isset($question->code)) { - $byCode[$question->code] = $question; - } - } - $submitted = $submitted_formdata ?? null; - $val = function ($code) use ($byCode, $submitted) { - if (is_object($submitted) && isset($submitted->{$code}) && $submitted->{$code} !== '' && $submitted->{$code} !== null) { - return $submitted->{$code}; - } - if (is_array($submitted) && isset($submitted[$code]) && $submitted[$code] !== '' && $submitted[$code] !== null) { - return $submitted[$code]; - } - if (isset($byCode[$code]->value) && $byCode[$code]->value !== '' && $byCode[$code]->value !== null) { - return $byCode[$code]->value; - } - return ''; - }; - $show = function ($code) use ($val) { - $value = $val($code); - return $value !== '' && $value !== null ? $value : '—'; - }; - $fileUrl = function ($url) { - $url = trim((string) $url); - if ($url === '') { - return ''; - } - if (!preg_match('#^https?://#i', $url)) { - return rtrim((string) env('AWS_URL'), '/') . '/' . ltrim($url, '/'); - } - return $url; - }; - $isImageUrl = function ($url) { - $ext = strtolower(pathinfo((string) parse_url($url, PHP_URL_PATH), PATHINFO_EXTENSION)); - return in_array($ext, ['jpg', 'jpeg', 'png', 'gif', 'webp'], true); - }; -@endphp diff --git a/resources/views/form/rapport-team3/preview-1790230856-704c97b6-61f7-4eda-901a-2cb4ff6f293d.blade.php b/resources/views/form/rapport-team3/preview-1790230856-704c97b6-61f7-4eda-901a-2cb4ff6f293d.blade.php index 7a099a68..e71dfa89 100644 --- a/resources/views/form/rapport-team3/preview-1790230856-704c97b6-61f7-4eda-901a-2cb4ff6f293d.blade.php +++ b/resources/views/form/rapport-team3/preview-1790230856-704c97b6-61f7-4eda-901a-2cb4ff6f293d.blade.php @@ -6,8 +6,44 @@ -@include('form.rapport-team3.partials.survey-preview-helpers') @php + $byCode = []; + foreach ($questions ?? [] as $question) { + if (isset($question->code)) { + $byCode[$question->code] = $question; + } + } + $submitted = $submitted_formdata ?? null; + $val = function ($code) use ($byCode, $submitted) { + if (is_object($submitted) && isset($submitted->{$code}) && $submitted->{$code} !== '' && $submitted->{$code} !== null) { + return $submitted->{$code}; + } + if (is_array($submitted) && isset($submitted[$code]) && $submitted[$code] !== '' && $submitted[$code] !== null) { + return $submitted[$code]; + } + if (isset($byCode[$code]->value) && $byCode[$code]->value !== '' && $byCode[$code]->value !== null) { + return $byCode[$code]->value; + } + return ''; + }; + $show = function ($code) use ($val) { + $value = $val($code); + return $value !== '' && $value !== null ? $value : '—'; + }; + $fileUrl = function ($url) { + $url = trim((string) $url); + if ($url === '') { + return ''; + } + if (!preg_match('#^https?://#i', $url)) { + return rtrim((string) env('AWS_URL'), '/') . '/' . ltrim($url, '/'); + } + return $url; + }; + $isImageUrl = function ($url) { + $ext = strtolower(pathinfo((string) parse_url($url, PHP_URL_PATH), PATHINFO_EXTENSION)); + return in_array($ext, ['jpg', 'jpeg', 'png', 'gif', 'webp'], true); + }; $products = [ 'Asthalin Inhaler' => 'asthalin_inhaler', 'Asthalin Rotacap' => 'asthalin_rotacap', diff --git a/resources/views/form/rapport-team3/preview-1790230856-a5ff58a6-d509-4ac0-9b18-6d366a74965e.blade.php b/resources/views/form/rapport-team3/preview-1790230856-a5ff58a6-d509-4ac0-9b18-6d366a74965e.blade.php index 59f1bad4..6a398941 100644 --- a/resources/views/form/rapport-team3/preview-1790230856-a5ff58a6-d509-4ac0-9b18-6d366a74965e.blade.php +++ b/resources/views/form/rapport-team3/preview-1790230856-a5ff58a6-d509-4ac0-9b18-6d366a74965e.blade.php @@ -6,8 +6,44 @@ -@include('form.rapport-team3.partials.survey-preview-helpers') @php + $byCode = []; + foreach ($questions ?? [] as $question) { + if (isset($question->code)) { + $byCode[$question->code] = $question; + } + } + $submitted = $submitted_formdata ?? null; + $val = function ($code) use ($byCode, $submitted) { + if (is_object($submitted) && isset($submitted->{$code}) && $submitted->{$code} !== '' && $submitted->{$code} !== null) { + return $submitted->{$code}; + } + if (is_array($submitted) && isset($submitted[$code]) && $submitted[$code] !== '' && $submitted[$code] !== null) { + return $submitted[$code]; + } + if (isset($byCode[$code]->value) && $byCode[$code]->value !== '' && $byCode[$code]->value !== null) { + return $byCode[$code]->value; + } + return ''; + }; + $show = function ($code) use ($val) { + $value = $val($code); + return $value !== '' && $value !== null ? $value : '—'; + }; + $fileUrl = function ($url) { + $url = trim((string) $url); + if ($url === '') { + return ''; + } + if (!preg_match('#^https?://#i', $url)) { + return rtrim((string) env('AWS_URL'), '/') . '/' . ltrim($url, '/'); + } + return $url; + }; + $isImageUrl = function ($url) { + $ext = strtolower(pathinfo((string) parse_url($url, PHP_URL_PATH), PATHINFO_EXTENSION)); + return in_array($ext, ['jpg', 'jpeg', 'png', 'gif', 'webp'], true); + }; $products = [ 'Asthalin Inhaler' => 'asthalin_inhaler', 'Asthalin Rotacap' => 'asthalin_rotacap',