diff --git a/jey_erp/jey_erp/doctype/bank_statement_importer/bank_statement_importer.js b/jey_erp/jey_erp/doctype/bank_statement_importer/bank_statement_importer.js index 44741f2..4b70d63 100644 --- a/jey_erp/jey_erp/doctype/bank_statement_importer/bank_statement_importer.js +++ b/jey_erp/jey_erp/doctype/bank_statement_importer/bank_statement_importer.js @@ -17,6 +17,7 @@ frappe.ui.form.on('Bank Statement Importer', { refresh(frm) { BIFileFormat.applySampleHeaders(frm); + _bi_render_workflow_guide(frm); if (frm.is_new()) return; @@ -490,6 +491,78 @@ function _show_load_data_dialog(frm) { // DATA TAB — registry overviews (Accounts / Customers / Suppliers / Purposes) // ═══════════════════════════════════════════════════════════════════════════════ +// ═══════════════════════════════════════════════════════════════════════════════ +// WORKFLOW GUIDE — adaptive 4-step banner above the tabs. +// Highlights the next action based on the form's current state so users don't +// have to memorise the sequence (Setup → Load Data → Match/Create → Use). +// ═══════════════════════════════════════════════════════════════════════════════ + +function _bi_render_workflow_guide(frm) { + if (frm.is_new()) { + frm.set_intro( + __('Fill in Bank Name and Save to begin setup. Then configure the File Format tab.'), + 'blue' + ); + return; + } + + const hasFormat = (frm.doc.column_mappings || []).some(r => r.excel_column && r.standard_field); + const hasAccountMappings = (frm.doc.account_mappings || []).length > 0; + const hasCustomerMappings = (frm.doc.customer_mappings || []).length > 0; + const hasSupplierMappings = (frm.doc.supplier_mappings || []).length > 0; + const hasAnyMapping = hasAccountMappings || hasCustomerMappings || hasSupplierMappings; + + const step = (n, label, active) => { + const color = active ? 'var(--primary)' : 'var(--text-muted)'; + const weight = active ? '600' : '400'; + const bg = active ? 'var(--alert-bg-blue, #e7f1ff)' : 'transparent'; + return ` + ${n} + ${frappe.utils.escape_html(label)} + `; + }; + + let current, hint, color; + if (!hasFormat) { + current = 1; + hint = __("Open the File Format tab. Upload a sample statement — auto-detect fills the column mappings."); + color = 'orange'; + } else if (!hasAnyMapping) { + current = 2; + hint = __("Click Load Data (top-right) to register counterparties and purposes from a real statement."); + color = 'orange'; + } else { + // Heuristic: once any mapping table has rows, users still need to link + // each registry entry to an ERP record. We can't cheaply count registry + // rows here without an extra call, so we just point at the Data tab. + current = 3; + hint = __("Open the Data tab. Use the Match / Create buttons (top-right) to link each registry entry to an ERPNext record. When done, import statements via Bank Transaction list → Import From."); + color = 'blue'; + } + + const stepper = + '