From 6d96a86e3f0ad242d04e56e90aa454481c6d60f8 Mon Sep 17 00:00:00 2001 From: zeeshan Date: Sat, 10 Oct 2026 11:33:45 +0530 Subject: [PATCH] Team 4 (Mother Forum) Speciality , msl code readonly --- ...2f9a-fe45-4b16-843a-224f07ed0d7b.blade.php | 191 ++++++++---------- 1 file changed, 83 insertions(+), 108 deletions(-) diff --git a/resources/views/form/rapport-team4/1791539482-b06c2f9a-fe45-4b16-843a-224f07ed0d7b.blade.php b/resources/views/form/rapport-team4/1791539482-b06c2f9a-fe45-4b16-843a-224f07ed0d7b.blade.php index a38549eb..3e8c2210 100644 --- a/resources/views/form/rapport-team4/1791539482-b06c2f9a-fe45-4b16-843a-224f07ed0d7b.blade.php +++ b/resources/views/form/rapport-team4/1791539482-b06c2f9a-fe45-4b16-843a-224f07ed0d7b.blade.php @@ -80,59 +80,32 @@ @case('dropdown') - @php - - $submittedMonths = []; - if (isset($submissions) && is_array($submissions)) { - foreach ($submissions as $sub) { - - if (isset($id) && $id && isset($sub->id) && $sub->id == $id) { - continue; - } + - - $monthVal = $sub->month ?? ($sub->data->month ?? null); - if ($monthVal) { - $submittedMonths[] = trim($monthVal); - } - } - } - @endphp - - @break @break @case('checkbox') @foreach($question->options as $option) @@ -292,75 +265,77 @@ } $("[id^='field-contact_id']").each(function() { - var select = $(this); + var select = $(this); - - var existingVal = select.attr('data-initial-value') || select.val(); + + var existingVal = select.attr('data-initial-value') || select.val(); - - select.empty(); + + select.empty(); - // Default option - select.append($("").attr("value", '').text('-- Select --')); + // Default option + select.append($("").attr("value", '').text('-- Select --')); - - contacts.forEach(function(itm) { - var option = $("") - .attr("value", itm.value) - .text(itm.display); + + 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); - }); + 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); + }); - - if (existingVal) { - select.val(String(existingVal)); - } + + if (existingVal) { + select.val(String(existingVal)); + } - - 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] : ''; + + 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); + 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') || ''); - } + if (mslCodeField.length) { + mslCodeField.val(selected.attr('msl_code') || ''); + } + if (specialityField.length) { + specialityField.val(selected.attr('speciality') || ''); + } - enforceUniqueDoctorSelections(); - }); - }); - - - applySelect2ToDoctorDropdowns(); - - - $("[id^='field-contact_id']").each(function() { - var select = $(this); - var existingVal = select.attr('data-initial-value'); - if (existingVal) { - select.val(String(existingVal)).trigger('change'); - } - }); - - $("#pageloader").fadeOut(); - - + enforceUniqueDoctorSelections(); + }); }); + + applySelect2ToDoctorDropdowns(); + + + $("[id^='field-msl_code'], [id^='field-speciality']").prop('readonly', true); + + $("[id^='field-contact_id']").each(function() { + var select = $(this); + var existingVal = select.attr('data-initial-value'); + if (existingVal) { + select.val(String(existingVal)).trigger('change'); + } + }); + + $("#pageloader").fadeOut(); + + + }); + @endif