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:
2026-11-19 18:36:27 +02:00
co-authored by Claude Opus 5.5
parent 07c9a0aecf
commit bde125bf09
28 changed files with 1356 additions and 1244 deletions
@@ -16,8 +16,8 @@ export default function NotesCard() {
const navigate = useNavigate()
const timer = useRef(null)
const [preview, setPreview] = useState(false)
const { data: notes = [] } = useLiveQuery({ queryKey: ['notes'], queryFn: () => client.get('/api/notes/').then(r => r.data), refetchInterval: 60_000 })
const { data: todos = [] } = useLiveQuery({ queryKey: ['todos'], queryFn: () => client.get('/api/notes/todos').then(r => r.data), refetchInterval: 60_000 })
const { data: notes = [] } = useLiveQuery({ queryKey: ['notes'], queryFn: () => client.get('/api/notes/').then(r => r.data), events: ['notes.changed'] })
const { data: todos = [] } = useLiveQuery({ queryKey: ['todos'], queryFn: () => client.get('/api/notes/todos').then(r => r.data), events: ['notes.changed'] })
const items = notesPreview(notes, todos)
const pinned = notes.filter(n => n.is_pinned).length
@@ -11,7 +11,7 @@ import { useNavigate } from 'react-router-dom'
import toast from 'react-hot-toast'
import { BarChart3, Eye, EyeOff, Lock, Play, Power } from 'lucide-react'
import { errorMessage } from '@xenia/api'
import { useModule } from '@xenia/access'
import { useCan, useModule } from '@xenia/access'
import { useFormat, useTranslation } from '@xenia/i18n'
import { Button, Dialog, IconButton, Spinner, cx } from '@xenia/ui'
import client from '../../api/client'
@@ -44,7 +44,8 @@ export default function OverviewPage() {
const navigate = useNavigate()
const qc = useQueryClient()
const license = useContext(LicenseContext)
const notesOn = useModule('notes')
const notesModule = useModule('notes')
const notesOn = useCan('notes.use') && notesModule // what /api/notes checks (6.13b)
const bookingsOn = useModule('reservations')
const chatOn = useModule('chat')