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 fa4fba9a..bdee2167 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 @@ -94,7 +94,7 @@ $isContact = str_starts_with($question->code, 'contact_id'); @endphp - required == 'yes' ? 'required' : '' }}> @foreach ($question->options as $option) @if($isContact && isset($option->contact->type) && $option->contact->type == 'doctor' ) @@ -350,7 +350,7 @@ } - /* $("select[id^='field-contact_id']").each(function() { + $("select[id^='field-contact_id']").each(function() { var select = $(this); // Clear previous options select.html(''); @@ -411,74 +411,11 @@ // Enable search on doctor dropdowns applySelect2ToDoctorDropdowns(); $("#pageloader").fadeOut(); - }); */ - - // contacts लोड झाल्यानंतर: -contacts = contacts.filter(function(itm) { return itm.value !== 'sample'; }); - -$("select[id^='field-contact_id']").each(function() { - var select = $(this); - - // जर आधी Select2 लागलेले असेल तर ते आधी नष्ट (destroy) करा - if (select.hasClass("select2-hidden-accessible")) { - select.select2('destroy'); - } - - // जुने ऑप्शन्स रिकामे करा - select.empty(); - - // डिफॉल्ट सिलेक्ट पर्याय जोडा - select.append($("").attr("value", '').text('-- Select --')); - - // डॉक्टरांची यादी जोडा - contacts.forEach(function(itm) { - var option = $("") - .attr("value", itm.value) - .text(itm.display); - - if (itm.contact && itm.contact.msl_code) { - option.attr("msl_code", itm.contact.msl_code); - } - if (itm.contact && itm.contact.speciality) { - option.attr("speciality", itm.contact.speciality); - } - select.append(option); - }); - - // आता Select2 लागू करा - select.select2({ - width: "100%", - placeholder: "-- Select --", - allowClear: true - }); - - // Change event बांधा - select.off('change').on('change', function () { - var selected = $(this).find(':selected'); - var selectId = $(this).attr('id'); - var match = selectId.match(/^field-contact_id(_\d+)?$/); - var suffix = match && match[1] ? match[1] : ''; - - var mslCodeField = $('#field-msl_code' + suffix); - var specialityField = $('#field-speciality' + suffix); - - if (mslCodeField.length) { - mslCodeField.val(selected.attr('msl_code') || ''); - } - if (specialityField.length) { - specialityField.val(selected.attr('speciality') || ''); - } - - // डुप्लिकेट डॉक्टर निवडणे थांबवा - enforceUniqueDoctorSelections(); - }); -}); - -$("#pageloader").fadeOut(); + }); - @endif + @endif