@php $answer = $questionnaire->answer ?? null; $selectedOptions = $questionnaire->SELECTED_OPTIONS ?? []; $lang = $lang ?? app('translator')->getLocale(); $labelField = $lang === 'ar' ? 'NAME_AR' : 'NAME_EN'; $selectedOpts = !empty($selectedOptions) ? \App\Models\LABCATEGORYPACKAGEQUESTIONNAIREOPTIONS::whereIn('ID', $selectedOptions)->select('ID', 'NAME_EN', 'NAME_AR')->get() : collect(); // Allow callers to override the AJAX endpoint that select2 uses to load options. // Defaults to the operations-auth-protected endpoint; the public patient // questionnaire passes its own token-scoped URL via $optionsDataUrl. $optionsDataUrl = $optionsDataUrl ?? ('/operations/questionnaire/options/' . $questionnaire->ID); // DOM id must be HTML5-valid (no whitespace, see WHATWG: "The value must not // contain any space characters") and unique per caller's invocation so select2 // v4 — which keys its internal `Utils.__cache` on `element.id` — does not // collide across tabs. Callers MAY pass `$domKey` separately from `$key` so // they can keep the original `$key` in the form `name=` attribute (which the // controller parses via `questions[$key][...]`) while still producing a unique // DOM id. When `$domKey` is omitted, falls back to `$key`. $domId = \Illuminate\Support\Str::slug(($domKey ?? $key ?? '') . '_' . $questionnaire->ID, '_'); $displayName = $lang === 'ar' ? ($questionnaire->NAME_AR ?: $questionnaire->NAME_EN) : $questionnaire->NAME_EN; $dirAttr = ''; @endphp @if (isset($fillQuestionnaireByPatient) && $fillQuestionnaireByPatient) @endif @if($questionnaire->TYPE == 'SELECT' || $questionnaire->TYPE == 'MULTIPLE_SELECT')
Preview not available for this file type. Download File