Commit 2ca8e18
feat: admin Chart of Accounts editor (L4) (#89)
Adds /coa page for L4 (owner/admin) users to view and manage tenant-specific
Chart of Accounts overrides alongside the 80 global defaults.
New: client/src/pages/CoaAdmin.tsx
- Searchable, filterable table (scope: all/global/tenant, type: 5 enum)
- Stats header: total / global / tenant-specific counts
- Create form with 8 fields (code, name, type, subtype, parent, schedule E,
tax deductible, description)
- Toggle activate/deactivate for tenant-specific accounts
- Global defaults are displayed read-only (cannot be edited through this UI)
- L4 authorization enforced server-side; UI shows friendly "need owner/admin
role" error if PATCH/POST returns 403
validateNewAccountCode() enforces the ChittyFinance code-range convention:
- 4-digit code required
- Code must fall inside one of the ranges defined for its type
(e.g. expense codes must be in 5000-5499, 5100-5199, 6000-6099, 7000-7099,
or 9000-9999)
- Code must not already exist for this tenant or as a global default
- Parent code must exist in the COA if provided
Hook additions (client/src/hooks/use-classification.ts):
- useCreateCoaAccount() — POST /api/coa
- useUpdateCoaAccount() — PATCH /api/coa/:id
- Both invalidate the tenant-scoped /api/coa cache on success
Wiring:
- /coa route added to App.tsx
- Sidebar link added (cfo, accountant roles; L4 check is server-side)
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 515aad1 commit 2ca8e18
4 files changed
Lines changed: 493 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| |||
61 | 62 | | |
62 | 63 | | |
63 | 64 | | |
| 65 | + | |
64 | 66 | | |
65 | 67 | | |
66 | 68 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
142 | 142 | | |
143 | 143 | | |
144 | 144 | | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
145 | 179 | | |
146 | 180 | | |
147 | 181 | | |
| |||
0 commit comments