Merge pull request #38533 from KerollesFathy/feat/frappe-confirm-custom-labels

feat: Add `primary_label` and `secondary_label` params to frappe.confirm
This commit is contained in:
Ejaaz Khan 2026-04-13 11:32:07 +05:30 committed by GitHub
commit 11a9eba342
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -26,15 +26,21 @@ frappe.throw = function (msg) {
throw new Error(msg.message);
};
frappe.confirm = function (message, confirm_action, reject_action) {
frappe.confirm = function (
message,
confirm_action,
reject_action,
primary_label,
secondary_label
) {
var d = new frappe.ui.Dialog({
title: __("Confirm", null, "Title of confirmation dialog"),
primary_action_label: __("Yes", null, "Approve confirmation dialog"),
primary_action_label: __(primary_label || "Yes", null, "Approve confirmation dialog"),
primary_action: () => {
confirm_action && confirm_action();
d.hide();
},
secondary_action_label: __("No", null, "Dismiss confirmation dialog"),
secondary_action_label: __(secondary_label || "No", null, "Dismiss confirmation dialog"),
secondary_action: () => d.hide(),
});