Rapport-Laravel/resources/views/form/rapport-team3/preview-1790230856-a5ff58a6...

179 lines
9.5 KiB
PHP

<!DOCTYPE html>
<html lang="en">
<head>
@include('layouts.shared/title-meta', ['title' => $form->title ?? 'Doctor Survey'])
@include('layouts.shared/head-css', ['mode' => $mode ?? '', 'demo' => $demo ?? ''])
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
</head>
<body class="preview-approval-body">
@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',
'Aerocort Inhaler' => 'aerocort_inhaler',
'Aerocort Rotacap' => 'aerocort_rotacap',
'Aerocort Forte Rotacap' => 'aerocort_forte_rotacap',
];
$therapies = [
'Nebulization Respules / Month' => 'neb_respules',
'Foracort Inhaler Units / Month' => 'foracort_inhaler_units',
'Foracort Rotacaps Units / Month' => 'foracort_rotacaps_units',
'Asthalin Syrup Units / Month' => 'asthalin_syrup_units',
'Levolin Syrup Units / Month' => 'levolin_syrup_units',
'Deriphyllin Units / Month' => 'deriphyllin_units',
'Betnesol Tablet Units / Month' => 'beclomethasone_units',
'Methylprednisolone Units / Month' => 'methylprednisolone_units',
'Prednisolone Units / Month' => 'prednisolone_units',
'Cough Syrups Units / Month' => 'cough_syrups_units',
];
$photos = [
'Visiting Card' => 'visiting_card',
'Rx Pad' => 'rx_pad',
'Doctor Board' => 'doctor_board',
];
$degree = (string) $val('degree');
if (strcasecmp($degree, 'Other') === 0 && $val('doctor_other_degree') !== '') {
$degree = $val('doctor_other_degree');
}
$specialty = (string) $val('specialty');
if (strcasecmp($specialty, 'Other') === 0 && $val('doctor_other_speciality') !== '') {
$specialty = $val('doctor_other_speciality');
}
@endphp
<div class="approval-container">
<div class="approval-header">
<h1 class="approval-title">Doctor Survey Review</h1>
<p class="approval-subtitle">Review the submitted doctor survey before you approve or reject</p>
@if(isset($form->user_info->name) && $form->user_info->name !== '')
<p class="text-muted mb-0">Submitted by: {{ $form->user_info->name }}</p>
@endif
</div>
<div class="preview-accordion">
<details class="preview-panel" open>
<summary class="section-title">Doctor details</summary>
<div class="section-content">
<div class="detail-row"><span class="detail-label">Date</span><span class="detail-value">{{ $show('record_date') }}</span></div>
<div class="detail-row"><span class="detail-label">Doctor Name</span><span class="detail-value">{{ $show('doctor_name') }}</span></div>
<div class="detail-row"><span class="detail-label">MSL Code</span><span class="detail-value">{{ $show('msl_code') }}</span></div>
<div class="detail-row"><span class="detail-label">Registration Number</span><span class="detail-value">{{ $show('doctor_registration_number') }}</span></div>
<div class="detail-row"><span class="detail-label">Mobile Number</span><span class="detail-value">{{ $show('mobile_number') }}</span></div>
<div class="detail-row"><span class="detail-label">Legacy Code</span><span class="detail-value">{{ $show('legacy_code') }}</span></div>
<div class="detail-row"><span class="detail-label">Degree</span><span class="detail-value">{{ $degree !== '' ? $degree : '—' }}</span></div>
<div class="detail-row"><span class="detail-label">Specialty</span><span class="detail-value">{{ $specialty !== '' ? $specialty : '—' }}</span></div>
<div class="detail-row"><span class="detail-label">Doctor Address</span><span class="detail-value">{{ $show('doctor_location') }}</span></div>
<div class="detail-row"><span class="detail-label">Doctor Pincode</span><span class="detail-value">{{ $show('doctor_pincode') }}</span></div>
<div class="detail-row"><span class="detail-label">Doctor Type</span><span class="detail-value">{{ $show('doctor_type') }}</span></div>
<div class="detail-row"><span class="detail-label">Total Patients / Day</span><span class="detail-value">{{ $show('total_patients') }}</span></div>
<div class="detail-row"><span class="detail-label">Respiratory Patients / Day</span><span class="detail-value">{{ $show('respiratory_patients') }}</span></div>
<div class="detail-row"><span class="detail-label">Manager Joint Visit</span><span class="detail-value">{{ $show('manager_joint_visit') }}</span></div>
<div class="detail-row"><span class="detail-label">Attached Chemist</span><span class="detail-value">{{ $show('attached_chemist_name') }}</span></div>
<div class="detail-row"><span class="detail-label">No. of Staff</span><span class="detail-value">{{ $show('no_of_staff') }}</span></div>
</div>
</details>
<details class="preview-panel" open>
<summary class="section-title">Doctor Prescription</summary>
<div class="section-content p-0">
<table class="table table-sm mb-0">
<thead class="table-light">
<tr>
<th>Product</th>
<th>Prescribed</th>
<th class="text-end">Units / Month</th>
</tr>
</thead>
<tbody>
@foreach($products as $label => $code)
<tr>
<td>{{ $label }}</td>
<td>{{ $show($code) }}</td>
<td class="text-end">{{ $val($code.'_units') !== '' ? $val($code.'_units') : '—' }}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</details>
<details class="preview-panel">
<summary class="section-title">Other therapies</summary>
<div class="section-content">
@foreach($therapies as $label => $code)
<div class="detail-row">
<span class="detail-label">{{ $label }}</span>
<span class="detail-value">{{ $show($code) }}</span>
</div>
@endforeach
</div>
</details>
<details class="preview-panel" open>
<summary class="section-title">Photos</summary>
<div class="section-content">
@php $anyPhoto = false; @endphp
@foreach($photos as $label => $code)
@php $url = $fileUrl($val($code)); @endphp
@if($url !== '')
@php $anyPhoto = true; @endphp
<div class="mb-3">
<div class="detail-label mb-2">{{ $label }}</div>
@if($isImageUrl($url))
<div class="request-letter-container">
<img src="{{ $url }}" alt="{{ $label }}" class="request-letter-image" onclick="openImageModal(@json($url))" />
</div>
@endif
<p class="text-center mt-2 mb-0"><a href="{{ $url }}" target="_blank" rel="noopener">Open {{ strtolower($label) }}</a></p>
</div>
@endif
@endforeach
@if(!$anyPhoto)
<p class="text-muted mb-0">No photos uploaded.</p>
@endif
</div>
</details>
</div>
</div>
@include('form.rapport-team3.partials.survey-preview-styles')
</body>
</html>