@php
$fullRowFields = ['consent_privacy_patient', 'consent_newsletter'];
$hiddenFields = ['privacy_patient_name'];
$phoneFields = [
'phone_number',
'home_phone',
'cell_phone',
'physician_phone',
'previous_dentist_phone',
'en_phone_number',
];
$displayFields = collect($formFields)->except(array_merge($fullRowFields, $hiddenFields));
$emailFields = ['email', 'email_address'];
$locationFields = ['select_location', 'preferred_location'];
$notAvailable = __('common.na_txt');
$hasModifier = (int) ($submission->updated_id ?? 0) > 0;
$staticRows = [
['label' => $staticLabels['submitted_date'], 'value' => $submission->created_at->format($listDataAtrArr['mdfy_dt_frmt'])],
['label' => $staticLabels['user_ip'], 'value' => $submission->user_ip ?? ''],
['label' => $staticLabels['browser'], 'value' => $submission->browser ?? ''],
['label' => $staticLabels['platform'], 'value' => $submission->platform ?? ''],
];
$modifiedRows = [
['label' => __('admin.mdfy_date_txt'), 'value' => $hasModifier && $submission->updated_at ? $submission->updated_at->format($listDataAtrArr['mdfy_dt_frmt']) : $notAvailable],
['label' => __('admin.mdfy_by_txt'), 'value' => $hasModifier ? ($submission->updatedBy->display_name ?? $notAvailable) : $notAvailable],
];
@endphp
@foreach ($displayFields->chunk(2) as $fieldPair)
@foreach ($fieldPair as $field => $label)
@php
$value = $fieldValues[$field] ?? '';
$signatureUrl = '';
if ($field === 'signature' && (string) $value !== '') {
$signatureUrl = \Illuminate\Support\Str::startsWith((string) $value, ['http://', 'https://'])
? $value
: $mediaFolder . $value;
}
@endphp
@endforeach
@endforeach
@foreach ($fullRowFields as $field)
@if (array_key_exists($field, $formFields))
@php
$label = $formFields[$field];
$value = $fieldValues[$field] ?? '';
if ($field === 'consent_privacy_patient') {
$label = str_replace(
'___________________',
$fieldValues['privacy_patient_name'] ?? '',
$label,
);
}
@endphp
@endif
@endforeach
@if ((string) $value === '')
@elseif ($field === 'signature')
@elseif (in_array($field, $phoneFields, true))
{{ $value }}
@elseif (in_array($field, $emailFields, true))
{{ $value }}
@elseif (strip_tags((string) $value) !== (string) $value)
{!! $value !!}
@else
{{ $value }}
@endif
{!! strip_tags((string) $value) !== (string) $value ? $value : e($value) !!}
@foreach ($staticRows as $row)
@endforeach
{{ $row['value'] }}
@foreach ($modifiedRows as $row)
@endforeach
{{ $row['value'] }}