Skip to content

Commit

Permalink
fix: status past tense
Browse files Browse the repository at this point in the history
(cherry picked from commit 1a789f6)
  • Loading branch information
krantheman authored and mergify[bot] committed Jan 9, 2024
1 parent 1e45c0b commit 9221bc0
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions hrms/hr/doctype/goal/goal_list.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,18 @@ frappe.listview_settings["Goal"] = {
const status_menu = listview.page.add_custom_button_group(
__("Update Status")
);

["Complete", "Archive", "Close", "Unarchive", "Reopen"].forEach(
(option) => {
listview.page.add_custom_menu_item(status_menu, __(option), () =>
this.trigger_update_status_dialog(
option + option.slice(-1) === "e" ? "d" : "ed",
listview
)
);
}
);
const options = [
{ present: "Complete", past: "Completed" },
{ present: "Archive", past: "Archived" },
{ present: "Close", past: "Closed" },
{ present: "Unarchive", past: "Unarchived" },
{ present: "Reopen", past: "Reopened" },
];
options.forEach((option) => {
listview.page.add_custom_menu_item(status_menu, __(option.present), () =>
this.trigger_update_status_dialog(option.past, listview)
);
});
},

trigger_update_status_dialog: function (status, listview) {
Expand Down Expand Up @@ -98,20 +99,22 @@ frappe.listview_settings["Goal"] = {

if (checked_items.some((item) => item.is_group))
frappe.msgprint({
title: __("Error"),
message: __("Cannot update status of Goal groups"),
indicator: "yellow",
indicator: "orange",
});

const applicable_statuses = applicable_current_statuses(status);
if (
checked_items.some((item) => !applicable_statuses.includes(item.status))
)
frappe.msgprint({
title: __("Error"),
message: __("Only {0} Goals can be {1}", [
frappe.utils.comma_and(applicable_statuses),
status,
]),
indicator: "yellow",
indicator: "orange",
});
},

Expand Down

0 comments on commit 9221bc0

Please sign in to comment.