@burdenoff/microfe-proserviceworld 2026.827.1 → 2026.1009.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +4 -4
- package/dist/proserviceworld/components/ui.js +1 -1
- package/dist/proserviceworld/components/ui.js.map +1 -1
- package/dist/proserviceworld/hooks/useProServiceWorldApi.d.ts.map +1 -1
- package/dist/proserviceworld/hooks/useProServiceWorldApi.js.map +1 -1
- package/dist/proserviceworld/hooks/useTr.d.ts +19 -0
- package/dist/proserviceworld/hooks/useTr.d.ts.map +1 -0
- package/dist/proserviceworld/hooks/useTr.js +33 -0
- package/dist/proserviceworld/hooks/useTr.js.map +1 -0
- package/dist/proserviceworld/i18n/index.d.ts +1 -1
- package/dist/proserviceworld/i18n/index.d.ts.map +1 -1
- package/dist/proserviceworld/i18n/index.js +723 -18
- package/dist/proserviceworld/i18n/index.js.map +1 -1
- package/dist/proserviceworld/index.js +4 -4
- package/dist/proserviceworld/pages/ClientsPage.d.ts.map +1 -1
- package/dist/proserviceworld/pages/ClientsPage.js +166 -164
- package/dist/proserviceworld/pages/ClientsPage.js.map +1 -1
- package/dist/proserviceworld/pages/DashboardPage.d.ts.map +1 -1
- package/dist/proserviceworld/pages/DashboardPage.js +152 -142
- package/dist/proserviceworld/pages/DashboardPage.js.map +1 -1
- package/dist/proserviceworld/pages/EngagementsPage.d.ts.map +1 -1
- package/dist/proserviceworld/pages/EngagementsPage.js +135 -135
- package/dist/proserviceworld/pages/EngagementsPage.js.map +1 -1
- package/dist/proserviceworld/pages/MattersPage.d.ts.map +1 -1
- package/dist/proserviceworld/pages/MattersPage.js +204 -197
- package/dist/proserviceworld/pages/MattersPage.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DashboardPage.js","names":[],"sources":["../../../src/proserviceworld/pages/DashboardPage.tsx"],"sourcesContent":["import type { FC, ReactNode } from 'react';\nimport {\n Users,\n Briefcase,\n FolderKanban,\n Clock,\n Receipt,\n Wallet,\n ShieldCheck,\n GitBranch,\n ArrowRight,\n Scale,\n FileText,\n Network,\n BarChart3,\n} from 'lucide-react';\nimport { useDashboardStats } from '../hooks/useProServiceWorldApi';\nimport { useNav } from '../utils/nav';\nimport { cn } from '../utils/cn';\nimport {\n PageHeader,\n MetricCard,\n SectionCard,\n LoadingBlock,\n ErrorState,\n StatusPill,\n fmtMoney,\n fmtHours,\n} from '../components/ui';\n\nconst QUICK: { label: string; to: string; icon: ReactNode }[] = [\n { label: 'Clients', to: 'clients', icon: <Users className=\"h-4 w-4\" /> },\n { label: 'Engagements', to: 'engagements', icon: <Briefcase className=\"h-4 w-4\" /> },\n { label: 'Matters', to: 'matters', icon: <FolderKanban className=\"h-4 w-4\" /> },\n { label: 'Time', to: 'time', icon: <Clock className=\"h-4 w-4\" /> },\n { label: 'Invoices', to: 'invoices', icon: <Receipt className=\"h-4 w-4\" /> },\n { label: 'Trust accounting', to: 'trust', icon: <Wallet className=\"h-4 w-4\" /> },\n { label: 'Compliance', to: 'compliance', icon: <ShieldCheck className=\"h-4 w-4\" /> },\n { label: 'Conflict checks', to: 'conflicts', icon: <Scale className=\"h-4 w-4\" /> },\n { label: 'Documents', to: 'documents', icon: <FileText className=\"h-4 w-4\" /> },\n { label: 'Practice areas', to: 'practice-areas', icon: <Network className=\"h-4 w-4\" /> },\n { label: 'Analytics', to: 'analytics', icon: <BarChart3 className=\"h-4 w-4\" /> },\n];\n\nexport const DashboardPage: FC = () => {\n const nav = useNav();\n const { data, isLoading, error, refetch } = useDashboardStats();\n\n if (isLoading) return <LoadingBlock label=\"Loading practice overview…\" />;\n if (error) return <ErrorState error={error} onRetry={() => void refetch()} />;\n if (!data) return null;\n\n return (\n <div className=\"space-y-6\">\n <PageHeader\n title=\"Practice overview\"\n subtitle=\"One governed view of clients, engagements, matters, time and billing across your firm.\"\n />\n\n <div className=\"grid grid-cols-2 gap-3 md:grid-cols-3 lg:grid-cols-4\">\n <MetricCard\n label=\"Active clients\"\n value={data.activeClients}\n hint={`${data.totalClients} total`}\n icon={<Users className=\"h-4 w-4\" />}\n tone=\"success\"\n />\n <MetricCard\n label=\"Active engagements\"\n value={data.activeEngagements}\n icon={<Briefcase className=\"h-4 w-4\" />}\n tone=\"accent\"\n />\n <MetricCard\n label=\"Open matters\"\n value={data.openMatters}\n icon={<FolderKanban className=\"h-4 w-4\" />}\n tone=\"info\"\n />\n <MetricCard\n label=\"Unbilled hours\"\n value={fmtHours(data.unbilledHours)}\n hint={`${fmtHours(data.billedHours)} billed`}\n icon={<Clock className=\"h-4 w-4\" />}\n tone=\"warning\"\n />\n <MetricCard\n label=\"Outstanding\"\n value={fmtMoney(data.outstandingInvoiceTotal)}\n hint=\"Sent + overdue\"\n icon={<Receipt className=\"h-4 w-4\" />}\n tone=\"warning\"\n />\n <MetricCard\n label=\"Collected\"\n value={fmtMoney(data.paidInvoiceTotal)}\n icon={<Receipt className=\"h-4 w-4\" />}\n tone=\"success\"\n />\n <MetricCard\n label=\"Trust held\"\n value={fmtMoney(data.trustHeldTotal)}\n hint={`${data.activeTrustAccounts} active account${data.activeTrustAccounts === 1 ? '' : 's'}`}\n icon={<Wallet className=\"h-4 w-4\" />}\n tone=\"info\"\n />\n <MetricCard\n label=\"Compliance due\"\n value={data.pendingComplianceChecks}\n icon={<ShieldCheck className=\"h-4 w-4\" />}\n tone={data.pendingComplianceChecks ? 'warning' : 'success'}\n />\n <MetricCard\n label=\"Open conflicts\"\n value={data.openConflictChecks}\n icon={<GitBranch className=\"h-4 w-4\" />}\n tone={data.openConflictChecks ? 'danger' : 'success'}\n />\n </div>\n\n <div className=\"grid grid-cols-1 gap-4 lg:grid-cols-3\">\n <SectionCard title=\"Engagements by status\">\n <StatusBreakdown items={data.engagementsByStatus} />\n </SectionCard>\n <SectionCard title=\"Matters by status\">\n <StatusBreakdown items={data.mattersByStatus} />\n </SectionCard>\n <SectionCard title=\"Revenue\" description=\"Invoiced totals, recent months.\">\n <RevenueBars data={data.revenueByMonth} />\n </SectionCard>\n </div>\n\n <SectionCard title=\"Jump to\">\n <div className=\"grid grid-cols-1 gap-2.5 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-5\">\n {QUICK.map((q) => (\n <button\n key={q.to}\n type=\"button\"\n onClick={() => nav(q.to)}\n className={cn(\n 'group flex items-center gap-3 rounded-xl border border-border-seam bg-bg-canvas px-3.5 py-3 text-left',\n 'transition hover:-translate-y-0.5 hover:border-accent hover:bg-bg-surface hover:shadow-sm'\n )}\n >\n <span className=\"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-bg-sunken text-accent transition group-hover:bg-accent/15\">\n {q.icon}\n </span>\n <span className=\"flex-1 truncate text-sm font-medium text-text-primary\">\n {q.label}\n </span>\n <ArrowRight className=\"h-4 w-4 shrink-0 text-text-tertiary transition group-hover:translate-x-0.5 group-hover:text-accent\" />\n </button>\n ))}\n </div>\n </SectionCard>\n </div>\n );\n};\n\n// ---------------------------------------------------------------------------\n// Status breakdown — tone-colored, gradient horizontal bars with count + share\n// ---------------------------------------------------------------------------\nconst StatusBreakdown: FC<{ items: { status: string; count: number }[] }> = ({ items }) => {\n if (!items.length) return <p className=\"text-sm text-text-tertiary\">No records yet.</p>;\n const max = Math.max(...items.map((i) => i.count), 1);\n const total = items.reduce((s, i) => s + i.count, 0) || 1;\n return (\n <ul className=\"space-y-3.5\">\n {items.map((i) => (\n <li\n key={i.status}\n className=\"grid grid-cols-[7.5rem_minmax(0,1fr)_auto] items-center gap-3\"\n >\n <StatusPill status={i.status} className=\"justify-self-start\" />\n <div className=\"h-2.5 overflow-hidden rounded-full bg-bg-sunken\">\n <div\n className={cn(\n 'h-full rounded-full bg-gradient-to-r transition-all duration-500',\n barGradientFor(i.status)\n )}\n style={{ width: `${Math.max((i.count / max) * 100, 4)}%` }}\n />\n </div>\n <span className=\"flex items-baseline justify-end gap-1.5 tabular-nums\">\n <span className=\"text-sm font-semibold text-text-primary\">{i.count}</span>\n <span className=\"text-xs text-text-tertiary\">\n {Math.round((i.count / total) * 100)}%\n </span>\n </span>\n </li>\n ))}\n </ul>\n );\n};\n\n// ---------------------------------------------------------------------------\n// Revenue column chart — y-axis scale + gridlines, gradient columns, hover\n// ---------------------------------------------------------------------------\nconst RevenueBars: FC<{ data: { month: string; amount: number }[] }> = ({ data }) => {\n if (!data.length) return <p className=\"text-sm text-text-tertiary\">No invoiced revenue yet.</p>;\n const peak = Math.max(...data.map((d) => d.amount), 1);\n const axisMax = niceCeil(peak);\n const ticks = [1, 0.75, 0.5, 0.25, 0].map((f) => axisMax * f);\n return (\n <div className=\"overflow-x-auto\">\n <div className=\"min-w-[260px]\">\n <div className=\"relative h-44\">\n {ticks.map((t, idx) => (\n <div\n key={t}\n className=\"absolute inset-x-0 flex items-center gap-2\"\n style={{ top: `${(idx / (ticks.length - 1)) * 100}%` }}\n >\n <span className=\"w-11 shrink-0 text-right text-[10px] leading-none tabular-nums text-text-tertiary\">\n {fmtCompactMoney(t)}\n </span>\n <span\n className={cn(\n 'h-px flex-1',\n idx === ticks.length - 1 ? 'bg-border-seam' : 'bg-border-seam/50'\n )}\n />\n </div>\n ))}\n <div className=\"absolute inset-0 flex items-end gap-1.5 pl-[3.25rem]\">\n {data.map((d) => (\n <div\n key={d.month}\n className=\"group flex h-full flex-1 flex-col items-center justify-end\"\n >\n <div\n className=\"w-full max-w-[2rem] rounded-t-md bg-gradient-to-t from-accent/55 to-accent shadow-sm transition-all duration-200 group-hover:-translate-y-0.5 group-hover:shadow\"\n style={{ height: `${Math.max((d.amount / axisMax) * 100, 1.5)}%` }}\n title={fmtMoney(d.amount)}\n />\n </div>\n ))}\n </div>\n </div>\n <div className=\"mt-2 flex gap-1.5 pl-[3.25rem]\">\n {data.map((d) => (\n <span key={d.month} className=\"flex-1 text-center text-[10px] text-text-tertiary\">\n {monthShort(d.month)}\n </span>\n ))}\n </div>\n </div>\n </div>\n );\n};\n\n// ---------------------------------------------------------------------------\n// Chart helpers (token-driven; self-contained to this page)\n// ---------------------------------------------------------------------------\ntype BarTone = 'success' | 'warning' | 'danger' | 'info' | 'accent' | 'neutral';\n\nconst BAR_GRADIENT: Record<BarTone, string> = {\n success: 'from-status-success-text/55 to-status-success-text',\n warning: 'from-status-warning-text/55 to-status-warning-text',\n danger: 'from-status-error-text/55 to-status-error-text',\n info: 'from-text-link/55 to-text-link',\n accent: 'from-accent/55 to-accent',\n neutral: 'from-text-tertiary/30 to-text-tertiary/70',\n};\n\n/** Mirror of the shared StatusPill tone mapping, used to tint chart bars. */\nconst STATUS_BAR_TONE: Record<string, BarTone> = {\n ACTIVE: 'success',\n DELIVERED: 'success',\n INVOICED: 'success',\n PAID: 'success',\n APPROVED: 'success',\n PASSED: 'success',\n CLEAR: 'success',\n COMPLETED: 'success',\n FINAL: 'success',\n PROSPECT: 'info',\n PROPOSAL: 'info',\n MEDIUM: 'info',\n INTERNAL_REVIEW: 'info',\n SUBMITTED: 'info',\n SENT: 'info',\n IN_REVIEW: 'info',\n REVIEW: 'warning',\n ON_HOLD: 'warning',\n HIGH: 'warning',\n CLIENT_REVIEW: 'warning',\n PENDING: 'warning',\n POTENTIAL_CONFLICT: 'warning',\n CANCELLED: 'danger',\n CRITICAL: 'danger',\n REJECTED: 'danger',\n OVERDUE: 'danger',\n FAILED: 'danger',\n CONFLICT: 'danger',\n ACCEPTED: 'accent',\n IN_PROGRESS: 'accent',\n OPEN: 'accent',\n BILLED: 'accent',\n INACTIVE: 'neutral',\n ARCHIVED: 'neutral',\n CLOSED: 'neutral',\n LOW: 'neutral',\n DRAFT: 'neutral',\n WAIVED: 'neutral',\n};\n\nfunction barGradientFor(status: string): string {\n return BAR_GRADIENT[STATUS_BAR_TONE[status] ?? 'accent'];\n}\n\n/** Round a peak value up to a clean axis maximum (1/2/2.5/5/10 × 10ⁿ). */\nfunction niceCeil(v: number): number {\n if (v <= 0) return 1;\n const pow = 10 ** Math.floor(Math.log10(v));\n const n = v / pow;\n const step = n <= 1 ? 1 : n <= 2 ? 2 : n <= 2.5 ? 2.5 : n <= 5 ? 5 : 10;\n return step * pow;\n}\n\nfunction fmtCompactMoney(n: number): string {\n if (n >= 1_000_000) return `$${(n / 1_000_000).toFixed(n % 1_000_000 === 0 ? 0 : 1)}M`;\n if (n >= 1_000) return `$${Math.round(n / 1_000)}k`;\n return `$${Math.round(n)}`;\n}\n\n/** \"2026-07\" → \"Jul\" (falls back to the raw value if unparseable). */\nfunction monthShort(m: string): string {\n const [y, mo] = m.split('-').map(Number);\n if (!y || !mo) return m;\n const d = new Date(y, mo - 1, 1);\n return Number.isNaN(d.getTime()) ? m : d.toLocaleDateString(undefined, { month: 'short' });\n}\n"],"mappings":";;;;;;;AA8BA,IAAM,IAA0D;CAC9D;EAAE,OAAO;EAAW,IAAI;EAAW,MAAM,kBAAC,GAAD,EAAO,WAAU,UAAW,CAAA;CAAE;CACvE;EAAE,OAAO;EAAe,IAAI;EAAe,MAAM,kBAAC,GAAD,EAAW,WAAU,UAAW,CAAA;CAAE;CACnF;EAAE,OAAO;EAAW,IAAI;EAAW,MAAM,kBAAC,GAAD,EAAc,WAAU,UAAW,CAAA;CAAE;CAC9E;EAAE,OAAO;EAAQ,IAAI;EAAQ,MAAM,kBAAC,GAAD,EAAO,WAAU,UAAW,CAAA;CAAE;CACjE;EAAE,OAAO;EAAY,IAAI;EAAY,MAAM,kBAAC,GAAD,EAAS,WAAU,UAAW,CAAA;CAAE;CAC3E;EAAE,OAAO;EAAoB,IAAI;EAAS,MAAM,kBAAC,GAAD,EAAQ,WAAU,UAAW,CAAA;CAAE;CAC/E;EAAE,OAAO;EAAc,IAAI;EAAc,MAAM,kBAAC,GAAD,EAAa,WAAU,UAAW,CAAA;CAAE;CACnF;EAAE,OAAO;EAAmB,IAAI;EAAa,MAAM,kBAAC,GAAD,EAAO,WAAU,UAAW,CAAA;CAAE;CACjF;EAAE,OAAO;EAAa,IAAI;EAAa,MAAM,kBAAC,GAAD,EAAU,WAAU,UAAW,CAAA;C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;CACpB,WAAW;CACX,UAAU;CACV,UAAU;CACV,SAAS;CACT,QAAQ;CACR,UAAU;CACV,UAAU;CACV,aAAa;CACb,MAAM;CACN,QAAQ;CACR,UAAU;CACV,UAAU;CACV,QAAQ;CACR,KAAK;CACL,OAAO;CACP,QAAQ;AACV;AAEA,SAAS,EAAe,GAAwB;CAC9C,OAAO,EAAa,EAAgB,MAAW;AACjD;AAGA,SAAS,EAAS,GAAmB;CACnC,IAAI,KAAK,GAAG,OAAO;CACnB,IAAM,IAAM,MAAM,KAAK,MAAM,KAAK,MAAM,CAAC,CAAC,GACpC,IAAI,IAAI;CAEd,QADa,KAAK,IAAI,IAAI,KAAK,IAAI,IAAI,KAAK,MAAM,MAAM,KAAK,IAAI,IAAI,MACvD;AAChB;AAEA,SAAS,EAAgB,GAAmB;CAG1C,OAFI,KAAK,MAAkB,KAAK,IAAI,IAAA,CAAW,QAAQ,IAAI,OAAc,IAAI,IAAI,CAAC,EAAE,KAChF,KAAK,MAAc,IAAI,KAAK,MAAM,IAAI,GAAK,EAAE,KAC1C,IAAI,KAAK,MAAM,CAAC;AACzB;AAGA,SAAS,EAAW,GAAmB;CACrC,IAAM,CAAC,GAAG,KAAM,EAAE,MAAM,GAAG,CAAC,CAAC,IAAI,MAAM;CACvC,IAAI,CAAC,KAAK,CAAC,GAAI,OAAO;CACtB,IAAM,IAAI,IAAI,KAAK,GAAG,IAAK,GAAG,CAAC;CAC/B,OAAO,OAAO,MAAM,EAAE,QAAQ,CAAC,IAAI,IAAI,EAAE,mBAAmB,KAAA,GAAW,EAAE,OAAO,QAAQ,CAAC;AAC3F"}
|
|
1
|
+
{"version":3,"file":"DashboardPage.js","names":[],"sources":["../../../src/proserviceworld/pages/DashboardPage.tsx"],"sourcesContent":["import type { FC, ReactNode } from 'react';\nimport {\n Users,\n Briefcase,\n FolderKanban,\n Clock,\n Receipt,\n Wallet,\n ShieldCheck,\n GitBranch,\n ArrowRight,\n Scale,\n FileText,\n Network,\n BarChart3,\n} from 'lucide-react';\nimport { useDashboardStats } from '../hooks/useProServiceWorldApi';\nimport { useNav } from '../utils/nav';\nimport { cn } from '../utils/cn';\nimport { useTr } from '../hooks/useTr';\nimport {\n PageHeader,\n MetricCard,\n SectionCard,\n LoadingBlock,\n ErrorState,\n StatusPill,\n fmtMoney,\n fmtHours,\n} from '../components/ui';\n\nconst QUICK: { key: string; to: string; icon: ReactNode }[] = [\n { key: 'clients', to: 'clients', icon: <Users className=\"h-4 w-4\" /> },\n { key: 'engagements', to: 'engagements', icon: <Briefcase className=\"h-4 w-4\" /> },\n { key: 'matters', to: 'matters', icon: <FolderKanban className=\"h-4 w-4\" /> },\n { key: 'time', to: 'time', icon: <Clock className=\"h-4 w-4\" /> },\n { key: 'invoices', to: 'invoices', icon: <Receipt className=\"h-4 w-4\" /> },\n { key: 'trust', to: 'trust', icon: <Wallet className=\"h-4 w-4\" /> },\n { key: 'compliance', to: 'compliance', icon: <ShieldCheck className=\"h-4 w-4\" /> },\n { key: 'conflicts', to: 'conflicts', icon: <Scale className=\"h-4 w-4\" /> },\n { key: 'documents', to: 'documents', icon: <FileText className=\"h-4 w-4\" /> },\n { key: 'practice-areas', to: 'practice-areas', icon: <Network className=\"h-4 w-4\" /> },\n { key: 'analytics', to: 'analytics', icon: <BarChart3 className=\"h-4 w-4\" /> },\n];\n\nexport const DashboardPage: FC = () => {\n const nav = useNav();\n const tr = useTr();\n const { data, isLoading, error, refetch } = useDashboardStats();\n\n if (isLoading)\n return <LoadingBlock label={tr('psw.dashboard.loading', 'Loading practice overview…')} />;\n if (error) return <ErrorState error={error} onRetry={() => void refetch()} />;\n if (!data) return null;\n\n return (\n <div className=\"space-y-6\">\n <PageHeader\n title={tr('psw.dashboard.title', 'Practice overview')}\n subtitle={tr(\n 'psw.dashboard.subtitle',\n 'One governed view of clients, engagements, matters, time and billing across your firm.'\n )}\n />\n\n <div className=\"grid grid-cols-2 gap-3 md:grid-cols-3 lg:grid-cols-4\">\n <MetricCard\n label={tr('psw.dashboard.activeClients', 'Active clients')}\n value={data.activeClients}\n hint={tr('psw.dashboard.totalClients', '{{count}} total', { count: data.totalClients })}\n icon={<Users className=\"h-4 w-4\" />}\n tone=\"success\"\n />\n <MetricCard\n label={tr('psw.dashboard.activeEngagements', 'Active engagements')}\n value={data.activeEngagements}\n icon={<Briefcase className=\"h-4 w-4\" />}\n tone=\"accent\"\n />\n <MetricCard\n label={tr('psw.dashboard.openMatters', 'Open matters')}\n value={data.openMatters}\n icon={<FolderKanban className=\"h-4 w-4\" />}\n tone=\"info\"\n />\n <MetricCard\n label={tr('psw.dashboard.unbilledHours', 'Unbilled hours')}\n value={fmtHours(data.unbilledHours)}\n hint={tr('psw.dashboard.billedHours', '{{count}} billed', {\n count: fmtHours(data.billedHours),\n })}\n icon={<Clock className=\"h-4 w-4\" />}\n tone=\"warning\"\n />\n <MetricCard\n label={tr('psw.dashboard.outstanding', 'Outstanding')}\n value={fmtMoney(data.outstandingInvoiceTotal)}\n hint={tr('psw.dashboard.outstandingHint', 'Sent + overdue')}\n icon={<Receipt className=\"h-4 w-4\" />}\n tone=\"warning\"\n />\n <MetricCard\n label={tr('psw.dashboard.collected', 'Collected')}\n value={fmtMoney(data.paidInvoiceTotal)}\n icon={<Receipt className=\"h-4 w-4\" />}\n tone=\"success\"\n />\n <MetricCard\n label={tr('psw.dashboard.trustHeld', 'Trust held')}\n value={fmtMoney(data.trustHeldTotal)}\n hint={\n data.activeTrustAccounts === 1\n ? tr('psw.dashboard.trustAccounts', '{{count}} active account', {\n count: data.activeTrustAccounts,\n })\n : tr('psw.dashboard.trustAccountsPlural', '{{count}} active accounts', {\n count: data.activeTrustAccounts,\n })\n }\n icon={<Wallet className=\"h-4 w-4\" />}\n tone=\"info\"\n />\n <MetricCard\n label={tr('psw.dashboard.complianceDue', 'Compliance due')}\n value={data.pendingComplianceChecks}\n icon={<ShieldCheck className=\"h-4 w-4\" />}\n tone={data.pendingComplianceChecks ? 'warning' : 'success'}\n />\n <MetricCard\n label={tr('psw.dashboard.openConflicts', 'Open conflicts')}\n value={data.openConflictChecks}\n icon={<GitBranch className=\"h-4 w-4\" />}\n tone={data.openConflictChecks ? 'danger' : 'success'}\n />\n </div>\n\n <div className=\"grid grid-cols-1 gap-4 lg:grid-cols-3\">\n <SectionCard title={tr('psw.dashboard.engagementsByStatus', 'Engagements by status')}>\n <StatusBreakdown items={data.engagementsByStatus} tr={tr} />\n </SectionCard>\n <SectionCard title={tr('psw.dashboard.mattersByStatus', 'Matters by status')}>\n <StatusBreakdown items={data.mattersByStatus} tr={tr} />\n </SectionCard>\n <SectionCard\n title={tr('psw.dashboard.revenue', 'Revenue')}\n description={tr('psw.dashboard.revenueDescription', 'Invoiced totals, recent months.')}\n >\n <RevenueBars data={data.revenueByMonth} tr={tr} />\n </SectionCard>\n </div>\n\n <SectionCard title={tr('psw.dashboard.jumpTo', 'Jump to')}>\n <div className=\"grid grid-cols-1 gap-2.5 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-5\">\n {QUICK.map((q) => (\n <button\n key={q.to}\n type=\"button\"\n onClick={() => nav(q.to)}\n className={cn(\n 'group flex items-center gap-3 rounded-xl border border-border-seam bg-bg-canvas px-3.5 py-3 text-left',\n 'transition hover:-translate-y-0.5 hover:border-accent hover:bg-bg-surface hover:shadow-sm'\n )}\n >\n <span className=\"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-bg-sunken text-accent transition group-hover:bg-accent/15\">\n {q.icon}\n </span>\n <span className=\"flex-1 truncate text-sm font-medium text-text-primary\">\n {tr(`psw.${q.key}.title`, q.key)}\n </span>\n <ArrowRight className=\"h-4 w-4 shrink-0 text-text-tertiary transition group-hover:translate-x-0.5 group-hover:text-accent\" />\n </button>\n ))}\n </div>\n </SectionCard>\n </div>\n );\n};\n\n// ---------------------------------------------------------------------------\n// Status breakdown — tone-colored, gradient horizontal bars with count + share\n// ---------------------------------------------------------------------------\nconst StatusBreakdown: FC<{\n items: { status: string; count: number }[];\n tr: ReturnType<typeof useTr>;\n}> = ({ items, tr }) => {\n if (!items.length)\n return (\n <p className=\"text-sm text-text-tertiary\">\n {tr('psw.dashboard.noRecords', 'No records yet.')}\n </p>\n );\n const max = Math.max(...items.map((i) => i.count), 1);\n const total = items.reduce((s, i) => s + i.count, 0) || 1;\n return (\n <ul className=\"space-y-3.5\">\n {items.map((i) => (\n <li\n key={i.status}\n className=\"grid grid-cols-[7.5rem_minmax(0,1fr)_auto] items-center gap-3\"\n >\n <StatusPill status={i.status} className=\"justify-self-start\" />\n <div className=\"h-2.5 overflow-hidden rounded-full bg-bg-sunken\">\n <div\n className={cn(\n 'h-full rounded-full bg-gradient-to-r transition-all duration-500',\n barGradientFor(i.status)\n )}\n style={{ width: `${Math.max((i.count / max) * 100, 4)}%` }}\n />\n </div>\n <span className=\"flex items-baseline justify-end gap-1.5 tabular-nums\">\n <span className=\"text-sm font-semibold text-text-primary\">{i.count}</span>\n <span className=\"text-xs text-text-tertiary\">\n {Math.round((i.count / total) * 100)}%\n </span>\n </span>\n </li>\n ))}\n </ul>\n );\n};\n\n// ---------------------------------------------------------------------------\n// Revenue column chart — y-axis scale + gridlines, gradient columns, hover\n// ---------------------------------------------------------------------------\nconst RevenueBars: FC<{\n data: { month: string; amount: number }[];\n tr: ReturnType<typeof useTr>;\n}> = ({ data, tr }) => {\n if (!data.length)\n return (\n <p className=\"text-sm text-text-tertiary\">\n {tr('psw.dashboard.noRevenue', 'No invoiced revenue yet.')}\n </p>\n );\n const peak = Math.max(...data.map((d) => d.amount), 1);\n const axisMax = niceCeil(peak);\n const ticks = [1, 0.75, 0.5, 0.25, 0].map((f) => axisMax * f);\n return (\n <div className=\"overflow-x-auto\">\n <div className=\"min-w-[260px]\">\n <div className=\"relative h-44\">\n {ticks.map((t, idx) => (\n <div\n key={t}\n className=\"absolute inset-x-0 flex items-center gap-2\"\n style={{ top: `${(idx / (ticks.length - 1)) * 100}%` }}\n >\n <span className=\"w-11 shrink-0 text-right text-[10px] leading-none tabular-nums text-text-tertiary\">\n {fmtCompactMoney(t)}\n </span>\n <span\n className={cn(\n 'h-px flex-1',\n idx === ticks.length - 1 ? 'bg-border-seam' : 'bg-border-seam/50'\n )}\n />\n </div>\n ))}\n <div className=\"absolute inset-0 flex items-end gap-1.5 pl-[3.25rem]\">\n {data.map((d) => (\n <div\n key={d.month}\n className=\"group flex h-full flex-1 flex-col items-center justify-end\"\n >\n <div\n className=\"w-full max-w-[2rem] rounded-t-md bg-gradient-to-t from-accent/55 to-accent shadow-sm transition-all duration-200 group-hover:-translate-y-0.5 group-hover:shadow\"\n style={{ height: `${Math.max((d.amount / axisMax) * 100, 1.5)}%` }}\n title={fmtMoney(d.amount)}\n />\n </div>\n ))}\n </div>\n </div>\n <div className=\"mt-2 flex gap-1.5 pl-[3.25rem]\">\n {data.map((d) => (\n <span key={d.month} className=\"flex-1 text-center text-[10px] text-text-tertiary\">\n {monthShort(d.month)}\n </span>\n ))}\n </div>\n </div>\n </div>\n );\n};\n\n// ---------------------------------------------------------------------------\n// Chart helpers (token-driven; self-contained to this page)\n// ---------------------------------------------------------------------------\ntype BarTone = 'success' | 'warning' | 'danger' | 'info' | 'accent' | 'neutral';\n\nconst BAR_GRADIENT: Record<BarTone, string> = {\n success: 'from-status-success-text/55 to-status-success-text',\n warning: 'from-status-warning-text/55 to-status-warning-text',\n danger: 'from-status-error-text/55 to-status-error-text',\n info: 'from-text-link/55 to-text-link',\n accent: 'from-accent/55 to-accent',\n neutral: 'from-text-tertiary/30 to-text-tertiary/70',\n};\n\n/** Mirror of the shared StatusPill tone mapping, used to tint chart bars. */\nconst STATUS_BAR_TONE: Record<string, BarTone> = {\n ACTIVE: 'success',\n DELIVERED: 'success',\n INVOICED: 'success',\n PAID: 'success',\n APPROVED: 'success',\n PASSED: 'success',\n CLEAR: 'success',\n COMPLETED: 'success',\n FINAL: 'success',\n PROSPECT: 'info',\n PROPOSAL: 'info',\n MEDIUM: 'info',\n INTERNAL_REVIEW: 'info',\n SUBMITTED: 'info',\n SENT: 'info',\n IN_REVIEW: 'info',\n REVIEW: 'warning',\n ON_HOLD: 'warning',\n HIGH: 'warning',\n CLIENT_REVIEW: 'warning',\n PENDING: 'warning',\n POTENTIAL_CONFLICT: 'warning',\n CANCELLED: 'danger',\n CRITICAL: 'danger',\n REJECTED: 'danger',\n OVERDUE: 'danger',\n FAILED: 'danger',\n CONFLICT: 'danger',\n ACCEPTED: 'accent',\n IN_PROGRESS: 'accent',\n OPEN: 'accent',\n BILLED: 'accent',\n INACTIVE: 'neutral',\n ARCHIVED: 'neutral',\n CLOSED: 'neutral',\n LOW: 'neutral',\n DRAFT: 'neutral',\n WAIVED: 'neutral',\n};\n\nfunction barGradientFor(status: string): string {\n return BAR_GRADIENT[STATUS_BAR_TONE[status] ?? 'accent'];\n}\n\n/** Round a peak value up to a clean axis maximum (1/2/2.5/5/10 × 10ⁿ). */\nfunction niceCeil(v: number): number {\n if (v <= 0) return 1;\n const pow = 10 ** Math.floor(Math.log10(v));\n const n = v / pow;\n const step = n <= 1 ? 1 : n <= 2 ? 2 : n <= 2.5 ? 2.5 : n <= 5 ? 5 : 10;\n return step * pow;\n}\n\nfunction fmtCompactMoney(n: number): string {\n if (n >= 1_000_000) return `$${(n / 1_000_000).toFixed(n % 1_000_000 === 0 ? 0 : 1)}M`;\n if (n >= 1_000) return `$${Math.round(n / 1_000)}k`;\n return `$${Math.round(n)}`;\n}\n\n/** \"2026-07\" → \"Jul\" (falls back to the raw value if unparseable). */\nfunction monthShort(m: string): string {\n const [y, mo] = m.split('-').map(Number);\n if (!y || !mo) return m;\n const d = new Date(y, mo - 1, 1);\n return Number.isNaN(d.getTime()) ? m : d.toLocaleDateString(undefined, { month: 'short' });\n}\n"],"mappings":";;;;;;;;AA+BA,IAAM,IAAwD;CAC5D;EAAE,KAAK;EAAW,IAAI;EAAW,MAAM,kBAAC,GAAD,EAAO,WAAU,UAAW,CAAA;CAAE;CACrE;EAAE,KAAK;EAAe,IAAI;EAAe,MAAM,kBAAC,GA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;CACR,SAAS;CACT,MAAM;CACN,eAAe;CACf,SAAS;CACT,oBAAoB;CACpB,WAAW;CACX,UAAU;CACV,UAAU;CACV,SAAS;CACT,QAAQ;CACR,UAAU;CACV,UAAU;CACV,aAAa;CACb,MAAM;CACN,QAAQ;CACR,UAAU;CACV,UAAU;CACV,QAAQ;CACR,KAAK;CACL,OAAO;CACP,QAAQ;AACV;AAEA,SAAS,EAAe,GAAwB;CAC9C,OAAO,EAAa,EAAgB,MAAW;AACjD;AAGA,SAAS,EAAS,GAAmB;CACnC,IAAI,KAAK,GAAG,OAAO;CACnB,IAAM,IAAM,MAAM,KAAK,MAAM,KAAK,MAAM,CAAC,CAAC,GACpC,IAAI,IAAI;CAEd,QADa,KAAK,IAAI,IAAI,KAAK,IAAI,IAAI,KAAK,MAAM,MAAM,KAAK,IAAI,IAAI,MACvD;AAChB;AAEA,SAAS,EAAgB,GAAmB;CAG1C,OAFI,KAAK,MAAkB,KAAK,IAAI,IAAA,CAAW,QAAQ,IAAI,OAAc,IAAI,IAAI,CAAC,EAAE,KAChF,KAAK,MAAc,IAAI,KAAK,MAAM,IAAI,GAAK,EAAE,KAC1C,IAAI,KAAK,MAAM,CAAC;AACzB;AAGA,SAAS,EAAW,GAAmB;CACrC,IAAM,CAAC,GAAG,KAAM,EAAE,MAAM,GAAG,CAAC,CAAC,IAAI,MAAM;CACvC,IAAI,CAAC,KAAK,CAAC,GAAI,OAAO;CACtB,IAAM,IAAI,IAAI,KAAK,GAAG,IAAK,GAAG,CAAC;CAC/B,OAAO,OAAO,MAAM,EAAE,QAAQ,CAAC,IAAI,IAAI,EAAE,mBAAmB,KAAA,GAAW,EAAE,OAAO,QAAQ,CAAC;AAC3F"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EngagementsPage.d.ts","sourceRoot":"","sources":["../../../src/proserviceworld/pages/EngagementsPage.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAwEhC,eAAO,MAAM,eAAe,EAAE,
|
|
1
|
+
{"version":3,"file":"EngagementsPage.d.ts","sourceRoot":"","sources":["../../../src/proserviceworld/pages/EngagementsPage.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAwEhC,eAAO,MAAM,eAAe,EAAE,EAyN7B,CAAC"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { useClients as e, useCreateEngagement as t, useEngagements as n, usePracticeAreas as r, useUpdateEngagement as i } from "../hooks/useProServiceWorldApi.js";
|
|
2
2
|
import { useNav as a } from "../utils/nav.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { useTr as o } from "../hooks/useTr.js";
|
|
4
|
+
import { Banner as s, Empty as c, ErrorState as l, Field as u, LoadingBlock as d, Modal as f, NativeSelect as p, PageHeader as m, SectionCard as h, StatusPill as g, TableWrap as _, Td as v, TextArea as y, TextInput as b, Th as x, enumOptions as S, fmtDate as ee, fmtMoney as C, humanize as w } from "../components/ui.js";
|
|
5
5
|
import { useAnalytics as T } from "../hooks/useAnalytics.js";
|
|
6
6
|
import { impactFeedback as E } from "../utils/native.js";
|
|
7
7
|
import { TagPicker as D } from "../components/TagPicker.js";
|
|
8
8
|
import { LoadMore as te } from "../components/LoadMore.js";
|
|
9
9
|
import { useMemo as O, useState as k } from "react";
|
|
10
|
-
import { Briefcase as A, ChevronRight as
|
|
10
|
+
import { Briefcase as A, ChevronRight as ne, Plus as j, Search as M } from "lucide-react";
|
|
11
11
|
import { Fragment as N, jsx as P, jsxs as F } from "react/jsx-runtime";
|
|
12
12
|
import { Button as I } from "@burdenoff/fe-libs/ui";
|
|
13
13
|
//#region src/proserviceworld/pages/EngagementsPage.tsx
|
|
@@ -30,61 +30,61 @@ var re = [
|
|
|
30
30
|
"aria-hidden": !0,
|
|
31
31
|
children: R(e)
|
|
32
32
|
}), z = 25, B = () => {
|
|
33
|
-
let t = a(), { emitIntent:
|
|
33
|
+
let t = a(), r = o(), { emitIntent: u, emitFact: f } = T(), [y, N] = k(""), [L, R] = k(""), [B, H] = k(""), [U, W] = k(!1), [G, K] = k(null), [q, J] = k({
|
|
34
34
|
limit: z,
|
|
35
35
|
offset: 0
|
|
36
|
-
}),
|
|
37
|
-
search:
|
|
38
|
-
status:
|
|
39
|
-
clientId:
|
|
40
|
-
pagination:
|
|
36
|
+
}), ae = e({ pagination: { limit: 100 } }), oe = i(), { data: Y, isLoading: X, error: Z, refetch: Q } = n({
|
|
37
|
+
search: y.trim() || void 0,
|
|
38
|
+
status: L || void 0,
|
|
39
|
+
clientId: B || void 0,
|
|
40
|
+
pagination: q
|
|
41
41
|
}), $ = O(() => Y?.items ?? [], [Y]);
|
|
42
42
|
return /* @__PURE__ */ F("div", {
|
|
43
43
|
className: "space-y-6",
|
|
44
44
|
children: [
|
|
45
|
-
/* @__PURE__ */ P(
|
|
46
|
-
title:
|
|
47
|
-
subtitle:
|
|
45
|
+
/* @__PURE__ */ P(m, {
|
|
46
|
+
title: r("psw.engagements.title", "Engagements"),
|
|
47
|
+
subtitle: r("psw.engagements.subtitle", "The commercial containers of contracted work — scope, fee arrangement, delivery lifecycle, and billing."),
|
|
48
48
|
icon: /* @__PURE__ */ P(A, { className: "h-6 w-6" }),
|
|
49
49
|
actions: /* @__PURE__ */ F(I, {
|
|
50
50
|
onClick: () => {
|
|
51
|
-
E("light"),
|
|
51
|
+
E("light"), u("psw.engagement.create_clicked"), W(!0);
|
|
52
52
|
},
|
|
53
|
-
children: [/* @__PURE__ */ P(
|
|
53
|
+
children: [/* @__PURE__ */ P(j, { className: "mr-1.5 h-4 w-4" }), r("psw.engagements.new", "New engagement")]
|
|
54
54
|
})
|
|
55
55
|
}),
|
|
56
|
-
|
|
56
|
+
G && /* @__PURE__ */ P(s, {
|
|
57
57
|
tone: "success",
|
|
58
|
-
onClose: () =>
|
|
59
|
-
children:
|
|
58
|
+
onClose: () => K(null),
|
|
59
|
+
children: G
|
|
60
60
|
}),
|
|
61
61
|
/* @__PURE__ */ F("div", {
|
|
62
62
|
className: "flex flex-col gap-2 sm:flex-row sm:items-center",
|
|
63
63
|
children: [
|
|
64
64
|
/* @__PURE__ */ F("div", {
|
|
65
65
|
className: "relative flex-1",
|
|
66
|
-
children: [/* @__PURE__ */ P(
|
|
67
|
-
placeholder:
|
|
68
|
-
value:
|
|
66
|
+
children: [/* @__PURE__ */ P(M, { className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-text-tertiary" }), /* @__PURE__ */ P(b, {
|
|
67
|
+
placeholder: r("psw.engagements.searchPlaceholder", "Search engagements…"),
|
|
68
|
+
value: y,
|
|
69
69
|
onChange: (e) => {
|
|
70
|
-
|
|
70
|
+
N(e.target.value), J({
|
|
71
71
|
limit: z,
|
|
72
72
|
offset: 0
|
|
73
73
|
});
|
|
74
74
|
},
|
|
75
75
|
onKeyDown: (e) => {
|
|
76
|
-
e.key === "Enter" &&
|
|
76
|
+
e.key === "Enter" && y.trim() && f("psw.search.performed", {
|
|
77
77
|
entityType: "engagement",
|
|
78
|
-
queryLength:
|
|
78
|
+
queryLength: y.trim().length
|
|
79
79
|
});
|
|
80
80
|
},
|
|
81
81
|
className: "pl-9"
|
|
82
82
|
})]
|
|
83
83
|
}),
|
|
84
|
-
/* @__PURE__ */ F(
|
|
85
|
-
value:
|
|
84
|
+
/* @__PURE__ */ F(p, {
|
|
85
|
+
value: L,
|
|
86
86
|
onChange: (e) => {
|
|
87
|
-
|
|
87
|
+
R(e.target.value), J({
|
|
88
88
|
limit: z,
|
|
89
89
|
offset: 0
|
|
90
90
|
});
|
|
@@ -92,13 +92,13 @@ var re = [
|
|
|
92
92
|
className: "sm:w-44",
|
|
93
93
|
children: [/* @__PURE__ */ P("option", {
|
|
94
94
|
value: "",
|
|
95
|
-
children:
|
|
96
|
-
}),
|
|
95
|
+
children: r("psw.engagements.allStatuses", "All statuses")
|
|
96
|
+
}), S(re)]
|
|
97
97
|
}),
|
|
98
|
-
/* @__PURE__ */ F(
|
|
99
|
-
value:
|
|
98
|
+
/* @__PURE__ */ F(p, {
|
|
99
|
+
value: B,
|
|
100
100
|
onChange: (e) => {
|
|
101
|
-
|
|
101
|
+
H(e.target.value), J({
|
|
102
102
|
limit: z,
|
|
103
103
|
offset: 0
|
|
104
104
|
});
|
|
@@ -106,53 +106,53 @@ var re = [
|
|
|
106
106
|
className: "sm:w-48",
|
|
107
107
|
children: [/* @__PURE__ */ P("option", {
|
|
108
108
|
value: "",
|
|
109
|
-
children:
|
|
110
|
-
}),
|
|
109
|
+
children: r("psw.engagements.allClients", "All clients")
|
|
110
|
+
}), ae.data?.items.map((e) => /* @__PURE__ */ P("option", {
|
|
111
111
|
value: e.id,
|
|
112
112
|
children: e.name
|
|
113
113
|
}, e.id))]
|
|
114
114
|
})
|
|
115
115
|
]
|
|
116
116
|
}),
|
|
117
|
-
X ? /* @__PURE__ */ P(
|
|
117
|
+
X ? /* @__PURE__ */ P(d, {}) : Z ? /* @__PURE__ */ P(l, {
|
|
118
118
|
error: Z,
|
|
119
119
|
onRetry: () => void Q()
|
|
120
|
-
}) : !Y || Y.items.length === 0 ? /* @__PURE__ */ P(
|
|
121
|
-
title:
|
|
122
|
-
description:
|
|
120
|
+
}) : !Y || Y.items.length === 0 ? /* @__PURE__ */ P(c, {
|
|
121
|
+
title: r("psw.engagements.emptyTitle", "No engagements yet"),
|
|
122
|
+
description: r("psw.engagements.emptyDescription", "Create your first engagement to scope work, set fees, and track delivery."),
|
|
123
123
|
icon: /* @__PURE__ */ P(A, { className: "h-8 w-8" }),
|
|
124
124
|
action: /* @__PURE__ */ F(I, {
|
|
125
|
-
onClick: () =>
|
|
126
|
-
children: [/* @__PURE__ */ P(
|
|
125
|
+
onClick: () => W(!0),
|
|
126
|
+
children: [/* @__PURE__ */ P(j, { className: "mr-1.5 h-4 w-4" }), r("psw.engagements.new", "New engagement")]
|
|
127
127
|
})
|
|
128
|
-
}) : /* @__PURE__ */ F(
|
|
129
|
-
title:
|
|
130
|
-
children: [/* @__PURE__ */ F(
|
|
131
|
-
/* @__PURE__ */ P(
|
|
132
|
-
/* @__PURE__ */ P(
|
|
133
|
-
/* @__PURE__ */ P(
|
|
134
|
-
/* @__PURE__ */ P(
|
|
135
|
-
/* @__PURE__ */ P(
|
|
136
|
-
/* @__PURE__ */ P(
|
|
128
|
+
}) : /* @__PURE__ */ F(h, {
|
|
129
|
+
title: Y.totalCount === 1 ? r("psw.engagements.count", "{{count}} engagement", { count: Y.totalCount }) : r("psw.engagements.countPlural", "{{count}} engagements", { count: Y.totalCount }),
|
|
130
|
+
children: [/* @__PURE__ */ F(_, { children: [/* @__PURE__ */ P("thead", { children: /* @__PURE__ */ F("tr", { children: [
|
|
131
|
+
/* @__PURE__ */ P(x, { children: r("psw.engagements.tableEngagement", "Engagement") }),
|
|
132
|
+
/* @__PURE__ */ P(x, { children: r("psw.engagements.tableClient", "Client") }),
|
|
133
|
+
/* @__PURE__ */ P(x, { children: r("psw.engagements.tableFee", "Fee") }),
|
|
134
|
+
/* @__PURE__ */ P(x, { children: r("psw.engagements.tableStatus", "Status") }),
|
|
135
|
+
/* @__PURE__ */ P(x, { children: r("psw.engagements.tableStarted", "Started") }),
|
|
136
|
+
/* @__PURE__ */ P(x, { children: r("psw.engagements.tableTags", "Tags") })
|
|
137
137
|
] }) }), /* @__PURE__ */ P("tbody", { children: Y.items.map((e) => /* @__PURE__ */ F("tr", {
|
|
138
138
|
className: "group cursor-pointer transition-colors hover:bg-bg-sunken/60",
|
|
139
139
|
onClick: () => t(`engagements/${e.id}`),
|
|
140
140
|
children: [
|
|
141
|
-
/* @__PURE__ */ F(
|
|
141
|
+
/* @__PURE__ */ F(v, { children: [/* @__PURE__ */ F("div", {
|
|
142
142
|
className: "flex items-center gap-1 font-medium text-text-primary transition-colors group-hover:text-accent",
|
|
143
|
-
children: [/* @__PURE__ */ P("span", { children: e.name }), /* @__PURE__ */ P(
|
|
143
|
+
children: [/* @__PURE__ */ P("span", { children: e.name }), /* @__PURE__ */ P(ne, { className: "h-3.5 w-3.5 shrink-0 text-text-tertiary opacity-0 transition-opacity group-hover:opacity-100" })]
|
|
144
144
|
}), e.description ? /* @__PURE__ */ P("div", {
|
|
145
145
|
className: "mt-0.5 max-w-md truncate text-xs text-text-tertiary",
|
|
146
146
|
children: e.description
|
|
147
147
|
}) : null] }),
|
|
148
|
-
/* @__PURE__ */ P(
|
|
148
|
+
/* @__PURE__ */ P(v, { children: /* @__PURE__ */ F("span", {
|
|
149
149
|
className: "inline-flex items-center gap-2.5",
|
|
150
|
-
children: [/* @__PURE__ */ P(ie, { name: e.client?.name ?? "—" }), /* @__PURE__ */ P("span", {
|
|
150
|
+
children: [/* @__PURE__ */ P(ie, { name: e.client?.name ?? r("psw.common.dash", "—") }), /* @__PURE__ */ P("span", {
|
|
151
151
|
className: "text-text-secondary",
|
|
152
|
-
children: e.client?.name ?? "—"
|
|
152
|
+
children: e.client?.name ?? r("psw.common.dash", "—")
|
|
153
153
|
})]
|
|
154
154
|
}) }),
|
|
155
|
-
/* @__PURE__ */ F(
|
|
155
|
+
/* @__PURE__ */ F(v, {
|
|
156
156
|
className: "whitespace-nowrap",
|
|
157
157
|
children: [
|
|
158
158
|
/* @__PURE__ */ P("span", {
|
|
@@ -162,16 +162,16 @@ var re = [
|
|
|
162
162
|
" ",
|
|
163
163
|
/* @__PURE__ */ F("span", {
|
|
164
164
|
className: "text-xs text-text-tertiary",
|
|
165
|
-
children: ["/ ",
|
|
165
|
+
children: ["/ ", w(e.feeArrangement)]
|
|
166
166
|
})
|
|
167
167
|
]
|
|
168
168
|
}),
|
|
169
|
-
/* @__PURE__ */ P(
|
|
170
|
-
/* @__PURE__ */ P(
|
|
169
|
+
/* @__PURE__ */ P(v, { children: /* @__PURE__ */ P(g, { status: e.status }) }),
|
|
170
|
+
/* @__PURE__ */ P(v, {
|
|
171
171
|
className: "whitespace-nowrap",
|
|
172
|
-
children:
|
|
172
|
+
children: ee(e.startDate)
|
|
173
173
|
}),
|
|
174
|
-
/* @__PURE__ */ P(
|
|
174
|
+
/* @__PURE__ */ P(v, { children: /* @__PURE__ */ P("div", {
|
|
175
175
|
onClick: (e) => e.stopPropagation(),
|
|
176
176
|
role: "presentation",
|
|
177
177
|
children: /* @__PURE__ */ P(D, {
|
|
@@ -179,7 +179,7 @@ var re = [
|
|
|
179
179
|
entityId: e.id,
|
|
180
180
|
tags: e.tags ?? [],
|
|
181
181
|
onChange: async (t) => {
|
|
182
|
-
await
|
|
182
|
+
await oe.mutateAsync({
|
|
183
183
|
id: e.id,
|
|
184
184
|
input: { tags: t }
|
|
185
185
|
}), Q();
|
|
@@ -193,20 +193,20 @@ var re = [
|
|
|
193
193
|
loading: X,
|
|
194
194
|
loadedCount: $.length,
|
|
195
195
|
totalCount: Y?.totalCount ?? $.length,
|
|
196
|
-
onLoadMore: () =>
|
|
196
|
+
onLoadMore: () => J((e) => ({
|
|
197
197
|
limit: z,
|
|
198
198
|
offset: e.offset + z
|
|
199
199
|
}))
|
|
200
200
|
})]
|
|
201
201
|
}),
|
|
202
|
-
|
|
203
|
-
onClose: () =>
|
|
204
|
-
onSaved: (e) =>
|
|
202
|
+
U && /* @__PURE__ */ P(V, {
|
|
203
|
+
onClose: () => W(!1),
|
|
204
|
+
onSaved: (e) => K(r("psw.engagements.created", "{{name}} created.", { name: e }))
|
|
205
205
|
})
|
|
206
206
|
]
|
|
207
207
|
});
|
|
208
208
|
}, V = ({ onClose: n, onSaved: i }) => {
|
|
209
|
-
let a = t(), { emitFact:
|
|
209
|
+
let a = o(), c = t(), { emitFact: l } = T(), d = e({ pagination: { limit: 100 } }), m = r(), [h, g] = k({
|
|
210
210
|
clientId: "",
|
|
211
211
|
practiceAreaId: "",
|
|
212
212
|
name: "",
|
|
@@ -215,86 +215,86 @@ var re = [
|
|
|
215
215
|
feeAmount: "",
|
|
216
216
|
currency: "USD",
|
|
217
217
|
startDate: ""
|
|
218
|
-
}), [
|
|
218
|
+
}), [_, v] = k(null), x = (e) => (t) => g((n) => ({
|
|
219
219
|
...n,
|
|
220
220
|
[e]: t.target.value
|
|
221
221
|
}));
|
|
222
|
-
return /* @__PURE__ */ P(
|
|
222
|
+
return /* @__PURE__ */ P(f, {
|
|
223
223
|
open: !0,
|
|
224
224
|
onClose: n,
|
|
225
|
-
title:
|
|
225
|
+
title: a("psw.engagements.newTitle", "New engagement"),
|
|
226
226
|
footer: /* @__PURE__ */ F(N, { children: [/* @__PURE__ */ P(I, {
|
|
227
227
|
variant: "outline",
|
|
228
228
|
onClick: n,
|
|
229
|
-
disabled:
|
|
230
|
-
children: "Cancel"
|
|
229
|
+
disabled: c.isPending,
|
|
230
|
+
children: a("psw.common.cancel", "Cancel")
|
|
231
231
|
}), /* @__PURE__ */ P(I, {
|
|
232
232
|
onClick: () => {
|
|
233
|
-
if (
|
|
234
|
-
if (!
|
|
235
|
-
|
|
236
|
-
clientId:
|
|
237
|
-
practiceAreaId:
|
|
238
|
-
name:
|
|
239
|
-
description:
|
|
240
|
-
feeArrangement:
|
|
241
|
-
feeAmount:
|
|
242
|
-
currency:
|
|
243
|
-
startDate:
|
|
233
|
+
if (v(null), !h.clientId) return v(a("psw.engagements.selectClient", "Select a client."));
|
|
234
|
+
if (!h.name.trim()) return v(a("psw.engagements.nameRequired", "Engagement name is required."));
|
|
235
|
+
c.mutate({
|
|
236
|
+
clientId: h.clientId,
|
|
237
|
+
practiceAreaId: h.practiceAreaId || null,
|
|
238
|
+
name: h.name.trim(),
|
|
239
|
+
description: h.description.trim() || null,
|
|
240
|
+
feeArrangement: h.feeArrangement,
|
|
241
|
+
feeAmount: h.feeAmount ? Number(h.feeAmount) : 0,
|
|
242
|
+
currency: h.currency || "USD",
|
|
243
|
+
startDate: h.startDate ? new Date(h.startDate).toISOString() : null
|
|
244
244
|
}, {
|
|
245
245
|
onSuccess: (e) => {
|
|
246
246
|
let t = e.pswCreateEngagement;
|
|
247
|
-
|
|
247
|
+
l("psw.engagement.created", {
|
|
248
248
|
engagementId: t.id,
|
|
249
|
-
clientId:
|
|
250
|
-
}), i(
|
|
249
|
+
clientId: h.clientId
|
|
250
|
+
}), i(h.name.trim()), n();
|
|
251
251
|
},
|
|
252
|
-
onError: (e) =>
|
|
252
|
+
onError: (e) => v(e instanceof Error ? e.message : a("psw.engagements.createFailed", "Failed."))
|
|
253
253
|
});
|
|
254
254
|
},
|
|
255
|
-
disabled:
|
|
256
|
-
children:
|
|
255
|
+
disabled: c.isPending,
|
|
256
|
+
children: c.isPending ? a("psw.common.creating", "Creating…") : a("psw.common.create", "Create engagement")
|
|
257
257
|
})] }),
|
|
258
258
|
children: /* @__PURE__ */ F("div", {
|
|
259
259
|
className: "space-y-3",
|
|
260
260
|
children: [
|
|
261
|
-
|
|
261
|
+
_ && /* @__PURE__ */ P(s, {
|
|
262
262
|
tone: "danger",
|
|
263
|
-
children:
|
|
263
|
+
children: _
|
|
264
264
|
}),
|
|
265
|
-
/* @__PURE__ */ P(
|
|
266
|
-
label: "Client",
|
|
265
|
+
/* @__PURE__ */ P(u, {
|
|
266
|
+
label: a("psw.engagements.client", "Client"),
|
|
267
267
|
required: !0,
|
|
268
|
-
children: /* @__PURE__ */ F(
|
|
269
|
-
value:
|
|
270
|
-
onChange:
|
|
268
|
+
children: /* @__PURE__ */ F(p, {
|
|
269
|
+
value: h.clientId,
|
|
270
|
+
onChange: x("clientId"),
|
|
271
271
|
children: [/* @__PURE__ */ P("option", {
|
|
272
272
|
value: "",
|
|
273
|
-
children: "Select a client…"
|
|
274
|
-
}),
|
|
273
|
+
children: a("psw.engagements.selectClientPlaceholder", "Select a client…")
|
|
274
|
+
}), d.data?.items.map((e) => /* @__PURE__ */ P("option", {
|
|
275
275
|
value: e.id,
|
|
276
276
|
children: e.name
|
|
277
277
|
}, e.id))]
|
|
278
278
|
})
|
|
279
279
|
}),
|
|
280
|
-
/* @__PURE__ */ P(
|
|
281
|
-
label: "Name",
|
|
280
|
+
/* @__PURE__ */ P(u, {
|
|
281
|
+
label: a("psw.engagements.name", "Name"),
|
|
282
282
|
required: !0,
|
|
283
|
-
children: /* @__PURE__ */ P(
|
|
284
|
-
value:
|
|
285
|
-
onChange:
|
|
286
|
-
placeholder: "FY26 Statutory Audit"
|
|
283
|
+
children: /* @__PURE__ */ P(b, {
|
|
284
|
+
value: h.name,
|
|
285
|
+
onChange: x("name"),
|
|
286
|
+
placeholder: a("psw.engagements.namePlaceholder", "FY26 Statutory Audit")
|
|
287
287
|
})
|
|
288
288
|
}),
|
|
289
|
-
/* @__PURE__ */ P(
|
|
290
|
-
label: "Practice area",
|
|
291
|
-
children: /* @__PURE__ */ F(
|
|
292
|
-
value:
|
|
293
|
-
onChange:
|
|
289
|
+
/* @__PURE__ */ P(u, {
|
|
290
|
+
label: a("psw.engagements.practiceArea", "Practice area"),
|
|
291
|
+
children: /* @__PURE__ */ F(p, {
|
|
292
|
+
value: h.practiceAreaId,
|
|
293
|
+
onChange: x("practiceAreaId"),
|
|
294
294
|
children: [/* @__PURE__ */ P("option", {
|
|
295
295
|
value: "",
|
|
296
|
-
children: "Unassigned"
|
|
297
|
-
}),
|
|
296
|
+
children: a("psw.engagements.unassigned", "Unassigned")
|
|
297
|
+
}), m.data?.items.map((e) => /* @__PURE__ */ P("option", {
|
|
298
298
|
value: e.id,
|
|
299
299
|
children: e.name
|
|
300
300
|
}, e.id))]
|
|
@@ -303,47 +303,47 @@ var re = [
|
|
|
303
303
|
/* @__PURE__ */ F("div", {
|
|
304
304
|
className: "grid grid-cols-3 gap-3",
|
|
305
305
|
children: [
|
|
306
|
-
/* @__PURE__ */ P(
|
|
307
|
-
label: "Fee type",
|
|
308
|
-
children: /* @__PURE__ */ P(
|
|
309
|
-
value:
|
|
310
|
-
onChange:
|
|
311
|
-
children:
|
|
306
|
+
/* @__PURE__ */ P(u, {
|
|
307
|
+
label: a("psw.engagements.feeType", "Fee type"),
|
|
308
|
+
children: /* @__PURE__ */ P(p, {
|
|
309
|
+
value: h.feeArrangement,
|
|
310
|
+
onChange: x("feeArrangement"),
|
|
311
|
+
children: S(L)
|
|
312
312
|
})
|
|
313
313
|
}),
|
|
314
|
-
/* @__PURE__ */ P(
|
|
315
|
-
label: "Fee amount",
|
|
316
|
-
children: /* @__PURE__ */ P(
|
|
314
|
+
/* @__PURE__ */ P(u, {
|
|
315
|
+
label: a("psw.engagements.feeAmount", "Fee amount"),
|
|
316
|
+
children: /* @__PURE__ */ P(b, {
|
|
317
317
|
type: "number",
|
|
318
318
|
min: "0",
|
|
319
|
-
value:
|
|
320
|
-
onChange:
|
|
319
|
+
value: h.feeAmount,
|
|
320
|
+
onChange: x("feeAmount"),
|
|
321
321
|
placeholder: "50000"
|
|
322
322
|
})
|
|
323
323
|
}),
|
|
324
|
-
/* @__PURE__ */ P(
|
|
325
|
-
label: "Currency",
|
|
326
|
-
children: /* @__PURE__ */ P(
|
|
327
|
-
value:
|
|
328
|
-
onChange:
|
|
324
|
+
/* @__PURE__ */ P(u, {
|
|
325
|
+
label: a("psw.engagements.currency", "Currency"),
|
|
326
|
+
children: /* @__PURE__ */ P(b, {
|
|
327
|
+
value: h.currency,
|
|
328
|
+
onChange: x("currency"),
|
|
329
329
|
maxLength: 3
|
|
330
330
|
})
|
|
331
331
|
})
|
|
332
332
|
]
|
|
333
333
|
}),
|
|
334
|
-
/* @__PURE__ */ P(
|
|
335
|
-
label: "Start date",
|
|
336
|
-
children: /* @__PURE__ */ P(
|
|
334
|
+
/* @__PURE__ */ P(u, {
|
|
335
|
+
label: a("psw.engagements.startDate", "Start date"),
|
|
336
|
+
children: /* @__PURE__ */ P(b, {
|
|
337
337
|
type: "date",
|
|
338
|
-
value:
|
|
339
|
-
onChange:
|
|
338
|
+
value: h.startDate,
|
|
339
|
+
onChange: x("startDate")
|
|
340
340
|
})
|
|
341
341
|
}),
|
|
342
|
-
/* @__PURE__ */ P(
|
|
343
|
-
label: "Description",
|
|
344
|
-
children: /* @__PURE__ */ P(
|
|
345
|
-
value:
|
|
346
|
-
onChange:
|
|
342
|
+
/* @__PURE__ */ P(u, {
|
|
343
|
+
label: a("psw.engagements.description", "Description"),
|
|
344
|
+
children: /* @__PURE__ */ P(y, {
|
|
345
|
+
value: h.description,
|
|
346
|
+
onChange: x("description")
|
|
347
347
|
})
|
|
348
348
|
})
|
|
349
349
|
]
|