Team 3 (Visit Form) UpdateDoctorDetail function
Specific Folder FTP Upload / ftp-deploy (push) Successful in 1m19s Details

This commit is contained in:
zeeshan 2026-11-25 16:41:04 +05:30
parent a9d6cdc940
commit 396a4110d6
1 changed files with 62 additions and 0 deletions

View File

@ -351,6 +351,68 @@
$('#report-form').append('<input type="hidden" name="l2manager_joint_visit" value="1" />');
}
// MSL Code and Speciality update function
function updateDoctorDetails() {
let visitType = $('#field-visit_type').val();
let selectedOption;
if (visitType === 'Doctor') {
selectedOption = $('#field-contact_id option:selected');
}
else if (visitType === 'Chemist') {
selectedOption = $('#field-chemist_name option:selected');
}
if (selectedOption && selectedOption.val()) {
$('#field-msl_code').val(selectedOption.attr('msl_code') || '');
$('#field-speciality').val(selectedOption.attr('speciality') || '');
}
}
// Doctor dropdown change
$('#field-contact_id').on('change', function () {
updateDoctorDetails();
});
// Chemist dropdown change
$('#field-chemist_name').on('change', function () {
updateDoctorDetails();
});
// Visit type change
$('#field-visit_type').on('change', function () {
let type = $(this).val();
if (type === 'Doctor') {
$('#field-contact_id').parent().show();
$('#field-contact_id').attr('required', true);
$('#field-chemist_name').parent().hide();
$('#field-chemist_name').attr('required', false);
}
else if (type === 'Chemist') {
$('#field-chemist_name').parent().show();
$('#field-chemist_name').attr('required', true);
$('#field-contact_id').parent().hide();
$('#field-contact_id').attr('required', false);
}
else {
$('#field-contact_id, #field-chemist_name').parent().hide();
$('#field-contact_id, #field-chemist_name').attr('required', false);
}
updateDoctorDetails();
});
// Initial load - Edit mode
updateDoctorDetails();