@php $v = fn ($key) => trim((string) ($data[$key] ?? '')); $fieldsByName = collect($formFields ?? [])->keyBy('field_name'); $fieldType = fn ($key) => optional($fieldsByName->get($key))->type; $fieldOptions = function ($key) use ($fieldsByName) { $options = optional($fieldsByName->get($key))->options; if (is_array($options)) { return $options; } if (is_string($options) && $options !== '') { return json_decode($options, true) ?: []; } return []; }; $selectedValues = fn ($key) => array_values(array_filter(array_map('trim', explode(',', $v($key))), fn ($value) => $value !== '')); $isSelected = fn ($key, $option) => in_array((string) $option, $selectedValues($key), true); $patientRows = [ [['Title', 'title'], ['Full Name', 'full_name']], [['Age', 'age'], ['Sex', 'sex']], [['Marital Status', 'marital_status'], ['Date of Birth', 'date_of_birth']], [['Street Address', 'street_address'], null], [['City', 'city'], ['Province / State', 'province']], [['Postal Code', 'postal_code'], null], [['Email Address', 'email_address'], null], [['Home Phone', 'home_phone'], ['Cell Phone', 'cell_phone']], [['Occupation', 'cccupation'], ['Employed By', 'employed_by']], ]; $insuranceRows = [ [['Dental Insurance?', 'dental_insurance'], ['Company', 'insurance_company']], [['Policy No.', 'policy_no'], ['ID / Cert No.', 'certificate_no']], [['Family Physician', 'family_physician'], ['Physician Phone', 'physician_phone']], [['Previous Dentist', 'previous_dentist'], ['Previous Dentist Phone', 'previous_dentist_phone']], [['Referral Credit', 'referral_credit'], null], ]; $fullWidthPatientFields = ['street_address', 'email_address']; $fullWidthInsuranceFields = ['referral_credit']; $emergencyRows = [ [['Contact Name', 'en_contact_name'], ['Relationship', 'en_relationship']], [['Address', 'en_address'], ['Phone Number', 'en_phone_number']], ]; $medicalRows = [ ['1. Date of last complete physical examination', 'dlcp_examination'], ["2. Are you currently under a physician's care?", 'cup_care', 'cup_care_specify'], ['3. Do you have frequent headaches?', 'frequent_headaches'], ['4. Do you smoke?', 'smoke'], ['5. Do you drink alcohol?', 'drink_alcohol', 'drink_alcohol_specify'], ['6. Do you do recreational drugs?', 'recreational_drugs'], ['7. Do you routinely take vitamins, herbal substances, or natural products?', 'herbal_substances', 'herbal_substances_specify'], ['8. Are you taking any medications?', 'any_medications', 'any_medications_specify'], ['9. Have you taken any prolonged medication in the past?', 'prolonged_medication', 'prolonged_medication_specify'], ['10. Have you taken cortisone or steroids?', 'cortisone'], ['11. Have you ever been hospitalized for any surgery?', 'any_surgery', 'any_surgery_specify'], ['12. Are your ankles often swollen?', 'ankles_swollen'], ['13. Have you gained or lost excessive weight recently?', 'gained_lost_weight'], ['14. Are you pregnant?', 'pregnant', 'pregnant_weeks'], ['15. Sensitive / adverse reactions', 'adverse_reaction'], ['16. Allergies / adverse reactions', 'allergic_adverse_reaction'], ['17. Allergic or adverse reactions to any other drugs?', 'adverse_reactions', 'adverse_reactions_specify'], ['18. Treated for or told you have any of the following', 'treated'], ['19. Have you ever experienced heavy bleeding?', 'heavy_bleeding'], ['20. Is there anything else we should know?', 'anything_else_know', 'anything_else_know_specify'], ['21. Have you been diagnosed with any other disease, condition or problem?', 'other_disease'], ['22. Is there anything about your health we should be aware of?', 'anything_about_health', 'anything_about_health_specify'], ['23. Do you wish to speak to the doctor privately?', 'speak_doctor_privately'], ]; $dentalRows = [ ['24. Date of last complete exam', 'date_last_complete_exam'], ['25. Date of last cleaning', 'date_last_cleaning'], ['26. Date of last x-rays', 'date_last_x_rays'], ['27. Did you see your last dentist regularly?', 'last_dentist_regularly'], ['28. How often did you see your last dentist?', 'last_dentist', 'last_dentist_description'], ['29. Have you ever been advised to take antibiotics?', 'antibiotics'], ['30. Heavy bleeding following extractions?', 'heavy_bleeding_extractions'], ['31. Have you ever had gum treatment or surgery?', 'gum_treatment'], ['32. Have you had any orthodontic treatment?', 'orthodontic_treatment'], ['33. Have you ever had an unpleasant dental experience?', 'unpleasant_dental_experience'], ['34. How can we make your dental experience more pleasant?', 'pleasant_dental_experience'], ['35. Is there anything else we should know?', 'anything_else_should_know'], ['36. What brings you to the office today?', 'brings_office_today'], ['37. Are you in any discomfort?', 'any_discomfort', 'any_discomfort_specify'], ['38. Do you have or have you experienced', 'have_experienced'], ['39. Does food get caught between your teeth?', 'food_teeth'], ['40. Do you have any sore spots in your mouth?', 'sore_spots'], ['41. Have you had any teeth replaced?', 'teeth_replaced'], ['42. Interested in permanent tooth replacement?', 'permanent_tooth_replacement'], ['43. Have you ever been given local anesthesia?', 'local_anesthesia'], ['44. Have you ever been given general anesthesia?', 'general_anesthesia'], ['45. Are you satisfied with the appearance of your teeth?', 'satisfied_appearance_teeth'], ['46. Are you anxious to keep your natural teeth?', 'keep_natural_teeth'], ['47. Are you tense during dental visits?', 'tense_dental_visits'], ['48. Interested in a method to calm your nerves?', 'calm_nerves'], ]; @endphp
{{ $v('location_name') }}
{!! $v('location_address') !!}
{{ $v('location_email') }}
{{ $v('location_phone') }}
CHAGGER DENTAL PATIENT INFORMATION
Submitted: {{ $v('submitted_at') }}
PATIENT PROFILE
@foreach ($patientRows as $row) @php($isFullWidthRow = count(array_filter($row)) === 1 && in_array($row[0][1], $fullWidthPatientFields, true)) @foreach ($row as $field) @if ($field) @elseif (!$isFullWidthRow) @endif @endforeach @endforeach
@if ($field[1] === 'marital_status')
Marital Status
Single
Married
Prefer Not to Say
@else
{{ $field[0] }}
@include('pdf-templates.partials.formatted-value', ['fieldKey' => $field[1]])
@endif
 
