@argusoft/medplat-product-management 1.0.0

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.
Files changed (65) hide show
  1. package/dist/BrandsPage-DCMCVvDY.js +334 -0
  2. package/dist/BrandsPage-DCMCVvDY.js.map +1 -0
  3. package/dist/CategoriesPage-BpRhwfrc.js +284 -0
  4. package/dist/CategoriesPage-BpRhwfrc.js.map +1 -0
  5. package/dist/DashboardPage-BNKUQj46.js +436 -0
  6. package/dist/DashboardPage-BNKUQj46.js.map +1 -0
  7. package/dist/FacilityPicker-Coi8I3yE.js +79 -0
  8. package/dist/FacilityPicker-Coi8I3yE.js.map +1 -0
  9. package/dist/InventoryPage-BR6jOzg2.js +517 -0
  10. package/dist/InventoryPage-BR6jOzg2.js.map +1 -0
  11. package/dist/MemberProfileCard-DbHZCS5n.js +272 -0
  12. package/dist/MemberProfileCard-DbHZCS5n.js.map +1 -0
  13. package/dist/PaymentCreatePage-Ci3ERnby.js +487 -0
  14. package/dist/PaymentCreatePage-Ci3ERnby.js.map +1 -0
  15. package/dist/PaymentsPage-sdg902zX.js +157 -0
  16. package/dist/PaymentsPage-sdg902zX.js.map +1 -0
  17. package/dist/PickupCreatePage-CieMsgWV.js +310 -0
  18. package/dist/PickupCreatePage-CieMsgWV.js.map +1 -0
  19. package/dist/PickupsPage-Ci2Ll0Kn.js +566 -0
  20. package/dist/PickupsPage-Ci2Ll0Kn.js.map +1 -0
  21. package/dist/PmGuard-CjJBisaN.js +1195 -0
  22. package/dist/PmGuard-CjJBisaN.js.map +1 -0
  23. package/dist/PmTable-BuXZQZCU.js +302 -0
  24. package/dist/PmTable-BuXZQZCU.js.map +1 -0
  25. package/dist/ProductEditPage-DL8gy85Y.js +666 -0
  26. package/dist/ProductEditPage-DL8gy85Y.js.map +1 -0
  27. package/dist/ProductsPage-BANTKxLb.js +221 -0
  28. package/dist/ProductsPage-BANTKxLb.js.map +1 -0
  29. package/dist/PurchaseCreatePage-C3KMfBxJ.js +626 -0
  30. package/dist/PurchaseCreatePage-C3KMfBxJ.js.map +1 -0
  31. package/dist/PurchaseRequestDetailPage-C0GYFJDl.js +586 -0
  32. package/dist/PurchaseRequestDetailPage-C0GYFJDl.js.map +1 -0
  33. package/dist/PurchaseRequestsPage-DvFH_tWe.js +265 -0
  34. package/dist/PurchaseRequestsPage-DvFH_tWe.js.map +1 -0
  35. package/dist/PurchasesPage-BCvLvSp4.js +295 -0
  36. package/dist/PurchasesPage-BCvLvSp4.js.map +1 -0
  37. package/dist/SaleCreatePage-DpkQMoTq.js +548 -0
  38. package/dist/SaleCreatePage-DpkQMoTq.js.map +1 -0
  39. package/dist/SalesPage-DUwgkEO-.js +315 -0
  40. package/dist/SalesPage-DUwgkEO-.js.map +1 -0
  41. package/dist/SettingsPage-CusC0jqJ.js +710 -0
  42. package/dist/SettingsPage-CusC0jqJ.js.map +1 -0
  43. package/dist/StorageUnitsPage-BlC2AgrJ.js +469 -0
  44. package/dist/StorageUnitsPage-BlC2AgrJ.js.map +1 -0
  45. package/dist/TransactionsPage-DDaK4VyY.js +714 -0
  46. package/dist/TransactionsPage-DDaK4VyY.js.map +1 -0
  47. package/dist/TransferCreatePage-BxudLfhS.js +363 -0
  48. package/dist/TransferCreatePage-BxudLfhS.js.map +1 -0
  49. package/dist/TransfersPage-zgmt7teZ.js +480 -0
  50. package/dist/TransfersPage-zgmt7teZ.js.map +1 -0
  51. package/dist/VialsPage-CjqPfgpV.js +855 -0
  52. package/dist/VialsPage-CjqPfgpV.js.map +1 -0
  53. package/dist/constants-BrA_hfAI.js +254 -0
  54. package/dist/constants-BrA_hfAI.js.map +1 -0
  55. package/dist/currency-BDDCDgeE.js +169 -0
  56. package/dist/currency-BDDCDgeE.js.map +1 -0
  57. package/dist/format-UOyOu75i.js +52 -0
  58. package/dist/format-UOyOu75i.js.map +1 -0
  59. package/dist/index.js +45 -0
  60. package/dist/index.js.map +1 -0
  61. package/dist/useFieldErrors-hDG8ox_x.js +29 -0
  62. package/dist/useFieldErrors-hDG8ox_x.js.map +1 -0
  63. package/dist/validation-Ba7puFIO.js +109 -0
  64. package/dist/validation-Ba7puFIO.js.map +1 -0
  65. package/package.json +36 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PmGuard-CjJBisaN.js","names":[],"sources":["../src/utils/workspaces.js","../src/services/pmApi.js","../src/utils/countries.js","../src/utils/settingsStore.js","../src/components/PmPageShell.jsx","../src/utils/permissions.js","../src/components/PmNav.jsx","../src/components/PmGuard.jsx"],"sourcesContent":["// Information architecture: the module is split into three \"workspaces\" that\n// match real-world roles in a clinic / store.\n//\n// Catalog — master-data setup (configured occasionally by an admin)\n// Operations — daily floor work (stock, sales, vials, payments)\n// Ledger — read-only audit trail (every stock + money movement)\n//\n// Each workspace has its own accent hue so the operator knows which\n// \"section\" of the tool they're in without explicit labels everywhere.\n// Dashboard sits outside any workspace — it's the landing page.\n\nimport SpaceDashboardRoundedIcon from '@mui/icons-material/SpaceDashboardRounded';\nimport SettingsRoundedIcon from '@mui/icons-material/SettingsRounded';\nimport LayersRoundedIcon from '@mui/icons-material/LayersRounded';\nimport CategoryRoundedIcon from '@mui/icons-material/CategoryRounded';\nimport SellRoundedIcon from '@mui/icons-material/SellRounded';\nimport Inventory2RoundedIcon from '@mui/icons-material/Inventory2Rounded';\nimport WarehouseRoundedIcon from '@mui/icons-material/WarehouseRounded';\nimport LocalShippingRoundedIcon from '@mui/icons-material/LocalShippingRounded';\nimport WidgetsRoundedIcon from '@mui/icons-material/WidgetsRounded';\nimport ShoppingCartRoundedIcon from '@mui/icons-material/ShoppingCartRounded';\nimport FactCheckRoundedIcon from '@mui/icons-material/FactCheckRounded';\nimport MoveDownRoundedIcon from '@mui/icons-material/MoveDownRounded';\nimport SwapHorizRoundedIcon from '@mui/icons-material/SwapHorizRounded';\nimport PointOfSaleRoundedIcon from '@mui/icons-material/PointOfSaleRounded';\nimport VaccinesRoundedIcon from '@mui/icons-material/VaccinesRounded';\nimport PaymentsRoundedIcon from '@mui/icons-material/PaymentsRounded';\nimport ReceiptLongRoundedIcon from '@mui/icons-material/ReceiptLongRounded';\n\n// Permission ids match the backend's api_permission rows. Treated as plain\n// strings here — there's no parallel constants table; the featureJson at\n// runtime is the source of truth for what each user has been granted.\nexport const DASHBOARD = {\n id: 'dashboard',\n label: 'Dashboard',\n path: '/ui/medplat/manage/pm',\n icon: SpaceDashboardRoundedIcon,\n accent: '#6366f1', // indigo — the \"home\" accent\n accentDark: '#4338ca',\n permissionId: 'view.manage.productManagement',\n};\n\n// Settings sits outside the three workspaces — administrative, rarely used,\n// available as its own pill on the nav row alongside Dashboard.\nexport const SETTINGS = {\n id: 'settings',\n label: 'Settings',\n path: '/ui/medplat/manage/pm/settings',\n icon: SettingsRoundedIcon,\n accent: '#64748b', // slate — quiet, non-competing\n accentDark: '#334155',\n permissionId: 'view.manage.productManagement.settings',\n};\n\nexport const WORKSPACES = [\n {\n id: 'catalog',\n label: 'Catalog',\n description: 'Define what you sell and where you keep it. Master data — configured once, used everywhere.',\n icon: LayersRoundedIcon,\n accent: '#8b5cf6', // violet\n accentDark: '#6d28d9',\n accentSoft: '#ede9fe',\n items: [\n { id: 'categories', label: 'Categories', path: '/ui/medplat/manage/pm/categories', icon: CategoryRoundedIcon, permissionId: 'view.manage.productManagement.category' },\n { id: 'brands', label: 'Brands', path: '/ui/medplat/manage/pm/brands', icon: SellRoundedIcon, permissionId: 'view.manage.productManagement.brand' },\n { id: 'products', label: 'Products', path: '/ui/medplat/manage/pm/products', icon: Inventory2RoundedIcon, permissionId: 'view.manage.productManagement.product' },\n { id: 'storage', label: 'Storage Units', path: '/ui/medplat/manage/pm/storage-units', icon: WarehouseRoundedIcon, permissionId: 'view.manage.productManagement.storageUnit' },\n ],\n },\n {\n id: 'operations',\n label: 'Operations',\n description: 'Run the day — receive stock, sell to customers, administer vaccines, collect payments.',\n icon: LocalShippingRoundedIcon,\n accent: '#10b981', // emerald\n accentDark: '#047857',\n accentSoft: '#d1fae5',\n items: [\n // Purchase tabs are mutually exclusive based on the deployment-level\n // requirePurchaseConfirmation setting:\n // confirmation ON → \"Purchase Requests\" page with My Requests +\n // Pending tabs (per-tab perm-gated). An approver\n // with only the approve perm sees just Pending.\n // confirmation OFF → \"Purchases\" page with the direct-purchase list.\n // Both surface under either view.purchase or approve.purchase — the\n // approver-only role still gets the nav entry to reach their queue.\n { id: 'purchase-requests', label: 'Purchase Requests', path: '/ui/medplat/manage/pm/purchase-requests', icon: FactCheckRoundedIcon,\n anyOfPermissionIds: ['view.manage.productManagement.purchase', 'approve.manage.productManagement.purchase'],\n purchaseApprovalGroup: true },\n { id: 'purchases', label: 'Purchases', path: '/ui/medplat/manage/pm/purchases', icon: ShoppingCartRoundedIcon,\n permissionId: 'view.manage.productManagement.purchase', hiddenWhenConfirmationOn: true },\n { id: 'inventory', label: 'Inventory', path: '/ui/medplat/manage/pm/inventory', icon: WidgetsRoundedIcon, permissionId: 'view.manage.productManagement.inventory' },\n // Pickups — user checks out facility stock onto personal inventory and\n // hands it back later. Wastage gets recorded at return if there's a gap.\n { id: 'pickups', label: 'Pickups', path: '/ui/medplat/manage/pm/pickups', icon: MoveDownRoundedIcon, permissionId: 'view.manage.productManagement.pickup' },\n // Transfers — two-step facility ↔ facility movement (sender ships,\n // receiver confirms). Permission-gated so deployments that don't use\n // transfers can leave the menu out by withholding the perm.\n { id: 'transfers', label: 'Transfers', path: '/ui/medplat/manage/pm/transfers', icon: SwapHorizRoundedIcon, permissionId: 'view.manage.productManagement.transfer' },\n // Sales + Payments items also AND with settings.manageSales; PmNav and\n // DashboardPage hide them when the deployment isn't running sales.\n { id: 'sales', label: 'Sales', path: '/ui/medplat/manage/pm/sales', icon: PointOfSaleRoundedIcon, permissionId: 'view.manage.productManagement.sale', salesGroup: true },\n { id: 'vials', label: 'Vial', path: '/ui/medplat/manage/pm/vials', icon: VaccinesRoundedIcon, permissionId: 'view.manage.productManagement.vial' },\n { id: 'payments', label: 'Payments', path: '/ui/medplat/manage/pm/payments', icon: PaymentsRoundedIcon, permissionId: 'view.manage.productManagement.payment', salesGroup: true },\n ],\n },\n {\n id: 'ledger',\n label: 'Ledger',\n description: 'Every stock and money movement, append-only, with full lot / volume / monetary detail.',\n icon: ReceiptLongRoundedIcon,\n accent: '#f59e0b', // amber\n accentDark: '#b45309',\n accentSoft: '#fef3c7',\n items: [\n { id: 'transactions', label: 'Transactions', path: '/ui/medplat/manage/pm/transactions', icon: ReceiptLongRoundedIcon, permissionId: 'view.manage.productManagement.ledger' },\n ],\n },\n];\n\n/**\n * Filter the workspace tree against (a) the current operator's PM permission\n * set and (b) the manageSales settings toggle. An item is visible iff its\n * permissionId is granted AND (manageSales is on OR it isn't in the sales\n * group). A workspace tab survives iff at least one of its items survives.\n *\n * Both PmNav and DashboardPage consume this so the two stay in lock-step.\n */\nexport function getVisibleWorkspaces(perms, settings) {\n const manageSales = settings?.manageSales !== false;\n const requirePurchaseConfirmation = settings?.requirePurchaseConfirmation === true;\n return WORKSPACES\n .map((ws) => ({\n ...ws,\n items: ws.items.filter((it) => {\n // Items can declare either a single `permissionId` or\n // `anyOfPermissionIds` for the \"user needs any of these perms\" case\n // (used by the Purchase Requests entry — visible to both viewers\n // and approvers).\n const hasPerm = it.anyOfPermissionIds\n ? !!perms?.hasAny?.(it.anyOfPermissionIds)\n : !!perms?.has?.(it.permissionId);\n return hasPerm\n && (manageSales || !it.salesGroup)\n && (requirePurchaseConfirmation || !it.purchaseApprovalGroup)\n && (!requirePurchaseConfirmation || !it.hiddenWhenConfirmationOn);\n }),\n }))\n .filter((ws) => ws.items.length > 0);\n}\n\n// Locate the workspace that owns a given pathname. The Dashboard route is\n// intentionally not in any workspace; we surface it via a dedicated pill.\nexport function findWorkspaceForPath(pathname) {\n if (!pathname) return null;\n for (const ws of WORKSPACES) {\n if (ws.items.some((it) => pathname.startsWith(it.path))) return ws;\n }\n return null;\n}\n\nexport function findItemForPath(pathname) {\n if (!pathname) return null;\n for (const ws of WORKSPACES) {\n const hit = ws.items.find((it) => pathname.startsWith(it.path));\n if (hit) return { workspace: ws, item: hit };\n }\n return null;\n}\n","import { api } from \"@/common/interceptors/AxiosInterceptor\";\nimport { execute } from \"@/common/services/QueryBuilder.js\";\n\nconst BASE = \"/pm\";\n\n// ---------- Module settings (subject mappings + currency) ----------\nexport async function getSettings() {\n const response = await api.get(`${BASE}/settings`);\n return response.data;\n}\n\nexport async function upsertSettings(payload) {\n const response = await api.put(`${BASE}/settings`, payload);\n return response.data;\n}\n\nexport async function listPublicTables() {\n const response = await api.get(`${BASE}/settings/tables`);\n return response.data ?? [];\n}\n\nexport async function listUuidColumns(tableName) {\n const response = await api.get(`${BASE}/settings/tables/${encodeURIComponent(tableName)}/uuid-columns`);\n return response.data ?? [];\n}\n\nexport async function listTextColumns(tableName) {\n const response = await api.get(`${BASE}/settings/tables/${encodeURIComponent(tableName)}/text-columns`);\n return response.data ?? [];\n}\n\nexport async function listDateColumns(tableName) {\n const response = await api.get(`${BASE}/settings/tables/${encodeURIComponent(tableName)}/date-columns`);\n return response.data ?? [];\n}\n\n// ---------- Reference data (from medplat shared query master) ----------\n// Returns rows from medplat_immunization_master via the FETCH_IMMUNISATION_MASTER query.\n// Each row carries id, vaccine_name, vaccine_code, etc. We expose only what the\n// product-management UI needs.\nexport async function getImmunizationMaster() {\n const response = await execute(\n { code: \"FETCH_IMMUNISATION_MASTER\", parameters: {} },\n { showLoader: false }\n );\n const rows = response?.data?.result ?? [];\n return rows.map((row) => ({\n id: row.id,\n vaccineCode: row.vaccine_code,\n vaccineName: row.vaccine_name,\n }));\n}\n\n// ---------- Categories ----------\nexport async function getCategories(lastModifiedDate) {\n const response = await api.get(`${BASE}/categories`, {\n params: lastModifiedDate ? { lastModifiedDate } : {},\n });\n return response.data ?? [];\n}\n\nexport async function upsertCategory(payload) {\n const response = await api.post(`${BASE}/categories`, payload);\n return response.data;\n}\n\n// ---------- Brands ----------\nexport async function getBrands(lastModifiedDate) {\n const response = await api.get(`${BASE}/brands`, {\n params: lastModifiedDate ? { lastModifiedDate } : {},\n });\n return response.data ?? [];\n}\n\nexport async function upsertBrand(payload) {\n const response = await api.post(`${BASE}/brands`, payload);\n return response.data;\n}\n\n// ---------- Products ----------\nexport async function getProducts(lastModifiedDate) {\n const response = await api.get(`${BASE}/products`, {\n params: lastModifiedDate ? { lastModifiedDate } : {},\n });\n return response.data ?? [];\n}\n\nexport async function getProduct(productId) {\n const response = await api.get(`${BASE}/products/${productId}`);\n return response.data;\n}\n\nexport async function upsertProduct(payload) {\n const response = await api.post(`${BASE}/products`, payload);\n return response.data;\n}\n\n// ---------- Storage Units ----------\nexport async function getStorageUnits({ facilityId, activeOnly = false } = {}) {\n const params = { activeOnly };\n if (facilityId) params.facilityId = facilityId;\n const response = await api.get(`${BASE}/storage-units`, { params });\n return response.data ?? [];\n}\n\nexport async function upsertStorageUnit(payload) {\n const response = await api.post(`${BASE}/storage-units`, payload);\n return response.data;\n}\n\n// ---------- Health facilities ----------\n// Scoped server-side to the current operator's assignments\n// (user_health_infrastructure JOIN health_infrastructure_details). The list\n// is small enough that the picker filters client-side — no q/limit.\nexport async function listFacilities() {\n const response = await api.get(`${BASE}/facilities`);\n return response.data ?? [];\n}\n\n// Bulk-hydrate facility names for a known set of ids. Used by list views\n// that already have saved ownerIds and just need to render display names\n// without pulling the full directory.\nexport async function getFacilitiesByIds(ids) {\n const list = (ids ?? []).filter(Boolean);\n if (list.length === 0) return [];\n const response = await api.get(`${BASE}/facilities/by-ids`, {\n params: { ids: list.join(',') },\n });\n return response.data ?? [];\n}\n\n// ---------- Members ----------\n// Sales/Payments pages receive the memberId via route param, so the API\n// surface is profile-by-id (rich card payload) + bulk-by-ids (display\n// names for list tables). No search endpoint — the picker is upstream.\n\n// Full member profile (identifier, family id, name, dob) for one member.\n// Returns null when the row doesn't exist or the mapping is incomplete.\nexport async function getMemberProfile(memberId) {\n if (!memberId) return null;\n try {\n const response = await api.get(`${BASE}/members/${memberId}`);\n return response.data ?? null;\n } catch (err) {\n if (err?.response?.status === 404) return null;\n throw err;\n }\n}\n\n// Bulk-hydrate display names for a known set of member ids. Used by list\n// views (sales / payments history) that already have memberIds and need\n// names.\nexport async function getMembersByIds(ids) {\n const list = (ids ?? []).filter(Boolean);\n if (list.length === 0) return [];\n const response = await api.get(`${BASE}/members/by-ids`, {\n params: { ids: list.join(',') },\n });\n return response.data ?? [];\n}\n\n// Per-member outstanding dues, aggregated from pm_sale.due_amount on the\n// backend. Returns [{ memberId, totalDue }]; only members with non-zero dues\n// are included.\nexport async function getMemberOutstandingDues() {\n const response = await api.get(`${BASE}/inventory/dues/by-member`);\n return response.data ?? [];\n}\n\n// Full dues details for one member: total, oldestDueDate, lastSaleDate, and\n// the open sales with item-level breakdown. Powers the Collect Payment screen.\nexport async function getMemberDuesDetails(memberId) {\n const response = await api.get(`${BASE}/inventory/dues/by-member/${memberId}`);\n return response.data;\n}\n\n// ---------- Inventory (read) ----------\nexport async function getStockSnapshot(updatedSince) {\n const response = await api.get(`${BASE}/inventory/stock`, {\n params: updatedSince ? { updatedSince } : {},\n });\n return response.data;\n}\n\nexport async function listBatches() {\n const response = await api.get(`${BASE}/inventory/batches`);\n return response.data ?? [];\n}\n\nexport async function getBatch(batchId) {\n const response = await api.get(`${BASE}/inventory/batches/${batchId}`);\n return response.data;\n}\n\nexport async function listOpenVials() {\n const response = await api.get(`${BASE}/inventory/vials/open`);\n return response.data ?? [];\n}\n\nexport async function listVialsForProduct(productId) {\n const response = await api.get(\n `${BASE}/inventory/vials/by-product/${productId}`,\n );\n return response.data ?? [];\n}\n\nexport async function listPurchases(page = 0, size = 25) {\n const response = await api.get(`${BASE}/inventory/purchases`, {\n params: { page, size },\n });\n return response.data ?? [];\n}\n\nexport async function getPurchase(purchaseId) {\n const response = await api.get(`${BASE}/inventory/purchases/${purchaseId}`);\n return response.data;\n}\n\nexport async function listSales(page = 0, size = 25) {\n const response = await api.get(`${BASE}/inventory/sales`, {\n params: { page, size },\n });\n return response.data ?? [];\n}\n\nexport async function getSale(saleId) {\n const response = await api.get(`${BASE}/inventory/sales/${saleId}`);\n return response.data;\n}\n\nexport async function listPayments(page = 0, size = 25) {\n const response = await api.get(`${BASE}/inventory/payments`, {\n params: { page, size },\n });\n return response.data ?? [];\n}\n\nexport async function getPayment(paymentId) {\n const response = await api.get(`${BASE}/inventory/payments/${paymentId}`);\n return response.data;\n}\n\nexport async function listTransactions(page = 0, size = 50) {\n // Back-compat wrapper for places that only need the content array (e.g.\n // the Dashboard). New code should call queryTransactions for the full\n // PageResponse + filter support.\n const response = await api.get(`${BASE}/inventory/transactions`, {\n params: { page, size },\n });\n return response.data?.content ?? [];\n}\n\nexport async function queryTransactions(params = {}) {\n // `params` accepts: page, size, dateFrom, dateTo, types (array → joined),\n // productId, batchId, ownerType, ownerId, search.\n const { types, ...rest } = params;\n const response = await api.get(`${BASE}/inventory/transactions`, {\n params: {\n ...rest,\n // Spring binds repeated query params (types=A&types=B) onto List<String>\n types: Array.isArray(types) ? types : undefined,\n },\n // Repeat the key for each array entry (Spring's default binding).\n paramsSerializer: {\n serialize: (q) => {\n const sp = new URLSearchParams();\n Object.entries(q).forEach(([k, v]) => {\n if (v == null || v === '') return;\n if (Array.isArray(v)) v.forEach((item) => sp.append(k, item));\n else sp.append(k, v);\n });\n return sp.toString();\n },\n },\n });\n return response.data ?? { content: [], totalElements: 0, totalPages: 0, page: 0, size: 50 };\n}\n\nexport async function txnsForBatch(batchId) {\n const response = await api.get(\n `${BASE}/inventory/transactions/by-batch/${batchId}`,\n );\n return response.data ?? [];\n}\n\nexport async function txnsForVial(openVialId) {\n const response = await api.get(\n `${BASE}/inventory/transactions/by-vial/${openVialId}`,\n );\n return response.data ?? [];\n}\n\n// ---------- Inventory (commands) ----------\nexport async function createPurchase(payload) {\n const response = await api.post(`${BASE}/inventory/purchase`, payload);\n return response.data;\n}\n\n// ---------- Stock Transfers (facility → facility, two-step) ----------\nexport async function shipTransfer(payload) {\n const response = await api.post(`${BASE}/inventory/transfer`, payload);\n return response.data;\n}\n\nexport async function confirmTransfer(id, payload) {\n const response = await api.post(`${BASE}/inventory/transfer/${id}/confirm`, payload ?? {});\n return response.data;\n}\n\nexport async function cancelTransfer(id, payload) {\n const response = await api.post(`${BASE}/inventory/transfer/${id}/cancel`, payload ?? {});\n return response.data;\n}\n\nexport async function listTransfers() {\n const response = await api.get(`${BASE}/inventory/transfers`);\n return response.data ?? [];\n}\n\nexport async function getTransfer(id) {\n const response = await api.get(`${BASE}/inventory/transfers/${id}`);\n return response.data;\n}\n\n// ---------- Stock Pickups (user checks out facility stock + returns it) ----------\nexport async function recordPickup(payload) {\n const response = await api.post(`${BASE}/inventory/pickup`, payload);\n return response.data;\n}\n\nexport async function recordPickupReturn(id, payload) {\n const response = await api.post(`${BASE}/inventory/pickup/${id}/return`, payload);\n return response.data;\n}\n\nexport async function recordPickupTopup(id, payload) {\n const response = await api.post(`${BASE}/inventory/pickup/${id}/topup`, payload);\n return response.data;\n}\n\nexport async function cancelPickup(id, payload) {\n const response = await api.post(`${BASE}/inventory/pickup/${id}/cancel`, payload ?? {});\n return response.data;\n}\n\nexport async function listPickups() {\n const response = await api.get(`${BASE}/inventory/pickups`);\n return response.data ?? [];\n}\n\nexport async function listMyOpenPickups() {\n const response = await api.get(`${BASE}/inventory/pickups/mine/open`);\n return response.data ?? [];\n}\n\nexport async function getPickup(id) {\n const response = await api.get(`${BASE}/inventory/pickups/${id}`);\n return response.data;\n}\n\n// ---------- Purchase Requests (approval workflow) ----------\nexport async function submitPurchaseRequest(payload) {\n const response = await api.post(`${BASE}/inventory/purchase-request`, payload);\n return response.data;\n}\n\nexport async function listMyPurchaseRequests() {\n const response = await api.get(`${BASE}/inventory/purchase-requests/mine`);\n return response.data ?? [];\n}\n\nexport async function listPendingPurchaseRequests() {\n const response = await api.get(`${BASE}/inventory/purchase-requests/pending`);\n return response.data ?? [];\n}\n\nexport async function getPurchaseRequest(id) {\n const response = await api.get(`${BASE}/inventory/purchase-requests/${id}`);\n return response.data;\n}\n\nexport async function decidePurchaseRequest(id, payload) {\n const response = await api.post(`${BASE}/inventory/purchase-request/${id}/decision`, payload);\n return response.data;\n}\n\nexport async function cancelPurchaseRequest(id) {\n const response = await api.post(`${BASE}/inventory/purchase-request/${id}/cancel`);\n return response.data;\n}\n\nexport async function createSale(payload) {\n const response = await api.post(`${BASE}/inventory/sale`, payload);\n return response.data;\n}\n\nexport async function createPayment(payload) {\n const response = await api.post(`${BASE}/inventory/payment`, payload);\n return response.data;\n}\n\nexport async function openVial(payload) {\n const response = await api.post(`${BASE}/inventory/vial/open`, payload);\n return response.data;\n}\n\nexport async function administerDose(payload) {\n const response = await api.post(`${BASE}/inventory/vial/administer`, payload);\n return response.data;\n}\n\nexport async function closeVial(payload) {\n const response = await api.post(`${BASE}/inventory/vial/close`, payload);\n return response.data;\n}\n\nexport async function quarantineBatch(payload) {\n const response = await api.post(\n `${BASE}/inventory/batch/quarantine`,\n payload,\n );\n return response.data;\n}\n\nexport async function unquarantineBatch(payload) {\n const response = await api.post(\n `${BASE}/inventory/batch/unquarantine`,\n payload,\n );\n return response.data;\n}\n","// Country master list. Each entry carries everything the module needs derived\n// from the picked deployment country: ISO code, display name, currency it\n// uses, and the local phone format (dial code + min/max digits) for the\n// country-aware phone input on Brands.\n//\n// Phone length is the local part — i.e. digits after the dial code. North\n// American countries share +1 but each is on the 10-digit NANP plan.\n\nexport const COUNTRIES = [\n { code: 'IN', name: 'India', currencyCode: 'INR', currencySymbol: '₹', phoneCode: '+91', phoneMin: 10, phoneMax: 10 },\n { code: 'JM', name: 'Jamaica', currencyCode: 'JMD', currencySymbol: 'J$', phoneCode: '+1', phoneMin: 10, phoneMax: 10 },\n { code: 'US', name: 'United States', currencyCode: 'USD', currencySymbol: '$', phoneCode: '+1', phoneMin: 10, phoneMax: 10 },\n { code: 'CA', name: 'Canada', currencyCode: 'CAD', currencySymbol: 'C$', phoneCode: '+1', phoneMin: 10, phoneMax: 10 },\n { code: 'GB', name: 'United Kingdom', currencyCode: 'GBP', currencySymbol: '£', phoneCode: '+44', phoneMin: 10, phoneMax: 10 },\n { code: 'AU', name: 'Australia', currencyCode: 'AUD', currencySymbol: 'A$', phoneCode: '+61', phoneMin: 9, phoneMax: 9 },\n { code: 'NZ', name: 'New Zealand', currencyCode: 'NZD', currencySymbol: 'NZ$', phoneCode: '+64', phoneMin: 8, phoneMax: 10 },\n { code: 'SG', name: 'Singapore', currencyCode: 'SGD', currencySymbol: 'S$', phoneCode: '+65', phoneMin: 8, phoneMax: 8 },\n { code: 'HK', name: 'Hong Kong', currencyCode: 'HKD', currencySymbol: 'HK$', phoneCode: '+852', phoneMin: 8, phoneMax: 8 },\n { code: 'MY', name: 'Malaysia', currencyCode: 'MYR', currencySymbol: 'RM', phoneCode: '+60', phoneMin: 9, phoneMax: 10 },\n { code: 'TH', name: 'Thailand', currencyCode: 'THB', currencySymbol: '฿', phoneCode: '+66', phoneMin: 9, phoneMax: 9 },\n { code: 'VN', name: 'Vietnam', currencyCode: 'VND', currencySymbol: '₫', phoneCode: '+84', phoneMin: 9, phoneMax: 10 },\n { code: 'PH', name: 'Philippines', currencyCode: 'PHP', currencySymbol: '₱', phoneCode: '+63', phoneMin: 10, phoneMax: 10 },\n { code: 'ID', name: 'Indonesia', currencyCode: 'IDR', currencySymbol: 'Rp', phoneCode: '+62', phoneMin: 9, phoneMax: 12 },\n { code: 'CN', name: 'China', currencyCode: 'CNY', currencySymbol: '¥', phoneCode: '+86', phoneMin: 11, phoneMax: 11 },\n { code: 'JP', name: 'Japan', currencyCode: 'JPY', currencySymbol: '¥', phoneCode: '+81', phoneMin: 10, phoneMax: 11 },\n { code: 'KR', name: 'South Korea', currencyCode: 'KRW', currencySymbol: '₩', phoneCode: '+82', phoneMin: 9, phoneMax: 11 },\n { code: 'PK', name: 'Pakistan', currencyCode: 'PKR', currencySymbol: '₨', phoneCode: '+92', phoneMin: 10, phoneMax: 10 },\n { code: 'BD', name: 'Bangladesh', currencyCode: 'BDT', currencySymbol: '৳', phoneCode: '+880', phoneMin: 10, phoneMax: 10 },\n { code: 'LK', name: 'Sri Lanka', currencyCode: 'LKR', currencySymbol: '₨', phoneCode: '+94', phoneMin: 9, phoneMax: 9 },\n { code: 'NP', name: 'Nepal', currencyCode: 'NPR', currencySymbol: '₨', phoneCode: '+977', phoneMin: 10, phoneMax: 10 },\n { code: 'AE', name: 'United Arab Emirates', currencyCode: 'AED', currencySymbol: 'د.إ', phoneCode: '+971', phoneMin: 9, phoneMax: 9 },\n { code: 'SA', name: 'Saudi Arabia', currencyCode: 'SAR', currencySymbol: '﷼', phoneCode: '+966', phoneMin: 9, phoneMax: 9 },\n { code: 'EG', name: 'Egypt', currencyCode: 'EGP', currencySymbol: 'E£', phoneCode: '+20', phoneMin: 10, phoneMax: 10 },\n { code: 'NG', name: 'Nigeria', currencyCode: 'NGN', currencySymbol: '₦', phoneCode: '+234', phoneMin: 10, phoneMax: 10 },\n { code: 'KE', name: 'Kenya', currencyCode: 'KES', currencySymbol: 'KSh', phoneCode: '+254', phoneMin: 9, phoneMax: 10 },\n { code: 'GH', name: 'Ghana', currencyCode: 'GHS', currencySymbol: 'GH₵', phoneCode: '+233', phoneMin: 9, phoneMax: 10 },\n { code: 'ZA', name: 'South Africa', currencyCode: 'ZAR', currencySymbol: 'R', phoneCode: '+27', phoneMin: 9, phoneMax: 9 },\n { code: 'BR', name: 'Brazil', currencyCode: 'BRL', currencySymbol: 'R$', phoneCode: '+55', phoneMin: 10, phoneMax: 11 },\n { code: 'MX', name: 'Mexico', currencyCode: 'MXN', currencySymbol: 'MX$', phoneCode: '+52', phoneMin: 10, phoneMax: 10 },\n { code: 'AR', name: 'Argentina', currencyCode: 'ARS', currencySymbol: '$', phoneCode: '+54', phoneMin: 10, phoneMax: 11 },\n { code: 'DE', name: 'Germany', currencyCode: 'EUR', currencySymbol: '€', phoneCode: '+49', phoneMin: 10, phoneMax: 11 },\n { code: 'FR', name: 'France', currencyCode: 'EUR', currencySymbol: '€', phoneCode: '+33', phoneMin: 9, phoneMax: 9 },\n { code: 'IT', name: 'Italy', currencyCode: 'EUR', currencySymbol: '€', phoneCode: '+39', phoneMin: 9, phoneMax: 10 },\n { code: 'ES', name: 'Spain', currencyCode: 'EUR', currencySymbol: '€', phoneCode: '+34', phoneMin: 9, phoneMax: 9 },\n { code: 'NL', name: 'Netherlands', currencyCode: 'EUR', currencySymbol: '€', phoneCode: '+31', phoneMin: 9, phoneMax: 9 },\n { code: 'CH', name: 'Switzerland', currencyCode: 'CHF', currencySymbol: 'Fr', phoneCode: '+41', phoneMin: 9, phoneMax: 9 },\n { code: 'TR', name: 'Turkey', currencyCode: 'TRY', currencySymbol: '₺', phoneCode: '+90', phoneMin: 10, phoneMax: 10 },\n { code: 'RU', name: 'Russia', currencyCode: 'RUB', currencySymbol: '₽', phoneCode: '+7', phoneMin: 10, phoneMax: 10 },\n];\n\nconst BY_CODE = Object.fromEntries(COUNTRIES.map((c) => [c.code, c]));\n\nexport function findCountry(code) {\n if (!code) return null;\n return BY_CODE[code] ?? null;\n}\n\n/** Symbol for the country's currency, with sensible fallback. */\nexport function currencySymbolForCountry(countryCode) {\n return findCountry(countryCode)?.currencySymbol ?? '₹';\n}\n\n/** ISO currency code for a country, useful for downstream code that already speaks \"currency\". */\nexport function currencyCodeForCountry(countryCode) {\n return findCountry(countryCode)?.currencyCode ?? 'INR';\n}\n\n/**\n * Validate a phone number against a country's local format. Pure digits only;\n * the dial code is shown as adornment in the UI and not part of the input value.\n * Returns an error string or empty string when the value is acceptable.\n */\nexport function validatePhoneForCountry(value, country) {\n if (!value) return '';\n const digits = String(value).replace(/\\D/g, '');\n if (!country) {\n if (digits.length < 6 || digits.length > 15) return 'Phone number looks invalid.';\n return '';\n }\n if (digits.length < country.phoneMin || digits.length > country.phoneMax) {\n const range = country.phoneMin === country.phoneMax\n ? `${country.phoneMin} digits`\n : `${country.phoneMin}–${country.phoneMax} digits`;\n return `Phone must be ${range} for ${country.name}.`;\n }\n return '';\n}\n","import { useEffect, useState } from 'react';\nimport { getSettings } from '@pm/services/pmApi';\nimport { currencyCodeForCountry } from './countries';\n\n// Module-scoped cache + tiny subscriber model so settings-aware components\n// (PmMoney, PmNav, PurchaseCreatePage, …) can read the same snapshot without\n// re-fetching per page.\n//\n// Lifecycle:\n// - first usePmSettings() call from anywhere triggers the fetch\n// - subsequent renders read from the cache synchronously\n// - SettingsPage calls updateLocalPmSettings() after saving so the change\n// propagates without a round-trip\n\nconst DEFAULT_SETTINGS = {\n memberTableName: null,\n memberIdColumn: null,\n memberIdentifierColumn: null,\n memberFamilyIdColumn: null,\n memberNameColumn: null,\n memberDobColumn: null,\n countryCode: 'IN',\n // Derived from countryCode at hydrate time so PmMoney etc. can keep\n // reading a stable currencyCode field without knowing about countries.\n currencyCode: 'INR',\n managePurchaseAmounts: true,\n manageSales: true,\n allowPersonalPurchase: true,\n requirePurchaseConfirmation: false,\n};\n\nlet _settings = null;\nlet _pending = null;\nconst _listeners = new Set();\n\nfunction hydrate(raw) {\n const base = { ...DEFAULT_SETTINGS, ...(raw ?? {}) };\n // Derive currency from country every load — country is the source of truth.\n base.currencyCode = currencyCodeForCountry(base.countryCode);\n base.managePurchaseAmounts = base.managePurchaseAmounts !== false; // default true\n base.manageSales = base.manageSales !== false; // default true\n base.allowPersonalPurchase = base.allowPersonalPurchase !== false; // default true\n base.requirePurchaseConfirmation = base.requirePurchaseConfirmation === true; // default false\n return base;\n}\n\nfunction notify() {\n _listeners.forEach((cb) => cb(_settings));\n}\n\nexport async function loadPmSettings(force = false) {\n if (!force && _settings) return _settings;\n if (!force && _pending) return _pending;\n _pending = getSettings()\n .then((s) => {\n _settings = hydrate(s);\n _pending = null;\n notify();\n return _settings;\n })\n .catch((err) => {\n _pending = null;\n if (!_settings) {\n _settings = hydrate(null);\n notify();\n }\n throw err;\n });\n return _pending;\n}\n\nexport function updateLocalPmSettings(next) {\n _settings = hydrate(next);\n notify();\n}\n\nexport function getCachedPmSettings() {\n return _settings;\n}\n\nexport function usePmSettings() {\n const [snap, setSnap] = useState(_settings ?? hydrate(null));\n useEffect(() => {\n _listeners.add(setSnap);\n if (!_settings && !_pending) {\n void loadPmSettings().catch(() => {});\n } else if (_settings) {\n setSnap(_settings);\n }\n return () => {\n _listeners.delete(setSnap);\n };\n }, []);\n return snap;\n}\n","import PropTypes from 'prop-types';\nimport { useEffect } from 'react';\nimport { useLocation } from 'react-router-dom';\nimport { alpha, useTheme } from '@mui/material/styles';\nimport { Box, Chip, Fade, Stack, Typography } from '@mui/material';\nimport { DASHBOARD, SETTINGS, findItemForPath } from '@pm/utils/workspaces';\nimport { loadPmSettings } from '@pm/utils/settingsStore';\n\n// Page shell shared by every PM screen. Reads the active workspace from the\n// route and tints the header to match — peripheral cue for \"what section of\n// the tool am I in\". Body content fades in to soften route changes.\nexport default function PmPageShell({ title, subtitle, chips = [], actions, children }) {\n const theme = useTheme();\n const { pathname } = useLocation();\n\n // Kick off the settings preload from the shared shell, so every PM page has\n // the currency cached by the time PmMoney renders. usePmSettings inside the\n // money cell will also trigger this; calling here just shaves one render.\n useEffect(() => { void loadPmSettings().catch(() => {}); }, []);\n\n const onDashboard = pathname.startsWith(DASHBOARD.path);\n const onSettings = pathname.startsWith(SETTINGS.path);\n const hit = findItemForPath(pathname);\n const workspace = hit?.workspace;\n\n const accent = onDashboard\n ? DASHBOARD.accent\n : onSettings\n ? SETTINGS.accent\n : (workspace?.accent ?? theme.palette.primary.main);\n const accentDark = onDashboard\n ? DASHBOARD.accentDark\n : onSettings\n ? SETTINGS.accentDark\n : (workspace?.accentDark ?? theme.palette.primary.dark);\n\n return (\n <Box sx={{ position: 'relative', px: { xs: 1, md: 2 }, py: { xs: 1, md: 2 } }}>\n {/* Soft accent glow tied to the active workspace. */}\n <Box sx={{ position: 'absolute', inset: 0, pointerEvents: 'none', overflow: 'hidden' }}>\n <Box\n sx={{\n position: 'absolute',\n top: -60,\n right: -40,\n width: 260,\n height: 260,\n borderRadius: '50%',\n background: `radial-gradient(circle, ${alpha(accent, 0.18)} 0%, transparent 70%)`,\n filter: 'blur(2px)',\n }}\n />\n <Box\n sx={{\n position: 'absolute',\n top: 40,\n left: -50,\n width: 200,\n height: 200,\n borderRadius: '50%',\n background: `radial-gradient(circle, ${alpha(theme.palette.info.main, 0.08)} 0%, transparent 72%)`,\n filter: 'blur(2px)',\n }}\n />\n </Box>\n\n {/* Header card — workspace badge + title + actions. */}\n <Box\n sx={{\n position: 'relative',\n zIndex: 1,\n mb: 2,\n p: { xs: 2, md: 2.5 },\n borderRadius: 4,\n border: `1px solid ${alpha(accent, 0.18)}`,\n background: `linear-gradient(135deg, ${alpha(theme.palette.background.paper, 0.98)} 0%, ${alpha(accent, 0.07)} 100%)`,\n boxShadow: `0 18px 44px ${alpha(theme.palette.common.black, 0.06)}`,\n overflow: 'hidden',\n // Thin colored bar at the left edge — instantly tells you which workspace.\n '&::before': {\n content: '\"\"',\n position: 'absolute',\n left: 0,\n top: 0,\n bottom: 0,\n width: 4,\n background: `linear-gradient(180deg, ${accent} 0%, ${accentDark} 100%)`,\n },\n }}\n >\n <Stack\n direction={{ xs: 'column', md: 'row' }}\n justifyContent=\"space-between\"\n alignItems={{ xs: 'flex-start', md: 'center' }}\n spacing={1.5}\n >\n <Box sx={{ minWidth: 0 }}>\n {workspace || onDashboard || onSettings ? (\n <Stack direction=\"row\" alignItems=\"center\" spacing={0.75} sx={{ mb: 0.75 }}>\n {(() => {\n const Icon = onDashboard\n ? DASHBOARD.icon\n : onSettings\n ? SETTINGS.icon\n : workspace.icon;\n return Icon ? (\n <Icon sx={{ fontSize: 16, color: accentDark }} />\n ) : null;\n })()}\n <Typography\n variant=\"overline\"\n sx={{\n color: accentDark,\n fontWeight: 800,\n letterSpacing: 1.1,\n lineHeight: 1,\n }}\n >\n {onDashboard ? 'Overview' : onSettings ? 'Configuration' : workspace.label}\n </Typography>\n {hit?.item ? (\n <>\n <Box sx={{ width: 4, height: 4, borderRadius: '50%', bgcolor: alpha(accent, 0.4), mx: 0.5 }} />\n <Typography variant=\"overline\" sx={{ color: theme.palette.text.secondary, fontWeight: 700, letterSpacing: 0.8 }}>\n {hit.item.label}\n </Typography>\n </>\n ) : null}\n </Stack>\n ) : null}\n\n <Typography variant=\"h5\" sx={{ fontWeight: 800, color: theme.palette.text.primary, lineHeight: 1.2 }}>\n {title}\n </Typography>\n {subtitle ? (\n <Typography variant=\"body2\" sx={{ mt: 0.75, maxWidth: 900, color: theme.palette.text.secondary }}>\n {subtitle}\n </Typography>\n ) : null}\n {chips?.length ? (\n <Stack direction=\"row\" spacing={1} useFlexGap flexWrap=\"wrap\" sx={{ mt: 1.5 }}>\n {chips.map((chip) => (\n <Chip\n key={chip}\n label={chip}\n size=\"small\"\n sx={{\n borderRadius: 2,\n backgroundColor: alpha(accent, 0.1),\n color: accentDark,\n fontWeight: 700,\n border: `1px solid ${alpha(accent, 0.2)}`,\n }}\n />\n ))}\n </Stack>\n ) : null}\n </Box>\n {actions ? <Box>{actions}</Box> : null}\n </Stack>\n </Box>\n\n {/* Body — fade in to soften route transitions. Keyed on pathname so each\n navigation triggers a fresh animation rather than reusing prior fade. */}\n <Fade in key={pathname} timeout={360}>\n <Box sx={{ position: 'relative', zIndex: 1 }}>{children}</Box>\n </Fade>\n </Box>\n );\n}\n\nPmPageShell.propTypes = {\n title: PropTypes.node,\n subtitle: PropTypes.node,\n chips: PropTypes.arrayOf(PropTypes.string),\n actions: PropTypes.node,\n children: PropTypes.node,\n};\n","import { useEffect, useMemo } from 'react';\nimport { useSelector } from 'react-redux';\n\n// PM module's navigation_state in menu_config. The backend attaches a\n// featureJson onto this node whose keys are the permission_ids the current\n// user has been granted under the module — exactly the same featureJson\n// MedplatForm reads off any other menu node. Nothing about which\n// permissions exist is baked into the frontend; the source of truth is\n// whatever the backend serialised onto this node.\nconst PM_MENU_KEY = 'techo.manage.pm';\n\n/**\n * Hook returning the PM permission set for the current user.\n *\n * Reads `linearMenuItems['techo.manage.pm'].featureJson` from the\n * Authenticate slice — Protected.jsx populates that at login via\n * /api/login/menuV2. The featureJson is a JSON-string-or-object whose keys\n * are permission_ids and whose values are true/false.\n *\n * Returns:\n * has(permId) — true iff the user has been granted that permission_id\n * hasAny(ids[]) — true iff any id in the list is granted\n *\n * **Default-deny**: when the PM menu node is missing or its featureJson is\n * empty, both helpers return false. There's no dev escape hatch — devs go\n * through the same grant flow as everyone else.\n *\n * **What's actually in featureJson**: only the top-level api_permission\n * rows for menu_id 543 (those with `parent_permission_id = NULL`). The\n * `.child.get.X` / `.child.post.X` rows govern API-URL access via the\n * backend's GlobalMenuPermissionFilter but they do NOT surface to the\n * frontend. So every UI check in PM uses the parent perm\n * (`view.manage.productManagement.<page>`). The backend still 403s any\n * write the user lacks the `.child.post.X` row for — that's the actual\n * write gate. To gate buttons in the UI separately from page-visibility\n * later, mint flat write perms (e.g. `write.manage.productManagement.X`\n * with `parent_permission_id = NULL`).\n */\n/**\n * `useEffect` that only runs when the current user has the permission.\n *\n * <p>PM pages historically declared their load `useEffect` in the outer\n * component above {@code <PmGuard>}. That meant the fetch fired on mount\n * regardless of the user's perm — the guard only hid the UI after the\n * network call already went out. Wrapping the effect with this hook makes\n * the fetch wait for (or skip entirely without) the perm, matching what\n * `PmGuard` does for the rendered tree.\n *\n * @param {string|string[]} perm Permission id required to fire the effect. Array means any-of.\n * @param {() => (void|(()=>void))} fn The effect body — receives no args, may return a cleanup.\n * @param {ReadonlyArray<*>} [deps] Extra deps; the perm gate is added implicitly.\n */\nexport function usePermissionedEffect(perm, fn, deps) {\n const perms = usePmPermissions();\n const allowed = Array.isArray(perm)\n ? perms.hasAny(perm)\n : (!!perm && perms.has(perm));\n // We list `allowed` first so a perm flip re-fires the effect (e.g. a user\n // who gains the perm mid-session lands on the page fully loaded). Caller\n // deps come after — same semantics they'd get from a plain useEffect.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useEffect(() => {\n if (!allowed) return undefined;\n return fn();\n }, [allowed, ...(deps ?? [])]);\n}\n\nexport function usePmPermissions() {\n const linearMenuItems = useSelector((state) => state.Authenticate?.linearMenuItems);\n return useMemo(() => {\n const node = linearMenuItems?.[PM_MENU_KEY];\n let grants = node?.featureJson;\n if (typeof grants === 'string') {\n try { grants = JSON.parse(grants); } catch { grants = {}; }\n }\n const grantSet = grants && typeof grants === 'object' ? grants : {};\n const has = (permId) => !!permId && grantSet[permId] === true;\n const hasAny = (perms) => Array.isArray(perms) && perms.some(has);\n return { has, hasAny };\n }, [linearMenuItems]);\n}\n","import { useMemo } from 'react';\nimport { useLocation, useNavigate } from 'react-router-dom';\nimport { Box, Stack, Tab, Tabs, Typography } from '@mui/material';\nimport { alpha, useTheme } from '@mui/material/styles';\nimport { DASHBOARD, SETTINGS, findWorkspaceForPath, getVisibleWorkspaces } from '@pm/utils/workspaces';\nimport { usePmSettings } from '@pm/utils/settingsStore';\nimport { usePmPermissions } from '@pm/utils/permissions';\n\n// Two-row navigation:\n// Row 1 — workspace pills: Dashboard · Catalog · Operations · Ledger\n// Row 2 — when inside a workspace, the items in that workspace as tabs,\n// accented with the workspace's hue.\n//\n// The active workspace's accent flows into both rows so the user always\n// has a peripheral cue for \"where am I in the tool\".\n//\n// Visibility is filtered by getVisibleWorkspaces() — items that the user\n// lacks permission for OR that the deployment has turned off (e.g. Sales +\n// Payments when manageSales=false) are dropped, and a workspace tab whose\n// items all got dropped disappears too.\nexport default function PmNav() {\n const navigate = useNavigate();\n const location = useLocation();\n const theme = useTheme();\n const settings = usePmSettings();\n const perms = usePmPermissions();\n\n const visibleWorkspaces = useMemo(\n () => getVisibleWorkspaces(perms, settings),\n [perms, settings],\n );\n\n const showDashboardPill = perms.has(DASHBOARD.permissionId);\n const showSettingsPill = perms.has(SETTINGS.permissionId);\n\n const onDashboard = location.pathname.startsWith(DASHBOARD.path);\n const onSettings = location.pathname.startsWith(SETTINGS.path);\n const activeWorkspace = findWorkspaceForPath(location.pathname);\n // visibleWorkspaces is already filtered; if the user landed on a workspace\n // whose items they no longer have access to (e.g. deep link), it won't be\n // here and the row-2 tab strip stays collapsed.\n const visibleActiveWorkspace = activeWorkspace\n ? visibleWorkspaces.find((ws) => ws.id === activeWorkspace.id) ?? null\n : null;\n const accent = onDashboard\n ? DASHBOARD.accent\n : onSettings\n ? SETTINGS.accent\n : (activeWorkspace?.accent ?? theme.palette.primary.main);\n\n const activeItemIndex = visibleActiveWorkspace\n ? visibleActiveWorkspace.items.findIndex((it) => location.pathname.startsWith(it.path))\n : -1;\n\n function pillSx(active, hue) {\n return {\n px: 2,\n py: 0.9,\n borderRadius: 999,\n cursor: 'pointer',\n display: 'inline-flex',\n alignItems: 'center',\n gap: 1,\n fontWeight: 700,\n fontSize: '0.875rem',\n letterSpacing: 0.2,\n transition: 'all 220ms cubic-bezier(0.4, 0, 0.2, 1)',\n color: active ? '#fff' : theme.palette.text.secondary,\n backgroundColor: active ? hue : 'transparent',\n boxShadow: active ? `0 8px 22px ${alpha(hue, 0.32)}` : 'none',\n '&:hover': {\n color: active ? '#fff' : hue,\n backgroundColor: active ? hue : alpha(hue, 0.08),\n transform: active ? 'none' : 'translateY(-1px)',\n },\n };\n }\n\n function renderPill({ id, label, icon: Icon, active, onClick, hue }) {\n return (\n <Box key={id} role=\"button\" onClick={onClick} sx={pillSx(active, hue)}>\n {Icon ? <Icon sx={{ fontSize: 18 }} /> : null}\n {label}\n </Box>\n );\n }\n\n return (\n <Box sx={{ mb: 2 }}>\n {/* Row 1 — workspace pills */}\n <Box\n sx={{\n position: 'relative',\n borderRadius: 4,\n p: 1,\n background: `linear-gradient(135deg, ${alpha(theme.palette.background.paper, 0.96)} 0%, ${alpha(accent, 0.06)} 100%)`,\n border: `1px solid ${alpha(theme.palette.divider, 0.7)}`,\n boxShadow: `0 10px 28px ${alpha(theme.palette.common.black, 0.04)}`,\n }}\n >\n <Stack direction=\"row\" alignItems=\"center\" spacing={0.75} flexWrap=\"wrap\" useFlexGap>\n {showDashboardPill ? renderPill({\n id: DASHBOARD.id,\n label: DASHBOARD.label,\n icon: DASHBOARD.icon,\n active: onDashboard,\n hue: DASHBOARD.accent,\n onClick: () => navigate(DASHBOARD.path),\n }) : null}\n\n {showDashboardPill && visibleWorkspaces.length > 0 ? (\n <Box sx={{ width: 1, height: 22, mx: 0.5, bgcolor: 'divider', opacity: 0.7 }} />\n ) : null}\n\n {visibleWorkspaces.map((ws) => renderPill({\n id: ws.id,\n label: ws.label,\n icon: ws.icon,\n active: activeWorkspace?.id === ws.id,\n hue: ws.accent,\n // Tapping a workspace jumps to its first item — a deterministic\n // landing, no submenu to fight with.\n onClick: () => ws.items[0] && navigate(ws.items[0].path),\n }))}\n\n {/* Settings sits to the right, separated from the workspaces — it's\n configuration, not a workspace, and shouldn't compete visually. */}\n <Box sx={{ flexGrow: 1 }} />\n {showSettingsPill ? renderPill({\n id: SETTINGS.id,\n label: SETTINGS.label,\n icon: SETTINGS.icon,\n active: onSettings,\n hue: SETTINGS.accent,\n onClick: () => navigate(SETTINGS.path),\n }) : null}\n </Stack>\n </Box>\n\n {/* Row 2 — items within the active workspace */}\n {visibleActiveWorkspace && visibleActiveWorkspace.items.length > 0 ? (\n <Box\n sx={{\n mt: 1,\n borderRadius: 3,\n px: 1,\n bgcolor: alpha(visibleActiveWorkspace.accent, 0.04),\n border: `1px solid ${alpha(visibleActiveWorkspace.accent, 0.12)}`,\n }}\n >\n <Tabs\n value={activeItemIndex === -1 ? false : activeItemIndex}\n onChange={(_, idx) => navigate(visibleActiveWorkspace.items[idx].path)}\n variant=\"scrollable\"\n scrollButtons=\"auto\"\n slotProps={{\n indicator: { sx: { backgroundColor: visibleActiveWorkspace.accent, height: 3, borderRadius: 2 } },\n }}\n sx={{\n minHeight: 44,\n '& .MuiTab-root': {\n minHeight: 44,\n fontWeight: 700,\n textTransform: 'none',\n fontSize: '0.85rem',\n color: theme.palette.text.secondary,\n transition: 'color 180ms ease',\n '&:hover': { color: visibleActiveWorkspace.accentDark },\n '&.Mui-selected': { color: visibleActiveWorkspace.accentDark },\n },\n }}\n >\n {visibleActiveWorkspace.items.map((it) => {\n const Icon = it.icon;\n return (\n <Tab\n key={it.id}\n iconPosition=\"start\"\n icon={Icon ? <Icon sx={{ fontSize: 18 }} /> : undefined}\n label={<Typography component=\"span\" sx={{ fontWeight: 700 }}>{it.label}</Typography>}\n />\n );\n })}\n </Tabs>\n </Box>\n ) : null}\n </Box>\n );\n}\n","import { useNavigate } from 'react-router-dom';\nimport { useSelector } from 'react-redux';\nimport { Alert, Box, Button, LinearProgress, Stack, Typography } from '@mui/material';\nimport LockOutlinedIcon from '@mui/icons-material/LockOutlined';\nimport { usePmPermissions } from '@pm/utils/permissions';\n\n/**\n * Page-level guard. Wrap a PM page in `<PmGuard perm=\"...\">…</PmGuard>` and\n * the children only render when the current user has the perm; otherwise\n * the page shows a friendly \"no access\" panel with a back-to-dashboard\n * button.\n *\n * Default-deny: when the featureJson is missing the guard blocks. While the\n * menu tree hasn't loaded yet (first paint right after login) we show a\n * thin loader so the \"no access\" alert doesn't flash.\n */\nexport default function PmGuard({ perm, anyOf, children, title = 'You don’t have access to this page' }) {\n const perms = usePmPermissions();\n const navigate = useNavigate();\n const linearMenuItems = useSelector((state) => state.Authenticate?.linearMenuItems);\n const menuReady = linearMenuItems !== null && linearMenuItems !== undefined;\n if (!menuReady) {\n return (\n <Box sx={{ p: 3 }}>\n <LinearProgress />\n </Box>\n );\n }\n const allowed = anyOf ? perms.hasAny(anyOf) : perms.has(perm);\n if (allowed) return children;\n return (\n <Box sx={{ p: 3 }}>\n <Alert\n severity=\"warning\"\n icon={<LockOutlinedIcon />}\n sx={{ borderRadius: 3, alignItems: 'flex-start' }}\n >\n <Stack spacing={1.25}>\n <Typography sx={{ fontWeight: 800 }}>{title}</Typography>\n <Typography variant=\"body2\" color=\"text.secondary\">\n Your account doesn’t have the required permission to view this\n section of Product Management. Ask an admin to grant it via the\n role / user permission assignment.\n </Typography>\n <Box>\n <Button\n size=\"small\"\n variant=\"contained\"\n onClick={() => navigate('/ui/medplat/manage/pm')}\n >\n Back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AkB,CAAA;KACxD,kBAAC,GAAD;MAAY,SAAQ;MAAQ,OAAM;gBAAiB;KAIvC,CAAA;KACZ,kBAAC,GAAD,EAAA,UACE,kBAAC,GAAD;MACE,MAAK;MACL,SAAQ;MACR,eAAe,EAAS,uBAAuB;gBAChD;KAEO,CAAA,EACL,CAAA;IACA;;EACF,CAAA;CACJ,CAAA;AAET"}
