import { useEffect, useState } from 'react' import { Link } from 'react-router-dom' import { catalog, finance, inventory, partners, production, purchaseOrders, salesOrders, } from '@/api/client' import { PageHeader } from '@/components/PageHeader' import { Loading } from '@/components/Loading' import { ErrorBox } from '@/components/ErrorBox' import { useAuth } from '@/auth/AuthContext' interface DashboardCounts { items: number partners: number locations: number salesOrders: number purchaseOrders: number workOrders: number journalEntries: number inProgressWorkOrders: number } export function DashboardPage() { const { username } = useAuth() const [counts, setCounts] = useState(null) const [error, setError] = useState(null) const [loading, setLoading] = useState(true) useEffect(() => { let active = true setLoading(true) Promise.all([ catalog.listItems(), partners.list(), inventory.listLocations(), salesOrders.list(), purchaseOrders.list(), production.listWorkOrders(), finance.listJournalEntries(), production.shopFloor(), ]) .then(([items, parts, locs, sos, pos, wos, jes, sf]) => { if (!active) return setCounts({ items: items.length, partners: parts.length, locations: locs.length, salesOrders: sos.length, purchaseOrders: pos.length, workOrders: wos.length, journalEntries: jes.length, inProgressWorkOrders: sf.length, }) }) .catch((e: unknown) => { if (active) setError(e instanceof Error ? e : new Error(String(e))) }) .finally(() => active && setLoading(false)) return () => { active = false } }, []) return (
{loading && } {error && } {counts && (
)}

Demo: EBC-PP-001 Work Order Management Flow

Walk the printing company's production flow end-to-end — sales order to finished goods.

  1. Create or open a sales order —{' '} create a new order {' '} or open an existing one from the{' '} list.
  2. Confirm the order — click{' '} Confirm. The system auto-generates one production work order per line (EBC-PP-001 step B-010). Check the{' '} Work Orders{' '} page to see them appear. Finance posts an AR entry automatically.
  3. Walk the pre-seeded work order — open{' '} WO-PRINT-0001. It has a 3-step routing (CTP plate-making → offset printing → post-press finishing) and a BOM with paper, ink, and CTP plates. Click Start{' '} to put it in progress, then watch it on the{' '} Shop Floor dashboard.
  4. Complete the work order — materials are consumed from the warehouse, finished goods are credited. Check{' '} Stock Balances{' '} and{' '} Movements{' '} to see the ledger entries.
  5. Ship the sales order — finished goods leave the warehouse, the AR journal entry settles from POSTED to SETTLED in{' '} Finance.
) } function DashboardCard({ label, value, to, highlight = false, }: { label: string value: number to: string highlight?: boolean }) { return (
{label}
{value}
) }