diff --git a/resources/views/form/rapport-titans/1790327878-266dd3f9-1f3b-4e1a-ac41-4f45fb93ff15.blade.php b/resources/views/form/rapport-titans/1790327878-266dd3f9-1f3b-4e1a-ac41-4f45fb93ff15.blade.php index 83b62e72..4f9d4afe 100644 --- a/resources/views/form/rapport-titans/1790327878-266dd3f9-1f3b-4e1a-ac41-4f45fb93ff15.blade.php +++ b/resources/views/form/rapport-titans/1790327878-266dd3f9-1f3b-4e1a-ac41-4f45fb93ff15.blade.php @@ -74,7 +74,7 @@ class="form-control" {{$question->required == 'yes'?'required':'' }} value="{{isset($question->value) ? $question->value : ($question->code == 'record_date' ? date('Y-m-d') : '')}}" - {{ $question->code == 'record_date' ? 'readonly' : '' }}> + {{ in_array($question->code, ['record_date', 'msl_code']) ? 'readonly' : '' }}> @break @case('number') required == 'yes'?'required':'' }} value="{{isset($question->value)?$question->value:0}}"> diff --git a/resources/views/form/rapport-zenova/1788239728-6f7f3c27-c5dc-4e6e-a042-aefd5681af3a.blade.php b/resources/views/form/rapport-zenova/1788239728-6f7f3c27-c5dc-4e6e-a042-aefd5681af3a.blade.php index b14a861f..7e19f005 100644 --- a/resources/views/form/rapport-zenova/1788239728-6f7f3c27-c5dc-4e6e-a042-aefd5681af3a.blade.php +++ b/resources/views/form/rapport-zenova/1788239728-6f7f3c27-c5dc-4e6e-a042-aefd5681af3a.blade.php @@ -229,7 +229,20 @@ $('#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).attr("absi_camp", itm.contact.absi_camp || '')); + + let absiCamp = itm.contact.absi_camp; + + console.log("Doctor:", itm.display); + console.log("ABSI from API:", absiCamp); + + $('#field-contact_id').append( + $("") + .attr("value", itm.value) + .text(itm.display) + .attr("msl_code", itm.contact.msl_code || '') + .attr("speciality", itm.contact.speciality || '') + .attr("absi_camp", absiCamp || '') + ); } $('#field-contact_id').change(function() { @@ -300,9 +313,27 @@ $('#field-contact_id').change(function() { - $('#field-absi_camp').val( - $('option:selected', this).attr('absi_camp') || '' - ); + + const selectedDoctor = $('option:selected', this); + + let absiCamp = selectedDoctor.attr('absi_camp') || ''; + + console.log("Selected doctor:", selectedDoctor.text()); + console.log("ABSI attribute:", absiCamp); + + // Convert 1/0 to Yes/No if required + if (absiCamp == 1 || absiCamp === '1') { + absiCamp = 'Yes'; + } + else if (absiCamp == 0 || absiCamp === '0') { + absiCamp = 'No'; + } + + $('#field-absi_camp').val(absiCamp); + + // This will show/hide No of Patients Screened + toggleAbsiPatientsField(); + }); @@ -314,9 +345,71 @@ ); }); + $('#field-pmos_dr').on('change',function(){ + let value=$(this).val(); + if(value=='Yes'){ + $('#report-form').append('') + } + }) + + $('#field-qbs_dr').on('change',function(){ + let value=$(this).val(); + if(value=='Yes'){ + $('#report-form').append('') + } + }) + + $('#field-adboard_dr').on('change',function(){ + let value=$(this).val(); + if(value=='Yes'){ + $('#report-form').append('') + } + }) + + $('#field-fb_live_dr').on('change',function(){ + let value=$(this).val(); + if(value=='Yes'){ + $('#report-form').append('') + } + }) + + $('#field-ecme_dr').on('change',function(){ + let value=$(this).val(); + if(value=='Yes'){ + $('#report-form').append('') + } + }) + + $('#field-rtm_dr').on('change',function(){ + let value=$(this).val(); + if(value=='Yes'){ + $('#report-form').append('') + } + }) + + $('#field-absi_camp').on('change', function(){ + + let value = $(this).val(); + + if(value == 'Yes'){ + $('#report-form input[name="absi_camp_count"]').val(1); + } else { + $('#report-form input[name="absi_camp_count"]').val(0); + } + + toggleAbsiPatientsField(); + + }); - - + + $('#field-h1_cardio_conference').on('change',function(){ + let value=$(this).val(); + if(value=='Yes'){ + $('#report-form').append('') + } + }) + + $('#field-msl_code,#field-speciality').attr('readonly',true); @@ -334,19 +427,59 @@ ].join(','); function toggleFields(selector, show) { - $(selector).parent().toggle(show); - $(selector).prop('required', show); + $(selector).parent().toggle(show); + $(selector).prop('required', show); + } + + function toggleAbsiPatientsField() { + + let absiCamp = $('#field-absi_camp').val(); + const brand = $('#field-select_brand').val(); + + // Convert stored 1/0 values to Yes/No + if (absiCamp == 1 || absiCamp === '1') { + absiCamp = 'Yes'; + $('#field-absi_camp').val('Yes'); + } + else if (absiCamp == 0 || absiCamp === '0') { + absiCamp = 'No'; + $('#field-absi_camp').val('No'); + } + + const $patientsField = $('#field-no_of_patients_screened'); + const $patientsWrapper = $patientsField.closest('.col-md-12'); + + console.log("Brand:", brand); + console.log("ABSI:", absiCamp); + + if (brand === 'Glipiq' && absiCamp === 'Yes') { + + $patientsWrapper.show(); + $patientsField.prop('required', true); + + } else { + + $patientsField.val(''); + $patientsWrapper.hide(); + $patientsField.prop('required', false); + + } } // Initial hide toggleFields(glipiFields, false); toggleFields(sitazitFields, false); + $('#field-no_of_patients_screened').parent().hide(); + $('#field-no_of_patients_screened').prop('required', false); + + $('#field-select_brand').on('change', function () { const brand = $(this).val(); console.log("Brand is :",brand); toggleFields(glipiFields, brand === 'Glipiq'); toggleFields(sitazitFields, brand === 'Sitazit'); + toggleAbsiPatientsField(); if(brand==='Glipiq'){ /* $('#report-form').append(''); @@ -397,6 +530,7 @@ $('#field-absi_camp').val(""); $('#field-h1_cardio_conference').val(""); + toggleAbsiPatientsField(); $('#report-form input[name="glipiq_new_conversion"]').val(0); $('#report-form input[name="glipiq_existing_conversion"]').val(0); $('#report-form input[name="glipiq_rx_total"]').val(0);