@@ -0,0 +1,302 @@
1
+ import { c as e } from "./PmGuard-CjJBisaN.js";
2
+ import { t } from "./currency-BDDCDgeE.js";
3
+ import { jsx as n, jsxs as r } from "react/jsx-runtime";
4
+ import { Box as i, Card as a, CardContent as o, Stack as s, Table as c, TableCell as l, TableContainer as u, TableRow as d, Typography as f } from "@mui/material";
5
+ import p from "prop-types";
6
+ import { alpha as m, useTheme as h } from "@mui/material/styles";
7
+ //#region src/components/PmTable.jsx
8
+ function g({ children: e, dense: t = !1, sx: r = {}, ...i }) {
9
+ let a = h();
10
+ return /* @__PURE__ */ n(u, {
11
+ sx: {
12
+ borderRadius: 2.5,
13
+ border: `1px solid ${m(a.palette.divider, .55)}`,
14
+ backgroundColor: a.palette.background.paper,
15
+ overflow: "auto",
16
+ ...r
17
+ },
18
+ children: /* @__PURE__ */ n(c, {
19
+ size: t ? "small" : "medium",
20
+ ...i,
21
+ sx: {
22
+ "& thead .MuiTableRow-root": { background: `linear-gradient(180deg, ${m(a.palette.grey[50], 1)} 0%, ${m(a.palette.grey[100], 1)} 100%)` },
23
+ "& thead .MuiTableCell-root": {
24
+ fontWeight: 800,
25
+ fontSize: "0.7rem",
26
+ textTransform: "uppercase",
27
+ letterSpacing: "0.65px",
28
+ color: a.palette.text.secondary,
29
+ borderBottom: `1px solid ${a.palette.divider}`,
30
+ py: 1.25,
31
+ whiteSpace: "nowrap",
32
+ position: "sticky",
33
+ top: 0,
34
+ zIndex: 1
35
+ },
36
+ "& tbody .MuiTableRow-root": { transition: "background-color 140ms ease" },
37
+ "& tbody .MuiTableRow-root:hover": { backgroundColor: m(a.palette.primary.main, .04) },
38
+ "& tbody .MuiTableCell-root": {
39
+ py: 1.4,
40
+ borderBottom: `1px solid ${m(a.palette.divider, .5)}`,
41
+ verticalAlign: "middle"
42
+ },
43
+ "& tbody .MuiTableRow-root:last-of-type .MuiTableCell-root": { borderBottom: "none" }
44
+ },
45
+ children: e
46
+ })
47
+ });
48
+ }
49
+ g.propTypes = {
50
+ children: p.node,
51
+ dense: p.bool,
52
+ sx: p.object
53
+ };
54
+ function _({ eyebrow: e, title: t, subtitle: c, actions: l, toolbar: u, children: d, sx: p = {} }) {
55
+ return /* @__PURE__ */ n(a, {
56
+ sx: {
57
+ borderRadius: 4,
58
+ border: "1px solid",
59
+ borderColor: "divider",
60
+ boxShadow: "0 12px 32px rgba(15, 23, 42, 0.045)",
61
+ overflow: "hidden",
62
+ ...p
63
+ },
64
+ children: /* @__PURE__ */ r(o, {
65
+ sx: {
66
+ p: 0,
67
+ "&:last-child": { pb: 0 }
68
+ },
69
+ children: [
70
+ t || l ? /* @__PURE__ */ n(i, {
71
+ sx: {
72
+ px: 2.5,
73
+ pt: 2,
74
+ pb: 1.5
75
+ },
76
+ children: /* @__PURE__ */ r(s, {
77
+ direction: {
78
+ xs: "column",
79
+ md: "row"
80
+ },
81
+ justifyContent: "space-between",
82
+ alignItems: {
83
+ xs: "flex-start",
84
+ md: "center"
85
+ },
86
+ spacing: 1.5,
87
+ children: [/* @__PURE__ */ r(i, {
88
+ sx: { minWidth: 0 },
89
+ children: [
90
+ e ? /* @__PURE__ */ n(f, {
91
+ variant: "overline",
92
+ sx: {
93
+ color: "text.secondary",
94
+ fontWeight: 800,
95
+ letterSpacing: 1,
96
+ lineHeight: 1
97
+ },
98
+ children: e
99
+ }) : null,
100
+ t ? /* @__PURE__ */ n(f, {
101
+ variant: "h6",
102
+ sx: {
103
+ fontWeight: 800,
104
+ lineHeight: 1.2
105
+ },
106
+ children: t
107
+ }) : null,
108
+ c ? /* @__PURE__ */ n(f, {
109
+ variant: "caption",
110
+ color: "text.secondary",
111
+ children: c
112
+ }) : null
113
+ ]
114
+ }), l ? /* @__PURE__ */ n(i, { children: l }) : null]
115
+ })
116
+ }) : null,
117
+ u ? /* @__PURE__ */ n(i, {
118
+ sx: {
119
+ px: 2.5,
120
+ pb: 1.5
121
+ },
122
+ children: u
123
+ }) : null,
124
+ /* @__PURE__ */ n(i, {
125
+ sx: {
126
+ p: 2.5,
127
+ pt: t || u ? 0 : 2.5
128
+ },
129
+ children: d
130
+ })
131
+ ]
132
+ })
133
+ });
134
+ }
135
+ _.propTypes = {
136
+ eyebrow: p.node,
137
+ title: p.node,
138
+ subtitle: p.node,
139
+ actions: p.node,
140
+ toolbar: p.node,
141
+ children: p.node,
142
+ sx: p.object
143
+ };
144
+ function v({ colSpan: e, title: t, hint: a, icon: o, action: c }) {
145
+ return /* @__PURE__ */ n(d, {
146
+ hover: !1,
147
+ children: /* @__PURE__ */ n(l, {
148
+ colSpan: e,
149
+ sx: {
150
+ py: 5,
151
+ textAlign: "center",
152
+ borderBottom: "none !important"
153
+ },
154
+ children: /* @__PURE__ */ r(s, {
155
+ alignItems: "center",
156
+ spacing: 1.25,
157
+ children: [
158
+ o ? /* @__PURE__ */ n(o, { sx: {
159
+ fontSize: 44,
160
+ color: "text.disabled",
161
+ opacity: .7
162
+ } }) : null,
163
+ /* @__PURE__ */ n(f, {
164
+ variant: "body2",
165
+ sx: { fontWeight: 700 },
166
+ children: t
167
+ }),
168
+ a ? /* @__PURE__ */ n(f, {
169
+ variant: "caption",
170
+ color: "text.secondary",
171
+ sx: { maxWidth: 360 },
172
+ children: a
173
+ }) : null,
174
+ c ? /* @__PURE__ */ n(i, { children: c }) : null
175
+ ]
176
+ })
177
+ })
178
+ });
179
+ }
180
+ v.propTypes = {
181
+ colSpan: p.number.isRequired,
182
+ title: p.node,
183
+ hint: p.node,
184
+ icon: p.elementType,
185
+ action: p.node
186
+ };
187
+ function y({ value: a, fallback: o = "—", size: s = "normal", tone: c, bold: l = !0, prefix: u, sx: d = {} }) {
188
+ let f = h(), p = e(), m = u ?? t(p?.currencyCode);
189
+ if (a == null || a === "") return /* @__PURE__ */ n(i, {
190
+ component: "span",
191
+ sx: {
192
+ color: "text.disabled",
193
+ fontVariantNumeric: "tabular-nums"
194
+ },
195
+ children: o
196
+ });
197
+ let g = Number(a);
198
+ if (Number.isNaN(g)) return /* @__PURE__ */ n(i, {
199
+ component: "span",
200
+ sx: {
201
+ color: "text.disabled",
202
+ fontVariantNumeric: "tabular-nums"
203
+ },
204
+ children: o
205
+ });
206
+ let _ = c === "warning" ? f.palette.warning.dark : c === "success" ? f.palette.success.dark : c === "error" ? f.palette.error.dark : c === "muted" ? f.palette.text.secondary : "inherit";
207
+ return /* @__PURE__ */ r(i, {
208
+ component: "span",
209
+ sx: {
210
+ fontWeight: l ? s === "big" ? 800 : 700 : 500,
211
+ fontSize: s === "big" ? "1.05rem" : "inherit",
212
+ fontVariantNumeric: "tabular-nums",
213
+ color: _,
214
+ ...d
215
+ },
216
+ children: [m, g.toFixed(2)]
217
+ });
218
+ }
219
+ y.propTypes = {
220
+ value: p.oneOfType([p.string, p.number]),
221
+ fallback: p.node,
222
+ size: p.oneOf(["normal", "big"]),
223
+ tone: p.oneOf([
224
+ "warning",
225
+ "success",
226
+ "error",
227
+ "muted"
228
+ ]),
229
+ bold: p.bool,
230
+ prefix: p.string,
231
+ sx: p.object
232
+ };
233
+ function b({ id: e }) {
234
+ return /* @__PURE__ */ r(i, {
235
+ component: "span",
236
+ sx: {
237
+ display: "inline-flex",
238
+ alignItems: "center",
239
+ px: .85,
240
+ py: .25,
241
+ borderRadius: 1,
242
+ backgroundColor: "grey.100",
243
+ color: "text.secondary",
244
+ fontFamily: "monospace",
245
+ fontSize: "0.72rem",
246
+ fontWeight: 700,
247
+ letterSpacing: .4,
248
+ lineHeight: 1.5
249
+ },
250
+ children: ["#", e]
251
+ });
252
+ }
253
+ b.propTypes = { id: p.oneOfType([p.string, p.number]) };
254
+ function x({ eyebrow: e, title: t, hint: a, children: o, sx: s = {} }) {
255
+ return /* @__PURE__ */ r(i, {
256
+ sx: s,
257
+ children: [e || t || a ? /* @__PURE__ */ r(i, {
258
+ sx: { mb: 1.75 },
259
+ children: [
260
+ e ? /* @__PURE__ */ n(f, {
261
+ variant: "overline",
262
+ sx: {
263
+ color: "text.secondary",
264
+ fontWeight: 800,
265
+ letterSpacing: 1,
266
+ lineHeight: 1,
267
+ display: "block"
268
+ },
269
+ children: e
270
+ }) : null,
271
+ t ? /* @__PURE__ */ n(f, {
272
+ variant: "h6",
273
+ sx: {
274
+ fontWeight: 800,
275
+ lineHeight: 1.25
276
+ },
277
+ children: t
278
+ }) : null,
279
+ a ? /* @__PURE__ */ n(f, {
280
+ variant: "caption",
281
+ color: "text.secondary",
282
+ sx: {
283
+ display: "block",
284
+ mt: .5
285
+ },
286
+ children: a
287
+ }) : null
288
+ ]
289
+ }) : null, o]
290
+ });
291
+ }
292
+ x.propTypes = {
293
+ eyebrow: p.node,
294
+ title: p.node,
295
+ hint: p.node,
296
+ children: p.node,
297
+ sx: p.object
298
+ };
299
+ //#endregion
300
+ export { g as a, b as i, x as n, _ as o, y as r, v as t };
301
+
302
+ //# sourceMappingURL=PmTable-BuXZQZCU.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PmTable-BuXZQZCU.js","names":[],"sources":["../src/components/PmTable.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport {\n Box,\n Card,\n CardContent,\n Stack,\n Table,\n TableCell,\n TableContainer,\n TableRow,\n Typography,\n} from '@mui/material';\nimport { alpha, useTheme } from '@mui/material/styles';\nimport { currencySymbol } from '@pm/utils/currency';\nimport { usePmSettings } from '@pm/utils/settingsStore';\n\n// Shared building blocks for the data-heavy PM tables. The goal is one\n// consistent look: gradient-headed table, soft hover, eyebrow + title card\n// chrome, semantic empty state, tabular-figure money cell. Every list page\n// is built from these so the visual rhythm is identical everywhere.\n\n// -------- Table -----------------------------------------------------------\n\nexport function PmTable({ children, dense = false, sx = {}, ...props }) {\n const theme = useTheme();\n return (\n <TableContainer\n sx={{\n borderRadius: 2.5,\n border: `1px solid ${alpha(theme.palette.divider, 0.55)}`,\n backgroundColor: theme.palette.background.paper,\n overflow: 'auto',\n ...sx,\n }}\n >\n <Table\n size={dense ? 'small' : 'medium'}\n {...props}\n sx={{\n '& thead .MuiTableRow-root': {\n background: `linear-gradient(180deg, ${alpha(theme.palette.grey[50], 1)} 0%, ${alpha(theme.palette.grey[100], 1)} 100%)`,\n },\n '& thead .MuiTableCell-root': {\n fontWeight: 800,\n fontSize: '0.7rem',\n textTransform: 'uppercase',\n letterSpacing: '0.65px',\n color: theme.palette.text.secondary,\n borderBottom: `1px solid ${theme.palette.divider}`,\n py: 1.25,\n whiteSpace: 'nowrap',\n position: 'sticky',\n top: 0,\n zIndex: 1,\n },\n '& tbody .MuiTableRow-root': {\n transition: 'background-color 140ms ease',\n },\n '& tbody .MuiTableRow-root:hover': {\n backgroundColor: alpha(theme.palette.primary.main, 0.04),\n },\n '& tbody .MuiTableCell-root': {\n py: 1.4,\n borderBottom: `1px solid ${alpha(theme.palette.divider, 0.5)}`,\n verticalAlign: 'middle',\n },\n '& tbody .MuiTableRow-root:last-of-type .MuiTableCell-root': {\n borderBottom: 'none',\n },\n }}\n >\n {children}\n </Table>\n </TableContainer>\n );\n}\nPmTable.propTypes = {\n children: PropTypes.node,\n dense: PropTypes.bool,\n sx: PropTypes.object,\n};\n\n// -------- Section card chrome --------------------------------------------\n\n/**\n * Card with a consistent eyebrow + title + actions header, ready to hold a\n * PmTable (or any other content). The table renders flush against the card\n * because the container handles borders/radius. Toolbar slot is for filters\n * or search inputs that sit between the title and the table.\n */\nexport function PmTableCard({\n eyebrow,\n title,\n subtitle,\n actions,\n toolbar,\n children,\n sx = {},\n}) {\n return (\n <Card\n sx={{\n borderRadius: 4,\n border: '1px solid',\n borderColor: 'divider',\n boxShadow: '0 12px 32px rgba(15, 23, 42, 0.045)',\n overflow: 'hidden',\n ...sx,\n }}\n >\n <CardContent sx={{ p: 0, '&:last-child': { pb: 0 } }}>\n {(title || actions) ? (\n <Box sx={{ px: 2.5, pt: 2, pb: 1.5 }}>\n <Stack\n direction={{ xs: 'column', md: 'row' }}\n justifyContent=\"space-between\"\n alignItems={{ xs: 'flex-start', md: 'center' }}\n spacing={1.5}\n >\n <Box sx={{ minWidth: 0 }}>\n {eyebrow ? (\n <Typography\n variant=\"overline\"\n sx={{ color: 'text.secondary', fontWeight: 800, letterSpacing: 1, lineHeight: 1 }}\n >\n {eyebrow}\n </Typography>\n ) : null}\n {title ? (\n <Typography variant=\"h6\" sx={{ fontWeight: 800, lineHeight: 1.2 }}>\n {title}\n </Typography>\n ) : null}\n {subtitle ? (\n <Typography variant=\"caption\" color=\"text.secondary\">\n {subtitle}\n </Typography>\n ) : null}\n </Box>\n {actions ? <Box>{actions}</Box> : null}\n </Stack>\n </Box>\n ) : null}\n {toolbar ? <Box sx={{ px: 2.5, pb: 1.5 }}>{toolbar}</Box> : null}\n <Box sx={{ p: 2.5, pt: title || toolbar ? 0 : 2.5 }}>{children}</Box>\n </CardContent>\n </Card>\n );\n}\nPmTableCard.propTypes = {\n eyebrow: PropTypes.node,\n title: PropTypes.node,\n subtitle: PropTypes.node,\n actions: PropTypes.node,\n toolbar: PropTypes.node,\n children: PropTypes.node,\n sx: PropTypes.object,\n};\n\n// -------- Empty state row -------------------------------------------------\n\nexport function PmEmptyRow({ colSpan, title, hint, icon: Icon, action }) {\n return (\n <TableRow hover={false}>\n <TableCell colSpan={colSpan} sx={{ py: 5, textAlign: 'center', borderBottom: 'none !important' }}>\n <Stack alignItems=\"center\" spacing={1.25}>\n {Icon ? <Icon sx={{ fontSize: 44, color: 'text.disabled', opacity: 0.7 }} /> : null}\n <Typography variant=\"body2\" sx={{ fontWeight: 700 }}>{title}</Typography>\n {hint ? (\n <Typography variant=\"caption\" color=\"text.secondary\" sx={{ maxWidth: 360 }}>{hint}</Typography>\n ) : null}\n {action ? <Box>{action}</Box> : null}\n </Stack>\n </TableCell>\n </TableRow>\n );\n}\nPmEmptyRow.propTypes = {\n colSpan: PropTypes.number.isRequired,\n title: PropTypes.node,\n hint: PropTypes.node,\n icon: PropTypes.elementType,\n action: PropTypes.node,\n};\n\n// -------- Money cell ------------------------------------------------------\n\n/**\n * Currency display with tabular figures so numbers don't shift between\n * rows. {@code tone} can semantically colour the value — useful for\n * paid/due splits in the Sales table.\n */\nexport function PmMoney({ value, fallback = '—', size = 'normal', tone, bold = true, prefix, sx = {} }) {\n const theme = useTheme();\n const settings = usePmSettings();\n // When the caller doesn't override the prefix, pull the symbol from the\n // module settings — every PmMoney across the module then renders with the\n // currency configured for the deployment.\n const effectivePrefix = prefix ?? currencySymbol(settings?.currencyCode);\n if (value == null || value === '') {\n return <Box component=\"span\" sx={{ color: 'text.disabled', fontVariantNumeric: 'tabular-nums' }}>{fallback}</Box>;\n }\n const n = Number(value);\n if (Number.isNaN(n)) {\n return <Box component=\"span\" sx={{ color: 'text.disabled', fontVariantNumeric: 'tabular-nums' }}>{fallback}</Box>;\n }\n const color = tone === 'warning' ? theme.palette.warning.dark\n : tone === 'success' ? theme.palette.success.dark\n : tone === 'error' ? theme.palette.error.dark\n : tone === 'muted' ? theme.palette.text.secondary\n : 'inherit';\n return (\n <Box\n component=\"span\"\n sx={{\n fontWeight: bold ? (size === 'big' ? 800 : 700) : 500,\n fontSize: size === 'big' ? '1.05rem' : 'inherit',\n fontVariantNumeric: 'tabular-nums',\n color,\n ...sx,\n }}\n >\n {effectivePrefix}{n.toFixed(2)}\n </Box>\n );\n}\nPmMoney.propTypes = {\n value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n fallback: PropTypes.node,\n size: PropTypes.oneOf(['normal', 'big']),\n tone: PropTypes.oneOf(['warning', 'success', 'error', 'muted']),\n bold: PropTypes.bool,\n prefix: PropTypes.string,\n sx: PropTypes.object,\n};\n\n// -------- Reference chip --------------------------------------------------\n\n/** Monospace `#1234` chip used in left-most \"Ref\" columns. */\nexport function PmRef({ id }) {\n return (\n <Box\n component=\"span\"\n sx={{\n display: 'inline-flex',\n alignItems: 'center',\n px: 0.85,\n py: 0.25,\n borderRadius: 1,\n backgroundColor: 'grey.100',\n color: 'text.secondary',\n fontFamily: 'monospace',\n fontSize: '0.72rem',\n fontWeight: 700,\n letterSpacing: 0.4,\n lineHeight: 1.5,\n }}\n >\n #{id}\n </Box>\n );\n}\nPmRef.propTypes = {\n id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n};\n\n// -------- Form section helper --------------------------------------------\n\n/**\n * Wraps a chunk of form fields with a consistent eyebrow + title + hint\n * header. Used inside create/edit pages so every section has the same\n * vertical rhythm.\n */\nexport function PmFormSection({ eyebrow, title, hint, children, sx = {} }) {\n return (\n <Box sx={sx}>\n {(eyebrow || title || hint) ? (\n <Box sx={{ mb: 1.75 }}>\n {eyebrow ? (\n <Typography\n variant=\"overline\"\n sx={{ color: 'text.secondary', fontWeight: 800, letterSpacing: 1, lineHeight: 1, display: 'block' }}\n >\n {eyebrow}\n </Typography>\n ) : null}\n {title ? (\n <Typography variant=\"h6\" sx={{ fontWeight: 800, lineHeight: 1.25 }}>{title}</Typography>\n ) : null}\n {hint ? (\n <Typography variant=\"caption\" color=\"text.secondary\" sx={{ display: 'block', mt: 0.5 }}>\n {hint}\n </Typography>\n ) : null}\n </Box>\n ) : null}\n {children}\n </Box>\n );\n}\nPmFormSection.propTypes = {\n eyebrow: PropTypes.node,\n title: PropTypes.node,\n hint: PropTypes.node,\n children: PropTypes.node,\n sx: PropTypes.object,\n};\n"],"mappings":";;;;;;;AAuBA,SAAgB,EAAQ,EAAE,aAAU,WAAQ,IAAO,QAAK,CAAC,GAAG,GAAG,KAAS;CACtE,IAAM,IAAQ,EAAS;CACvB,OACE,kBAAC,GAAD;EACE,IAAI;GACF,cAAc;GACd,QAAQ,aAAa,EAAM,EAAM,QAAQ,SAAS,GAAI;GACtD,iBAAiB,EAAM,QAAQ,WAAW;GAC1C,UAAU;GACV,GAAG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