Team 3 (Visit Form) UpdateDoctorDetail function
Specific Folder FTP Upload / ftp-deploy (push) Successful in 1m19s
Details
Specific Folder FTP Upload / ftp-deploy (push) Successful in 1m19s
Details
This commit is contained in:
parent
a9d6cdc940
commit
396a4110d6
|
|
@ -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();
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue