diff --git a/public/js/views/accounting-view.js b/public/js/views/accounting-view.js index a68a0da..7f11500 100644 --- a/public/js/views/accounting-view.js +++ b/public/js/views/accounting-view.js @@ -84,7 +84,25 @@ function showLoading(slotId, message = 'Loading…') { ${escapeHtml(message)} `; } +function makeCollapsible(headerText, contentId, startCollapsed = false) { + return ` +
+ + + +

${escapeHtml(headerText)}

+
`; +} +export function toggleSection(contentId, headerEl) { + const content = document.getElementById(contentId); + if (!content) return; + const isHidden = content.classList.toggle('hidden'); + const arrow = headerEl.querySelector('svg'); + if (arrow) arrow.classList.toggle('rotate-90', !isHidden); +} // ──────────────────────────────────────────────────────────────────── // Toolbar // ──────────────────────────────────────────────────────────────────── @@ -243,27 +261,30 @@ export function injectRegisterControls() { if (!registerEndDate) registerEndDate = todayISO(); c.innerHTML = ` -
-
- - + ${makeCollapsible('Register', 'register-section-body')} +
+
+
+ + +
+
+ + +
+
+ + +
+
-
- - -
-
- - -
- -
-
`; +
+
`; } export function selectRegisterAccount(accountId) { @@ -366,7 +387,16 @@ function renderRegisterRow(r) { } function renderSplitCell(r) { - if (!r.splits || !r.splits.length) return `-Split-`; + if (!r.splits || !r.splits.length) { + const type = (r.type || '').toLowerCase(); + if (type.includes('tax payment')) { + return `-Split- (Sales Tax)`; + } + if (type.includes('paycheck') || type.includes('payroll')) { + return `-Split- (Payroll)`; + } + return `-Split-`; + } const lines = r.splits.map(s => `
${escapeHtml(s.account || '?')} @@ -387,39 +417,42 @@ export function injectReportsControls() { if (!bsAsOfDate) bsAsOfDate = todayISO(); c.innerHTML = ` -
-
-

Profit & Loss

-
-
-
-
-
-
-
-
- + ${makeCollapsible('Reports', 'reports-section-body')} +
+
+
+

Profit & Loss

+
+
+
+
+
+
+
+
+ +
+
-
-
-
-

Balance Sheet

-
-
-
-
-
-
- +
+

Balance Sheet

+
+
+
+
+
+
+ +
+
-
`; @@ -514,33 +547,36 @@ export function injectExpensesSection() { if (!expEndDate) expEndDate = todayISO(); c.innerHTML = ` -
-
-
- - -
-
- - -
-
- - -
- -
- +
+ +
+
-
`; }