Dear Team,
i have wrote this custom code in onload event.
const buttonConfigs = [
{ label: "OP", values: \["BOOKING", "WALK IN"\] },
{ label: "Online", values: \["ONLINE"\] },
{ label: "Queue", values: \["QUEUE"\] },
{ label: "CC", values: \["CC"\] },
{ label: "Call", values: \["CALL APPT"\] },
{ label: "FP", values: \["LAB REPORT", "WA REPORT", "WA QUEUE", "15 FOLLOWUP", "45 FOLLOWUP"\] },
\];
buttonConfigs.forEach(cfg => {
const btn = listview.page.add_inner_button(__(cfg.label), () => {
listview.filter_area.clear();
listview.filter_area.add([
\["Patient Appointment", "custom_type_of_visit", "in", cfg.values\],
\["Patient Appointment", "appointment_date", "=", "05-11-2025"\]
\]);
listview.refresh();
});
frappe.db.count(“Patient Appointment”, {
filters: {
custom_type_of_visit: [“in”, cfg.values],
appointment_date: frappe.datetime.get_today()
}
}).then(count => {
if (count > 0) {
$(btn).css({
“background-color”: “#6ea8fe”,
“color”: “white”,
“border-radius”: “6px”,
“font-weight”: “600”,
“box-shadow”: “0 0 4px rgba(0,0,0,0.2)”
});
} else {
$(btn).css({
“opacity”: “0.6”
});
}
});
});
In this
date filter in
frappe.db.count(“Patient Appointment”, {
filters: { custom_type_of_visit: [“in”, cfg.values],
appointment_date: today
}
is working but in
listview.filter_area.add([ [“Patient Appointment”, “custom_type_of_visit”, “in”, cfg.values],
[“Patient Appointment”, “appointment_date”, “=”, today] ]);
NOT WORKING