feat(manager): customers, throwaways, stock and notes on v2 (platform-v2 step 6.13b)
- CRM -> Customers: search ignoring case and Greek accents (and part of the phone), visits / spent / last visit, the card (contact, notes, open tab, every visit with what was on a tab), new/edit/remove - Inventory -> Throwaways: log (product, quantity with a comma, reason, note) with its cost, today's list (delete today only), a period's totals by reason and product, every entry; Inventory -> Stock: an honest 'not available yet' - Notes: notes (pinned first, edit in place) and to-dos (urgent first, done folded away, who did it kept) - backend: crm.manage / inventory.manage / notes.use (the customer search also with the dashboard key, for orders); spending counted by services/sales.py (refunds off, tab lines in); null clears a field; names/notes not blank, priorities checked; waste ?date_from=&date_to= venue dates; the Greek reason labels left the API; live customers.changed / waste.changed / notes.changed - the overview's notes card needs notes.use and refreshes live - tests: test_customers_waste_notes.py (4), crm.test.mjs (3), e2e manager.mjs (customers, throwaways, notes, stock, Greek) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
// The order of the Notes page (plan step 6.13b), unit-tested in tests/crm.test.mjs.
|
||||
|
||||
/** Pinned notes first, then the rest; each newest-edited first. */
|
||||
export function splitNotes(notes) {
|
||||
const newest = (a, b) => String(b.updated_at ?? b.created_at).localeCompare(String(a.updated_at ?? a.created_at))
|
||||
return { pinned: notes.filter(n => n.is_pinned).sort(newest), rest: notes.filter(n => !n.is_pinned).sort(newest) }
|
||||
}
|
||||
|
||||
/** To-dos not done (urgent first, then newest) and done ones (most recently done first). */
|
||||
export function splitTodos(todos) {
|
||||
const open = todos.filter(t => !t.is_done).sort((a, b) => (a.priority === 'high' ? 0 : 1) - (b.priority === 'high' ? 0 : 1)
|
||||
|| String(b.created_at).localeCompare(String(a.created_at)))
|
||||
const done = todos.filter(t => t.is_done).sort((a, b) => String(b.done_at ?? '').localeCompare(String(a.done_at ?? '')))
|
||||
return { open, done }
|
||||
}
|
||||
Reference in New Issue
Block a user