Add document storage (local filesystem) + fix dashboard outstanding KPI

- Local file storage via STORAGE_PATH env var (replaces DO Spaces)
- POST/GET/DELETE /api/cases/:caseId/documents + GET /api/documents/:docId/download
- useDocuments hook + upload/list/download/delete UI in CaseDetailPage
- GET /api/invoices/summary — live SUM of sent+overdue invoices
- Dashboard outstanding KPI wired to real DB value
- api.upload() for FormData, formatBytes() utility

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Leon Serfaty
2026-04-26 03:07:37 -04:00
co-authored by Claude Sonnet 4.6
parent 0700d54225
commit ce2278f4be
13 changed files with 334 additions and 14 deletions
+6
View File
@@ -16,6 +16,12 @@ export function formatMoney(amount: string | number | null | undefined): string
return new Intl.NumberFormat(undefined, { style: 'currency', currency: 'USD' }).format(n);
}
export function formatBytes(bytes: number): string {
if (bytes < 1024) return `${bytes} B`;
if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
}
export function planLimitMessage(code: string | undefined, fallback = 'Action not allowed.'): string {
switch (code) {
case 'plan_limit_clients':