mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-08 15:42:52 +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){
|
if(frm.doc.patient){
|
||||||
frm.add_custom_button(__('Patient History'), function() {
|
frm.add_custom_button(__('Patient History'), function() {
|
||||||
frappe.route_options = {"patient": frm.doc.patient};
|
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){
|
onload:function(frm){
|
||||||
if(frm.is_new()) {
|
if(frm.is_new()) {
|
||||||
frm.set_value("appointment_time", null);
|
frm.set_value("appointment_time", null);
|
||||||
|
|||||||
Reference in New Issue
Block a user