fix: make check availability as the primary action button
diff --git a/erpnext/healthcare/doctype/patient_appointment/patient_appointment.js b/erpnext/healthcare/doctype/patient_appointment/patient_appointment.js
index 49de78c..28c326a 100644
--- a/erpnext/healthcare/doctype/patient_appointment/patient_appointment.js
+++ b/erpnext/healthcare/doctype/patient_appointment/patient_appointment.js
@@ -29,6 +29,19 @@
}
};
});
+
+ 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 @@
}
});
},
- check_availability: function(frm) {
- check_and_set_availability(frm);
- },
onload:function(frm){
if(frm.is_new()) {
frm.set_value("appointment_time", null);