From 7704441d728eb63c5c4d4d49360b9efb5339f035 Mon Sep 17 00:00:00 2001 From: zeeshan Date: Mon, 16 Nov 2026 20:34:17 +0530 Subject: [PATCH 1/3] Team 2 (Lung Manager Programme) --- ...ffaa-1b76-40c8-800b-6b2d3c801016.blade.php | 635 +++++++++--------- 1 file changed, 325 insertions(+), 310 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 a685e74b..95bba942 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 @@ -7,37 +7,45 @@
@@ -60,7 +68,8 @@

{{$form->title}}

- @if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes' ) ) + @if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes' + ) )
@if($form->link_type == 'form') View History @@ -77,7 +86,9 @@ @php $submissions = Formhelper::getMultiformData( $form->partition, $form_id, $form->user_id); - $submissions = isset($submissions->data->submissions) ? $submissions->data->submissions : []; + $submissions = $submissions->data->submissions; + + @endphp @if(count($submissions)===0 || $id)
@@ -86,23 +97,9 @@ @if($id) @endif - - - @if(isset($form->manager_can_submit) && $form->manager_can_submit == true) - - @endif - @foreach($questions as $question) - @if( !in_array($question->code, ["record_date","select_rxber_type"] ) ) + @if( !in_array($question->code, + ["record_date","select_rxber_type"] ) ) @continue; @endif
@@ -137,22 +134,23 @@ @break @case('dropdown') + + @foreach ($question->options as $option) + + + @endforeach + @break @endswitch
@endforeach - -
+ @foreach($questions as $question) - @if( in_array($question->code, ["record_date","select_rxber_type"] ) ) + @if( in_array($question->code, + ["record_date","select_rxber_type"] ) ) @continue; @endif
@@ -187,33 +185,37 @@ @break @case('dropdown') @if ($question->code == 'contact_id') - + @else - - @endif + + @endif @break @case('checkbox') @foreach($question->options as $option) @@ -221,7 +223,7 @@ value) && $question->value != '' && in_array($option->value, (array)$question->value) ? 'checked':''}}> + {{isset($question->value) && $question->value != '' && in_array($option->value, $question->value) ? 'checked':''}}>
@@ -236,6 +238,7 @@ @elseif(isset($question->value)) @endif + @break @case('multitextbox')
@@ -253,17 +256,14 @@
@endforeach
- - {{-- उर्वरित 4 Wrappers येथे आपोआप अ‍ॅड होतील --}}
- - @if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes' ) ) + @if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != + 'yes' ) )
- {{-- 3) Add Doctor बटण Hide केले आहे --}} @if(!$id) - + @endif
@@ -274,11 +274,17 @@ @endif
+ + + + + + - + - @include('layouts.shared/footer-script') - \ No newline at end of file + + From 885095ae3e307216f1de38083c29ba6b56e033db Mon Sep 17 00:00:00 2001 From: zeeshan Date: Mon, 16 Nov 2026 20:46:21 +0530 Subject: [PATCH 2/3] Team 2 (Lung Manager Programme) --- .../1794811995-cd07ffaa-1b76-40c8-800b-6b2d3c801016.blade.php | 4 ++-- 1 file changed, 2 insertions(+), 2 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 95bba942..3a6b7818 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 @@ -191,7 +191,7 @@ @foreach ($question->options as $option) - + @if($question->code == 'contact_id' && isset($option->contact->type) && $option->contact->type == 'doctor' ) - + @endif @endforeach @else From 8f1381d6aa0224142f1bc39ba29b6d263ad0d91d Mon Sep 17 00:00:00 2001 From: zeeshan Date: Mon, 16 Nov 2026 21:05:55 +0530 Subject: [PATCH 3/3] Team 2 (Lung Manager Programme) Duplicate Doctor --- ...ffaa-1b76-40c8-800b-6b2d3c801016.blade.php | 130 +++++++++++++++++- 1 file changed, 128 insertions(+), 2 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 3a6b7818..3a3272cd 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 @@ -356,7 +356,7 @@ $('#field-speciality' + suffix).val(selectedOption.attr('speciality') || ''); } - function preventDuplicateDoctors() { + /* function preventDuplicateDoctors() { const selectedValues = []; $('select[id^="field-contact_id"]').each(function () { @@ -388,8 +388,80 @@ $select.select2({ width: '100%', placeholder: '-- Select Doctor --' }); $select.val(oldValue).trigger('change.select2'); }); + } */ + + function preventDuplicateDoctors() { + + const selectedValues = []; + + // Get all selected doctor IDs + $('select[id^="field-contact_id"]').each(function () { + + const value = $(this).val(); + + if (value) { + selectedValues.push(String(value)); + } + + }); + + // Disable already selected doctors in other dropdowns + $('select[id^="field-contact_id"]').each(function () { + + const $select = $(this); + + const currentValue = $select.val() + ? String($select.val()) + : ''; + + $select.find('option').each(function () { + + const $option = $(this); + const optionValue = String($option.val() || ''); + + if (!optionValue) return; + + const cleanText = $option.text() + .replace(' (Already Added)', ''); + + if ( + selectedValues.includes(optionValue) && + optionValue !== currentValue + ) { + + $option.prop('disabled', true); + + $option.text(cleanText + ' (Already Added)'); + + } else { + + $option.prop('disabled', false); + + $option.text(cleanText); + + } + + }); + + // Refresh Select2 + const oldValue = $select.val(); + + if ($select.hasClass('select2-hidden-accessible')) { + $select.select2('destroy'); + } + + $select.select2({ + width: '100%', + placeholder: '-- Select Doctor --' + }); + + $select.val(oldValue).trigger('change.select2'); + + }); + } + // All doctor dropdowns use the same change handler, including added wrappers. $(document).on('change', 'select[id^="field-contact_id"]', function () { updateDoctorMeta($(this)); @@ -425,7 +497,7 @@ Promise.all(requests).then(function (responses) { const doctorMap = new Map(); - responses.forEach(function (data) { + /* responses.forEach(function (data) { if (!Array.isArray(data)) return; data.forEach(function (doctor) { @@ -433,8 +505,40 @@ const key = String(doctor.value); if (!doctorMap.has(key)) doctorMap.set(key, doctor); }); + }); */ + + responses.forEach(function (data) { + if (!Array.isArray(data)) return; + + data.forEach(function (doctor) { + + if (!doctor || !doctor.contact) return; + + // Only Doctor type contacts + const contactType = String(doctor.contact.type || '').toLowerCase(); + + if (contactType !== 'doctor') { + return; + } + + if ( + doctor.value === undefined || + doctor.value === null || + doctor.value === '' + ) { + return; + } + + const key = String(doctor.value); + + // Remove duplicate doctor records + if (!doctorMap.has(key)) { + doctorMap.set(key, doctor); + } + }); }); + const allDoctors = Array.from(doctorMap.values()).sort(function (a, b) { return String(a.display || '').localeCompare(String(b.display || ''), 'en', { sensitivity: 'base' }); }); @@ -559,6 +663,28 @@ return !!$(this).val(); }).length; + + const selectedDoctorIds = []; + + $('select[id^="field-contact_id"]').each(function () { + + const doctorId = $(this).val(); + + if (doctorId) { + selectedDoctorIds.push(String(doctorId)); + } + + }); + + const uniqueDoctorIds = [...new Set(selectedDoctorIds)]; + + if (selectedDoctorIds.length !== uniqueDoctorIds.length) { + + alert('Duplicate doctors are not allowed.'); + + return; + } + if (!isEditMode && selectedDoctorCount !== 10) { alert('You must select exactly 10 doctors. Currently selected: ' + selectedDoctorCount); return;