From c3308b28853c321334c683acafe3d73ae2980a99 Mon Sep 17 00:00:00 2001 From: zeeshan Date: Sat, 21 Nov 2026 17:44:22 +0530 Subject: [PATCH] Team 2 (Lung Care Programme) Add Doctor Code Fix --- ...ffaa-1b76-40c8-800b-6b2d3c801016.blade.php | 25 ++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/resources/views/form/rapport-team2/1794811995-cd07ffaa-1b76-40c8-800b-6b2d3c801016.blade.php b/resources/views/form/rapport-team2/1794811995-cd07ffaa-1b76-40c8-800b-6b2d3c801016.blade.php index d8712b35..39869f7f 100644 --- a/resources/views/form/rapport-team2/1794811995-cd07ffaa-1b76-40c8-800b-6b2d3c801016.blade.php +++ b/resources/views/form/rapport-team2/1794811995-cd07ffaa-1b76-40c8-800b-6b2d3c801016.blade.php @@ -347,7 +347,7 @@ }); } - function updateDoctorMeta($select) { + /*function updateDoctorMeta($select) { const selectedOption = $select.find(':selected'); const selectId = $select.attr('id'); let suffix = ''; @@ -358,8 +358,20 @@ $('#field-msl_code' + suffix).val(selectedOption.attr('msl_code') || ''); $('#field-speciality' + suffix).val(selectedOption.attr('speciality') || ''); + }*/ + + + function updateDoctorMeta($select) { + const selectedOption = $select.find(':selected'); + const $wrapper = $select.closest('.doctor-wrapper'); + + $wrapper.find('input[id^="field-msl_code"]').val(selectedOption.attr('msl_code') || ''); + $wrapper.find('input[id^="field-speciality"]').val(selectedOption.attr('speciality') || ''); } + + + /* function preventDuplicateDoctors() { const selectedValues = []; @@ -654,7 +666,14 @@ $('#doctor-group-wrapper').append(empty_doctor); - const $newDoctorSelect = $('#field-contact_id-' + doctor_count); + const $newDoctorSelect = $('#field-contact_id-' + doctor_count); + + $newDoctorSelect.find('option').prop('selected', false).prop('disabled', false).each(function() { + $(this).text($(this).text().replace(' (Already Added)', '')); + }); + $newDoctorSelect.val(''); + + initializeSelect2($newDoctorSelect); $('#field-msl_code-' + doctor_count + ', #field-speciality-' + doctor_count).attr('readonly', true); initializeExecutionSelects(); @@ -674,7 +693,7 @@ }); $wrapper.remove(); preventDuplicateDoctors(); - if ($('.doctor-wrapper').length < 10) $('#adddoctor-btn').show(); + if ($('.doctor-wrapper').length < 5) $('#adddoctor-btn').show(); }); $('#report-form').on('submit', function (event) {