@open-mercato/core 0.4.6-develop-ce2a0728a5 → 0.4.6-develop-4d77832982
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/AGENTS.md +22 -0
- package/dist/modules/customers/backend/customers/companies/page.js +3 -3
- package/dist/modules/customers/backend/customers/companies/page.js.map +2 -2
- package/dist/modules/customers/backend/customers/deals/page.js +3 -3
- package/dist/modules/customers/backend/customers/deals/page.js.map +2 -2
- package/dist/modules/customers/backend/customers/people/page.js +3 -3
- package/dist/modules/customers/backend/customers/people/page.js.map +2 -2
- package/dist/modules/planner/backend/planner/availability-rulesets/page.js +3 -3
- package/dist/modules/planner/backend/planner/availability-rulesets/page.js.map +2 -2
- package/dist/modules/resources/backend/resources/resource-types/page.js +2 -2
- package/dist/modules/resources/backend/resources/resource-types/page.js.map +2 -2
- package/dist/modules/resources/backend/resources/resources/page.js +3 -3
- package/dist/modules/resources/backend/resources/resources/page.js.map +2 -2
- package/dist/modules/sales/backend/sales/channels/page.js +3 -3
- package/dist/modules/sales/backend/sales/channels/page.js.map +2 -2
- package/dist/modules/sales/components/channels/offerTableUtils.js +3 -2
- package/dist/modules/sales/components/channels/offerTableUtils.js.map +2 -2
- package/dist/modules/sales/components/documents/SalesDocumentsTable.js +3 -3
- package/dist/modules/sales/components/documents/SalesDocumentsTable.js.map +2 -2
- package/dist/modules/staff/backend/staff/leave-requests/page.js +3 -3
- package/dist/modules/staff/backend/staff/leave-requests/page.js.map +2 -2
- package/dist/modules/staff/backend/staff/my-leave-requests/page.js +3 -3
- package/dist/modules/staff/backend/staff/my-leave-requests/page.js.map +2 -2
- package/dist/modules/staff/backend/staff/team-members/page.js +3 -3
- package/dist/modules/staff/backend/staff/team-members/page.js.map +2 -2
- package/dist/modules/staff/backend/staff/team-roles/page.js +2 -2
- package/dist/modules/staff/backend/staff/team-roles/page.js.map +2 -2
- package/dist/modules/staff/backend/staff/teams/[id]/edit/page.js +3 -3
- package/dist/modules/staff/backend/staff/teams/[id]/edit/page.js.map +2 -2
- package/dist/modules/staff/backend/staff/teams/page.js +2 -2
- package/dist/modules/staff/backend/staff/teams/page.js.map +2 -2
- package/package.json +2 -2
- package/src/modules/customers/backend/customers/companies/page.tsx +3 -3
- package/src/modules/customers/backend/customers/deals/page.tsx +3 -3
- package/src/modules/customers/backend/customers/people/page.tsx +3 -3
- package/src/modules/planner/backend/planner/availability-rulesets/page.tsx +3 -4
- package/src/modules/resources/backend/resources/resource-types/page.tsx +2 -3
- package/src/modules/resources/backend/resources/resources/page.tsx +3 -3
- package/src/modules/sales/backend/sales/channels/page.tsx +3 -3
- package/src/modules/sales/components/channels/offerTableUtils.tsx +3 -2
- package/src/modules/sales/components/documents/SalesDocumentsTable.tsx +3 -3
- package/src/modules/staff/backend/staff/leave-requests/page.tsx +3 -3
- package/src/modules/staff/backend/staff/my-leave-requests/page.tsx +3 -3
- package/src/modules/staff/backend/staff/team-members/page.tsx +3 -3
- package/src/modules/staff/backend/staff/team-roles/page.tsx +2 -2
- package/src/modules/staff/backend/staff/teams/[id]/edit/page.tsx +3 -4
- package/src/modules/staff/backend/staff/teams/page.tsx +2 -3
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../src/modules/staff/backend/staff/teams/page.tsx"],
|
|
4
|
-
"sourcesContent": ["\"use client\"\n\nimport * as React from 'react'\nimport Link from 'next/link'\nimport dynamic from 'next/dynamic'\nimport type { PluggableList } from 'unified'\nimport { useRouter } from 'next/navigation'\nimport type { ColumnDef, SortingState } from '@tanstack/react-table'\nimport { Page, PageBody } from '@open-mercato/ui/backend/Page'\nimport { DataTable } from '@open-mercato/ui/backend/DataTable'\nimport { RowActions } from '@open-mercato/ui/backend/RowActions'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { BooleanIcon } from '@open-mercato/ui/backend/ValueIcons'\nimport { readApiResultOrThrow } from '@open-mercato/ui/backend/utils/apiCall'\nimport { deleteCrud } from '@open-mercato/ui/backend/utils/crud'\nimport { flash } from '@open-mercato/ui/backend/FlashMessages'\nimport { useConfirmDialog } from '@open-mercato/ui/backend/confirm-dialog'\nimport { useOrganizationScopeVersion } from '@open-mercato/shared/lib/frontend/useOrganizationScope'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport { Users } from 'lucide-react'\nimport { formatDateTime } from '@open-mercato/shared/lib/time'\n\nconst PAGE_SIZE = 50\nconst isTestEnv = typeof process !== 'undefined' && process.env.NODE_ENV === 'test'\nconst MARKDOWN_CLASSNAME =\n 'text-sm text-foreground break-words [&>*]:mb-2 [&>*:last-child]:mb-0 [&_ul]:ml-4 [&_ul]:list-disc [&_ol]:ml-4 [&_ol]:list-decimal [&_code]:rounded [&_code]:bg-muted [&_code]:px-1 [&_code]:py-0.5 [&_pre]:rounded-md [&_pre]:bg-muted [&_pre]:p-3 [&_pre]:text-xs'\n\ntype MarkdownPreviewProps = { children: string; className?: string; remarkPlugins?: PluggableList }\n\nconst MarkdownPreview: React.ComponentType<MarkdownPreviewProps> = isTestEnv\n ? ({ children, className }) => <div className={className}>{children}</div>\n : (dynamic(() => import('react-markdown').then((mod) => mod.default as React.ComponentType<MarkdownPreviewProps>), {\n ssr: false,\n loading: () => null,\n }) as unknown as React.ComponentType<MarkdownPreviewProps>)\n\nlet markdownPluginsPromise: Promise<PluggableList> | null = null\n\nasync function loadMarkdownPlugins(): Promise<PluggableList> {\n if (isTestEnv) return []\n if (!markdownPluginsPromise) {\n markdownPluginsPromise = import('remark-gfm')\n .then((mod) => [mod.default ?? mod] as PluggableList)\n .catch(() => [])\n }\n return markdownPluginsPromise\n}\n\ntype TeamRow = {\n id: string\n name: string\n description: string | null\n isActive: boolean\n updatedAt: string | null\n memberCount: number\n}\n\ntype TeamsResponse = {\n items?: Array<Record<string, unknown>>\n total?: number\n totalPages?: number\n}\n\nexport default function StaffTeamsPage() {\n const t = useT()\n const router = useRouter()\n const scopeVersion = useOrganizationScopeVersion()\n const { confirm, ConfirmDialogElement } = useConfirmDialog()\n const [rows, setRows] = React.useState<TeamRow[]>([])\n const [page, setPage] = React.useState(1)\n const [total, setTotal] = React.useState(0)\n const [totalPages, setTotalPages] = React.useState(1)\n const [sorting, setSorting] = React.useState<SortingState>([{ id: 'name', desc: false }])\n const [search, setSearch] = React.useState('')\n const [isLoading, setIsLoading] = React.useState(true)\n const [reloadToken, setReloadToken] = React.useState(0)\n const [markdownPlugins, setMarkdownPlugins] = React.useState<PluggableList>([])\n\n React.useEffect(() => {\n void loadMarkdownPlugins().then((plugins) => setMarkdownPlugins(plugins))\n }, [])\n\n const labels = React.useMemo(() => ({\n title: t('staff.teams.page.title', 'Teams'),\n description: t('staff.teams.page.description', 'Group team members and roles.'),\n table: {\n name: t('staff.teams.table.name', 'Name'),\n description: t('staff.teams.table.description', 'Description'),\n active: t('staff.teams.table.active', 'Active'),\n members: t('staff.teams.table.members', 'Team members'),\n updatedAt: t('staff.teams.table.updatedAt', 'Updated'),\n empty: t('staff.teams.table.empty', 'No teams yet.'),\n search: t('staff.teams.table.search', 'Search teams...'),\n },\n actions: {\n add: t('staff.teams.actions.add', 'Add team'),\n edit: t('staff.teams.actions.edit', 'Edit'),\n delete: t('staff.teams.actions.delete', 'Delete'),\n deleteConfirm: t('staff.teams.actions.deleteConfirm', 'Delete team \"{{name}}\"?'),\n showMembers: t('staff.teams.actions.showMembers', 'Show team members ({{count}})'),\n refresh: t('staff.teams.actions.refresh', 'Refresh'),\n },\n messages: {\n deleted: t('staff.teams.messages.deleted', 'Team deleted.'),\n },\n errors: {\n load: t('staff.teams.errors.load', 'Failed to load teams.'),\n delete: t('staff.teams.errors.delete', 'Failed to delete team.'),\n deleteAssigned: t('staff.teams.errors.deleteAssigned', 'Team has assigned members and cannot be deleted.'),\n },\n }), [t])\n\n const columns = React.useMemo<ColumnDef<TeamRow>[]>(() => [\n {\n accessorKey: 'name',\n header: labels.table.name,\n meta: { priority: 1, sticky: true },\n cell: ({ row }) => (\n <div className=\"flex flex-col\">\n <span className=\"font-medium\">{row.original.name}</span>\n {row.original.description ? (\n <MarkdownPreview\n remarkPlugins={markdownPlugins}\n className={`${MARKDOWN_CLASSNAME} text-xs text-muted-foreground line-clamp-2`}\n >\n {row.original.description}\n </MarkdownPreview>\n ) : null}\n </div>\n ),\n },\n {\n accessorKey: 'description',\n header: labels.table.description,\n meta: { priority: 4 },\n cell: ({ row }) => row.original.description\n ? (\n <MarkdownPreview remarkPlugins={markdownPlugins} className={MARKDOWN_CLASSNAME}>\n {row.original.description}\n </MarkdownPreview>\n )\n : <span className=\"text-xs text-muted-foreground\">-</span>,\n },\n {\n accessorKey: 'isActive',\n header: labels.table.active,\n meta: { priority: 2 },\n cell: ({ row }) => <BooleanIcon value={row.original.isActive} />,\n },\n {\n accessorKey: 'memberCount',\n header: () => <span className=\"inline-block min-w-[250px]\">{labels.table.members}</span>,\n meta: { priority: 3 },\n enableSorting: false,\n cell: ({ row }) => (\n <Link\n className=\"inline-flex min-w-[220px] items-center gap-2 text-sm text-muted-foreground hover:text-foreground\"\n href={`/backend/staff/team-members?teamId=${encodeURIComponent(row.original.id)}`}\n onClick={(event) => event.stopPropagation()}\n >\n <Users className=\"h-4 w-4\" aria-hidden />\n {labels.actions.showMembers.replace('{{count}}', String(row.original.memberCount))}\n </Link>\n ),\n },\n {\n accessorKey: 'updatedAt',\n header: labels.table.updatedAt,\n meta: { priority: 5 },\n cell: ({ row }) => row.original.updatedAt\n ? <span className=\"text-xs text-muted-foreground\">{formatDateTime(row.original.updatedAt)}</span>\n : <span className=\"text-xs text-muted-foreground\">-</span>,\n },\n ], [\n labels.actions.showMembers,\n labels.table.active,\n labels.table.description,\n labels.table.members,\n labels.table.name,\n labels.table.updatedAt,\n markdownPlugins,\n ])\n\n const loadTeams = React.useCallback(async () => {\n setIsLoading(true)\n try {\n const params = new URLSearchParams({\n page: String(page),\n pageSize: String(PAGE_SIZE),\n })\n const sort = sorting[0]\n if (sort?.id) {\n params.set('sortField', sort.id)\n params.set('sortDir', sort.desc ? 'desc' : 'asc')\n }\n if (search.trim()) params.set('search', search.trim())\n const payload = await readApiResultOrThrow<TeamsResponse>(\n `/api/staff/teams?${params.toString()}`,\n undefined,\n { errorMessage: labels.errors.load, fallback: { items: [], total: 0, totalPages: 1 } },\n )\n const items = Array.isArray(payload.items) ? payload.items : []\n setRows(items.map(mapApiTeam))\n setTotal(typeof payload.total === 'number' ? payload.total : items.length)\n setTotalPages(typeof payload.totalPages === 'number' ? payload.totalPages : Math.max(1, Math.ceil(items.length / PAGE_SIZE)))\n } catch (error) {\n console.error('staff.teams.list', error)\n flash(labels.errors.load, 'error')\n } finally {\n setIsLoading(false)\n }\n }, [labels.errors.load, page, search, sorting])\n\n React.useEffect(() => {\n void loadTeams()\n }, [loadTeams, scopeVersion, reloadToken])\n\n const handleSearchChange = React.useCallback((value: string) => {\n setSearch(value)\n setPage(1)\n }, [])\n\n const handleRefresh = React.useCallback(() => {\n setReloadToken((token) => token + 1)\n }, [])\n\n const handleDelete = React.useCallback(async (entry: TeamRow) => {\n if (entry.memberCount > 0) {\n flash(labels.errors.deleteAssigned, 'error')\n return\n }\n const message = labels.actions.deleteConfirm.replace('{{name}}', entry.name)\n const confirmed = await confirm({\n title: labels.actions.delete,\n text: message,\n variant: 'destructive',\n })\n if (!confirmed) return\n try {\n await deleteCrud('staff/teams', entry.id, { errorMessage: labels.errors.delete })\n flash(labels.messages.deleted, 'success')\n handleRefresh()\n } catch (error) {\n console.error('staff.teams.delete', error)\n flash(labels.errors.delete, 'error')\n }\n }, [confirm, handleRefresh, labels.actions.deleteConfirm, labels.actions.delete, labels.errors.delete, labels.errors.deleteAssigned, labels.messages.deleted])\n\n return (\n <Page>\n <PageBody>\n <DataTable<TeamRow>\n title={labels.title}\n data={rows}\n columns={columns}\n isLoading={isLoading}\n searchValue={search}\n onSearchChange={handleSearchChange}\n searchPlaceholder={labels.table.search}\n emptyState={<p className=\"py-8 text-center text-sm text-muted-foreground\">{labels.table.empty}</p>}\n actions={(\n <Button asChild size=\"sm\">\n <Link href=\"/backend/staff/teams/create\">\n {labels.actions.add}\n </Link>\n </Button>\n )}\n refreshButton={{\n label: labels.actions.refresh,\n onRefresh: handleRefresh,\n isRefreshing: isLoading,\n }}\n sortable\n sorting={sorting}\n onSortingChange={setSorting}\n pagination={{\n page,\n pageSize: PAGE_SIZE,\n total,\n totalPages,\n onPageChange: setPage,\n }}\n rowActions={(row) => (\n <RowActions\n items={[\n { id: 'edit', label: labels.actions.edit, href: `/backend/staff/teams/${row.id}/edit` },\n ...(row.memberCount > 0\n ? []\n : [{ id: 'delete', label: labels.actions.delete, destructive: true, onSelect: () => { void handleDelete(row) } }]),\n ]}\n />\n )}\n onRowClick={(row) => router.push(`/backend/staff/teams/${row.id}/edit`)}\n />\n </PageBody>\n {ConfirmDialogElement}\n </Page>\n )\n}\n\nfunction mapApiTeam(item: Record<string, unknown>): TeamRow {\n const id = typeof item.id === 'string' ? item.id : ''\n const name = typeof item.name === 'string' ? item.name : id\n const description = typeof item.description === 'string' && item.description.trim().length ? item.description.trim() : null\n const updatedAt = typeof item.updatedAt === 'string'\n ? item.updatedAt\n : typeof item.updated_at === 'string'\n ? item.updated_at\n : null\n const isActive = typeof item.isActive === 'boolean'\n ? item.isActive\n : typeof item.is_active === 'boolean'\n ? item.is_active\n : true\n const memberCount = typeof item.memberCount === 'number'\n ? item.memberCount\n : typeof item.member_count === 'number'\n ? item.member_count\n : 0\n return { id, name, description, isActive, updatedAt, memberCount }\n}\n\n\n"],
|
|
5
|
-
"mappings": ";AA8BiC,cAwFzB,YAxFyB;AA5BjC,YAAY,WAAW;AACvB,OAAO,UAAU;AACjB,OAAO,aAAa;AAEpB,SAAS,iBAAiB;AAE1B,SAAS,MAAM,gBAAgB;AAC/B,SAAS,
|
|
4
|
+
"sourcesContent": ["\"use client\"\n\nimport * as React from 'react'\nimport Link from 'next/link'\nimport dynamic from 'next/dynamic'\nimport type { PluggableList } from 'unified'\nimport { useRouter } from 'next/navigation'\nimport type { ColumnDef, SortingState } from '@tanstack/react-table'\nimport { Page, PageBody } from '@open-mercato/ui/backend/Page'\nimport { DataTable, withDataTableNamespaces } from '@open-mercato/ui/backend/DataTable'\nimport { RowActions } from '@open-mercato/ui/backend/RowActions'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { BooleanIcon } from '@open-mercato/ui/backend/ValueIcons'\nimport { readApiResultOrThrow } from '@open-mercato/ui/backend/utils/apiCall'\nimport { deleteCrud } from '@open-mercato/ui/backend/utils/crud'\nimport { flash } from '@open-mercato/ui/backend/FlashMessages'\nimport { useConfirmDialog } from '@open-mercato/ui/backend/confirm-dialog'\nimport { useOrganizationScopeVersion } from '@open-mercato/shared/lib/frontend/useOrganizationScope'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport { Users } from 'lucide-react'\nimport { formatDateTime } from '@open-mercato/shared/lib/time'\n\nconst PAGE_SIZE = 50\nconst isTestEnv = typeof process !== 'undefined' && process.env.NODE_ENV === 'test'\nconst MARKDOWN_CLASSNAME =\n 'text-sm text-foreground break-words [&>*]:mb-2 [&>*:last-child]:mb-0 [&_ul]:ml-4 [&_ul]:list-disc [&_ol]:ml-4 [&_ol]:list-decimal [&_code]:rounded [&_code]:bg-muted [&_code]:px-1 [&_code]:py-0.5 [&_pre]:rounded-md [&_pre]:bg-muted [&_pre]:p-3 [&_pre]:text-xs'\n\ntype MarkdownPreviewProps = { children: string; className?: string; remarkPlugins?: PluggableList }\n\nconst MarkdownPreview: React.ComponentType<MarkdownPreviewProps> = isTestEnv\n ? ({ children, className }) => <div className={className}>{children}</div>\n : (dynamic(() => import('react-markdown').then((mod) => mod.default as React.ComponentType<MarkdownPreviewProps>), {\n ssr: false,\n loading: () => null,\n }) as unknown as React.ComponentType<MarkdownPreviewProps>)\n\nlet markdownPluginsPromise: Promise<PluggableList> | null = null\n\nasync function loadMarkdownPlugins(): Promise<PluggableList> {\n if (isTestEnv) return []\n if (!markdownPluginsPromise) {\n markdownPluginsPromise = import('remark-gfm')\n .then((mod) => [mod.default ?? mod] as PluggableList)\n .catch(() => [])\n }\n return markdownPluginsPromise\n}\n\ntype TeamRow = {\n id: string\n name: string\n description: string | null\n isActive: boolean\n updatedAt: string | null\n memberCount: number\n}\n\ntype TeamsResponse = {\n items?: Array<Record<string, unknown>>\n total?: number\n totalPages?: number\n}\n\nexport default function StaffTeamsPage() {\n const t = useT()\n const router = useRouter()\n const scopeVersion = useOrganizationScopeVersion()\n const { confirm, ConfirmDialogElement } = useConfirmDialog()\n const [rows, setRows] = React.useState<TeamRow[]>([])\n const [page, setPage] = React.useState(1)\n const [total, setTotal] = React.useState(0)\n const [totalPages, setTotalPages] = React.useState(1)\n const [sorting, setSorting] = React.useState<SortingState>([{ id: 'name', desc: false }])\n const [search, setSearch] = React.useState('')\n const [isLoading, setIsLoading] = React.useState(true)\n const [reloadToken, setReloadToken] = React.useState(0)\n const [markdownPlugins, setMarkdownPlugins] = React.useState<PluggableList>([])\n\n React.useEffect(() => {\n void loadMarkdownPlugins().then((plugins) => setMarkdownPlugins(plugins))\n }, [])\n\n const labels = React.useMemo(() => ({\n title: t('staff.teams.page.title', 'Teams'),\n description: t('staff.teams.page.description', 'Group team members and roles.'),\n table: {\n name: t('staff.teams.table.name', 'Name'),\n description: t('staff.teams.table.description', 'Description'),\n active: t('staff.teams.table.active', 'Active'),\n members: t('staff.teams.table.members', 'Team members'),\n updatedAt: t('staff.teams.table.updatedAt', 'Updated'),\n empty: t('staff.teams.table.empty', 'No teams yet.'),\n search: t('staff.teams.table.search', 'Search teams...'),\n },\n actions: {\n add: t('staff.teams.actions.add', 'Add team'),\n edit: t('staff.teams.actions.edit', 'Edit'),\n delete: t('staff.teams.actions.delete', 'Delete'),\n deleteConfirm: t('staff.teams.actions.deleteConfirm', 'Delete team \"{{name}}\"?'),\n showMembers: t('staff.teams.actions.showMembers', 'Show team members ({{count}})'),\n refresh: t('staff.teams.actions.refresh', 'Refresh'),\n },\n messages: {\n deleted: t('staff.teams.messages.deleted', 'Team deleted.'),\n },\n errors: {\n load: t('staff.teams.errors.load', 'Failed to load teams.'),\n delete: t('staff.teams.errors.delete', 'Failed to delete team.'),\n deleteAssigned: t('staff.teams.errors.deleteAssigned', 'Team has assigned members and cannot be deleted.'),\n },\n }), [t])\n\n const columns = React.useMemo<ColumnDef<TeamRow>[]>(() => [\n {\n accessorKey: 'name',\n header: labels.table.name,\n meta: { priority: 1, sticky: true },\n cell: ({ row }) => (\n <div className=\"flex flex-col\">\n <span className=\"font-medium\">{row.original.name}</span>\n {row.original.description ? (\n <MarkdownPreview\n remarkPlugins={markdownPlugins}\n className={`${MARKDOWN_CLASSNAME} text-xs text-muted-foreground line-clamp-2`}\n >\n {row.original.description}\n </MarkdownPreview>\n ) : null}\n </div>\n ),\n },\n {\n accessorKey: 'description',\n header: labels.table.description,\n meta: { priority: 4 },\n cell: ({ row }) => row.original.description\n ? (\n <MarkdownPreview remarkPlugins={markdownPlugins} className={MARKDOWN_CLASSNAME}>\n {row.original.description}\n </MarkdownPreview>\n )\n : <span className=\"text-xs text-muted-foreground\">-</span>,\n },\n {\n accessorKey: 'isActive',\n header: labels.table.active,\n meta: { priority: 2 },\n cell: ({ row }) => <BooleanIcon value={row.original.isActive} />,\n },\n {\n accessorKey: 'memberCount',\n header: () => <span className=\"inline-block min-w-[250px]\">{labels.table.members}</span>,\n meta: { priority: 3 },\n enableSorting: false,\n cell: ({ row }) => (\n <Link\n className=\"inline-flex min-w-[220px] items-center gap-2 text-sm text-muted-foreground hover:text-foreground\"\n href={`/backend/staff/team-members?teamId=${encodeURIComponent(row.original.id)}`}\n onClick={(event) => event.stopPropagation()}\n >\n <Users className=\"h-4 w-4\" aria-hidden />\n {labels.actions.showMembers.replace('{{count}}', String(row.original.memberCount))}\n </Link>\n ),\n },\n {\n accessorKey: 'updatedAt',\n header: labels.table.updatedAt,\n meta: { priority: 5 },\n cell: ({ row }) => row.original.updatedAt\n ? <span className=\"text-xs text-muted-foreground\">{formatDateTime(row.original.updatedAt)}</span>\n : <span className=\"text-xs text-muted-foreground\">-</span>,\n },\n ], [\n labels.actions.showMembers,\n labels.table.active,\n labels.table.description,\n labels.table.members,\n labels.table.name,\n labels.table.updatedAt,\n markdownPlugins,\n ])\n\n const loadTeams = React.useCallback(async () => {\n setIsLoading(true)\n try {\n const params = new URLSearchParams({\n page: String(page),\n pageSize: String(PAGE_SIZE),\n })\n const sort = sorting[0]\n if (sort?.id) {\n params.set('sortField', sort.id)\n params.set('sortDir', sort.desc ? 'desc' : 'asc')\n }\n if (search.trim()) params.set('search', search.trim())\n const payload = await readApiResultOrThrow<TeamsResponse>(\n `/api/staff/teams?${params.toString()}`,\n undefined,\n { errorMessage: labels.errors.load, fallback: { items: [], total: 0, totalPages: 1 } },\n )\n const items = Array.isArray(payload.items) ? payload.items : []\n setRows(items.map(mapApiTeam))\n setTotal(typeof payload.total === 'number' ? payload.total : items.length)\n setTotalPages(typeof payload.totalPages === 'number' ? payload.totalPages : Math.max(1, Math.ceil(items.length / PAGE_SIZE)))\n } catch (error) {\n console.error('staff.teams.list', error)\n flash(labels.errors.load, 'error')\n } finally {\n setIsLoading(false)\n }\n }, [labels.errors.load, page, search, sorting])\n\n React.useEffect(() => {\n void loadTeams()\n }, [loadTeams, scopeVersion, reloadToken])\n\n const handleSearchChange = React.useCallback((value: string) => {\n setSearch(value)\n setPage(1)\n }, [])\n\n const handleRefresh = React.useCallback(() => {\n setReloadToken((token) => token + 1)\n }, [])\n\n const handleDelete = React.useCallback(async (entry: TeamRow) => {\n if (entry.memberCount > 0) {\n flash(labels.errors.deleteAssigned, 'error')\n return\n }\n const message = labels.actions.deleteConfirm.replace('{{name}}', entry.name)\n const confirmed = await confirm({\n title: labels.actions.delete,\n text: message,\n variant: 'destructive',\n })\n if (!confirmed) return\n try {\n await deleteCrud('staff/teams', entry.id, { errorMessage: labels.errors.delete })\n flash(labels.messages.deleted, 'success')\n handleRefresh()\n } catch (error) {\n console.error('staff.teams.delete', error)\n flash(labels.errors.delete, 'error')\n }\n }, [confirm, handleRefresh, labels.actions.deleteConfirm, labels.actions.delete, labels.errors.delete, labels.errors.deleteAssigned, labels.messages.deleted])\n\n return (\n <Page>\n <PageBody>\n <DataTable<TeamRow>\n title={labels.title}\n data={rows}\n columns={columns}\n isLoading={isLoading}\n searchValue={search}\n onSearchChange={handleSearchChange}\n searchPlaceholder={labels.table.search}\n emptyState={<p className=\"py-8 text-center text-sm text-muted-foreground\">{labels.table.empty}</p>}\n actions={(\n <Button asChild size=\"sm\">\n <Link href=\"/backend/staff/teams/create\">\n {labels.actions.add}\n </Link>\n </Button>\n )}\n refreshButton={{\n label: labels.actions.refresh,\n onRefresh: handleRefresh,\n isRefreshing: isLoading,\n }}\n sortable\n sorting={sorting}\n onSortingChange={setSorting}\n pagination={{\n page,\n pageSize: PAGE_SIZE,\n total,\n totalPages,\n onPageChange: setPage,\n }}\n rowActions={(row) => (\n <RowActions\n items={[\n { id: 'edit', label: labels.actions.edit, href: `/backend/staff/teams/${row.id}/edit` },\n ...(row.memberCount > 0\n ? []\n : [{ id: 'delete', label: labels.actions.delete, destructive: true, onSelect: () => { void handleDelete(row) } }]),\n ]}\n />\n )}\n onRowClick={(row) => router.push(`/backend/staff/teams/${row.id}/edit`)}\n />\n </PageBody>\n {ConfirmDialogElement}\n </Page>\n )\n}\n\nfunction mapApiTeam(item: Record<string, unknown>): TeamRow {\n const id = typeof item.id === 'string' ? item.id : ''\n const name = typeof item.name === 'string' ? item.name : id\n const description = typeof item.description === 'string' && item.description.trim().length ? item.description.trim() : null\n const updatedAt = typeof item.updatedAt === 'string'\n ? item.updatedAt\n : typeof item.updated_at === 'string'\n ? item.updated_at\n : null\n const isActive = typeof item.isActive === 'boolean'\n ? item.isActive\n : typeof item.is_active === 'boolean'\n ? item.is_active\n : true\n const memberCount = typeof item.memberCount === 'number'\n ? item.memberCount\n : typeof item.member_count === 'number'\n ? item.member_count\n : 0\n return withDataTableNamespaces({ id, name,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AO,OAAO,QAAQ,MAAM,MAAM,wBAAwB,IAAI,EAAE,QAAQ;AAAA,cACtF,GAAI,IAAI,cAAc,IAClB,CAAC,IACD,CAAC,EAAE,IAAI,UAAU,OAAO,OAAO,QAAQ,QAAQ,aAAa,MAAM,UAAU,MAAM;AAAE,qBAAK,aAAa,GAAG;AAAA,cAAE,EAAE,CAAC;AAAA,YACpH;AAAA;AAAA,QACF;AAAA,QAEF,YAAY,CAAC,QAAQ,OAAO,KAAK,wBAAwB,IAAI,EAAE,OAAO;AAAA;AAAA,IACxE,GACF;AAAA,IACC;AAAA,KACH;AAEJ;AAEA,SAAS,WAAW,MAAwC;AAC1D,QAAM,KAAK,OAAO,KAAK,OAAO,WAAW,KAAK,KAAK;AACnD,QAAM,OAAO,OAAO,KAAK,SAAS,WAAW,KAAK,OAAO;AACzD,QAAM,cAAc,OAAO,KAAK,gBAAgB,YAAY,KAAK,YAAY,KAAK,EAAE,SAAS,KAAK,YAAY,KAAK,IAAI;AACvH,QAAM,YAAY,OAAO,KAAK,cAAc,WACxC,KAAK,YACL,OAAO,KAAK,eAAe,WACzB,KAAK,aACL;AACN,QAAM,WAAW,OAAO,KAAK,aAAa,YACtC,KAAK,WACL,OAAO,KAAK,cAAc,YACxB,KAAK,YACL;AACN,QAAM,cAAc,OAAO,KAAK,gBAAgB,WAC5C,KAAK,cACL,OAAO,KAAK,iBAAiB,WAC3B,KAAK,eACL;AACN,SAAO,wBAAwB,EAAE,IAAI,MAAM,aAAa,UAAU,WAAW,YAAY,GAAG,IAAI;AAClG;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-mercato/core",
|
|
3
|
-
"version": "0.4.6-develop-
|
|
3
|
+
"version": "0.4.6-develop-4d77832982",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -207,7 +207,7 @@
|
|
|
207
207
|
}
|
|
208
208
|
},
|
|
209
209
|
"dependencies": {
|
|
210
|
-
"@open-mercato/shared": "0.4.6-develop-
|
|
210
|
+
"@open-mercato/shared": "0.4.6-develop-4d77832982",
|
|
211
211
|
"@types/html-to-text": "^9.0.4",
|
|
212
212
|
"@types/semver": "^7.5.8",
|
|
213
213
|
"@xyflow/react": "^12.6.0",
|
|
@@ -4,7 +4,7 @@ import * as React from 'react'
|
|
|
4
4
|
import Link from 'next/link'
|
|
5
5
|
import { useRouter } from 'next/navigation'
|
|
6
6
|
import { Page, PageBody } from '@open-mercato/ui/backend/Page'
|
|
7
|
-
import { DataTable, type DataTableExportFormat } from '@open-mercato/ui/backend/DataTable'
|
|
7
|
+
import { DataTable, type DataTableExportFormat, withDataTableNamespaces } from '@open-mercato/ui/backend/DataTable'
|
|
8
8
|
import type { ColumnDef } from '@tanstack/react-table'
|
|
9
9
|
import { Button } from '@open-mercato/ui/primitives/button'
|
|
10
10
|
import { RowActions } from '@open-mercato/ui/backend/RowActions'
|
|
@@ -85,7 +85,7 @@ function mapApiItem(item: Record<string, unknown>): CompanyRow | null {
|
|
|
85
85
|
customFields[key] = value
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
|
-
return {
|
|
88
|
+
return withDataTableNamespaces({
|
|
89
89
|
id,
|
|
90
90
|
name,
|
|
91
91
|
description,
|
|
@@ -100,7 +100,7 @@ function mapApiItem(item: Record<string, unknown>): CompanyRow | null {
|
|
|
100
100
|
organizationId,
|
|
101
101
|
source,
|
|
102
102
|
...customFields,
|
|
103
|
-
}
|
|
103
|
+
}, item)
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
export default function CustomersCompaniesPage() {
|
|
@@ -6,7 +6,7 @@ import { usePathname, useRouter, useSearchParams } from 'next/navigation'
|
|
|
6
6
|
import { useQueryClient } from '@tanstack/react-query'
|
|
7
7
|
import type { ColumnDef } from '@tanstack/react-table'
|
|
8
8
|
import { Page, PageBody } from '@open-mercato/ui/backend/Page'
|
|
9
|
-
import { DataTable, type DataTableExportFormat } from '@open-mercato/ui/backend/DataTable'
|
|
9
|
+
import { DataTable, type DataTableExportFormat, withDataTableNamespaces } from '@open-mercato/ui/backend/DataTable'
|
|
10
10
|
import type { FilterDef, FilterValues } from '@open-mercato/ui/backend/FilterBar'
|
|
11
11
|
import { apiCall } from '@open-mercato/ui/backend/utils/apiCall'
|
|
12
12
|
import { buildCrudExportUrl, deleteCrud } from '@open-mercato/ui/backend/utils/crud'
|
|
@@ -1026,7 +1026,7 @@ function mapDeal(item: Record<string, unknown>): DealRow | null {
|
|
|
1026
1026
|
for (const [key, value] of Object.entries(item)) {
|
|
1027
1027
|
if (key.startsWith('cf_')) customFields[key] = value
|
|
1028
1028
|
}
|
|
1029
|
-
return {
|
|
1029
|
+
return withDataTableNamespaces({
|
|
1030
1030
|
id,
|
|
1031
1031
|
title,
|
|
1032
1032
|
status,
|
|
@@ -1041,5 +1041,5 @@ function mapDeal(item: Record<string, unknown>): DealRow | null {
|
|
|
1041
1041
|
people,
|
|
1042
1042
|
companies,
|
|
1043
1043
|
...customFields,
|
|
1044
|
-
}
|
|
1044
|
+
}, item)
|
|
1045
1045
|
}
|
|
@@ -4,7 +4,7 @@ import * as React from 'react'
|
|
|
4
4
|
import Link from 'next/link'
|
|
5
5
|
import { useRouter } from 'next/navigation'
|
|
6
6
|
import { Page, PageBody } from '@open-mercato/ui/backend/Page'
|
|
7
|
-
import { DataTable, type DataTableExportFormat } from '@open-mercato/ui/backend/DataTable'
|
|
7
|
+
import { DataTable, type DataTableExportFormat, withDataTableNamespaces } from '@open-mercato/ui/backend/DataTable'
|
|
8
8
|
import type { ColumnDef } from '@tanstack/react-table'
|
|
9
9
|
import { Button } from '@open-mercato/ui/primitives/button'
|
|
10
10
|
import { RowActions } from '@open-mercato/ui/backend/RowActions'
|
|
@@ -101,7 +101,7 @@ function mapApiItem(item: Record<string, unknown>): PersonRow | null {
|
|
|
101
101
|
customFields[key] = value
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
|
-
return {
|
|
104
|
+
return withDataTableNamespaces({
|
|
105
105
|
id,
|
|
106
106
|
name,
|
|
107
107
|
description,
|
|
@@ -116,7 +116,7 @@ function mapApiItem(item: Record<string, unknown>): PersonRow | null {
|
|
|
116
116
|
organizationId,
|
|
117
117
|
source,
|
|
118
118
|
...customFields,
|
|
119
|
-
}
|
|
119
|
+
}, item)
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
export default function CustomersPeoplePage() {
|
|
@@ -8,7 +8,7 @@ import type { PluggableList } from 'unified'
|
|
|
8
8
|
import ReactMarkdown from 'react-markdown'
|
|
9
9
|
import remarkGfm from 'remark-gfm'
|
|
10
10
|
import { Page, PageBody } from '@open-mercato/ui/backend/Page'
|
|
11
|
-
import { DataTable } from '@open-mercato/ui/backend/DataTable'
|
|
11
|
+
import { DataTable, withDataTableNamespaces } from '@open-mercato/ui/backend/DataTable'
|
|
12
12
|
import { RowActions } from '@open-mercato/ui/backend/RowActions'
|
|
13
13
|
import { Button } from '@open-mercato/ui/primitives/button'
|
|
14
14
|
import { readApiResultOrThrow } from '@open-mercato/ui/backend/utils/apiCall'
|
|
@@ -233,13 +233,12 @@ function mapRuleSet(item: Record<string, unknown>): RuleSetRow {
|
|
|
233
233
|
: typeof item.updated_at === 'string'
|
|
234
234
|
? item.updated_at
|
|
235
235
|
: null
|
|
236
|
-
return {
|
|
236
|
+
return withDataTableNamespaces({
|
|
237
237
|
id,
|
|
238
238
|
name,
|
|
239
239
|
description,
|
|
240
240
|
timezone,
|
|
241
241
|
updatedAt,
|
|
242
|
-
}
|
|
242
|
+
}, item)
|
|
243
243
|
}
|
|
244
244
|
|
|
245
|
-
|
|
@@ -8,7 +8,7 @@ import type { PluggableList } from 'unified'
|
|
|
8
8
|
import ReactMarkdown from 'react-markdown'
|
|
9
9
|
import remarkGfm from 'remark-gfm'
|
|
10
10
|
import { Page, PageBody } from '@open-mercato/ui/backend/Page'
|
|
11
|
-
import { DataTable } from '@open-mercato/ui/backend/DataTable'
|
|
11
|
+
import { DataTable, withDataTableNamespaces } from '@open-mercato/ui/backend/DataTable'
|
|
12
12
|
import { Button } from '@open-mercato/ui/primitives/button'
|
|
13
13
|
import { RowActions } from '@open-mercato/ui/backend/RowActions'
|
|
14
14
|
import { flash } from '@open-mercato/ui/backend/FlashMessages'
|
|
@@ -317,7 +317,6 @@ function mapApiResourceType(item: Record<string, unknown>): ResourceTypeRow {
|
|
|
317
317
|
: typeof item.resource_count === 'number'
|
|
318
318
|
? item.resource_count
|
|
319
319
|
: 0
|
|
320
|
-
return { id, name, description, appearanceIcon, appearanceColor, updatedAt, resourceCount }
|
|
320
|
+
return withDataTableNamespaces({ id, name, description, appearanceIcon, appearanceColor, updatedAt, resourceCount }, item)
|
|
321
321
|
}
|
|
322
322
|
|
|
323
|
-
|
|
@@ -5,7 +5,7 @@ import Link from 'next/link'
|
|
|
5
5
|
import { usePathname, useRouter, useSearchParams } from 'next/navigation'
|
|
6
6
|
import type { ColumnDef } from '@tanstack/react-table'
|
|
7
7
|
import { Page, PageBody } from '@open-mercato/ui/backend/Page'
|
|
8
|
-
import { DataTable } from '@open-mercato/ui/backend/DataTable'
|
|
8
|
+
import { DataTable, withDataTableNamespaces } from '@open-mercato/ui/backend/DataTable'
|
|
9
9
|
import { RowActions } from '@open-mercato/ui/backend/RowActions'
|
|
10
10
|
import { Button } from '@open-mercato/ui/primitives/button'
|
|
11
11
|
import { BooleanIcon } from '@open-mercato/ui/backend/ValueIcons'
|
|
@@ -534,7 +534,7 @@ function mapApiResource(item: Record<string, unknown>): ResourceRow {
|
|
|
534
534
|
? item.appearance_color
|
|
535
535
|
: null
|
|
536
536
|
const tags = Array.isArray(item.tags) ? item.tags as TagOption[] : []
|
|
537
|
-
return {
|
|
537
|
+
return withDataTableNamespaces({
|
|
538
538
|
id,
|
|
539
539
|
name,
|
|
540
540
|
resourceTypeId,
|
|
@@ -543,5 +543,5 @@ function mapApiResource(item: Record<string, unknown>): ResourceRow {
|
|
|
543
543
|
isActive,
|
|
544
544
|
appearanceIcon,
|
|
545
545
|
appearanceColor,
|
|
546
|
-
}
|
|
546
|
+
}, item)
|
|
547
547
|
}
|
|
@@ -5,7 +5,7 @@ import { useRouter } from 'next/navigation'
|
|
|
5
5
|
import Link from 'next/link'
|
|
6
6
|
import type { ColumnDef, SortingState } from '@tanstack/react-table'
|
|
7
7
|
import { Page, PageBody } from '@open-mercato/ui/backend/Page'
|
|
8
|
-
import { DataTable } from '@open-mercato/ui/backend/DataTable'
|
|
8
|
+
import { DataTable, withDataTableNamespaces } from '@open-mercato/ui/backend/DataTable'
|
|
9
9
|
import { Button } from '@open-mercato/ui/primitives/button'
|
|
10
10
|
import { RowActions } from '@open-mercato/ui/backend/RowActions'
|
|
11
11
|
import { BooleanIcon } from '@open-mercato/ui/backend/ValueIcons'
|
|
@@ -217,7 +217,7 @@ export default function SalesChannelsPage() {
|
|
|
217
217
|
|
|
218
218
|
function mapApiChannel(item: Record<string, unknown>): ChannelRow {
|
|
219
219
|
const id = typeof item.id === 'string' ? item.id : ''
|
|
220
|
-
return {
|
|
220
|
+
return withDataTableNamespaces({
|
|
221
221
|
id,
|
|
222
222
|
name: typeof item.name === 'string' ? item.name : id,
|
|
223
223
|
code: typeof item.code === 'string' && item.code.length ? item.code : null,
|
|
@@ -233,5 +233,5 @@ function mapApiChannel(item: Record<string, unknown>): ChannelRow {
|
|
|
233
233
|
: typeof item.updated_at === 'string'
|
|
234
234
|
? item.updated_at
|
|
235
235
|
: null,
|
|
236
|
-
}
|
|
236
|
+
}, item)
|
|
237
237
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from 'react'
|
|
2
|
+
import { withDataTableNamespaces } from '@open-mercato/ui/backend/DataTable'
|
|
2
3
|
|
|
3
4
|
type Translator = (key: string, fallback: string, vars?: Record<string, unknown>) => string
|
|
4
5
|
|
|
@@ -45,7 +46,7 @@ export function mapOfferRow(item: Record<string, unknown>): OfferRow {
|
|
|
45
46
|
: item.product_channel_price && typeof item.product_channel_price === 'object'
|
|
46
47
|
? item.product_channel_price as Record<string, unknown>
|
|
47
48
|
: null
|
|
48
|
-
return {
|
|
49
|
+
return withDataTableNamespaces({
|
|
49
50
|
id: typeof item.id === 'string' ? item.id : '',
|
|
50
51
|
channelId: typeof item.channelId === 'string'
|
|
51
52
|
? item.channelId
|
|
@@ -80,7 +81,7 @@ export function mapOfferRow(item: Record<string, unknown>): OfferRow {
|
|
|
80
81
|
: typeof item.updated_at === 'string'
|
|
81
82
|
? item.updated_at
|
|
82
83
|
: null,
|
|
83
|
-
}
|
|
84
|
+
}, item)
|
|
84
85
|
}
|
|
85
86
|
|
|
86
87
|
export function renderOfferPriceSummary(
|
|
@@ -5,7 +5,7 @@ import Link from 'next/link'
|
|
|
5
5
|
import { useRouter } from 'next/navigation'
|
|
6
6
|
import type { ColumnDef, SortingState } from '@tanstack/react-table'
|
|
7
7
|
import { Page, PageBody } from '@open-mercato/ui/backend/Page'
|
|
8
|
-
import { DataTable, type DataTableExportFormat } from '@open-mercato/ui/backend/DataTable'
|
|
8
|
+
import { DataTable, type DataTableExportFormat, withDataTableNamespaces } from '@open-mercato/ui/backend/DataTable'
|
|
9
9
|
import type { FilterDef, FilterValues } from '@open-mercato/ui/backend/FilterBar'
|
|
10
10
|
import { RowActions } from '@open-mercato/ui/backend/RowActions'
|
|
11
11
|
import { Button } from '@open-mercato/ui/primitives/button'
|
|
@@ -449,7 +449,7 @@ export function SalesDocumentsTable({ kind }: { kind: SalesDocumentKind }) {
|
|
|
449
449
|
const validUntil = doc.validUntil ?? null
|
|
450
450
|
const createdAt = doc.createdAt ?? null
|
|
451
451
|
const date = placedAt ?? validUntil ?? createdAt ?? null
|
|
452
|
-
return {
|
|
452
|
+
return withDataTableNamespaces({
|
|
453
453
|
id,
|
|
454
454
|
number,
|
|
455
455
|
status: doc.status ?? null,
|
|
@@ -461,7 +461,7 @@ export function SalesDocumentsTable({ kind }: { kind: SalesDocumentKind }) {
|
|
|
461
461
|
totalGross,
|
|
462
462
|
currency: doc.currencyCode ?? null,
|
|
463
463
|
date,
|
|
464
|
-
}
|
|
464
|
+
}, item)
|
|
465
465
|
},
|
|
466
466
|
[kind]
|
|
467
467
|
)
|
|
@@ -5,7 +5,7 @@ import Link from 'next/link'
|
|
|
5
5
|
import { useRouter } from 'next/navigation'
|
|
6
6
|
import type { ColumnDef, SortingState } from '@tanstack/react-table'
|
|
7
7
|
import { Page, PageBody } from '@open-mercato/ui/backend/Page'
|
|
8
|
-
import { DataTable } from '@open-mercato/ui/backend/DataTable'
|
|
8
|
+
import { DataTable, withDataTableNamespaces } from '@open-mercato/ui/backend/DataTable'
|
|
9
9
|
import { Badge } from '@open-mercato/ui/primitives/badge'
|
|
10
10
|
import { Button } from '@open-mercato/ui/primitives/button'
|
|
11
11
|
import { readApiResultOrThrow } from '@open-mercato/ui/backend/utils/apiCall'
|
|
@@ -209,7 +209,7 @@ function mapLeaveRequest(item: Record<string, unknown>): LeaveRequestRow {
|
|
|
209
209
|
: typeof item.updated_at === 'string'
|
|
210
210
|
? item.updated_at
|
|
211
211
|
: null
|
|
212
|
-
return {
|
|
212
|
+
return withDataTableNamespaces({
|
|
213
213
|
id,
|
|
214
214
|
memberName,
|
|
215
215
|
startDate,
|
|
@@ -217,7 +217,7 @@ function mapLeaveRequest(item: Record<string, unknown>): LeaveRequestRow {
|
|
|
217
217
|
status,
|
|
218
218
|
reason,
|
|
219
219
|
updatedAt,
|
|
220
|
-
}
|
|
220
|
+
}, item)
|
|
221
221
|
}
|
|
222
222
|
|
|
223
223
|
function formatDateRange(start?: string | null, end?: string | null): string {
|
|
@@ -5,7 +5,7 @@ import Link from 'next/link'
|
|
|
5
5
|
import { useRouter } from 'next/navigation'
|
|
6
6
|
import type { ColumnDef, SortingState } from '@tanstack/react-table'
|
|
7
7
|
import { Page, PageBody } from '@open-mercato/ui/backend/Page'
|
|
8
|
-
import { DataTable } from '@open-mercato/ui/backend/DataTable'
|
|
8
|
+
import { DataTable, withDataTableNamespaces } from '@open-mercato/ui/backend/DataTable'
|
|
9
9
|
import { Badge } from '@open-mercato/ui/primitives/badge'
|
|
10
10
|
import { Button } from '@open-mercato/ui/primitives/button'
|
|
11
11
|
import { readApiResultOrThrow } from '@open-mercato/ui/backend/utils/apiCall'
|
|
@@ -215,14 +215,14 @@ function mapLeaveRequest(item: Record<string, unknown>): LeaveRequestRow {
|
|
|
215
215
|
: typeof item.updated_at === 'string'
|
|
216
216
|
? item.updated_at
|
|
217
217
|
: null
|
|
218
|
-
return {
|
|
218
|
+
return withDataTableNamespaces({
|
|
219
219
|
id,
|
|
220
220
|
startDate,
|
|
221
221
|
endDate,
|
|
222
222
|
status,
|
|
223
223
|
reason,
|
|
224
224
|
updatedAt,
|
|
225
|
-
}
|
|
225
|
+
}, item)
|
|
226
226
|
}
|
|
227
227
|
|
|
228
228
|
function formatDateRange(start?: string | null, end?: string | null): string {
|
|
@@ -5,7 +5,7 @@ import Link from 'next/link'
|
|
|
5
5
|
import { usePathname, useRouter, useSearchParams } from 'next/navigation'
|
|
6
6
|
import type { ColumnDef, SortingFn, SortingState } from '@tanstack/react-table'
|
|
7
7
|
import { Page, PageBody } from '@open-mercato/ui/backend/Page'
|
|
8
|
-
import { DataTable } from '@open-mercato/ui/backend/DataTable'
|
|
8
|
+
import { DataTable, withDataTableNamespaces } from '@open-mercato/ui/backend/DataTable'
|
|
9
9
|
import { RowActions } from '@open-mercato/ui/backend/RowActions'
|
|
10
10
|
import { Button } from '@open-mercato/ui/primitives/button'
|
|
11
11
|
import { BooleanIcon } from '@open-mercato/ui/backend/ValueIcons'
|
|
@@ -505,7 +505,7 @@ function mapApiTeamMember(item: Record<string, unknown>): TeamMemberApiRow {
|
|
|
505
505
|
: null
|
|
506
506
|
const team = item.team && typeof item.team === 'object' ? item.team as { name?: unknown } : null
|
|
507
507
|
const teamName = typeof team?.name === 'string' ? team.name : null
|
|
508
|
-
return {
|
|
508
|
+
return withDataTableNamespaces({
|
|
509
509
|
id,
|
|
510
510
|
displayName,
|
|
511
511
|
description,
|
|
@@ -517,7 +517,7 @@ function mapApiTeamMember(item: Record<string, unknown>): TeamMemberApiRow {
|
|
|
517
517
|
updatedAt,
|
|
518
518
|
teamId,
|
|
519
519
|
teamName,
|
|
520
|
-
}
|
|
520
|
+
}, item)
|
|
521
521
|
}
|
|
522
522
|
|
|
523
523
|
function compareGroupedRows(
|
|
@@ -7,7 +7,7 @@ import type { PluggableList } from 'unified'
|
|
|
7
7
|
import { useRouter } from 'next/navigation'
|
|
8
8
|
import type { ColumnDef } from '@tanstack/react-table'
|
|
9
9
|
import { Page, PageBody } from '@open-mercato/ui/backend/Page'
|
|
10
|
-
import { DataTable } from '@open-mercato/ui/backend/DataTable'
|
|
10
|
+
import { DataTable, withDataTableNamespaces } from '@open-mercato/ui/backend/DataTable'
|
|
11
11
|
import { RowActions } from '@open-mercato/ui/backend/RowActions'
|
|
12
12
|
import { Button } from '@open-mercato/ui/primitives/button'
|
|
13
13
|
import { readApiResultOrThrow, apiCall } from '@open-mercato/ui/backend/utils/apiCall'
|
|
@@ -394,7 +394,7 @@ function mapApiTeamRole(item: Record<string, unknown>): TeamRoleApiRow {
|
|
|
394
394
|
: null
|
|
395
395
|
const teamName = typeof team?.name === 'string' ? team.name : null
|
|
396
396
|
const memberCount = typeof item.memberCount === 'number' ? item.memberCount : 0
|
|
397
|
-
return { id, name, description, updatedAt, teamId, teamName, memberCount }
|
|
397
|
+
return withDataTableNamespaces({ id, name, description, updatedAt, teamId, teamName, memberCount }, item)
|
|
398
398
|
}
|
|
399
399
|
|
|
400
400
|
function buildTeamRoleRows(items: TeamRoleApiRow[], unassignedLabel: string): TeamRoleRow[] {
|
|
@@ -7,7 +7,7 @@ import type { ColumnDef, SortingState } from '@tanstack/react-table'
|
|
|
7
7
|
import { Page, PageBody } from '@open-mercato/ui/backend/Page'
|
|
8
8
|
import { readApiResultOrThrow } from '@open-mercato/ui/backend/utils/apiCall'
|
|
9
9
|
import { updateCrud, deleteCrud } from '@open-mercato/ui/backend/utils/crud'
|
|
10
|
-
import { DataTable } from '@open-mercato/ui/backend/DataTable'
|
|
10
|
+
import { DataTable, withDataTableNamespaces } from '@open-mercato/ui/backend/DataTable'
|
|
11
11
|
import { RowActions } from '@open-mercato/ui/backend/RowActions'
|
|
12
12
|
import { Button } from '@open-mercato/ui/primitives/button'
|
|
13
13
|
import { BooleanIcon } from '@open-mercato/ui/backend/ValueIcons'
|
|
@@ -424,7 +424,7 @@ function mapApiTeamMember(item: Record<string, unknown>): TeamMemberRow {
|
|
|
424
424
|
: typeof item.team_id === 'string'
|
|
425
425
|
? item.team_id
|
|
426
426
|
: null
|
|
427
|
-
return {
|
|
427
|
+
return withDataTableNamespaces({
|
|
428
428
|
id,
|
|
429
429
|
displayName,
|
|
430
430
|
description,
|
|
@@ -434,7 +434,6 @@ function mapApiTeamMember(item: Record<string, unknown>): TeamMemberRow {
|
|
|
434
434
|
isActive,
|
|
435
435
|
updatedAt,
|
|
436
436
|
teamId,
|
|
437
|
-
}
|
|
437
|
+
}, item)
|
|
438
438
|
}
|
|
439
439
|
|
|
440
|
-
|
|
@@ -7,7 +7,7 @@ import type { PluggableList } from 'unified'
|
|
|
7
7
|
import { useRouter } from 'next/navigation'
|
|
8
8
|
import type { ColumnDef, SortingState } from '@tanstack/react-table'
|
|
9
9
|
import { Page, PageBody } from '@open-mercato/ui/backend/Page'
|
|
10
|
-
import { DataTable } from '@open-mercato/ui/backend/DataTable'
|
|
10
|
+
import { DataTable, withDataTableNamespaces } from '@open-mercato/ui/backend/DataTable'
|
|
11
11
|
import { RowActions } from '@open-mercato/ui/backend/RowActions'
|
|
12
12
|
import { Button } from '@open-mercato/ui/primitives/button'
|
|
13
13
|
import { BooleanIcon } from '@open-mercato/ui/backend/ValueIcons'
|
|
@@ -317,7 +317,6 @@ function mapApiTeam(item: Record<string, unknown>): TeamRow {
|
|
|
317
317
|
: typeof item.member_count === 'number'
|
|
318
318
|
? item.member_count
|
|
319
319
|
: 0
|
|
320
|
-
return { id, name, description, isActive, updatedAt, memberCount }
|
|
320
|
+
return withDataTableNamespaces({ id, name, description, isActive, updatedAt, memberCount }, item)
|
|
321
321
|
}
|
|
322
322
|
|
|
323
|
-
|