fix(dashboard): few fixes (#7910)
* fix: fixes * fix: inventory section row formatting with preline whitespace * fix: manage zone areas
This commit is contained in:
+2
-1
@@ -48,7 +48,7 @@ const useColumns = () => {
|
|||||||
<DataGridReadOnlyCell>{row.original.name}</DataGridReadOnlyCell>
|
<DataGridReadOnlyCell>{row.original.name}</DataGridReadOnlyCell>
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
disableHidding: true,
|
disableHiding: true,
|
||||||
}),
|
}),
|
||||||
columnHelper.column({
|
columnHelper.column({
|
||||||
id: "in-stock",
|
id: "in-stock",
|
||||||
@@ -64,6 +64,7 @@ const useColumns = () => {
|
|||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
disableHiding: true,
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
[t]
|
[t]
|
||||||
|
|||||||
+3
-2
@@ -59,6 +59,7 @@ export const InventoryItemGeneralSection = ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
const getQuantityFormat = (quantity: number, locations?: number) => {
|
const getQuantityFormat = (quantity: number, locations?: number) => {
|
||||||
return `${quantity ?? "-"}
|
return `${quantity ?? "-"} ${
|
||||||
${quantity ? `across ${locations ?? "-"} locations` : ""}`
|
quantity ? `across ${locations ?? "-"} locations` : ""
|
||||||
|
}`
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -411,7 +411,7 @@ function ServiceZone({ zone, locationId, fulfillmentSetId }: ServiceZoneProps) {
|
|||||||
{
|
{
|
||||||
label: t("stockLocations.serviceZones.manageAreas.action"),
|
label: t("stockLocations.serviceZones.manageAreas.action"),
|
||||||
icon: <Map />,
|
icon: <Map />,
|
||||||
to: `/settings/locations/${locationId}/fulfillment-set/${fulfillmentSetId}/service-zone/${zone.id}/edit-areas`,
|
to: `/settings/locations/${locationId}/fulfillment-set/${fulfillmentSetId}/service-zone/${zone.id}/areas`,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|||||||
+12
-4
@@ -16,6 +16,7 @@ import {
|
|||||||
import { useProductVariantsInventoryItemsBatch } from "../../../../../hooks/api/products"
|
import { useProductVariantsInventoryItemsBatch } from "../../../../../hooks/api/products"
|
||||||
import { useComboboxData } from "../../../../../hooks/use-combobox-data"
|
import { useComboboxData } from "../../../../../hooks/use-combobox-data"
|
||||||
import { sdk } from "../../../../../lib/client"
|
import { sdk } from "../../../../../lib/client"
|
||||||
|
import { useEffect } from "react"
|
||||||
|
|
||||||
type ManageVariantInventoryItemsFormProps = {
|
type ManageVariantInventoryItemsFormProps = {
|
||||||
variant: AdminProductVariant & {
|
variant: AdminProductVariant & {
|
||||||
@@ -53,10 +54,17 @@ export function ManageVariantInventoryItemsForm({
|
|||||||
|
|
||||||
const form = useForm<zod.infer<typeof ManageVariantInventoryItemsSchema>>({
|
const form = useForm<zod.infer<typeof ManageVariantInventoryItemsSchema>>({
|
||||||
defaultValues: {
|
defaultValues: {
|
||||||
inventory: variant.inventory_items!.map((i) => ({
|
inventory: variant.inventory_items.length
|
||||||
required_quantity: i.required_quantity,
|
? variant.inventory_items!.map((i) => ({
|
||||||
inventory_item_id: i.inventory.id,
|
required_quantity: i.required_quantity,
|
||||||
})),
|
inventory_item_id: i.inventory.id,
|
||||||
|
}))
|
||||||
|
: [
|
||||||
|
{
|
||||||
|
inventory_item_id: "",
|
||||||
|
required_quantity: "",
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
resolver: zodResolver(ManageVariantInventoryItemsSchema),
|
resolver: zodResolver(ManageVariantInventoryItemsSchema),
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -97,11 +97,16 @@ export const useVariantPriceGridColumns = ({
|
|||||||
return columnHelper.display({
|
return columnHelper.display({
|
||||||
header: `Price ${region.name}`,
|
header: `Price ${region.name}`,
|
||||||
cell: ({ row, table }) => {
|
cell: ({ row, table }) => {
|
||||||
|
const currency = currencies.find(
|
||||||
|
(c) => c.code === region.currency_code
|
||||||
|
)
|
||||||
|
|
||||||
|
if (!currency) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
<CurrencyCell
|
<CurrencyCell
|
||||||
currency={currencies.find(
|
currency={currency}
|
||||||
(c) => c.code === region.currency_code
|
|
||||||
)}
|
|
||||||
meta={table.options.meta as DataGridMeta}
|
meta={table.options.meta as DataGridMeta}
|
||||||
field={`variants.${row.index}.prices.${region.id}`}
|
field={`variants.${row.index}.prices.${region.id}`}
|
||||||
/>
|
/>
|
||||||
|
|||||||
+3
-2
@@ -124,10 +124,11 @@ export const useProductVariantTableColumns = (
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex h-full w-full items-center overflow-hidden">
|
<div className="flex items-center">
|
||||||
<Badge
|
<Badge
|
||||||
size="2xsmall"
|
size="2xsmall"
|
||||||
className="flex min-w-[20px] items-center justify-center"
|
title={variantOpt.value}
|
||||||
|
className="inline-block min-w-[20px] max-w-[140px] overflow-hidden truncate"
|
||||||
>
|
>
|
||||||
{variantOpt.value}
|
{variantOpt.value}
|
||||||
</Badge>
|
</Badge>
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ export const PricingEdit = ({
|
|||||||
acc[reg.id] = reg.currency_code
|
acc[reg.id] = reg.currency_code
|
||||||
return acc
|
return acc
|
||||||
}, {})
|
}, {})
|
||||||
}, regions)
|
}, [regions])
|
||||||
|
|
||||||
const variants = variantId
|
const variants = variantId
|
||||||
? product.variants.filter((v) => v.id === variantId)
|
? product.variants.filter((v) => v.id === variantId)
|
||||||
|
|||||||
Reference in New Issue
Block a user