diff --git a/resources/views/form/rapport-team2/1790853173-2ef535a8-b66e-4889-b29d-db2666f4163a.blade.php b/resources/views/form/rapport-team2/1790853173-2ef535a8-b66e-4889-b29d-db2666f4163a.blade.php
index 4cd1bb6e..2972841f 100644
--- a/resources/views/form/rapport-team2/1790853173-2ef535a8-b66e-4889-b29d-db2666f4163a.blade.php
+++ b/resources/views/form/rapport-team2/1790853173-2ef535a8-b66e-4889-b29d-db2666f4163a.blade.php
@@ -89,9 +89,10 @@
@case('textarea')
@break
- @case('dropdown')
+ {{-- @case('dropdown')
@php
$isContact = str_starts_with($question->code, 'contact_id');
+ $options = collect($question->options)->sortBy('display', SORT_NATURAL | SORT_FLAG_CASE);
@endphp
required == 'yes' ? 'required' : '' }}>
@@ -117,7 +118,43 @@
@endforeach
- @break
+ @break --}}
+
+
+ @case('dropdown')
+ @php
+ $isContact = str_starts_with($question->code, 'contact_id');
+
+ // जर options collection किंवा array असेल तर display field नुसार alphabetize करा
+ $options = collect($question->options)->sortBy('display', SORT_NATURAL | SORT_FLAG_CASE);
+ @endphp
+
+ required == 'yes' ? 'required' : '' }}>
+ -- Select --
+
+ {{-- $question->options ऐवजी $options वापरा --}}
+ @foreach ($options as $option)
+ @if($isContact && isset($option->contact->type) && $option->contact->type == 'doctor' )
+ value) && $question->value == $option->value) selected @endif
+ @if($isContact)
+ msl_code="{{ (isset($option->contact->msl_code) ? $option->contact->msl_code : '') }}"
+ speciality="{{ (isset($option->contact->speciality) ? $option->contact->speciality : '') }}"
+ @endif
+ >
+ {{ $option->display }}
+
+ @elseif(!$isContact)
+ value) && $question->value == $option->value ? 'selected' : '' }}
+ {{ $question->code == 'contact_id' ? 'pcode= ' . (isset($option->contact->pcode)?$option->contact->pcode:'') . ' ' : '' }}
+ {{ $question->code == 'contact_id' ? 'speciality= ' . (isset($option->contact->speciality) ? $option->contact->speciality :'') . ' ' : '' }}>
+ {{ $option->display }}
+
+ @endif
+ @endforeach
+
+@break
@case('checkbox')
@foreach($question->options as $option)
@@ -232,8 +269,13 @@
// Example usage: console.log(contacts);
// Filter out contacts where value == 'sample'
contacts = contacts.filter(function(itm) { return itm.value !== 'sample' && itm.contact && itm.contact.type === 'doctor' });
+
+ contacts.sort(function(a, b) {
+ return (a.display || '').localeCompare(b.display || '', undefined, { sensitivity: 'base' });
+ });
+
console.log(contacts);
-
+
// Loop through contacts and append options to select elements whose id starts with 'field-contact_id'
// We assume contact_id fields may be suffixed, e.g. field-contact_id_1, field-contact_id, etc.
function applySelect2ToDoctorDropdowns() {