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) {