Team 3 (Visit Form) Update MSL code
Specific Folder FTP Upload / ftp-deploy (push) Successful in 1m20s Details

This commit is contained in:
zeeshan 2026-11-25 16:51:11 +05:30
parent 396a4110d6
commit 622adecf6e
1 changed files with 64 additions and 29 deletions

View File

@ -272,7 +272,7 @@
$('#field-contact_id,#field-chemist_name').attr('required',false);
$('#field-visit_type').on('change',function(){
/* $('#field-visit_type').on('change',function(){
let type=$(this).val();
console.log("Value is : ",type);
if(type==='Doctor'){
@ -291,7 +291,69 @@
$('#field-contact_id,#field-chemist_name').parent().hide();
$('#field-contact_id,#field-chemist_name').attr('required',false);
}
})
}) */
// 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();
@ -354,34 +416,7 @@
// 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 () {