Skip to content

Commit

Permalink
chore: confirm before deleting page
Browse files Browse the repository at this point in the history
  • Loading branch information
maharshivpatel committed Jun 11, 2024
1 parent fce1939 commit daff1dc
Showing 1 changed file with 28 additions and 4 deletions.
32 changes: 28 additions & 4 deletions print_designer/public/js/print_designer/PropertiesPanelState.js
Original file line number Diff line number Diff line change
Expand Up @@ -412,10 +412,34 @@ export const createPropertiesPanel = () => {
style: "secondary",
margin: 15,
onClick: (e, field) => {
ElementStore.Elements.splice(
ElementStore.Elements.indexOf(MainStore.activePage),
1
);
if (MainStore.activePage?.childrens.length) {
let message = __("Are you sure you want to delete the page?");
frappe.confirm(message, () => {
ElementStore.Elements.splice(
ElementStore.Elements.indexOf(MainStore.activePage),
1
);
frappe.show_alert(
{
message: `Page Deleted Successfully`,
indicator: "green",
},
5
);
});
} else {
ElementStore.Elements.splice(
ElementStore.Elements.indexOf(MainStore.activePage),
1
);
frappe.show_alert(
{
message: `Page Deleted Successfully`,
indicator: "green",
},
5
);
}
e.target.blur();
},
},
Expand Down

0 comments on commit daff1dc

Please sign in to comment.