managarten/apps
Till JS 8d00ee0697 feat(invoices): M2 CRUD — draft lifecycle, totals, list + detail
Full draft → sent → paid flow with the supporting surface:

Data layer
- totals.ts: pure computeLineTotal / computeInvoiceTotals (testable
  without Dexie); per-line rounding then per-rate summing so the
  breakdown equals the sum-of-lines exactly
- queries.ts: useAllInvoices (live, overdue derived on read),
  useInvoiceClients, computeStats per currency, formatAmount
- stores/settings.svelte.ts: singleton with stable sentinel id,
  ensureSettings() lazy-creates, takeNextNumber() atomic via Dexie
  rw-transaction (plaintext-only fields → no crypto breaks the tx)
- stores/invoices.svelte.ts: create / update / updateLines (recomputes
  totals) / markSent / markPaid / void / duplicate / soft-delete; drafts
  only editable, paid can't be voided, sent/paid can't be deleted

Components
- StatusBadge, LinesEditor (add/remove/reorder, live per-line totals,
  minor-unit conversion on type), ClientPicker (contacts + invoice
  client book, manual entry fallback, snapshot binding),
  SenderProfileForm (sender + sequence + defaults), InvoiceForm
  (create + edit with live totals + VAT breakdown)

Views & routes
- DetailView with full action bar (edit/duplicate/mark sent/mark paid/
  void/delete), lines table, per-rate totals block
- ListView rewritten: status chips with counts, stats cards
  (open/overdue/YTD fakturiert/YTD bezahlt) scoped to primary currency,
  search, row-click to detail
- routes: /invoices/new, /invoices/[id], /invoices/[id]/edit (with
  edit-lock for non-drafts), /invoices/settings

Design notes addressed
- Number sequence atomicity: rw-transaction around plaintext fields
  guards same-device race; cross-device offline collision documented
  in settings store header as a known gap, acceptable for solo-MVP
- Edit-after-send: drafts only are editable; to revise a sent invoice,
  void and duplicate (keeps bookkeeping evidence intact)

Plan: docs/plans/invoices-module.md §M2.
Next: M3 pdf-lib renderer + M5 swissqrbill.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-20 15:40:11 +02:00
..
api feat(auth): server-side tier gating via requireTier middleware 2026-04-19 17:38:06 +02:00
calc/packages/shared chore: delete 25 web-archived directories, remove stale stubs, clean workspace config 2026-04-03 13:03:49 +02:00
calendar refactor(shared-tailwind): rewrite themes.css to single-layer shadcn convention 2026-04-09 01:13:06 +02:00
cards chore(mobile): remove 6 of 7 mobile apps — keep only memoro 2026-04-20 15:31:47 +02:00
chat chore(mobile): remove 6 of 7 mobile apps — keep only memoro 2026-04-20 15:31:47 +02:00
citycorners chore: complete ManaCore → Mana rename (docs, go modules, plists, images) 2026-04-07 12:26:10 +02:00
contacts refactor(shared-tailwind): rewrite themes.css to single-layer shadcn convention 2026-04-09 01:13:06 +02:00
context chore(mobile): remove 6 of 7 mobile apps — keep only memoro 2026-04-20 15:31:47 +02:00
docs feat(ai): Mission Grant rollout gating — flag, alerts, runbook, user docs 2026-04-15 14:02:47 +02:00
food refactor: rename nutriphi module to food (Essen) 2026-04-14 15:30:07 +02:00
guides refactor(shared-tailwind): rewrite themes.css to single-layer shadcn convention 2026-04-09 01:13:06 +02:00
inventory refactor(mana): rename inventar → inventory across the codebase 2026-04-09 15:50:24 +02:00
mana feat(invoices): M2 CRUD — draft lifecycle, totals, list + detail 2026-04-20 15:40:11 +02:00
manavoxel fix(type-check): repair silently broken per-package type-check scripts 2026-04-20 15:13:54 +02:00
memoro chore: remove abandoned per-product workspace artifacts 2026-04-09 11:56:51 +02:00
moodlit refactor(shared-tailwind): rewrite themes.css to single-layer shadcn convention 2026-04-09 01:13:06 +02:00
mukke feat: rename ManaCore to Mana across entire codebase 2026-04-05 20:00:13 +02:00
news refactor(shared-tailwind): rewrite themes.css to single-layer shadcn convention 2026-04-09 01:13:06 +02:00
photos refactor: rename nutriphi module to food (Essen) 2026-04-14 15:30:07 +02:00
picture chore(mobile): remove 6 of 7 mobile apps — keep only memoro 2026-04-20 15:31:47 +02:00
plants refactor: rename planta → plants, clean up codebase 2026-04-12 18:59:44 +02:00
presi fix(presi): wire up db:push for presi schema via @mana/api 2026-04-12 14:32:44 +02:00
questions refactor(shared-tailwind): rewrite themes.css to single-layer shadcn convention 2026-04-09 01:13:06 +02:00
quotes/packages/content fix(mana-llm): google-genai v1.73 keyword-only Part.from_text() 2026-04-16 12:47:23 +02:00
skilltree chore: delete 25 web-archived directories, remove stale stubs, clean workspace config 2026-04-03 13:03:49 +02:00
storage refactor(shared-tailwind): rewrite themes.css to single-layer shadcn convention 2026-04-09 01:13:06 +02:00
times chore: complete ManaCore → Mana rename (docs, go modules, plists, images) 2026-04-07 12:26:10 +02:00
todo refactor(shared-tailwind): rewrite themes.css to single-layer shadcn convention 2026-04-09 01:13:06 +02:00
traces chore(mobile): remove 6 of 7 mobile apps — keep only memoro 2026-04-20 15:31:47 +02:00
uload refactor(shared-tailwind): rewrite themes.css to single-layer shadcn convention 2026-04-09 01:13:06 +02:00