From db2179994450c5ba5ff7e59ce877d343c8a019c2 Mon Sep 17 00:00:00 2001 From: zeeshan Date: Fri, 7 Aug 2026 15:09:01 +0530 Subject: [PATCH] Titans (Report Novel Meet) --- ...118d-3199-483f-bbae-1b8f5d0f24e8.blade.php | 162 ++++++++++++++++++ 1 file changed, 162 insertions(+) diff --git a/resources/views/form/rapport-titans/1781589472-85f7118d-3199-483f-bbae-1b8f5d0f24e8.blade.php b/resources/views/form/rapport-titans/1781589472-85f7118d-3199-483f-bbae-1b8f5d0f24e8.blade.php index 7f5f89b5..d8fdf8db 100644 --- a/resources/views/form/rapport-titans/1781589472-85f7118d-3199-483f-bbae-1b8f5d0f24e8.blade.php +++ b/resources/views/form/rapport-titans/1781589472-85f7118d-3199-483f-bbae-1b8f5d0f24e8.blade.php @@ -117,6 +117,19 @@ @if ($id) @endif + @if(isset($form->manager_can_submit) && $form->manager_can_submit == true) +
+ + + +
+ @endif + @foreach ($questions as $question) @if (in_array($question->code, ['execution_date','actual_no_of_attendees' ,'hcp_name','pcode_of_wrapper_doctor','speaker_name','venue','time','eas_id'])) @continue @@ -401,6 +414,53 @@ $('#field-eas_amt').on('input', function () { this.value = this.value.replace(/\D/g, ''); }); + $('#field-user_id').change(function(){ + let hierarchy = $('option:selected', this).attr('hierarchy'); + $('#field-hierarchy_id').val(hierarchy) + event.preventDefault(); + $("#pageloader").fadeIn(); + $.ajax({ + type: "GET", + url: '/form/getdoctorlist?partition={{$form->partition}}&hierarchy='+hierarchy, + processData: false, + contentType: false, + success: function( data ) { + $("#pageloader").fadeOut(); + $('#field-contact_id').html('') + $('#field-contact_id').append($("").attr("value",'').text('-- Select --')); + for (let itm of data) { + $('#field-contact_id').append($("").attr("value",itm.value).text(itm.display).attr("msl_code", itm.contact.msl_code).attr('speciality',itm.contact.speciality)); + } + + /* New Code */ + let $doctorSelects = $('[id^="field-hcp_name"]'); + $doctorSelects.each(function() { + let $select = $(this); + $select.empty().append($("").attr("value", "").text("-- Select --")); + for (let itm of data) { + $select.append( + $("") + .attr("value", itm.value) + .text(itm.display) + .attr("msl_code", itm.contact ? itm.contact.msl_code : "") + .attr("speciality", itm.contact ? itm.contact.speciality : "") + ); + } + }); + /* End of New Code */ + + $('#field-contact_id').change(function() { + $('#field-msl_code').val($('option:selected', this).attr('msl_code')) + }) + + $('#field-contact_id').change(function() { + $('#field-speciality').val($('option:selected', this).attr('speciality')) + }) + }, + }); + + console.log(hierarchy) + }) $('#form-wrapper').hide() $('#execution-form-wrapper').hide() var count = 1 @@ -648,6 +708,9 @@ }); + + + $('.edit-btn').click(function() { $('#execution-form-wrapper').show(100, () => { $('#add-camp-btn').hide(0); @@ -720,10 +783,109 @@ el.readOnly = true; }); + let hierarchy = selected['hierarchy_id'] || $('#field-hierarchy_id').val(); + + console.log("Execution Hierarchy:", hierarchy); + console.log("Selected Doctor:", selected['contact_id']); + + if (hierarchy) { + + $("#pageloader").fadeIn(); + + $.ajax({ + type: "GET", + url: '/form/getdoctorlist?partition={{$form->partition}}&hierarchy=' + hierarchy, + + success: function(data) { + + $("#pageloader").fadeOut(); + + let $executionContact = $('#execution-contact_id'); + + $executionContact.empty(); + + $executionContact.append( + $("") + .attr("value", "") + .text("-- Select --") + ); + + for (let itm of data) { + + $executionContact.append( + $("") + .attr("value", itm.value) + .text(itm.display) + .attr("msl_code", itm.contact ? itm.contact.msl_code : "") + .attr("speciality", itm.contact ? itm.contact.speciality : "") + ); + + } + + // ========================================================= + // NEW CODE START: Populate Add Attendee / Speaker dropdowns for Manager Execution + // ========================================================= + let $doctorSelects = $('[id^="field-hcp_name"]'); + $doctorSelects.each(function() { + let $select = $(this); + let currentVal = $select.val(); + $select.empty().append($("").attr("value", "").text("-- Select --")); + for (let itm of data) { + $select.append( + $("") + .attr("value", itm.value) + .text(itm.display) + .attr("msl_code", itm.contact ? itm.contact.msl_code : "") + .attr("speciality", itm.contact ? itm.contact.speciality : "") + ); + } + if (currentVal) { + $select.val(currentVal); + } + }); + // ========================================================= + // NEW CODE END + // ========================================================= + + + + // Selected doctor select करा + if (selected['contact_id']) { + + let contactId = selected['contact_id'].trim(); + + let $option = $executionContact.find('option').filter(function() { + return $(this).text().trim() === contactId || + $(this).val() === contactId; + }).first(); + + if ($option.length) { + $executionContact.val($option.val()).trigger('change'); + } + } + + }, + + error: function(xhr) { + + $("#pageloader").fadeOut(); + + console.error( + "Doctor loading failed:", + xhr.responseText + ); + + } + + + }); + } }) + + $('#report-form').on('submit', function(event) { event.preventDefault();