DENTAL INSURANCE & CARE PROVIDERS
@foreach ($insuranceRows as $row) @php($isFullWidthRow = count(array_filter($row)) === 1 && in_array($row[0][1], $fullWidthInsuranceFields, true)) @foreach ($row as $field) @if ($field) @elseif (!$isFullWidthRow) @endif @endforeach @endforeach
{{ $field[0] }}
@include('pdf-templates.partials.formatted-value', ['fieldKey' => $field[1]])
 
EMERGENCY CONTACT
@foreach ($emergencyRows as $row) @foreach ($row as $field) @endforeach @endforeach
{{ $field[0] }}
@include('pdf-templates.partials.formatted-value', ['fieldKey' => $field[1]])
CONFIDENTIAL MEDICAL HISTORY
@foreach ($medicalRows as $row) @if ($fieldType($row[1]) === 'checkbox') @else @endif @endforeach
{{ $row[0] }}
@include('pdf-templates.partials.formatted-value', ['fieldKey' => $row[1]])
{{ $row[0] }} @include('pdf-templates.partials.formatted-value', ['fieldKey' => $row[1]]) @isset($row[2])
Specify
@include('pdf-templates.partials.formatted-value', ['fieldKey' => $row[2]]) @endisset
CONFIDENTIAL DENTAL HISTORY
@foreach ($dentalRows as $row) @if ($fieldType($row[1]) === 'checkbox') @else @endif @endforeach
{{ $row[0] }}
@include('pdf-templates.partials.formatted-value', ['fieldKey' => $row[1]])
{{ $row[0] }} @include('pdf-templates.partials.formatted-value', ['fieldKey' => $row[1]]) @isset($row[2])
Specify
@include('pdf-templates.partials.formatted-value', ['fieldKey' => $row[2]]) @endisset
49. How can we help you today?
{{ $v('describe') }}