From 9c06ea08929136b32c945bb4c58269dddda45242 Mon Sep 17 00:00:00 2001 From: Farhan Pathan Date: Thu, 25 Jun 2026 16:59:54 +0530 Subject: [PATCH] Team4 - Molecule Identification form Changes (25/06/2026) --- ...f382-9fbb-45ac-896b-94de9104a11b.blade.php | 52 ++++++++++++++++--- 1 file changed, 45 insertions(+), 7 deletions(-) diff --git a/resources/views/form/rapport-team4/1781090899-2cedf382-9fbb-45ac-896b-94de9104a11b.blade.php b/resources/views/form/rapport-team4/1781090899-2cedf382-9fbb-45ac-896b-94de9104a11b.blade.php index a82d905e..79190679 100644 --- a/resources/views/form/rapport-team4/1781090899-2cedf382-9fbb-45ac-896b-94de9104a11b.blade.php +++ b/resources/views/form/rapport-team4/1781090899-2cedf382-9fbb-45ac-896b-94de9104a11b.blade.php @@ -590,6 +590,14 @@ select option:disabled { prefillDoctorTableSection($(this), $(this).data('category')); }); } + function refreshAllDropdownRules(){ + updateDoctorDropdowns(); + updateOtherMoleculeOptions(); + + $('.doctor-row').each(function(){ + toggleOtherMoleculeRxSupport($(this)); + }); + } function checkOtherRxHeader(){ let visible = false; @@ -991,7 +999,7 @@ function updateOtherMoleculeOptions() { }); } - function updateOtherMoleculeDropdowns($tbody) { + /* function updateOtherMoleculeDropdowns($tbody) { let sectionMolecule = $tbody.data('molecule-use'); $tbody.find('.other-molecule-select').each(function() { @@ -1011,7 +1019,7 @@ function updateOtherMoleculeOptions() { } }); }); - } + }*/ function buildSubmitFormData() { let fd = new FormData(); @@ -1101,21 +1109,51 @@ function updateOtherMoleculeOptions() { }); prefillAllDoctorTables(); + refreshAllDropdownRules(); - /* $('.doctor-table-body').each(function() { - let $tbody = $(this); - updateOtherMoleculeDropdowns($tbody); - updateDoctorDropdowns($tbody); - }); */ + /* $('.doctor-table-body').each(function() { let $tbody = $(this); updateOtherMoleculeDropdowns($tbody); }); + */ updateDoctorDropdowns(); $('#report-form').on('submit', function(event) { event.preventDefault(); + let isValid = true; + let errorMsg = ''; + + $('.doctor-row').each(function(index){ + + let doctor = $(this).find('.doctor-select').val(); + let rx = $(this).find('.rx-support-select').val(); + let other = $(this).find('.other-molecule-select').val(); + let otherRx = $(this).find('.other-molecule-rx-support').val(); + + if(!doctor || !rx || !other){ + isValid = false; + errorMsg = 'Please fill all Doctor, Rxn/Week Support and Other Molecule Use fields.'; + return false; + } + + if(other !== 'No' && !otherRx){ + isValid = false; + errorMsg = 'Please fill Other Molecule Rxn/Week Support.'; + return false; + } + + }); + + if(!isValid){ + Swal.fire({ + icon: 'warning', + title: 'Validation Error', + text: errorMsg + }); + return; + } $("#pageloader").fadeIn(); $.ajax({