@burdenoff/microfe-govcitizenhub 2026.1201.1 → 2026.1202.2
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/govcitizenhub/components/DocumentUploadField.js +1 -1
- package/dist/govcitizenhub/components/DocumentUploadField.js.map +1 -1
- package/dist/govcitizenhub/components/EmptyState.d.ts +19 -1
- package/dist/govcitizenhub/components/EmptyState.js +36 -16
- package/dist/govcitizenhub/components/EmptyState.js.map +1 -1
- package/dist/govcitizenhub/components/FilterTabs.js +1 -1
- package/dist/govcitizenhub/components/FilterTabs.js.map +1 -1
- package/dist/govcitizenhub/components/GovCharts.js +1 -1
- package/dist/govcitizenhub/components/GovCharts.js.map +1 -1
- package/dist/govcitizenhub/components/KeyValueList.js +1 -1
- package/dist/govcitizenhub/components/KeyValueList.js.map +1 -1
- package/dist/govcitizenhub/components/Pagination.js +2 -2
- package/dist/govcitizenhub/components/Pagination.js.map +1 -1
- package/dist/govcitizenhub/components/StatusStepper.js +2 -2
- package/dist/govcitizenhub/components/StatusStepper.js.map +1 -1
- package/dist/govcitizenhub/components/SummaryStrip.js +2 -2
- package/dist/govcitizenhub/components/SummaryStrip.js.map +1 -1
- package/dist/govcitizenhub/components/Timeline.js +2 -2
- package/dist/govcitizenhub/components/Timeline.js.map +1 -1
- package/dist/govcitizenhub/components/mobile/MobileLayout.d.ts +5 -0
- package/dist/govcitizenhub/components/mobile/MobileLayout.js +14 -7
- package/dist/govcitizenhub/components/mobile/MobileLayout.js.map +1 -1
- package/dist/govcitizenhub/context/GovCitizenHubContext.js +26 -22
- package/dist/govcitizenhub/context/GovCitizenHubContext.js.map +1 -1
- package/dist/govcitizenhub/hooks/uploadVisibility.d.ts +2 -0
- package/dist/govcitizenhub/hooks/uploadVisibility.js +8 -0
- package/dist/govcitizenhub/hooks/uploadVisibility.js.map +1 -0
- package/dist/govcitizenhub/hooks/useFiles.d.ts +3 -18
- package/dist/govcitizenhub/hooks/useFiles.js +49 -48
- package/dist/govcitizenhub/hooks/useFiles.js.map +1 -1
- package/dist/govcitizenhub/pages/CitizenHomePage.js +3 -3
- package/dist/govcitizenhub/pages/CitizenHomePage.js.map +1 -1
- package/dist/govcitizenhub/pages/DashboardPage.js +11 -11
- package/dist/govcitizenhub/pages/DashboardPage.js.map +1 -1
- package/dist/govcitizenhub/pages/access-control/AccessControlPage.js +42 -42
- package/dist/govcitizenhub/pages/access-control/AccessControlPage.js.map +1 -1
- package/dist/govcitizenhub/pages/agencies/AgenciesPage.js +4 -4
- package/dist/govcitizenhub/pages/agencies/AgenciesPage.js.map +1 -1
- package/dist/govcitizenhub/pages/applications/ApplicationDetailPage.js +4 -4
- package/dist/govcitizenhub/pages/applications/ApplicationDetailPage.js.map +1 -1
- package/dist/govcitizenhub/pages/applications/ApplicationsPage.js +8 -8
- package/dist/govcitizenhub/pages/applications/ApplicationsPage.js.map +1 -1
- package/dist/govcitizenhub/pages/applications/NewApplicationPage.js +7 -7
- package/dist/govcitizenhub/pages/applications/NewApplicationPage.js.map +1 -1
- package/dist/govcitizenhub/pages/documents/DocumentsPage.js +2 -2
- package/dist/govcitizenhub/pages/documents/DocumentsPage.js.map +1 -1
- package/dist/govcitizenhub/pages/grievances/GrievanceDetailPage.js +3 -3
- package/dist/govcitizenhub/pages/grievances/GrievanceDetailPage.js.map +1 -1
- package/dist/govcitizenhub/pages/grievances/GrievancesPage.js +9 -9
- package/dist/govcitizenhub/pages/grievances/GrievancesPage.js.map +1 -1
- package/dist/govcitizenhub/pages/intelligence/AdminLevelsPage.js +11 -11
- package/dist/govcitizenhub/pages/intelligence/AdminLevelsPage.js.map +1 -1
- package/dist/govcitizenhub/pages/intelligence/AssetFormDialog.js +1 -1
- package/dist/govcitizenhub/pages/intelligence/AssetFormDialog.js.map +1 -1
- package/dist/govcitizenhub/pages/intelligence/BenchmarkPage.js +13 -13
- package/dist/govcitizenhub/pages/intelligence/BenchmarkPage.js.map +1 -1
- package/dist/govcitizenhub/pages/intelligence/BudgetPage.js +28 -28
- package/dist/govcitizenhub/pages/intelligence/BudgetPage.js.map +1 -1
- package/dist/govcitizenhub/pages/intelligence/ConsultationFormDialog.js +2 -2
- package/dist/govcitizenhub/pages/intelligence/ConsultationFormDialog.js.map +1 -1
- package/dist/govcitizenhub/pages/intelligence/ConsultationParticipateDialog.js +3 -3
- package/dist/govcitizenhub/pages/intelligence/ConsultationParticipateDialog.js.map +1 -1
- package/dist/govcitizenhub/pages/intelligence/ConsultationsPage.js +13 -13
- package/dist/govcitizenhub/pages/intelligence/ConsultationsPage.js.map +1 -1
- package/dist/govcitizenhub/pages/intelligence/CorrectionsPage.js +5 -5
- package/dist/govcitizenhub/pages/intelligence/CorrectionsPage.js.map +1 -1
- package/dist/govcitizenhub/pages/intelligence/ElectionsPage.js +16 -16
- package/dist/govcitizenhub/pages/intelligence/ElectionsPage.js.map +1 -1
- package/dist/govcitizenhub/pages/intelligence/GovernancePage.js +6 -6
- package/dist/govcitizenhub/pages/intelligence/GovernancePage.js.map +1 -1
- package/dist/govcitizenhub/pages/intelligence/IndicatorCatalogPage.js +16 -16
- package/dist/govcitizenhub/pages/intelligence/IndicatorCatalogPage.js.map +1 -1
- package/dist/govcitizenhub/pages/intelligence/IndicatorsPage.js +10 -10
- package/dist/govcitizenhub/pages/intelligence/IndicatorsPage.js.map +1 -1
- package/dist/govcitizenhub/pages/intelligence/JurisdictionDirectoryPage.js +7 -7
- package/dist/govcitizenhub/pages/intelligence/JurisdictionDirectoryPage.js.map +1 -1
- package/dist/govcitizenhub/pages/intelligence/JurisdictionLayout.js +2 -2
- package/dist/govcitizenhub/pages/intelligence/JurisdictionLayout.js.map +1 -1
- package/dist/govcitizenhub/pages/intelligence/JurisdictionProfilePage.js +2 -2
- package/dist/govcitizenhub/pages/intelligence/JurisdictionProfilePage.js.map +1 -1
- package/dist/govcitizenhub/pages/intelligence/OpenDataPage.js +18 -18
- package/dist/govcitizenhub/pages/intelligence/OpenDataPage.js.map +1 -1
- package/dist/govcitizenhub/pages/intelligence/ProjectsPage.js +14 -14
- package/dist/govcitizenhub/pages/intelligence/ProjectsPage.js.map +1 -1
- package/dist/govcitizenhub/pages/intelligence/PublicAssetsPage.js +8 -8
- package/dist/govcitizenhub/pages/intelligence/PublicAssetsPage.js.map +1 -1
- package/dist/govcitizenhub/pages/intelligence/ServicePerformancePage.js +27 -27
- package/dist/govcitizenhub/pages/intelligence/ServicePerformancePage.js.map +1 -1
- package/dist/govcitizenhub/pages/intelligence/TimelinePage.js +3 -3
- package/dist/govcitizenhub/pages/intelligence/TimelinePage.js.map +1 -1
- package/dist/govcitizenhub/pages/mobile/MobileHomePage.js +3 -3
- package/dist/govcitizenhub/pages/mobile/MobileHomePage.js.map +1 -1
- package/dist/govcitizenhub/pages/mobile/MobileProfilePage.js +1 -1
- package/dist/govcitizenhub/pages/mobile/MobileProfilePage.js.map +1 -1
- package/dist/govcitizenhub/pages/mobile/MobileRequestsPage.js +1 -1
- package/dist/govcitizenhub/pages/mobile/MobileRequestsPage.js.map +1 -1
- package/dist/govcitizenhub/pages/payments/PaymentsPage.js +4 -4
- package/dist/govcitizenhub/pages/payments/PaymentsPage.js.map +1 -1
- package/dist/govcitizenhub/pages/permits/IssuePermitDialog.js +2 -2
- package/dist/govcitizenhub/pages/permits/IssuePermitDialog.js.map +1 -1
- package/dist/govcitizenhub/pages/permits/PermitsPage.js +8 -8
- package/dist/govcitizenhub/pages/permits/PermitsPage.js.map +1 -1
- package/dist/govcitizenhub/pages/permits/VerifyPermitPage.js +6 -6
- package/dist/govcitizenhub/pages/permits/VerifyPermitPage.js.map +1 -1
- package/dist/govcitizenhub/pages/services/FormFieldBuilder.js +3 -3
- package/dist/govcitizenhub/pages/services/FormFieldBuilder.js.map +1 -1
- package/dist/govcitizenhub/pages/services/ServiceDetailPage.js +3 -3
- package/dist/govcitizenhub/pages/services/ServiceDetailPage.js.map +1 -1
- package/dist/govcitizenhub/pages/services/ServiceFormDialog.js +3 -3
- package/dist/govcitizenhub/pages/services/ServiceFormDialog.js.map +1 -1
- package/dist/govcitizenhub/pages/services/ServicesPage.js +6 -6
- package/dist/govcitizenhub/pages/services/ServicesPage.js.map +1 -1
- package/dist/govcitizenhub/pages/wallet/WalletPage.js +2 -2
- package/dist/govcitizenhub/pages/wallet/WalletPage.js.map +1 -1
- package/dist/govcitizenhub/types/index.d.ts +6 -0
- package/dist/services/createSandboxAssistantTransport.js +3 -3
- package/dist/services/createSandboxAssistantTransport.js.map +1 -1
- package/package.json +7 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgenciesPage.js","names":["FILTERS","SERVICES_COUNT_MAX","SERVICES_COUNT_QUERY","useAgencyServicesCount","useGovCitizenHub","useQuery","agencyId","response","graphqlFetch","apiGatewayUrl","conn","ServicesCount","isLoading","Skeleton","count","data","label","Layers","AgencyCard","GlassCard","Building2","agency","DropdownMenu","DropdownMenuTrigger","MoreVertical","DropdownMenuContent","DropdownMenuItem","onEdit","Pencil","onArchive","Archive","Phone","Mail","MapPin","StatusBadge","Switch","onToggleActive","toggleBusy","AgenciesPage","filter","setFilter","useState","search","setSearch","bannerOpen","setBannerOpen","useGovAgencies","archiveAgency","useGovArchiveAgency","updateAgency","useGovUpdateAgency","formOpen","setFormOpen","editing","setEditing","archiving","setArchiving","togglingId","setTogglingId","agencies","useMemo","query","visible","a","openCreate","openEdit","toggleActive","next","notify","err","describeError","PageLayout","Button","Plus","Info","X","FilterTabs","Search","Input","i","isError","ErrorView","refetch","EmptyState","AgencyFormDialog","ConfirmDialog"],"sources":["../../../../src/govcitizenhub/pages/agencies/AgenciesPage.tsx"],"sourcesContent":["/**\n * AgenciesPage — manage the government agencies that own services.\n * @module govcitizenhub/pages/agencies\n *\n * Reads `govListAgencies` (a paginated `GovAgencyConnection`, flattened to a\n * plain array by {@link useGovAgencies}) and offers full CRUD: create / edit\n * via {@link AgencyFormDialog}, a quick active/inactive toggle\n * (`govUpdateAgency`) and a confirm-guarded archive (`govArchiveAgency`). Each\n * card shows its live services count via a page-local `govListServices` query.\n */\n\nimport { useMemo, useState } from 'react';\nimport {\n Plus,\n Mail,\n Phone,\n MapPin,\n MoreVertical,\n Pencil,\n Archive,\n Info,\n X,\n Search,\n Building2,\n Layers,\n} from 'lucide-react';\nimport {\n Button,\n GlassCard,\n Input,\n Switch,\n Skeleton,\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuTrigger,\n} from '@burdenoff/fe-libs/ui';\nimport { useQuery } from '@tanstack/react-query';\nimport { graphqlFetch } from '@burdenoff/fe-libs/shared/graphql';\n\nimport { PageLayout } from '../../components/PageLayout';\nimport { FilterTabs, type FilterOption } from '../../components/FilterTabs';\nimport { StatusBadge } from '../../components/StatusBadge';\nimport { EmptyState } from '../../components/EmptyState';\nimport { ErrorView } from '../../components/StateViews';\nimport { ConfirmDialog } from '../../components/ConfirmDialog';\nimport { AgencyFormDialog } from './AgencyFormDialog';\nimport { useGovAgencies, useGovArchiveAgency, useGovUpdateAgency } from '../../hooks';\nimport { useGovCitizenHub } from '../../context';\nimport { notify, describeError } from '../../lib/toast';\nimport type { GovAgency } from '../../types';\n\ntype ActiveFilter = 'ALL' | 'ACTIVE' | 'INACTIVE';\n\nconst FILTERS: FilterOption<ActiveFilter>[] = [\n { value: 'ALL', label: 'All' },\n { value: 'ACTIVE', label: 'Active' },\n { value: 'INACTIVE', label: 'Inactive' },\n];\n\nconst SERVICES_COUNT_MAX = 100;\n\n/**\n * Page-local services count. `govListServices` is a connection with no total, so\n * we read one capped page and show `items.length` (with a `100+` affordance if\n * more exist). Defined here via `graphqlFetch` — the shared hook file is untouched.\n */\nconst SERVICES_COUNT_QUERY = `\n query GovAgencyServicesCount($agencyId: ID!, $pagination: PaginationInput) {\n govListServices(agencyId: $agencyId, pagination: $pagination) {\n items { id }\n pageInfo { hasMore }\n }\n }\n`;\n\nfunction useAgencyServicesCount(agencyId: string) {\n const { apiGatewayUrl } = useGovCitizenHub();\n return useQuery({\n queryKey: ['govcitizenhub', 'agency-services-count', agencyId],\n staleTime: 60_000,\n queryFn: async () => {\n const response = await graphqlFetch<{\n govListServices: { items: { id: string }[]; pageInfo: { hasMore: boolean } };\n }>({\n gateway: 'workspace',\n baseUrl: apiGatewayUrl,\n workspaceToken: true,\n query: SERVICES_COUNT_QUERY,\n variables: { agencyId, pagination: { limit: SERVICES_COUNT_MAX } },\n });\n if (response.errors?.length) {\n throw new Error(response.errors[0]?.message ?? 'Could not count services');\n }\n const conn = response.data?.govListServices;\n return { count: conn?.items.length ?? 0, hasMore: conn?.pageInfo.hasMore ?? false };\n },\n });\n}\n\nfunction ServicesCount({ agencyId }: { agencyId: string }) {\n const { data, isLoading } = useAgencyServicesCount(agencyId);\n if (isLoading) {\n return <Skeleton className=\"inline-block h-3.5 w-16 rounded\" />;\n }\n const count = data?.count ?? 0;\n const label = data?.hasMore ? `${SERVICES_COUNT_MAX}+` : count;\n return (\n <span className=\"inline-flex items-center gap-1.5 text-sm text-text-secondary\">\n <Layers className=\"size-3.5 text-text-muted\" />\n <span className=\"font-medium text-text-primary tabular-nums\">{label}</span>{' '}\n {count === 1 && !data?.hasMore ? 'service' : 'services'}\n </span>\n );\n}\n\nfunction AgencyCard({\n agency,\n onEdit,\n onArchive,\n onToggleActive,\n toggleBusy,\n}: {\n agency: GovAgency;\n onEdit: () => void;\n onArchive: () => void;\n onToggleActive: (next: boolean) => void;\n toggleBusy: boolean;\n}) {\n return (\n <GlassCard treatment=\"plain\" className=\"flex flex-col border-border-seam p-5\">\n <div className=\"flex items-start gap-3\">\n <span className=\"inline-flex size-12 shrink-0 items-center justify-center rounded-xl bg-[var(--color-accent-soft)] text-action-primary-text\">\n <Building2 className=\"size-6\" aria-hidden=\"true\" />\n </span>\n <div className=\"min-w-0 flex-1\">\n <div className=\"flex items-start justify-between gap-2\">\n <div className=\"min-w-0\">\n <h2\n className=\"truncate text-base font-semibold text-text-primary\"\n title={agency.name}\n >\n {agency.name}\n </h2>\n {agency.jurisdiction && (\n <p className=\"truncate text-xs text-text-muted\">{agency.jurisdiction}</p>\n )}\n </div>\n <DropdownMenu>\n <DropdownMenuTrigger\n className=\"inline-flex size-8 shrink-0 items-center justify-center rounded-button text-text-secondary hover:bg-bg-sunken hover:text-text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-border-focus\"\n aria-label={`Actions for ${agency.name}`}\n >\n <MoreVertical className=\"size-4\" />\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"end\" className=\"min-w-40\">\n <DropdownMenuItem className=\"gap-2\" onSelect={onEdit}>\n <Pencil className=\"size-4\" /> Edit\n </DropdownMenuItem>\n <DropdownMenuItem\n className=\"gap-2 text-status-error-text focus:text-status-error-text\"\n onSelect={onArchive}\n >\n <Archive className=\"size-4\" /> Archive\n </DropdownMenuItem>\n </DropdownMenuContent>\n </DropdownMenu>\n </div>\n </div>\n </div>\n\n <div className=\"mt-4 space-y-1.5 text-sm text-text-secondary\">\n {agency.code && (\n <p className=\"flex items-center gap-1.5\">\n <span className=\"inline-flex rounded bg-bg-sunken px-1.5 py-0.5 font-mono text-xs text-text-secondary\">\n {agency.code}\n </span>\n </p>\n )}\n {agency.contactPhone && (\n <p className=\"flex items-center gap-1.5\">\n <Phone className=\"size-3.5 shrink-0 text-text-muted\" /> {agency.contactPhone}\n </p>\n )}\n {agency.contactEmail && (\n <p className=\"flex items-center gap-1.5\">\n <Mail className=\"size-3.5 shrink-0 text-text-muted\" />\n <span className=\"truncate\">{agency.contactEmail}</span>\n </p>\n )}\n {agency.jurisdiction && (\n <p className=\"flex items-center gap-1.5\">\n <MapPin className=\"size-3.5 shrink-0 text-text-muted\" /> {agency.jurisdiction}\n </p>\n )}\n </div>\n\n <div className=\"mt-4 flex items-center justify-between gap-3 border-t border-border-seam pt-4\">\n <ServicesCount agencyId={agency.id} />\n <div className=\"flex items-center gap-2.5\">\n <StatusBadge status={agency.isActive ? 'ACTIVE' : 'RETIRED'} />\n <Switch\n checked={agency.isActive}\n onCheckedChange={onToggleActive}\n disabled={toggleBusy}\n aria-label={`${agency.isActive ? 'Deactivate' : 'Activate'} ${agency.name}`}\n />\n </div>\n </div>\n </GlassCard>\n );\n}\n\nexport function AgenciesPage() {\n const [filter, setFilter] = useState<ActiveFilter>('ALL');\n const [search, setSearch] = useState('');\n const [bannerOpen, setBannerOpen] = useState(true);\n const { data, isLoading, isError, refetch } = useGovAgencies(\n filter === 'ALL' ? {} : { isActive: filter === 'ACTIVE' }\n );\n const archiveAgency = useGovArchiveAgency();\n const updateAgency = useGovUpdateAgency();\n\n const [formOpen, setFormOpen] = useState(false);\n const [editing, setEditing] = useState<GovAgency | null>(null);\n const [archiving, setArchiving] = useState<GovAgency | null>(null);\n const [togglingId, setTogglingId] = useState<string | null>(null);\n\n const agencies = useMemo(() => data ?? [], [data]);\n const query = search.trim().toLowerCase();\n const visible = useMemo(\n () =>\n query\n ? agencies.filter(\n (a) =>\n a.name.toLowerCase().includes(query) ||\n (a.jurisdiction ?? '').toLowerCase().includes(query) ||\n (a.code ?? '').toLowerCase().includes(query) ||\n (a.contactEmail ?? '').toLowerCase().includes(query)\n )\n : agencies,\n [agencies, query]\n );\n\n const openCreate = () => {\n setEditing(null);\n setFormOpen(true);\n };\n const openEdit = (agency: GovAgency) => {\n setEditing(agency);\n setFormOpen(true);\n };\n\n const toggleActive = async (agency: GovAgency, next: boolean) => {\n setTogglingId(agency.id);\n try {\n await updateAgency.mutateAsync({ id: agency.id, input: { isActive: next } });\n notify.success(next ? 'Agency activated' : 'Agency deactivated', agency.name);\n } catch (err) {\n notify.error('Could not update agency', describeError(err));\n } finally {\n setTogglingId(null);\n }\n };\n\n const confirmArchive = async () => {\n if (!archiving) return;\n try {\n await archiveAgency.mutateAsync(archiving.id);\n notify.success('Agency archived', archiving.name);\n setArchiving(null);\n } catch (err) {\n notify.error('Could not archive agency', describeError(err));\n }\n };\n\n return (\n <PageLayout\n title=\"Agencies\"\n titleGradient\n description=\"Government departments and bodies that own and deliver public services.\"\n actions={\n <Button onClick={openCreate}>\n <Plus className=\"mr-1.5 h-4 w-4\" /> New agency\n </Button>\n }\n >\n {bannerOpen && (\n <div className=\"mb-5 flex items-start gap-3 rounded-card border border-[var(--color-accent-soft)] bg-[var(--color-accent-soft)] px-4 py-3\">\n <Info className=\"mt-0.5 size-4 shrink-0 text-action-primary-text\" aria-hidden=\"true\" />\n <p className=\"min-w-0 flex-1 text-sm text-action-primary-text\">\n Each agency is isolated in its own workspace, sharing common identity and standards.\n </p>\n <button\n type=\"button\"\n onClick={() => setBannerOpen(false)}\n aria-label=\"Dismiss multi-tenancy note\"\n className=\"inline-flex size-6 shrink-0 items-center justify-center rounded-md text-action-primary-text/70 transition-colors hover:bg-bg-surface/40 hover:text-action-primary-text focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-border-focus\"\n >\n <X className=\"size-4\" />\n </button>\n </div>\n )}\n\n <div className=\"mb-5 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between\">\n <FilterTabs options={FILTERS} value={filter} onChange={setFilter} />\n <div className=\"relative w-full sm:max-w-xs\">\n <Search className=\"pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-text-muted\" />\n <Input\n value={search}\n onChange={(e) => setSearch(e.target.value)}\n placeholder=\"Search agencies…\"\n aria-label=\"Search agencies\"\n className=\"pl-9\"\n />\n </div>\n </div>\n\n {isLoading ? (\n <div className=\"grid gap-4 sm:grid-cols-2 xl:grid-cols-3\">\n {Array.from({ length: 6 }, (_, i) => (\n <GlassCard key={i} treatment=\"plain\" className=\"space-y-3 p-5\">\n <div className=\"flex items-center gap-3\">\n <Skeleton className=\"size-12 rounded-xl\" />\n <Skeleton className=\"h-5 w-1/2 rounded\" />\n </div>\n <Skeleton className=\"h-4 w-3/4 rounded\" />\n <Skeleton className=\"h-4 w-2/3 rounded\" />\n </GlassCard>\n ))}\n </div>\n ) : isError ? (\n <ErrorView message=\"We couldn't load agencies.\" onRetry={() => refetch()} />\n ) : agencies.length === 0 ? (\n <EmptyState\n illustration=\"empty-data\"\n title=\"No agencies yet\"\n description=\"Create your first agency to start publishing services citizens can apply for.\"\n action={\n <Button onClick={openCreate}>\n <Plus className=\"mr-1.5 h-4 w-4\" /> New agency\n </Button>\n }\n />\n ) : visible.length === 0 ? (\n <EmptyState\n illustration=\"empty-search\"\n title=\"No matching agencies\"\n description={`Nothing matches “${search.trim()}”.`}\n />\n ) : (\n <div className=\"grid gap-4 sm:grid-cols-2 xl:grid-cols-3\">\n {visible.map((agency) => (\n <AgencyCard\n key={agency.id}\n agency={agency}\n onEdit={() => openEdit(agency)}\n onArchive={() => setArchiving(agency)}\n onToggleActive={(next) => toggleActive(agency, next)}\n toggleBusy={togglingId === agency.id}\n />\n ))}\n </div>\n )}\n\n <AgencyFormDialog\n open={formOpen}\n onOpenChange={setFormOpen}\n agency={editing}\n onSaved={() => refetch()}\n />\n <ConfirmDialog\n open={Boolean(archiving)}\n onOpenChange={(next) => (next ? undefined : setArchiving(null))}\n title={`Archive ${archiving?.name ?? 'agency'}?`}\n description=\"The agency will be archived and hidden from citizens. You can recreate or edit it later.\"\n confirmLabel=\"Archive\"\n destructive\n onConfirm={confirmArchive}\n />\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAsDA,IAAMA,IAAwC;CAC5C;EAAE,OAAO;EAAO,OAAO;CAAM;CAC7B;EAAE,OAAO;EAAU,OAAO;CAAS;CACnC;EAAE,OAAO;EAAY,OAAO;CAAW;AACzC,GAEMC,IAAqB,KAOrBC,IAAuB;AAS7B,SAASC,EAAuB,GAAkB;CAChD,IAAM,EAAE,qBAAkBC,EAAiB;CAC3C,OAAOC,EAAS;EACd,UAAU;GAAC;GAAiB;GAAyBC;EAAQ;EAC7D,WAAW;EACX,SAAS,YAAY;GACnB,IAAMC,IAAW,MAAMC,EAEpB;IACD,SAAS;IACT,SAASC;IACT,gBAAgB;IAChB,OAAOP;IACP,WAAW;KAAE;KAAU,YAAY,EAAE,OAAOD,EAAmB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;IAC7D,OAAO,WAAWD,GAAW,QAAQ,SAAS;IAC9C,aAAY;IACZ,cAAa;IACb,aAAA;IACA,WAAW,YAjHkB;KACjC,IAAKA,GACL,IAAI;MAGF,AAFA,MAAMR,EAAc,YAAYQ,EAAU,EAAE,GAC5Ca,EAAO,QAAQ,mBAAmBb,EAAU,IAAI,GAChDC,EAAa,IAAI;KACnB,SAASa,GAAK;MACZ,EAAO,MAAM,4BAA4BC,EAAcD,CAAG,CAAC;KAC7D;IACF;GAyGK,CAAA;EACS;;AAEhB"}
|
|
1
|
+
{"version":3,"file":"AgenciesPage.js","names":["EmptyState","EmptyState$1","FILTERS","SERVICES_COUNT_MAX","SERVICES_COUNT_QUERY","useAgencyServicesCount","useGovCitizenHub","useQuery","agencyId","response","graphqlFetch","apiGatewayUrl","conn","ServicesCount","isLoading","Skeleton","count","data","label","Layers","AgencyCard","GlassCard","Building2","agency","DropdownMenu","DropdownMenuTrigger","MoreVertical","DropdownMenuContent","DropdownMenuItem","onEdit","Pencil","onArchive","Archive","Phone","Mail","MapPin","StatusBadge","Switch","onToggleActive","toggleBusy","AgenciesPage","filter","setFilter","useState","search","setSearch","bannerOpen","setBannerOpen","useGovAgencies","archiveAgency","useGovArchiveAgency","updateAgency","useGovUpdateAgency","formOpen","setFormOpen","editing","setEditing","archiving","setArchiving","togglingId","setTogglingId","agencies","useMemo","query","visible","a","openCreate","openEdit","toggleActive","next","notify","err","describeError","PageLayout","Button","Plus","Info","X","FilterTabs","Search","Input","i","isError","ErrorView","refetch","AgencyFormDialog","ConfirmDialog"],"sources":["../../../../src/govcitizenhub/pages/agencies/AgenciesPage.tsx"],"sourcesContent":["/**\n * AgenciesPage — manage the government agencies that own services.\n * @module govcitizenhub/pages/agencies\n *\n * Reads `govListAgencies` (a paginated `GovAgencyConnection`, flattened to a\n * plain array by {@link useGovAgencies}) and offers full CRUD: create / edit\n * via {@link AgencyFormDialog}, a quick active/inactive toggle\n * (`govUpdateAgency`) and a confirm-guarded archive (`govArchiveAgency`). Each\n * card shows its live services count via a page-local `govListServices` query.\n */\n\nimport { useMemo, useState } from 'react';\nimport {\n Plus,\n Mail,\n Phone,\n MapPin,\n MoreVertical,\n Pencil,\n Archive,\n Info,\n X,\n Search,\n Building2,\n Layers,\n} from 'lucide-react';\nimport {\n Button,\n GlassCard,\n Input,\n Switch,\n Skeleton,\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuTrigger,\n} from '@burdenoff/fe-libs/ui';\nimport { useQuery } from '@tanstack/react-query';\nimport { graphqlFetch } from '@burdenoff/fe-libs/shared/graphql';\n\nimport { PageLayout } from '../../components/PageLayout';\nimport { FilterTabs, type FilterOption } from '../../components/FilterTabs';\nimport { StatusBadge } from '../../components/StatusBadge';\nimport { EmptyState } from '../../components/EmptyState';\nimport { ErrorView } from '../../components/StateViews';\nimport { ConfirmDialog } from '../../components/ConfirmDialog';\nimport { AgencyFormDialog } from './AgencyFormDialog';\nimport { useGovAgencies, useGovArchiveAgency, useGovUpdateAgency } from '../../hooks';\nimport { useGovCitizenHub } from '../../context';\nimport { notify, describeError } from '../../lib/toast';\nimport type { GovAgency } from '../../types';\n\ntype ActiveFilter = 'ALL' | 'ACTIVE' | 'INACTIVE';\n\nconst FILTERS: FilterOption<ActiveFilter>[] = [\n { value: 'ALL', label: 'All' },\n { value: 'ACTIVE', label: 'Active' },\n { value: 'INACTIVE', label: 'Inactive' },\n];\n\nconst SERVICES_COUNT_MAX = 100;\n\n/**\n * Page-local services count. `govListServices` is a connection with no total, so\n * we read one capped page and show `items.length` (with a `100+` affordance if\n * more exist). Defined here via `graphqlFetch` — the shared hook file is untouched.\n */\nconst SERVICES_COUNT_QUERY = `\n query GovAgencyServicesCount($agencyId: ID!, $pagination: PaginationInput) {\n govListServices(agencyId: $agencyId, pagination: $pagination) {\n items { id }\n pageInfo { hasMore }\n }\n }\n`;\n\nfunction useAgencyServicesCount(agencyId: string) {\n const { apiGatewayUrl } = useGovCitizenHub();\n return useQuery({\n queryKey: ['govcitizenhub', 'agency-services-count', agencyId],\n staleTime: 60_000,\n queryFn: async () => {\n const response = await graphqlFetch<{\n govListServices: { items: { id: string }[]; pageInfo: { hasMore: boolean } };\n }>({\n gateway: 'workspace',\n baseUrl: apiGatewayUrl,\n workspaceToken: true,\n query: SERVICES_COUNT_QUERY,\n variables: { agencyId, pagination: { limit: SERVICES_COUNT_MAX } },\n });\n if (response.errors?.length) {\n throw new Error(response.errors[0]?.message ?? 'Could not count services');\n }\n const conn = response.data?.govListServices;\n return { count: conn?.items.length ?? 0, hasMore: conn?.pageInfo.hasMore ?? false };\n },\n });\n}\n\nfunction ServicesCount({ agencyId }: { agencyId: string }) {\n const { data, isLoading } = useAgencyServicesCount(agencyId);\n if (isLoading) {\n return <Skeleton className=\"inline-block h-3.5 w-16 rounded\" />;\n }\n const count = data?.count ?? 0;\n const label = data?.hasMore ? `${SERVICES_COUNT_MAX}+` : count;\n return (\n <span className=\"inline-flex items-center gap-1.5 text-sm text-text-secondary\">\n <Layers className=\"size-3.5 text-text-muted\" />\n <span className=\"font-medium text-text-primary tabular-nums\">{label}</span>{' '}\n {count === 1 && !data?.hasMore ? 'service' : 'services'}\n </span>\n );\n}\n\nfunction AgencyCard({\n agency,\n onEdit,\n onArchive,\n onToggleActive,\n toggleBusy,\n}: {\n agency: GovAgency;\n onEdit: () => void;\n onArchive: () => void;\n onToggleActive: (next: boolean) => void;\n toggleBusy: boolean;\n}) {\n return (\n <GlassCard treatment=\"plain\" className=\"flex flex-col border-border-seam p-5\">\n <div className=\"flex items-start gap-3\">\n <span className=\"inline-flex size-12 shrink-0 items-center justify-center rounded-xl bg-[var(--color-accent-soft)] text-action-primary-text\">\n <Building2 className=\"size-6\" aria-hidden=\"true\" />\n </span>\n <div className=\"min-w-0 flex-1\">\n <div className=\"flex items-start justify-between gap-2\">\n <div className=\"min-w-0\">\n <h2\n className=\"truncate text-base font-semibold text-text-primary\"\n title={agency.name}\n >\n {agency.name}\n </h2>\n {agency.jurisdiction && (\n <p className=\"truncate text-xs text-text-muted\">{agency.jurisdiction}</p>\n )}\n </div>\n <DropdownMenu>\n <DropdownMenuTrigger\n className=\"inline-flex size-8 shrink-0 items-center justify-center rounded-button text-text-secondary hover:bg-bg-sunken hover:text-text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-border-focus\"\n aria-label={`Actions for ${agency.name}`}\n >\n <MoreVertical className=\"size-4\" />\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"end\" className=\"min-w-40\">\n <DropdownMenuItem className=\"gap-2\" onSelect={onEdit}>\n <Pencil className=\"size-4\" /> Edit\n </DropdownMenuItem>\n <DropdownMenuItem\n className=\"gap-2 text-status-error-text focus:text-status-error-text\"\n onSelect={onArchive}\n >\n <Archive className=\"size-4\" /> Archive\n </DropdownMenuItem>\n </DropdownMenuContent>\n </DropdownMenu>\n </div>\n </div>\n </div>\n\n <div className=\"mt-4 space-y-1.5 text-sm text-text-secondary\">\n {agency.code && (\n <p className=\"flex items-center gap-1.5\">\n <span className=\"inline-flex rounded bg-bg-sunken px-1.5 py-0.5 font-mono text-xs text-text-secondary\">\n {agency.code}\n </span>\n </p>\n )}\n {agency.contactPhone && (\n <p className=\"flex items-center gap-1.5\">\n <Phone className=\"size-3.5 shrink-0 text-text-muted\" /> {agency.contactPhone}\n </p>\n )}\n {agency.contactEmail && (\n <p className=\"flex items-center gap-1.5\">\n <Mail className=\"size-3.5 shrink-0 text-text-muted\" />\n <span className=\"truncate\">{agency.contactEmail}</span>\n </p>\n )}\n {agency.jurisdiction && (\n <p className=\"flex items-center gap-1.5\">\n <MapPin className=\"size-3.5 shrink-0 text-text-muted\" /> {agency.jurisdiction}\n </p>\n )}\n </div>\n\n <div className=\"mt-4 flex items-center justify-between gap-3 border-t border-border-seam pt-4\">\n <ServicesCount agencyId={agency.id} />\n <div className=\"flex items-center gap-2.5\">\n <StatusBadge status={agency.isActive ? 'ACTIVE' : 'RETIRED'} />\n <Switch\n checked={agency.isActive}\n onCheckedChange={onToggleActive}\n disabled={toggleBusy}\n aria-label={`${agency.isActive ? 'Deactivate' : 'Activate'} ${agency.name}`}\n />\n </div>\n </div>\n </GlassCard>\n );\n}\n\nexport function AgenciesPage() {\n const [filter, setFilter] = useState<ActiveFilter>('ALL');\n const [search, setSearch] = useState('');\n const [bannerOpen, setBannerOpen] = useState(true);\n const { data, isLoading, isError, refetch } = useGovAgencies(\n filter === 'ALL' ? {} : { isActive: filter === 'ACTIVE' }\n );\n const archiveAgency = useGovArchiveAgency();\n const updateAgency = useGovUpdateAgency();\n\n const [formOpen, setFormOpen] = useState(false);\n const [editing, setEditing] = useState<GovAgency | null>(null);\n const [archiving, setArchiving] = useState<GovAgency | null>(null);\n const [togglingId, setTogglingId] = useState<string | null>(null);\n\n const agencies = useMemo(() => data ?? [], [data]);\n const query = search.trim().toLowerCase();\n const visible = useMemo(\n () =>\n query\n ? agencies.filter(\n (a) =>\n a.name.toLowerCase().includes(query) ||\n (a.jurisdiction ?? '').toLowerCase().includes(query) ||\n (a.code ?? '').toLowerCase().includes(query) ||\n (a.contactEmail ?? '').toLowerCase().includes(query)\n )\n : agencies,\n [agencies, query]\n );\n\n const openCreate = () => {\n setEditing(null);\n setFormOpen(true);\n };\n const openEdit = (agency: GovAgency) => {\n setEditing(agency);\n setFormOpen(true);\n };\n\n const toggleActive = async (agency: GovAgency, next: boolean) => {\n setTogglingId(agency.id);\n try {\n await updateAgency.mutateAsync({ id: agency.id, input: { isActive: next } });\n notify.success(next ? 'Agency activated' : 'Agency deactivated', agency.name);\n } catch (err) {\n notify.error('Could not update agency', describeError(err));\n } finally {\n setTogglingId(null);\n }\n };\n\n const confirmArchive = async () => {\n if (!archiving) return;\n try {\n await archiveAgency.mutateAsync(archiving.id);\n notify.success('Agency archived', archiving.name);\n setArchiving(null);\n } catch (err) {\n notify.error('Could not archive agency', describeError(err));\n }\n };\n\n return (\n <PageLayout\n title=\"Agencies\"\n titleGradient\n description=\"Government departments and bodies that own and deliver public services.\"\n actions={\n <Button onClick={openCreate}>\n <Plus className=\"me-1.5 h-4 w-4\" /> New agency\n </Button>\n }\n >\n {bannerOpen && (\n <div className=\"mb-5 flex items-start gap-3 rounded-card border border-[var(--color-accent-soft)] bg-[var(--color-accent-soft)] px-4 py-3\">\n <Info className=\"mt-0.5 size-4 shrink-0 text-action-primary-text\" aria-hidden=\"true\" />\n <p className=\"min-w-0 flex-1 text-sm text-action-primary-text\">\n Each agency is isolated in its own workspace, sharing common identity and standards.\n </p>\n <button\n type=\"button\"\n onClick={() => setBannerOpen(false)}\n aria-label=\"Dismiss multi-tenancy note\"\n className=\"inline-flex size-6 shrink-0 items-center justify-center rounded-md text-action-primary-text/70 transition-colors hover:bg-bg-surface/40 hover:text-action-primary-text focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-border-focus\"\n >\n <X className=\"size-4\" />\n </button>\n </div>\n )}\n\n <div className=\"mb-5 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between\">\n <FilterTabs options={FILTERS} value={filter} onChange={setFilter} />\n <div className=\"relative w-full sm:max-w-xs\">\n <Search className=\"pointer-events-none absolute start-3 top-1/2 size-4 -translate-y-1/2 text-text-muted\" />\n <Input\n value={search}\n onChange={(e) => setSearch(e.target.value)}\n placeholder=\"Search agencies…\"\n aria-label=\"Search agencies\"\n className=\"ps-9\"\n />\n </div>\n </div>\n\n {isLoading ? (\n <div className=\"grid gap-4 sm:grid-cols-2 xl:grid-cols-3\">\n {Array.from({ length: 6 }, (_, i) => (\n <GlassCard key={i} treatment=\"plain\" className=\"space-y-3 p-5\">\n <div className=\"flex items-center gap-3\">\n <Skeleton className=\"size-12 rounded-xl\" />\n <Skeleton className=\"h-5 w-1/2 rounded\" />\n </div>\n <Skeleton className=\"h-4 w-3/4 rounded\" />\n <Skeleton className=\"h-4 w-2/3 rounded\" />\n </GlassCard>\n ))}\n </div>\n ) : isError ? (\n <ErrorView message=\"We couldn't load agencies.\" onRetry={() => refetch()} />\n ) : agencies.length === 0 ? (\n <EmptyState\n illustration=\"empty-data\"\n title=\"No agencies yet\"\n description=\"Create your first agency to start publishing services citizens can apply for.\"\n action={\n <Button onClick={openCreate}>\n <Plus className=\"me-1.5 h-4 w-4\" /> New agency\n </Button>\n }\n />\n ) : visible.length === 0 ? (\n <EmptyState\n illustration=\"empty-search\"\n title=\"No matching agencies\"\n description={`Nothing matches “${search.trim()}”.`}\n />\n ) : (\n <div className=\"grid gap-4 sm:grid-cols-2 xl:grid-cols-3\">\n {visible.map((agency) => (\n <AgencyCard\n key={agency.id}\n agency={agency}\n onEdit={() => openEdit(agency)}\n onArchive={() => setArchiving(agency)}\n onToggleActive={(next) => toggleActive(agency, next)}\n toggleBusy={togglingId === agency.id}\n />\n ))}\n </div>\n )}\n\n <AgencyFormDialog\n open={formOpen}\n onOpenChange={setFormOpen}\n agency={editing}\n onSaved={() => refetch()}\n />\n <ConfirmDialog\n open={Boolean(archiving)}\n onOpenChange={(next) => (next ? undefined : setArchiving(null))}\n title={`Archive ${archiving?.name ?? 'agency'}?`}\n description=\"The agency will be archived and hidden from citizens. You can recreate or edit it later.\"\n confirmLabel=\"Archive\"\n destructive\n onConfirm={confirmArchive}\n />\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAsDA,IAAME,IAAwC;CAC5C;EAAE,OAAO;EAAO,OAAO;CAAM;CAC7B;EAAE,OAAO;EAAU,OAAO;CAAS;CACnC;EAAE,OAAO;EAAY,OAAO;CAAW;AACzC,GAEMC,IAAqB,KAOrBC,IAAuB;AAS7B,SAASC,EAAuB,GAAkB;CAChD,IAAM,EAAE,qBAAkBC,EAAiB;CAC3C,OAAOC,EAAS;EACd,UAAU;GAAC;GAAiB;GAAyBC;EAAQ;EAC7D,WAAW;EACX,SAAS,YAAY;GACnB,IAAMC,IAAW,MAAMC,EAEpB;IACD,SAAS;IACT,SAASC;IACT,gBAAgB;IAChB,OAAOP;IACP,WAAW;KAAE;KAAU,YAAY,EAAE,OAAOD,EAA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a,IAAI;IAC7D,OAAO,WAAWD,GAAW,QAAQ,SAAS;IAC9C,aAAY;IACZ,cAAa;IACb,aAAA;IACA,WAAW,YAjHkB;KACjC,IAAKA,GACL,IAAI;MAGF,AAFA,MAAMR,EAAc,YAAYQ,EAAU,EAAE,GAC5Ca,EAAO,QAAQ,mBAAmBb,EAAU,IAAI,GAChDC,EAAa,IAAI;KACnB,SAASa,GAAK;MACZ,EAAO,MAAM,4BAA4BC,EAAcD,CAAG,CAAC;KAC7D;IACF;GAyGK,CAAA;EACS;;AAEhB"}
|
|
@@ -409,12 +409,12 @@ function W() {
|
|
|
409
409
|
variant: "outline",
|
|
410
410
|
onClick: St,
|
|
411
411
|
disabled: R.isPending,
|
|
412
|
-
children: [/* @__PURE__ */ k(Fe, { className: "
|
|
412
|
+
children: [/* @__PURE__ */ k(Fe, { className: "me-1.5 h-4 w-4" }), " Assign to me"]
|
|
413
413
|
}),
|
|
414
414
|
T.status === "DRAFT" && /* @__PURE__ */ A(j, {
|
|
415
415
|
onClick: bt,
|
|
416
416
|
disabled: Et,
|
|
417
|
-
children: [/* @__PURE__ */ k(Me, { className: "
|
|
417
|
+
children: [/* @__PURE__ */ k(Me, { className: "me-1.5 h-4 w-4" }), " Submit"]
|
|
418
418
|
}),
|
|
419
419
|
w && mt.length > 0 && /* @__PURE__ */ A(ze, { children: [/* @__PURE__ */ A(He, {
|
|
420
420
|
disabled: Et,
|
|
@@ -625,7 +625,7 @@ function W() {
|
|
|
625
625
|
children: /* @__PURE__ */ A(j, {
|
|
626
626
|
onClick: wt,
|
|
627
627
|
disabled: !X.trim() || U.isPending,
|
|
628
|
-
children: [/* @__PURE__ */ k(Me, { className: "
|
|
628
|
+
children: [/* @__PURE__ */ k(Me, { className: "me-1.5 h-4 w-4" }), " Send reply"]
|
|
629
629
|
})
|
|
630
630
|
})]
|
|
631
631
|
}),
|
|
@@ -661,7 +661,7 @@ function W() {
|
|
|
661
661
|
}), /* @__PURE__ */ A(j, {
|
|
662
662
|
onClick: Tt,
|
|
663
663
|
disabled: !Y.trim() || B.isPending,
|
|
664
|
-
children: [/* @__PURE__ */ k(D, { className: "
|
|
664
|
+
children: [/* @__PURE__ */ k(D, { className: "me-1.5 h-4 w-4" }), " Add note"]
|
|
665
665
|
})]
|
|
666
666
|
})]
|
|
667
667
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApplicationDetailPage.js","names":["_Fragment","Fragment$1","NOTE_TYPES","SLA_RUNNING","NOTE_META","Lock","MessageSquare","HelpCircle","Gavel","userDisplayName","user","full","shortId","id","transitionsFor","status","PlayCircle","CheckCircle2","XCircle","elapsedDays","start","since","startOfDay","d","requirementKey","value","requirementStateOf","documents","statuses","doc","REQUIREMENT_META","Clock","MinusCircle","buildRequirementRows","byRequirement","key","bucket","requiredDocuments","matched","requirement","RequirementChecklist","rows","meta","row","Icon","filed","FileText","cn","AssignedValue","assignedToId","currentUser","AssigneeChip","ApplicationDetailPage","useParams","useGovCitizenHub","useGovCitizenHubAnalytics","isOfficer","useSurface","application","useGovApplication","service","useGovService","payments","useGovPayments","submitApplication","useGovSubmitApplication","transitionApplication","useGovTransitionApplication","updateApplication","useGovUpdateApplication","reviewDocument","useGovReviewDocument","addCaseNote","useGovAddCaseNote","replyToApplication","useGovReplyToMyApplication","createPayment","useGovCreatePayment","markPaid","useGovMarkPaymentPaid","refundPayment","useGovRefundPayment","pendingTransition","setPendingTransition","useState","rejectDoc","setRejectDoc","noteBody","setNoteBody","replyBody","setReplyBody","noteType","setNoteType","payOpen","setPayOpen","permitOpen","setPermitOpen","transitions","useMemo","lifecycle","buildApplicationLifecycle","formEntries","fd","v","requirementRows","requirementsAccepted","requirementsOutstanding","unmatchedDocuments","known","slaProgress","day","sortedNotes","note","a","b","isLoading","PageLayout","navigateTo","LoadingView","isError","ErrorView","refetch","runSubmit","notify","err","describeError","runTransition","spec","reason","formatEnumLabel","assignToMe","acceptDoc","sendReply","addNote","busy","assignedToMe","onTransitionSelect","metaItems","formatDateTime","formatDate","SlaBadge","StatusBadge","Button","UserPlus","Send","DropdownMenu","DropdownMenuTrigger","ChevronDown","DropdownMenuContent","DropdownMenuItem","SectionCard","Route","StatusStepper","ClipboardList","KeyValueList","formatRelativeTime","Check","X","DocumentUploadField","ListChecks","Timeline","author","TimelineItem","index","Textarea","Label","Select","SelectTrigger","SelectValue","SelectContent","SelectItem","t","Plus","TriangleAlert","offset","escalation","offsetLabel","Bell","UserCheck","Eye","CreditCard","formatCurrency","payment","emitPaymentSettled","BadgeCheck","permit","ConfirmDialog","next","RecordPaymentDialog","providerRef","IssuePermitDialog","amount","setAmount","currency","setCurrency","defaultCurrency","setProviderRef","setBusy","useEffect","open","defaultAmount","ResponsiveDialog","onOpenChange","ResponsiveDialogContent","ResponsiveDialogHeader","ResponsiveDialogTitle","ResponsiveDialogDescription","Input","ResponsiveDialogFooter","onSubmit"],"sources":["../../../../src/govcitizenhub/pages/applications/ApplicationDetailPage.tsx"],"sourcesContent":["/* eslint-disable react-hooks/set-state-in-effect -- form dialogs re-seed local state when opened/edited (guarded by open/entity deps); matches reference MFE pattern */\n/**\n * ApplicationDetailPage — the casework workspace for a single application.\n * @module govcitizenhub/pages/applications\n *\n * Reads `govApplication(id)` (documents, notes, permits, formData) plus the\n * owning service and this application's payments. Drives the full lifecycle:\n * - a StatusStepper lifecycle header (Submitted → In review → Info requested →\n * Approved/Rejected) that doubles as the citizen tracking view\n * - transitions (submit / start review / request info / approve / reject) via an\n * \"Advance status\" menu, with a reason prompt where the svc requires one\n * - documents (real upload → govAddDocument, officer review → govReviewDocument)\n * - the domain case-notes timeline (govAddCaseNote — colour-coded by note type)\n * - payments (record / mark paid / refund) and permits (issue)\n * - assignment (assign to me via govUpdateApplication)\n *\n * All data is real (no mocks); `User`/`File` are id-only stubs, so identity is\n * only rendered for the signed-in officer — never a fabricated name.\n */\n\nimport { useEffect, useMemo, useState, type FC } from 'react';\nimport { useParams } from 'react-router';\nimport {\n Send,\n PlayCircle,\n HelpCircle,\n CheckCircle2,\n XCircle,\n UserPlus,\n FileText,\n MessageSquare,\n CreditCard,\n BadgeCheck,\n Check,\n X,\n Plus,\n ChevronDown,\n Lock,\n Gavel,\n ClipboardList,\n Route,\n Eye,\n Clock,\n MinusCircle,\n ListChecks,\n TriangleAlert,\n Bell,\n UserCheck,\n} from 'lucide-react';\nimport {\n Button,\n Input,\n Label,\n Textarea,\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuTrigger,\n ResponsiveDialog,\n ResponsiveDialogContent,\n ResponsiveDialogHeader,\n ResponsiveDialogTitle,\n ResponsiveDialogDescription,\n ResponsiveDialogFooter,\n} from '@burdenoff/fe-libs/ui';\n\nimport { PageLayout } from '../../components/PageLayout';\nimport { StatusBadge } from '../../components/StatusBadge';\nimport { SlaBadge } from '../../components/SlaBadge';\nimport { StatusStepper } from '../../components/StatusStepper';\nimport { Timeline, TimelineItem, type TimelineTone } from '../../components/Timeline';\nimport { SectionCard } from '../../components/SectionCard';\nimport { KeyValueList, type KeyValueItem } from '../../components/KeyValueList';\nimport { AssigneeChip } from '../../components/Avatar';\nimport { LoadingView, ErrorView } from '../../components/StateViews';\nimport { DocumentUploadField } from '../../components/DocumentUploadField';\nimport { ConfirmDialog } from '../../components/ConfirmDialog';\nimport { IssuePermitDialog } from '../permits/IssuePermitDialog';\nimport {\n useGovApplication,\n useGovService,\n useGovPayments,\n useGovSubmitApplication,\n useGovTransitionApplication,\n useGovUpdateApplication,\n useGovReviewDocument,\n useGovAddCaseNote,\n useGovReplyToMyApplication,\n useGovCreatePayment,\n useGovMarkPaymentPaid,\n useGovCitizenHubAnalytics,\n useGovRefundPayment,\n} from '../../hooks';\nimport { useGovCitizenHub } from '../../context';\nimport { useSurface } from '../../surface/SurfaceContext';\nimport { buildApplicationLifecycle } from '../../utils/applicationLifecycle';\nimport { cn } from '../../utils/cn';\nimport { notify, describeError } from '../../lib/toast';\nimport {\n formatDate,\n formatDateTime,\n formatRelativeTime,\n formatCurrency,\n formatEnumLabel,\n} from '../../utils/formatters';\nimport type { GovApplicationStatus, GovCaseNoteType, GovDocument, CurrentUser } from '../../types';\n\nconst NOTE_TYPES: GovCaseNoteType[] = ['INTERNAL', 'CITIZEN_MESSAGE', 'INFO_REQUEST', 'DECISION'];\n\n/** Statuses where the service SLA clock is still running. */\nconst SLA_RUNNING: ReadonlySet<GovApplicationStatus> = new Set<GovApplicationStatus>([\n 'SUBMITTED',\n 'IN_REVIEW',\n 'INFO_REQUESTED',\n]);\n\n/** Colour + icon + label for each case-note type (mock 07). */\nconst NOTE_META: Record<GovCaseNoteType, { tone: TimelineTone; icon: typeof Lock; label: string }> =\n {\n INTERNAL: { tone: 'default', icon: Lock, label: 'Internal' },\n CITIZEN_MESSAGE: { tone: 'success', icon: MessageSquare, label: 'Citizen message' },\n INFO_REQUEST: { tone: 'warning', icon: HelpCircle, label: 'Info request' },\n DECISION: { tone: 'info', icon: Gavel, label: 'Decision' },\n };\n\n/** Best available display name for the signed-in officer (never fabricated for others). */\nfunction userDisplayName(user?: CurrentUser | null): string | undefined {\n if (!user) return undefined;\n const full = [user.firstName, user.lastName].filter(Boolean).join(' ').trim();\n return user.name?.trim() || full || user.username?.trim() || user.email;\n}\n\n/** First 8 chars of an opaque actor id — an honest reference, not a name. */\nconst shortId = (id: string): string => id.slice(0, 8);\n\ninterface TransitionSpec {\n status: GovApplicationStatus;\n label: string;\n icon: typeof CheckCircle2;\n reason: 'none' | 'optional' | 'required';\n destructive?: boolean;\n}\n\nfunction transitionsFor(status: GovApplicationStatus): TransitionSpec[] {\n switch (status) {\n case 'SUBMITTED':\n return [\n { status: 'IN_REVIEW', label: 'Start review', icon: PlayCircle, reason: 'none' },\n { status: 'INFO_REQUESTED', label: 'Request info', icon: HelpCircle, reason: 'required' },\n { status: 'APPROVED', label: 'Approve', icon: CheckCircle2, reason: 'optional' },\n {\n status: 'REJECTED',\n label: 'Reject',\n icon: XCircle,\n reason: 'required',\n destructive: true,\n },\n ];\n case 'IN_REVIEW':\n return [\n { status: 'INFO_REQUESTED', label: 'Request info', icon: HelpCircle, reason: 'required' },\n { status: 'APPROVED', label: 'Approve', icon: CheckCircle2, reason: 'optional' },\n {\n status: 'REJECTED',\n label: 'Reject',\n icon: XCircle,\n reason: 'required',\n destructive: true,\n },\n ];\n case 'INFO_REQUESTED':\n return [\n { status: 'IN_REVIEW', label: 'Resume review', icon: PlayCircle, reason: 'none' },\n { status: 'APPROVED', label: 'Approve', icon: CheckCircle2, reason: 'optional' },\n {\n status: 'REJECTED',\n label: 'Reject',\n icon: XCircle,\n reason: 'required',\n destructive: true,\n },\n ];\n default:\n return [];\n }\n}\n\n/**\n * Whole calendar days from `since` to today, counted inclusively so the day of\n * submission is \"Day 1\". Returns null for an unparseable timestamp.\n */\nfunction elapsedDays(since: string): number | null {\n const start = new Date(since);\n if (Number.isNaN(start.getTime())) return null;\n const startOfDay = (d: Date) => new Date(d.getFullYear(), d.getMonth(), d.getDate()).getTime();\n const diff = Math.round((startOfDay(new Date()) - startOfDay(start)) / 86_400_000);\n return diff + 1;\n}\n\n// ---------------------------------------------------------------------------\n// Required-documents checklist (mock 32)\n//\n// The service publishes `requiredDocuments` (a list of requirement labels) and\n// every attached `GovDocument` carries the `requirement` it was filed against\n// plus its review `status`. Both already arrive in this page's own query\n// results; before this the page only printed the requirement labels as a\n// comma-joined sentence, so an officer could not see which of them were still\n// outstanding without reading the attachment list and doing the join by eye.\n//\n// A requirement with no attachment is MISSING. That state is derived from the\n// absence of a record, never asserted as a backend field.\n// ---------------------------------------------------------------------------\n\ntype RequirementState = 'ACCEPTED' | 'PENDING' | 'REJECTED' | 'MISSING';\n\ninterface RequirementRow {\n requirement: string;\n state: RequirementState;\n /** The documents filed against this requirement, if any. */\n documents: GovDocument[];\n}\n\n/** Normalised match key — requirement labels are free text on both sides. */\nconst requirementKey = (value: string): string => value.trim().toLowerCase();\n\n/**\n * Worst-first precedence so a requirement is only \"Accepted\" once something\n * filed against it actually has been. A rejected attachment with no replacement\n * outranks nothing else on the requirement, so it reads as still outstanding.\n */\nfunction requirementStateOf(documents: GovDocument[]): RequirementState {\n if (documents.length === 0) return 'MISSING';\n const statuses = new Set(documents.map((doc) => doc.status.toUpperCase()));\n if (statuses.has('ACCEPTED')) return 'ACCEPTED';\n if (statuses.has('PENDING')) return 'PENDING';\n if (statuses.has('REJECTED')) return 'REJECTED';\n return 'MISSING';\n}\n\nconst REQUIREMENT_META: Record<\n RequirementState,\n { label: string; icon: typeof CheckCircle2; tone: string }\n> = {\n ACCEPTED: { label: 'Accepted', icon: CheckCircle2, tone: 'text-status-success-text' },\n PENDING: { label: 'Pending', icon: Clock, tone: 'text-status-warning-text' },\n REJECTED: { label: 'Rejected', icon: XCircle, tone: 'text-status-error-text' },\n MISSING: { label: 'Missing', icon: MinusCircle, tone: 'text-text-muted' },\n};\n\nfunction buildRequirementRows(\n requiredDocuments: string[],\n documents: GovDocument[]\n): RequirementRow[] {\n const byRequirement = new Map<string, GovDocument[]>();\n for (const doc of documents) {\n if (!doc.requirement) continue;\n const key = requirementKey(doc.requirement);\n const bucket = byRequirement.get(key);\n if (bucket) bucket.push(doc);\n else byRequirement.set(key, [doc]);\n }\n\n return requiredDocuments.map((requirement) => {\n const matched = byRequirement.get(requirementKey(requirement)) ?? [];\n return { requirement, state: requirementStateOf(matched), documents: matched };\n });\n}\n\nconst RequirementChecklist: FC<{ rows: RequirementRow[] }> = ({ rows }) => (\n <ul className=\"space-y-1.5\">\n {rows.map((row) => {\n const meta = REQUIREMENT_META[row.state];\n const Icon = meta.icon;\n const filed = row.documents[0];\n return (\n <li\n key={row.requirement}\n className=\"flex flex-wrap items-center justify-between gap-2 rounded-lg bg-bg-sunken px-3 py-2\"\n >\n <span className=\"flex min-w-0 items-center gap-2\">\n <FileText className=\"size-4 shrink-0 text-text-muted\" aria-hidden=\"true\" />\n <span className=\"min-w-0\">\n <span className=\"block truncate text-sm text-text-primary\">{row.requirement}</span>\n {filed && (\n <span className=\"block truncate text-xs text-text-muted\">{filed.name}</span>\n )}\n </span>\n </span>\n <span className={cn('flex shrink-0 items-center gap-1.5 text-xs font-medium', meta.tone)}>\n <Icon className=\"size-4\" aria-hidden=\"true\" />\n {meta.label}\n </span>\n </li>\n );\n })}\n </ul>\n);\n\n/** Assigned-officer value — real identity only (self), else a neutral id chip. */\nfunction AssignedValue({\n assignedToId,\n currentUser,\n}: {\n assignedToId?: string | null;\n currentUser?: CurrentUser | null;\n}) {\n if (!assignedToId) return <span className=\"text-sm text-text-muted\">Unassigned</span>;\n if (currentUser?.id && assignedToId === currentUser.id) {\n return (\n <AssigneeChip\n name={userDisplayName(currentUser) ?? 'You'}\n src={currentUser.avatar}\n subtitle=\"You\"\n />\n );\n }\n return <AssigneeChip name=\"Assigned officer\" subtitle={`#${shortId(assignedToId)}`} />;\n}\n\nexport function ApplicationDetailPage() {\n const { id } = useParams<{ id: string }>();\n const { navigateTo, currentUser, workspaceId } = useGovCitizenHub();\n const { emitPaymentSettled } = useGovCitizenHubAnalytics();\n // Casework controls live in the officer console; the citizen portal is a read-only\n // \"track my request\" view of the same application (BOFF-4093).\n const isOfficer = useSurface() === 'officer';\n\n const { data: application, isLoading, isError, refetch } = useGovApplication(id);\n const { data: service } = useGovService(application?.serviceId);\n const payments = useGovPayments(\n { applicationId: id, pagination: { limit: 50 } },\n { enabled: isOfficer }\n );\n\n const submitApplication = useGovSubmitApplication();\n const transitionApplication = useGovTransitionApplication();\n const updateApplication = useGovUpdateApplication();\n const reviewDocument = useGovReviewDocument();\n const addCaseNote = useGovAddCaseNote();\n const replyToApplication = useGovReplyToMyApplication();\n const createPayment = useGovCreatePayment();\n const markPaid = useGovMarkPaymentPaid();\n const refundPayment = useGovRefundPayment();\n\n const [pendingTransition, setPendingTransition] = useState<TransitionSpec | null>(null);\n const [rejectDoc, setRejectDoc] = useState<GovDocument | null>(null);\n const [noteBody, setNoteBody] = useState('');\n const [replyBody, setReplyBody] = useState('');\n const [noteType, setNoteType] = useState<GovCaseNoteType>('INTERNAL');\n const [payOpen, setPayOpen] = useState(false);\n const [permitOpen, setPermitOpen] = useState(false);\n\n const transitions = useMemo(\n () => (application ? transitionsFor(application.status) : []),\n [application]\n );\n const lifecycle = useMemo(\n () => (application ? buildApplicationLifecycle(application) : { steps: [], current: 0 }),\n [application]\n );\n const formEntries = useMemo(() => {\n const fd = application?.formData;\n if (!fd || typeof fd !== 'object' || Array.isArray(fd)) return [];\n return Object.entries(fd as Record<string, unknown>).filter(\n ([, v]) => v != null && String(v).trim() !== ''\n );\n }, [application?.formData]);\n\n /**\n * Requirement rows: `service.requiredDocuments` joined to the application's\n * own attachments by `requirement`. Both sides are already in this page's\n * query results — nothing extra is fetched and nothing is inferred beyond\n * \"no attachment filed against this requirement\" = Missing.\n */\n const requirementRows = useMemo(\n () =>\n service && application\n ? buildRequirementRows(service.requiredDocuments, application.documents)\n : [],\n [service, application]\n );\n const requirementsAccepted = requirementRows.filter((row) => row.state === 'ACCEPTED').length;\n const requirementsOutstanding = requirementRows.length - requirementsAccepted;\n /** Attachments filed with no requirement, or one the service no longer lists. */\n const unmatchedDocuments = useMemo(() => {\n if (!application) return 0;\n const known = new Set(requirementRows.map((row) => requirementKey(row.requirement)));\n return application.documents.filter(\n (doc) => !doc.requirement || !known.has(requirementKey(doc.requirement))\n ).length;\n }, [application, requirementRows]);\n\n /**\n * SLA day counter — \"Day N of <service.slaDays>\". N counts calendar days from\n * the day the citizen submitted; both inputs are persisted fields, so the\n * counter is only rendered when the record actually carries them.\n */\n const slaProgress = useMemo(() => {\n if (!application?.submittedAt || !service || service.slaDays <= 0) return null;\n // The clock only runs while the case is open; a decided case shows its\n // decision date instead of a running counter.\n if (!SLA_RUNNING.has(application.status)) return null;\n const day = elapsedDays(application.submittedAt);\n if (day == null) return null;\n return { day, total: service.slaDays, breached: day > service.slaDays };\n }, [application, service]);\n\n const sortedNotes = useMemo(\n () =>\n application\n ? [...application.notes]\n .filter((note) => isOfficer || note.type !== 'INTERNAL')\n .sort((a, b) => new Date(a.createdAt).getTime() - new Date(b.createdAt).getTime())\n : [],\n [application, isOfficer]\n );\n\n if (isLoading) {\n return (\n <PageLayout\n title=\"Application\"\n back={{ label: 'Applications', onClick: () => navigateTo('applications') }}\n >\n <LoadingView label=\"Loading application…\" />\n </PageLayout>\n );\n }\n if (isError || !application) {\n return (\n <PageLayout\n title=\"Application\"\n back={{ label: 'Applications', onClick: () => navigateTo('applications') }}\n >\n <ErrorView message=\"We couldn't load this application.\" onRetry={() => refetch()} />\n </PageLayout>\n );\n }\n\n const runSubmit = async () => {\n try {\n await submitApplication.mutateAsync(application.id);\n notify.success('Application submitted', application.reference);\n } catch (err) {\n notify.error('Could not submit', describeError(err));\n }\n };\n\n const runTransition = async (spec: TransitionSpec, reason: string) => {\n try {\n await transitionApplication.mutateAsync({\n id: application.id,\n status: spec.status,\n reason: reason.trim() || null,\n });\n notify.success('Application updated', `Status is now ${formatEnumLabel(spec.status)}.`);\n } catch (err) {\n notify.error('Could not update the application', describeError(err));\n }\n };\n\n const assignToMe = async () => {\n if (!currentUser?.id) return;\n try {\n await updateApplication.mutateAsync({\n id: application.id,\n input: { assignedToId: currentUser.id },\n });\n notify.success('Assigned to you');\n } catch (err) {\n notify.error('Could not assign', describeError(err));\n }\n };\n\n const acceptDoc = async (doc: GovDocument) => {\n try {\n await reviewDocument.mutateAsync({\n id: doc.id,\n status: 'ACCEPTED',\n applicationId: application.id,\n });\n notify.success('Document accepted', doc.name);\n } catch (err) {\n notify.error('Could not accept document', describeError(err));\n }\n };\n\n // Citizen reply on their own request (stored as a CITIZEN_MESSAGE note).\n const sendReply = async () => {\n if (!replyBody.trim()) return;\n try {\n await replyToApplication.mutateAsync({\n applicationId: application.id,\n body: replyBody.trim(),\n });\n setReplyBody('');\n notify.success('Reply sent');\n } catch (err) {\n notify.error('Could not send reply', describeError(err));\n }\n };\n\n const addNote = async () => {\n if (!noteBody.trim()) return;\n try {\n await addCaseNote.mutateAsync({\n applicationId: application.id,\n body: noteBody.trim(),\n type: noteType,\n });\n setNoteBody('');\n notify.success('Note added');\n } catch (err) {\n notify.error('Could not add note', describeError(err));\n }\n };\n\n const busy =\n submitApplication.isPending || transitionApplication.isPending || updateApplication.isPending;\n const assignedToMe = Boolean(\n application.assignedToId && application.assignedToId === currentUser?.id\n );\n\n const onTransitionSelect = (spec: TransitionSpec) => {\n if (spec.reason === 'none') void runTransition(spec, '');\n else setPendingTransition(spec);\n };\n\n const metaItems: KeyValueItem[] = [\n { label: 'Filed', value: formatDateTime(application.createdAt) },\n {\n label: 'Submitted',\n value: application.submittedAt ? formatDateTime(application.submittedAt) : 'Not submitted',\n },\n {\n label: 'Due date',\n value: application.dueDate ? (\n <span className=\"flex flex-col items-end gap-1\">\n <span>{formatDate(application.dueDate)}</span>\n <SlaBadge dueDate={application.dueDate} status={application.status} />\n </span>\n ) : (\n '—'\n ),\n },\n {\n label: 'Decided',\n value: application.decidedAt ? formatDateTime(application.decidedAt) : '—',\n },\n {\n label: 'Assigned to',\n value: <AssignedValue assignedToId={application.assignedToId} currentUser={currentUser} />,\n },\n ];\n\n return (\n <PageLayout\n title={\n <span className=\"flex flex-wrap items-center gap-x-3 gap-y-2\">\n <span className=\"text-text-primary\">{application.reference}</span>\n {service && (\n <span className=\"text-lg font-normal text-text-secondary\">· {service.name}</span>\n )}\n <StatusBadge status={application.status} size=\"md\" />\n <StatusBadge status={application.priority} size=\"md\" />\n {slaProgress && (\n <span\n className={cn(\n 'inline-flex items-center gap-1.5 rounded-full px-3 py-1 text-sm font-medium',\n slaProgress.breached\n ? 'bg-status-error-bg-subtle text-status-error-text'\n : 'bg-bg-sunken text-text-secondary'\n )}\n title={`Service SLA: ${slaProgress.total} days from submission`}\n >\n <Clock className=\"size-3.5\" aria-hidden=\"true\" />\n <span className=\"tabular-nums\">\n Day {slaProgress.day} of {slaProgress.total}\n </span>\n </span>\n )}\n </span>\n }\n back={{ label: 'Applications', onClick: () => navigateTo('applications') }}\n actions={\n <div className=\"flex flex-wrap items-center gap-2\">\n {isOfficer && !assignedToMe && currentUser?.id && (\n <Button variant=\"outline\" onClick={assignToMe} disabled={updateApplication.isPending}>\n <UserPlus className=\"mr-1.5 h-4 w-4\" /> Assign to me\n </Button>\n )}\n {application.status === 'DRAFT' && (\n <Button onClick={runSubmit} disabled={busy}>\n <Send className=\"mr-1.5 h-4 w-4\" /> Submit\n </Button>\n )}\n {isOfficer && transitions.length > 0 && (\n <DropdownMenu>\n <DropdownMenuTrigger\n disabled={busy}\n className=\"inline-flex items-center gap-1.5 rounded-button bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text transition-opacity hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-border-focus disabled:opacity-50\"\n aria-label=\"Advance status\"\n >\n Advance status <ChevronDown className=\"size-4\" />\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"end\" className=\"min-w-48\">\n {transitions.map((spec) => {\n const Icon = spec.icon;\n return (\n <DropdownMenuItem\n key={spec.status}\n className={`gap-2 ${spec.destructive ? 'text-status-error-text focus:text-status-error-text' : ''}`}\n onSelect={() => onTransitionSelect(spec)}\n >\n <Icon className=\"size-4\" /> {spec.label}\n </DropdownMenuItem>\n );\n })}\n </DropdownMenuContent>\n </DropdownMenu>\n )}\n </div>\n }\n >\n {/* Lifecycle stepper — officer transitions + citizen tracking (mock 18) */}\n <SectionCard title=\"Progress\" icon={<Route />} className=\"mb-4 border-border-seam\">\n <StatusStepper steps={lifecycle.steps} current={lifecycle.current} />\n </SectionCard>\n\n <div className=\"grid gap-4 lg:grid-cols-3\">\n <div className=\"space-y-4 lg:col-span-2\">\n {/* Decision note (when a decision has been recorded) */}\n {application.decisionReason && (\n <div className=\"rounded-card border border-border-seam bg-bg-sunken px-4 py-3 text-sm text-text-secondary\">\n <span className=\"font-medium text-text-primary\">Decision note: </span>\n {application.decisionReason}\n </div>\n )}\n\n {/* Submitted information */}\n <SectionCard\n title=\"Submitted information\"\n icon={<ClipboardList />}\n className=\"border-border-seam\"\n >\n {formEntries.length === 0 ? (\n <p className=\"text-sm text-text-secondary\">\n No form data was captured with this application.\n </p>\n ) : (\n <KeyValueList\n columns={2}\n variant=\"stacked\"\n items={formEntries.map(([key, value]) => ({\n label: formatEnumLabel(key),\n value: String(value),\n }))}\n />\n )}\n </SectionCard>\n\n {/* Documents */}\n <SectionCard\n title=\"Documents\"\n icon={<FileText />}\n className=\"border-border-seam\"\n actions={\n <span className=\"text-xs text-text-muted tabular-nums\">\n {application.documents.length} attached\n </span>\n }\n >\n <div className=\"space-y-2.5\">\n {application.documents.length === 0 ? (\n <p className=\"text-sm text-text-secondary\">No documents attached yet.</p>\n ) : (\n application.documents.map((doc) => (\n <div\n key={doc.id}\n className=\"flex flex-wrap items-center justify-between gap-3 rounded-lg border border-border-seam bg-bg-surface px-3 py-2.5\"\n >\n <div className=\"flex min-w-0 items-center gap-3\">\n <span className=\"inline-flex size-9 shrink-0 items-center justify-center rounded-lg bg-bg-sunken text-text-secondary\">\n <FileText className=\"size-4\" />\n </span>\n <div className=\"min-w-0\">\n <p className=\"truncate text-sm font-medium text-text-primary\">{doc.name}</p>\n <p className=\"text-xs text-text-muted\">\n {doc.requirement ? `${doc.requirement} · ` : ''}\n Added {formatRelativeTime(doc.createdAt)}\n </p>\n {doc.status === 'REJECTED' && doc.rejectionReason && (\n <p className=\"mt-0.5 text-xs text-status-error-text\">\n Rejected: {doc.rejectionReason}\n </p>\n )}\n </div>\n </div>\n <div className=\"flex items-center gap-2\">\n <StatusBadge status={doc.status} />\n {isOfficer && doc.status === 'PENDING' && (\n <>\n <Button\n size=\"sm\"\n variant=\"outline\"\n onClick={() => acceptDoc(doc)}\n disabled={reviewDocument.isPending}\n aria-label={`Accept ${doc.name}`}\n >\n <Check className=\"h-4 w-4\" />\n </Button>\n <Button\n size=\"sm\"\n variant=\"outline\"\n onClick={() => setRejectDoc(doc)}\n disabled={reviewDocument.isPending}\n aria-label={`Reject ${doc.name}`}\n >\n <X className=\"h-4 w-4\" />\n </Button>\n </>\n )}\n </div>\n </div>\n ))\n )}\n </div>\n <div className=\"mt-4 border-t border-border-seam pt-4\">\n <DocumentUploadField applicationId={application.id} onAdded={() => refetch()} />\n </div>\n </SectionCard>\n\n {/* Required-documents checklist — what the service asks for, and what\n has actually been filed against each requirement (mock 32). */}\n {requirementRows.length > 0 && (\n <SectionCard\n title=\"Required documents\"\n icon={<ListChecks />}\n className=\"border-border-seam\"\n actions={\n <span className=\"text-xs text-text-muted tabular-nums\">\n {requirementsAccepted} of {requirementRows.length} accepted\n </span>\n }\n >\n <RequirementChecklist rows={requirementRows} />\n {requirementsOutstanding > 0 && (\n <p className=\"mt-3 text-xs text-text-muted\">\n {requirementsOutstanding}{' '}\n {requirementsOutstanding === 1 ? 'requirement is' : 'requirements are'} still\n outstanding.\n </p>\n )}\n {unmatchedDocuments > 0 && (\n <p className=\"mt-1 text-xs text-text-muted\">\n {unmatchedDocuments} further{' '}\n {unmatchedDocuments === 1 ? 'document is' : 'documents are'} attached without a\n named requirement.\n </p>\n )}\n </SectionCard>\n )}\n\n {/* Case notes timeline */}\n <SectionCard\n title=\"Case notes\"\n icon={<MessageSquare />}\n className=\"border-border-seam\"\n actions={\n <span className=\"text-xs text-text-muted tabular-nums\">\n {sortedNotes.length} {sortedNotes.length === 1 ? 'note' : 'notes'}\n </span>\n }\n >\n {sortedNotes.length === 0 ? (\n <p className=\"text-sm text-text-secondary\">No case notes yet.</p>\n ) : (\n <Timeline>\n {sortedNotes.map((note, index) => {\n const meta = NOTE_META[note.type];\n const Icon = meta.icon;\n const author =\n currentUser?.id && note.authorId === currentUser.id\n ? 'You'\n : `#${shortId(note.authorId)}`;\n return (\n <TimelineItem\n key={note.id}\n tone={meta.tone}\n icon={<Icon />}\n title={meta.label}\n author={author}\n timestamp={formatDateTime(note.createdAt)}\n last={index === sortedNotes.length - 1}\n >\n <p className=\"whitespace-pre-wrap text-text-primary\">{note.body}</p>\n </TimelineItem>\n );\n })}\n </Timeline>\n )}\n\n {/* Citizen reply — answers an information request on the same thread */}\n {!isOfficer && (\n <div className=\"mt-4 space-y-2 border-t border-border-seam pt-4\">\n <Textarea\n value={replyBody}\n onChange={(e) => setReplyBody(e.target.value)}\n placeholder=\"Write a reply to the agency…\"\n rows={2}\n aria-label=\"Reply to the agency\"\n />\n <div className=\"flex justify-end\">\n <Button\n onClick={sendReply}\n disabled={!replyBody.trim() || replyToApplication.isPending}\n >\n <Send className=\"mr-1.5 h-4 w-4\" /> Send reply\n </Button>\n </div>\n </div>\n )}\n {/* Composer */}\n {isOfficer && (\n <div className=\"mt-4 space-y-2 border-t border-border-seam pt-4\">\n <Textarea\n value={noteBody}\n onChange={(e) => setNoteBody(e.target.value)}\n placeholder=\"Add a case note…\"\n rows={2}\n aria-label=\"New case note\"\n />\n <div className=\"flex flex-wrap items-center justify-between gap-2\">\n <div className=\"flex items-center gap-2\">\n <Label htmlFor=\"note-type\" className=\"text-xs text-text-muted\">\n Note type\n </Label>\n <Select\n value={noteType}\n onValueChange={(v) => setNoteType(v as GovCaseNoteType)}\n >\n <SelectTrigger id=\"note-type\" className=\"w-44\" aria-label=\"Note type\">\n <SelectValue />\n </SelectTrigger>\n <SelectContent>\n {NOTE_TYPES.map((t) => (\n <SelectItem key={t} value={t}>\n {NOTE_META[t].label}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n </div>\n <Button onClick={addNote} disabled={!noteBody.trim() || addCaseNote.isPending}>\n <Plus className=\"mr-1.5 h-4 w-4\" /> Add note\n </Button>\n </div>\n </div>\n )}\n </SectionCard>\n\n {/* SLA escalations fired on this case (BOFF-5792) — officer only. The\n subgraph resolves an empty list on citizen paths, so this renders\n nothing there even before the isOfficer guard. */}\n {isOfficer && (application.slaEscalations?.length ?? 0) > 0 && (\n <SectionCard\n title=\"SLA escalations\"\n icon={<TriangleAlert />}\n className=\"border-border-seam\"\n actions={\n <span className=\"text-xs text-text-muted tabular-nums\">\n {application.slaEscalations?.length ?? 0}{' '}\n {(application.slaEscalations?.length ?? 0) === 1 ? 'fired' : 'fired'}\n </span>\n }\n >\n <ul className=\"space-y-3\">\n {(application.slaEscalations ?? []).map((escalation) => {\n const offset = escalation.breachOffsetHours;\n const offsetLabel =\n offset == null\n ? 'Threshold reached'\n : offset >= 0\n ? `${Math.round(offset)}h past due at escalation`\n : `due in ${Math.abs(Math.round(offset))}h at escalation`;\n return (\n <li\n key={escalation.id}\n className=\"rounded-lg border border-border-seam bg-bg-sunken p-3\"\n >\n <div className=\"flex flex-wrap items-center justify-between gap-2\">\n <span className=\"text-sm font-medium text-text-primary\">\n Rule #{shortId(escalation.ruleId)}\n </span>\n <span className=\"text-xs text-text-muted\">\n {formatDateTime(escalation.createdAt)}\n </span>\n </div>\n <p className=\"mt-1 text-xs text-text-secondary\">{offsetLabel}</p>\n <div className=\"mt-2 flex flex-wrap gap-2 text-xs\">\n {escalation.notifiedSupervisorId && (\n <span className=\"inline-flex items-center gap-1 rounded-full bg-bg-surface px-2 py-0.5 text-text-secondary\">\n <Bell className=\"size-3\" aria-hidden=\"true\" />\n Supervisor #{shortId(escalation.notifiedSupervisorId)} notified\n </span>\n )}\n {escalation.reassignedToId && (\n <span className=\"inline-flex items-center gap-1 rounded-full bg-bg-surface px-2 py-0.5 text-text-secondary\">\n <UserCheck className=\"size-3\" aria-hidden=\"true\" />\n Reassigned to Officer #{shortId(escalation.reassignedToId)}\n </span>\n )}\n </div>\n </li>\n );\n })}\n </ul>\n </SectionCard>\n )}\n </div>\n\n {/* Side column: meta + payments + permits */}\n <div className=\"space-y-4\">\n <SectionCard title=\"Case details\" icon={<Eye />} className=\"border-border-seam\">\n <KeyValueList items={metaItems} />\n </SectionCard>\n\n {/* Payments */}\n {isOfficer && (\n <SectionCard\n title=\"Payments\"\n icon={<CreditCard />}\n className=\"border-border-seam\"\n actions={\n <Button\n size=\"sm\"\n variant=\"outline\"\n onClick={() => setPayOpen(true)}\n aria-label=\"Record payment\"\n >\n <Plus className=\"h-4 w-4\" />\n </Button>\n }\n >\n <div className=\"space-y-2\">\n {payments.data?.items.length ? (\n payments.data.items.map((payment) => (\n <div\n key={payment.id}\n className=\"rounded-lg border border-border-seam bg-bg-surface px-3 py-2.5\"\n >\n <div className=\"flex items-center justify-between gap-2\">\n <span className=\"font-medium text-text-primary tabular-nums\">\n {formatCurrency(payment.amount, payment.currency)}\n </span>\n <StatusBadge status={payment.status} />\n </div>\n {payment.receiptNumber && (\n <p className=\"mt-0.5 text-xs text-text-muted\">\n Receipt {payment.receiptNumber}\n </p>\n )}\n {(payment.status === 'PENDING' || payment.status === 'PAID') && (\n <div className=\"mt-2 flex gap-2\">\n {payment.status === 'PENDING' && (\n <Button\n size=\"sm\"\n variant=\"outline\"\n onClick={() =>\n markPaid\n .mutateAsync({ id: payment.id })\n .then(() => {\n notify.success('Marked as paid');\n emitPaymentSettled({ workspaceId, id: payment.id });\n })\n .catch((err) =>\n notify.error('Could not update', describeError(err))\n )\n }\n disabled={markPaid.isPending}\n >\n Mark paid\n </Button>\n )}\n {payment.status === 'PAID' && (\n <Button\n size=\"sm\"\n variant=\"outline\"\n onClick={() =>\n refundPayment\n .mutateAsync(payment.id)\n .then(() => notify.success('Refunded'))\n .catch((err) =>\n notify.error('Could not refund', describeError(err))\n )\n }\n disabled={refundPayment.isPending}\n >\n Refund\n </Button>\n )}\n </div>\n )}\n </div>\n ))\n ) : (\n <p className=\"text-sm text-text-secondary\">No payments recorded.</p>\n )}\n </div>\n </SectionCard>\n )}\n {/* Permits */}\n <SectionCard\n title=\"Permits\"\n icon={<BadgeCheck />}\n className=\"border-border-seam\"\n actions={\n isOfficer ? (\n <Button\n size=\"sm\"\n variant=\"outline\"\n onClick={() => setPermitOpen(true)}\n aria-label=\"Issue permit\"\n >\n <Plus className=\"h-4 w-4\" />\n </Button>\n ) : undefined\n }\n >\n <div className=\"space-y-2\">\n {application.permits.length ? (\n application.permits.map((permit) => (\n <div\n key={permit.id}\n className=\"rounded-lg border border-border-seam bg-bg-surface px-3 py-2.5\"\n >\n <div className=\"flex items-center justify-between gap-2\">\n <span className=\"truncate font-medium text-text-primary\">{permit.title}</span>\n <StatusBadge status={permit.status} />\n </div>\n <p className=\"mt-0.5 font-mono text-xs text-text-muted\">\n {permit.verificationCode}\n </p>\n </div>\n ))\n ) : (\n <p className=\"text-sm text-text-secondary\">\n {isOfficer\n ? 'No permit issued yet. Approve the application, then issue the permit here.'\n : 'No permit has been issued for this request yet.'}\n </p>\n )}\n </div>\n </SectionCard>\n </div>\n </div>\n\n {/* Transition confirm (with optional/required reason) */}\n {pendingTransition && (\n <ConfirmDialog\n open={Boolean(pendingTransition)}\n onOpenChange={(next) => (next ? undefined : setPendingTransition(null))}\n title={`${pendingTransition.label}?`}\n description={`This will move the application to ${formatEnumLabel(pendingTransition.status)}.`}\n confirmLabel={pendingTransition.label}\n destructive={pendingTransition.destructive}\n reason={{\n label:\n pendingTransition.status === 'REJECTED' ? 'Reason for rejection' : 'Reason / note',\n placeholder: 'Explain the decision…',\n required: pendingTransition.reason === 'required',\n }}\n onConfirm={async (reason) => {\n await runTransition(pendingTransition, reason);\n setPendingTransition(null);\n }}\n />\n )}\n\n {/* Document reject reason */}\n {rejectDoc && (\n <ConfirmDialog\n open={Boolean(rejectDoc)}\n onOpenChange={(next) => (next ? undefined : setRejectDoc(null))}\n title={`Reject ${rejectDoc.name}?`}\n confirmLabel=\"Reject document\"\n destructive\n reason={{\n label: 'Reason for rejection',\n placeholder: 'What is wrong with this document?',\n required: true,\n }}\n onConfirm={async (reason) => {\n await reviewDocument.mutateAsync({\n id: rejectDoc.id,\n status: 'REJECTED',\n rejectionReason: reason,\n applicationId: application.id,\n });\n notify.success('Document rejected');\n setRejectDoc(null);\n }}\n />\n )}\n\n {/* Record payment */}\n {isOfficer && (\n <RecordPaymentDialog\n open={payOpen}\n onOpenChange={setPayOpen}\n defaultAmount={service?.feeAmount ?? 0}\n defaultCurrency={service?.currency ?? 'INR'}\n onSubmit={async ({ amount, currency, providerRef }) => {\n await createPayment.mutateAsync({\n applicationId: application.id,\n amount,\n currency,\n providerRef: providerRef || null,\n });\n notify.success('Payment recorded');\n payments.refetch();\n }}\n />\n )}\n\n {/* Issue permit */}\n {isOfficer && (\n <IssuePermitDialog\n open={permitOpen}\n onOpenChange={setPermitOpen}\n defaultServiceId={application.serviceId}\n defaultHolderId={application.citizenId}\n applicationId={application.id}\n onIssued={() => refetch()}\n />\n )}\n </PageLayout>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Inline record-payment dialog (also used to top up an application's fees).\n// ---------------------------------------------------------------------------\n\nfunction RecordPaymentDialog({\n open,\n onOpenChange,\n defaultAmount,\n defaultCurrency,\n onSubmit,\n}: {\n open: boolean;\n onOpenChange: (open: boolean) => void;\n defaultAmount: number;\n defaultCurrency: string;\n onSubmit: (v: { amount: number; currency: string; providerRef: string }) => Promise<void>;\n}) {\n const [amount, setAmount] = useState('');\n const [currency, setCurrency] = useState(defaultCurrency);\n const [providerRef, setProviderRef] = useState('');\n const [busy, setBusy] = useState(false);\n\n // Re-seed defaults each time the dialog opens.\n useEffect(() => {\n if (open) {\n setAmount(defaultAmount ? String(defaultAmount) : '');\n setCurrency(defaultCurrency || 'INR');\n setProviderRef('');\n }\n }, [open, defaultAmount, defaultCurrency]);\n\n const submit = async () => {\n const value = Number(amount || 0);\n if (value <= 0) return;\n setBusy(true);\n try {\n await onSubmit({\n amount: value,\n currency: currency.trim() || 'INR',\n providerRef: providerRef.trim(),\n });\n onOpenChange(false);\n } finally {\n setBusy(false);\n }\n };\n\n return (\n <ResponsiveDialog open={open} onOpenChange={(next) => (busy ? undefined : onOpenChange(next))}>\n <ResponsiveDialogContent className=\"sm:max-w-md\">\n <ResponsiveDialogHeader>\n <ResponsiveDialogTitle>Record a payment</ResponsiveDialogTitle>\n <ResponsiveDialogDescription>\n Log a fee payment against this application.\n </ResponsiveDialogDescription>\n </ResponsiveDialogHeader>\n <div className=\"grid gap-4 py-2 sm:grid-cols-2\">\n <div className=\"grid gap-1.5\">\n <Label htmlFor=\"pay-amount\">Amount</Label>\n <Input\n id=\"pay-amount\"\n type=\"number\"\n min=\"0\"\n step=\"0.01\"\n value={amount}\n onChange={(e) => setAmount(e.target.value)}\n />\n </div>\n <div className=\"grid gap-1.5\">\n <Label htmlFor=\"pay-currency\">Currency</Label>\n <Input\n id=\"pay-currency\"\n value={currency}\n maxLength={3}\n onChange={(e) => setCurrency(e.target.value.toUpperCase())}\n />\n </div>\n <div className=\"grid gap-1.5 sm:col-span-2\">\n <Label htmlFor=\"pay-ref\">Provider reference (optional)</Label>\n <Input\n id=\"pay-ref\"\n value={providerRef}\n onChange={(e) => setProviderRef(e.target.value)}\n placeholder=\"Gateway / txn id\"\n />\n </div>\n </div>\n <ResponsiveDialogFooter>\n <Button variant=\"outline\" onClick={() => onOpenChange(false)} disabled={busy}>\n Cancel\n </Button>\n <Button onClick={submit} disabled={busy || Number(amount || 0) <= 0}>\n Record payment\n </Button>\n </ResponsiveDialogFooter>\n </ResponsiveDialogContent>\n </ResponsiveDialog>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgHA,IAAME,KAAgC;CAAC;CAAY;CAAmB;CAAgB;AAAU,GAG1FC,qBAAiD,IAAI,IAA0B;CACnF;CACA;CACA;AACF,CAAC,GAGKC,KACJ;CACE,UAAU;EAAE,MAAM;EAAW,MAAMC;EAAM,OAAO;CAAW;CAC3D,iBAAiB;EAAE,MAAM;EAAW,MAAMC;EAAe,OAAO;CAAkB;CAClF,cAAc;EAAE,MAAM;EAAW,MAAMC;EAAY,OAAO;CAAe;CACzE,UAAU;EAAE,MAAM;EAAQ,MAAMC;EAAO,OAAO;CAAW;AAC3D;AAGF,SAASC,EAAgB,GAA+C;CACtE,IAAI,CAACC,GAAM;CACX,IAAMC,IAAO,CAACD,EAAK,WAAWA,EAAK,QAAQ,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG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,CACc,EAAA,CAAA;GACD;;CACT,CAAA;AAEtB"}
|
|
1
|
+
{"version":3,"file":"ApplicationDetailPage.js","names":["_Fragment","Fragment$1","NOTE_TYPES","SLA_RUNNING","NOTE_META","Lock","MessageSquare","HelpCircle","Gavel","userDisplayName","user","full","shortId","id","transitionsFor","status","PlayCircle","CheckCircle2","XCircle","elapsedDays","start","since","startOfDay","d","requirementKey","value","requirementStateOf","documents","statuses","doc","REQUIREMENT_META","Clock","MinusCircle","buildRequirementRows","byRequirement","key","bucket","requiredDocuments","matched","requirement","RequirementChecklist","rows","meta","row","Icon","filed","FileText","cn","AssignedValue","assignedToId","currentUser","AssigneeChip","ApplicationDetailPage","useParams","useGovCitizenHub","useGovCitizenHubAnalytics","isOfficer","useSurface","application","useGovApplication","service","useGovService","payments","useGovPayments","submitApplication","useGovSubmitApplication","transitionApplication","useGovTransitionApplication","updateApplication","useGovUpdateApplication","reviewDocument","useGovReviewDocument","addCaseNote","useGovAddCaseNote","replyToApplication","useGovReplyToMyApplication","createPayment","useGovCreatePayment","markPaid","useGovMarkPaymentPaid","refundPayment","useGovRefundPayment","pendingTransition","setPendingTransition","useState","rejectDoc","setRejectDoc","noteBody","setNoteBody","replyBody","setReplyBody","noteType","setNoteType","payOpen","setPayOpen","permitOpen","setPermitOpen","transitions","useMemo","lifecycle","buildApplicationLifecycle","formEntries","fd","v","requirementRows","requirementsAccepted","requirementsOutstanding","unmatchedDocuments","known","slaProgress","day","sortedNotes","note","a","b","isLoading","PageLayout","navigateTo","LoadingView","isError","ErrorView","refetch","runSubmit","notify","err","describeError","runTransition","spec","reason","formatEnumLabel","assignToMe","acceptDoc","sendReply","addNote","busy","assignedToMe","onTransitionSelect","metaItems","formatDateTime","formatDate","SlaBadge","StatusBadge","Button","UserPlus","Send","DropdownMenu","DropdownMenuTrigger","ChevronDown","DropdownMenuContent","DropdownMenuItem","SectionCard","Route","StatusStepper","ClipboardList","KeyValueList","formatRelativeTime","Check","X","DocumentUploadField","ListChecks","Timeline","author","TimelineItem","index","Textarea","Label","Select","SelectTrigger","SelectValue","SelectContent","SelectItem","t","Plus","TriangleAlert","offset","escalation","offsetLabel","Bell","UserCheck","Eye","CreditCard","formatCurrency","payment","emitPaymentSettled","BadgeCheck","permit","ConfirmDialog","next","RecordPaymentDialog","providerRef","IssuePermitDialog","amount","setAmount","currency","setCurrency","defaultCurrency","setProviderRef","setBusy","useEffect","open","defaultAmount","ResponsiveDialog","onOpenChange","ResponsiveDialogContent","ResponsiveDialogHeader","ResponsiveDialogTitle","ResponsiveDialogDescription","Input","ResponsiveDialogFooter","onSubmit"],"sources":["../../../../src/govcitizenhub/pages/applications/ApplicationDetailPage.tsx"],"sourcesContent":["/* eslint-disable react-hooks/set-state-in-effect -- form dialogs re-seed local state when opened/edited (guarded by open/entity deps); matches reference MFE pattern */\n/**\n * ApplicationDetailPage — the casework workspace for a single application.\n * @module govcitizenhub/pages/applications\n *\n * Reads `govApplication(id)` (documents, notes, permits, formData) plus the\n * owning service and this application's payments. Drives the full lifecycle:\n * - a StatusStepper lifecycle header (Submitted → In review → Info requested →\n * Approved/Rejected) that doubles as the citizen tracking view\n * - transitions (submit / start review / request info / approve / reject) via an\n * \"Advance status\" menu, with a reason prompt where the svc requires one\n * - documents (real upload → govAddDocument, officer review → govReviewDocument)\n * - the domain case-notes timeline (govAddCaseNote — colour-coded by note type)\n * - payments (record / mark paid / refund) and permits (issue)\n * - assignment (assign to me via govUpdateApplication)\n *\n * All data is real (no mocks); `User`/`File` are id-only stubs, so identity is\n * only rendered for the signed-in officer — never a fabricated name.\n */\n\nimport { useEffect, useMemo, useState, type FC } from 'react';\nimport { useParams } from 'react-router';\nimport {\n Send,\n PlayCircle,\n HelpCircle,\n CheckCircle2,\n XCircle,\n UserPlus,\n FileText,\n MessageSquare,\n CreditCard,\n BadgeCheck,\n Check,\n X,\n Plus,\n ChevronDown,\n Lock,\n Gavel,\n ClipboardList,\n Route,\n Eye,\n Clock,\n MinusCircle,\n ListChecks,\n TriangleAlert,\n Bell,\n UserCheck,\n} from 'lucide-react';\nimport {\n Button,\n Input,\n Label,\n Textarea,\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuTrigger,\n ResponsiveDialog,\n ResponsiveDialogContent,\n ResponsiveDialogHeader,\n ResponsiveDialogTitle,\n ResponsiveDialogDescription,\n ResponsiveDialogFooter,\n} from '@burdenoff/fe-libs/ui';\n\nimport { PageLayout } from '../../components/PageLayout';\nimport { StatusBadge } from '../../components/StatusBadge';\nimport { SlaBadge } from '../../components/SlaBadge';\nimport { StatusStepper } from '../../components/StatusStepper';\nimport { Timeline, TimelineItem, type TimelineTone } from '../../components/Timeline';\nimport { SectionCard } from '../../components/SectionCard';\nimport { KeyValueList, type KeyValueItem } from '../../components/KeyValueList';\nimport { AssigneeChip } from '../../components/Avatar';\nimport { LoadingView, ErrorView } from '../../components/StateViews';\nimport { DocumentUploadField } from '../../components/DocumentUploadField';\nimport { ConfirmDialog } from '../../components/ConfirmDialog';\nimport { IssuePermitDialog } from '../permits/IssuePermitDialog';\nimport {\n useGovApplication,\n useGovService,\n useGovPayments,\n useGovSubmitApplication,\n useGovTransitionApplication,\n useGovUpdateApplication,\n useGovReviewDocument,\n useGovAddCaseNote,\n useGovReplyToMyApplication,\n useGovCreatePayment,\n useGovMarkPaymentPaid,\n useGovCitizenHubAnalytics,\n useGovRefundPayment,\n} from '../../hooks';\nimport { useGovCitizenHub } from '../../context';\nimport { useSurface } from '../../surface/SurfaceContext';\nimport { buildApplicationLifecycle } from '../../utils/applicationLifecycle';\nimport { cn } from '../../utils/cn';\nimport { notify, describeError } from '../../lib/toast';\nimport {\n formatDate,\n formatDateTime,\n formatRelativeTime,\n formatCurrency,\n formatEnumLabel,\n} from '../../utils/formatters';\nimport type { GovApplicationStatus, GovCaseNoteType, GovDocument, CurrentUser } from '../../types';\n\nconst NOTE_TYPES: GovCaseNoteType[] = ['INTERNAL', 'CITIZEN_MESSAGE', 'INFO_REQUEST', 'DECISION'];\n\n/** Statuses where the service SLA clock is still running. */\nconst SLA_RUNNING: ReadonlySet<GovApplicationStatus> = new Set<GovApplicationStatus>([\n 'SUBMITTED',\n 'IN_REVIEW',\n 'INFO_REQUESTED',\n]);\n\n/** Colour + icon + label for each case-note type (mock 07). */\nconst NOTE_META: Record<GovCaseNoteType, { tone: TimelineTone; icon: typeof Lock; label: string }> =\n {\n INTERNAL: { tone: 'default', icon: Lock, label: 'Internal' },\n CITIZEN_MESSAGE: { tone: 'success', icon: MessageSquare, label: 'Citizen message' },\n INFO_REQUEST: { tone: 'warning', icon: HelpCircle, label: 'Info request' },\n DECISION: { tone: 'info', icon: Gavel, label: 'Decision' },\n };\n\n/** Best available display name for the signed-in officer (never fabricated for others). */\nfunction userDisplayName(user?: CurrentUser | null): string | undefined {\n if (!user) return undefined;\n const full = [user.firstName, user.lastName].filter(Boolean).join(' ').trim();\n return user.name?.trim() || full || user.username?.trim() || user.email;\n}\n\n/** First 8 chars of an opaque actor id — an honest reference, not a name. */\nconst shortId = (id: string): string => id.slice(0, 8);\n\ninterface TransitionSpec {\n status: GovApplicationStatus;\n label: string;\n icon: typeof CheckCircle2;\n reason: 'none' | 'optional' | 'required';\n destructive?: boolean;\n}\n\nfunction transitionsFor(status: GovApplicationStatus): TransitionSpec[] {\n switch (status) {\n case 'SUBMITTED':\n return [\n { status: 'IN_REVIEW', label: 'Start review', icon: PlayCircle, reason: 'none' },\n { status: 'INFO_REQUESTED', label: 'Request info', icon: HelpCircle, reason: 'required' },\n { status: 'APPROVED', label: 'Approve', icon: CheckCircle2, reason: 'optional' },\n {\n status: 'REJECTED',\n label: 'Reject',\n icon: XCircle,\n reason: 'required',\n destructive: true,\n },\n ];\n case 'IN_REVIEW':\n return [\n { status: 'INFO_REQUESTED', label: 'Request info', icon: HelpCircle, reason: 'required' },\n { status: 'APPROVED', label: 'Approve', icon: CheckCircle2, reason: 'optional' },\n {\n status: 'REJECTED',\n label: 'Reject',\n icon: XCircle,\n reason: 'required',\n destructive: true,\n },\n ];\n case 'INFO_REQUESTED':\n return [\n { status: 'IN_REVIEW', label: 'Resume review', icon: PlayCircle, reason: 'none' },\n { status: 'APPROVED', label: 'Approve', icon: CheckCircle2, reason: 'optional' },\n {\n status: 'REJECTED',\n label: 'Reject',\n icon: XCircle,\n reason: 'required',\n destructive: true,\n },\n ];\n default:\n return [];\n }\n}\n\n/**\n * Whole calendar days from `since` to today, counted inclusively so the day of\n * submission is \"Day 1\". Returns null for an unparseable timestamp.\n */\nfunction elapsedDays(since: string): number | null {\n const start = new Date(since);\n if (Number.isNaN(start.getTime())) return null;\n const startOfDay = (d: Date) => new Date(d.getFullYear(), d.getMonth(), d.getDate()).getTime();\n const diff = Math.round((startOfDay(new Date()) - startOfDay(start)) / 86_400_000);\n return diff + 1;\n}\n\n// ---------------------------------------------------------------------------\n// Required-documents checklist (mock 32)\n//\n// The service publishes `requiredDocuments` (a list of requirement labels) and\n// every attached `GovDocument` carries the `requirement` it was filed against\n// plus its review `status`. Both already arrive in this page's own query\n// results; before this the page only printed the requirement labels as a\n// comma-joined sentence, so an officer could not see which of them were still\n// outstanding without reading the attachment list and doing the join by eye.\n//\n// A requirement with no attachment is MISSING. That state is derived from the\n// absence of a record, never asserted as a backend field.\n// ---------------------------------------------------------------------------\n\ntype RequirementState = 'ACCEPTED' | 'PENDING' | 'REJECTED' | 'MISSING';\n\ninterface RequirementRow {\n requirement: string;\n state: RequirementState;\n /** The documents filed against this requirement, if any. */\n documents: GovDocument[];\n}\n\n/** Normalised match key — requirement labels are free text on both sides. */\nconst requirementKey = (value: string): string => value.trim().toLowerCase();\n\n/**\n * Worst-first precedence so a requirement is only \"Accepted\" once something\n * filed against it actually has been. A rejected attachment with no replacement\n * outranks nothing else on the requirement, so it reads as still outstanding.\n */\nfunction requirementStateOf(documents: GovDocument[]): RequirementState {\n if (documents.length === 0) return 'MISSING';\n const statuses = new Set(documents.map((doc) => doc.status.toUpperCase()));\n if (statuses.has('ACCEPTED')) return 'ACCEPTED';\n if (statuses.has('PENDING')) return 'PENDING';\n if (statuses.has('REJECTED')) return 'REJECTED';\n return 'MISSING';\n}\n\nconst REQUIREMENT_META: Record<\n RequirementState,\n { label: string; icon: typeof CheckCircle2; tone: string }\n> = {\n ACCEPTED: { label: 'Accepted', icon: CheckCircle2, tone: 'text-status-success-text' },\n PENDING: { label: 'Pending', icon: Clock, tone: 'text-status-warning-text' },\n REJECTED: { label: 'Rejected', icon: XCircle, tone: 'text-status-error-text' },\n MISSING: { label: 'Missing', icon: MinusCircle, tone: 'text-text-muted' },\n};\n\nfunction buildRequirementRows(\n requiredDocuments: string[],\n documents: GovDocument[]\n): RequirementRow[] {\n const byRequirement = new Map<string, GovDocument[]>();\n for (const doc of documents) {\n if (!doc.requirement) continue;\n const key = requirementKey(doc.requirement);\n const bucket = byRequirement.get(key);\n if (bucket) bucket.push(doc);\n else byRequirement.set(key, [doc]);\n }\n\n return requiredDocuments.map((requirement) => {\n const matched = byRequirement.get(requirementKey(requirement)) ?? [];\n return { requirement, state: requirementStateOf(matched), documents: matched };\n });\n}\n\nconst RequirementChecklist: FC<{ rows: RequirementRow[] }> = ({ rows }) => (\n <ul className=\"space-y-1.5\">\n {rows.map((row) => {\n const meta = REQUIREMENT_META[row.state];\n const Icon = meta.icon;\n const filed = row.documents[0];\n return (\n <li\n key={row.requirement}\n className=\"flex flex-wrap items-center justify-between gap-2 rounded-lg bg-bg-sunken px-3 py-2\"\n >\n <span className=\"flex min-w-0 items-center gap-2\">\n <FileText className=\"size-4 shrink-0 text-text-muted\" aria-hidden=\"true\" />\n <span className=\"min-w-0\">\n <span className=\"block truncate text-sm text-text-primary\">{row.requirement}</span>\n {filed && (\n <span className=\"block truncate text-xs text-text-muted\">{filed.name}</span>\n )}\n </span>\n </span>\n <span className={cn('flex shrink-0 items-center gap-1.5 text-xs font-medium', meta.tone)}>\n <Icon className=\"size-4\" aria-hidden=\"true\" />\n {meta.label}\n </span>\n </li>\n );\n })}\n </ul>\n);\n\n/** Assigned-officer value — real identity only (self), else a neutral id chip. */\nfunction AssignedValue({\n assignedToId,\n currentUser,\n}: {\n assignedToId?: string | null;\n currentUser?: CurrentUser | null;\n}) {\n if (!assignedToId) return <span className=\"text-sm text-text-muted\">Unassigned</span>;\n if (currentUser?.id && assignedToId === currentUser.id) {\n return (\n <AssigneeChip\n name={userDisplayName(currentUser) ?? 'You'}\n src={currentUser.avatar}\n subtitle=\"You\"\n />\n );\n }\n return <AssigneeChip name=\"Assigned officer\" subtitle={`#${shortId(assignedToId)}`} />;\n}\n\nexport function ApplicationDetailPage() {\n const { id } = useParams<{ id: string }>();\n const { navigateTo, currentUser, workspaceId } = useGovCitizenHub();\n const { emitPaymentSettled } = useGovCitizenHubAnalytics();\n // Casework controls live in the officer console; the citizen portal is a read-only\n // \"track my request\" view of the same application (BOFF-4093).\n const isOfficer = useSurface() === 'officer';\n\n const { data: application, isLoading, isError, refetch } = useGovApplication(id);\n const { data: service } = useGovService(application?.serviceId);\n const payments = useGovPayments(\n { applicationId: id, pagination: { limit: 50 } },\n { enabled: isOfficer }\n );\n\n const submitApplication = useGovSubmitApplication();\n const transitionApplication = useGovTransitionApplication();\n const updateApplication = useGovUpdateApplication();\n const reviewDocument = useGovReviewDocument();\n const addCaseNote = useGovAddCaseNote();\n const replyToApplication = useGovReplyToMyApplication();\n const createPayment = useGovCreatePayment();\n const markPaid = useGovMarkPaymentPaid();\n const refundPayment = useGovRefundPayment();\n\n const [pendingTransition, setPendingTransition] = useState<TransitionSpec | null>(null);\n const [rejectDoc, setRejectDoc] = useState<GovDocument | null>(null);\n const [noteBody, setNoteBody] = useState('');\n const [replyBody, setReplyBody] = useState('');\n const [noteType, setNoteType] = useState<GovCaseNoteType>('INTERNAL');\n const [payOpen, setPayOpen] = useState(false);\n const [permitOpen, setPermitOpen] = useState(false);\n\n const transitions = useMemo(\n () => (application ? transitionsFor(application.status) : []),\n [application]\n );\n const lifecycle = useMemo(\n () => (application ? buildApplicationLifecycle(application) : { steps: [], current: 0 }),\n [application]\n );\n const formEntries = useMemo(() => {\n const fd = application?.formData;\n if (!fd || typeof fd !== 'object' || Array.isArray(fd)) return [];\n return Object.entries(fd as Record<string, unknown>).filter(\n ([, v]) => v != null && String(v).trim() !== ''\n );\n }, [application?.formData]);\n\n /**\n * Requirement rows: `service.requiredDocuments` joined to the application's\n * own attachments by `requirement`. Both sides are already in this page's\n * query results — nothing extra is fetched and nothing is inferred beyond\n * \"no attachment filed against this requirement\" = Missing.\n */\n const requirementRows = useMemo(\n () =>\n service && application\n ? buildRequirementRows(service.requiredDocuments, application.documents)\n : [],\n [service, application]\n );\n const requirementsAccepted = requirementRows.filter((row) => row.state === 'ACCEPTED').length;\n const requirementsOutstanding = requirementRows.length - requirementsAccepted;\n /** Attachments filed with no requirement, or one the service no longer lists. */\n const unmatchedDocuments = useMemo(() => {\n if (!application) return 0;\n const known = new Set(requirementRows.map((row) => requirementKey(row.requirement)));\n return application.documents.filter(\n (doc) => !doc.requirement || !known.has(requirementKey(doc.requirement))\n ).length;\n }, [application, requirementRows]);\n\n /**\n * SLA day counter — \"Day N of <service.slaDays>\". N counts calendar days from\n * the day the citizen submitted; both inputs are persisted fields, so the\n * counter is only rendered when the record actually carries them.\n */\n const slaProgress = useMemo(() => {\n if (!application?.submittedAt || !service || service.slaDays <= 0) return null;\n // The clock only runs while the case is open; a decided case shows its\n // decision date instead of a running counter.\n if (!SLA_RUNNING.has(application.status)) return null;\n const day = elapsedDays(application.submittedAt);\n if (day == null) return null;\n return { day, total: service.slaDays, breached: day > service.slaDays };\n }, [application, service]);\n\n const sortedNotes = useMemo(\n () =>\n application\n ? [...application.notes]\n .filter((note) => isOfficer || note.type !== 'INTERNAL')\n .sort((a, b) => new Date(a.createdAt).getTime() - new Date(b.createdAt).getTime())\n : [],\n [application, isOfficer]\n );\n\n if (isLoading) {\n return (\n <PageLayout\n title=\"Application\"\n back={{ label: 'Applications', onClick: () => navigateTo('applications') }}\n >\n <LoadingView label=\"Loading application…\" />\n </PageLayout>\n );\n }\n if (isError || !application) {\n return (\n <PageLayout\n title=\"Application\"\n back={{ label: 'Applications', onClick: () => navigateTo('applications') }}\n >\n <ErrorView message=\"We couldn't load this application.\" onRetry={() => refetch()} />\n </PageLayout>\n );\n }\n\n const runSubmit = async () => {\n try {\n await submitApplication.mutateAsync(application.id);\n notify.success('Application submitted', application.reference);\n } catch (err) {\n notify.error('Could not submit', describeError(err));\n }\n };\n\n const runTransition = async (spec: TransitionSpec, reason: string) => {\n try {\n await transitionApplication.mutateAsync({\n id: application.id,\n status: spec.status,\n reason: reason.trim() || null,\n });\n notify.success('Application updated', `Status is now ${formatEnumLabel(spec.status)}.`);\n } catch (err) {\n notify.error('Could not update the application', describeError(err));\n }\n };\n\n const assignToMe = async () => {\n if (!currentUser?.id) return;\n try {\n await updateApplication.mutateAsync({\n id: application.id,\n input: { assignedToId: currentUser.id },\n });\n notify.success('Assigned to you');\n } catch (err) {\n notify.error('Could not assign', describeError(err));\n }\n };\n\n const acceptDoc = async (doc: GovDocument) => {\n try {\n await reviewDocument.mutateAsync({\n id: doc.id,\n status: 'ACCEPTED',\n applicationId: application.id,\n });\n notify.success('Document accepted', doc.name);\n } catch (err) {\n notify.error('Could not accept document', describeError(err));\n }\n };\n\n // Citizen reply on their own request (stored as a CITIZEN_MESSAGE note).\n const sendReply = async () => {\n if (!replyBody.trim()) return;\n try {\n await replyToApplication.mutateAsync({\n applicationId: application.id,\n body: replyBody.trim(),\n });\n setReplyBody('');\n notify.success('Reply sent');\n } catch (err) {\n notify.error('Could not send reply', describeError(err));\n }\n };\n\n const addNote = async () => {\n if (!noteBody.trim()) return;\n try {\n await addCaseNote.mutateAsync({\n applicationId: application.id,\n body: noteBody.trim(),\n type: noteType,\n });\n setNoteBody('');\n notify.success('Note added');\n } catch (err) {\n notify.error('Could not add note', describeError(err));\n }\n };\n\n const busy =\n submitApplication.isPending || transitionApplication.isPending || updateApplication.isPending;\n const assignedToMe = Boolean(\n application.assignedToId && application.assignedToId === currentUser?.id\n );\n\n const onTransitionSelect = (spec: TransitionSpec) => {\n if (spec.reason === 'none') void runTransition(spec, '');\n else setPendingTransition(spec);\n };\n\n const metaItems: KeyValueItem[] = [\n { label: 'Filed', value: formatDateTime(application.createdAt) },\n {\n label: 'Submitted',\n value: application.submittedAt ? formatDateTime(application.submittedAt) : 'Not submitted',\n },\n {\n label: 'Due date',\n value: application.dueDate ? (\n <span className=\"flex flex-col items-end gap-1\">\n <span>{formatDate(application.dueDate)}</span>\n <SlaBadge dueDate={application.dueDate} status={application.status} />\n </span>\n ) : (\n '—'\n ),\n },\n {\n label: 'Decided',\n value: application.decidedAt ? formatDateTime(application.decidedAt) : '—',\n },\n {\n label: 'Assigned to',\n value: <AssignedValue assignedToId={application.assignedToId} currentUser={currentUser} />,\n },\n ];\n\n return (\n <PageLayout\n title={\n <span className=\"flex flex-wrap items-center gap-x-3 gap-y-2\">\n <span className=\"text-text-primary\">{application.reference}</span>\n {service && (\n <span className=\"text-lg font-normal text-text-secondary\">· {service.name}</span>\n )}\n <StatusBadge status={application.status} size=\"md\" />\n <StatusBadge status={application.priority} size=\"md\" />\n {slaProgress && (\n <span\n className={cn(\n 'inline-flex items-center gap-1.5 rounded-full px-3 py-1 text-sm font-medium',\n slaProgress.breached\n ? 'bg-status-error-bg-subtle text-status-error-text'\n : 'bg-bg-sunken text-text-secondary'\n )}\n title={`Service SLA: ${slaProgress.total} days from submission`}\n >\n <Clock className=\"size-3.5\" aria-hidden=\"true\" />\n <span className=\"tabular-nums\">\n Day {slaProgress.day} of {slaProgress.total}\n </span>\n </span>\n )}\n </span>\n }\n back={{ label: 'Applications', onClick: () => navigateTo('applications') }}\n actions={\n <div className=\"flex flex-wrap items-center gap-2\">\n {isOfficer && !assignedToMe && currentUser?.id && (\n <Button variant=\"outline\" onClick={assignToMe} disabled={updateApplication.isPending}>\n <UserPlus className=\"me-1.5 h-4 w-4\" /> Assign to me\n </Button>\n )}\n {application.status === 'DRAFT' && (\n <Button onClick={runSubmit} disabled={busy}>\n <Send className=\"me-1.5 h-4 w-4\" /> Submit\n </Button>\n )}\n {isOfficer && transitions.length > 0 && (\n <DropdownMenu>\n <DropdownMenuTrigger\n disabled={busy}\n className=\"inline-flex items-center gap-1.5 rounded-button bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text transition-opacity hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-border-focus disabled:opacity-50\"\n aria-label=\"Advance status\"\n >\n Advance status <ChevronDown className=\"size-4\" />\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"end\" className=\"min-w-48\">\n {transitions.map((spec) => {\n const Icon = spec.icon;\n return (\n <DropdownMenuItem\n key={spec.status}\n className={`gap-2 ${spec.destructive ? 'text-status-error-text focus:text-status-error-text' : ''}`}\n onSelect={() => onTransitionSelect(spec)}\n >\n <Icon className=\"size-4\" /> {spec.label}\n </DropdownMenuItem>\n );\n })}\n </DropdownMenuContent>\n </DropdownMenu>\n )}\n </div>\n }\n >\n {/* Lifecycle stepper — officer transitions + citizen tracking (mock 18) */}\n <SectionCard title=\"Progress\" icon={<Route />} className=\"mb-4 border-border-seam\">\n <StatusStepper steps={lifecycle.steps} current={lifecycle.current} />\n </SectionCard>\n\n <div className=\"grid gap-4 lg:grid-cols-3\">\n <div className=\"space-y-4 lg:col-span-2\">\n {/* Decision note (when a decision has been recorded) */}\n {application.decisionReason && (\n <div className=\"rounded-card border border-border-seam bg-bg-sunken px-4 py-3 text-sm text-text-secondary\">\n <span className=\"font-medium text-text-primary\">Decision note: </span>\n {application.decisionReason}\n </div>\n )}\n\n {/* Submitted information */}\n <SectionCard\n title=\"Submitted information\"\n icon={<ClipboardList />}\n className=\"border-border-seam\"\n >\n {formEntries.length === 0 ? (\n <p className=\"text-sm text-text-secondary\">\n No form data was captured with this application.\n </p>\n ) : (\n <KeyValueList\n columns={2}\n variant=\"stacked\"\n items={formEntries.map(([key, value]) => ({\n label: formatEnumLabel(key),\n value: String(value),\n }))}\n />\n )}\n </SectionCard>\n\n {/* Documents */}\n <SectionCard\n title=\"Documents\"\n icon={<FileText />}\n className=\"border-border-seam\"\n actions={\n <span className=\"text-xs text-text-muted tabular-nums\">\n {application.documents.length} attached\n </span>\n }\n >\n <div className=\"space-y-2.5\">\n {application.documents.length === 0 ? (\n <p className=\"text-sm text-text-secondary\">No documents attached yet.</p>\n ) : (\n application.documents.map((doc) => (\n <div\n key={doc.id}\n className=\"flex flex-wrap items-center justify-between gap-3 rounded-lg border border-border-seam bg-bg-surface px-3 py-2.5\"\n >\n <div className=\"flex min-w-0 items-center gap-3\">\n <span className=\"inline-flex size-9 shrink-0 items-center justify-center rounded-lg bg-bg-sunken text-text-secondary\">\n <FileText className=\"size-4\" />\n </span>\n <div className=\"min-w-0\">\n <p className=\"truncate text-sm font-medium text-text-primary\">{doc.name}</p>\n <p className=\"text-xs text-text-muted\">\n {doc.requirement ? `${doc.requirement} · ` : ''}\n Added {formatRelativeTime(doc.createdAt)}\n </p>\n {doc.status === 'REJECTED' && doc.rejectionReason && (\n <p className=\"mt-0.5 text-xs text-status-error-text\">\n Rejected: {doc.rejectionReason}\n </p>\n )}\n </div>\n </div>\n <div className=\"flex items-center gap-2\">\n <StatusBadge status={doc.status} />\n {isOfficer && doc.status === 'PENDING' && (\n <>\n <Button\n size=\"sm\"\n variant=\"outline\"\n onClick={() => acceptDoc(doc)}\n disabled={reviewDocument.isPending}\n aria-label={`Accept ${doc.name}`}\n >\n <Check className=\"h-4 w-4\" />\n </Button>\n <Button\n size=\"sm\"\n variant=\"outline\"\n onClick={() => setRejectDoc(doc)}\n disabled={reviewDocument.isPending}\n aria-label={`Reject ${doc.name}`}\n >\n <X className=\"h-4 w-4\" />\n </Button>\n </>\n )}\n </div>\n </div>\n ))\n )}\n </div>\n <div className=\"mt-4 border-t border-border-seam pt-4\">\n <DocumentUploadField applicationId={application.id} onAdded={() => refetch()} />\n </div>\n </SectionCard>\n\n {/* Required-documents checklist — what the service asks for, and what\n has actually been filed against each requirement (mock 32). */}\n {requirementRows.length > 0 && (\n <SectionCard\n title=\"Required documents\"\n icon={<ListChecks />}\n className=\"border-border-seam\"\n actions={\n <span className=\"text-xs text-text-muted tabular-nums\">\n {requirementsAccepted} of {requirementRows.length} accepted\n </span>\n }\n >\n <RequirementChecklist rows={requirementRows} />\n {requirementsOutstanding > 0 && (\n <p className=\"mt-3 text-xs text-text-muted\">\n {requirementsOutstanding}{' '}\n {requirementsOutstanding === 1 ? 'requirement is' : 'requirements are'} still\n outstanding.\n </p>\n )}\n {unmatchedDocuments > 0 && (\n <p className=\"mt-1 text-xs text-text-muted\">\n {unmatchedDocuments} further{' '}\n {unmatchedDocuments === 1 ? 'document is' : 'documents are'} attached without a\n named requirement.\n </p>\n )}\n </SectionCard>\n )}\n\n {/* Case notes timeline */}\n <SectionCard\n title=\"Case notes\"\n icon={<MessageSquare />}\n className=\"border-border-seam\"\n actions={\n <span className=\"text-xs text-text-muted tabular-nums\">\n {sortedNotes.length} {sortedNotes.length === 1 ? 'note' : 'notes'}\n </span>\n }\n >\n {sortedNotes.length === 0 ? (\n <p className=\"text-sm text-text-secondary\">No case notes yet.</p>\n ) : (\n <Timeline>\n {sortedNotes.map((note, index) => {\n const meta = NOTE_META[note.type];\n const Icon = meta.icon;\n const author =\n currentUser?.id && note.authorId === currentUser.id\n ? 'You'\n : `#${shortId(note.authorId)}`;\n return (\n <TimelineItem\n key={note.id}\n tone={meta.tone}\n icon={<Icon />}\n title={meta.label}\n author={author}\n timestamp={formatDateTime(note.createdAt)}\n last={index === sortedNotes.length - 1}\n >\n <p className=\"whitespace-pre-wrap text-text-primary\">{note.body}</p>\n </TimelineItem>\n );\n })}\n </Timeline>\n )}\n\n {/* Citizen reply — answers an information request on the same thread */}\n {!isOfficer && (\n <div className=\"mt-4 space-y-2 border-t border-border-seam pt-4\">\n <Textarea\n value={replyBody}\n onChange={(e) => setReplyBody(e.target.value)}\n placeholder=\"Write a reply to the agency…\"\n rows={2}\n aria-label=\"Reply to the agency\"\n />\n <div className=\"flex justify-end\">\n <Button\n onClick={sendReply}\n disabled={!replyBody.trim() || replyToApplication.isPending}\n >\n <Send className=\"me-1.5 h-4 w-4\" /> Send reply\n </Button>\n </div>\n </div>\n )}\n {/* Composer */}\n {isOfficer && (\n <div className=\"mt-4 space-y-2 border-t border-border-seam pt-4\">\n <Textarea\n value={noteBody}\n onChange={(e) => setNoteBody(e.target.value)}\n placeholder=\"Add a case note…\"\n rows={2}\n aria-label=\"New case note\"\n />\n <div className=\"flex flex-wrap items-center justify-between gap-2\">\n <div className=\"flex items-center gap-2\">\n <Label htmlFor=\"note-type\" className=\"text-xs text-text-muted\">\n Note type\n </Label>\n <Select\n value={noteType}\n onValueChange={(v) => setNoteType(v as GovCaseNoteType)}\n >\n <SelectTrigger id=\"note-type\" className=\"w-44\" aria-label=\"Note type\">\n <SelectValue />\n </SelectTrigger>\n <SelectContent>\n {NOTE_TYPES.map((t) => (\n <SelectItem key={t} value={t}>\n {NOTE_META[t].label}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n </div>\n <Button onClick={addNote} disabled={!noteBody.trim() || addCaseNote.isPending}>\n <Plus className=\"me-1.5 h-4 w-4\" /> Add note\n </Button>\n </div>\n </div>\n )}\n </SectionCard>\n\n {/* SLA escalations fired on this case (BOFF-5792) — officer only. The\n subgraph resolves an empty list on citizen paths, so this renders\n nothing there even before the isOfficer guard. */}\n {isOfficer && (application.slaEscalations?.length ?? 0) > 0 && (\n <SectionCard\n title=\"SLA escalations\"\n icon={<TriangleAlert />}\n className=\"border-border-seam\"\n actions={\n <span className=\"text-xs text-text-muted tabular-nums\">\n {application.slaEscalations?.length ?? 0}{' '}\n {(application.slaEscalations?.length ?? 0) === 1 ? 'fired' : 'fired'}\n </span>\n }\n >\n <ul className=\"space-y-3\">\n {(application.slaEscalations ?? []).map((escalation) => {\n const offset = escalation.breachOffsetHours;\n const offsetLabel =\n offset == null\n ? 'Threshold reached'\n : offset >= 0\n ? `${Math.round(offset)}h past due at escalation`\n : `due in ${Math.abs(Math.round(offset))}h at escalation`;\n return (\n <li\n key={escalation.id}\n className=\"rounded-lg border border-border-seam bg-bg-sunken p-3\"\n >\n <div className=\"flex flex-wrap items-center justify-between gap-2\">\n <span className=\"text-sm font-medium text-text-primary\">\n Rule #{shortId(escalation.ruleId)}\n </span>\n <span className=\"text-xs text-text-muted\">\n {formatDateTime(escalation.createdAt)}\n </span>\n </div>\n <p className=\"mt-1 text-xs text-text-secondary\">{offsetLabel}</p>\n <div className=\"mt-2 flex flex-wrap gap-2 text-xs\">\n {escalation.notifiedSupervisorId && (\n <span className=\"inline-flex items-center gap-1 rounded-full bg-bg-surface px-2 py-0.5 text-text-secondary\">\n <Bell className=\"size-3\" aria-hidden=\"true\" />\n Supervisor #{shortId(escalation.notifiedSupervisorId)} notified\n </span>\n )}\n {escalation.reassignedToId && (\n <span className=\"inline-flex items-center gap-1 rounded-full bg-bg-surface px-2 py-0.5 text-text-secondary\">\n <UserCheck className=\"size-3\" aria-hidden=\"true\" />\n Reassigned to Officer #{shortId(escalation.reassignedToId)}\n </span>\n )}\n </div>\n </li>\n );\n })}\n </ul>\n </SectionCard>\n )}\n </div>\n\n {/* Side column: meta + payments + permits */}\n <div className=\"space-y-4\">\n <SectionCard title=\"Case details\" icon={<Eye />} className=\"border-border-seam\">\n <KeyValueList items={metaItems} />\n </SectionCard>\n\n {/* Payments */}\n {isOfficer && (\n <SectionCard\n title=\"Payments\"\n icon={<CreditCard />}\n className=\"border-border-seam\"\n actions={\n <Button\n size=\"sm\"\n variant=\"outline\"\n onClick={() => setPayOpen(true)}\n aria-label=\"Record payment\"\n >\n <Plus className=\"h-4 w-4\" />\n </Button>\n }\n >\n <div className=\"space-y-2\">\n {payments.data?.items.length ? (\n payments.data.items.map((payment) => (\n <div\n key={payment.id}\n className=\"rounded-lg border border-border-seam bg-bg-surface px-3 py-2.5\"\n >\n <div className=\"flex items-center justify-between gap-2\">\n <span className=\"font-medium text-text-primary tabular-nums\">\n {formatCurrency(payment.amount, payment.currency)}\n </span>\n <StatusBadge status={payment.status} />\n </div>\n {payment.receiptNumber && (\n <p className=\"mt-0.5 text-xs text-text-muted\">\n Receipt {payment.receiptNumber}\n </p>\n )}\n {(payment.status === 'PENDING' || payment.status === 'PAID') && (\n <div className=\"mt-2 flex gap-2\">\n {payment.status === 'PENDING' && (\n <Button\n size=\"sm\"\n variant=\"outline\"\n onClick={() =>\n markPaid\n .mutateAsync({ id: payment.id })\n .then(() => {\n notify.success('Marked as paid');\n emitPaymentSettled({ workspaceId, id: payment.id });\n })\n .catch((err) =>\n notify.error('Could not update', describeError(err))\n )\n }\n disabled={markPaid.isPending}\n >\n Mark paid\n </Button>\n )}\n {payment.status === 'PAID' && (\n <Button\n size=\"sm\"\n variant=\"outline\"\n onClick={() =>\n refundPayment\n .mutateAsync(payment.id)\n .then(() => notify.success('Refunded'))\n .catch((err) =>\n notify.error('Could not refund', describeError(err))\n )\n }\n disabled={refundPayment.isPending}\n >\n Refund\n </Button>\n )}\n </div>\n )}\n </div>\n ))\n ) : (\n <p className=\"text-sm text-text-secondary\">No payments recorded.</p>\n )}\n </div>\n </SectionCard>\n )}\n {/* Permits */}\n <SectionCard\n title=\"Permits\"\n icon={<BadgeCheck />}\n className=\"border-border-seam\"\n actions={\n isOfficer ? (\n <Button\n size=\"sm\"\n variant=\"outline\"\n onClick={() => setPermitOpen(true)}\n aria-label=\"Issue permit\"\n >\n <Plus className=\"h-4 w-4\" />\n </Button>\n ) : undefined\n }\n >\n <div className=\"space-y-2\">\n {application.permits.length ? (\n application.permits.map((permit) => (\n <div\n key={permit.id}\n className=\"rounded-lg border border-border-seam bg-bg-surface px-3 py-2.5\"\n >\n <div className=\"flex items-center justify-between gap-2\">\n <span className=\"truncate font-medium text-text-primary\">{permit.title}</span>\n <StatusBadge status={permit.status} />\n </div>\n <p className=\"mt-0.5 font-mono text-xs text-text-muted\">\n {permit.verificationCode}\n </p>\n </div>\n ))\n ) : (\n <p className=\"text-sm text-text-secondary\">\n {isOfficer\n ? 'No permit issued yet. Approve the application, then issue the permit here.'\n : 'No permit has been issued for this request yet.'}\n </p>\n )}\n </div>\n </SectionCard>\n </div>\n </div>\n\n {/* Transition confirm (with optional/required reason) */}\n {pendingTransition && (\n <ConfirmDialog\n open={Boolean(pendingTransition)}\n onOpenChange={(next) => (next ? undefined : setPendingTransition(null))}\n title={`${pendingTransition.label}?`}\n description={`This will move the application to ${formatEnumLabel(pendingTransition.status)}.`}\n confirmLabel={pendingTransition.label}\n destructive={pendingTransition.destructive}\n reason={{\n label:\n pendingTransition.status === 'REJECTED' ? 'Reason for rejection' : 'Reason / note',\n placeholder: 'Explain the decision…',\n required: pendingTransition.reason === 'required',\n }}\n onConfirm={async (reason) => {\n await runTransition(pendingTransition, reason);\n setPendingTransition(null);\n }}\n />\n )}\n\n {/* Document reject reason */}\n {rejectDoc && (\n <ConfirmDialog\n open={Boolean(rejectDoc)}\n onOpenChange={(next) => (next ? undefined : setRejectDoc(null))}\n title={`Reject ${rejectDoc.name}?`}\n confirmLabel=\"Reject document\"\n destructive\n reason={{\n label: 'Reason for rejection',\n placeholder: 'What is wrong with this document?',\n required: true,\n }}\n onConfirm={async (reason) => {\n await reviewDocument.mutateAsync({\n id: rejectDoc.id,\n status: 'REJECTED',\n rejectionReason: reason,\n applicationId: application.id,\n });\n notify.success('Document rejected');\n setRejectDoc(null);\n }}\n />\n )}\n\n {/* Record payment */}\n {isOfficer && (\n <RecordPaymentDialog\n open={payOpen}\n onOpenChange={setPayOpen}\n defaultAmount={service?.feeAmount ?? 0}\n defaultCurrency={service?.currency ?? 'INR'}\n onSubmit={async ({ amount, currency, providerRef }) => {\n await createPayment.mutateAsync({\n applicationId: application.id,\n amount,\n currency,\n providerRef: providerRef || null,\n });\n notify.success('Payment recorded');\n payments.refetch();\n }}\n />\n )}\n\n {/* Issue permit */}\n {isOfficer && (\n <IssuePermitDialog\n open={permitOpen}\n onOpenChange={setPermitOpen}\n defaultServiceId={application.serviceId}\n defaultHolderId={application.citizenId}\n applicationId={application.id}\n onIssued={() => refetch()}\n />\n )}\n </PageLayout>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Inline record-payment dialog (also used to top up an application's fees).\n// ---------------------------------------------------------------------------\n\nfunction RecordPaymentDialog({\n open,\n onOpenChange,\n defaultAmount,\n defaultCurrency,\n onSubmit,\n}: {\n open: boolean;\n onOpenChange: (open: boolean) => void;\n defaultAmount: number;\n defaultCurrency: string;\n onSubmit: (v: { amount: number; currency: string; providerRef: string }) => Promise<void>;\n}) {\n const [amount, setAmount] = useState('');\n const [currency, setCurrency] = useState(defaultCurrency);\n const [providerRef, setProviderRef] = useState('');\n const [busy, setBusy] = useState(false);\n\n // Re-seed defaults each time the dialog opens.\n useEffect(() => {\n if (open) {\n setAmount(defaultAmount ? String(defaultAmount) : '');\n setCurrency(defaultCurrency || 'INR');\n setProviderRef('');\n }\n }, [open, defaultAmount, defaultCurrency]);\n\n const submit = async () => {\n const value = Number(amount || 0);\n if (value <= 0) return;\n setBusy(true);\n try {\n await onSubmit({\n amount: value,\n currency: currency.trim() || 'INR',\n providerRef: providerRef.trim(),\n });\n onOpenChange(false);\n } finally {\n setBusy(false);\n }\n };\n\n return (\n <ResponsiveDialog open={open} onOpenChange={(next) => (busy ? undefined : onOpenChange(next))}>\n <ResponsiveDialogContent className=\"sm:max-w-md\">\n <ResponsiveDialogHeader>\n <ResponsiveDialogTitle>Record a payment</ResponsiveDialogTitle>\n <ResponsiveDialogDescription>\n Log a fee payment against this application.\n </ResponsiveDialogDescription>\n </ResponsiveDialogHeader>\n <div className=\"grid gap-4 py-2 sm:grid-cols-2\">\n <div className=\"grid gap-1.5\">\n <Label htmlFor=\"pay-amount\">Amount</Label>\n <Input\n id=\"pay-amount\"\n type=\"number\"\n min=\"0\"\n step=\"0.01\"\n value={amount}\n onChange={(e) => setAmount(e.target.value)}\n />\n </div>\n <div className=\"grid gap-1.5\">\n <Label htmlFor=\"pay-currency\">Currency</Label>\n <Input\n id=\"pay-currency\"\n value={currency}\n maxLength={3}\n onChange={(e) => setCurrency(e.target.value.toUpperCase())}\n />\n </div>\n <div className=\"grid gap-1.5 sm:col-span-2\">\n <Label htmlFor=\"pay-ref\">Provider reference (optional)</Label>\n <Input\n id=\"pay-ref\"\n value={providerRef}\n onChange={(e) => setProviderRef(e.target.value)}\n placeholder=\"Gateway / txn id\"\n />\n </div>\n </div>\n <ResponsiveDialogFooter>\n <Button variant=\"outline\" onClick={() => onOpenChange(false)} disabled={busy}>\n Cancel\n </Button>\n <Button onClick={submit} disabled={busy || Number(amount || 0) <= 0}>\n Record payment\n </Button>\n </ResponsiveDialogFooter>\n </ResponsiveDialogContent>\n </ResponsiveDialog>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgHA,IAAME,KAAgC;CAAC;CAAY;CAAmB;CAAgB;AAAU,GAG1FC,qBAAiD,IAAI,IAA0B;CACnF;CACA;CACA;AACF,CAAC,GAGKC,KACJ;CACE,UAAU;EAAE,MAAM;EAAW,MAAMC;EAAM,OAAO;CAAW;CAC3D,iBAAiB;EAAE,MAAM;EAAW,MAAMC;EAAe,OAAO;CAAkB;CAClF,cAAc;EAAE,MAAM;EAAW,MAAMC;EAAY,OAAO;CAAe;CACzE,UAAU;EAAE,MAAM;EAAQ,MAAMC;EAAO,OAAO;CAAW;AAC3D;AAGF,SAASC,EAAgB,GAA+C;CACtE,IAAI,CAACC,GAAM;CACX,IAAMC,IAAO,CAACD,EAAK,WAAWA,EAAK,QAAQ,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK;CAC5E,OAAOA,EAAK,MAAM,KAAK,KAAKC,KAAQD,EAAK,UAAU,KAAK,KAAKA,EAAK;AACpE;AAGA,IAAME,KAAW,MAAuBC,EAAG,MAAM,GAAG,CAAC;AAUrD,SAASC,GAAe,GAAgD;C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ACJ,MAAK;QACL,OAAOhB;QACP,WAAW,MAAMC,EAAU,EAAE,OAAO,KAAK;OAC1C,CAAA,CACE;;MACL,kBAAC,OAAD;OAAK,WAAU;OAAf,UAAA,CACE,kBAAC3B,GAAD;QAAO,SAAQ;QAAe,UAAA;OAAe,CAAA,GAC7C,kBAAC0C,GAAD;QACE,IAAG;QACH,OAAOd;QACP,WAAW;QACX,WAAW,MAAMC,EAAY,EAAE,OAAO,MAAM,YAAY,CAAC;OAC1D,CAAA,CACE;;MACL,kBAAC,OAAD;OAAK,WAAU;OAAf,UAAA,CACE,kBAAC7B,GAAD;QAAO,SAAQ;QAAU,UAAA;OAAoC,CAAA,GAC7D,kBAAC0C,GAAD;QACE,IAAG;QACH,OAAOlB;QACP,WAAW,MAAMO,EAAe,EAAE,OAAO,KAAK;QAC9C,aAAY;OACb,CAAA,CACE;;KACF;;IACL,kBAACY,GAAD,EAAA,UAAA,CACE,kBAAClE,GAAD;KAAQ,SAAQ;KAAU,eAAe4D,EAAa,EAAK;KAAG,UAAUpE;KAAM,UAAA;IAEtE,CAAA,GACR,kBAACQ,GAAD;KAAQ,SAAS,YA5DE;MACzB,IAAMrH,IAAQ,OAAOsK,KAAU,CAAC;MAChC,IAAI,OAAS,IACb;SAAQ,EAAI;OACZ,IAAI;QAMF,AALA,MAAMkB,EAAS;SACb,QAAQxL;SACR,UAAUwK,EAAS,KAAK,KAAK;SAC7B,aAAaJ,EAAY,KAAK;QAChC,CAAC,GACDa,EAAa,EAAK;OACpB,UAAU;QACR,EAAQ,EAAK;OACf;MAVY;KAWd;KA8CiC,UAAUpE,KAAQ,OAAOyD,KAAU,CAAC,KAAK;KAAG,UAAA;IAE7D,CAAA,CACc,EAAA,CAAA;GACD;;CACT,CAAA;AAEtB"}
|
|
@@ -116,7 +116,7 @@ function F({ app: e, currentUser: t, onAssign: n, pending: r }) {
|
|
|
116
116
|
t.stopPropagation(), n(e);
|
|
117
117
|
},
|
|
118
118
|
children: [/* @__PURE__ */ S(b, {
|
|
119
|
-
className: "
|
|
119
|
+
className: "me-1.5 size-3.5",
|
|
120
120
|
"aria-hidden": "true"
|
|
121
121
|
}), e.assignedToId ? "Reassign" : "Assign"]
|
|
122
122
|
});
|
|
@@ -208,7 +208,7 @@ function L({ app: e, serviceName: t, currentUser: n, actorProfiles: a, onOpen: o
|
|
|
208
208
|
type: "button",
|
|
209
209
|
onClick: o,
|
|
210
210
|
"aria-label": `Open application ${e.reference}`,
|
|
211
|
-
className: "flex w-full flex-col gap-2 text-
|
|
211
|
+
className: "flex w-full flex-col gap-2 text-start outline-none",
|
|
212
212
|
children: [
|
|
213
213
|
/* @__PURE__ */ C("div", {
|
|
214
214
|
className: "flex items-center justify-between gap-2",
|
|
@@ -417,14 +417,14 @@ function R({ myQueue: r = !1 }) {
|
|
|
417
417
|
}), /* @__PURE__ */ C("div", {
|
|
418
418
|
className: "relative lg:w-80",
|
|
419
419
|
children: [/* @__PURE__ */ S(de, {
|
|
420
|
-
className: "pointer-events-none absolute
|
|
420
|
+
className: "pointer-events-none absolute start-3 top-1/2 size-4 -translate-y-1/2 text-text-muted",
|
|
421
421
|
"aria-hidden": "true"
|
|
422
422
|
}), /* @__PURE__ */ S(pe, {
|
|
423
423
|
value: j,
|
|
424
424
|
onChange: (e) => M(e.target.value),
|
|
425
425
|
placeholder: "Search by reference, applicant, or service…",
|
|
426
426
|
"aria-label": "Search applications on this page",
|
|
427
|
-
className: "
|
|
427
|
+
className: "ps-9"
|
|
428
428
|
})]
|
|
429
429
|
})]
|
|
430
430
|
}),
|
|
@@ -461,7 +461,7 @@ function R({ myQueue: r = !1 }) {
|
|
|
461
461
|
onClick: () => void ye(),
|
|
462
462
|
title: "Fire every active SLA escalation rule once per at-risk case",
|
|
463
463
|
children: [/* @__PURE__ */ S(y, {
|
|
464
|
-
className: "
|
|
464
|
+
className: "me-1.5 size-3.5",
|
|
465
465
|
"aria-hidden": "true"
|
|
466
466
|
}), W.isPending ? "Sweeping…" : "Run escalation sweep"]
|
|
467
467
|
})]
|
|
@@ -478,7 +478,7 @@ function R({ myQueue: r = !1 }) {
|
|
|
478
478
|
children: /* @__PURE__ */ S("div", {
|
|
479
479
|
className: "overflow-x-auto",
|
|
480
480
|
children: /* @__PURE__ */ C("table", {
|
|
481
|
-
className: "w-full text-
|
|
481
|
+
className: "w-full text-start text-sm",
|
|
482
482
|
children: [/* @__PURE__ */ S("thead", { children: /* @__PURE__ */ C("tr", {
|
|
483
483
|
className: "border-b border-border-seam text-xs font-medium uppercase tracking-wide text-text-muted",
|
|
484
484
|
children: [
|
|
@@ -572,7 +572,7 @@ function R({ myQueue: r = !1 }) {
|
|
|
572
572
|
}) : /* @__PURE__ */ C(x, { children: [/* @__PURE__ */ S("div", {
|
|
573
573
|
className: "hidden overflow-x-auto md:block",
|
|
574
574
|
children: /* @__PURE__ */ C("table", {
|
|
575
|
-
className: "w-full text-
|
|
575
|
+
className: "w-full text-start text-sm",
|
|
576
576
|
children: [/* @__PURE__ */ S("thead", { children: /* @__PURE__ */ C("tr", {
|
|
577
577
|
className: "border-b border-border-seam text-xs font-medium uppercase tracking-wide text-text-muted",
|
|
578
578
|
children: [
|
|
@@ -605,7 +605,7 @@ function R({ myQueue: r = !1 }) {
|
|
|
605
605
|
children: "Status"
|
|
606
606
|
}),
|
|
607
607
|
/* @__PURE__ */ S("th", {
|
|
608
|
-
className: "px-4 py-2.5 text-
|
|
608
|
+
className: "px-4 py-2.5 text-end font-medium",
|
|
609
609
|
children: "Actions"
|
|
610
610
|
})
|
|
611
611
|
]
|