fix: dont render demo clear button if onboarding tour present

This commit is contained in:
Ankush Menat 2023-08-12 11:21:33 +05:30
parent f8e7bc08af
commit 6b464edf84

View File

@ -1,15 +1,25 @@
$(document).on("toolbar_setup", function () {
if (frappe.boot.sysdefaults.demo_company) {
erpnext.setup_clear_button();
render_clear_demo_button();
}
// for first load
// for first load after setup.
frappe.realtime.on("demo_data_complete", () => {
erpnext.setup_clear_button();
render_clear_demo_button();
});
});
erpnext.setup_clear_button = function () {
function render_clear_demo_button() {
let wait_for_onboaring_tours = setInterval(() => {
if ($("#driver-page-overlay").length) {
return;
}
setup_clear_demo_button();
clearInterval(wait_for_onboaring_tours);
}, 2000);
}
function setup_clear_demo_button() {
let message_string = __(
"Demo data is present on the system, erase data before starting real usage."
);
@ -68,4 +78,4 @@ erpnext.setup_clear_button = function () {
}
);
});
};
}