From 98131001644a173b36ccee0d8c8aeb5bd372f94c Mon Sep 17 00:00:00 2001 From: Tanuja Pansare Date: Fri, 4 Sep 2026 17:39:04 +0530 Subject: [PATCH] Team 4 Form changes MONTAIR LC Kid Dr Conversion --- ...f5ac-f7a7-477b-926f-62a066a6c718.blade.php | 84 +++++++++++-------- 1 file changed, 47 insertions(+), 37 deletions(-) diff --git a/resources/views/form/rapport-team4/1788495344-e823f5ac-f7a7-477b-926f-62a066a6c718.blade.php b/resources/views/form/rapport-team4/1788495344-e823f5ac-f7a7-477b-926f-62a066a6c718.blade.php index d641fdec..845ce6e5 100644 --- a/resources/views/form/rapport-team4/1788495344-e823f5ac-f7a7-477b-926f-62a066a6c718.blade.php +++ b/resources/views/form/rapport-team4/1788495344-e823f5ac-f7a7-477b-926f-62a066a6c718.blade.php @@ -93,8 +93,14 @@ @case('email') @case('tel') @case('date') - required == 'yes'?'required':'' }} value="{{isset($question->value)?$question->value:''}}"> - @break + required == 'yes'?'required':'' }} + value="{{isset($question->value)?$question->value:''}}" + {{$question->code == 'legacy_code' ? 'readonly' : ''}}> + @break @case('number') ") .attr("value", itm.value) .text(itm.display) - .attr("legacy_code", itm.contact.legacy_code) + .attr("msl_code", itm.contact.legacy_code) .attr("speciality", itm.contact.speciality) ); } @@ -374,45 +380,49 @@ function preventDuplicateDoctors() { console.log(hierarchy); }); - $('#report-form').on('submit', function(event){ - event.preventDefault(); - $("#pageloader").fadeIn(); - $.ajax({ - type: "POST", - url: '/form/ajaxsubmit', - data: new FormData($('#report-form')[0]), - processData: false, - contentType: false, - success: function(data) { + $('#report-form').on('submit', function(event){ + event.preventDefault(); - console.log("FULL DOCTOR DATA:", data); + $("#pageloader").fadeIn(); - /*for (let itm of data) { - console.log("DOCTOR:", itm); - console.log("LEGACY CODE:", itm.legacy_code); - console.log("CONTACT:", itm.contact); - console.log("CONTACT LEGACY CODE:", itm.contact ? itm.contact.legacy_code : 'NO CONTACT'); - }*/ + $.ajax({ + type: "POST", + url: '/form/ajaxsubmit', + data: new FormData($('#report-form')[0]), + processData: false, + contentType: false, - $("#pageloader").fadeOut(); + success: function(data) { - $('#field-contact_id').html(''); - $('#field-contact_id').append( - $("") - .attr("value", '') - .text('-- Select --') - ); + $("#pageloader").fadeOut(); - for(let itm of data) { - $('#field-contact_id').append( - $("") - .attr("value", itm.value) - .text(itm.display) - ); - } -}, - }); - }); + if(data.status == 'success') { + + Swal.fire({ + title: 'Great!', + text: 'Your data is successfully submitted!', + icon: 'success' + }); + + $('#report-form').trigger("reset"); + + } else { + + Swal.fire({ + icon: 'error', + title: data.hasOwnProperty('message') + ? 'You are not mapped to any position code' + : 'Data not submitted', + + text: data.hasOwnProperty('message') + ? 'for resolution please email Position code, L1 Manager and L2 Manager details to support1@stratawiz.com' + : 'Something went wrong, please try again after some time!' + }); + + } + } + }); +}); $('#field-contact_id').change(function() {