diff --git a/jey_erp/public/js/bank_transaction_list.js b/jey_erp/public/js/bank_transaction_list.js index e0cf890..e0a9703 100644 --- a/jey_erp/public/js/bank_transaction_list.js +++ b/jey_erp/public/js/bank_transaction_list.js @@ -221,18 +221,22 @@ const BIExcelImport = { _runImport(selected, values, listview) { const total = selected.length; - frappe.show_progress(__('Importing'), 0, total, __('Starting import...')); + // Freeze the page instead of using show_progress. show_progress relies + // on a Bootstrap modal whose backdrop reliably gets stuck when we then + // open a msgprint on completion; freeze is a simple full-page overlay + // that unfreeze() always cleans up. + frappe.dom.freeze(__('Starting import…')); frappe.realtime.off('bi_bt_import_progress'); frappe.realtime.on('bi_bt_import_progress', function (d) { - frappe.show_progress(__('Importing'), d.current, d.total, __('{0} of {1}', [d.current, d.total])); + BIExcelImport._setFreezeMessage(__('Importing {0} of {1}…', [d.current, d.total])); }); frappe.realtime.off('bi_bt_import_complete'); frappe.realtime.on('bi_bt_import_complete', function (d) { frappe.realtime.off('bi_bt_import_progress'); frappe.realtime.off('bi_bt_import_complete'); - BIExcelImport._closeProgress(); + frappe.dom.unfreeze(); const ok = d.imported || 0; const errCount = (d.errors || []).length; @@ -273,7 +277,7 @@ const BIExcelImport = { error() { frappe.realtime.off('bi_bt_import_progress'); frappe.realtime.off('bi_bt_import_complete'); - BIExcelImport._closeProgress(); + frappe.dom.unfreeze(); frappe.msgprint({ title: __('Error'), indicator: 'red', message: __('Network error starting import'), @@ -282,6 +286,15 @@ const BIExcelImport = { }); }, + // Replace the message on the active freeze overlay without re-freezing + // (re-freezing stacks counter and breaks unfreeze pairing). + _setFreezeMessage(msg) { + const $msg = $('#freeze .freeze-message'); + if ($msg.length) { + $msg.text(msg); + } + }, + _showDateParseHelp(droppedCount, bankIntegrationName) { const openForm = function () { frappe.set_route('Form', 'Bank Statement Importer', bankIntegrationName); @@ -352,20 +365,6 @@ const BIExcelImport = { d.show(); }, - _closeProgress() { - try { - if (frappe.cur_progress) { - frappe.cur_progress.$wrapper.modal('hide'); - frappe.cur_progress.$wrapper.remove(); - frappe.cur_progress = null; - } - } catch (e) { /* ignore */ } - if ($('.modal:visible').length === 0) { - $('.modal-backdrop').remove(); - $('body').removeClass('modal-open'); - } - }, - _showErrorDetails() { const errs = BIExcelImport._lastErrors || []; if (!errs.length) {