Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Give merchants screens for transfers, purchase orders and suppliers

Łukasz Adamczykc275c83d7838
diff --git a/packages/dashboard-core/src/lib/permissions.ts b/packages/dashboard-core/src/lib/permissions.ts
index b0d2776443..4db788797e 100644
--- a/packages/dashboard-core/src/lib/permissions.ts
+++ b/packages/dashboard-core/src/lib/permissions.ts
@@ -58,6 +58,10 @@ export const Subject = {
/** @deprecated Use Subject.StockLevel — removed in Spree 6.1. */
StockItem: 'Spree::StockItem',
StockTransfer: 'Spree::StockTransfer',
+ StockTransferItem: 'Spree::StockTransferItem',
+ Supplier: 'Spree::Supplier',
+ PurchaseOrder: 'Spree::PurchaseOrder',
+ PurchaseOrderItem: 'Spree::PurchaseOrderItem',
PriceList: 'Spree::PriceList',
PriceRule: 'Spree::PriceRule',
Promotion: 'Spree::Promotion',
diff --git a/packages/dashboard-core/src/pages/stock-locations.tsx b/packages/dashboard-core/src/pages/stock-locations.tsx
index bd7287158e..abc2522878 100644
--- a/packages/dashboard-core/src/pages/stock-locations.tsx
+++ b/packages/dashboard-core/src/pages/stock-locations.tsx
@@ -80,19 +80,22 @@ export type StockLocationsSearch = z.infer<typeof stockLocationsSearchSchema>
* API answers with every location in the store and a seller's with only their
* own, and this page renders whatever it is given.
*
- * Two things a panel supplies rather than this page assuming them: the API
- * resource, registered through `setApiClient`, and `stockLevelsPanel` — the
- * on-hand editor, which reads the Admin API and links to the operator's
- * product pages, so a seller's panel simply passes nothing and gets a page
- * without it.
+ * Three things a panel supplies rather than this page assuming them: the API
+ * resource, registered through `setApiClient`, and the two injected panels —
+ * the on-hand editor and the movement history, both of which read the Admin
+ * API and link to the operator's product pages, so a seller's panel simply
+ * passes nothing and gets a page without them.
*/
export function StockLocationsPage({
search,
stockLevelsPanel: StockLevelsPanel,
+ activityPanel: ActivityPanel,
}: {
search: StockLocationsSearch
/** Rendered inside the edit sheet, below the form. Optional — see above. */
stockLevelsPanel?: ComponentType<{ stockLocationId: string }>
+ /** What changed in this warehouse, for reconciliation. Optional. */
+ activityPanel?: ComponentType<{ stockLocationId: string }>
}) {
const { t } = useTranslation()
const navigate = useNavigate()
@@ -174,6 +177,7 @@ export function StockLocationsPage({
open
onOpenChange={(o) => !o && closeSheet()}
stockLevelsPanel={StockLevelsPanel}
+ activityPanel={ActivityPanel}
/>
)}
</>
@@ -258,11 +262,13 @@ function EditStockLocationSheet({
open,
onOpenChange,
stockLevelsPanel: StockLevelsPanel,
+ activityPanel: ActivityPanel,
}: {
id: string
open: boolean
onOpenChange: (open: boolean) => void
stockLevelsPanel?: ComponentType<{ stockLocationId: string }>
+ activityPanel?: ComponentType<{ stockLocationId: string }>
}) {
const { t } = useTranslation()
const { data: stockLocation, isLoading } = useStockLocation(id)
@@ -309,6 +315,7 @@ function EditStockLocationSheet({
<div className="flex flex-1 flex-col gap-4 overflow-y-auto p-4">
<StockLocationFormFields form={form} />
{StockLevelsPanel && <StockLevelsPanel stockLocationId={id} />}
+ {ActivityPanel && <ActivityPanel stockLocationId={id} />}
</div>
<SheetFooter>
<Button
diff --git a/packages/dashboard-starter/src/routeTree.gen.ts b/packages/dashboard-starter/src/routeTree.gen.ts
index 2a665e773c..80c85bf1fe 100644
--- a/packages/dashboard-starter/src/routeTree.gen.ts
+++ b/packages/dashboard-starter/src/routeTree.gen.ts
@@ -59,7 +59,6 @@ import { Route as PromotionsNewRouteImport } from './../../dashboard/src/routes/
import { Route as PromotionsGiftCardsRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/promotions/gift-cards'
import { Route as PromotionsPromotionIdRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/promotions/$promotionId'
import { Route as ProductsTranslationsRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/products/translations'
-import { Route as ProductsTransfersRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/products/transfers'
import { Route as ProductsOptionsRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/products/options'
import { Route as ProductsNewRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/products/new'
import { Route as ProductsMediaRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/products/media'
@@ -345,11 +344,6 @@ const ProductsTranslationsRoute = ProductsTranslationsRouteImport.update({
path: '/products/translations',
getParentRoute: () => authenticatedStoreIdRoute,
} as any)
-const ProductsTransfersRoute = ProductsTransfersRouteImport.update({
- id: '/products/transfers',
- path: '/products/transfers',
- getParentRoute: () => authenticatedStoreIdRoute,
-} as any)
const ProductsOptionsRoute = ProductsOptionsRouteImport.update({
id: '/products/options',
path: '/products/options',
@@ -546,7 +540,6 @@ export interface FileRoutesByFullPath {
'/$storeId/products/media': typeof ProductsMediaRoute
'/$storeId/products/new': typeof ProductsNewRoute
'/$storeId/products/options': typeof ProductsOptionsRoute
- '/$storeId/products/transfers': typeof ProductsTransfersRoute
'/$storeId/products/translations': typeof ProductsTranslationsRoute
'/$storeId/promotions/$promotionId': typeof PromotionsPromotionIdRoute
'/$storeId/promotions/gift-cards': typeof PromotionsGiftCardsRoute
@@ -628,7 +621,6 @@ export interface FileRoutesByTo {
'/$storeId/products/media': typeof ProductsMediaRoute
'/$storeId/products/new': typeof ProductsNewRoute
'/$storeId/products/options': typeof ProductsOptionsRoute
- '/$storeId/products/transfers': typeof ProductsTransfersRoute
'/$storeId/products/translations': typeof ProductsTranslationsRoute
'/$storeId/promotions/$promotionId': typeof PromotionsPromotionIdRoute
'/$storeId/promotions/gift-cards': typeof PromotionsGiftCardsRoute
@@ -714,7 +706,6 @@ export interface FileRoutesById {
'/_authenticated/$storeId/products/media': typeof ProductsMediaRoute
'/_authenticated/$storeId/products/new': typeof ProductsNewRoute
'/_authenticated/$storeId/products/options': typeof ProductsOptionsRoute
- '/_authenticated/$storeId/products/transfers': typeof ProductsTransfersRoute
'/_authenticated/$storeId/products/translations': typeof ProductsTranslationsRoute
'/_authenticated/$storeId/promotions/$promotionId': typeof PromotionsPromotionIdRoute
'/_authenticated/$storeId/promotions/gift-cards': typeof PromotionsGiftCardsRoute
@@ -800,7 +791,6 @@ export interface FileRouteTypes {
| '/$storeId/products/media'
| '/$storeId/products/new'
| '/$storeId/products/options'
- | '/$storeId/products/transfers'
| '/$storeId/products/translations'
| '/$storeId/promotions/$promotionId'
| '/$storeId/promotions/gift-cards'
@@ -882,7 +872,6 @@ export interface FileRouteTypes {
| '/$storeId/products/media'
| '/$storeId/products/new'
| '/$storeId/products/options'
- | '/$storeId/products/transfers'
| '/$storeId/products/translations'
| '/$storeId/promotions/$promotionId'
| '/$storeId/promotions/gift-cards'
@@ -967,7 +956,6 @@ export interface FileRouteTypes {
| '/_authenticated/$storeId/products/media'
| '/_authenticated/$storeId/products/new'
| '/_authenticated/$storeId/products/options'
- | '/_authenticated/$storeId/products/transfers'
| '/_authenticated/$storeId/products/translations'
| '/_authenticated/$storeId/promotions/$promotionId'
| '/_authenticated/$storeId/promotions/gift-cards'
@@ -1388,13 +1376,6 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof ProductsTranslationsRouteImport
parentRoute: typeof authenticatedStoreIdRoute
}
- '/_authenticated/$storeId/products/transfers': {
- id: '/_authenticated/$storeId/products/transfers'
- path: '/products/transfers'
- fullPath: '/$storeId/products/transfers'
- preLoaderRoute: typeof ProductsTransfersRouteImport
- parentRoute: typeof authenticatedStoreIdRoute
- }
'/_authenticated/$storeId/products/options': {
id: '/_authenticated/$storeId/products/options'
path: '/products/options'
@@ -1712,7 +1693,6 @@ interface authenticatedStoreIdRouteChildren {
ProductsMediaRoute: typeof ProductsMediaRoute
ProductsNewRoute: typeof ProductsNewRoute
ProductsOptionsRoute: typeof ProductsOptionsRoute
- ProductsTransfersRoute: typeof ProductsTransfersRoute
ProductsTranslationsRoute: typeof ProductsTranslationsRoute
PromotionsPromotionIdRoute: typeof PromotionsPromotionIdRoute
PromotionsGiftCardsRoute: typeof PromotionsGiftCardsRoute
@@ -1761,7 +1741,6 @@ const authenticatedStoreIdRouteChildren: authenticatedStoreIdRouteChildren = {
ProductsMediaRoute: ProductsMediaRoute,
ProductsNewRoute: ProductsNewRoute,
ProductsOptionsRoute: ProductsOptionsRoute,
- ProductsTransfersRoute: ProductsTransfersRoute,
ProductsTranslationsRoute: ProductsTranslationsRoute,
PromotionsPromotionIdRoute: PromotionsPromotionIdRoute,
PromotionsGiftCardsRoute: PromotionsGiftCardsRoute,
diff --git a/packages/dashboard-ui/src/ui/badge.tsx b/packages/dashboard-ui/src/ui/badge.tsx
index bcd597a1d7..bfde2dd38f 100644
--- a/packages/dashboard-ui/src/ui/badge.tsx
+++ b/packages/dashboard-ui/src/ui/badge.tsx
@@ -135,6 +135,13 @@ const statusToneMap: Record<string, StatusTone> = {
refunded: 'success',
resolved: 'success',
denied: 'destructive',
+ // Inventory operations. `received` is deliberately absent: on a return it
+ // means the merchant still owes a refund, on a transfer or purchase order it
+ // means the job is done — one code, two tones, so those two callers pass
+ // `tone` explicitly.
+ ready_to_ship: 'warning',
+ ordered: 'info',
+ partially_received: 'info',
// Gift cards.
partially_redeemed: 'info',
redeemed: 'neutral',
@@ -166,8 +173,16 @@ const dotToneClasses: Record<StatusTone, string> = {
* a status with its label in a menu or list; use `StatusBadge` when you want
* the dot and its label together.
*/
-function StatusDot({ status, className }: { status: string; className?: string }) {
- const tone = statusToneMap[status] ?? 'neutral'
+function StatusDot({
+ status,
+ tone: toneOverride,
+ className,
+}: {
+ status: string
+ tone?: StatusTone
+ className?: string
+}) {
+ const tone = toneOverride ?? statusToneMap[status] ?? 'neutral'
return (
<span
aria-hidden
@@ -188,14 +203,21 @@ function StatusDot({ status, className }: { status: string; className?: string }
* Stays headless: pass a translated `label` from the app layer; without one it
* humanizes the code itself (`balance_due` → `balance due`) as a best-effort
* fallback.
+ *
+ * `tone` overrides the shared map, for the rare code that means different
+ * things in two domains — a `received` return still owes a refund, a
+ * `received` stock transfer is finished. Reach for it only then: everything
+ * else belongs in `statusToneMap`, or two surfaces will disagree.
*/
function StatusBadge({
status,
label,
+ tone,
className,
}: {
status: string
label?: string
+ tone?: StatusTone
className?: string
}) {
return (
@@ -207,7 +229,7 @@ function StatusBadge({
className,
)}
>
- <StatusDot status={status} />
+ <StatusDot status={status} tone={tone} />
{label ?? status.replace(/_/g, ' ')}
</span>
)
diff --git a/packages/dashboard/src/components/spree/inventory-status-badge.tsx b/packages/dashboard/src/components/spree/inventory-status-badge.tsx
new file mode 100644
index 0000000000..da90f148dd
--- /dev/null
+++ b/packages/dashboard/src/components/spree/inventory-status-badge.tsx
@@ -0,0 +1,27 @@
+import { StatusBadge } from '@spree/dashboard-ui'
+import { useTranslation } from 'react-i18next'
+
+/**
+ * A stock transfer's or purchase order's status.
+ *
+ * `received` gets an explicit success tone: the shared tone map reads that code
+ * as a return awaiting a refund, which is amber, and a finished transfer is
+ * not amber.
+ */
+export function InventoryStatusBadge({
+ status,
+ resource,
+}: {
+ status: string
+ resource: 'stock_transfers' | 'purchase_orders'
+}) {
+ const { t } = useTranslation()
+
+ return (
+ <StatusBadge
+ status={status}
+ label={t(`admin.${resource}.statuses.${status}`)}
+ tone={status === 'received' ? 'success' : undefined}
+ />
+ )
+}
diff --git a/packages/dashboard/src/components/spree/stock-history-card.tsx b/packages/dashboard/src/components/spree/stock-history-card.tsx
new file mode 100644
index 0000000000..385521d898
--- /dev/null
+++ b/packages/dashboard/src/components/spree/stock-history-card.tsx
@@ -0,0 +1,160 @@
+import type { StockMovement } from '@spree/admin-sdk'
+import { adminClient, useResourceKey } from '@spree/dashboard-core'
+import {
+ Card,
+ CardContent,
+ CardHeader,
+ CardTitle,
+ Pagination,
+ RelativeTime,
+ StatusBadge,
+ Table,
+ TableBody,
+ TableCell,
+ TableHead,
+ TableHeader,
+ TableRow,
+} from '@spree/dashboard-ui'
+import { useQuery } from '@tanstack/react-query'
+import { useState } from 'react'
+import { useTranslation } from 'react-i18next'
+
+/**
+ * Why the on-hand number is what it is.
+ *
+ * Movement history is only ever read in the context of a variant or a
+ * warehouse — "why is this SKU 47?" and "what changed in Brooklyn this week?"
+ * are the questions merchants actually ask, and the legacy admin's
+ * undifferentiated firehose answered neither
+ * (docs/plans/6.0-inventory-operations.md). So this is a panel, never a page.
+ */
+export function StockHistoryCard({
+ variantIds,
+ stockLocationId,
+ title,
+}: {
+ /** One SKU's history, or a product's across all of its variants. */
+ variantIds?: string[]
+ stockLocationId?: string | null
+ title?: string
+}) {
+ const { t } = useTranslation()
+ const [page, setPage] = useState(1)
+
+ // Movements carry no variant or location of their own — they hang off a
+ // stock level, which is the (variant, warehouse) pair — so both filters
+ // reach through it.
+ const filter = variantIds
+ ? { stock_level_variant_id_in: variantIds }
+ : { stock_level_stock_location_id_eq: stockLocationId }
+
+ const scopeKey = variantIds ? variantIds.join(',') : (stockLocationId ?? '')
+
+ const { data, isLoading } = useQuery({
+ queryKey: useResourceKey('stock-movements', `${scopeKey}-${page}`),
+ queryFn: () => adminClient.stockMovements.list({ page, limit: 10, ...filter }),
+ enabled: variantIds ? variantIds.length > 0 : !!stockLocationId,
+ })
+
+ const movements = data?.data ?? []
+
+ return (
+ <Card>
+ <CardHeader>
+ <CardTitle>{title ?? t('admin.stock_history.title')}</CardTitle>
+ </CardHeader>
+ <CardContent>
+ {isLoading ? (
+ <p className="text-sm text-muted-foreground">{t('admin.common.loading')}</p>
+ ) : movements.length === 0 ? (
+ <p className="text-sm text-muted-foreground">{t('admin.stock_history.empty')}</p>
+ ) : (
+ <>
+ <div className="overflow-x-auto">
+ <Table>
+ <TableHeader>
+ <TableRow>
+ <TableHead>{t('admin.stock_history.columns.when')}</TableHead>
+ <TableHead>{t('admin.stock_history.columns.change')}</TableHead>
+ <TableHead>{t('admin.stock_history.columns.kind')}</TableHead>
+ <TableHead>{t('admin.stock_history.columns.cause')}</TableHead>
+ </TableRow>
+ </TableHeader>
+ <TableBody>
+ {movements.map((movement) => (
+ <TableRow key={movement.id}>
+ <TableCell className="whitespace-nowrap text-sm text-muted-foreground">
+ <RelativeTime iso={movement.created_at} />
+ </TableCell>
+ <TableCell className="tabular-nums font-medium">
+ <QuantityChange movement={movement} />
+ </TableCell>
+ <TableCell>
+ {movement.kind ? (
+ <StatusBadge
+ status={movement.kind}
+ label={t(`admin.stock_history.kinds.${movement.kind}`)}
+ />
+ ) : (
+ '—'
+ )}
+ </TableCell>
+ <TableCell className="text-sm">
+ <MovementCause movement={movement} />
+ </TableCell>
+ </TableRow>
+ ))}
+ </TableBody>
+ </Table>
+ </div>
+ {data?.meta && <Pagination meta={data.meta} onPageChange={setPage} />}
+ </>
+ )}
+ </CardContent>
+ </Card>
+ )
+}
+
+/**
+ * The direction lives in the kind, not the sign: `shipped` rows are stored
+ * positive and read as a departure, while `adjusted` keeps whatever sign the
+ * merchant's correction had.
+ */
+function QuantityChange({ movement }: { movement: StockMovement }) {
+ const leaves = movement.kind === 'shipped'
+ const magnitude = Math.abs(movement.quantity)
+ const signed =
+ movement.kind === 'adjusted' && movement.quantity < 0
+ ? -magnitude
+ : leaves
+ ? -magnitude
+ : magnitude
+
+ return (
+ <span className={signed < 0 ? 'text-danger' : 'text-success'}>
+ {signed > 0 ? `+${signed}` : signed}
+ </span>
+ )
+}
+
+/** What caused the change, in the merchant's own vocabulary. */
+function MovementCause({ movement }: { movement: StockMovement }) {
+ const { t } = useTranslation()
+
+ if (movement.purchase_order_id) {
+ return <span>{t('admin.stock_history.causes.purchase_order')}</span>
+ }
+ if (movement.stock_transfer_id) {
+ return <span>{t('admin.stock_history.causes.stock_transfer')}</span>
+ }
+ if (movement.return_id) return <span>{t('admin.stock_history.causes.return')}</span>
+ if (movement.exchange_id) return <span>{t('admin.stock_history.causes.exchange')}</span>
+ if (movement.fulfillment_id) return <span>{t('admin.stock_history.causes.fulfillment')}</span>
+ if (movement.order_id) return <span>{t('admin.stock_history.causes.order')}</span>
+
+ return (
+ <span className="text-muted-foreground">
+ {movement.reason ?? t('admin.stock_history.causes.manual')}
+ </span>
+ )
+}
diff --git a/packages/dashboard/src/components/spree/variant-line-editor.tsx b/packages/dashboard/src/components/spree/variant-line-editor.tsx
new file mode 100644
index 0000000000..29b2e9d469
--- /dev/null
+++ b/packages/dashboard/src/components/spree/variant-line-editor.tsx
@@ -0,0 +1,186 @@
+import type { Variant } from '@spree/admin-sdk'
+import { adminClient, formatPrice, ResourceCombobox } from '@spree/dashboard-core'
+import {
+ Button,
+ Field,
+ FieldLabel,
+ Input,
+ InputGroup,
+ InputGroupAddon,
+ InputGroupInput,
+ InputGroupText,
+ Table,
+ TableBody,
+ TableCell,
+ TableHead,
+ TableHeader,
+ TableRow,
+} from '@spree/dashboard-ui'
+import { TrashIcon } from '@spree/dashboard-ui/icons'
+import { useRef } from 'react'
+import { useTranslation } from 'react-i18next'
+
+/** One SKU the merchant is putting on a transfer or a purchase order. */
+export interface VariantLine {
+ variant: Variant
+ quantity: number
+ /** Only purchase orders have a cost; transfers move stock already owned. */
+ unitCost?: string
+}
+
+/**
+ * Picks SKUs and their quantities for a draft inventory document.
+ *
+ * Shared by the new-transfer and new-purchase-order screens: both pick a
+ * variant, both count units, and only the purchase order asks what they cost.
+ */
+export function VariantLineEditor({
+ lines,
+ onChange,
+ currency,
+ quantityLabel,
+ withCost = false,
+}: {
+ lines: VariantLine[]
+ onChange: (lines: VariantLine[]) => void
+ /** Currency symbol context for the cost column; purchase orders only. */
+ currency?: string
+ quantityLabel: string
+ withCost?: boolean
+}) {
+ const { t } = useTranslation()
+ // `onChange` hands back only the option id, so keep the records the search
+ // returned to resolve it. A ref, not state: it is a lookup table.
+ const variantById = useRef(new Map<string, Variant>())
+
+ function addVariant(variant: Variant) {
+ const existing = lines.find((line) => line.variant.id === variant.id)
+ if (existing) {
+ onChange(
+ lines.map((line) =>
+ line.variant.id === variant.id ? { ...line, quantity: line.quantity + 1 } : line,
+ ),
+ )
+ return
+ }
+ onChange([...lines, { variant, quantity: 1, unitCost: withCost ? '0.00' : undefined }])
+ }
+
+ function update(variantId: string, patch: Partial<VariantLine>) {
+ onChange(lines.map((line) => (line.variant.id === variantId ? { ...line, ...patch } : line)))
+ }
+
+ function remove(variantId: string) {
+ onChange(lines.filter((line) => line.variant.id !== variantId))
+ }
+
+ return (
+ <div className="flex flex-col gap-4">
+ <Field>
+ <FieldLabel>{t('admin.inventory_lines.add_label')}</FieldLabel>
+ {/* Combobox rather than a bare input over a list of buttons:
+ arrow-key navigation, `aria-activedescendant` and Enter-to-pick
+ come from the primitive. Selecting adds the row and clears the
+ field, so no value is held. */}
+ <ResourceCombobox<Variant>
+ queryKey="inventory-line-variant-picker"
+ value=""
+ onChange={(id) => {
+ const variant = id ? variantById.current.get(id) : undefined
+ if (variant) addVariant(variant)
+ }}
+ search={async (query) => {
+ const res = await adminClient.variants.list({ search: query, limit: 8 })
+ for (const variant of res.data) variantById.current.set(variant.id, variant)
+ return res
+ }}
+ hydrate={async () => ({ data: [] })}
+ getOptionLabel={(variant) => variant.product_name ?? variant.sku ?? variant.id}
+ renderOption={(variant) => (
+ <div className="flex flex-col">
+ <span className="font-medium">
+ {variant.product_name ?? variant.sku ?? variant.id}
+ </span>
+ <span className="text-xs text-muted-foreground">
+ {t('admin.inventory_lines.columns.sku')} {variant.sku} ·{' '}
+ {formatPrice(variant.price)}
+ </span>
+ </div>
+ )}
+ placeholder={t('admin.inventory_lines.search_placeholder')}
+ />
+ </Field>
+
+ {lines.length > 0 && (
+ <div className="overflow-x-auto rounded-md border">
+ <Table>
+ <TableHeader>
+ <TableRow>
+ <TableHead>{t('admin.inventory_lines.columns.variant')}</TableHead>
+ <TableHead>{t('admin.inventory_lines.columns.sku')}</TableHead>
+ <TableHead className="text-right">{quantityLabel}</TableHead>
+ {withCost && (
+ <TableHead className="text-right">
+ {t('admin.inventory_lines.columns.unit_cost')}
+ </TableHead>
+ )}
+ <TableHead className="w-10" />
+ </TableRow>
+ </TableHeader>
+ <TableBody>
+ {lines.map(({ variant, quantity, unitCost }) => (
+ <TableRow key={variant.id}>
+ <TableCell className="font-medium">
+ {variant.product_name ?? variant.sku ?? variant.id}
+ </TableCell>
+ <TableCell className="text-muted-foreground">{variant.sku}</TableCell>
+ <TableCell className="text-right">
+ <Input
+ type="number"
+ min={1}
+ value={quantity}
+ onChange={(event) =>
+ update(variant.id, { quantity: Number(event.target.value) })
+ }
+ className="ml-auto w-20 text-right tabular-nums"
+ aria-label={quantityLabel}
+ />
+ </TableCell>
+ {withCost && (
+ <TableCell className="text-right">
+ <InputGroup className="ml-auto w-36">
+ <InputGroupAddon>
+ <InputGroupText>{currency ?? ''}</InputGroupText>
+ </InputGroupAddon>
+ <InputGroupInput
+ type="number"
+ min={0}
+ step="0.01"
+ value={unitCost ?? ''}
+ onChange={(event) => update(variant.id, { unitCost: event.target.value })}
+ className="text-right tabular-nums"
+ aria-label={t('admin.inventory_lines.columns.unit_cost')}
+ />
+ </InputGroup>
+ </TableCell>
+ )}
+ <TableCell className="text-right">
+ <Button
+ type="button"
+ size="icon-xs"
+ variant="ghost"
+ onClick={() => remove(variant.id)}
+ >
+ <TrashIcon className="size-4" />
+ <span className="sr-only">{t('admin.actions.remove')}</span>
+ </Button>
+ </TableCell>
+ </TableRow>
+ ))}
+ </TableBody>
+ </Table>
+ </div>
+ )}
+ </div>
+ )
+}
diff --git a/packages/dashboard/src/hooks/use-purchase-orders.ts b/packages/dashboard/src/hooks/use-purchase-orders.ts
new file mode 100644
index 0000000000..8b18bd81b5
--- /dev/null
+++ b/packages/dashboard/src/hooks/use-purchase-orders.ts
@@ -0,0 +1,91 @@
+import type {
+ PurchaseOrder,
+ PurchaseOrderCreateParams,
+ PurchaseOrderReceiveParams,
+ PurchaseOrderUpdateParams,
+} from '@spree/admin-sdk'
+import {
+ adminClient,
+ useResourceKey,
+ useResourceKeyBuilder,
+ useResourceMutation,
+} from '@spree/dashboard-core'
+import { useQuery, useQueryClient } from '@tanstack/react-query'
+import i18n from 'i18next'
+
+/** The lines carry the costs, and the supplier is the document's counterparty. */
+const DETAIL_EXPAND = ['items', 'supplier', 'destination_location']
+
+export function usePurchaseOrder(id: string | undefined) {
+ return useQuery({
+ queryKey: useResourceKey('purchase-orders', id ?? 'noop'),
+ queryFn: () => adminClient.purchaseOrders.get(id as string, { expand: DETAIL_EXPAND }),
+ enabled: !!id,
+ })
+}
+
+export function useCreatePurchaseOrder() {
+ return useResourceMutation<PurchaseOrder, Error, PurchaseOrderCreateParams>({
+ mutationFn: (params) => adminClient.purchaseOrders.create(params),
+ invalidate: [['purchase-orders']],
+ successMessage: i18n.t('admin.purchase_orders.messages.created'),
+ errorMessage: i18n.t('admin.purchase_orders.errors.failed_to_create'),
+ })
+}
+
+export function useUpdatePurchaseOrder(id: string) {
+ return useResourceMutation<PurchaseOrder, Error, PurchaseOrderUpdateParams>({
+ mutationFn: (params) => adminClient.purchaseOrders.update(id, params),
+ invalidate: [['purchase-orders'], ['purchase-orders', id]],
+ successMessage: i18n.t('admin.purchase_orders.messages.saved'),
+ errorMessage: i18n.t('admin.purchase_orders.errors.failed_to_save'),
+ })
+}
+
+export function useDeletePurchaseOrder() {
+ const queryClient = useQueryClient()
+ const buildKey = useResourceKeyBuilder()
+
+ return useResourceMutation<void, Error, string>({
+ mutationFn: (id) => adminClient.purchaseOrders.delete(id),
+ invalidate: [['purchase-orders']],
+ successMessage: i18n.t('admin.purchase_orders.messages.deleted'),
+ errorMessage: i18n.t('admin.purchase_orders.errors.failed_to_delete'),
+ onSuccess: (_data, id) => {
+ queryClient.removeQueries({ queryKey: buildKey('purchase-orders', id) })
+ },
+ })
+}
+
+export function useMarkPurchaseOrderOrdered(id: string) {
+ return useResourceMutation<PurchaseOrder, Error, void>({
+ mutationFn: () => adminClient.purchaseOrders.markOrdered(id),
+ invalidate: [['purchase-orders'], ['purchase-orders', id]],
+ successMessage: i18n.t('admin.purchase_orders.messages.ordered'),
+ errorMessage: i18n.t('admin.purchase_orders.errors.failed_to_order'),
+ })
+}
+
+/** The first moment purchased goods count toward availability. */
+export function useReceivePurchaseOrder(id: string) {
+ return useResourceMutation<PurchaseOrder, Error, PurchaseOrderReceiveParams | undefined>({
+ mutationFn: (params) => adminClient.purchaseOrders.receive(id, params ?? undefined),
+ invalidate: [
+ ['purchase-orders'],
+ ['purchase-orders', id],
+ ['stock-levels'],
+ ['stock-movements'],
+ ],
+ successMessage: i18n.t('admin.purchase_orders.messages.received'),
+ errorMessage: i18n.t('admin.purchase_orders.errors.failed_to_receive'),
+ })
+}
+
+export function useCancelPurchaseOrder(id: string) {
+ return useResourceMutation<PurchaseOrder, Error, { reason?: string } | undefined>({
+ mutationFn: (params) => adminClient.purchaseOrders.cancel(id, params ?? undefined),
+ invalidate: [['purchase-orders'], ['purchase-orders', id]],
+ successMessage: i18n.t('admin.purchase_orders.messages.canceled'),
+ errorMessage: i18n.t('admin.purchase_orders.errors.failed_to_cancel'),
+ })
+}
diff --git a/packages/dashboard/src/hooks/use-stock-transfers.ts b/packages/dashboard/src/hooks/use-stock-transfers.ts
index 765e44743f..a92281e158 100644
--- a/packages/dashboard/src/hooks/use-stock-transfers.ts
+++ b/packages/dashboard/src/hooks/use-stock-transfers.ts
@@ -1,4 +1,10 @@
-import type { StockTransfer, StockTransferCreateParams } from '@spree/admin-sdk'
+import type {
+ StockTransfer,
+ StockTransferCancelParams,
+ StockTransferCreateParams,
+ StockTransferReceiveParams,
+ StockTransferUpdateParams,
+} from '@spree/admin-sdk'
import {
adminClient,
useResourceKey,
@@ -8,13 +14,13 @@ import {
import { useQuery, useQueryClient } from '@tanstack/react-query'
import i18n from 'i18next'
+/** The lines and both warehouses: a transfer is unreadable without them. */
+const DETAIL_EXPAND = ['items', 'source_location', 'destination_location']
+
export function useStockTransfer(id: string | undefined) {
return useQuery({
queryKey: useResourceKey('stock-transfers', id ?? 'noop'),
- queryFn: () =>
- adminClient.stockTransfers.get(id as string, {
- expand: ['source_location', 'destination_location'],
- }),
+ queryFn: () => adminClient.stockTransfers.get(id as string, { expand: DETAIL_EXPAND }),
enabled: !!id,
})
}
@@ -23,8 +29,17 @@ export function useCreateStockTransfer() {
return useResourceMutation<StockTransfer, Error, StockTransferCreateParams>({
mutationFn: (params) => adminClient.stockTransfers.create(params),
invalidate: [['stock-transfers']],
- successMessage: i18n.t('admin.stock_transfers.messages.recorded'),
- errorMessage: i18n.t('admin.stock_transfers.errors.failed_to_record'),
+ successMessage: i18n.t('admin.stock_transfers.messages.created'),
+ errorMessage: i18n.t('admin.stock_transfers.errors.failed_to_create'),
+ })
+}
+
+export function useUpdateStockTransfer(id: string) {
+ return useResourceMutation<StockTransfer, Error, StockTransferUpdateParams>({
+ mutationFn: (params) => adminClient.stockTransfers.update(id, params),
+ invalidate: [['stock-transfers'], ['stock-transfers', id]],
+ successMessage: i18n.t('admin.stock_transfers.messages.saved'),
+ errorMessage: i18n.t('admin.stock_transfers.errors.failed_to_save'),
})
}
@@ -42,3 +57,58 @@ export function useDeleteStockTransfer() {
},
})
}
+
+export function useMarkStockTransferReady(id: string) {
+ return useResourceMutation<StockTransfer, Error, void>({
+ mutationFn: () => adminClient.stockTransfers.markReady(id),
+ invalidate: [['stock-transfers'], ['stock-transfers', id]],
+ successMessage: i18n.t('admin.stock_transfers.messages.marked_ready'),
+ errorMessage: i18n.t('admin.stock_transfers.errors.failed_to_mark_ready'),
+ })
+}
+
+/**
+ * Stock leaves the source warehouse here, so the stock queries a merchant may
+ * be looking at go stale too.
+ */
+export function useMarkStockTransferInTransit(id: string) {
+ return useResourceMutation<StockTransfer, Error, { force?: boolean } | undefined>({
+ mutationFn: (params) => adminClient.stockTransfers.markInTransit(id, params ?? undefined),
+ invalidate: [
+ ['stock-transfers'],
+ ['stock-transfers', id],
+ ['stock-levels'],
+ ['stock-movements'],
+ ],
+ successMessage: i18n.t('admin.stock_transfers.messages.marked_in_transit'),
+ errorMessage: i18n.t('admin.stock_transfers.errors.failed_to_mark_in_transit'),
+ })
+}
+
+export function useReceiveStockTransfer(id: string) {
+ return useResourceMutation<StockTransfer, Error, StockTransferReceiveParams | undefined>({
+ mutationFn: (params) => adminClient.stockTransfers.receive(id, params ?? undefined),
+ invalidate: [
+ ['stock-transfers'],
+ ['stock-transfers', id],
+ ['stock-levels'],
+ ['stock-movements'],
+ ],
+ successMessage: i18n.t('admin.stock_transfers.messages.received'),
+ errorMessage: i18n.t('admin.stock_transfers.errors.failed_to_receive'),
+ })
+}
+
+export function useCancelStockTransfer(id: string) {
+ return useResourceMutation<StockTransfer, Error, StockTransferCancelParams | undefined>({
+ mutationFn: (params) => adminClient.stockTransfers.cancel(id, params ?? undefined),
+ invalidate: [
+ ['stock-transfers'],
+ ['stock-transfers', id],
+ ['stock-levels'],
+ ['stock-movements'],
+ ],
+ successMessage: i18n.t('admin.stock_transfers.messages.canceled'),
+ errorMessage: i18n.t('admin.stock_transfers.errors.failed_to_cancel'),
+ })
+}
diff --git a/packages/dashboard/src/hooks/use-suppliers.ts b/packages/dashboard/src/hooks/use-suppliers.ts
new file mode 100644
index 0000000000..0fdf014aa8
--- /dev/null
+++ b/packages/dashboard/src/hooks/use-suppliers.ts
@@ -0,0 +1,57 @@
+import type { Supplier, SupplierCreateParams, SupplierUpdateParams } from '@spree/admin-sdk'
+import {
+ adminClient,
+ useResourceKey,
+ useResourceKeyBuilder,
+ useResourceMutation,
+} from '@spree/dashboard-core'
+import { useQuery, useQueryClient } from '@tanstack/react-query'
+import i18n from 'i18next'
+
+export function useSuppliers(params?: { limit?: number; search?: string }) {
+ return useQuery({
+ queryKey: useResourceKey('suppliers', JSON.stringify(params ?? {})),
+ queryFn: () => adminClient.suppliers.list(params),
+ })
+}
+
+export function useSupplier(id: string | undefined) {
+ return useQuery({
+ queryKey: useResourceKey('suppliers', id ?? 'noop'),
+ queryFn: () => adminClient.suppliers.get(id as string),
+ enabled: !!id,
+ })
+}
+
+export function useCreateSupplier() {
+ return useResourceMutation<Supplier, Error, SupplierCreateParams>({
+ mutationFn: (params) => adminClient.suppliers.create(params),
+ invalidate: [['suppliers']],
+ successMessage: i18n.t('admin.suppliers.messages.created'),
+ errorMessage: i18n.t('admin.suppliers.errors.failed_to_create'),
+ })
+}
+
+export function useUpdateSupplier(id: string) {
+ return useResourceMutation<Supplier, Error, SupplierUpdateParams>({
+ mutationFn: (params) => adminClient.suppliers.update(id, params),
+ invalidate: [['suppliers'], ['suppliers', id]],
+ successMessage: i18n.t('admin.suppliers.messages.saved'),
+ errorMessage: i18n.t('admin.suppliers.errors.failed_to_save'),
+ })
+}
+
+export function useDeleteSupplier() {
+ const queryClient = useQueryClient()
+ const buildKey = useResourceKeyBuilder()
+
+ return useResourceMutation<void, Error, string>({
+ mutationFn: (id) => adminClient.suppliers.delete(id),
+ invalidate: [['suppliers']],
+ successMessage: i18n.t('admin.suppliers.messages.deleted'),
+ errorMessage: i18n.t('admin.suppliers.errors.failed_to_delete'),
+ onSuccess: (_data, id) => {
+ queryClient.removeQueries({ queryKey: buildKey('suppliers', id) })
+ },
+ })
+}
diff --git a/packages/dashboard/src/locales/ar.json b/packages/dashboard/src/locales/ar.json
index 8d68d3ab73..831d905d5f 100644
--- a/packages/dashboard/src/locales/ar.json
+++ b/packages/dashboard/src/locales/ar.json
@@ -2141,6 +2141,17 @@
},
"digital_asset_authorized_days": {
"label": "الأيام المتاحة"
+ },
+ "preferred_default_package_dimensions": {
+ "height": "الارتفاع",
+ "help": "الصندوق المعتاد للشحن، تستخدمه شركات النقل لتسعير الوزن الحجمي — بوصات للنظام الإمبراطوري وسنتيمترات للمتري. تلزم القيم الثلاث ليصبح ساريًا.",
+ "label": "أبعاد الطرد الافتراضية",
+ "length": "الطول",
+ "width": "العرض"
+ },
+ "preferred_default_package_weight": {
+ "help": "وزن التغليف (الصندوق والحشو) الذي يُضاف إلى محتويات كل طرد عند حساب أسعار التوصيل. اضبطه على 0 للتعطيل.",
+ "label": "الوزن الافتراضي للطرد"
}
},
"store_credit": {
@@ -2590,7 +2601,8 @@
"sellers": "البائعون",
"settings": "الإعدادات",
"transfers": "التحويلات",
- "translations": "الترجمات"
+ "translations": "الترجمات",
+ "purchase_orders": "أوامر الشراء"
},
"option_types": {
"columns": {
@@ -3717,7 +3729,9 @@
"tab_storefront_access": "الوصول إلى المتجر",
"title": "إعدادات المتجر",
"tab_downloads": "التنزيلات الرقمية",
- "downloads_help": "مدة صلاحية رابط التنزيل وعدد مرات استخدامه. يمكن لكل ملف تجاوز هذه القيم."
+ "downloads_help": "مدة صلاحية رابط التنزيل وعدد مرات استخدامه. يمكن لكل ملف تجاوز هذه القيم.",
+ "default_package_description": "الصندوق المعتاد للشحن. يضيف مزوّدو أسعار النقل وزنه إلى كل طرد ويستخدمون أبعاده لتسعير الوزن الحجمي.",
+ "tab_default_package": "الطرد الافتراضي"
},
"tax_categories": {
"add_sheet_title": "إضافة فئة الضريبة",
@@ -4894,7 +4908,8 @@
"tax_rates": "النسب المطبقة حسب السوق والمنطقة",
"webhooks": "نقاط النهاية التي تُخطر عند وقوع الأحداث",
"payouts": "من يدفع لبائعيك، وكم مرة، والحد الأدنى الذي يستحق الإرسال",
- "package_types": "صناديق وكراتين ومنصات وحاويات"
+ "package_types": "صناديق وكراتين ومنصات وحاويات",
+ "suppliers": "من تشتري منه المخزون، وكيفية التواصل معه"
},
"groups": {
"audit": "التدقيق",
@@ -4931,7 +4946,8 @@
"tax_rates": "نسب الضريبة",
"webhooks": "Webhooks",
"payouts": "المدفوعات",
- "package_types": "أنواع التغليف"
+ "package_types": "أنواع التغليف",
+ "suppliers": "الموردون"
}
},
"setup": {
@@ -5049,25 +5065,105 @@
"columns": {
"direction": "اتجاه",
"number": "رقم",
- "reference": "مرجع"
+ "reference": "مرجع",
+ "units": "المستلَم / المُرسَل",
+ "shipped": "تاريخ الإرسال",
+ "quantity_shipped": "المُرسَل",
+ "quantity_received": "المستلَم",
+ "discrepancy": "الفرق"
},
"direction": {
"external_receive": "استلام خارجي",
"internal": "نقل بين المواقع"
},
"errors": {
- "failed_to_delete": "فشل في حذف نقل المخزون",
- "failed_to_record": "فشل في تسجيل نقل المخزون"
+ "failed_to_delete": "تعذّر حذف التحويل",
+ "failed_to_record": "فشل في تسجيل نقل المخزون",
+ "same_location": "يجب أن يكون المستودعان مختلفين.",
+ "failed_to_create": "تعذّر إنشاء التحويل",
+ "failed_to_save": "تعذّر حفظ التحويل",
+ "failed_to_mark_ready": "تعذّر تعيين التحويل كجاهز للإرسال",
+ "failed_to_mark_in_transit": "تعذّر تعيين التحويل كفي الطريق",
+ "failed_to_receive": "تعذّر استلام التحويل",
+ "failed_to_cancel": "تعذّر إلغاء التحويل"
},
"messages": {
- "deleted": "تم حذف نقل المخزون",
- "recorded": "تم تسجيل نقل المخزون"
+ "deleted": "تم حذف التحويل",
+ "recorded": "تم تسجيل نقل المخزون",
+ "created": "تم إنشاء التحويل",
+ "saved": "تم حفظ التحويل",
+ "marked_ready": "التحويل جاهز للإرسال",
+ "marked_in_transit": "التحويل في الطريق — غادرت الوحدات المستودع المصدر",
+ "received": "تم استلام التحويل",
+ "canceled": "تم إلغاء التحويل"
},
"table": {
"empty": "لا يوجد تحويلات الأسهم حتى الآن",
"search_placeholder": "البحث بالرقم أو المرجع…"
},
- "title": "Stock Transfers"
+ "title": "Stock Transfers",
+ "new_cta": "تحويل جديد",
+ "new_title": "تحويل مخزون جديد",
+ "details_title": "التفاصيل",
+ "items_title": "البنود",
+ "items_empty": "لا توجد بنود بعد — أضف منتجًا لإرساله.",
+ "receive_title": "الاستلام",
+ "actions_title": "الإجراءات",
+ "history_title": "الحركة في المستودع المستقبِل",
+ "units_summary": "تم استلام {{received}} من {{shipped}} وحدة مُرسَلة",
+ "receive_running_total": "تم عدّ {{counted}} من {{shipped}} وحدة مُرسَلة",
+ "discrepancy_placeholder": "سبب نقص الكمية الواصلة",
+ "statuses": {
+ "draft": "مسودة",
+ "ready_to_ship": "جاهز للإرسال",
+ "in_transit": "في الطريق",
+ "partially_received": "مستلَم جزئيًا",
+ "received": "مستلَم",
+ "canceled": "ملغى"
+ },
+ "discrepancy_reasons": {
+ "damaged_in_transit": "تضرر أثناء النقل",
+ "lost_in_transit": "فُقد أثناء النقل",
+ "undercount": "خطأ في العدّ عند الإرسال"
+ },
+ "in_transit_resolutions": {
+ "restock": "إرجاع الوحدات إلى المستودع المصدر",
+ "write_off": "شطب الوحدات كخسارة"
+ },
+ "fields": {
+ "source": "من",
+ "source_placeholder": "اختر المستودع المُرسِل",
+ "destination": "إلى",
+ "destination_placeholder": "اختر المستودع المستقبِل",
+ "reference": "المرجع",
+ "reference_placeholder": "التسمية الخاصة بك لهذه الرحلة",
+ "notes": "ملاحظات",
+ "units": "الوحدات",
+ "shipped_at": "تاريخ الإرسال",
+ "received_at": "تاريخ الاستلام",
+ "in_transit_resolution": "الوحدات غادرت المستودع بالفعل. ماذا حدث لها؟"
+ },
+ "actions": {
+ "create_draft": "إنشاء مسودة",
+ "mark_ready": "تعيين كجاهز للإرسال",
+ "mark_in_transit": "تعيين كفي الطريق",
+ "receive": "استلام",
+ "cancel_transfer": "إلغاء التحويل"
+ },
+ "delete_confirm": {
+ "title": "حذف هذا التحويل؟",
+ "message": "التحويل {{number}} لا يزال مسودة، لذا لم يتحرك أي مخزون. لا يمكن التراجع عن هذا."
+ },
+ "ship_confirm": {
+ "title": "إرسال هذا التحويل؟",
+ "message": "ستغادر {{count}} وحدة المستودع المصدر الآن ولن تكون متاحة فيه حتى وصولها."
+ },
+ "cancel_confirm": {
+ "title": "إلغاء هذا التحويل؟",
+ "message": "لم يتحرك أي مخزون بعد، لذا لن يُعاد أي شيء.",
+ "in_flight_restock": "ستعود الوحدات إلى رفّ المستودع المصدر، كأن التحويل لم يُرسَل أبدًا.",
+ "in_flight_write_off": "تبقى الوحدات مشطوبة كخسارة. لن يُضاف أي شيء في أي مكان."
+ }
},
"store": {
"load_failed_title": "فشل تحميل إعدادات المتجر",
@@ -5092,7 +5188,9 @@
"options": "خيارات مثل المقاس أو اللون تُحوِّل المنتج إلى تنويعات.",
"price_lists": "أسعار بديلة تُطبَّق عند تحقق قواعدها.",
"product_types": "قوالب تمنح المنتجات الجديدة حقولها وخياراتها.",
- "stock_transfers": "المخزون المنقول بين مواقعك، وما وصل منه."
+ "stock_transfers": "المخزون المنقول بين مواقعك، وما وصل منه.",
+ "purchase_orders": "المخزون الذي طلبته من الموردين، وما وصل منه",
+ "suppliers": "دفتر عناوين الموردين"
},
"tax_categories": {
"add_cta": "إضافة فئة الضريبة",
@@ -5341,6 +5439,163 @@
"message": "يجمع كل ما هو مستحق لـ {{name}} في دفعة واحدة لكل عملة. لا يتم إرسال أي أموال — ضع علامة مدفوعة على الدفعة بعد تنفيذ التحويل."
},
"settle_failed": "تعذرت تسوية هذا البائع."
+ },
+ "inventory_lines": {
+ "add_label": "إضافة منتج",
+ "search_placeholder": "ابحث عن المنتجات بالاسم أو رمز SKU…",
+ "columns": {
+ "variant": "المنتج",
+ "sku": "رمز SKU",
+ "unit_cost": "تكلفة الوحدة"
+ }
+ },
+ "stock_history": {
+ "title": "سجل المخزون",
+ "empty": "لم يتغير هذا المخزون بعد",
+ "columns": {
+ "when": "الوقت",
+ "change": "التغيير",
+ "kind": "ما حدث",
+ "cause": "السبب"
+ },
+ "kinds": {
+ "received": "تم الاستلام",
+ "allocated": "تم التخصيص",
+ "shipped": "تم الإرسال",
+ "released": "تم التحرير",
+ "adjusted": "تم التعديل"
+ },
+ "causes": {
+ "purchase_order": "أمر شراء",
+ "stock_transfer": "تحويل مخزون",
+ "return": "إرجاع",
+ "exchange": "استبدال",
+ "fulfillment": "تنفيذ الطلب",
+ "order": "طلب",
+ "manual": "تعديل يدوي"
+ }
+ },
+ "purchase_orders": {
+ "title": "أوامر الشراء",
+ "new_cta": "أمر شراء جديد",
+ "new_title": "أمر شراء جديد",
+ "details_title": "التفاصيل",
+ "items_title": "البنود",
+ "items_empty": "لا توجد بنود بعد — أضف منتجًا لطلبه.",
+ "receive_title": "الاستلام",
+ "actions_title": "الإجراءات",
+ "history_title": "الحركة في المستودع المستقبِل",
+ "units_summary": "تم استلام {{received}} من {{ordered}} وحدة مطلوبة",
+ "receive_running_total": "تم عدّ {{counted}} من {{ordered}} وحدة مطلوبة",
+ "table": {
+ "empty": "لا توجد أوامر شراء بعد",
+ "search_placeholder": "ابحث بالرقم أو المرجع…"
+ },
+ "columns": {
+ "number": "الرقم",
+ "supplier": "المورد",
+ "units": "المستلَم / المطلوب",
+ "subtotal": "الإجمالي",
+ "expected": "متوقع",
+ "quantity_ordered": "المطلوب",
+ "quantity_received": "المستلَم",
+ "line_total": "إجمالي البند"
+ },
+ "statuses": {
+ "draft": "مسودة",
+ "ordered": "مطلوب",
+ "partially_received": "مستلَم جزئيًا",
+ "received": "مستلَم",
+ "canceled": "ملغى"
+ },
+ "fields": {
+ "supplier": "المورد",
+ "supplier_placeholder": "اختر موردًا",
+ "destination": "التوصيل إلى",
+ "destination_placeholder": "اختر المستودع المستقبِل",
+ "currency": "العملة",
+ "expected_at": "متوقع",
+ "expected_at_placeholder": "اليوم الذي وعد به المورد",
+ "reference": "مرجع المورد",
+ "reference_placeholder": "رقم الطلب الخاص بالمورد",
+ "notes": "ملاحظات",
+ "units": "الوحدات",
+ "subtotal": "الإجمالي",
+ "ordered_at": "تاريخ الطلب",
+ "received_at": "تاريخ الاستلام"
+ },
+ "actions": {
+ "create_draft": "إنشاء مسودة",
+ "mark_ordered": "تعيين كمطلوب",
+ "receive": "استلام",
+ "cancel_order": "إلغاء الأمر"
+ },
+ "messages": {
+ "created": "تم إنشاء أمر الشراء",
+ "saved": "تم حفظ أمر الشراء",
+ "deleted": "تم حذف أمر الشراء",
+ "ordered": "تم إرسال أمر الشراء",
+ "received": "تم تسجيل التوريد",
+ "canceled": "تم إلغاء أمر الشراء"
+ },
+ "errors": {
+ "failed_to_create": "تعذّر إنشاء أمر الشراء",
+ "failed_to_save": "تعذّر حفظ أمر الشراء",
+ "failed_to_delete": "تعذّر حذف أمر الشراء",
+ "failed_to_order": "تعذّر إرسال أمر الشراء",
+ "failed_to_receive": "تعذّر تسجيل التوريد",
+ "failed_to_cancel": "تعذّر إلغاء أمر الشراء"
+ },
+ "delete_confirm": {
+ "title": "حذف أمر الشراء هذا؟",
+ "message": "الأمر {{number}} لا يزال مسودة، لذا لم يُطلب أي شيء. لا يمكن التراجع عن هذا."
+ },
+ "order_confirm": {
+ "title": "إرسال هذا الأمر؟",
+ "message": "تُثبَّت البنود بمجرد إرسال الأمر إلى {{supplier}}. المخزون المطلوب لا يُحتسب متاحًا إلا بعد وصوله."
+ },
+ "cancel_confirm": {
+ "title": "إلغاء أمر الشراء هذا؟",
+ "message": "يُلغى ما تبقّى غير مستلَم. الوحدات المستلَمة بالفعل تبقى في المخزون."
+ }
+ },
+ "suppliers": {
+ "title": "الموردون",
+ "new_cta": "مورد جديد",
+ "new_title": "مورد جديد",
+ "edit_title": "تعديل المورد",
+ "sheet_description": "من تشتري منه المخزون، وكيفية التواصل معه.",
+ "table": {
+ "empty": "لا يوجد موردون بعد",
+ "search_placeholder": "ابحث بالاسم أو جهة الاتصال أو البريد…"
+ },
+ "columns": {
+ "contact": "جهة الاتصال",
+ "orders": "أوامر الشراء"
+ },
+ "fields": {
+ "contact_name": "اسم جهة الاتصال",
+ "address1": "العنوان",
+ "address2": "سطر العنوان الثاني",
+ "city": "المدينة",
+ "postal_code": "الرمز البريدي",
+ "notes": "ملاحظات"
+ },
+ "messages": {
+ "created": "تم إنشاء المورد",
+ "saved": "تم حفظ المورد",
+ "deleted": "تم حذف المورد"
+ },
+ "errors": {
+ "name_blank": "يحتاج المورد إلى اسم.",
+ "failed_to_create": "تعذّر إنشاء المورد",
+ "failed_to_save": "تعذّر حفظ المورد",
+ "failed_to_delete": "تعذّر حذف المورد"
+ },
+ "delete_confirm": {
+ "title": "حذف هذا المورد؟",
+ "message": "لن يكون {{name}} متاحًا لأوامر شراء جديدة. أوامر الشراء الحالية ستظل تشير إليه."
+ }
}
}
}
diff --git a/packages/dashboard/src/locales/de.json b/packages/dashboard/src/locales/de.json
index 22c249da52..f74ea6d807 100644
--- a/packages/dashboard/src/locales/de.json
+++ b/packages/dashboard/src/locales/de.json
@@ -2123,6 +2123,17 @@
},
"digital_asset_authorized_days": {
"label": "Verfügbare Tage"
+ },
+ "preferred_default_package_dimensions": {
+ "height": "Höhe",
+ "help": "Der übliche Versandkarton, von Carrier-Tarifanbietern für Volumengewicht-Preise genutzt — Zoll bei imperial, Zentimeter bei metrisch. Wirksam nur mit allen drei Werten.",
+ "label": "Standard-Paketabmessungen",
+ "length": "Länge",
+ "width": "Breite"
+ },
+ "preferred_default_package_weight": {
+ "help": "Verpackungsgewicht (Karton und Füllmaterial), das bei der Berechnung von Versandtarifen zum Inhalt jedes Pakets addiert wird. 0 deaktiviert es.",
+ "label": "Standard-Paketgewicht"
}
},
"store_credit": {
@@ -2572,7 +2583,8 @@
"sellers": "Verkäufer",
"settings": "Einstellungen",
"transfers": "Umlagerungen",
- "translations": "Übersetzungen"
+ "translations": "Übersetzungen",
+ "purchase_orders": "Bestellungen"
},
"option_types": {
"columns": {
@@ -3700,7 +3712,9 @@
"tab_storefront_access": "Storefront-Zugriff",
"title": "Shop-Einstellungen",
"tab_downloads": "Digitale Downloads",
- "downloads_help": "Wie lange ein Download-Link gültig ist und wie oft er verwendet werden kann. Einzelne Dateien können diese Werte überschreiben."
+ "downloads_help": "Wie lange ein Download-Link gültig ist und wie oft er verwendet werden kann. Einzelne Dateien können diese Werte überschreiben.",
+ "default_package_description": "Der Karton, in dem Sie üblicherweise versenden. Carrier-Tarifanbieter addieren sein Gewicht zu jedem Paket und nutzen seine Abmessungen für Volumengewicht-Preise.",
+ "tab_default_package": "Standardpaket"
},
"tax_categories": {
"add_sheet_title": "Steuerkategorie hinzufügen",
@@ -4872,7 +4886,8 @@
"tax_rates": "Sätze pro Markt und Region",
"webhooks": "Endpunkte, die bei Ereignissen benachrichtigt werden",
"payouts": "Wer Ihre Verkäufer bezahlt, wie oft und ab welchem Betrag",
- "package_types": "Kartons, Paletten und Container"
+ "package_types": "Kartons, Paletten und Container",
+ "suppliers": "Von wem Sie Ware einkaufen und wie Sie sie erreichen"
},
"groups": {
"audit": "Audit",
@@ -4909,7 +4924,8 @@
"tax_rates": "Steuersätze",
"webhooks": "Webhooks",
"payouts": "Auszahlungen",
- "package_types": "Verpackungsarten"
+ "package_types": "Verpackungsarten",
+ "suppliers": "Lieferanten"
}
},
"setup": {
@@ -5027,25 +5043,105 @@
"columns": {
"direction": "Richtung",
"number": "Nummer",
- "reference": "Referenz"
+ "reference": "Referenz",
+ "units": "Eingegangen / versandt",
+ "shipped": "Versandt",
+ "quantity_shipped": "Versandt",
+ "quantity_received": "Eingegangen",
+ "discrepancy": "Abweichung"
},
"direction": {
"external_receive": "Externer Wareneingang",
"internal": "Umbuchung zwischen Standorten"
},
"errors": {
- "failed_to_delete": "Lagerübertrag konnte nicht gelöscht werden",
- "failed_to_record": "Lagerübertrag konnte nicht erfasst werden"
+ "failed_to_delete": "Umlagerung konnte nicht gelöscht werden",
+ "failed_to_record": "Lagerübertrag konnte nicht erfasst werden",
+ "same_location": "Die beiden Lager müssen unterschiedlich sein.",
+ "failed_to_create": "Umlagerung konnte nicht erstellt werden",
+ "failed_to_save": "Umlagerung konnte nicht gespeichert werden",
+ "failed_to_mark_ready": "Umlagerung konnte nicht als versandbereit markiert werden",
+ "failed_to_mark_in_transit": "Umlagerung konnte nicht als unterwegs markiert werden",
+ "failed_to_receive": "Wareneingang konnte nicht gebucht werden",
+ "failed_to_cancel": "Umlagerung konnte nicht abgebrochen werden"
},
"messages": {
- "deleted": "Lagerübertrag gelöscht",
- "recorded": "Lagerübertrag erfasst"
+ "deleted": "Umlagerung gelöscht",
+ "recorded": "Lagerübertrag erfasst",
+ "created": "Umlagerung erstellt",
+ "saved": "Umlagerung gespeichert",
+ "marked_ready": "Umlagerung ist versandbereit",
+ "marked_in_transit": "Umlagerung ist unterwegs – die Einheiten haben das Quelllager verlassen",
+ "received": "Wareneingang gebucht",
+ "canceled": "Umlagerung abgebrochen"
},
"table": {
"empty": "Noch keine Lagerumbuchungen",
"search_placeholder": "Nach Nummer oder Referenz suchen…"
},
- "title": "Lagerumbuchungen"
+ "title": "Lagerumbuchungen",
+ "new_cta": "Neue Umlagerung",
+ "new_title": "Neue Umlagerung",
+ "details_title": "Details",
+ "items_title": "Positionen",
+ "items_empty": "Noch keine Positionen – fügen Sie ein Produkt hinzu.",
+ "receive_title": "Wareneingang",
+ "actions_title": "Aktionen",
+ "history_title": "Bewegungen im Ziellager",
+ "units_summary": "{{received}} von {{shipped}} versandten Einheiten eingegangen",
+ "receive_running_total": "{{counted}} von {{shipped}} versandten Einheiten gezählt",
+ "discrepancy_placeholder": "Warum weniger eingetroffen ist",
+ "statuses": {
+ "draft": "Entwurf",
+ "ready_to_ship": "Versandbereit",
+ "in_transit": "Unterwegs",
+ "partially_received": "Teilweise eingegangen",
+ "received": "Eingegangen",
+ "canceled": "Abgebrochen"
+ },
+ "discrepancy_reasons": {
+ "damaged_in_transit": "Auf dem Transport beschädigt",
+ "lost_in_transit": "Auf dem Transport verloren",
+ "undercount": "Beim Versand falsch gezählt"
+ },
+ "in_transit_resolutions": {
+ "restock": "Einheiten zurück ins Quelllager buchen",
+ "write_off": "Einheiten als Verlust abschreiben"
+ },
+ "fields": {
+ "source": "Von",
+ "source_placeholder": "Quelllager auswählen",
+ "destination": "Nach",
+ "destination_placeholder": "Ziellager auswählen",
+ "reference": "Referenz",
+ "reference_placeholder": "Ihre eigene Bezeichnung für diesen Transport",
+ "notes": "Notizen",
+ "units": "Einheiten",
+ "shipped_at": "Versandt",
+ "received_at": "Eingegangen",
+ "in_transit_resolution": "Die Einheiten haben das Lager verlassen. Was ist mit ihnen passiert?"
+ },
+ "actions": {
+ "create_draft": "Entwurf erstellen",
+ "mark_ready": "Als versandbereit markieren",
+ "mark_in_transit": "Als unterwegs markieren",
+ "receive": "Wareneingang buchen",
+ "cancel_transfer": "Umlagerung abbrechen"
+ },
+ "delete_confirm": {
+ "title": "Diese Umlagerung löschen?",
+ "message": "Umlagerung {{number}} ist noch ein Entwurf, es wurde kein Bestand bewegt. Dies kann nicht rückgängig gemacht werden."
+ },
+ "ship_confirm": {
+ "title": "Diese Umlagerung versenden?",
+ "message": "{{count}} Einheiten verlassen jetzt das Quelllager und sind dort erst nach Ankunft wieder verfügbar."
+ },
+ "cancel_confirm": {
+ "title": "Diese Umlagerung abbrechen?",
+ "message": "Es wurde noch kein Bestand bewegt, es wird also nichts zurückgebucht.",
+ "in_flight_restock": "Die Einheiten werden zurück ins Quelllager gebucht, als wäre die Umlagerung nie versandt worden.",
+ "in_flight_write_off": "Die Einheiten bleiben als Verlust ausgebucht. Es wird nirgends etwas zurückgebucht."
+ }
},
"store": {
"load_failed_title": "Laden der Store-Einstellungen fehlgeschlagen",
@@ -5070,7 +5166,9 @@
"options": "Auswahlmöglichkeiten wie Größe oder Farbe, aus denen Varianten entstehen.",
"price_lists": "Alternative Preise, die gelten, wenn ihre Regeln zutreffen.",
"product_types": "Vorlagen, die neuen Produkten ihre Felder und Optionen geben.",
- "stock_transfers": "Bestand, der zwischen Ihren Lagern bewegt wird, und was angekommen ist."
+ "stock_transfers": "Bestand, der zwischen Ihren Lagern bewegt wird, und was angekommen ist.",
+ "purchase_orders": "Ware, die Sie bei Lieferanten bestellt haben, und was eingetroffen ist",
+ "suppliers": "Ihr Lieferanten-Adressbuch"
},
"tax_categories": {
"add_cta": "Steuerkategorie hinzufügen",
@@ -5316,6 +5414,163 @@
"message": "Fasst alles zusammen, was {{name}} zusteht, als eine Auszahlung je Währung. Es wird kein Geld gesendet — markieren Sie die Auszahlung als bezahlt, sobald die Überweisung raus ist."
},
"settle_failed": "Dieser Verkäufer konnte nicht abgerechnet werden."
+ },
+ "inventory_lines": {
+ "add_label": "Produkt hinzufügen",
+ "search_placeholder": "Produkte nach Name oder SKU suchen…",
+ "columns": {
+ "variant": "Produkt",
+ "sku": "SKU",
+ "unit_cost": "Stückkosten"
+ }
+ },
+ "stock_history": {
+ "title": "Bestandsverlauf",
+ "empty": "Dieser Bestand hat sich noch nicht verändert",
+ "columns": {
+ "when": "Wann",
+ "change": "Änderung",
+ "kind": "Was passiert ist",
+ "cause": "Warum"
+ },
+ "kinds": {
+ "received": "Eingegangen",
+ "allocated": "Reserviert",
+ "shipped": "Versandt",
+ "released": "Freigegeben",
+ "adjusted": "Korrigiert"
+ },
+ "causes": {
+ "purchase_order": "Bestellung",
+ "stock_transfer": "Umlagerung",
+ "return": "Rücksendung",
+ "exchange": "Umtausch",
+ "fulfillment": "Auftragsabwicklung",
+ "order": "Auftrag",
+ "manual": "Manuelle Korrektur"
+ }
+ },
+ "purchase_orders": {
+ "title": "Bestellungen",
+ "new_cta": "Neue Bestellung",
+ "new_title": "Neue Bestellung",
+ "details_title": "Details",
+ "items_title": "Positionen",
+ "items_empty": "Noch keine Positionen – fügen Sie ein Produkt hinzu.",
+ "receive_title": "Wareneingang",
+ "actions_title": "Aktionen",
+ "history_title": "Bewegungen im Ziellager",
+ "units_summary": "{{received}} von {{ordered}} bestellten Einheiten eingegangen",
+ "receive_running_total": "{{counted}} von {{ordered}} bestellten Einheiten gezählt",
+ "table": {
+ "empty": "Noch keine Bestellungen",
+ "search_placeholder": "Nach Nummer oder Referenz suchen…"
+ },
+ "columns": {
+ "number": "Nummer",
+ "supplier": "Lieferant",
+ "units": "Eingegangen / bestellt",
+ "subtotal": "Gesamt",
+ "expected": "Erwartet",
+ "quantity_ordered": "Bestellt",
+ "quantity_received": "Eingegangen",
+ "line_total": "Positionssumme"
+ },
+ "statuses": {
+ "draft": "Entwurf",
+ "ordered": "Bestellt",
+ "partially_received": "Teilweise eingegangen",
+ "received": "Eingegangen",
+ "canceled": "Abgebrochen"
+ },
+ "fields": {
+ "supplier": "Lieferant",
+ "supplier_placeholder": "Lieferant auswählen",
+ "destination": "Lieferung an",
+ "destination_placeholder": "Ziellager auswählen",
+ "currency": "Währung",
+ "expected_at": "Erwartet",
+ "expected_at_placeholder": "Der vom Lieferanten zugesagte Tag",
+ "reference": "Lieferantenreferenz",
+ "reference_placeholder": "Die Bestellnummer des Lieferanten",
+ "notes": "Notizen",
+ "units": "Einheiten",
+ "subtotal": "Gesamt",
+ "ordered_at": "Bestellt",
+ "received_at": "Eingegangen"
+ },
+ "actions": {
+ "create_draft": "Entwurf erstellen",
+ "mark_ordered": "Als bestellt markieren",
+ "receive": "Wareneingang buchen",
+ "cancel_order": "Bestellung abbrechen"
+ },
+ "messages": {
+ "created": "Bestellung erstellt",
+ "saved": "Bestellung gespeichert",
+ "deleted": "Bestellung gelöscht",
+ "ordered": "Bestellung aufgegeben",
+ "received": "Lieferung eingebucht",
+ "canceled": "Bestellung abgebrochen"
+ },
+ "errors": {
+ "failed_to_create": "Bestellung konnte nicht erstellt werden",
+ "failed_to_save": "Bestellung konnte nicht gespeichert werden",
+ "failed_to_delete": "Bestellung konnte nicht gelöscht werden",
+ "failed_to_order": "Bestellung konnte nicht aufgegeben werden",
+ "failed_to_receive": "Lieferung konnte nicht eingebucht werden",
+ "failed_to_cancel": "Bestellung konnte nicht abgebrochen werden"
+ },
+ "delete_confirm": {
+ "title": "Diese Bestellung löschen?",
+ "message": "Bestellung {{number}} ist noch ein Entwurf, es wurde nichts bestellt. Dies kann nicht rückgängig gemacht werden."
+ },
+ "order_confirm": {
+ "title": "Diese Bestellung aufgeben?",
+ "message": "Die Positionen sind festgeschrieben, sobald die Bestellung an {{supplier}} geht. Bestellte Ware gilt erst nach Ankunft als verfügbar."
+ },
+ "cancel_confirm": {
+ "title": "Diese Bestellung abbrechen?",
+ "message": "Alles Offene wird abgesagt. Bereits eingegangene Einheiten bleiben im Bestand."
+ }
+ },
+ "suppliers": {
+ "title": "Lieferanten",
+ "new_cta": "Neuer Lieferant",
+ "new_title": "Neuer Lieferant",
+ "edit_title": "Lieferant bearbeiten",
+ "sheet_description": "Von wem Sie Ware einkaufen und wie Sie sie erreichen.",
+ "table": {
+ "empty": "Noch keine Lieferanten",
+ "search_placeholder": "Nach Name, Kontakt oder E-Mail suchen…"
+ },
+ "columns": {
+ "contact": "Kontakt",
+ "orders": "Bestellungen"
+ },
+ "fields": {
+ "contact_name": "Ansprechpartner",
+ "address1": "Adresse",
+ "address2": "Adresszeile 2",
+ "city": "Stadt",
+ "postal_code": "Postleitzahl",
+ "notes": "Notizen"
+ },
+ "messages": {
+ "created": "Lieferant erstellt",
+ "saved": "Lieferant gespeichert",
+ "deleted": "Lieferant gelöscht"
+ },
+ "errors": {
+ "name_blank": "Ein Lieferant braucht einen Namen.",
+ "failed_to_create": "Lieferant konnte nicht erstellt werden",
+ "failed_to_save": "Lieferant konnte nicht gespeichert werden",
+ "failed_to_delete": "Lieferant konnte nicht gelöscht werden"
+ },
+ "delete_confirm": {
+ "title": "Diesen Lieferanten löschen?",
+ "message": "{{name}} steht für neue Bestellungen nicht mehr zur Verfügung. Bestehende Bestellungen nennen ihn weiterhin."
+ }
}
}
}
diff --git a/packages/dashboard/src/locales/en.json b/packages/dashboard/src/locales/en.json
index 3a2e1248a1..09fe944ab8 100644
--- a/packages/dashboard/src/locales/en.json
+++ b/packages/dashboard/src/locales/en.json
@@ -2123,6 +2123,17 @@
},
"digital_asset_authorized_days": {
"label": "Days available"
+ },
+ "preferred_default_package_dimensions": {
+ "height": "Height",
+ "help": "The box you usually ship in, used by carrier rate providers for dimensional-weight pricing — inches for imperial, centimeters for metric. All three are needed to take effect.",
+ "label": "Default package dimensions",
+ "length": "Length",
+ "width": "Width"
+ },
+ "preferred_default_package_weight": {
+ "help": "Packaging weight (box and filler) added to every package's contents when calculating delivery rates. Set to 0 to disable.",
+ "label": "Default package weight"
}
},
"store_credit": {
@@ -2572,7 +2583,8 @@
"sellers": "Sellers",
"settings": "Settings",
"transfers": "Transfers",
- "translations": "Translations"
+ "translations": "Translations",
+ "purchase_orders": "Purchase orders"
},
"option_types": {
"columns": {
@@ -3700,7 +3712,9 @@
"tab_storefront_access": "Storefront access",
"title": "Store settings",
"tab_downloads": "Digital downloads",
- "downloads_help": "How long a download link works and how many times it can be used. Individual files can override these numbers."
+ "downloads_help": "How long a download link works and how many times it can be used. Individual files can override these numbers.",
+ "default_package_description": "The box you usually ship in. Carrier rate providers add its weight to every package and use its dimensions for dimensional-weight pricing.",
+ "tab_default_package": "Default package"
},
"tax_categories": {
"add_sheet_title": "Add tax category",
@@ -4872,7 +4886,8 @@
"tax_rates": "Rates applied per market and region",
"webhooks": "Endpoints notified when events happen",
"payouts": "Who pays your sellers, how often, and the minimum worth sending",
- "package_types": "Boxes, cartons, pallets and containers"
+ "package_types": "Boxes, cartons, pallets and containers",
+ "suppliers": "Who you buy stock from, and how to reach them"
},
"groups": {
"audit": "Audit",
@@ -4909,7 +4924,8 @@
"tax_rates": "Tax rates",
"webhooks": "Webhooks",
"payouts": "Payouts",
- "package_types": "Package types"
+ "package_types": "Package types",
+ "suppliers": "Suppliers"
}
},
"setup": {
@@ -5027,25 +5043,105 @@
"columns": {
"direction": "Direction",
"number": "Number",
- "reference": "Reference"
+ "reference": "Reference",
+ "units": "Received / shipped",
+ "shipped": "Shipped",
+ "quantity_shipped": "Shipped",
+ "quantity_received": "Received",
+ "discrepancy": "Discrepancy"
},
"direction": {
"external_receive": "External receive",
"internal": "Transfer between locations"
},
"errors": {
- "failed_to_delete": "Failed to delete stock transfer",
- "failed_to_record": "Failed to record stock transfer"
+ "failed_to_delete": "Failed to delete the transfer",
+ "failed_to_record": "Failed to record stock transfer",
+ "same_location": "The two warehouses must be different.",
+ "failed_to_create": "Failed to create the transfer",
+ "failed_to_save": "Failed to save the transfer",
+ "failed_to_mark_ready": "Failed to mark the transfer ready",
+ "failed_to_mark_in_transit": "Failed to mark the transfer in transit",
+ "failed_to_receive": "Failed to receive the transfer",
+ "failed_to_cancel": "Failed to cancel the transfer"
},
"messages": {
- "deleted": "Stock transfer deleted",
- "recorded": "Stock transfer recorded"
+ "deleted": "Transfer deleted",
+ "recorded": "Stock transfer recorded",
+ "created": "Transfer created",
+ "saved": "Transfer saved",
+ "marked_ready": "Transfer is ready to ship",
+ "marked_in_transit": "Transfer is in transit — the units have left the source",
+ "received": "Transfer received",
+ "canceled": "Transfer cancelled"
},
"table": {
"empty": "No stock transfers yet",
"search_placeholder": "Search by number or reference…"
},
- "title": "Stock Transfers"
+ "title": "Stock Transfers",
+ "new_cta": "New transfer",
+ "new_title": "New stock transfer",
+ "details_title": "Details",
+ "items_title": "Items",
+ "items_empty": "No items yet — add a product to send.",
+ "receive_title": "Receive",
+ "actions_title": "Actions",
+ "history_title": "Activity at the destination",
+ "units_summary": "{{received}} received of {{shipped}} shipped",
+ "receive_running_total": "{{counted}} counted of {{shipped}} shipped",
+ "discrepancy_placeholder": "Why fewer arrived",
+ "statuses": {
+ "draft": "Draft",
+ "ready_to_ship": "Ready to ship",
+ "in_transit": "In transit",
+ "partially_received": "Partially received",
+ "received": "Received",
+ "canceled": "Cancelled"
+ },
+ "discrepancy_reasons": {
+ "damaged_in_transit": "Damaged in transit",
+ "lost_in_transit": "Lost in transit",
+ "undercount": "Miscounted when shipped"
+ },
+ "in_transit_resolutions": {
+ "restock": "Put the units back at the source",
+ "write_off": "Write the units off as lost"
+ },
+ "fields": {
+ "source": "From",
+ "source_placeholder": "Select the warehouse it leaves from",
+ "destination": "To",
+ "destination_placeholder": "Select the warehouse it is going to",
+ "reference": "Reference",
+ "reference_placeholder": "Your own label for this trip",
+ "notes": "Notes",
+ "units": "Units",
+ "shipped_at": "Shipped",
+ "received_at": "Received",
+ "in_transit_resolution": "The units have already left. What happened to them?"
+ },
+ "actions": {
+ "create_draft": "Create draft",
+ "mark_ready": "Mark as ready to ship",
+ "mark_in_transit": "Mark in transit",
+ "receive": "Receive",
+ "cancel_transfer": "Cancel transfer"
+ },
+ "delete_confirm": {
+ "title": "Delete this transfer?",
+ "message": "Transfer {{number}} is still a draft, so no stock has moved. This cannot be undone."
+ },
+ "ship_confirm": {
+ "title": "Send this transfer?",
+ "message": "{{count}} units leave the source warehouse now and will not be available there until they arrive."
+ },
+ "cancel_confirm": {
+ "title": "Cancel this transfer?",
+ "message": "No stock has moved yet, so nothing will be reversed.",
+ "in_flight_restock": "The units will go back onto the source warehouse's shelf, as if the transfer had never shipped.",
+ "in_flight_write_off": "The units stay off the books as lost. Nothing is added back anywhere."
+ }
},
"store": {
"load_failed_title": "Failed to load store settings",
@@ -5070,7 +5166,9 @@
"options": "Choices like size or colour that turn one product into variants.",
"price_lists": "Alternative prices that apply when their rules match.",
"product_types": "Templates that give new products their fields and options.",
- "stock_transfers": "Stock moving between your locations, and what has arrived."
+ "stock_transfers": "Stock moving between your locations, and what has arrived.",
+ "purchase_orders": "Stock you have ordered from suppliers, and what has arrived",
+ "suppliers": "Your supplier address book"
},
"tax_categories": {
"add_cta": "Add tax category",
@@ -5316,6 +5414,163 @@
"message": "Sweeps everything {{name}} is owed into a payout per currency. It does not send the money — mark the payout paid once the transfer goes out."
},
"settle_failed": "Could not settle this seller."
+ },
+ "inventory_lines": {
+ "add_label": "Add a product",
+ "search_placeholder": "Search products by name or SKU…",
+ "columns": {
+ "variant": "Product",
+ "sku": "SKU",
+ "unit_cost": "Unit cost"
+ }
+ },
+ "stock_history": {
+ "title": "Stock history",
+ "empty": "Nothing has changed this stock yet",
+ "columns": {
+ "when": "When",
+ "change": "Change",
+ "kind": "What happened",
+ "cause": "Why"
+ },
+ "kinds": {
+ "received": "Received",
+ "allocated": "Allocated",
+ "shipped": "Shipped",
+ "released": "Released",
+ "adjusted": "Adjusted"
+ },
+ "causes": {
+ "purchase_order": "Purchase order",
+ "stock_transfer": "Stock transfer",
+ "return": "Return",
+ "exchange": "Exchange",
+ "fulfillment": "Fulfillment",
+ "order": "Order",
+ "manual": "Manual adjustment"
+ }
+ },
+ "purchase_orders": {
+ "title": "Purchase Orders",
+ "new_cta": "New purchase order",
+ "new_title": "New purchase order",
+ "details_title": "Details",
+ "items_title": "Items",
+ "items_empty": "No items yet — add a product to order.",
+ "receive_title": "Receive",
+ "actions_title": "Actions",
+ "history_title": "Activity at the destination",
+ "units_summary": "{{received}} received of {{ordered}} ordered",
+ "receive_running_total": "{{counted}} counted of {{ordered}} ordered",
+ "table": {
+ "empty": "No purchase orders yet",
+ "search_placeholder": "Search by number or reference…"
+ },
+ "columns": {
+ "number": "Number",
+ "supplier": "Supplier",
+ "units": "Received / ordered",
+ "subtotal": "Total",
+ "expected": "Expected",
+ "quantity_ordered": "Ordered",
+ "quantity_received": "Received",
+ "line_total": "Line total"
+ },
+ "statuses": {
+ "draft": "Draft",
+ "ordered": "Ordered",
+ "partially_received": "Partially received",
+ "received": "Received",
+ "canceled": "Cancelled"
+ },
+ "fields": {
+ "supplier": "Supplier",
+ "supplier_placeholder": "Select a supplier",
+ "destination": "Deliver to",
+ "destination_placeholder": "Select the warehouse it is coming to",
+ "currency": "Currency",
+ "expected_at": "Expected",
+ "expected_at_placeholder": "The day the supplier promised",
+ "reference": "Supplier reference",
+ "reference_placeholder": "The supplier's own order number",
+ "notes": "Notes",
+ "units": "Units",
+ "subtotal": "Total",
+ "ordered_at": "Ordered",
+ "received_at": "Received"
+ },
+ "actions": {
+ "create_draft": "Create draft",
+ "mark_ordered": "Mark as ordered",
+ "receive": "Receive",
+ "cancel_order": "Cancel order"
+ },
+ "messages": {
+ "created": "Purchase order created",
+ "saved": "Purchase order saved",
+ "deleted": "Purchase order deleted",
+ "ordered": "Purchase order placed",
+ "received": "Delivery booked in",
+ "canceled": "Purchase order cancelled"
+ },
+ "errors": {
+ "failed_to_create": "Failed to create the purchase order",
+ "failed_to_save": "Failed to save the purchase order",
+ "failed_to_delete": "Failed to delete the purchase order",
+ "failed_to_order": "Failed to place the purchase order",
+ "failed_to_receive": "Failed to book in the delivery",
+ "failed_to_cancel": "Failed to cancel the purchase order"
+ },
+ "delete_confirm": {
+ "title": "Delete this purchase order?",
+ "message": "Order {{number}} is still a draft, so nothing has been ordered. This cannot be undone."
+ },
+ "order_confirm": {
+ "title": "Place this order?",
+ "message": "The lines are frozen once the order goes to {{supplier}}. Ordered stock still does not count as available until it arrives."
+ },
+ "cancel_confirm": {
+ "title": "Cancel this purchase order?",
+ "message": "What is still outstanding is called off. Units already received stay on the shelf."
+ }
+ },
+ "suppliers": {
+ "title": "Suppliers",
+ "new_cta": "New supplier",
+ "new_title": "New supplier",
+ "edit_title": "Edit supplier",
+ "sheet_description": "Who you buy stock from, and how to reach them.",
+ "table": {
+ "empty": "No suppliers yet",
+ "search_placeholder": "Search by name, contact or email…"
+ },
+ "columns": {
+ "contact": "Contact",
+ "orders": "Purchase orders"
+ },
+ "fields": {
+ "contact_name": "Contact name",
+ "address1": "Address",
+ "address2": "Address line 2",
+ "city": "City",
+ "postal_code": "Postal code",
+ "notes": "Notes"
+ },
+ "messages": {
+ "created": "Supplier created",
+ "saved": "Supplier saved",
+ "deleted": "Supplier deleted"
+ },
+ "errors": {
+ "name_blank": "A supplier needs a name.",
+ "failed_to_create": "Failed to create the supplier",
+ "failed_to_save": "Failed to save the supplier",
+ "failed_to_delete": "Failed to delete the supplier"
+ },
+ "delete_confirm": {
+ "title": "Delete this supplier?",
+ "message": "{{name}} will no longer be available for new purchase orders. Existing orders keep naming them."
+ }
}
}
}
diff --git a/packages/dashboard/src/locales/fr.json b/packages/dashboard/src/locales/fr.json
index 57b3bbbd9b..ed25553e58 100644
--- a/packages/dashboard/src/locales/fr.json
+++ b/packages/dashboard/src/locales/fr.json
@@ -2123,6 +2123,17 @@
},
"digital_asset_authorized_days": {
"label": "Jours de disponibilité"
+ },
+ "preferred_default_package_dimensions": {
+ "height": "Hauteur",
+ "help": "Le carton habituel d'expédition, utilisé par les transporteurs pour le poids volumétrique — pouces en impérial, centimètres en métrique. Les trois valeurs sont requises.",
+ "label": "Dimensions de colis par défaut",
+ "length": "Longueur",
+ "width": "Largeur"
+ },
+ "preferred_default_package_weight": {
+ "help": "Poids d'emballage (carton et calage) ajouté au contenu de chaque colis lors du calcul des tarifs de livraison. 0 pour désactiver.",
+ "label": "Poids de colis par défaut"
}
},
"store_credit": {
@@ -2572,7 +2583,8 @@
"sellers": "Vendeurs",
"settings": "Paramètres",
"transfers": "Transferts",
- "translations": "Traductions"
+ "translations": "Traductions",
+ "purchase_orders": "Bons de commande"
},
"option_types": {
"columns": {
@@ -3700,7 +3712,9 @@
"tab_storefront_access": "Accès à la vitrine",
"title": "Paramètres de la boutique",
"tab_downloads": "Téléchargements numériques",
- "downloads_help": "Durée de validité d'un lien de téléchargement et nombre d'utilisations possibles. Chaque fichier peut remplacer ces valeurs."
+ "downloads_help": "Durée de validité d'un lien de téléchargement et nombre d'utilisations possibles. Chaque fichier peut remplacer ces valeurs.",
+ "default_package_description": "Le carton habituel d'expédition. Les transporteurs ajoutent son poids à chaque colis et utilisent ses dimensions pour le poids volumétrique.",
+ "tab_default_package": "Colis par défaut"
},
"tax_categories": {
"add_sheet_title": "Ajouter une catégorie de taxe",
@@ -4872,7 +4886,8 @@
"tax_rates": "Taux appliqués par marché et région",
"webhooks": "Points de terminaison notifiés lors d'événements",
"payouts": "Qui paie vos vendeurs, à quelle fréquence et à partir de quel montant",
- "package_types": "Cartons, palettes et conteneurs"
+ "package_types": "Cartons, palettes et conteneurs",
+ "suppliers": "À qui vous achetez votre stock, et comment les joindre"
},
"groups": {
"audit": "Audit",
@@ -4909,7 +4924,8 @@
"tax_rates": "Taux de taxe",
"webhooks": "Webhooks",
"payouts": "Paiements",
- "package_types": "Types d'emballage"
+ "package_types": "Types d'emballage",
+ "suppliers": "Fournisseurs"
}
},
"setup": {
@@ -5027,25 +5043,105 @@
"columns": {
"direction": "Direction",
"number": "Numéro",
- "reference": "Référence"
+ "reference": "Référence",
+ "units": "Reçues / expédiées",
+ "shipped": "Expédié",
+ "quantity_shipped": "Expédiées",
+ "quantity_received": "Reçues",
+ "discrepancy": "Écart"
},
"direction": {
"external_receive": "Réception externe",
"internal": "Transfert entre emplacements"
},
"errors": {
- "failed_to_delete": "Échec de la suppression du transfert de stock",
- "failed_to_record": "Échec de l'enregistrement du transfert de stock"
+ "failed_to_delete": "Échec de la suppression du transfert",
+ "failed_to_record": "Échec de l'enregistrement du transfert de stock",
+ "same_location": "Les deux entrepôts doivent être différents.",
+ "failed_to_create": "Échec de la création du transfert",
+ "failed_to_save": "Échec de l'enregistrement du transfert",
+ "failed_to_mark_ready": "Impossible de marquer le transfert prêt à expédier",
+ "failed_to_mark_in_transit": "Impossible de marquer le transfert en transit",
+ "failed_to_receive": "Échec de la réception du transfert",
+ "failed_to_cancel": "Échec de l'annulation du transfert"
},
"messages": {
- "deleted": "Transfert de stock supprimé",
- "recorded": "Transfert de stock enregistré"
+ "deleted": "Transfert supprimé",
+ "recorded": "Transfert de stock enregistré",
+ "created": "Transfert créé",
+ "saved": "Transfert enregistré",
+ "marked_ready": "Le transfert est prêt à expédier",
+ "marked_in_transit": "Transfert en transit — les unités ont quitté l'entrepôt d'origine",
+ "received": "Transfert réceptionné",
+ "canceled": "Transfert annulé"
},
"table": {
"empty": "Aucun transfert de stock pour le moment",
"search_placeholder": "Rechercher par numéro ou référence…"
},
- "title": "Transferts de stock"
+ "title": "Transferts de stock",
+ "new_cta": "Nouveau transfert",
+ "new_title": "Nouveau transfert de stock",
+ "details_title": "Détails",
+ "items_title": "Articles",
+ "items_empty": "Aucun article — ajoutez un produit à envoyer.",
+ "receive_title": "Réception",
+ "actions_title": "Actions",
+ "history_title": "Activité à destination",
+ "units_summary": "{{received}} reçues sur {{shipped}} expédiées",
+ "receive_running_total": "{{counted}} comptées sur {{shipped}} expédiées",
+ "discrepancy_placeholder": "Pourquoi il en manque",
+ "statuses": {
+ "draft": "Brouillon",
+ "ready_to_ship": "Prêt à expédier",
+ "in_transit": "En transit",
+ "partially_received": "Partiellement reçu",
+ "received": "Reçu",
+ "canceled": "Annulé"
+ },
+ "discrepancy_reasons": {
+ "damaged_in_transit": "Endommagé en transit",
+ "lost_in_transit": "Perdu en transit",
+ "undercount": "Mal compté au départ"
+ },
+ "in_transit_resolutions": {
+ "restock": "Remettre les unités à l'entrepôt d'origine",
+ "write_off": "Passer les unités en perte"
+ },
+ "fields": {
+ "source": "De",
+ "source_placeholder": "Choisir l'entrepôt de départ",
+ "destination": "Vers",
+ "destination_placeholder": "Choisir l'entrepôt de destination",
+ "reference": "Référence",
+ "reference_placeholder": "Votre propre libellé pour ce trajet",
+ "notes": "Notes",
+ "units": "Unités",
+ "shipped_at": "Expédié",
+ "received_at": "Reçu",
+ "in_transit_resolution": "Les unités sont déjà parties. Que leur est-il arrivé ?"
+ },
+ "actions": {
+ "create_draft": "Créer le brouillon",
+ "mark_ready": "Marquer prêt à expédier",
+ "mark_in_transit": "Marquer en transit",
+ "receive": "Réceptionner",
+ "cancel_transfer": "Annuler le transfert"
+ },
+ "delete_confirm": {
+ "title": "Supprimer ce transfert ?",
+ "message": "Le transfert {{number}} est encore un brouillon, aucun stock n'a bougé. Cette action est irréversible."
+ },
+ "ship_confirm": {
+ "title": "Expédier ce transfert ?",
+ "message": "{{count}} unités quittent maintenant l'entrepôt d'origine et n'y seront plus disponibles avant leur arrivée."
+ },
+ "cancel_confirm": {
+ "title": "Annuler ce transfert ?",
+ "message": "Aucun stock n'a encore bougé, rien ne sera donc annulé.",
+ "in_flight_restock": "Les unités retourneront dans l'entrepôt d'origine, comme si le transfert n'avait jamais été expédié.",
+ "in_flight_write_off": "Les unités restent sorties du stock, en perte. Rien n'est réintégré."
+ }
},
"store": {
"load_failed_title": "Échec du chargement des paramètres de la boutique",
@@ -5070,7 +5166,9 @@
"options": "Des choix comme la taille ou la couleur qui déclinent un produit en variantes.",
"price_lists": "Des prix alternatifs qui s’appliquent quand leurs règles correspondent.",
"product_types": "Des modèles qui donnent aux nouveaux produits leurs champs et leurs options.",
- "stock_transfers": "Le stock qui circule entre vos entrepôts, et ce qui est arrivé."
+ "stock_transfers": "Le stock qui circule entre vos entrepôts, et ce qui est arrivé.",
+ "purchase_orders": "Le stock commandé à vos fournisseurs, et ce qui est arrivé",
+ "suppliers": "Votre carnet d'adresses fournisseurs"
},
"tax_categories": {
"add_cta": "Ajouter une catégorie de taxe",
@@ -5316,6 +5414,163 @@
"message": "Regroupe tout ce qui est dû à {{name}} en un versement par devise. Aucun argent n'est envoyé — marquez le versement comme payé une fois le virement effectué."
},
"settle_failed": "Impossible de régler ce vendeur."
+ },
+ "inventory_lines": {
+ "add_label": "Ajouter un produit",
+ "search_placeholder": "Rechercher un produit par nom ou UGS…",
+ "columns": {
+ "variant": "Produit",
+ "sku": "UGS",
+ "unit_cost": "Coût unitaire"
+ }
+ },
+ "stock_history": {
+ "title": "Historique du stock",
+ "empty": "Ce stock n'a pas encore changé",
+ "columns": {
+ "when": "Quand",
+ "change": "Variation",
+ "kind": "Ce qui s'est passé",
+ "cause": "Pourquoi"
+ },
+ "kinds": {
+ "received": "Reçu",
+ "allocated": "Réservé",
+ "shipped": "Expédié",
+ "released": "Libéré",
+ "adjusted": "Ajusté"
+ },
+ "causes": {
+ "purchase_order": "Bon de commande",
+ "stock_transfer": "Transfert de stock",
+ "return": "Retour",
+ "exchange": "Échange",
+ "fulfillment": "Préparation",
+ "order": "Commande",
+ "manual": "Ajustement manuel"
+ }
+ },
+ "purchase_orders": {
+ "title": "Bons de commande",
+ "new_cta": "Nouveau bon de commande",
+ "new_title": "Nouveau bon de commande",
+ "details_title": "Détails",
+ "items_title": "Articles",
+ "items_empty": "Aucun article — ajoutez un produit à commander.",
+ "receive_title": "Réception",
+ "actions_title": "Actions",
+ "history_title": "Activité à destination",
+ "units_summary": "{{received}} reçues sur {{ordered}} commandées",
+ "receive_running_total": "{{counted}} comptées sur {{ordered}} commandées",
+ "table": {
+ "empty": "Aucun bon de commande",
+ "search_placeholder": "Rechercher par numéro ou référence…"
+ },
+ "columns": {
+ "number": "Numéro",
+ "supplier": "Fournisseur",
+ "units": "Reçues / commandées",
+ "subtotal": "Total",
+ "expected": "Attendu",
+ "quantity_ordered": "Commandées",
+ "quantity_received": "Reçues",
+ "line_total": "Total ligne"
+ },
+ "statuses": {
+ "draft": "Brouillon",
+ "ordered": "Commandé",
+ "partially_received": "Partiellement reçu",
+ "received": "Reçu",
+ "canceled": "Annulé"
+ },
+ "fields": {
+ "supplier": "Fournisseur",
+ "supplier_placeholder": "Choisir un fournisseur",
+ "destination": "Livrer à",
+ "destination_placeholder": "Choisir l'entrepôt de réception",
+ "currency": "Devise",
+ "expected_at": "Attendu",
+ "expected_at_placeholder": "Le jour promis par le fournisseur",
+ "reference": "Référence fournisseur",
+ "reference_placeholder": "Le numéro de commande du fournisseur",
+ "notes": "Notes",
+ "units": "Unités",
+ "subtotal": "Total",
+ "ordered_at": "Commandé",
+ "received_at": "Reçu"
+ },
+ "actions": {
+ "create_draft": "Créer le brouillon",
+ "mark_ordered": "Marquer comme commandé",
+ "receive": "Réceptionner",
+ "cancel_order": "Annuler la commande"
+ },
+ "messages": {
+ "created": "Bon de commande créé",
+ "saved": "Bon de commande enregistré",
+ "deleted": "Bon de commande supprimé",
+ "ordered": "Commande passée",
+ "received": "Livraison enregistrée",
+ "canceled": "Bon de commande annulé"
+ },
+ "errors": {
+ "failed_to_create": "Échec de la création du bon de commande",
+ "failed_to_save": "Échec de l'enregistrement du bon de commande",
+ "failed_to_delete": "Échec de la suppression du bon de commande",
+ "failed_to_order": "Échec du passage de la commande",
+ "failed_to_receive": "Échec de l'enregistrement de la livraison",
+ "failed_to_cancel": "Échec de l'annulation du bon de commande"
+ },
+ "delete_confirm": {
+ "title": "Supprimer ce bon de commande ?",
+ "message": "La commande {{number}} est encore un brouillon, rien n'a été commandé. Cette action est irréversible."
+ },
+ "order_confirm": {
+ "title": "Passer cette commande ?",
+ "message": "Les lignes sont figées dès que la commande part chez {{supplier}}. Le stock commandé ne compte comme disponible qu'à son arrivée."
+ },
+ "cancel_confirm": {
+ "title": "Annuler ce bon de commande ?",
+ "message": "Ce qui reste dû est annulé. Les unités déjà reçues restent en stock."
+ }
+ },
+ "suppliers": {
+ "title": "Fournisseurs",
+ "new_cta": "Nouveau fournisseur",
+ "new_title": "Nouveau fournisseur",
+ "edit_title": "Modifier le fournisseur",
+ "sheet_description": "À qui vous achetez votre stock, et comment les joindre.",
+ "table": {
+ "empty": "Aucun fournisseur",
+ "search_placeholder": "Rechercher par nom, contact ou e-mail…"
+ },
+ "columns": {
+ "contact": "Contact",
+ "orders": "Bons de commande"
+ },
+ "fields": {
+ "contact_name": "Nom du contact",
+ "address1": "Adresse",
+ "address2": "Complément d'adresse",
+ "city": "Ville",
+ "postal_code": "Code postal",
+ "notes": "Notes"
+ },
+ "messages": {
+ "created": "Fournisseur créé",
+ "saved": "Fournisseur enregistré",
+ "deleted": "Fournisseur supprimé"
+ },
+ "errors": {
+ "name_blank": "Un fournisseur doit avoir un nom.",
+ "failed_to_create": "Échec de la création du fournisseur",
+ "failed_to_save": "Échec de l'enregistrement du fournisseur",
+ "failed_to_delete": "Échec de la suppression du fournisseur"
+ },
+ "delete_confirm": {
+ "title": "Supprimer ce fournisseur ?",
+ "message": "{{name}} ne sera plus disponible pour de nouveaux bons de commande. Les commandes existantes continuent de le nommer."
+ }
}
}
}
diff --git a/packages/dashboard/src/locales/pl.json b/packages/dashboard/src/locales/pl.json
index be83382e66..272f8be1c1 100644
--- a/packages/dashboard/src/locales/pl.json
+++ b/packages/dashboard/src/locales/pl.json
@@ -2141,6 +2141,17 @@
},
"digital_asset_authorized_days": {
"label": "Dostępne dni"
+ },
+ "preferred_default_package_dimensions": {
+ "height": "Wysokość",
+ "help": "Karton, w którym zwykle wysyłasz, używany przez przewoźników do wyceny wagi wymiarowej — cale dla systemu imperialnego, centymetry dla metrycznego. Działa dopiero po podaniu wszystkich trzech.",
+ "label": "Domyślne wymiary paczki",
+ "length": "Długość",
+ "width": "Szerokość"
+ },
+ "preferred_default_package_weight": {
+ "help": "Waga opakowania (karton i wypełnienie) dodawana do zawartości każdej paczki przy wyliczaniu stawek dostawy. 0 wyłącza.",
+ "label": "Domyślna waga paczki"
}
},
"store_credit": {
@@ -2594,7 +2605,8 @@
"sellers": "Sprzedawcy",
"settings": "Ustawienia",
"transfers": "Transfery",
- "translations": "Tłumaczenia"
+ "translations": "Tłumaczenia",
+ "purchase_orders": "Zamówienia zakupu"
},
"option_types": {
"columns": {
@@ -3742,7 +3754,9 @@
"tab_storefront_access": "Dostęp do sklepu",
"title": "Ustawienia sklepu",
"tab_downloads": "Pobrania cyfrowe",
- "downloads_help": "Jak długo działa link do pobrania i ile razy można go użyć. Poszczególne pliki mogą nadpisać te wartości."
+ "downloads_help": "Jak długo działa link do pobrania i ile razy można go użyć. Poszczególne pliki mogą nadpisać te wartości.",
+ "default_package_description": "Karton, w którym zwykle wysyłasz. Dostawcy stawek przewoźników dodają jego wagę do każdej paczki i używają wymiarów do wyceny wagi wymiarowej.",
+ "tab_default_package": "Domyślna paczka"
},
"tax_categories": {
"add_sheet_title": "Dodaj kategorię podatkową",
@@ -4930,7 +4944,8 @@
"tax_rates": "Stawki stosowane według rynku i regionu",
"webhooks": "Adresy powiadamiane o zdarzeniach",
"payouts": "Kto płaci Twoim sprzedawcom, jak często i od jakiej kwoty",
- "package_types": "Kartony, palety i kontenery"
+ "package_types": "Kartony, palety i kontenery",
+ "suppliers": "Od kogo kupujesz towar i jak się z nimi skontaktować"
},
"groups": {
"audit": "Audyt",
@@ -4967,7 +4982,8 @@
"tax_rates": "Stawki podatku",
"webhooks": "Webhooki",
"payouts": "Wypłaty",
- "package_types": "Rodzaje opakowań"
+ "package_types": "Rodzaje opakowań",
+ "suppliers": "Dostawcy"
}
},
"setup": {
@@ -5085,25 +5101,105 @@
"columns": {
"direction": "Kierunek",
"number": "Numer",
- "reference": "Referencja"
+ "reference": "Referencja",
+ "units": "Przyjęte / wysłane",
+ "shipped": "Wysłano",
+ "quantity_shipped": "Wysłano",
+ "quantity_received": "Przyjęto",
+ "discrepancy": "Rozbieżność"
},
"direction": {
"external_receive": "Przyjęcie zewnętrzne",
"internal": "Transfer między lokalizacjami"
},
"errors": {
- "failed_to_delete": "Nie udało się usunąć przesunięcia magazynowego",
- "failed_to_record": "Nie udało się zarejestrować przesunięcia magazynowego"
+ "failed_to_delete": "Nie udało się usunąć przesunięcia",
+ "failed_to_record": "Nie udało się zarejestrować przesunięcia magazynowego",
+ "same_location": "Oba magazyny muszą być różne.",
+ "failed_to_create": "Nie udało się utworzyć przesunięcia",
+ "failed_to_save": "Nie udało się zapisać przesunięcia",
+ "failed_to_mark_ready": "Nie udało się oznaczyć przesunięcia jako gotowego",
+ "failed_to_mark_in_transit": "Nie udało się oznaczyć przesunięcia jako w drodze",
+ "failed_to_receive": "Nie udało się przyjąć przesunięcia",
+ "failed_to_cancel": "Nie udało się anulować przesunięcia"
},
"messages": {
- "deleted": "Usunięto przesunięcie magazynowe",
- "recorded": "Zarejestrowano przesunięcie magazynowe"
+ "deleted": "Przesunięcie usunięte",
+ "recorded": "Zarejestrowano przesunięcie magazynowe",
+ "created": "Przesunięcie utworzone",
+ "saved": "Przesunięcie zapisane",
+ "marked_ready": "Przesunięcie gotowe do wysyłki",
+ "marked_in_transit": "Przesunięcie w drodze — jednostki opuściły magazyn źródłowy",
+ "received": "Przesunięcie przyjęte",
+ "canceled": "Przesunięcie anulowane"
},
"table": {
"empty": "Brak transferów magazynowych",
"search_placeholder": "Szukaj według numeru lub referencji…"
},
- "title": "Transfery magazynowe"
+ "title": "Transfery magazynowe",
+ "new_cta": "Nowe przesunięcie",
+ "new_title": "Nowe przesunięcie magazynowe",
+ "details_title": "Szczegóły",
+ "items_title": "Pozycje",
+ "items_empty": "Brak pozycji — dodaj produkt do wysłania.",
+ "receive_title": "Przyjęcie",
+ "actions_title": "Akcje",
+ "history_title": "Ruchy w magazynie docelowym",
+ "units_summary": "przyjęto {{received}} z {{shipped}} wysłanych",
+ "receive_running_total": "policzono {{counted}} z {{shipped}} wysłanych",
+ "discrepancy_placeholder": "Dlaczego dotarło mniej",
+ "statuses": {
+ "draft": "Szkic",
+ "ready_to_ship": "Gotowe do wysyłki",
+ "in_transit": "W drodze",
+ "partially_received": "Częściowo przyjęte",
+ "received": "Przyjęte",
+ "canceled": "Anulowane"
+ },
+ "discrepancy_reasons": {
+ "damaged_in_transit": "Uszkodzone w transporcie",
+ "lost_in_transit": "Zagubione w transporcie",
+ "undercount": "Błędnie policzone przy wysyłce"
+ },
+ "in_transit_resolutions": {
+ "restock": "Zwróć jednostki do magazynu źródłowego",
+ "write_off": "Odpisz jednostki jako stratę"
+ },
+ "fields": {
+ "source": "Z",
+ "source_placeholder": "Wybierz magazyn źródłowy",
+ "destination": "Do",
+ "destination_placeholder": "Wybierz magazyn docelowy",
+ "reference": "Referencja",
+ "reference_placeholder": "Twoje własne oznaczenie tego transportu",
+ "notes": "Notatki",
+ "units": "Jednostki",
+ "shipped_at": "Wysłano",
+ "received_at": "Przyjęto",
+ "in_transit_resolution": "Jednostki już wyjechały. Co się z nimi stało?"
+ },
+ "actions": {
+ "create_draft": "Utwórz szkic",
+ "mark_ready": "Oznacz jako gotowe do wysyłki",
+ "mark_in_transit": "Oznacz jako w drodze",
+ "receive": "Przyjmij",
+ "cancel_transfer": "Anuluj przesunięcie"
+ },
+ "delete_confirm": {
+ "title": "Usunąć to przesunięcie?",
+ "message": "Przesunięcie {{number}} jest jeszcze szkicem, więc stan się nie zmienił. Tego nie można cofnąć."
+ },
+ "ship_confirm": {
+ "title": "Wysłać to przesunięcie?",
+ "message": "{{count}} jednostek opuszcza teraz magazyn źródłowy i nie będzie tam dostępnych do czasu dotarcia."
+ },
+ "cancel_confirm": {
+ "title": "Anulować to przesunięcie?",
+ "message": "Stan jeszcze się nie zmienił, więc nic nie zostanie wycofane.",
+ "in_flight_restock": "Jednostki wrócą na półkę magazynu źródłowego, tak jakby przesunięcie nigdy nie wyjechało.",
+ "in_flight_write_off": "Jednostki pozostaną odpisane jako strata. Nic nie zostanie nigdzie dodane."
+ }
},
"store": {
"load_failed_title": "Nie udało się załadować ustawień sklepu",
@@ -5128,7 +5224,9 @@
"options": "Cechy takie jak rozmiar czy kolor, które tworzą warianty produktu.",
"price_lists": "Alternatywne ceny, które obowiązują, gdy pasują ich reguły.",
"product_types": "Szablony nadające nowym produktom pola i opcje.",
- "stock_transfers": "Zapasy przemieszczane między lokalizacjami i to, co już dotarło."
+ "stock_transfers": "Zapasy przemieszczane między lokalizacjami i to, co już dotarło.",
+ "purchase_orders": "Towar zamówiony u dostawców i to, co już dotarło",
+ "suppliers": "Twoja książka adresowa dostawców"
},
"tax_categories": {
"add_cta": "Dodaj kategorię podatkową",
@@ -5376,6 +5474,163 @@
"message": "Zbiera wszystko, co należy się {{name}}, w jedną wypłatę na walutę. Nie wysyła pieniędzy — oznacz wypłatę jako zapłaconą po wykonaniu przelewu."
},
"settle_failed": "Nie udało się rozliczyć tego sprzedawcy."
+ },
+ "inventory_lines": {
+ "add_label": "Dodaj produkt",
+ "search_placeholder": "Szukaj produktów po nazwie lub SKU…",
+ "columns": {
+ "variant": "Produkt",
+ "sku": "SKU",
+ "unit_cost": "Koszt jednostkowy"
+ }
+ },
+ "stock_history": {
+ "title": "Historia stanu",
+ "empty": "Ten stan jeszcze się nie zmieniał",
+ "columns": {
+ "when": "Kiedy",
+ "change": "Zmiana",
+ "kind": "Co się stało",
+ "cause": "Dlaczego"
+ },
+ "kinds": {
+ "received": "Przyjęto",
+ "allocated": "Zarezerwowano",
+ "shipped": "Wydano",
+ "released": "Zwolniono",
+ "adjusted": "Skorygowano"
+ },
+ "causes": {
+ "purchase_order": "Zamówienie zakupu",
+ "stock_transfer": "Przesunięcie magazynowe",
+ "return": "Zwrot",
+ "exchange": "Wymiana",
+ "fulfillment": "Realizacja",
+ "order": "Zamówienie",
+ "manual": "Korekta ręczna"
+ }
+ },
+ "purchase_orders": {
+ "title": "Zamówienia zakupu",
+ "new_cta": "Nowe zamówienie zakupu",
+ "new_title": "Nowe zamówienie zakupu",
+ "details_title": "Szczegóły",
+ "items_title": "Pozycje",
+ "items_empty": "Brak pozycji — dodaj produkt do zamówienia.",
+ "receive_title": "Przyjęcie",
+ "actions_title": "Akcje",
+ "history_title": "Ruchy w magazynie docelowym",
+ "units_summary": "przyjęto {{received}} z {{ordered}} zamówionych",
+ "receive_running_total": "policzono {{counted}} z {{ordered}} zamówionych",
+ "table": {
+ "empty": "Brak zamówień zakupu",
+ "search_placeholder": "Szukaj po numerze lub referencji…"
+ },
+ "columns": {
+ "number": "Numer",
+ "supplier": "Dostawca",
+ "units": "Przyjęte / zamówione",
+ "subtotal": "Razem",
+ "expected": "Oczekiwane",
+ "quantity_ordered": "Zamówiono",
+ "quantity_received": "Przyjęto",
+ "line_total": "Suma pozycji"
+ },
+ "statuses": {
+ "draft": "Szkic",
+ "ordered": "Zamówione",
+ "partially_received": "Częściowo przyjęte",
+ "received": "Przyjęte",
+ "canceled": "Anulowane"
+ },
+ "fields": {
+ "supplier": "Dostawca",
+ "supplier_placeholder": "Wybierz dostawcę",
+ "destination": "Dostawa do",
+ "destination_placeholder": "Wybierz magazyn docelowy",
+ "currency": "Waluta",
+ "expected_at": "Oczekiwane",
+ "expected_at_placeholder": "Dzień obiecany przez dostawcę",
+ "reference": "Referencja dostawcy",
+ "reference_placeholder": "Numer zamówienia u dostawcy",
+ "notes": "Notatki",
+ "units": "Jednostki",
+ "subtotal": "Razem",
+ "ordered_at": "Zamówiono",
+ "received_at": "Przyjęto"
+ },
+ "actions": {
+ "create_draft": "Utwórz szkic",
+ "mark_ordered": "Oznacz jako zamówione",
+ "receive": "Przyjmij",
+ "cancel_order": "Anuluj zamówienie"
+ },
+ "messages": {
+ "created": "Zamówienie zakupu utworzone",
+ "saved": "Zamówienie zakupu zapisane",
+ "deleted": "Zamówienie zakupu usunięte",
+ "ordered": "Zamówienie złożone",
+ "received": "Dostawa zaksięgowana",
+ "canceled": "Zamówienie zakupu anulowane"
+ },
+ "errors": {
+ "failed_to_create": "Nie udało się utworzyć zamówienia zakupu",
+ "failed_to_save": "Nie udało się zapisać zamówienia zakupu",
+ "failed_to_delete": "Nie udało się usunąć zamówienia zakupu",
+ "failed_to_order": "Nie udało się złożyć zamówienia",
+ "failed_to_receive": "Nie udało się zaksięgować dostawy",
+ "failed_to_cancel": "Nie udało się anulować zamówienia zakupu"
+ },
+ "delete_confirm": {
+ "title": "Usunąć to zamówienie zakupu?",
+ "message": "Zamówienie {{number}} jest jeszcze szkicem, więc nic nie zostało zamówione. Tego nie można cofnąć."
+ },
+ "order_confirm": {
+ "title": "Złożyć to zamówienie?",
+ "message": "Pozycje zostaną zablokowane, gdy zamówienie trafi do {{supplier}}. Zamówiony towar liczy się jako dostępny dopiero po dotarciu."
+ },
+ "cancel_confirm": {
+ "title": "Anulować to zamówienie zakupu?",
+ "message": "To, co pozostało niedostarczone, zostanie odwołane. Przyjęte jednostki zostają w magazynie."
+ }
+ },
+ "suppliers": {
+ "title": "Dostawcy",
+ "new_cta": "Nowy dostawca",
+ "new_title": "Nowy dostawca",
+ "edit_title": "Edytuj dostawcę",
+ "sheet_description": "Od kogo kupujesz towar i jak się z nimi skontaktować.",
+ "table": {
+ "empty": "Brak dostawców",
+ "search_placeholder": "Szukaj po nazwie, kontakcie lub e-mailu…"
+ },
+ "columns": {
+ "contact": "Kontakt",
+ "orders": "Zamówienia zakupu"
+ },
+ "fields": {
+ "contact_name": "Osoba kontaktowa",
+ "address1": "Adres",
+ "address2": "Adres, linia 2",
+ "city": "Miasto",
+ "postal_code": "Kod pocztowy",
+ "notes": "Notatki"
+ },
+ "messages": {
+ "created": "Dostawca utworzony",
+ "saved": "Dostawca zapisany",
+ "deleted": "Dostawca usunięty"
+ },
+ "errors": {
+ "name_blank": "Dostawca musi mieć nazwę.",
+ "failed_to_create": "Nie udało się utworzyć dostawcy",
+ "failed_to_save": "Nie udało się zapisać dostawcy",
+ "failed_to_delete": "Nie udało się usunąć dostawcy"
+ },
+ "delete_confirm": {
+ "title": "Usunąć tego dostawcę?",
+ "message": "{{name}} nie będzie już dostępny w nowych zamówieniach zakupu. Istniejące zamówienia nadal będą go wskazywać."
+ }
}
}
}
diff --git a/packages/dashboard/src/locales/zh-CN.json b/packages/dashboard/src/locales/zh-CN.json
index 51570f1af9..5c1080241b 100644
--- a/packages/dashboard/src/locales/zh-CN.json
+++ b/packages/dashboard/src/locales/zh-CN.json
@@ -2118,6 +2118,17 @@
},
"digital_asset_authorized_days": {
"label": "可用天数"
+ },
+ "preferred_default_package_dimensions": {
+ "height": "高",
+ "help": "常用的发货纸箱尺寸,承运商费率提供方据此计算体积重量——英制为英寸,公制为厘米。三项都填写后才生效。",
+ "label": "默认包裹尺寸",
+ "length": "长",
+ "width": "宽"
+ },
+ "preferred_default_package_weight": {
+ "help": "计算配送费率时加到每个包裹内容上的包装重量(纸箱与填充物)。设为 0 可停用。",
+ "label": "默认包裹重量"
}
},
"store_credit": {
@@ -2565,7 +2576,8 @@
"sellers": "卖家",
"settings": "设置",
"transfers": "调拨",
- "translations": "翻译"
+ "translations": "翻译",
+ "purchase_orders": "采购订单"
},
"option_types": {
"columns": {
@@ -3692,7 +3704,9 @@
"tab_storefront_access": "店铺访问权限",
"title": "店铺设置",
"tab_downloads": "数字下载",
- "downloads_help": "下载链接的有效期以及可使用的次数。单个文件可覆盖这些数值。"
+ "downloads_help": "下载链接的有效期以及可使用的次数。单个文件可覆盖这些数值。",
+ "default_package_description": "常用的发货纸箱。承运商费率提供方会将其重量加到每个包裹上,并使用其尺寸计算体积重量。",
+ "tab_default_package": "默认包裹"
},
"tax_categories": {
"add_sheet_title": "添加税收类别",
@@ -4863,7 +4877,8 @@
"tax_rates": "按市场和地区适用的税率",
"webhooks": "事件发生时接收通知的端点",
"payouts": "由谁向卖家付款、多久一次,以及值得发放的最低金额",
- "package_types": "纸箱、外箱、托盘与集装箱"
+ "package_types": "纸箱、外箱、托盘与集装箱",
+ "suppliers": "你从谁那里采购库存,以及如何联系他们"
},
"groups": {
"audit": "审计",
@@ -4900,7 +4915,8 @@
"tax_rates": "税率",
"webhooks": "Webhooks",
"payouts": "付款",
- "package_types": "包装类型"
+ "package_types": "包装类型",
+ "suppliers": "供应商"
}
},
"setup": {
@@ -5018,25 +5034,105 @@
"columns": {
"direction": "方向",
"number": "编号",
- "reference": "参考信息"
+ "reference": "参考信息",
+ "units": "已收 / 已发",
+ "shipped": "发出时间",
+ "quantity_shipped": "已发出",
+ "quantity_received": "已收到",
+ "discrepancy": "差异"
},
"direction": {
"external_receive": "外部收货",
"internal": "在库存地点之间调拨"
},
"errors": {
- "failed_to_delete": "删除库存调拨失败",
- "failed_to_record": "记录库存调拨失败"
+ "failed_to_delete": "删除调拨失败",
+ "failed_to_record": "记录库存调拨失败",
+ "same_location": "两个仓库必须不同。",
+ "failed_to_create": "创建调拨失败",
+ "failed_to_save": "保存调拨失败",
+ "failed_to_mark_ready": "标记调拨为待发出失败",
+ "failed_to_mark_in_transit": "标记调拨为在途失败",
+ "failed_to_receive": "调拨收货失败",
+ "failed_to_cancel": "取消调拨失败"
},
"messages": {
- "deleted": "库存调拨已删除",
- "recorded": "库存调拨已记录"
+ "deleted": "调拨已删除",
+ "recorded": "库存调拨已记录",
+ "created": "调拨已创建",
+ "saved": "调拨已保存",
+ "marked_ready": "调拨已待发出",
+ "marked_in_transit": "调拨已在途 — 货物已离开来源仓库",
+ "received": "调拨已收货",
+ "canceled": "调拨已取消"
},
"table": {
"empty": "暂无库存调拨",
"search_placeholder": "按编号或参考信息搜索…"
},
- "title": "库存调拨"
+ "title": "库存调拨",
+ "new_cta": "新建调拨",
+ "new_title": "新建库存调拨",
+ "details_title": "详情",
+ "items_title": "明细",
+ "items_empty": "暂无明细 — 请添加要发出的商品。",
+ "receive_title": "收货",
+ "actions_title": "操作",
+ "history_title": "目标仓库的变动",
+ "units_summary": "已发出 {{shipped}} 件,已收到 {{received}} 件",
+ "receive_running_total": "已发出 {{shipped}} 件,已清点 {{counted}} 件",
+ "discrepancy_placeholder": "为何到货变少",
+ "statuses": {
+ "draft": "草稿",
+ "ready_to_ship": "待发出",
+ "in_transit": "在途",
+ "partially_received": "部分收货",
+ "received": "已收货",
+ "canceled": "已取消"
+ },
+ "discrepancy_reasons": {
+ "damaged_in_transit": "运输中损坏",
+ "lost_in_transit": "运输中丢失",
+ "undercount": "发货时清点有误"
+ },
+ "in_transit_resolutions": {
+ "restock": "将数量退回来源仓库",
+ "write_off": "将数量按丢失核销"
+ },
+ "fields": {
+ "source": "从",
+ "source_placeholder": "选择发出仓库",
+ "destination": "到",
+ "destination_placeholder": "选择接收仓库",
+ "reference": "参考号",
+ "reference_placeholder": "你为此次运输自定的标识",
+ "notes": "备注",
+ "units": "数量",
+ "shipped_at": "发出时间",
+ "received_at": "收货时间",
+ "in_transit_resolution": "货物已经离库。它们怎么了?"
+ },
+ "actions": {
+ "create_draft": "创建草稿",
+ "mark_ready": "标记为待发出",
+ "mark_in_transit": "标记为在途",
+ "receive": "收货",
+ "cancel_transfer": "取消调拨"
+ },
+ "delete_confirm": {
+ "title": "删除此调拨?",
+ "message": "调拨 {{number}} 仍是草稿,库存未发生变动。此操作无法撤销。"
+ },
+ "ship_confirm": {
+ "title": "发出此调拨?",
+ "message": "{{count}} 件将立即离开来源仓库,在到货前不可在该仓库使用。"
+ },
+ "cancel_confirm": {
+ "title": "取消此调拨?",
+ "message": "库存尚未变动,因此无需回退。",
+ "in_flight_restock": "数量将回到来源仓库的货架,如同从未发出。",
+ "in_flight_write_off": "数量保持核销为丢失,任何仓库都不会补回。"
+ }
},
"store": {
"load_failed_title": "加载店铺设置失败",
@@ -5061,7 +5157,9 @@
"options": "尺码、颜色等选项,用于生成商品的多个款式。",
"price_lists": "规则匹配时生效的备选价格。",
"product_types": "为新商品预设字段和选项的模板。",
- "stock_transfers": "在各地点之间调拨的库存,以及已到货的部分。"
+ "stock_transfers": "在各地点之间调拨的库存,以及已到货的部分。",
+ "purchase_orders": "已向供应商订购的库存,以及已到货的部分",
+ "suppliers": "你的供应商通讯簿"
},
"tax_categories": {
"add_cta": "添加税务类别",
@@ -5306,6 +5404,163 @@
"message": "将 {{name}} 应得的款项按币种汇总为一笔打款。此操作不会转账——转账完成后请将打款标记为已支付。"
},
"settle_failed": "无法结算此卖家。"
+ },
+ "inventory_lines": {
+ "add_label": "添加商品",
+ "search_placeholder": "按名称或 SKU 搜索商品…",
+ "columns": {
+ "variant": "商品",
+ "sku": "SKU",
+ "unit_cost": "单位成本"
+ }
+ },
+ "stock_history": {
+ "title": "库存记录",
+ "empty": "此库存尚无变动",
+ "columns": {
+ "when": "时间",
+ "change": "变动",
+ "kind": "发生了什么",
+ "cause": "原因"
+ },
+ "kinds": {
+ "received": "已入库",
+ "allocated": "已分配",
+ "shipped": "已出库",
+ "released": "已释放",
+ "adjusted": "已调整"
+ },
+ "causes": {
+ "purchase_order": "采购订单",
+ "stock_transfer": "库存调拨",
+ "return": "退货",
+ "exchange": "换货",
+ "fulfillment": "履约",
+ "order": "订单",
+ "manual": "手动调整"
+ }
+ },
+ "purchase_orders": {
+ "title": "采购订单",
+ "new_cta": "新建采购订单",
+ "new_title": "新建采购订单",
+ "details_title": "详情",
+ "items_title": "明细",
+ "items_empty": "暂无明细 — 请添加要订购的商品。",
+ "receive_title": "收货",
+ "actions_title": "操作",
+ "history_title": "目标仓库的变动",
+ "units_summary": "已订购 {{ordered}} 件,已收到 {{received}} 件",
+ "receive_running_total": "已订购 {{ordered}} 件,已清点 {{counted}} 件",
+ "table": {
+ "empty": "暂无采购订单",
+ "search_placeholder": "按编号或参考号搜索…"
+ },
+ "columns": {
+ "number": "编号",
+ "supplier": "供应商",
+ "units": "已收 / 已订",
+ "subtotal": "合计",
+ "expected": "预计到货",
+ "quantity_ordered": "已订购",
+ "quantity_received": "已收到",
+ "line_total": "行合计"
+ },
+ "statuses": {
+ "draft": "草稿",
+ "ordered": "已下单",
+ "partially_received": "部分收货",
+ "received": "已收货",
+ "canceled": "已取消"
+ },
+ "fields": {
+ "supplier": "供应商",
+ "supplier_placeholder": "选择供应商",
+ "destination": "送达",
+ "destination_placeholder": "选择接收仓库",
+ "currency": "货币",
+ "expected_at": "预计到货",
+ "expected_at_placeholder": "供应商承诺的日期",
+ "reference": "供应商参考号",
+ "reference_placeholder": "供应商自己的订单号",
+ "notes": "备注",
+ "units": "数量",
+ "subtotal": "合计",
+ "ordered_at": "下单时间",
+ "received_at": "收货时间"
+ },
+ "actions": {
+ "create_draft": "创建草稿",
+ "mark_ordered": "标记为已下单",
+ "receive": "收货",
+ "cancel_order": "取消订单"
+ },
+ "messages": {
+ "created": "采购订单已创建",
+ "saved": "采购订单已保存",
+ "deleted": "采购订单已删除",
+ "ordered": "采购订单已下单",
+ "received": "到货已入库",
+ "canceled": "采购订单已取消"
+ },
+ "errors": {
+ "failed_to_create": "创建采购订单失败",
+ "failed_to_save": "保存采购订单失败",
+ "failed_to_delete": "删除采购订单失败",
+ "failed_to_order": "下单失败",
+ "failed_to_receive": "到货入库失败",
+ "failed_to_cancel": "取消采购订单失败"
+ },
+ "delete_confirm": {
+ "title": "删除此采购订单?",
+ "message": "订单 {{number}} 仍是草稿,尚未订购任何商品。此操作无法撤销。"
+ },
+ "order_confirm": {
+ "title": "提交此订单?",
+ "message": "订单发往 {{supplier}} 后明细将被锁定。已订购的库存要到货后才计入可用。"
+ },
+ "cancel_confirm": {
+ "title": "取消此采购订单?",
+ "message": "尚未到货的部分将被取消。已收到的数量仍留在库存中。"
+ }
+ },
+ "suppliers": {
+ "title": "供应商",
+ "new_cta": "新建供应商",
+ "new_title": "新建供应商",
+ "edit_title": "编辑供应商",
+ "sheet_description": "你从谁那里采购库存,以及如何联系他们。",
+ "table": {
+ "empty": "暂无供应商",
+ "search_placeholder": "按名称、联系人或邮箱搜索…"
+ },
+ "columns": {
+ "contact": "联系人",
+ "orders": "采购订单"
+ },
+ "fields": {
+ "contact_name": "联系人姓名",
+ "address1": "地址",
+ "address2": "地址第二行",
+ "city": "城市",
+ "postal_code": "邮政编码",
+ "notes": "备注"
+ },
+ "messages": {
+ "created": "供应商已创建",
+ "saved": "供应商已保存",
+ "deleted": "供应商已删除"
+ },
+ "errors": {
+ "name_blank": "供应商需要一个名称。",
+ "failed_to_create": "创建供应商失败",
+ "failed_to_save": "保存供应商失败",
+ "failed_to_delete": "删除供应商失败"
+ },
+ "delete_confirm": {
+ "title": "删除此供应商?",
+ "message": "{{name}} 将无法用于新的采购订单。已有订单仍会显示该供应商。"
+ }
}
}
}
diff --git a/packages/dashboard/src/nav/default.ts b/packages/dashboard/src/nav/default.ts
index 12346838de..562104c3f3 100644
--- a/packages/dashboard/src/nav/default.ts
+++ b/packages/dashboard/src/nav/default.ts
@@ -154,6 +154,13 @@ nav.add({
subject: Subject.StockTransfer,
position: 500,
},
+ {
+ key: 'products.purchase-orders',
+ labelKey: 'admin.nav.purchase_orders',
+ path: '/products/purchase-orders',
+ subject: Subject.PurchaseOrder,
+ position: 550,
+ },
],
})
diff --git a/packages/dashboard/src/nav/settings.ts b/packages/dashboard/src/nav/settings.ts
index 0c59517725..2b2d751253 100644
--- a/packages/dashboard/src/nav/settings.ts
+++ b/packages/dashboard/src/nav/settings.ts
@@ -1,6 +1,7 @@
import { Subject, settingsNav } from '@spree/dashboard-core'
import {
BanknoteIcon,
+ Building2Icon,
ClipboardCheckIcon,
CreditCardIcon,
GlobeIcon,
@@ -223,6 +224,18 @@ settingsNav.add({
subject: Subject.PackageType,
})
+settingsNav.add({
+ key: 'settings.suppliers',
+ labelKey: 'admin.settings_nav.items.suppliers',
+ descriptionKey: 'admin.settings_nav.descriptions.suppliers',
+ keywords: ['vendor', 'purchasing', 'procurement', 'purchase orders'],
+ path: '/suppliers',
+ icon: Building2Icon,
+ group: 'shipping',
+ position: 250,
+ subject: Subject.Supplier,
+})
+
settingsNav.add({
key: 'settings.product-types',
labelKey: 'admin.settings_nav.items.product_types',
diff --git a/packages/dashboard/src/routeTree.gen.ts b/packages/dashboard/src/routeTree.gen.ts
index 958926d5dd..b06bb3e124 100644
--- a/packages/dashboard/src/routeTree.gen.ts
+++ b/packages/dashboard/src/routeTree.gen.ts
@@ -33,6 +33,7 @@ import { Route as CustomersIndexRouteImport } from './routes/_authenticated/$sto
import { Route as CompaniesIndexRouteImport } from './routes/_authenticated/$storeId/companies/index'
import { Route as SettingsTaxRatesRouteImport } from './routes/_authenticated/$storeId/settings/tax-rates'
import { Route as SettingsTaxCategoriesRouteImport } from './routes/_authenticated/$storeId/settings/tax-categories'
+import { Route as SettingsSuppliersRouteImport } from './routes/_authenticated/$storeId/settings/suppliers'
import { Route as SettingsStoreRouteImport } from './routes/_authenticated/$storeId/settings/store'
import { Route as SettingsStockLocationsRouteImport } from './routes/_authenticated/$storeId/settings/stock-locations'
import { Route as SettingsStaffRouteImport } from './routes/_authenticated/$storeId/settings/staff'
@@ -58,7 +59,6 @@ import { Route as PromotionsNewRouteImport } from './routes/_authenticated/$stor
import { Route as PromotionsGiftCardsRouteImport } from './routes/_authenticated/$storeId/promotions/gift-cards'
import { Route as PromotionsPromotionIdRouteImport } from './routes/_authenticated/$storeId/promotions/$promotionId'
import { Route as ProductsTranslationsRouteImport } from './routes/_authenticated/$storeId/products/translations'
-import { Route as ProductsTransfersRouteImport } from './routes/_authenticated/$storeId/products/transfers'
import { Route as ProductsOptionsRouteImport } from './routes/_authenticated/$storeId/products/options'
import { Route as ProductsNewRouteImport } from './routes/_authenticated/$storeId/products/new'
import { Route as ProductsMediaRouteImport } from './routes/_authenticated/$storeId/products/media'
@@ -72,6 +72,8 @@ import { Route as SettingsWebhooksIndexRouteImport } from './routes/_authenticat
import { Route as SettingsImportsIndexRouteImport } from './routes/_authenticated/$storeId/settings/imports/index'
import { Route as SettingsDeliveryProfilesIndexRouteImport } from './routes/_authenticated/$storeId/settings/delivery-profiles/index'
import { Route as SellersPayoutsIndexRouteImport } from './routes/_authenticated/$storeId/sellers/payouts/index'
+import { Route as ProductsTransfersIndexRouteImport } from './routes/_authenticated/$storeId/products/transfers/index'
+import { Route as ProductsPurchaseOrdersIndexRouteImport } from './routes/_authenticated/$storeId/products/purchase-orders/index'
import { Route as ProductsPriceListsIndexRouteImport } from './routes/_authenticated/$storeId/products/price-lists/index'
import { Route as ProductsCollectionsIndexRouteImport } from './routes/_authenticated/$storeId/products/collections/index'
import { Route as ProductsCategoriesIndexRouteImport } from './routes/_authenticated/$storeId/products/categories/index'
@@ -79,6 +81,10 @@ import { Route as ProductsCatalogsIndexRouteImport } from './routes/_authenticat
import { Route as OrdersOrderIdIndexRouteImport } from './routes/_authenticated/$storeId/orders/$orderId/index'
import { Route as SettingsWebhooksWebhookEndpointIdRouteImport } from './routes/_authenticated/$storeId/settings/webhooks/$webhookEndpointId'
import { Route as SellersPayoutsPayoutIdRouteImport } from './routes/_authenticated/$storeId/sellers/payouts/$payoutId'
+import { Route as ProductsTransfersNewRouteImport } from './routes/_authenticated/$storeId/products/transfers/new'
+import { Route as ProductsTransfersTransferIdRouteImport } from './routes/_authenticated/$storeId/products/transfers/$transferId'
+import { Route as ProductsPurchaseOrdersNewRouteImport } from './routes/_authenticated/$storeId/products/purchase-orders/new'
+import { Route as ProductsPurchaseOrdersPurchaseOrderIdRouteImport } from './routes/_authenticated/$storeId/products/purchase-orders/$purchaseOrderId'
import { Route as ProductsPriceListsNewRouteImport } from './routes/_authenticated/$storeId/products/price-lists/new'
import { Route as ProductsCollectionsNewRouteImport } from './routes/_authenticated/$storeId/products/collections/new'
import { Route as ProductsCollectionsCollectionIdRouteImport } from './routes/_authenticated/$storeId/products/collections/$collectionId'
@@ -211,6 +217,11 @@ const SettingsTaxCategoriesRoute = SettingsTaxCategoriesRouteImport.update({
path: '/tax-categories',
getParentRoute: () => SettingsRoute,
} as any)
+const SettingsSuppliersRoute = SettingsSuppliersRouteImport.update({
+ id: '/suppliers',
+ path: '/suppliers',
+ getParentRoute: () => SettingsRoute,
+} as any)
const SettingsStoreRoute = SettingsStoreRouteImport.update({
id: '/store',
path: '/store',
@@ -338,11 +349,6 @@ const ProductsTranslationsRoute = ProductsTranslationsRouteImport.update({
path: '/products/translations',
getParentRoute: () => authenticatedStoreIdRoute,
} as any)
-const ProductsTransfersRoute = ProductsTransfersRouteImport.update({
- id: '/products/transfers',
- path: '/products/transfers',
- getParentRoute: () => authenticatedStoreIdRoute,
-} as any)
const ProductsOptionsRoute = ProductsOptionsRouteImport.update({
id: '/products/options',
path: '/products/options',
@@ -409,6 +415,17 @@ const SellersPayoutsIndexRoute = SellersPayoutsIndexRouteImport.update({
path: '/sellers/payouts/',
getParentRoute: () => authenticatedStoreIdRoute,
} as any)
+const ProductsTransfersIndexRoute = ProductsTransfersIndexRouteImport.update({
+ id: '/products/transfers/',
+ path: '/products/transfers/',
+ getParentRoute: () => authenticatedStoreIdRoute,
+} as any)
+const ProductsPurchaseOrdersIndexRoute =
+ ProductsPurchaseOrdersIndexRouteImport.update({
+ id: '/products/purchase-orders/',
+ path: '/products/purchase-orders/',
+ getParentRoute: () => authenticatedStoreIdRoute,
+ } as any)
const ProductsPriceListsIndexRoute = ProductsPriceListsIndexRouteImport.update({
id: '/products/price-lists/',
path: '/products/price-lists/',
@@ -446,6 +463,29 @@ const SellersPayoutsPayoutIdRoute = SellersPayoutsPayoutIdRouteImport.update({
path: '/sellers/payouts/$payoutId',
getParentRoute: () => authenticatedStoreIdRoute,
} as any)
+const ProductsTransfersNewRoute = ProductsTransfersNewRouteImport.update({
+ id: '/products/transfers/new',
+ path: '/products/transfers/new',
+ getParentRoute: () => authenticatedStoreIdRoute,
+} as any)
+const ProductsTransfersTransferIdRoute =
+ ProductsTransfersTransferIdRouteImport.update({
+ id: '/products/transfers/$transferId',
+ path: '/products/transfers/$transferId',
+ getParentRoute: () => authenticatedStoreIdRoute,
+ } as any)
+const ProductsPurchaseOrdersNewRoute =
+ ProductsPurchaseOrdersNewRouteImport.update({
+ id: '/products/purchase-orders/new',
+ path: '/products/purchase-orders/new',
+ getParentRoute: () => authenticatedStoreIdRoute,
+ } as any)
+const ProductsPurchaseOrdersPurchaseOrderIdRoute =
+ ProductsPurchaseOrdersPurchaseOrderIdRouteImport.update({
+ id: '/products/purchase-orders/$purchaseOrderId',
+ path: '/products/purchase-orders/$purchaseOrderId',
+ getParentRoute: () => authenticatedStoreIdRoute,
+ } as any)
const ProductsPriceListsNewRoute = ProductsPriceListsNewRouteImport.update({
id: '/products/price-lists/new',
path: '/products/price-lists/new',
@@ -533,7 +573,6 @@ export interface FileRoutesByFullPath {
'/$storeId/products/media': typeof ProductsMediaRoute
'/$storeId/products/new': typeof ProductsNewRoute
'/$storeId/products/options': typeof ProductsOptionsRoute
- '/$storeId/products/transfers': typeof ProductsTransfersRoute
'/$storeId/products/translations': typeof ProductsTranslationsRoute
'/$storeId/promotions/$promotionId': typeof PromotionsPromotionIdRoute
'/$storeId/promotions/gift-cards': typeof PromotionsGiftCardsRoute
@@ -559,6 +598,7 @@ export interface FileRoutesByFullPath {
'/$storeId/settings/staff': typeof SettingsStaffRoute
'/$storeId/settings/stock-locations': typeof SettingsStockLocationsRoute
'/$storeId/settings/store': typeof SettingsStoreRoute
+ '/$storeId/settings/suppliers': typeof SettingsSuppliersRoute
'/$storeId/settings/tax-categories': typeof SettingsTaxCategoriesRoute
'/$storeId/settings/tax-rates': typeof SettingsTaxRatesRoute
'/$storeId/companies/': typeof CompaniesIndexRoute
@@ -575,6 +615,10 @@ export interface FileRoutesByFullPath {
'/$storeId/products/collections/$collectionId': typeof ProductsCollectionsCollectionIdRoute
'/$storeId/products/collections/new': typeof ProductsCollectionsNewRoute
'/$storeId/products/price-lists/new': typeof ProductsPriceListsNewRoute
+ '/$storeId/products/purchase-orders/$purchaseOrderId': typeof ProductsPurchaseOrdersPurchaseOrderIdRoute
+ '/$storeId/products/purchase-orders/new': typeof ProductsPurchaseOrdersNewRoute
+ '/$storeId/products/transfers/$transferId': typeof ProductsTransfersTransferIdRoute
+ '/$storeId/products/transfers/new': typeof ProductsTransfersNewRoute
'/$storeId/sellers/payouts/$payoutId': typeof SellersPayoutsPayoutIdRoute
'/$storeId/settings/webhooks/$webhookEndpointId': typeof SettingsWebhooksWebhookEndpointIdRoute
'/$storeId/orders/$orderId/': typeof OrdersOrderIdIndexRoute
@@ -582,6 +626,8 @@ export interface FileRoutesByFullPath {
'/$storeId/products/categories/': typeof ProductsCategoriesIndexRoute
'/$storeId/products/collections/': typeof ProductsCollectionsIndexRoute
'/$storeId/products/price-lists/': typeof ProductsPriceListsIndexRoute
+ '/$storeId/products/purchase-orders/': typeof ProductsPurchaseOrdersIndexRoute
+ '/$storeId/products/transfers/': typeof ProductsTransfersIndexRoute
'/$storeId/sellers/payouts/': typeof SellersPayoutsIndexRoute
'/$storeId/settings/delivery-profiles/': typeof SettingsDeliveryProfilesIndexRoute
'/$storeId/settings/imports/': typeof SettingsImportsIndexRoute
@@ -613,7 +659,6 @@ export interface FileRoutesByTo {
'/$storeId/products/media': typeof ProductsMediaRoute
'/$storeId/products/new': typeof ProductsNewRoute
'/$storeId/products/options': typeof ProductsOptionsRoute
- '/$storeId/products/transfers': typeof ProductsTransfersRoute
'/$storeId/products/translations': typeof ProductsTranslationsRoute
'/$storeId/promotions/$promotionId': typeof PromotionsPromotionIdRoute
'/$storeId/promotions/gift-cards': typeof PromotionsGiftCardsRoute
@@ -639,6 +684,7 @@ export interface FileRoutesByTo {
'/$storeId/settings/staff': typeof SettingsStaffRoute
'/$storeId/settings/stock-locations': typeof SettingsStockLocationsRoute
'/$storeId/settings/store': typeof SettingsStoreRoute
+ '/$storeId/settings/suppliers': typeof SettingsSuppliersRoute
'/$storeId/settings/tax-categories': typeof SettingsTaxCategoriesRoute
'/$storeId/settings/tax-rates': typeof SettingsTaxRatesRoute
'/$storeId/companies': typeof CompaniesIndexRoute
@@ -655,6 +701,10 @@ export interface FileRoutesByTo {
'/$storeId/products/collections/$collectionId': typeof ProductsCollectionsCollectionIdRoute
'/$storeId/products/collections/new': typeof ProductsCollectionsNewRoute
'/$storeId/products/price-lists/new': typeof ProductsPriceListsNewRoute
+ '/$storeId/products/purchase-orders/$purchaseOrderId': typeof ProductsPurchaseOrdersPurchaseOrderIdRoute
+ '/$storeId/products/purchase-orders/new': typeof ProductsPurchaseOrdersNewRoute
+ '/$storeId/products/transfers/$transferId': typeof ProductsTransfersTransferIdRoute
+ '/$storeId/products/transfers/new': typeof ProductsTransfersNewRoute
'/$storeId/sellers/payouts/$payoutId': typeof SellersPayoutsPayoutIdRoute
'/$storeId/settings/webhooks/$webhookEndpointId': typeof SettingsWebhooksWebhookEndpointIdRoute
'/$storeId/orders/$orderId': typeof OrdersOrderIdIndexRoute
@@ -662,6 +712,8 @@ export interface FileRoutesByTo {
'/$storeId/products/categories': typeof ProductsCategoriesIndexRoute
'/$storeId/products/collections': typeof ProductsCollectionsIndexRoute
'/$storeId/products/price-lists': typeof ProductsPriceListsIndexRoute
+ '/$storeId/products/purchase-orders': typeof ProductsPurchaseOrdersIndexRoute
+ '/$storeId/products/transfers': typeof ProductsTransfersIndexRoute
'/$storeId/sellers/payouts': typeof SellersPayoutsIndexRoute
'/$storeId/settings/delivery-profiles': typeof SettingsDeliveryProfilesIndexRoute
'/$storeId/settings/imports': typeof SettingsImportsIndexRoute
@@ -697,7 +749,6 @@ export interface FileRoutesById {
'/_authenticated/$storeId/products/media': typeof ProductsMediaRoute
'/_authenticated/$storeId/products/new': typeof ProductsNewRoute
'/_authenticated/$storeId/products/options': typeof ProductsOptionsRoute
- '/_authenticated/$storeId/products/transfers': typeof ProductsTransfersRoute
'/_authenticated/$storeId/products/translations': typeof ProductsTranslationsRoute
'/_authenticated/$storeId/promotions/$promotionId': typeof PromotionsPromotionIdRoute
'/_authenticated/$storeId/promotions/gift-cards': typeof PromotionsGiftCardsRoute
@@ -723,6 +774,7 @@ export interface FileRoutesById {
'/_authenticated/$storeId/settings/staff': typeof SettingsStaffRoute
'/_authenticated/$storeId/settings/stock-locations': typeof SettingsStockLocationsRoute
'/_authenticated/$storeId/settings/store': typeof SettingsStoreRoute
+ '/_authenticated/$storeId/settings/suppliers': typeof SettingsSuppliersRoute
'/_authenticated/$storeId/settings/tax-categories': typeof SettingsTaxCategoriesRoute
'/_authenticated/$storeId/settings/tax-rates': typeof SettingsTaxRatesRoute
'/_authenticated/$storeId/companies/': typeof CompaniesIndexRoute
@@ -739,6 +791,10 @@ export interface FileRoutesById {
'/_authenticated/$storeId/products/collections/$collectionId': typeof ProductsCollectionsCollectionIdRoute
'/_authenticated/$storeId/products/collections/new': typeof ProductsCollectionsNewRoute
'/_authenticated/$storeId/products/price-lists/new': typeof ProductsPriceListsNewRoute
+ '/_authenticated/$storeId/products/purchase-orders/$purchaseOrderId': typeof ProductsPurchaseOrdersPurchaseOrderIdRoute
+ '/_authenticated/$storeId/products/purchase-orders/new': typeof ProductsPurchaseOrdersNewRoute
+ '/_authenticated/$storeId/products/transfers/$transferId': typeof ProductsTransfersTransferIdRoute
+ '/_authenticated/$storeId/products/transfers/new': typeof ProductsTransfersNewRoute
'/_authenticated/$storeId/sellers/payouts/$payoutId': typeof SellersPayoutsPayoutIdRoute
'/_authenticated/$storeId/settings/webhooks/$webhookEndpointId': typeof SettingsWebhooksWebhookEndpointIdRoute
'/_authenticated/$storeId/orders/$orderId/': typeof OrdersOrderIdIndexRoute
@@ -746,6 +802,8 @@ export interface FileRoutesById {
'/_authenticated/$storeId/products/categories/': typeof ProductsCategoriesIndexRoute
'/_authenticated/$storeId/products/collections/': typeof ProductsCollectionsIndexRoute
'/_authenticated/$storeId/products/price-lists/': typeof ProductsPriceListsIndexRoute
+ '/_authenticated/$storeId/products/purchase-orders/': typeof ProductsPurchaseOrdersIndexRoute
+ '/_authenticated/$storeId/products/transfers/': typeof ProductsTransfersIndexRoute
'/_authenticated/$storeId/sellers/payouts/': typeof SellersPayoutsIndexRoute
'/_authenticated/$storeId/settings/delivery-profiles/': typeof SettingsDeliveryProfilesIndexRoute
'/_authenticated/$storeId/settings/imports/': typeof SettingsImportsIndexRoute
@@ -781,7 +839,6 @@ export interface FileRouteTypes {
| '/$storeId/products/media'
| '/$storeId/products/new'
| '/$storeId/products/options'
- | '/$storeId/products/transfers'
| '/$storeId/products/translations'
| '/$storeId/promotions/$promotionId'
| '/$storeId/promotions/gift-cards'
@@ -807,6 +864,7 @@ export interface FileRouteTypes {
| '/$storeId/settings/staff'
| '/$storeId/settings/stock-locations'
| '/$storeId/settings/store'
+ | '/$storeId/settings/suppliers'
| '/$storeId/settings/tax-categories'
| '/$storeId/settings/tax-rates'
| '/$storeId/companies/'
@@ -823,6 +881,10 @@ export interface FileRouteTypes {
| '/$storeId/products/collections/$collectionId'
| '/$storeId/products/collections/new'
| '/$storeId/products/price-lists/new'
+ | '/$storeId/products/purchase-orders/$purchaseOrderId'
+ | '/$storeId/products/purchase-orders/new'
+ | '/$storeId/products/transfers/$transferId'
+ | '/$storeId/products/transfers/new'
| '/$storeId/sellers/payouts/$payoutId'
| '/$storeId/settings/webhooks/$webhookEndpointId'
| '/$storeId/orders/$orderId/'
@@ -830,6 +892,8 @@ export interface FileRouteTypes {
| '/$storeId/products/categories/'
| '/$storeId/products/collections/'
| '/$storeId/products/price-lists/'
+ | '/$storeId/products/purchase-orders/'
+ | '/$storeId/products/transfers/'
| '/$storeId/sellers/payouts/'
| '/$storeId/settings/delivery-profiles/'
| '/$storeId/settings/imports/'
@@ -861,7 +925,6 @@ export interface FileRouteTypes {
| '/$storeId/products/media'
| '/$storeId/products/new'
| '/$storeId/products/options'
- | '/$storeId/products/transfers'
| '/$storeId/products/translations'
| '/$storeId/promotions/$promotionId'
| '/$storeId/promotions/gift-cards'
@@ -887,6 +950,7 @@ export interface FileRouteTypes {
| '/$storeId/settings/staff'
| '/$storeId/settings/stock-locations'
| '/$storeId/settings/store'
+ | '/$storeId/settings/suppliers'
| '/$storeId/settings/tax-categories'
| '/$storeId/settings/tax-rates'
| '/$storeId/companies'
@@ -903,6 +967,10 @@ export interface FileRouteTypes {
| '/$storeId/products/collections/$collectionId'
| '/$storeId/products/collections/new'
| '/$storeId/products/price-lists/new'
+ | '/$storeId/products/purchase-orders/$purchaseOrderId'
+ | '/$storeId/products/purchase-orders/new'
+ | '/$storeId/products/transfers/$transferId'
+ | '/$storeId/products/transfers/new'
| '/$storeId/sellers/payouts/$payoutId'
| '/$storeId/settings/webhooks/$webhookEndpointId'
| '/$storeId/orders/$orderId'
@@ -910,6 +978,8 @@ export interface FileRouteTypes {
| '/$storeId/products/categories'
| '/$storeId/products/collections'
| '/$storeId/products/price-lists'
+ | '/$storeId/products/purchase-orders'
+ | '/$storeId/products/transfers'
| '/$storeId/sellers/payouts'
| '/$storeId/settings/delivery-profiles'
| '/$storeId/settings/imports'
@@ -944,7 +1014,6 @@ export interface FileRouteTypes {
| '/_authenticated/$storeId/products/media'
| '/_authenticated/$storeId/products/new'
| '/_authenticated/$storeId/products/options'
- | '/_authenticated/$storeId/products/transfers'
| '/_authenticated/$storeId/products/translations'
| '/_authenticated/$storeId/promotions/$promotionId'
| '/_authenticated/$storeId/promotions/gift-cards'
@@ -970,6 +1039,7 @@ export interface FileRouteTypes {
| '/_authenticated/$storeId/settings/staff'
| '/_authenticated/$storeId/settings/stock-locations'
| '/_authenticated/$storeId/settings/store'
+ | '/_authenticated/$storeId/settings/suppliers'
| '/_authenticated/$storeId/settings/tax-categories'
| '/_authenticated/$storeId/settings/tax-rates'
| '/_authenticated/$storeId/companies/'
@@ -986,6 +1056,10 @@ export interface FileRouteTypes {
| '/_authenticated/$storeId/products/collections/$collectionId'
| '/_authenticated/$storeId/products/collections/new'
| '/_authenticated/$storeId/products/price-lists/new'
+ | '/_authenticated/$storeId/products/purchase-orders/$purchaseOrderId'
+ | '/_authenticated/$storeId/products/purchase-orders/new'
+ | '/_authenticated/$storeId/products/transfers/$transferId'
+ | '/_authenticated/$storeId/products/transfers/new'
| '/_authenticated/$storeId/sellers/payouts/$payoutId'
| '/_authenticated/$storeId/settings/webhooks/$webhookEndpointId'
| '/_authenticated/$storeId/orders/$orderId/'
@@ -993,6 +1067,8 @@ export interface FileRouteTypes {
| '/_authenticated/$storeId/products/categories/'
| '/_authenticated/$storeId/products/collections/'
| '/_authenticated/$storeId/products/price-lists/'
+ | '/_authenticated/$storeId/products/purchase-orders/'
+ | '/_authenticated/$storeId/products/transfers/'
| '/_authenticated/$storeId/sellers/payouts/'
| '/_authenticated/$storeId/settings/delivery-profiles/'
| '/_authenticated/$storeId/settings/imports/'
@@ -1182,6 +1258,13 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof SettingsTaxCategoriesRouteImport
parentRoute: typeof SettingsRoute
}
+ '/_authenticated/$storeId/settings/suppliers': {
+ id: '/_authenticated/$storeId/settings/suppliers'
+ path: '/suppliers'
+ fullPath: '/$storeId/settings/suppliers'
+ preLoaderRoute: typeof SettingsSuppliersRouteImport
+ parentRoute: typeof SettingsRoute
+ }
'/_authenticated/$storeId/settings/store': {
id: '/_authenticated/$storeId/settings/store'
path: '/store'
@@ -1357,13 +1440,6 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof ProductsTranslationsRouteImport
parentRoute: typeof authenticatedStoreIdRoute
}
- '/_authenticated/$storeId/products/transfers': {
- id: '/_authenticated/$storeId/products/transfers'
- path: '/products/transfers'
- fullPath: '/$storeId/products/transfers'
- preLoaderRoute: typeof ProductsTransfersRouteImport
- parentRoute: typeof authenticatedStoreIdRoute
- }
'/_authenticated/$storeId/products/options': {
id: '/_authenticated/$storeId/products/options'
path: '/products/options'
@@ -1455,6 +1531,20 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof SellersPayoutsIndexRouteImport
parentRoute: typeof authenticatedStoreIdRoute
}
+ '/_authenticated/$storeId/products/transfers/': {
+ id: '/_authenticated/$storeId/products/transfers/'
+ path: '/products/transfers'
+ fullPath: '/$storeId/products/transfers/'
+ preLoaderRoute: typeof ProductsTransfersIndexRouteImport
+ parentRoute: typeof authenticatedStoreIdRoute
+ }
+ '/_authenticated/$storeId/products/purchase-orders/': {
+ id: '/_authenticated/$storeId/products/purchase-orders/'
+ path: '/products/purchase-orders'
+ fullPath: '/$storeId/products/purchase-orders/'
+ preLoaderRoute: typeof ProductsPurchaseOrdersIndexRouteImport
+ parentRoute: typeof authenticatedStoreIdRoute
+ }
'/_authenticated/$storeId/products/price-lists/': {
id: '/_authenticated/$storeId/products/price-lists/'
path: '/products/price-lists'
@@ -1504,6 +1594,34 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof SellersPayoutsPayoutIdRouteImport
parentRoute: typeof authenticatedStoreIdRoute
}
+ '/_authenticated/$storeId/products/transfers/new': {
+ id: '/_authenticated/$storeId/products/transfers/new'
+ path: '/products/transfers/new'
+ fullPath: '/$storeId/products/transfers/new'
+ preLoaderRoute: typeof ProductsTransfersNewRouteImport
+ parentRoute: typeof authenticatedStoreIdRoute
+ }
+ '/_authenticated/$storeId/products/transfers/$transferId': {
+ id: '/_authenticated/$storeId/products/transfers/$transferId'
+ path: '/products/transfers/$transferId'
+ fullPath: '/$storeId/products/transfers/$transferId'
+ preLoaderRoute: typeof ProductsTransfersTransferIdRouteImport
+ parentRoute: typeof authenticatedStoreIdRoute
+ }
+ '/_authenticated/$storeId/products/purchase-orders/new': {
+ id: '/_authenticated/$storeId/products/purchase-orders/new'
+ path: '/products/purchase-orders/new'
+ fullPath: '/$storeId/products/purchase-orders/new'
+ preLoaderRoute: typeof ProductsPurchaseOrdersNewRouteImport
+ parentRoute: typeof authenticatedStoreIdRoute
+ }
+ '/_authenticated/$storeId/products/purchase-orders/$purchaseOrderId': {
+ id: '/_authenticated/$storeId/products/purchase-orders/$purchaseOrderId'
+ path: '/products/purchase-orders/$purchaseOrderId'
+ fullPath: '/$storeId/products/purchase-orders/$purchaseOrderId'
+ preLoaderRoute: typeof ProductsPurchaseOrdersPurchaseOrderIdRouteImport
+ parentRoute: typeof authenticatedStoreIdRoute
+ }
'/_authenticated/$storeId/products/price-lists/new': {
id: '/_authenticated/$storeId/products/price-lists/new'
path: '/products/price-lists/new'
@@ -1604,6 +1722,7 @@ interface SettingsRouteChildren {
SettingsStaffRoute: typeof SettingsStaffRoute
SettingsStockLocationsRoute: typeof SettingsStockLocationsRoute
SettingsStoreRoute: typeof SettingsStoreRoute
+ SettingsSuppliersRoute: typeof SettingsSuppliersRoute
SettingsTaxCategoriesRoute: typeof SettingsTaxCategoriesRoute
SettingsTaxRatesRoute: typeof SettingsTaxRatesRoute
SettingsIndexRoute: typeof SettingsIndexRoute
@@ -1636,6 +1755,7 @@ const SettingsRouteChildren: SettingsRouteChildren = {
SettingsStaffRoute: SettingsStaffRoute,
SettingsStockLocationsRoute: SettingsStockLocationsRoute,
SettingsStoreRoute: SettingsStoreRoute,
+ SettingsSuppliersRoute: SettingsSuppliersRoute,
SettingsTaxCategoriesRoute: SettingsTaxCategoriesRoute,
SettingsTaxRatesRoute: SettingsTaxRatesRoute,
SettingsIndexRoute: SettingsIndexRoute,
@@ -1673,7 +1793,6 @@ interface authenticatedStoreIdRouteChildren {
ProductsMediaRoute: typeof ProductsMediaRoute
ProductsNewRoute: typeof ProductsNewRoute
ProductsOptionsRoute: typeof ProductsOptionsRoute
- ProductsTransfersRoute: typeof ProductsTransfersRoute
ProductsTranslationsRoute: typeof ProductsTranslationsRoute
PromotionsPromotionIdRoute: typeof PromotionsPromotionIdRoute
PromotionsGiftCardsRoute: typeof PromotionsGiftCardsRoute
@@ -1693,12 +1812,18 @@ interface authenticatedStoreIdRouteChildren {
ProductsCollectionsCollectionIdRoute: typeof ProductsCollectionsCollectionIdRoute
ProductsCollectionsNewRoute: typeof ProductsCollectionsNewRoute
ProductsPriceListsNewRoute: typeof ProductsPriceListsNewRoute
+ ProductsPurchaseOrdersPurchaseOrderIdRoute: typeof ProductsPurchaseOrdersPurchaseOrderIdRoute
+ ProductsPurchaseOrdersNewRoute: typeof ProductsPurchaseOrdersNewRoute
+ ProductsTransfersTransferIdRoute: typeof ProductsTransfersTransferIdRoute
+ ProductsTransfersNewRoute: typeof ProductsTransfersNewRoute
SellersPayoutsPayoutIdRoute: typeof SellersPayoutsPayoutIdRoute
OrdersOrderIdIndexRoute: typeof OrdersOrderIdIndexRoute
ProductsCatalogsIndexRoute: typeof ProductsCatalogsIndexRoute
ProductsCategoriesIndexRoute: typeof ProductsCategoriesIndexRoute
ProductsCollectionsIndexRoute: typeof ProductsCollectionsIndexRoute
ProductsPriceListsIndexRoute: typeof ProductsPriceListsIndexRoute
+ ProductsPurchaseOrdersIndexRoute: typeof ProductsPurchaseOrdersIndexRoute
+ ProductsTransfersIndexRoute: typeof ProductsTransfersIndexRoute
SellersPayoutsIndexRoute: typeof SellersPayoutsIndexRoute
ProductsPriceListsPriceListIdIndexRoute: typeof ProductsPriceListsPriceListIdIndexRoute
}
@@ -1720,7 +1845,6 @@ const authenticatedStoreIdRouteChildren: authenticatedStoreIdRouteChildren = {
ProductsMediaRoute: ProductsMediaRoute,
ProductsNewRoute: ProductsNewRoute,
ProductsOptionsRoute: ProductsOptionsRoute,
- ProductsTransfersRoute: ProductsTransfersRoute,
ProductsTranslationsRoute: ProductsTranslationsRoute,
PromotionsPromotionIdRoute: PromotionsPromotionIdRoute,
PromotionsGiftCardsRoute: PromotionsGiftCardsRoute,
@@ -1740,12 +1864,19 @@ const authenticatedStoreIdRouteChildren: authenticatedStoreIdRouteChildren = {
ProductsCollectionsCollectionIdRoute: ProductsCollectionsCollectionIdRoute,
ProductsCollectionsNewRoute: ProductsCollectionsNewRoute,
ProductsPriceListsNewRoute: ProductsPriceListsNewRoute,
+ ProductsPurchaseOrdersPurchaseOrderIdRoute:
+ ProductsPurchaseOrdersPurchaseOrderIdRoute,
+ ProductsPurchaseOrdersNewRoute: ProductsPurchaseOrdersNewRoute,
+ ProductsTransfersTransferIdRoute: ProductsTransfersTransferIdRoute,
+ ProductsTransfersNewRoute: ProductsTransfersNewRoute,
SellersPayoutsPayoutIdRoute: SellersPayoutsPayoutIdRoute,
OrdersOrderIdIndexRoute: OrdersOrderIdIndexRoute,
ProductsCatalogsIndexRoute: ProductsCatalogsIndexRoute,
ProductsCategoriesIndexRoute: ProductsCategoriesIndexRoute,
ProductsCollectionsIndexRoute: ProductsCollectionsIndexRoute,
ProductsPriceListsIndexRoute: ProductsPriceListsIndexRoute,
+ ProductsPurchaseOrdersIndexRoute: ProductsPurchaseOrdersIndexRoute,
+ ProductsTransfersIndexRoute: ProductsTransfersIndexRoute,
SellersPayoutsIndexRoute: SellersPayoutsIndexRoute,
ProductsPriceListsPriceListIdIndexRoute:
ProductsPriceListsPriceListIdIndexRoute,
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/products/$productId.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/products/$productId.tsx
index 0640333fdb..749f2b39a8 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/products/$productId.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/products/$productId.tsx
@@ -44,6 +44,7 @@ import { ProductCustomFieldsProvider } from '../../../../components/spree/produc
import { ProductReviewActions } from '../../../../components/spree/products/product-review-actions'
import { ProductSellerCard } from '../../../../components/spree/products/product-seller-card'
import { PublishingCard } from '../../../../components/spree/products/publishing-card'
+import { StockHistoryCard } from '../../../../components/spree/stock-history-card'
import { ResourceTranslationsCard } from '../../../../components/spree/translations/resource-translations-card'
import { useDeleteProduct, useProduct, useUpdateProduct } from '../../../../hooks/use-product'
import { useProductMedia } from '../../../../hooks/use-product-media'
@@ -290,6 +291,10 @@ function ProductForm({ product }: { product: Product }) {
`/${storeId}/settings/stock-locations?edit=${encodeURIComponent(id)}`
}
/>
+ {/* Why the on-hand numbers above are what they are. Across every
+ variant, because that is the question a merchant asks on a
+ product page (docs/plans/6.0-inventory-operations.md). */}
+ <StockHistoryCard variantIds={assignableVariants.map((variant) => variant.id)} />
<DigitalAssetsCard productId={productId} variants={assignableVariants} />
<ProductCustomFieldsProvider form={form} productTypeId={selectedProductTypeId}>
<CustomFieldsInlineCard />
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/products/purchase-orders/$purchaseOrderId.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/products/purchase-orders/$purchaseOrderId.tsx
new file mode 100644
index 0000000000..9a168c9e96
--- /dev/null
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/products/purchase-orders/$purchaseOrderId.tsx
@@ -0,0 +1,340 @@
+import type { PurchaseOrder, PurchaseOrderItem } from '@spree/admin-sdk'
+import { Can, Subject } from '@spree/dashboard-core'
+import {
+ Button,
+ Card,
+ CardContent,
+ CardHeader,
+ CardTitle,
+ Input,
+ RelativeTime,
+ Table,
+ TableBody,
+ TableCell,
+ TableHead,
+ TableHeader,
+ TableRow,
+ useConfirm,
+} from '@spree/dashboard-ui'
+import { ArrowLeftIcon } from '@spree/dashboard-ui/icons'
+import { createFileRoute, useNavigate } from '@tanstack/react-router'
+import { useState } from 'react'
+import { useTranslation } from 'react-i18next'
+import { InventoryStatusBadge } from '../../../../../components/spree/inventory-status-badge'
+import { StockHistoryCard } from '../../../../../components/spree/stock-history-card'
+import {
+ useCancelPurchaseOrder,
+ useMarkPurchaseOrderOrdered,
+ usePurchaseOrder,
+ useReceivePurchaseOrder,
+} from '../../../../../hooks/use-purchase-orders'
+
+export const Route = createFileRoute(
+ '/_authenticated/$storeId/products/purchase-orders/$purchaseOrderId',
+)({
+ component: PurchaseOrderDetailPage,
+})
+
+function PurchaseOrderDetailPage() {
+ const { t } = useTranslation()
+ const { storeId, purchaseOrderId } = Route.useParams()
+ const navigate = useNavigate()
+ const { data: purchaseOrder, isLoading } = usePurchaseOrder(purchaseOrderId)
+
+ if (isLoading || !purchaseOrder) {
+ return <div className="p-4 text-sm text-muted-foreground">{t('admin.common.loading')}</div>
+ }
+
+ return (
+ <div className="mx-auto flex w-full max-w-4xl flex-col gap-4 p-4">
+ <div className="flex items-center gap-3">
+ <Button
+ type="button"
+ size="icon-sm"
+ variant="ghost"
+ onClick={() =>
+ navigate({ to: '/$storeId/products/purchase-orders', params: { storeId } })
+ }
+ >
+ <ArrowLeftIcon className="size-4" />
+ <span className="sr-only">{t('admin.actions.back')}</span>
+ </Button>
+ <h1 className="text-xl font-semibold tabular-nums">{purchaseOrder.number}</h1>
+ <InventoryStatusBadge status={purchaseOrder.status} resource="purchase_orders" />
+ </div>
+
+ <SummaryCard purchaseOrder={purchaseOrder} />
+ <ItemsCard purchaseOrder={purchaseOrder} />
+ <Actions purchaseOrder={purchaseOrder} />
+
+ <StockHistoryCard
+ stockLocationId={purchaseOrder.destination_location_id}
+ title={t('admin.purchase_orders.history_title')}
+ />
+ </div>
+ )
+}
+
+function SummaryCard({ purchaseOrder }: { purchaseOrder: PurchaseOrder }) {
+ const { t } = useTranslation()
+
+ return (
+ <Card>
+ <CardHeader>
+ <CardTitle>{t('admin.purchase_orders.details_title')}</CardTitle>
+ </CardHeader>
+ <CardContent>
+ <dl className="grid grid-cols-3 gap-y-2 text-sm">
+ <dt className="text-muted-foreground">{t('admin.purchase_orders.fields.supplier')}</dt>
+ <dd className="col-span-2">{purchaseOrder.supplier?.name ?? '—'}</dd>
+
+ <dt className="text-muted-foreground">{t('admin.purchase_orders.fields.destination')}</dt>
+ <dd className="col-span-2">{purchaseOrder.destination_location?.name ?? '—'}</dd>
+
+ <dt className="text-muted-foreground">{t('admin.purchase_orders.fields.units')}</dt>
+ <dd className="col-span-2 tabular-nums">
+ {t('admin.purchase_orders.units_summary', {
+ received: purchaseOrder.quantity_received_total,
+ ordered: purchaseOrder.quantity_ordered_total,
+ })}
+ </dd>
+
+ <dt className="text-muted-foreground">{t('admin.purchase_orders.fields.subtotal')}</dt>
+ <dd className="col-span-2 tabular-nums">{purchaseOrder.display_subtotal}</dd>
+
+ <dt className="text-muted-foreground">{t('admin.purchase_orders.fields.expected_at')}</dt>
+ <dd className="col-span-2">{purchaseOrder.expected_at ?? '—'}</dd>
+
+ {purchaseOrder.reference && (
+ <>
+ <dt className="text-muted-foreground">
+ {t('admin.purchase_orders.fields.reference')}
+ </dt>
+ <dd className="col-span-2">{purchaseOrder.reference}</dd>
+ </>
+ )}
+
+ {purchaseOrder.notes && (
+ <>
+ <dt className="text-muted-foreground">{t('admin.purchase_orders.fields.notes')}</dt>
+ <dd className="col-span-2 whitespace-pre-line">{purchaseOrder.notes}</dd>
+ </>
+ )}
+
+ <dt className="text-muted-foreground">{t('admin.purchase_orders.fields.ordered_at')}</dt>
+ <dd className="col-span-2">
+ {purchaseOrder.ordered_at ? <RelativeTime iso={purchaseOrder.ordered_at} /> : '—'}
+ </dd>
+
+ <dt className="text-muted-foreground">{t('admin.purchase_orders.fields.received_at')}</dt>
+ <dd className="col-span-2">
+ {purchaseOrder.received_at ? <RelativeTime iso={purchaseOrder.received_at} /> : '—'}
+ </dd>
+ </dl>
+ </CardContent>
+ </Card>
+ )
+}
+
+/**
+ * The lines, and — once the order has been placed — the receive screen.
+ *
+ * `quantity_received` is the running total for the line, so a second delivery
+ * tops it up rather than starting over.
+ */
+function ItemsCard({ purchaseOrder }: { purchaseOrder: PurchaseOrder }) {
+ const { t } = useTranslation()
+ const items = purchaseOrder.items ?? []
+ const receiveMutation = useReceivePurchaseOrder(purchaseOrder.id)
+ const receivable =
+ purchaseOrder.status === 'ordered' || purchaseOrder.status === 'partially_received'
+
+ const [counts, setCounts] = useState<Record<string, number>>(() =>
+ Object.fromEntries(items.map((item) => [item.id, item.quantity_ordered])),
+ )
+
+ const totalCounted = items.reduce((sum, item) => sum + (counts[item.id] ?? 0), 0)
+
+ async function handleReceive() {
+ await receiveMutation
+ .mutateAsync({
+ items: items.map((item) => ({
+ id: item.id,
+ quantity_received: counts[item.id] ?? item.quantity_received,
+ })),
+ })
+ .catch(() => undefined)
+ }
+
+ return (
+ <Card>
+ <CardHeader>
+ <CardTitle>
+ {receivable
+ ? t('admin.purchase_orders.receive_title')
+ : t('admin.purchase_orders.items_title')}
+ </CardTitle>
+ </CardHeader>
+ <CardContent className="flex flex-col gap-4">
+ {items.length === 0 ? (
+ <p className="text-sm text-muted-foreground">{t('admin.purchase_orders.items_empty')}</p>
+ ) : (
+ <div className="overflow-x-auto">
+ <Table>
+ <TableHeader>
+ <TableRow>
+ <TableHead>{t('admin.inventory_lines.columns.variant')}</TableHead>
+ <TableHead className="text-right">
+ {t('admin.purchase_orders.columns.quantity_ordered')}
+ </TableHead>
+ <TableHead className="text-right">
+ {t('admin.purchase_orders.columns.quantity_received')}
+ </TableHead>
+ <TableHead className="text-right">
+ {t('admin.inventory_lines.columns.unit_cost')}
+ </TableHead>
+ <TableHead className="text-right">
+ {t('admin.purchase_orders.columns.line_total')}
+ </TableHead>
+ </TableRow>
+ </TableHeader>
+ <TableBody>
+ {items.map((item) => (
+ <ItemRow
+ key={item.id}
+ item={item}
+ receivable={receivable}
+ count={counts[item.id] ?? item.quantity_received}
+ onCount={(value) => setCounts((prev) => ({ ...prev, [item.id]: value }))}
+ />
+ ))}
+ </TableBody>
+ </Table>
+ </div>
+ )}
+
+ {receivable && items.length > 0 && (
+ <div className="flex items-center justify-between">
+ <p className="text-sm text-muted-foreground tabular-nums">
+ {t('admin.purchase_orders.receive_running_total', {
+ counted: totalCounted,
+ ordered: purchaseOrder.quantity_ordered_total,
+ })}
+ </p>
+ <Can I="update" a={Subject.PurchaseOrder}>
+ <Button type="button" onClick={handleReceive} disabled={receiveMutation.isPending}>
+ {receiveMutation.isPending
+ ? t('admin.actions.saving')
+ : t('admin.purchase_orders.actions.receive')}
+ </Button>
+ </Can>
+ </div>
+ )}
+ </CardContent>
+ </Card>
+ )
+}
+
+function ItemRow({
+ item,
+ receivable,
+ count,
+ onCount,
+}: {
+ item: PurchaseOrderItem
+ receivable: boolean
+ count: number
+ onCount: (value: number) => void
+}) {
+ const { t } = useTranslation()
+
+ return (
+ <TableRow>
+ <TableCell className="font-medium">
+ {item.variant_name ?? '—'}
+ <span className="block text-xs text-muted-foreground">{item.variant_sku ?? ''}</span>
+ </TableCell>
+ <TableCell className="text-right tabular-nums">{item.quantity_ordered}</TableCell>
+ <TableCell className="text-right">
+ {receivable ? (
+ <Input
+ type="number"
+ // Never below what is already on the shelf: taking units back off
+ // is a correction, not a receive.
+ min={item.quantity_received}
+ max={item.quantity_ordered}
+ value={count}
+ onChange={(event) => onCount(Number(event.target.value))}
+ className="ml-auto w-20 text-right tabular-nums"
+ aria-label={t('admin.purchase_orders.columns.quantity_received')}
+ />
+ ) : (
+ <span className="tabular-nums">{item.quantity_received}</span>
+ )}
+ </TableCell>
+ <TableCell className="text-right tabular-nums">{item.display_unit_cost}</TableCell>
+ <TableCell className="text-right tabular-nums">{item.display_total_cost}</TableCell>
+ </TableRow>
+ )
+}
+
+function Actions({ purchaseOrder }: { purchaseOrder: PurchaseOrder }) {
+ const { t } = useTranslation()
+ const confirm = useConfirm()
+ const markOrdered = useMarkPurchaseOrderOrdered(purchaseOrder.id)
+ const cancelOrder = useCancelPurchaseOrder(purchaseOrder.id)
+
+ if (purchaseOrder.status === 'received' || purchaseOrder.status === 'canceled') return null
+
+ async function handleOrder() {
+ const ok = await confirm({
+ title: t('admin.purchase_orders.order_confirm.title'),
+ message: t('admin.purchase_orders.order_confirm.message', {
+ supplier: purchaseOrder.supplier?.name ?? '',
+ }),
+ confirmLabel: t('admin.purchase_orders.actions.mark_ordered'),
+ })
+ if (!ok) return
+ await markOrdered.mutateAsync().catch(() => undefined)
+ }
+
+ async function handleCancel() {
+ const ok = await confirm({
+ title: t('admin.purchase_orders.cancel_confirm.title'),
+ message: t('admin.purchase_orders.cancel_confirm.message'),
+ variant: 'destructive',
+ confirmLabel: t('admin.purchase_orders.actions.cancel_order'),
+ })
+ if (!ok) return
+ await cancelOrder.mutateAsync({}).catch(() => undefined)
+ }
+
+ return (
+ <Card>
+ <CardHeader>
+ <CardTitle>{t('admin.purchase_orders.actions_title')}</CardTitle>
+ </CardHeader>
+ <CardContent className="flex flex-wrap gap-2">
+ <Can I="update" a={Subject.PurchaseOrder}>
+ {purchaseOrder.status === 'draft' && (
+ <Button
+ type="button"
+ onClick={handleOrder}
+ disabled={markOrdered.isPending || (purchaseOrder.items_count ?? 0) === 0}
+ >
+ {t('admin.purchase_orders.actions.mark_ordered')}
+ </Button>
+ )}
+ <Button
+ type="button"
+ variant="destructive"
+ onClick={handleCancel}
+ disabled={cancelOrder.isPending}
+ >
+ {t('admin.purchase_orders.actions.cancel_order')}
+ </Button>
+ </Can>
+ </CardContent>
+ </Card>
+ )
+}
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/products/purchase-orders/index.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/products/purchase-orders/index.tsx
new file mode 100644
index 0000000000..6cd971360a
--- /dev/null
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/products/purchase-orders/index.tsx
@@ -0,0 +1,94 @@
+import type { PurchaseOrder } from '@spree/admin-sdk'
+import {
+ adminClient,
+ Can,
+ ResourceTable,
+ resourceSearchSchema,
+ Subject,
+ usePermissions,
+} from '@spree/dashboard-core'
+import { Button, RowActions, useConfirm, useRowClickBridge } from '@spree/dashboard-ui'
+import { EyeIcon, PlusIcon } from '@spree/dashboard-ui/icons'
+import { createFileRoute, useNavigate } from '@tanstack/react-router'
+import { useTranslation } from 'react-i18next'
+import { useDeletePurchaseOrder } from '../../../../../hooks/use-purchase-orders'
+import '../../../../../tables/purchase-orders'
+
+export const Route = createFileRoute('/_authenticated/$storeId/products/purchase-orders/')({
+ validateSearch: resourceSearchSchema,
+ component: PurchaseOrdersPage,
+})
+
+function PurchaseOrdersPage() {
+ const { t } = useTranslation()
+ const { storeId } = Route.useParams()
+ const search = Route.useSearch()
+ const navigate = useNavigate()
+ const confirm = useConfirm()
+ const deleteMutation = useDeletePurchaseOrder()
+ const { permissions } = usePermissions()
+
+ function openDetail(id: string) {
+ navigate({
+ to: '/$storeId/products/purchase-orders/$purchaseOrderId',
+ params: { storeId, purchaseOrderId: id },
+ })
+ }
+
+ function openCreate() {
+ navigate({ to: '/$storeId/products/purchase-orders/new', params: { storeId } })
+ }
+
+ useRowClickBridge('data-purchase-order-id', openDetail)
+
+ async function handleDelete(purchaseOrder: PurchaseOrder) {
+ const ok = await confirm({
+ title: t('admin.purchase_orders.delete_confirm.title'),
+ message: t('admin.purchase_orders.delete_confirm.message', { number: purchaseOrder.number }),
+ variant: 'destructive',
+ confirmLabel: t('admin.actions.delete'),
+ })
+ if (!ok) return
+ await deleteMutation.mutateAsync(purchaseOrder.id).catch(() => undefined)
+ }
+
+ return (
+ <ResourceTable<PurchaseOrder>
+ tableKey="purchase-orders"
+ queryKey="purchase-orders"
+ queryFn={(params) => adminClient.purchaseOrders.list({ ...params, expand: ['supplier'] })}
+ searchParams={search}
+ rowActions={(purchaseOrder) => (
+ <RowActions
+ actions={[
+ {
+ key: 'view',
+ label: t('admin.actions.view_details'),
+ icon: <EyeIcon className="size-4" />,
+ onSelect: () => openDetail(purchaseOrder.id),
+ },
+ {
+ key: 'delete',
+ destructive: true,
+ // A placed order is a matter of record with the supplier; the
+ // detail page cancels it instead.
+ visible:
+ purchaseOrder.status === 'draft' &&
+ permissions.can('destroy', Subject.PurchaseOrder),
+ disabled: deleteMutation.isPending,
+ onSelect: () => handleDelete(purchaseOrder),
+ },
+ ]}
+ />
+ )}
+ actions={
+ <Can I="create" a={Subject.PurchaseOrder}>
+ <Button size="sm" className="h-[2.125rem]" onClick={openCreate}>
+ <PlusIcon className="size-4" />
+ {t('admin.purchase_orders.new_cta')}
+ </Button>
+ </Can>
+ }
+ />
+ )
+}
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/products/purchase-orders/new.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/products/purchase-orders/new.tsx
new file mode 100644
index 0000000000..4005bc219e
--- /dev/null
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/products/purchase-orders/new.tsx
@@ -0,0 +1,210 @@
+import { CurrencySelect, StoreDatePicker, useStockLocations } from '@spree/dashboard-core'
+import {
+ Button,
+ Card,
+ CardContent,
+ CardHeader,
+ CardTitle,
+ Field,
+ FieldGroup,
+ FieldLabel,
+ Input,
+ Select,
+ SelectContent,
+ SelectItem,
+ SelectTrigger,
+ SelectValue,
+ Textarea,
+} from '@spree/dashboard-ui'
+import { createFileRoute, useNavigate } from '@tanstack/react-router'
+import { useState } from 'react'
+import { useTranslation } from 'react-i18next'
+import {
+ type VariantLine,
+ VariantLineEditor,
+} from '../../../../../components/spree/variant-line-editor'
+import { useCreatePurchaseOrder } from '../../../../../hooks/use-purchase-orders'
+import { useSuppliers } from '../../../../../hooks/use-suppliers'
+
+export const Route = createFileRoute('/_authenticated/$storeId/products/purchase-orders/new')({
+ component: NewPurchaseOrderPage,
+})
+
+function NewPurchaseOrderPage() {
+ const { t } = useTranslation()
+ const { storeId } = Route.useParams()
+ const navigate = useNavigate()
+ const createMutation = useCreatePurchaseOrder()
+ const { data: suppliers } = useSuppliers({ limit: 100 })
+ const { data: stockLocations } = useStockLocations({ limit: 100 })
+
+ const supplierOptions = suppliers?.data ?? []
+ const locations = stockLocations?.data ?? []
+
+ const [supplierId, setSupplierId] = useState('')
+ const [destinationId, setDestinationId] = useState('')
+ const [currency, setCurrency] = useState<string | undefined>(undefined)
+ const [expectedAt, setExpectedAt] = useState<string | undefined>(undefined)
+ const [reference, setReference] = useState('')
+ const [notes, setNotes] = useState('')
+ const [lines, setLines] = useState<VariantLine[]>([])
+
+ const canSubmit = !!supplierId && !!destinationId && lines.every((line) => line.quantity > 0)
+
+ async function handleSubmit() {
+ if (!canSubmit) return
+
+ const purchaseOrder = await createMutation.mutateAsync({
+ supplier_id: supplierId,
+ destination_location_id: destinationId,
+ currency,
+ expected_at: expectedAt,
+ reference: reference.trim() || undefined,
+ notes: notes.trim() || undefined,
+ items: lines.map((line) => ({
+ variant_id: line.variant.id,
+ quantity_ordered: line.quantity,
+ unit_cost: line.unitCost,
+ })),
+ })
+
+ navigate({
+ to: '/$storeId/products/purchase-orders/$purchaseOrderId',
+ params: { storeId, purchaseOrderId: purchaseOrder.id },
+ })
+ }
+
+ return (
+ <div className="mx-auto flex w-full max-w-3xl flex-col gap-4 p-4">
+ <Card>
+ <CardHeader>
+ <CardTitle>{t('admin.purchase_orders.new_title')}</CardTitle>
+ </CardHeader>
+ <CardContent>
+ <FieldGroup>
+ <Field>
+ <FieldLabel htmlFor="supplier">
+ {t('admin.purchase_orders.fields.supplier')}
+ </FieldLabel>
+ <Select value={supplierId} onValueChange={setSupplierId}>
+ <SelectTrigger id="supplier">
+ <SelectValue placeholder={t('admin.purchase_orders.fields.supplier_placeholder')}>
+ {(value) =>
+ supplierOptions.find((s) => s.id === value)?.name ?? (value as string)
+ }
+ </SelectValue>
+ </SelectTrigger>
+ <SelectContent>
+ {supplierOptions.map((supplier) => (
+ <SelectItem key={supplier.id} value={supplier.id}>
+ {supplier.name}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ </Field>
+
+ <Field>
+ <FieldLabel htmlFor="destination">
+ {t('admin.purchase_orders.fields.destination')}
+ </FieldLabel>
+ <Select value={destinationId} onValueChange={setDestinationId}>
+ <SelectTrigger id="destination">
+ <SelectValue
+ placeholder={t('admin.purchase_orders.fields.destination_placeholder')}
+ >
+ {(value) => locations.find((l) => l.id === value)?.name ?? (value as string)}
+ </SelectValue>
+ </SelectTrigger>
+ <SelectContent>
+ {locations.map((location) => (
+ <SelectItem key={location.id} value={location.id}>
+ {location.name}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ </Field>
+
+ <Field>
+ <FieldLabel htmlFor="currency">
+ {t('admin.purchase_orders.fields.currency')}
+ </FieldLabel>
+ {/* A foreign-currency purchase order is legitimate; leaving
+ this alone takes the store's own currency. */}
+ <CurrencySelect id="currency" value={currency} onChange={setCurrency} />
+ </Field>
+
+ <Field>
+ <FieldLabel>{t('admin.purchase_orders.fields.expected_at')}</FieldLabel>
+ {/* A calendar date, not an instant: the day the supplier
+ promised means the same day in every timezone. */}
+ <StoreDatePicker
+ value={expectedAt}
+ onChange={(value) => setExpectedAt(value ?? undefined)}
+ placeholder={t('admin.purchase_orders.fields.expected_at_placeholder')}
+ />
+ </Field>
+
+ <Field>
+ <FieldLabel htmlFor="reference">
+ {t('admin.purchase_orders.fields.reference')}
+ </FieldLabel>
+ <Input
+ id="reference"
+ placeholder={t('admin.purchase_orders.fields.reference_placeholder')}
+ value={reference}
+ onChange={(event) => setReference(event.target.value)}
+ />
+ </Field>
+
+ <Field>
+ <FieldLabel htmlFor="notes">{t('admin.purchase_orders.fields.notes')}</FieldLabel>
+ <Textarea
+ id="notes"
+ value={notes}
+ onChange={(event) => setNotes(event.target.value)}
+ />
+ </Field>
+ </FieldGroup>
+ </CardContent>
+ </Card>
+
+ <Card>
+ <CardHeader>
+ <CardTitle>{t('admin.purchase_orders.items_title')}</CardTitle>
+ </CardHeader>
+ <CardContent>
+ <VariantLineEditor
+ lines={lines}
+ onChange={setLines}
+ currency={currency}
+ quantityLabel={t('admin.purchase_orders.columns.quantity_ordered')}
+ withCost
+ />
+ </CardContent>
+ </Card>
+
+ <div className="flex justify-end gap-2">
+ <Button
+ type="button"
+ variant="outline"
+ onClick={() =>
+ navigate({ to: '/$storeId/products/purchase-orders', params: { storeId } })
+ }
+ >
+ {t('admin.actions.cancel')}
+ </Button>
+ <Button
+ type="button"
+ onClick={handleSubmit}
+ disabled={!canSubmit || createMutation.isPending}
+ >
+ {createMutation.isPending
+ ? t('admin.actions.creating')
+ : t('admin.purchase_orders.actions.create_draft')}
+ </Button>
+ </div>
+ </div>
+ )
+}
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/products/transfers.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/products/transfers.tsx
deleted file mode 100644
index 69dbed07d6..0000000000
--- a/packages/dashboard/src/routes/_authenticated/$storeId/products/transfers.tsx
+++ /dev/null
@@ -1,520 +0,0 @@
-import type { StockTransfer, Variant } from '@spree/admin-sdk'
-import {
- adminClient,
- Can,
- formatPrice,
- ResourceCombobox,
- ResourceTable,
- resourceSearchSchema,
- Subject,
- usePermissions,
- useStockLocations,
-} from '@spree/dashboard-core'
-import {
- Badge,
- Button,
- Card,
- CardContent,
- CardHeader,
- CardTitle,
- Field,
- FieldGroup,
- FieldLabel,
- Input,
- RelativeTime,
- RowActions,
- Select,
- SelectContent,
- SelectItem,
- SelectTrigger,
- SelectValue,
- Sheet,
- SheetContent,
- SheetDescription,
- SheetFooter,
- SheetHeader,
- SheetTitle,
- Table,
- TableBody,
- TableCell,
- TableHead,
- TableHeader,
- TableRow,
- useConfirm,
- useRowClickBridge,
-} from '@spree/dashboard-ui'
-import { ArrowLeftRightIcon, EyeIcon, PlusIcon, TrashIcon } from '@spree/dashboard-ui/icons'
-import { createFileRoute, useNavigate } from '@tanstack/react-router'
-import { useMemo, useRef, useState } from 'react'
-import { Trans, useTranslation } from 'react-i18next'
-import { z } from 'zod/v4'
-import {
- useCreateStockTransfer,
- useDeleteStockTransfer,
- useStockTransfer,
-} from '../../../../hooks/use-stock-transfers'
-import '../../../../tables/stock-transfers'
-
-const stockTransfersSearchSchema = resourceSearchSchema.extend({
- view: z.string().optional(),
- new: z.coerce.boolean().optional(),
-})
-
-export const Route = createFileRoute('/_authenticated/$storeId/products/transfers')({
- validateSearch: stockTransfersSearchSchema,
- component: StockTransfersPage,
-})
-
-const SOURCE_NONE = '__external__'
-
-function StockTransfersPage() {
- const { t } = useTranslation()
- const search = Route.useSearch() as z.infer<typeof stockTransfersSearchSchema>
- const navigate = useNavigate()
- const confirm = useConfirm()
- const deleteMutation = useDeleteStockTransfer()
- const { permissions } = usePermissions()
-
- const viewId = search.view
- const isCreating = !!search.new
-
- const closeSheet = () =>
- navigate({
- search: (prev: Record<string, unknown>) => {
- const { view: _v, new: _n, ...rest } = prev
- return rest as never
- },
- })
-
- const openCreate = () =>
- navigate({ search: (prev: Record<string, unknown>) => ({ ...prev, new: true }) as never })
-
- const openView = (id: string) =>
- navigate({ search: (prev: Record<string, unknown>) => ({ ...prev, view: id }) as never })
-
- useRowClickBridge('data-stock-transfer-id', openView)
-
- async function handleDelete(transfer: StockTransfer) {
- const ok = await confirm({
- title: t('admin.products.transfers.delete_confirm.title'),
- message: t('admin.products.transfers.delete_confirm.message'),
- variant: 'destructive',
- confirmLabel: t('admin.actions.delete'),
- })
- if (!ok) return
- await deleteMutation.mutateAsync(transfer.id).catch(() => undefined)
- }
-
- return (
- <>
- <ResourceTable<StockTransfer>
- tableKey="stock-transfers"
- queryKey="stock-transfers"
- queryFn={(params) => adminClient.stockTransfers.list(params)}
- searchParams={search}
- rowActions={(transfer) => (
- <RowActions
- actions={[
- {
- key: 'view',
- label: t('admin.actions.view_details'),
- icon: <EyeIcon className="size-4" />,
- onSelect: () => openView(transfer.id),
- },
- {
- key: 'delete',
- destructive: true,
- visible: permissions.can('destroy', Subject.StockTransfer),
- disabled: deleteMutation.isPending,
- onSelect: () => handleDelete(transfer),
- },
- ]}
- />
- )}
- actions={
- <Can I="create" a={Subject.StockTransfer}>
- <Button size="sm" className="h-[2.125rem]" onClick={openCreate}>
- <PlusIcon className="size-4" />
- {t('admin.products.transfers.new_cta')}
- </Button>
- </Can>
- }
- />
-
- {isCreating && <CreateStockTransferSheet open onOpenChange={(o) => !o && closeSheet()} />}
- {viewId && (
- <ViewStockTransferSheet id={viewId} open onOpenChange={(o) => !o && closeSheet()} />
- )}
- </>
- )
-}
-
-interface PendingItem {
- variant: Variant
- quantity: number
-}
-
-function CreateStockTransferSheet({
- open,
- onOpenChange,
-}: {
- open: boolean
- onOpenChange: (open: boolean) => void
-}) {
- const { t } = useTranslation()
- const createMutation = useCreateStockTransfer()
- const { data: stockLocations } = useStockLocations({ limit: 100 })
- const locations = stockLocations?.data ?? []
-
- const [sourceId, setSourceId] = useState<string>(SOURCE_NONE)
- const [destinationId, setDestinationId] = useState<string>('')
- const [reference, setReference] = useState('')
- const [items, setItems] = useState<PendingItem[]>([])
- // `onChange` hands back only the option id, so keep the records the search
- // returned to resolve it. A ref, not state: it's a lookup table.
- const variantById = useRef(new Map<string, Variant>())
-
- const isExternalReceive = sourceId === SOURCE_NONE
- const canSubmit =
- !!destinationId &&
- items.length > 0 &&
- items.every((i) => i.quantity > 0) &&
- (isExternalReceive || sourceId !== destinationId)
-
- function reset() {
- setSourceId(SOURCE_NONE)
- setDestinationId('')
- setReference('')
- setItems([])
- variantById.current.clear()
- }
-
- function addItem(variant: Variant) {
- const existing = items.find((i) => i.variant.id === variant.id)
- if (existing) {
- setItems(
- items.map((i) => (i.variant.id === variant.id ? { ...i, quantity: i.quantity + 1 } : i)),
- )
- } else {
- setItems([...items, { variant, quantity: 1 }])
- }
- }
-
- function updateQuantity(variantId: string, quantity: number) {
- setItems(items.map((i) => (i.variant.id === variantId ? { ...i, quantity } : i)))
- }
-
- function removeItem(variantId: string) {
- setItems(items.filter((i) => i.variant.id !== variantId))
- }
-
- async function handleSubmit() {
- if (!canSubmit) return
- await createMutation.mutateAsync({
- source_location_id: isExternalReceive ? undefined : sourceId,
- destination_location_id: destinationId,
- reference: reference.length > 0 ? reference : undefined,
- variants: items.map((i) => ({ variant_id: i.variant.id, quantity: i.quantity })),
- })
- reset()
- onOpenChange(false)
- }
-
- return (
- <Sheet
- open={open}
- onOpenChange={(next) => {
- if (!next) reset()
- onOpenChange(next)
- }}
- >
- <SheetContent className="sm:max-w-2xl">
- <SheetHeader>
- <SheetTitle>{t('admin.pages.products.transfers.sheet_title')}</SheetTitle>
- <SheetDescription>{t('admin.products.transfers.create_description')}</SheetDescription>
- </SheetHeader>
- <div className="flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto p-4">
- <FieldGroup>
- <Field>
- <FieldLabel htmlFor="source">
- {t('admin.pages.products.transfers.section_from')}
- </FieldLabel>
- <Select value={sourceId} onValueChange={setSourceId}>
- <SelectTrigger id="source">
- <SelectValue>
- {(value) =>
- value === SOURCE_NONE
- ? t('admin.products.transfers.external_label')
- : (locations.find((l) => l.id === value)?.name ?? (value as string))
- }
- </SelectValue>
- </SelectTrigger>
- <SelectContent>
- <SelectItem value={SOURCE_NONE}>
- {t('admin.products.transfers.external_label')}
- </SelectItem>
- {locations.map((l) => (
- <SelectItem key={l.id} value={l.id}>
- {l.name}
- </SelectItem>
- ))}
- </SelectContent>
- </Select>
- </Field>
-
- <Field>
- <FieldLabel htmlFor="destination">
- {t('admin.pages.products.transfers.section_to')}
- </FieldLabel>
- <Select value={destinationId} onValueChange={setDestinationId}>
- <SelectTrigger id="destination">
- <SelectValue placeholder={t('admin.products.transfers.destination_placeholder')}>
- {(value) => locations.find((l) => l.id === value)?.name ?? (value as string)}
- </SelectValue>
- </SelectTrigger>
- <SelectContent>
- {locations
- .filter((l) => l.id !== sourceId)
- .map((l) => (
- <SelectItem key={l.id} value={l.id}>
- {l.name}
- </SelectItem>
- ))}
- </SelectContent>
- </Select>
- {sourceId !== SOURCE_NONE && sourceId === destinationId && (
- <p className="text-sm text-destructive">
- {t('admin.products.transfers.different_locations_error')}
- </p>
- )}
- </Field>
-
- <Field>
- <FieldLabel htmlFor="reference">
- {t('admin.products.transfers.reference_label')}
- </FieldLabel>
- <Input
- id="reference"
- placeholder={t('admin.products.transfers.reference_placeholder')}
- value={reference}
- onChange={(e) => setReference(e.target.value)}
- />
- </Field>
-
- <Field>
- <FieldLabel>{t('admin.pages.products.transfers.section_items')}</FieldLabel>
- {/* Combobox rather than a bare input over a list of buttons:
- arrow-key navigation, `aria-activedescendant` and
- Enter-to-pick come from the primitive. Selecting adds the row
- and clears the field, so no value is held. */}
- <ResourceCombobox<Variant>
- queryKey="transfer-variant-picker"
- value=""
- onChange={(id) => {
- const variant = id ? variantById.current.get(id) : undefined
- if (variant) addItem(variant)
- }}
- search={async (query) => {
- const res = await adminClient.variants.list({ search: query, limit: 8 })
- for (const v of res.data) variantById.current.set(v.id, v)
- return res
- }}
- hydrate={async () => ({ data: [] })}
- getOptionLabel={(v) => v.product_name ?? v.sku ?? v.id}
- renderOption={(v) => (
- <div className="flex flex-col">
- <span className="font-medium">{v.product_name ?? v.sku ?? v.id}</span>
- <span className="text-xs text-muted-foreground">
- {t('admin.products.transfers.items_table.sku')} {v.sku} ·{' '}
- {formatPrice(v.price)}
- </span>
- </div>
- )}
- placeholder={t('admin.products.transfers.search_items_placeholder')}
- />
- </Field>
- </FieldGroup>
-
- {items.length > 0 && (
- <div className="overflow-x-auto rounded-md border">
- <Table>
- <TableHeader>
- <TableRow>
- <TableHead>{t('admin.products.transfers.items_table.variant')}</TableHead>
- <TableHead>{t('admin.products.transfers.items_table.sku')}</TableHead>
- <TableHead className="text-right">
- {t('admin.products.transfers.items_table.qty')}
- </TableHead>
- <TableHead className="w-10" />
- </TableRow>
- </TableHeader>
- <TableBody>
- {items.map(({ variant, quantity }) => (
- <TableRow key={variant.id}>
- <TableCell className="font-medium">
- {variant.product_name ?? variant.sku ?? variant.id}
- </TableCell>
- <TableCell className="text-muted-foreground">{variant.sku}</TableCell>
- <TableCell className="text-right">
- <Input
- type="number"
- min={1}
- value={quantity}
- onChange={(e) => updateQuantity(variant.id, Number(e.target.value))}
- className="w-20 text-right ml-auto"
- />
- </TableCell>
- <TableCell className="text-right">
- <Button
- type="button"
- size="icon-xs"
- variant="ghost"
- onClick={() => removeItem(variant.id)}
- >
- <TrashIcon className="size-4" />
- <span className="sr-only">{t('admin.actions.remove')}</span>
- </Button>
- </TableCell>
- </TableRow>
- ))}
- </TableBody>
- </Table>
- </div>
- )}
- </div>
- <SheetFooter>
- <Button
- type="button"
- variant="outline"
- onClick={() => onOpenChange(false)}
- disabled={createMutation.isPending}
- >
- {t('admin.actions.cancel')}
- </Button>
- <Button
- type="button"
- onClick={handleSubmit}
- disabled={!canSubmit || createMutation.isPending}
- >
- {createMutation.isPending ? t('admin.actions.creating') : t('admin.actions.create')}
- </Button>
- </SheetFooter>
- </SheetContent>
- </Sheet>
- )
-}
-
-function ViewStockTransferSheet({
- id,
- open,
- onOpenChange,
-}: {
- id: string
- open: boolean
- onOpenChange: (open: boolean) => void
-}) {
- const { t } = useTranslation()
- const { data: transfer, isLoading } = useStockTransfer(id)
- const { data: stockLocations } = useStockLocations({ limit: 100 })
-
- const locationsById = useMemo(() => {
- const map = new Map<string, string>()
- for (const l of stockLocations?.data ?? []) {
- map.set(l.id, l.name)
- }
- return map
- }, [stockLocations])
-
- const sourceName = transfer?.source_location_id
- ? (locationsById.get(transfer.source_location_id) ?? transfer.source_location_id)
- : null
- const destinationName = transfer?.destination_location_id
- ? (locationsById.get(transfer.destination_location_id) ?? transfer.destination_location_id)
- : null
-
- return (
- <Sheet open={open} onOpenChange={onOpenChange}>
- <SheetContent className="sm:max-w-xl">
- <SheetHeader>
- <SheetTitle>
- {transfer
- ? t('admin.pages.products.transfers.edit_sheet_title', { number: transfer.number })
- : t('admin.pages.products.transfers.sheet_title')}
- </SheetTitle>
- <SheetDescription>
- {transfer?.source_location_id ? (
- <Trans
- i18nKey="admin.pages.products.transfers.description_internal"
- values={{ source: sourceName, destination: destinationName }}
- components={{ strong: <span className="font-medium" /> }}
- />
- ) : (
- <Trans
- i18nKey="admin.pages.products.transfers.description_external"
- values={{ destination: destinationName }}
- components={{ strong: <span className="font-medium" /> }}
- />
- )}
- </SheetDescription>
- </SheetHeader>
-
- {isLoading || !transfer ? (
- <div className="p-4 text-sm text-muted-foreground">{t('admin.common.loading')}</div>
- ) : (
- <div className="flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto p-4">
- <Card>
- <CardHeader>
- <CardTitle>{t('admin.products.transfers.details_card')}</CardTitle>
- </CardHeader>
- <CardContent>
- <dl className="grid grid-cols-3 gap-y-2 text-sm">
- <dt className="text-muted-foreground">
- {t('admin.products.transfers.fields.type')}
- </dt>
- <dd className="col-span-2">
- {transfer.source_location_id ? (
- <Badge variant="outline">
- <ArrowLeftRightIcon className="size-3" />{' '}
- {t('admin.products.transfers.fields.internal')}
- </Badge>
- ) : (
- <Badge variant="outline">
- {t('admin.products.transfers.fields.external_receive')}
- </Badge>
- )}
- </dd>
-
- {transfer.reference && (
- <>
- <dt className="text-muted-foreground">
- {t('admin.products.transfers.fields.reference')}
- </dt>
- <dd className="col-span-2">{transfer.reference}</dd>
- </>
- )}
-
- <dt className="text-muted-foreground">
- {t('admin.products.transfers.fields.created')}
- </dt>
- <dd className="col-span-2">
- <RelativeTime iso={transfer.created_at} />
- </dd>
- </dl>
- </CardContent>
- </Card>
-
- <p className="text-xs text-muted-foreground">
- {t('admin.products.transfers.fields.immutable_note')}
- </p>
- </div>
- )}
-
- <SheetFooter>
- <Button type="button" variant="outline" onClick={() => onOpenChange(false)}>
- {t('admin.actions.close')}
- </Button>
- </SheetFooter>
- </SheetContent>
- </Sheet>
- )
-}
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/products/transfers/$transferId.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/products/transfers/$transferId.tsx
new file mode 100644
index 0000000000..8fe1827c32
--- /dev/null
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/products/transfers/$transferId.tsx
@@ -0,0 +1,475 @@
+import type { StockTransfer, StockTransferItem } from '@spree/admin-sdk'
+import { Can, Subject, useStockLocations } from '@spree/dashboard-core'
+import {
+ Button,
+ Card,
+ CardContent,
+ CardHeader,
+ CardTitle,
+ Field,
+ FieldLabel,
+ Input,
+ RelativeTime,
+ Select,
+ SelectContent,
+ SelectItem,
+ SelectTrigger,
+ SelectValue,
+ Table,
+ TableBody,
+ TableCell,
+ TableHead,
+ TableHeader,
+ TableRow,
+ useConfirm,
+} from '@spree/dashboard-ui'
+import { ArrowLeftIcon } from '@spree/dashboard-ui/icons'
+import { createFileRoute, useNavigate } from '@tanstack/react-router'
+import { useMemo, useState } from 'react'
+import { useTranslation } from 'react-i18next'
+import { InventoryStatusBadge } from '../../../../../components/spree/inventory-status-badge'
+import { StockHistoryCard } from '../../../../../components/spree/stock-history-card'
+import {
+ useCancelStockTransfer,
+ useMarkStockTransferInTransit,
+ useMarkStockTransferReady,
+ useReceiveStockTransfer,
+ useStockTransfer,
+} from '../../../../../hooks/use-stock-transfers'
+import {
+ DISCREPANCY_REASONS,
+ IN_TRANSIT_RESOLUTIONS,
+ type InTransitResolution,
+ isInFlight,
+} from '../../../../../schemas/inventory-operations'
+
+export const Route = createFileRoute('/_authenticated/$storeId/products/transfers/$transferId')({
+ component: StockTransferDetailPage,
+})
+
+function StockTransferDetailPage() {
+ const { t } = useTranslation()
+ const { storeId, transferId } = Route.useParams()
+ const navigate = useNavigate()
+ const { data: transfer, isLoading } = useStockTransfer(transferId)
+
+ if (isLoading || !transfer) {
+ return <div className="p-4 text-sm text-muted-foreground">{t('admin.common.loading')}</div>
+ }
+
+ return (
+ <div className="mx-auto flex w-full max-w-4xl flex-col gap-4 p-4">
+ <div className="flex items-center gap-3">
+ <Button
+ type="button"
+ size="icon-sm"
+ variant="ghost"
+ onClick={() => navigate({ to: '/$storeId/products/transfers', params: { storeId } })}
+ >
+ <ArrowLeftIcon className="size-4" />
+ <span className="sr-only">{t('admin.actions.back')}</span>
+ </Button>
+ <h1 className="text-xl font-semibold tabular-nums">{transfer.number}</h1>
+ <InventoryStatusBadge status={transfer.status} resource="stock_transfers" />
+ </div>
+
+ <SummaryCard transfer={transfer} />
+
+ {transfer.status === 'draft' || transfer.status === 'ready_to_ship' ? (
+ <PlannedItemsCard transfer={transfer} />
+ ) : (
+ <ReceiveCard transfer={transfer} />
+ )}
+
+ <Actions transfer={transfer} />
+
+ {/* Where the units on this trip came from and went — read on the
+ destination warehouse, which is the shelf the merchant is
+ reconciling. */}
+ <StockHistoryCard
+ stockLocationId={transfer.destination_location_id}
+ title={t('admin.stock_transfers.history_title')}
+ />
+ </div>
+ )
+}
+
+function SummaryCard({ transfer }: { transfer: StockTransfer }) {
+ const { t } = useTranslation()
+ const { data: stockLocations } = useStockLocations({ limit: 100 })
+
+ const locationName = useMemo(() => {
+ const byId = new Map((stockLocations?.data ?? []).map((l) => [l.id, l.name]))
+ return (id: string | null) => (id ? (byId.get(id) ?? id) : '—')
+ }, [stockLocations])
+
+ return (
+ <Card>
+ <CardHeader>
+ <CardTitle>{t('admin.stock_transfers.details_title')}</CardTitle>
+ </CardHeader>
+ <CardContent>
+ <dl className="grid grid-cols-3 gap-y-2 text-sm">
+ <dt className="text-muted-foreground">{t('admin.stock_transfers.fields.source')}</dt>
+ <dd className="col-span-2">
+ {transfer.source_location?.name ?? locationName(transfer.source_location_id)}
+ </dd>
+
+ <dt className="text-muted-foreground">{t('admin.stock_transfers.fields.destination')}</dt>
+ <dd className="col-span-2">
+ {transfer.destination_location?.name ?? locationName(transfer.destination_location_id)}
+ </dd>
+
+ <dt className="text-muted-foreground">{t('admin.stock_transfers.fields.units')}</dt>
+ <dd className="col-span-2 tabular-nums">
+ {t('admin.stock_transfers.units_summary', {
+ received: transfer.quantity_received_total,
+ shipped: transfer.quantity_shipped_total,
+ })}
+ </dd>
+
+ {transfer.reference && (
+ <>
+ <dt className="text-muted-foreground">
+ {t('admin.stock_transfers.fields.reference')}
+ </dt>
+ <dd className="col-span-2">{transfer.reference}</dd>
+ </>
+ )}
+
+ {transfer.notes && (
+ <>
+ <dt className="text-muted-foreground">{t('admin.stock_transfers.fields.notes')}</dt>
+ <dd className="col-span-2 whitespace-pre-line">{transfer.notes}</dd>
+ </>
+ )}
+
+ <dt className="text-muted-foreground">{t('admin.stock_transfers.fields.shipped_at')}</dt>
+ <dd className="col-span-2">
+ {transfer.shipped_at ? <RelativeTime iso={transfer.shipped_at} /> : '—'}
+ </dd>
+
+ <dt className="text-muted-foreground">{t('admin.stock_transfers.fields.received_at')}</dt>
+ <dd className="col-span-2">
+ {transfer.received_at ? <RelativeTime iso={transfer.received_at} /> : '—'}
+ </dd>
+ </dl>
+ </CardContent>
+ </Card>
+ )
+}
+
+/** Draft and ready-to-ship: what is going, and nothing about arrival yet. */
+function PlannedItemsCard({ transfer }: { transfer: StockTransfer }) {
+ const { t } = useTranslation()
+ const items = transfer.items ?? []
+
+ return (
+ <Card>
+ <CardHeader>
+ <CardTitle>{t('admin.stock_transfers.items_title')}</CardTitle>
+ </CardHeader>
+ <CardContent>
+ {items.length === 0 ? (
+ <p className="text-sm text-muted-foreground">{t('admin.stock_transfers.items_empty')}</p>
+ ) : (
+ <div className="overflow-x-auto">
+ <Table>
+ <TableHeader>
+ <TableRow>
+ <TableHead>{t('admin.inventory_lines.columns.variant')}</TableHead>
+ <TableHead>{t('admin.inventory_lines.columns.sku')}</TableHead>
+ <TableHead className="text-right">
+ {t('admin.stock_transfers.columns.quantity_shipped')}
+ </TableHead>
+ </TableRow>
+ </TableHeader>
+ <TableBody>
+ {items.map((item) => (
+ <TableRow key={item.id}>
+ <TableCell className="font-medium">{item.variant_name ?? '—'}</TableCell>
+ <TableCell className="text-muted-foreground">
+ {item.variant_sku ?? '—'}
+ </TableCell>
+ <TableCell className="text-right tabular-nums">
+ {item.quantity_shipped}
+ </TableCell>
+ </TableRow>
+ ))}
+ </TableBody>
+ </Table>
+ </div>
+ )}
+ </CardContent>
+ </Card>
+ )
+}
+
+/**
+ * In transit and beyond: the receive screen.
+ *
+ * `quantity_received` is the running total for the line, so a second delivery
+ * tops it up rather than starting over — which is why the inputs are seeded
+ * with what has already been counted rather than with zero.
+ */
+function ReceiveCard({ transfer }: { transfer: StockTransfer }) {
+ const { t } = useTranslation()
+ const items = transfer.items ?? []
+ const receiveMutation = useReceiveStockTransfer(transfer.id)
+ const editable = isInFlight(transfer.status)
+
+ const [counts, setCounts] = useState<Record<string, number>>(() =>
+ Object.fromEntries(items.map((item) => [item.id, item.quantity_shipped])),
+ )
+ const [reasons, setReasons] = useState<Record<string, string>>(() =>
+ Object.fromEntries(items.map((item) => [item.id, item.discrepancy_reason ?? ''])),
+ )
+
+ const totalCounted = items.reduce((sum, item) => sum + (counts[item.id] ?? 0), 0)
+
+ async function handleReceive() {
+ await receiveMutation
+ .mutateAsync({
+ items: items.map((item) => ({
+ id: item.id,
+ quantity_received: counts[item.id] ?? item.quantity_received,
+ discrepancy_reason: reasons[item.id] || undefined,
+ })),
+ })
+ .catch(() => undefined)
+ }
+
+ return (
+ <Card>
+ <CardHeader>
+ <CardTitle>{t('admin.stock_transfers.receive_title')}</CardTitle>
+ </CardHeader>
+ <CardContent className="flex flex-col gap-4">
+ <div className="overflow-x-auto">
+ <Table>
+ <TableHeader>
+ <TableRow>
+ <TableHead>{t('admin.inventory_lines.columns.variant')}</TableHead>
+ <TableHead className="text-right">
+ {t('admin.stock_transfers.columns.quantity_shipped')}
+ </TableHead>
+ <TableHead className="text-right">
+ {t('admin.stock_transfers.columns.quantity_received')}
+ </TableHead>
+ <TableHead>{t('admin.stock_transfers.columns.discrepancy')}</TableHead>
+ </TableRow>
+ </TableHeader>
+ <TableBody>
+ {items.map((item) => (
+ <ReceiveRow
+ key={item.id}
+ item={item}
+ editable={editable}
+ count={counts[item.id] ?? item.quantity_received}
+ reason={reasons[item.id] ?? ''}
+ onCount={(value) => setCounts((prev) => ({ ...prev, [item.id]: value }))}
+ onReason={(value) => setReasons((prev) => ({ ...prev, [item.id]: value }))}
+ />
+ ))}
+ </TableBody>
+ </Table>
+ </div>
+
+ {editable && (
+ <div className="flex items-center justify-between">
+ <p className="text-sm text-muted-foreground tabular-nums">
+ {t('admin.stock_transfers.receive_running_total', {
+ counted: totalCounted,
+ shipped: transfer.quantity_shipped_total,
+ })}
+ </p>
+ <Can I="update" a={Subject.StockTransfer}>
+ <Button type="button" onClick={handleReceive} disabled={receiveMutation.isPending}>
+ {receiveMutation.isPending
+ ? t('admin.actions.saving')
+ : t('admin.stock_transfers.actions.receive')}
+ </Button>
+ </Can>
+ </div>
+ )}
+ </CardContent>
+ </Card>
+ )
+}
+
+function ReceiveRow({
+ item,
+ editable,
+ count,
+ reason,
+ onCount,
+ onReason,
+}: {
+ item: StockTransferItem
+ editable: boolean
+ count: number
+ reason: string
+ onCount: (value: number) => void
+ onReason: (value: string) => void
+}) {
+ const { t } = useTranslation()
+ const short = count < item.quantity_shipped
+
+ return (
+ <TableRow>
+ <TableCell className="font-medium">
+ {item.variant_name ?? '—'}
+ <span className="block text-xs text-muted-foreground">{item.variant_sku ?? ''}</span>
+ </TableCell>
+ <TableCell className="text-right tabular-nums">{item.quantity_shipped}</TableCell>
+ <TableCell className="text-right">
+ {editable ? (
+ <Input
+ type="number"
+ // Never below what is already on the shelf: taking units back off
+ // is a correction, not a receive.
+ min={item.quantity_received}
+ max={item.quantity_shipped}
+ value={count}
+ onChange={(event) => onCount(Number(event.target.value))}
+ className="ml-auto w-20 text-right tabular-nums"
+ aria-label={t('admin.stock_transfers.columns.quantity_received')}
+ />
+ ) : (
+ <span className="tabular-nums">{item.quantity_received}</span>
+ )}
+ </TableCell>
+ <TableCell>
+ {editable && short ? (
+ <Select value={reason} onValueChange={onReason}>
+ <SelectTrigger aria-label={t('admin.stock_transfers.columns.discrepancy')}>
+ <SelectValue placeholder={t('admin.stock_transfers.discrepancy_placeholder')}>
+ {(value) => (value ? t(`admin.stock_transfers.discrepancy_reasons.${value}`) : '')}
+ </SelectValue>
+ </SelectTrigger>
+ <SelectContent>
+ {DISCREPANCY_REASONS.map((value) => (
+ <SelectItem key={value} value={value}>
+ {t(`admin.stock_transfers.discrepancy_reasons.${value}`)}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ ) : item.discrepancy_reason ? (
+ <span className="text-sm">
+ {t(`admin.stock_transfers.discrepancy_reasons.${item.discrepancy_reason}`, {
+ defaultValue: item.discrepancy_reason,
+ })}
+ </span>
+ ) : (
+ '—'
+ )}
+ </TableCell>
+ </TableRow>
+ )
+}
+
+function Actions({ transfer }: { transfer: StockTransfer }) {
+ const { t } = useTranslation()
+ const confirm = useConfirm()
+ const markReady = useMarkStockTransferReady(transfer.id)
+ const markInTransit = useMarkStockTransferInTransit(transfer.id)
+ const cancelTransfer = useCancelStockTransfer(transfer.id)
+ const [resolution, setResolution] = useState<InTransitResolution>('restock')
+
+ const inFlight = isInFlight(transfer.status)
+ const closed = transfer.status === 'received' || transfer.status === 'canceled'
+
+ if (closed) return null
+
+ async function handleShip() {
+ const ok = await confirm({
+ title: t('admin.stock_transfers.ship_confirm.title'),
+ message: t('admin.stock_transfers.ship_confirm.message', {
+ count: transfer.quantity_shipped_total,
+ }),
+ confirmLabel: t('admin.stock_transfers.actions.mark_in_transit'),
+ })
+ if (!ok) return
+ await markInTransit.mutateAsync({}).catch(() => undefined)
+ }
+
+ async function handleCancel() {
+ const ok = await confirm({
+ title: t('admin.stock_transfers.cancel_confirm.title'),
+ message: inFlight
+ ? t(`admin.stock_transfers.cancel_confirm.in_flight_${resolution}`)
+ : t('admin.stock_transfers.cancel_confirm.message'),
+ variant: 'destructive',
+ confirmLabel: t('admin.stock_transfers.actions.cancel_transfer'),
+ })
+ if (!ok) return
+ await cancelTransfer
+ .mutateAsync(inFlight ? { on_in_transit: resolution } : {})
+ .catch(() => undefined)
+ }
+
+ return (
+ <Card>
+ <CardHeader>
+ <CardTitle>{t('admin.stock_transfers.actions_title')}</CardTitle>
+ </CardHeader>
+ <CardContent className="flex flex-col gap-4">
+ {/* The merchant has to say what happened to units already gone from
+ the source: guessing would either invent stock or destroy it. */}
+ {inFlight && (
+ <Field>
+ <FieldLabel htmlFor="in-transit-resolution">
+ {t('admin.stock_transfers.fields.in_transit_resolution')}
+ </FieldLabel>
+ <Select
+ value={resolution}
+ onValueChange={(value) => setResolution(value as InTransitResolution)}
+ >
+ <SelectTrigger id="in-transit-resolution">
+ <SelectValue>
+ {(value) => t(`admin.stock_transfers.in_transit_resolutions.${value}`)}
+ </SelectValue>
+ </SelectTrigger>
+ <SelectContent>
+ {IN_TRANSIT_RESOLUTIONS.map((value) => (
+ <SelectItem key={value} value={value}>
+ {t(`admin.stock_transfers.in_transit_resolutions.${value}`)}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ </Field>
+ )}
+
+ <div className="flex flex-wrap gap-2">
+ <Can I="update" a={Subject.StockTransfer}>
+ {transfer.status === 'draft' && (
+ <Button
+ type="button"
+ variant="outline"
+ onClick={() => markReady.mutateAsync().catch(() => undefined)}
+ disabled={markReady.isPending || (transfer.items_count ?? 0) === 0}
+ >
+ {t('admin.stock_transfers.actions.mark_ready')}
+ </Button>
+ )}
+ {(transfer.status === 'draft' || transfer.status === 'ready_to_ship') && (
+ <Button type="button" onClick={handleShip} disabled={markInTransit.isPending}>
+ {t('admin.stock_transfers.actions.mark_in_transit')}
+ </Button>
+ )}
+ <Button
+ type="button"
+ variant="destructive"
+ onClick={handleCancel}
+ disabled={cancelTransfer.isPending}
+ >
+ {t('admin.stock_transfers.actions.cancel_transfer')}
+ </Button>
+ </Can>
+ </div>
+ </CardContent>
+ </Card>
+ )
+}
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/products/transfers/index.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/products/transfers/index.tsx
new file mode 100644
index 0000000000..67e13d0629
--- /dev/null
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/products/transfers/index.tsx
@@ -0,0 +1,94 @@
+import type { StockTransfer } from '@spree/admin-sdk'
+import {
+ adminClient,
+ Can,
+ ResourceTable,
+ resourceSearchSchema,
+ Subject,
+ usePermissions,
+} from '@spree/dashboard-core'
+import { Button, RowActions, useConfirm, useRowClickBridge } from '@spree/dashboard-ui'
+import { EyeIcon, PlusIcon } from '@spree/dashboard-ui/icons'
+import { createFileRoute, useNavigate } from '@tanstack/react-router'
+import { useTranslation } from 'react-i18next'
+import { useDeleteStockTransfer } from '../../../../../hooks/use-stock-transfers'
+import '../../../../../tables/stock-transfers'
+
+export const Route = createFileRoute('/_authenticated/$storeId/products/transfers/')({
+ validateSearch: resourceSearchSchema,
+ component: StockTransfersPage,
+})
+
+function StockTransfersPage() {
+ const { t } = useTranslation()
+ const { storeId } = Route.useParams()
+ const search = Route.useSearch()
+ const navigate = useNavigate()
+ const confirm = useConfirm()
+ const deleteMutation = useDeleteStockTransfer()
+ const { permissions } = usePermissions()
+
+ function openDetail(id: string) {
+ navigate({
+ to: '/$storeId/products/transfers/$transferId',
+ params: { storeId, transferId: id },
+ })
+ }
+
+ function openCreate() {
+ navigate({ to: '/$storeId/products/transfers/new', params: { storeId } })
+ }
+
+ useRowClickBridge('data-stock-transfer-id', openDetail)
+
+ async function handleDelete(transfer: StockTransfer) {
+ const ok = await confirm({
+ title: t('admin.stock_transfers.delete_confirm.title'),
+ message: t('admin.stock_transfers.delete_confirm.message', { number: transfer.number }),
+ variant: 'destructive',
+ confirmLabel: t('admin.actions.delete'),
+ })
+ if (!ok) return
+ await deleteMutation.mutateAsync(transfer.id).catch(() => undefined)
+ }
+
+ return (
+ <ResourceTable<StockTransfer>
+ tableKey="stock-transfers"
+ queryKey="stock-transfers"
+ queryFn={(params) => adminClient.stockTransfers.list(params)}
+ searchParams={search}
+ rowActions={(transfer) => (
+ <RowActions
+ actions={[
+ {
+ key: 'view',
+ label: t('admin.actions.view_details'),
+ icon: <EyeIcon className="size-4" />,
+ onSelect: () => openDetail(transfer.id),
+ },
+ {
+ key: 'delete',
+ destructive: true,
+ // Only a draft can be thrown away: past that the transfer
+ // describes a box that physically exists, and the detail page
+ // cancels it instead.
+ visible:
+ transfer.status === 'draft' && permissions.can('destroy', Subject.StockTransfer),
+ disabled: deleteMutation.isPending,
+ onSelect: () => handleDelete(transfer),
+ },
+ ]}
+ />
+ )}
+ actions={
+ <Can I="create" a={Subject.StockTransfer}>
+ <Button size="sm" className="h-[2.125rem]" onClick={openCreate}>
+ <PlusIcon className="size-4" />
+ {t('admin.stock_transfers.new_cta')}
+ </Button>
+ </Can>
+ }
+ />
+ )
+}
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/products/transfers/new.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/products/transfers/new.tsx
new file mode 100644
index 0000000000..a8a50a760e
--- /dev/null
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/products/transfers/new.tsx
@@ -0,0 +1,183 @@
+import { useStockLocations } from '@spree/dashboard-core'
+import {
+ Button,
+ Card,
+ CardContent,
+ CardHeader,
+ CardTitle,
+ Field,
+ FieldError,
+ FieldGroup,
+ FieldLabel,
+ Input,
+ Select,
+ SelectContent,
+ SelectItem,
+ SelectTrigger,
+ SelectValue,
+ Textarea,
+} from '@spree/dashboard-ui'
+import { createFileRoute, useNavigate } from '@tanstack/react-router'
+import { useState } from 'react'
+import { useTranslation } from 'react-i18next'
+import {
+ type VariantLine,
+ VariantLineEditor,
+} from '../../../../../components/spree/variant-line-editor'
+import { useCreateStockTransfer } from '../../../../../hooks/use-stock-transfers'
+
+export const Route = createFileRoute('/_authenticated/$storeId/products/transfers/new')({
+ component: NewStockTransferPage,
+})
+
+function NewStockTransferPage() {
+ const { t } = useTranslation()
+ const { storeId } = Route.useParams()
+ const navigate = useNavigate()
+ const createMutation = useCreateStockTransfer()
+ const { data: stockLocations } = useStockLocations({ limit: 100 })
+ const locations = stockLocations?.data ?? []
+
+ const [sourceId, setSourceId] = useState('')
+ const [destinationId, setDestinationId] = useState('')
+ const [reference, setReference] = useState('')
+ const [notes, setNotes] = useState('')
+ const [lines, setLines] = useState<VariantLine[]>([])
+
+ const sameLocation = !!sourceId && sourceId === destinationId
+ const canSubmit =
+ !!sourceId && !!destinationId && !sameLocation && lines.every((line) => line.quantity > 0)
+
+ async function handleSubmit() {
+ if (!canSubmit) return
+
+ const transfer = await createMutation.mutateAsync({
+ source_location_id: sourceId,
+ destination_location_id: destinationId,
+ reference: reference.trim() || undefined,
+ notes: notes.trim() || undefined,
+ items: lines.map((line) => ({
+ variant_id: line.variant.id,
+ quantity_shipped: line.quantity,
+ })),
+ })
+
+ navigate({
+ to: '/$storeId/products/transfers/$transferId',
+ params: { storeId, transferId: transfer.id },
+ })
+ }
+
+ return (
+ <div className="mx-auto flex w-full max-w-3xl flex-col gap-4 p-4">
+ <Card>
+ <CardHeader>
+ <CardTitle>{t('admin.stock_transfers.new_title')}</CardTitle>
+ </CardHeader>
+ <CardContent>
+ <FieldGroup>
+ <Field>
+ <FieldLabel htmlFor="source">{t('admin.stock_transfers.fields.source')}</FieldLabel>
+ <Select value={sourceId} onValueChange={setSourceId}>
+ <SelectTrigger id="source">
+ <SelectValue placeholder={t('admin.stock_transfers.fields.source_placeholder')}>
+ {(value) => locations.find((l) => l.id === value)?.name ?? (value as string)}
+ </SelectValue>
+ </SelectTrigger>
+ <SelectContent>
+ {locations.map((location) => (
+ <SelectItem key={location.id} value={location.id}>
+ {location.name}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ </Field>
+
+ <Field>
+ <FieldLabel htmlFor="destination">
+ {t('admin.stock_transfers.fields.destination')}
+ </FieldLabel>
+ <Select value={destinationId} onValueChange={setDestinationId}>
+ <SelectTrigger id="destination">
+ <SelectValue
+ placeholder={t('admin.stock_transfers.fields.destination_placeholder')}
+ >
+ {(value) => locations.find((l) => l.id === value)?.name ?? (value as string)}
+ </SelectValue>
+ </SelectTrigger>
+ <SelectContent>
+ {locations
+ .filter((location) => location.id !== sourceId)
+ .map((location) => (
+ <SelectItem key={location.id} value={location.id}>
+ {location.name}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ {sameLocation && (
+ <FieldError>{t('admin.stock_transfers.errors.same_location')}</FieldError>
+ )}
+ </Field>
+
+ <Field>
+ <FieldLabel htmlFor="reference">
+ {t('admin.stock_transfers.fields.reference')}
+ </FieldLabel>
+ <Input
+ id="reference"
+ placeholder={t('admin.stock_transfers.fields.reference_placeholder')}
+ value={reference}
+ onChange={(event) => setReference(event.target.value)}
+ />
+ </Field>
+
+ <Field>
+ <FieldLabel htmlFor="notes">{t('admin.stock_transfers.fields.notes')}</FieldLabel>
+ <Textarea
+ id="notes"
+ value={notes}
+ onChange={(event) => setNotes(event.target.value)}
+ />
+ </Field>
+ </FieldGroup>
+ </CardContent>
+ </Card>
+
+ <Card>
+ <CardHeader>
+ <CardTitle>{t('admin.stock_transfers.items_title')}</CardTitle>
+ </CardHeader>
+ <CardContent>
+ {/* A draft may open empty and gain lines as the merchant packs, so
+ there is nothing to enforce here. */}
+ <VariantLineEditor
+ lines={lines}
+ onChange={setLines}
+ quantityLabel={t('admin.stock_transfers.columns.quantity_shipped')}
+ />
+ </CardContent>
+ </Card>
+
+ <div className="flex justify-end gap-2">
+ <Button
+ type="button"
+ variant="outline"
+ onClick={() => navigate({ to: '/$storeId/products/transfers', params: { storeId } })}
+ >
+ {t('admin.actions.cancel')}
+ </Button>
+ <Button
+ type="button"
+ onClick={handleSubmit}
+ disabled={!canSubmit || createMutation.isPending}
+ >
+ {createMutation.isPending
+ ? t('admin.actions.creating')
+ : t('admin.stock_transfers.actions.create_draft')}
+ </Button>
+ </div>
+ </div>
+ )
+}
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/settings/stock-locations.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/settings/stock-locations.tsx
index 6eaf0156b6..39be91f03e 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/settings/stock-locations.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/settings/stock-locations.tsx
@@ -1,6 +1,7 @@
import { StockLocationsPage, stockLocationsSearchSchema } from '@spree/dashboard-core'
import { createFileRoute } from '@tanstack/react-router'
import type { z } from 'zod/v4'
+import { StockHistoryCard } from '../../../../components/spree/stock-history-card'
import { StockLevelsPanel } from '../../../../components/spree/stock-levels-panel'
// Adds the seller column to the shared table — operator-only, see the file.
import '../../../../tables/stock-locations'
@@ -13,8 +14,9 @@ export const Route = createFileRoute('/_authenticated/$storeId/settings/stock-lo
/**
* The page itself lives in `@spree/dashboard-core` so the marketplace seller
* panel renders the same one. What stays here is the route (paths differ per
- * panel, and file routes are generated per app) and the on-hand stock editor,
- * which reads the Admin API and links to the operator's product pages.
+ * panel, and file routes are generated per app), the on-hand stock editor and
+ * the movement history — both read the Admin API and link to the operator's
+ * product pages.
*/
function StockLocationsRoute() {
// Cast: the inferred search type unions with the parent layout's shape,
@@ -22,5 +24,16 @@ function StockLocationsRoute() {
// still the source of truth — this gets past the parent-union narrowing.
const search = Route.useSearch() as z.infer<typeof stockLocationsSearchSchema>
- return <StockLocationsPage search={search} stockLevelsPanel={StockLevelsPanel} />
+ return (
+ <StockLocationsPage
+ search={search}
+ stockLevelsPanel={StockLevelsPanel}
+ activityPanel={ActivityPanel}
+ />
+ )
+}
+
+/** What changed in this warehouse — the reconciliation view. */
+function ActivityPanel({ stockLocationId }: { stockLocationId: string }) {
+ return <StockHistoryCard stockLocationId={stockLocationId} />
}
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/settings/suppliers.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/settings/suppliers.tsx
new file mode 100644
index 0000000000..66eb397b5e
--- /dev/null
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/settings/suppliers.tsx
@@ -0,0 +1,375 @@
+import type { Supplier } from '@spree/admin-sdk'
+import {
+ adminClient,
+ Can,
+ CountryCombobox,
+ ResourceTable,
+ resourceSearchSchema,
+ StateCombobox,
+ Subject,
+ useCountryStates,
+ usePermissions,
+} from '@spree/dashboard-core'
+import {
+ Button,
+ Field,
+ FieldError,
+ FieldGroup,
+ FieldLabel,
+ Input,
+ RowActions,
+ Sheet,
+ SheetContent,
+ SheetDescription,
+ SheetFooter,
+ SheetHeader,
+ SheetTitle,
+ Textarea,
+ useConfirm,
+ useRowClickBridge,
+} from '@spree/dashboard-ui'
+import { PencilIcon, PlusIcon } from '@spree/dashboard-ui/icons'
+import { createFileRoute, useNavigate } from '@tanstack/react-router'
+import { useState } from 'react'
+import { useTranslation } from 'react-i18next'
+import { z } from 'zod/v4'
+import {
+ useCreateSupplier,
+ useDeleteSupplier,
+ useSupplier,
+ useUpdateSupplier,
+} from '../../../../hooks/use-suppliers'
+import '../../../../tables/suppliers'
+
+const suppliersSearchSchema = resourceSearchSchema.extend({
+ edit: z.string().optional(),
+ new: z.coerce.boolean().optional(),
+})
+
+export const Route = createFileRoute('/_authenticated/$storeId/settings/suppliers')({
+ validateSearch: suppliersSearchSchema,
+ component: SuppliersPage,
+})
+
+function SuppliersPage() {
+ const { t } = useTranslation()
+ const search = Route.useSearch() as z.infer<typeof suppliersSearchSchema>
+ const navigate = useNavigate()
+ const confirm = useConfirm()
+ const deleteMutation = useDeleteSupplier()
+ const { permissions } = usePermissions()
+
+ const editId = search.edit
+ const isCreating = !!search.new
+
+ const closeSheet = () =>
+ navigate({
+ search: (prev: Record<string, unknown>) => {
+ const { edit: _e, new: _n, ...rest } = prev
+ return rest as never
+ },
+ })
+
+ const openCreate = () =>
+ navigate({ search: (prev: Record<string, unknown>) => ({ ...prev, new: true }) as never })
+
+ const openEdit = (id: string) =>
+ navigate({ search: (prev: Record<string, unknown>) => ({ ...prev, edit: id }) as never })
+
+ useRowClickBridge('data-supplier-id', openEdit)
+
+ async function handleDelete(supplier: Supplier) {
+ const ok = await confirm({
+ title: t('admin.suppliers.delete_confirm.title'),
+ message: t('admin.suppliers.delete_confirm.message', { name: supplier.name }),
+ variant: 'destructive',
+ confirmLabel: t('admin.actions.delete'),
+ })
+ if (!ok) return
+ await deleteMutation.mutateAsync(supplier.id).catch(() => undefined)
+ }
+
+ return (
+ <>
+ <ResourceTable<Supplier>
+ tableKey="suppliers"
+ queryKey="suppliers"
+ queryFn={(params) => adminClient.suppliers.list(params)}
+ searchParams={search}
+ rowActions={(supplier) => (
+ <RowActions
+ actions={[
+ {
+ key: 'edit',
+ label: t('admin.actions.edit'),
+ icon: <PencilIcon className="size-4" />,
+ onSelect: () => openEdit(supplier.id),
+ },
+ {
+ key: 'delete',
+ destructive: true,
+ visible: permissions.can('destroy', Subject.Supplier),
+ disabled: deleteMutation.isPending,
+ onSelect: () => handleDelete(supplier),
+ },
+ ]}
+ />
+ )}
+ actions={
+ <Can I="create" a={Subject.Supplier}>
+ <Button size="sm" className="h-[2.125rem]" onClick={openCreate}>
+ <PlusIcon className="size-4" />
+ {t('admin.suppliers.new_cta')}
+ </Button>
+ </Can>
+ }
+ />
+
+ {isCreating && <SupplierSheet open onOpenChange={(open) => !open && closeSheet()} />}
+ {editId && <SupplierSheet id={editId} open onOpenChange={(open) => !open && closeSheet()} />}
+ </>
+ )
+}
+
+interface SupplierFormState {
+ name: string
+ contact_name: string
+ email: string
+ phone: string
+ notes: string
+ address1: string
+ address2: string
+ city: string
+ state_name: string
+ state_code: string
+ country_code: string
+ postal_code: string
+}
+
+const EMPTY_FORM: SupplierFormState = {
+ name: '',
+ contact_name: '',
+ email: '',
+ phone: '',
+ notes: '',
+ address1: '',
+ address2: '',
+ city: '',
+ state_name: '',
+ state_code: '',
+ country_code: '',
+ postal_code: '',
+}
+
+function SupplierSheet({
+ id,
+ open,
+ onOpenChange,
+}: {
+ id?: string
+ open: boolean
+ onOpenChange: (open: boolean) => void
+}) {
+ const { t } = useTranslation()
+ const { data: supplier } = useSupplier(id)
+ const createMutation = useCreateSupplier()
+ const updateMutation = useUpdateSupplier(id ?? '')
+ const mutation = id ? updateMutation : createMutation
+
+ const [form, setForm] = useState<SupplierFormState>(EMPTY_FORM)
+ const [hydratedFor, setHydratedFor] = useState<string | undefined>(undefined)
+ const { states } = useCountryStates(form.country_code)
+
+ // The record arrives after the sheet opens, so seed the fields the first
+ // time it does rather than on every render.
+ if (supplier && hydratedFor !== supplier.id) {
+ setHydratedFor(supplier.id)
+ setForm({
+ name: supplier.name,
+ contact_name: supplier.contact_name ?? '',
+ email: supplier.email ?? '',
+ phone: supplier.phone ?? '',
+ notes: supplier.notes ?? '',
+ address1: supplier.address1 ?? '',
+ address2: supplier.address2 ?? '',
+ city: supplier.city ?? '',
+ state_name: supplier.state_name ?? '',
+ state_code: supplier.state_code ?? '',
+ country_code: supplier.country_code ?? '',
+ postal_code: supplier.postal_code ?? '',
+ })
+ }
+
+ function set<K extends keyof SupplierFormState>(key: K, value: SupplierFormState[K]) {
+ setForm((prev) => ({ ...prev, [key]: value }))
+ }
+
+ async function handleSubmit() {
+ if (!form.name.trim()) return
+
+ // Blank strings would overwrite a stored value with an empty one; the
+ // API reads a missing key as "leave it alone".
+ const payload = Object.fromEntries(
+ Object.entries(form).map(([key, value]) => [key, value.trim() || undefined]),
+ ) as Record<string, string | undefined>
+
+ await mutation.mutateAsync({ ...payload, name: form.name.trim() })
+ onOpenChange(false)
+ }
+
+ return (
+ <Sheet open={open} onOpenChange={onOpenChange}>
+ <SheetContent className="sm:max-w-xl">
+ <SheetHeader>
+ <SheetTitle>
+ {id ? t('admin.suppliers.edit_title') : t('admin.suppliers.new_title')}
+ </SheetTitle>
+ <SheetDescription>{t('admin.suppliers.sheet_description')}</SheetDescription>
+ </SheetHeader>
+
+ <div className="flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto p-4">
+ <FieldGroup>
+ <Field>
+ <FieldLabel htmlFor="supplier-name">{t('admin.fields.name.label')}</FieldLabel>
+ <Input
+ id="supplier-name"
+ value={form.name}
+ onChange={(event) => set('name', event.target.value)}
+ aria-invalid={!form.name.trim() || undefined}
+ />
+ {!form.name.trim() && (
+ <FieldError>{t('admin.suppliers.errors.name_blank')}</FieldError>
+ )}
+ </Field>
+
+ <Field>
+ <FieldLabel htmlFor="supplier-contact">
+ {t('admin.suppliers.fields.contact_name')}
+ </FieldLabel>
+ <Input
+ id="supplier-contact"
+ value={form.contact_name}
+ onChange={(event) => set('contact_name', event.target.value)}
+ />
+ </Field>
+
+ <Field>
+ <FieldLabel htmlFor="supplier-email">{t('admin.fields.email.label')}</FieldLabel>
+ <Input
+ id="supplier-email"
+ type="email"
+ value={form.email}
+ onChange={(event) => set('email', event.target.value)}
+ />
+ </Field>
+
+ <Field>
+ <FieldLabel htmlFor="supplier-phone">{t('admin.fields.phone.label')}</FieldLabel>
+ <Input
+ id="supplier-phone"
+ value={form.phone}
+ onChange={(event) => set('phone', event.target.value)}
+ />
+ </Field>
+
+ <Field>
+ <FieldLabel htmlFor="supplier-address1">
+ {t('admin.suppliers.fields.address1')}
+ </FieldLabel>
+ <Input
+ id="supplier-address1"
+ value={form.address1}
+ onChange={(event) => set('address1', event.target.value)}
+ />
+ </Field>
+
+ <Field>
+ <FieldLabel htmlFor="supplier-address2">
+ {t('admin.suppliers.fields.address2')}
+ </FieldLabel>
+ <Input
+ id="supplier-address2"
+ value={form.address2}
+ onChange={(event) => set('address2', event.target.value)}
+ />
+ </Field>
+
+ <Field>
+ <FieldLabel htmlFor="supplier-city">{t('admin.suppliers.fields.city')}</FieldLabel>
+ <Input
+ id="supplier-city"
+ value={form.city}
+ onChange={(event) => set('city', event.target.value)}
+ />
+ </Field>
+
+ <Field>
+ <FieldLabel htmlFor="supplier-postal-code">
+ {t('admin.suppliers.fields.postal_code')}
+ </FieldLabel>
+ <Input
+ id="supplier-postal-code"
+ value={form.postal_code}
+ onChange={(event) => set('postal_code', event.target.value)}
+ />
+ </Field>
+
+ <Field>
+ <FieldLabel htmlFor="supplier-country">{t('admin.fields.country.label')}</FieldLabel>
+ <CountryCombobox
+ id="supplier-country"
+ value={form.country_code}
+ onValueChange={(iso) => {
+ set('country_code', iso ?? '')
+ // The old state belongs to the old country; keeping it would
+ // put the supplier in a state that no longer exists.
+ set('state_code', '')
+ }}
+ />
+ </Field>
+
+ {form.country_code && states.length > 0 && (
+ <Field>
+ <FieldLabel htmlFor="supplier-state">{t('admin.fields.state.label')}</FieldLabel>
+ <StateCombobox
+ id="supplier-state"
+ countryCode={form.country_code}
+ states={states}
+ value={form.state_code}
+ onValueChange={(abbr) => set('state_code', abbr)}
+ />
+ </Field>
+ )}
+
+ <Field>
+ <FieldLabel htmlFor="supplier-notes">{t('admin.suppliers.fields.notes')}</FieldLabel>
+ <Textarea
+ id="supplier-notes"
+ value={form.notes}
+ onChange={(event) => set('notes', event.target.value)}
+ />
+ </Field>
+ </FieldGroup>
+ </div>
+
+ <SheetFooter>
+ <Button
+ type="button"
+ variant="outline"
+ onClick={() => onOpenChange(false)}
+ disabled={mutation.isPending}
+ >
+ {t('admin.actions.cancel')}
+ </Button>
+ <Button
+ type="button"
+ onClick={handleSubmit}
+ disabled={!form.name.trim() || mutation.isPending}
+ >
+ {mutation.isPending ? t('admin.actions.saving') : t('admin.actions.save')}
+ </Button>
+ </SheetFooter>
+ </SheetContent>
+ </Sheet>
+ )
+}
diff --git a/packages/dashboard/src/schemas/inventory-operations.ts b/packages/dashboard/src/schemas/inventory-operations.ts
new file mode 100644
index 0000000000..1380d67147
--- /dev/null
+++ b/packages/dashboard/src/schemas/inventory-operations.ts
@@ -0,0 +1,50 @@
+/**
+ * Canonical status values for the two inventory documents, matching
+ * `Spree::HasStatus` on the models. Values only — labels are built at render
+ * time from `admin.stock_transfers.statuses.*` and
+ * `admin.purchase_orders.statuses.*`.
+ */
+export const STOCK_TRANSFER_STATUSES = [
+ 'draft',
+ 'ready_to_ship',
+ 'in_transit',
+ 'partially_received',
+ 'received',
+ 'canceled',
+] as const
+
+export type StockTransferStatus = (typeof STOCK_TRANSFER_STATUSES)[number]
+
+export const PURCHASE_ORDER_STATUSES = [
+ 'draft',
+ 'ordered',
+ 'partially_received',
+ 'received',
+ 'canceled',
+] as const
+
+export type PurchaseOrderStatus = (typeof PURCHASE_ORDER_STATUSES)[number]
+
+/**
+ * Why fewer units arrived than were shipped. Free text is allowed by the API,
+ * but offering the three answers a warehouse actually gives keeps the data
+ * worth reporting on.
+ */
+export const DISCREPANCY_REASONS = ['damaged_in_transit', 'lost_in_transit', 'undercount'] as const
+
+export type DiscrepancyReason = (typeof DISCREPANCY_REASONS)[number]
+
+/** What happens to units still in flight when a shipped transfer is called off. */
+export const IN_TRANSIT_RESOLUTIONS = ['restock', 'write_off'] as const
+
+export type InTransitResolution = (typeof IN_TRANSIT_RESOLUTIONS)[number]
+
+/** A transfer whose units have left the source but not all arrived. */
+export function isInFlight(status: string): boolean {
+ return status === 'in_transit' || status === 'partially_received'
+}
+
+/** Nothing more will arrive on a document in one of these. */
+export function isClosed(status: string): boolean {
+ return status === 'received' || status === 'canceled'
+}
diff --git a/packages/dashboard/src/tables/purchase-orders.tsx b/packages/dashboard/src/tables/purchase-orders.tsx
new file mode 100644
index 0000000000..88fb50f70a
--- /dev/null
+++ b/packages/dashboard/src/tables/purchase-orders.tsx
@@ -0,0 +1,94 @@
+import type { PurchaseOrder } from '@spree/admin-sdk'
+import { defineTable } from '@spree/dashboard-core'
+import { RelativeTime, ResourceNameCell, StatusBadge } from '@spree/dashboard-ui'
+import { TruckIcon } from '@spree/dashboard-ui/icons'
+import i18n from 'i18next'
+import { PURCHASE_ORDER_STATUSES } from '../schemas/inventory-operations'
+
+function statusLabel(value: string): string {
+ return i18n.t(`admin.purchase_orders.statuses.${value}`)
+}
+
+defineTable<PurchaseOrder>('purchase-orders', {
+ title: i18n.t('admin.purchase_orders.title'),
+ description: i18n.t('admin.table_descriptions.purchase_orders'),
+ searchParam: 'number_or_reference_cont',
+ searchPlaceholder: i18n.t('admin.purchase_orders.table.search_placeholder'),
+ defaultSort: { field: 'created_at', direction: 'desc' },
+ emptyIcon: <TruckIcon className="size-8 text-muted-foreground" />,
+ emptyMessage: i18n.t('admin.purchase_orders.table.empty'),
+ columns: [
+ {
+ key: 'number',
+ label: i18n.t('admin.purchase_orders.columns.number'),
+ sortable: true,
+ default: true,
+ render: (po) => (
+ <ResourceNameCell
+ id={po.id}
+ dataAttr="data-purchase-order-id"
+ name={po.number}
+ nameClassName="tabular-nums"
+ />
+ ),
+ },
+ {
+ key: 'status',
+ label: i18n.t('admin.fields.status.label'),
+ sortable: true,
+ filterable: true,
+ filterType: 'enum',
+ filterOptions: PURCHASE_ORDER_STATUSES.map((value) => ({ value, label: statusLabel(value) })),
+ quickFilter: true,
+ default: true,
+ // `received` overrides the shared tone map, which reads that code as a
+ // return still owing a refund. A finished transfer is not amber.
+ render: (po) => (
+ <StatusBadge
+ status={po.status}
+ label={statusLabel(po.status)}
+ tone={po.status === 'received' ? 'success' : undefined}
+ />
+ ),
+ },
+ {
+ key: 'supplier',
+ label: i18n.t('admin.purchase_orders.columns.supplier'),
+ default: true,
+ render: (po) => po.supplier?.name ?? '—',
+ },
+ {
+ key: 'quantity',
+ label: i18n.t('admin.purchase_orders.columns.units'),
+ default: true,
+ className: 'tabular-nums',
+ render: (po) => `${po.quantity_received_total} / ${po.quantity_ordered_total}`,
+ },
+ {
+ key: 'display_subtotal',
+ label: i18n.t('admin.purchase_orders.columns.subtotal'),
+ default: true,
+ className: 'tabular-nums',
+ render: (po) => po.display_subtotal,
+ },
+ {
+ key: 'expected_at',
+ label: i18n.t('admin.purchase_orders.columns.expected'),
+ sortable: true,
+ filterable: true,
+ filterType: 'date',
+ default: true,
+ className: 'text-sm text-muted-foreground whitespace-nowrap',
+ render: (po) => po.expected_at ?? '—',
+ },
+ {
+ key: 'created_at',
+ label: i18n.t('admin.fields.created_at.label'),
+ sortable: true,
+ filterable: true,
+ filterType: 'date',
+ className: 'text-sm text-muted-foreground whitespace-nowrap',
+ render: (po) => <RelativeTime iso={po.created_at} />,
+ },
+ ],
+})
diff --git a/packages/dashboard/src/tables/stock-transfers.tsx b/packages/dashboard/src/tables/stock-transfers.tsx
index d55106f1f0..635940b7af 100644
--- a/packages/dashboard/src/tables/stock-transfers.tsx
+++ b/packages/dashboard/src/tables/stock-transfers.tsx
@@ -1,8 +1,13 @@
import type { StockTransfer } from '@spree/admin-sdk'
import { defineTable } from '@spree/dashboard-core'
-import { Badge, RelativeTime, ResourceNameCell } from '@spree/dashboard-ui'
+import { RelativeTime, ResourceNameCell, StatusBadge } from '@spree/dashboard-ui'
import { ArrowLeftRightIcon } from '@spree/dashboard-ui/icons'
import i18n from 'i18next'
+import { STOCK_TRANSFER_STATUSES } from '../schemas/inventory-operations'
+
+function statusLabel(value: string): string {
+ return i18n.t(`admin.stock_transfers.statuses.${value}`)
+}
defineTable<StockTransfer>('stock-transfers', {
title: i18n.t('admin.stock_transfers.title'),
@@ -29,17 +34,23 @@ defineTable<StockTransfer>('stock-transfers', {
),
},
{
- key: 'source_destination',
- label: i18n.t('admin.stock_transfers.columns.direction'),
+ key: 'status',
+ label: i18n.t('admin.fields.status.label'),
+ sortable: true,
+ filterable: true,
+ filterType: 'enum',
+ filterOptions: STOCK_TRANSFER_STATUSES.map((value) => ({ value, label: statusLabel(value) })),
+ quickFilter: true,
default: true,
- render: (st) =>
- st.source_location_id ? (
- <span className="text-sm">{i18n.t('admin.stock_transfers.direction.internal')}</span>
- ) : (
- <Badge variant="outline">
- {i18n.t('admin.stock_transfers.direction.external_receive')}
- </Badge>
- ),
+ // `received` overrides the shared tone map, which reads that code as a
+ // return still owing a refund. A finished transfer is not amber.
+ render: (st) => (
+ <StatusBadge
+ status={st.status}
+ label={statusLabel(st.status)}
+ tone={st.status === 'received' ? 'success' : undefined}
+ />
+ ),
},
{
key: 'reference',
@@ -47,12 +58,28 @@ defineTable<StockTransfer>('stock-transfers', {
default: true,
render: (st) => st.reference ?? '—',
},
+ {
+ key: 'quantity',
+ label: i18n.t('admin.stock_transfers.columns.units'),
+ default: true,
+ className: 'tabular-nums',
+ // Received against shipped: the one number that says whether the trip is
+ // still owed anything.
+ render: (st) => `${st.quantity_received_total} / ${st.quantity_shipped_total}`,
+ },
+ {
+ key: 'shipped_at',
+ label: i18n.t('admin.stock_transfers.columns.shipped'),
+ sortable: true,
+ default: true,
+ className: 'text-sm text-muted-foreground whitespace-nowrap',
+ render: (st) => (st.shipped_at ? <RelativeTime iso={st.shipped_at} /> : '—'),
+ },
{
key: 'created_at',
label: i18n.t('admin.fields.created_at.label'),
sortable: true,
filterable: true,
- default: true,
filterType: 'date',
className: 'text-sm text-muted-foreground whitespace-nowrap',
render: (st) => <RelativeTime iso={st.created_at} />,
diff --git a/packages/dashboard/src/tables/suppliers.tsx b/packages/dashboard/src/tables/suppliers.tsx
new file mode 100644
index 0000000000..a93f1d0624
--- /dev/null
+++ b/packages/dashboard/src/tables/suppliers.tsx
@@ -0,0 +1,53 @@
+import type { Supplier } from '@spree/admin-sdk'
+import { defineTable } from '@spree/dashboard-core'
+import { ResourceNameCell } from '@spree/dashboard-ui'
+import { Building2Icon } from '@spree/dashboard-ui/icons'
+import i18n from 'i18next'
+
+defineTable<Supplier>('suppliers', {
+ title: i18n.t('admin.suppliers.title'),
+ description: i18n.t('admin.table_descriptions.suppliers'),
+ searchParam: 'name_or_contact_name_or_email_cont',
+ searchPlaceholder: i18n.t('admin.suppliers.table.search_placeholder'),
+ defaultSort: { field: 'name', direction: 'asc' },
+ emptyIcon: <Building2Icon className="size-8 text-muted-foreground" />,
+ emptyMessage: i18n.t('admin.suppliers.table.empty'),
+ columns: [
+ {
+ key: 'name',
+ label: i18n.t('admin.fields.name.label'),
+ sortable: true,
+ default: true,
+ render: (supplier) => (
+ <ResourceNameCell id={supplier.id} dataAttr="data-supplier-id" name={supplier.name} />
+ ),
+ },
+ {
+ key: 'contact_name',
+ label: i18n.t('admin.suppliers.columns.contact'),
+ sortable: true,
+ default: true,
+ render: (supplier) => supplier.contact_name ?? '—',
+ },
+ {
+ key: 'email',
+ label: i18n.t('admin.fields.email.label'),
+ sortable: true,
+ default: true,
+ render: (supplier) => supplier.email ?? '—',
+ },
+ {
+ key: 'phone',
+ label: i18n.t('admin.fields.phone.label'),
+ default: true,
+ render: (supplier) => supplier.phone ?? '—',
+ },
+ {
+ key: 'purchase_orders_count',
+ label: i18n.t('admin.suppliers.columns.orders'),
+ default: true,
+ className: 'tabular-nums',
+ render: (supplier) => supplier.purchase_orders_count,
+ },
+ ],
+})