diff --git a/resources/views/form/rapport-team3/preview-1791391025-cf688862-93e7-43b5-bf4e-7a29b30e3830.blade.php b/resources/views/form/rapport-team3/preview-1791391025-cf688862-93e7-43b5-bf4e-7a29b30e3830.blade.php new file mode 100644 index 00000000..f87ee299 --- /dev/null +++ b/resources/views/form/rapport-team3/preview-1791391025-cf688862-93e7-43b5-bf4e-7a29b30e3830.blade.php @@ -0,0 +1,323 @@ + + + + @include('layouts.shared/title-meta', ['title' => $form->title ?? 'POB']) + @include('layouts.shared/head-css', ['mode' => $mode ?? '', 'demo' => $demo ?? '']) + + + +@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 ''; + }; + $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; + }; + $contactType = strtolower((string) $val('contact_type')); + $isChemist = $contactType === 'ebt_chemist'; + $contactLabel = $isChemist ? 'Chemist' : 'Doctor'; + $skus = [ + ['Asthalin Inhaler', 'asthalin_inhaler'], + ['Asthalin Rotacap', 'asthalin_rotacap'], + ['Aerocort Inhaler', 'aerocort_inhaler'], + ['Aerocort Rotacap', 'aerocort_rotacap'], + ['Aerocort Forte Rotacap', 'aerocort_forte_rotacap'], + ]; + $supplyStatus = (string) $val('supply_status'); + $invoiceUrl = $fileUrl($val('upload_invoice')); + $invoiceExt = strtolower(pathinfo((string) parse_url($invoiceUrl, PHP_URL_PATH), PATHINFO_EXTENSION)); + $invoiceIsImage = in_array($invoiceExt, ['jpg', 'jpeg', 'png', 'gif', 'webp'], true); + $invoiceIsPdf = $invoiceExt === 'pdf'; + $showActual = $supplyStatus === 'Yes' || $invoiceUrl !== '' || $val('total_actual_pob_units') !== '' || $val('total_actual_pob_value') !== ''; +@endphp + +
+
+

POB Review

+

Review the order and invoice before you approve or reject

+ @if(isset($form->user_info->name) && $form->user_info->name !== '') +

Submitted by: {{ $form->user_info->name }}

+ @endif +
+ +
+
{{ $contactLabel }} details
+
+
+ Date + {{ $val('record_date') !== '' ? $val('record_date') : '—' }} +
+
+ {{ $contactLabel }} + {{ $val('contact_name') !== '' ? $val('contact_name') : '—' }} +
+ @if(!$isChemist) +
+ Speciality + {{ $val('speciality') !== '' ? $val('speciality') : '—' }} +
+
+ Doctor Address + {{ $val('doctor_location') !== '' ? $val('doctor_location') : '—' }} +
+ @else +
+ Chemist Address + {{ $val('chemist_location') !== '' ? $val('chemist_location') : '—' }} +
+ @endif +
+ MSL Code + {{ $val('msl_code') !== '' ? $val('msl_code') : '—' }} +
+
+ Supply Status + {{ $supplyStatus !== '' ? $supplyStatus : '—' }} +
+
+ Submission Status + {{ $val('submission_status') !== '' ? $val('submission_status') : '—' }} +
+
+
+ +
+
POB
+
+ + + + + + + + + + @foreach($skus as [$label, $code]) + + + + + + @endforeach + + + + + + +
SKUUnitsValue
{{ $label }}{{ $val($code.'_units') !== '' ? $val($code.'_units') : '0' }}{{ $val($code.'_value') !== '' ? $val($code.'_value') : '0' }}
Total{{ $val('total_pob_units') !== '' ? $val('total_pob_units') : '0' }}{{ $val('total_pob_value') !== '' ? $val('total_pob_value') : '0' }}
+
+
+ + @if($showActual) +
+
Actual POB
+
+ + + + + + + + + + @foreach($skus as [$label, $code]) + + + + + + @endforeach + + + + + + +
SKUActual UnitsActual Value
{{ $label }}{{ $val('actual_'.$code.'_units') !== '' ? $val('actual_'.$code.'_units') : '0' }}{{ $val('actual_'.$code.'_value') !== '' ? $val('actual_'.$code.'_value') : '0' }}
Total{{ $val('total_actual_pob_units') !== '' ? $val('total_actual_pob_units') : '0' }}{{ $val('total_actual_pob_value') !== '' ? $val('total_actual_pob_value') : '0' }}
+
+
+ @endif + +
+
Invoice
+
+ @if($invoiceUrl === '') +

No invoice uploaded.

+ @elseif($invoiceIsImage) +
+ Uploaded invoice +
+

Open invoice

+ @elseif($invoiceIsPdf) + +

Open invoice

+ @else +

Open invoice

+ @endif +
+
+
+ +
+
+ × + Uploaded invoice +
+
+ + + + +