mirror of
https://github.com/frappe/erpnext.git
synced 2026-03-19 10:14:59 +00:00
fix: make check availability as the primary action button
This commit is contained in:
@@ -29,6 +29,19 @@ frappe.ui.form.on('Patient Appointment', {
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
if (frm.is_new()) {
|
||||
frm.page.set_primary_action(__('Check Availability'), function() {
|
||||
if (!frm.doc.patient) {
|
||||
frappe.throw(__('Please select a patient first'));
|
||||
} else {
|
||||
check_and_set_availability(frm);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
frm.page.set_primary_action(__('Save'), () => frm.save());
|
||||
}
|
||||
|
||||
if(frm.doc.patient){
|
||||
frm.add_custom_button(__('Patient History'), function() {
|
||||
frappe.route_options = {"patient": frm.doc.patient};
|
||||
@@ -103,9 +116,6 @@ frappe.ui.form.on('Patient Appointment', {
|
||||
}
|
||||
});
|
||||
},
|
||||
check_availability: function(frm) {
|
||||
check_and_set_availability(frm);
|
||||
},
|
||||
onload:function(frm){
|
||||
if(frm.is_new()) {
|
||||
frm.set_value("appointment_time", null);
|
||||
|
||||
Reference in New Issue
Block a user