fix(dashboard): few fixes (#7910)

* fix: fixes

* fix: inventory section row formatting with preline whitespace

* fix: manage zone areas
This commit is contained in:
Frane Polić
2024-07-03 09:34:03 +02:00
committed by GitHub
parent 492213cf03
commit 837ed093e3
7 changed files with 30 additions and 14 deletions

View File

@@ -48,7 +48,7 @@ const useColumns = () => {
<DataGridReadOnlyCell>{row.original.name}</DataGridReadOnlyCell>
)
},
disableHidding: true,
disableHiding: true,
}),
columnHelper.column({
id: "in-stock",
@@ -64,6 +64,7 @@ const useColumns = () => {
/>
)
},
disableHiding: true,
}),
],
[t]

View File

@@ -59,6 +59,7 @@ export const InventoryItemGeneralSection = ({
}
const getQuantityFormat = (quantity: number, locations?: number) => {
return `${quantity ?? "-"}
${quantity ? `across ${locations ?? "-"} locations` : ""}`
return `${quantity ?? "-"} ${
quantity ? `across ${locations ?? "-"} locations` : ""
}`
}

View File

@@ -411,7 +411,7 @@ function ServiceZone({ zone, locationId, fulfillmentSetId }: ServiceZoneProps) {
{
label: t("stockLocations.serviceZones.manageAreas.action"),
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`,
},
],
},

View File

@@ -16,6 +16,7 @@ import {
import { useProductVariantsInventoryItemsBatch } from "../../../../../hooks/api/products"
import { useComboboxData } from "../../../../../hooks/use-combobox-data"
import { sdk } from "../../../../../lib/client"
import { useEffect } from "react"
type ManageVariantInventoryItemsFormProps = {
variant: AdminProductVariant & {
@@ -53,10 +54,17 @@ export function ManageVariantInventoryItemsForm({
const form = useForm<zod.infer<typeof ManageVariantInventoryItemsSchema>>({
defaultValues: {
inventory: variant.inventory_items!.map((i) => ({
required_quantity: i.required_quantity,
inventory_item_id: i.inventory.id,
})),
inventory: variant.inventory_items.length
? variant.inventory_items!.map((i) => ({
required_quantity: i.required_quantity,
inventory_item_id: i.inventory.id,
}))
: [
{
inventory_item_id: "",
required_quantity: "",
},
],
},
resolver: zodResolver(ManageVariantInventoryItemsSchema),
})

View File

@@ -97,11 +97,16 @@ export const useVariantPriceGridColumns = ({
return columnHelper.display({
header: `Price ${region.name}`,
cell: ({ row, table }) => {
const currency = currencies.find(
(c) => c.code === region.currency_code
)
if (!currency) {
return null
}
return (
<CurrencyCell
currency={currencies.find(
(c) => c.code === region.currency_code
)}
currency={currency}
meta={table.options.meta as DataGridMeta}
field={`variants.${row.index}.prices.${region.id}`}
/>

View File

@@ -124,10 +124,11 @@ export const useProductVariantTableColumns = (
}
return (
<div className="flex h-full w-full items-center overflow-hidden">
<div className="flex items-center">
<Badge
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}
</Badge>

View File

@@ -46,7 +46,7 @@ export const PricingEdit = ({
acc[reg.id] = reg.currency_code
return acc
}, {})
}, regions)
}, [regions])
const variants = variantId
? product.variants.filter((v) => v.id === variantId)