From ccd681a52f5d22bd50d6763c9e483694ce7fb1ae Mon Sep 17 00:00:00 2001 From: zeeshan Date: Wed, 4 Nov 2026 16:16:32 +0530 Subject: [PATCH 1/7] Team 4 (Montair LC Kid ABM Conversion) Duplicate Doctor --- ...f76eca22-0891-4e77-88e8-56b43dd57c5e.blade.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/resources/views/form/rapport-team4/1793785288-f76eca22-0891-4e77-88e8-56b43dd57c5e.blade.php b/resources/views/form/rapport-team4/1793785288-f76eca22-0891-4e77-88e8-56b43dd57c5e.blade.php index 6d1fff65..e1db4266 100644 --- a/resources/views/form/rapport-team4/1793785288-f76eca22-0891-4e77-88e8-56b43dd57c5e.blade.php +++ b/resources/views/form/rapport-team4/1793785288-f76eca22-0891-4e77-88e8-56b43dd57c5e.blade.php @@ -44,9 +44,9 @@ $submissions = Formhelper::getMultiformData( $form->partition, $form_id, $form->user_id); $submissions = $submissions->data->submissions; - echo "
";
+                           /*  echo "
";
                             print_r($submissions);
-                            echo "
"; + echo "
"; */ @endphp @if(count($submissions) <=4) @@ -268,6 +268,9 @@ $("[id^='field-contact_id']").each(function() { var select = $(this); // Clear previous options + + var existingVal = select.val() || select.attr('data-preselected') || ''; + select.html(''); // Add a default 'Select' option select.append( @@ -290,6 +293,10 @@ select.append(option); }); + if (existingVal) { + select.val(existingVal); + } + // For each select element, add a change event handler to populate `msl_code` and `speciality` // We assume dropdowns and targets follow the pattern: // - select: field-contact_id_1, field-contact_id_2, ..., field-contact_id @@ -320,7 +327,11 @@ }); // Ensure unique selection is enforced after initial render + if(existingVal){ + select.trigger('change'); + }else{ enforceUniqueDoctorSelections(); + } }); // Enable search on doctor dropdowns From deb99ed0b85dd37c97cb4387d120655f56d9b9dd Mon Sep 17 00:00:00 2001 From: zeeshan Date: Wed, 4 Nov 2026 16:23:37 +0530 Subject: [PATCH 2/7] Team 4 (Montair LC Kid ABM Conversion) Duplicate Doctor --- .../1793785288-f76eca22-0891-4e77-88e8-56b43dd57c5e.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/views/form/rapport-team4/1793785288-f76eca22-0891-4e77-88e8-56b43dd57c5e.blade.php b/resources/views/form/rapport-team4/1793785288-f76eca22-0891-4e77-88e8-56b43dd57c5e.blade.php index e1db4266..c65cc825 100644 --- a/resources/views/form/rapport-team4/1793785288-f76eca22-0891-4e77-88e8-56b43dd57c5e.blade.php +++ b/resources/views/form/rapport-team4/1793785288-f76eca22-0891-4e77-88e8-56b43dd57c5e.blade.php @@ -79,7 +79,7 @@ @break @case('dropdown') - required == 'yes' ? 'required' : '' }}> @foreach ($question->options as $option) @if($question->code == 'contact_id' && isset($option->contact->type) && $option->contact->type == 'doctor' ) From 3a47f7e01602536ba7b7ae91be99ecb059b5a53c Mon Sep 17 00:00:00 2001 From: zeeshan Date: Wed, 4 Nov 2026 16:29:06 +0530 Subject: [PATCH 3/7] Team 4 (Montair LC Kid ABM Conversion) Printing Submissions --- .../1793785288-f76eca22-0891-4e77-88e8-56b43dd57c5e.blade.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/views/form/rapport-team4/1793785288-f76eca22-0891-4e77-88e8-56b43dd57c5e.blade.php b/resources/views/form/rapport-team4/1793785288-f76eca22-0891-4e77-88e8-56b43dd57c5e.blade.php index c65cc825..28501b85 100644 --- a/resources/views/form/rapport-team4/1793785288-f76eca22-0891-4e77-88e8-56b43dd57c5e.blade.php +++ b/resources/views/form/rapport-team4/1793785288-f76eca22-0891-4e77-88e8-56b43dd57c5e.blade.php @@ -44,9 +44,9 @@ $submissions = Formhelper::getMultiformData( $form->partition, $form_id, $form->user_id); $submissions = $submissions->data->submissions; - /* echo "
";
+                            echo "
";
                             print_r($submissions);
-                            echo "
"; */ + echo "
"; @endphp @if(count($submissions) <=4) From ab0ac794ac93055793299410cf8a8772bb197120 Mon Sep 17 00:00:00 2001 From: zeeshan Date: Wed, 4 Nov 2026 16:45:28 +0530 Subject: [PATCH 4/7] Team 4 (Montair LC Kid ABM Conversion) Already Added Doctor --- ...ca22-0891-4e77-88e8-56b43dd57c5e.blade.php | 52 ++++++++++++++++--- 1 file changed, 44 insertions(+), 8 deletions(-) diff --git a/resources/views/form/rapport-team4/1793785288-f76eca22-0891-4e77-88e8-56b43dd57c5e.blade.php b/resources/views/form/rapport-team4/1793785288-f76eca22-0891-4e77-88e8-56b43dd57c5e.blade.php index 28501b85..535307a7 100644 --- a/resources/views/form/rapport-team4/1793785288-f76eca22-0891-4e77-88e8-56b43dd57c5e.blade.php +++ b/resources/views/form/rapport-team4/1793785288-f76eca22-0891-4e77-88e8-56b43dd57c5e.blade.php @@ -41,14 +41,26 @@ @endif @php - $submissions = Formhelper::getMultiformData( $form->partition, $form_id, $form->user_id); - $submissions = $submissions->data->submissions; - - echo "
";
-                            print_r($submissions);
-                            echo "
"; + $currentRecordId = $id ?? null; + $alreadySubmittedDoctors = []; + if(isset($submissions) && is_array($submissions)) { + foreach($submissions as $sub) { + // Edit करताना सध्याचा रेकॉर्ड वगळा + if($currentRecordId && isset($sub->id) && $sub->id == $currentRecordId) { + continue; + } + if(isset($sub->formdata->contact_id) && !empty($sub->formdata->contact_id)) { + $alreadySubmittedDoctors[] = (string)$sub->formdata->contact_id; + } + if(isset($sub->formdata->cont_id) && !empty($sub->formdata->cont_id)) { + $alreadySubmittedDoctors[] = (string)$sub->formdata->cont_id; + } + } + } @endphp + + @if(count($submissions) <=4)
@@ -191,7 +203,7 @@ $('[data-toggle="select2"]').select2(); var hierarcies = []; var contacts = []; - + var submittedDoctors = {!! json_encode(array_values(array_unique($alreadySubmittedDoctors))) !!}; @if(isset($form->manager_can_submit) && $form->manager_can_submit == true) @foreach($form->users as $option) hierarcies.push('{{$option->hierarchy_id}}'); @@ -269,7 +281,11 @@ var select = $(this); // Clear previous options - var existingVal = select.val() || select.attr('data-preselected') || ''; + //var existingVal = select.val() || select.attr('data-preselected') || ''; + + var existingVal = select.attr('data-preselected') !== undefined && select.attr('data-preselected') !== '' + ? String(select.attr('data-preselected')) + : (select.val() ? String(select.val()) : ''); select.html(''); // Add a default 'Select' option @@ -280,6 +296,26 @@ ); // Append options from contacts contacts.forEach(function(itm) { + var itmVal = String(itm.value); + var itmText = itm.display; + + // चेक करा: डॉक्टरचे नाव किंवा व्हॅल्यू आधीच सबमिट झाली आहे का? + var isAlreadySubmitted = submittedDoctors.includes(itmVal) || submittedDoctors.includes(itmText); + + // जर Edit मोडमध्ये हाच डॉक्टर आधी सिलेक्ट केलेला असेल, तर त्याला Allow करा + var isCurrentSelected = (existingVal !== '' && (existingVal === itmVal || existingVal === itmText)); + + var displayText = itmText; + var isDisabled = false; + + if (isAlreadySubmitted && !isCurrentSelected) { + displayText += " - Already Added"; + isDisabled = true; + } + + + + var option = $("") .attr("value", itm.value) .text(itm.display); From 855a07e6cfcb376b99aa2f414c2d9e0c62fcffe6 Mon Sep 17 00:00:00 2001 From: zeeshan Date: Wed, 4 Nov 2026 16:54:28 +0530 Subject: [PATCH 5/7] Team 4 (Montair LC Kid ABM) --- ...ca22-0891-4e77-88e8-56b43dd57c5e.blade.php | 51 ++++++++++++------- 1 file changed, 33 insertions(+), 18 deletions(-) diff --git a/resources/views/form/rapport-team4/1793785288-f76eca22-0891-4e77-88e8-56b43dd57c5e.blade.php b/resources/views/form/rapport-team4/1793785288-f76eca22-0891-4e77-88e8-56b43dd57c5e.blade.php index 535307a7..1afd00a7 100644 --- a/resources/views/form/rapport-team4/1793785288-f76eca22-0891-4e77-88e8-56b43dd57c5e.blade.php +++ b/resources/views/form/rapport-team4/1793785288-f76eca22-0891-4e77-88e8-56b43dd57c5e.blade.php @@ -41,22 +41,37 @@ @endif @php - $currentRecordId = $id ?? null; - $alreadySubmittedDoctors = []; - if(isset($submissions) && is_array($submissions)) { - foreach($submissions as $sub) { - // Edit करताना सध्याचा रेकॉर्ड वगळा - if($currentRecordId && isset($sub->id) && $sub->id == $currentRecordId) { - continue; - } - if(isset($sub->formdata->contact_id) && !empty($sub->formdata->contact_id)) { - $alreadySubmittedDoctors[] = (string)$sub->formdata->contact_id; - } - if(isset($sub->formdata->cont_id) && !empty($sub->formdata->cont_id)) { - $alreadySubmittedDoctors[] = (string)$sub->formdata->cont_id; - } - } - } + @php +$submissions = Formhelper::getMultiformData($form->partition, $form_id, $form->user_id); +// 1. null safe check +$submissions = $submissions->data->submissions ?? []; + +$currentRecordId = $id ?? null; +$alreadySubmittedDoctors = []; + +if (!empty($submissions)) { + foreach ($submissions as $sub) { + $subObj = (object)$sub; // safe object cast + + + if ($currentRecordId && isset($subObj->id) && (string)$subObj->id === (string)$currentRecordId) { + continue; + } + + + if (isset($subObj->formdata)) { + $fData = (object)$subObj->formdata; + if (!empty($fData->contact_id)) { + $alreadySubmittedDoctors[] = (string)$fData->contact_id; + } + if (!empty($fData->cont_id)) { + $alreadySubmittedDoctors[] = (string)$fData->cont_id; + } + } + } +} +$alreadySubmittedDoctors = array_values(array_unique($alreadySubmittedDoctors)); +@endphp @endphp @@ -203,7 +218,7 @@ $('[data-toggle="select2"]').select2(); var hierarcies = []; var contacts = []; - var submittedDoctors = {!! json_encode(array_values(array_unique($alreadySubmittedDoctors))) !!}; + var submittedDoctors = @json($alreadySubmittedDoctors ?? []); @if(isset($form->manager_can_submit) && $form->manager_can_submit == true) @foreach($form->users as $option) hierarcies.push('{{$option->hierarchy_id}}'); @@ -279,7 +294,7 @@ $("[id^='field-contact_id']").each(function() { var select = $(this); - // Clear previous options + //var existingVal = select.val() || select.attr('data-preselected') || ''; From 77b3301134f17f58d38563c715bf94968e5aaf34 Mon Sep 17 00:00:00 2001 From: zeeshan Date: Wed, 4 Nov 2026 17:04:44 +0530 Subject: [PATCH 6/7] Team 4 (Montair LC Kid ABM Conversion) --- ...ca22-0891-4e77-88e8-56b43dd57c5e.blade.php | 30 ++++++++++++++----- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/resources/views/form/rapport-team4/1793785288-f76eca22-0891-4e77-88e8-56b43dd57c5e.blade.php b/resources/views/form/rapport-team4/1793785288-f76eca22-0891-4e77-88e8-56b43dd57c5e.blade.php index 1afd00a7..fa83cb7c 100644 --- a/resources/views/form/rapport-team4/1793785288-f76eca22-0891-4e77-88e8-56b43dd57c5e.blade.php +++ b/resources/views/form/rapport-team4/1793785288-f76eca22-0891-4e77-88e8-56b43dd57c5e.blade.php @@ -274,7 +274,7 @@ $alreadySubmittedDoctors = array_values(array_unique($alreadySubmittedDoctors)); var currentSelect = $(this); var currentVal = currentSelect.val() ? String(currentSelect.val()) : ""; - currentSelect.find("option").prop("disabled", false); + /* currentSelect.find("option").prop("disabled", false); // Disable values selected in OTHER selects (keep current selection enabled) selectedValues.forEach(function (v) { @@ -283,7 +283,23 @@ $alreadySubmittedDoctors = array_values(array_unique($alreadySubmittedDoctors)); .find("option[value=\"" + v.replace(/"/g, '\\"') + "\"]") .prop("disabled", true); } - }); + }); */ + + currentSelect.find("option").each(function () { + var opt = $(this); + var optVal = String(opt.val() || ''); + var optText = opt.text(); + + + if (optText.indexOf("Already Added") !== -1) { + opt.prop("disabled", true); // Already Added + } else if (optVal && selectedValues.includes(optVal) && optVal !== currentVal) { + opt.prop("disabled", true); + } else { + opt.prop("disabled", false); + } + }); + // Refresh select2 UI if present if (currentSelect.data("select2")) { @@ -314,15 +330,14 @@ $alreadySubmittedDoctors = array_values(array_unique($alreadySubmittedDoctors)); var itmVal = String(itm.value); var itmText = itm.display; - // चेक करा: डॉक्टरचे नाव किंवा व्हॅल्यू आधीच सबमिट झाली आहे का? + var isAlreadySubmitted = submittedDoctors.includes(itmVal) || submittedDoctors.includes(itmText); - - // जर Edit मोडमध्ये हाच डॉक्टर आधी सिलेक्ट केलेला असेल, तर त्याला Allow करा var isCurrentSelected = (existingVal !== '' && (existingVal === itmVal || existingVal === itmText)); var displayText = itmText; var isDisabled = false; + if (isAlreadySubmitted && !isCurrentSelected) { displayText += " - Already Added"; isDisabled = true; @@ -332,8 +347,9 @@ $alreadySubmittedDoctors = array_values(array_unique($alreadySubmittedDoctors)); var option = $("") - .attr("value", itm.value) - .text(itm.display); + .attr("value", itm.value) + .text(displayText) + .prop("disabled", isDisabled); // If doctor options have extra attributes if (itm.contact && itm.contact.msl_code) { option.attr("msl_code", itm.contact.msl_code); From b918138117631472a618eb2e749ba87a8857e9b8 Mon Sep 17 00:00:00 2001 From: zeeshan Date: Wed, 4 Nov 2026 17:12:24 +0530 Subject: [PATCH 7/7] Team 4 (Montair LC Kid ABM Conversion) --- ...ca22-0891-4e77-88e8-56b43dd57c5e.blade.php | 346 +++++------------- 1 file changed, 101 insertions(+), 245 deletions(-) diff --git a/resources/views/form/rapport-team4/1793785288-f76eca22-0891-4e77-88e8-56b43dd57c5e.blade.php b/resources/views/form/rapport-team4/1793785288-f76eca22-0891-4e77-88e8-56b43dd57c5e.blade.php index fa83cb7c..83be967e 100644 --- a/resources/views/form/rapport-team4/1793785288-f76eca22-0891-4e77-88e8-56b43dd57c5e.blade.php +++ b/resources/views/form/rapport-team4/1793785288-f76eca22-0891-4e77-88e8-56b43dd57c5e.blade.php @@ -41,42 +41,11 @@ @endif @php - @php -$submissions = Formhelper::getMultiformData($form->partition, $form_id, $form->user_id); -// 1. null safe check -$submissions = $submissions->data->submissions ?? []; - -$currentRecordId = $id ?? null; -$alreadySubmittedDoctors = []; - -if (!empty($submissions)) { - foreach ($submissions as $sub) { - $subObj = (object)$sub; // safe object cast - - - if ($currentRecordId && isset($subObj->id) && (string)$subObj->id === (string)$currentRecordId) { - continue; - } - - - if (isset($subObj->formdata)) { - $fData = (object)$subObj->formdata; - if (!empty($fData->contact_id)) { - $alreadySubmittedDoctors[] = (string)$fData->contact_id; - } - if (!empty($fData->cont_id)) { - $alreadySubmittedDoctors[] = (string)$fData->cont_id; - } - } - } -} -$alreadySubmittedDoctors = array_values(array_unique($alreadySubmittedDoctors)); -@endphp - + $submissions = Formhelper::getMultiformData($form->partition, $form_id, $form->user_id); + $submissions = isset($submissions->data->submissions) ? $submissions->data->submissions : []; @endphp - - @if(count($submissions) <=4) + @if(count($submissions) <= 4) @@ -106,35 +75,31 @@ $alreadySubmittedDoctors = array_values(array_unique($alreadySubmittedDoctors)); @break @case('dropdown') - required == 'yes' ? 'required' : '' }}> @foreach ($question->options as $option) - @if($question->code == 'contact_id' && isset($option->contact->type) && $option->contact->type == 'doctor' ) + @if($question->code == 'contact_id' && isset($option->contact->type) && $option->contact->type == 'doctor' ) @elseif($question->code != 'contact_id') - @endif - - - @endforeach - @break @case('checkbox') @foreach($question->options as $option)
- value) && $question->value != '' && in_array($option->value, $question->value) ? 'checked':''}}> + value) && $question->value != '' && in_array($option->value, (array)$question->value) ? 'checked':''}}>
@endforeach @@ -145,7 +110,6 @@ $alreadySubmittedDoctors = array_values(array_unique($alreadySubmittedDoctors)); @elseif(isset($question->value)) @endif - @break @case('multitextbox')
@@ -156,8 +120,7 @@ $alreadySubmittedDoctors = array_values(array_unique($alreadySubmittedDoctors));
@endforeach - @break - + @break @case('time') required == 'yes' ? 'required' : ''}} value="{{isset($question->value) ? $question->value : ''}}"> - @break - + @break @endswitch @endforeach @@ -179,19 +141,13 @@ $alreadySubmittedDoctors = array_values(array_unique($alreadySubmittedDoctors)); @else
You have already submitted 5 Doctors
@endif -
+
- - - - - + - - - +