$(document).on("toolbar_setup", function() {
if (frappe.boot.sysdefaults.demo_company) {
erpnext.setup_clear_button();
}
});
erpnext.setup_clear_button = function() {
let message_string = __('Demo data is setup, use this button to clear before starting actual transactions');
let $floatingBar = $(`
`);
$('footer').append($floatingBar);
$('#clear-demo').on('click', function () {
frappe.call({
method: "erpnext.setup.demo.clear_demo_data",
freeze: true,
freeze_message: __('Clearing Demo Data...'),
callback: function(r) {
frappe.ui.toolbar.clear_cache();
frappe.show_alert({ message: __('Demo data cleared'), indicator: 'green' });
$('footer').remove($floatingBar);
}
})
});
}