fix: Minor fixes to the inventory pages (#7921)

This commit is contained in:
Stevche Radevski
2024-07-03 15:45:53 +02:00
committed by GitHub
parent 2711012d96
commit 3f499c829e
3 changed files with 12 additions and 9 deletions

View File

@@ -59,7 +59,9 @@ export const InventoryItemGeneralSection = ({
}
const getQuantityFormat = (quantity: number, locations?: number) => {
return `${quantity ?? "-"} ${
quantity ? `across ${locations ?? "-"} locations` : ""
}`
if (quantity !== undefined && !isNaN(quantity)) {
return `${quantity} across ${locations ?? "-"} locations`
}
return "-"
}

View File

@@ -2,10 +2,7 @@ import * as zod from "zod"
import { InventoryTypes, StockLocationDTO } from "@medusajs/types"
import { Button, Input, Select, Text, Textarea, toast } from "@medusajs/ui"
import {
RouteDrawer,
useRouteModal,
} from "../../../../../../components/modals"
import { RouteDrawer, useRouteModal } from "../../../../../../components/modals"
import { zodResolver } from "@hookform/resolvers/zod"
import { useForm } from "react-hook-form"
@@ -140,7 +137,11 @@ export const EditReservationForm = ({
/>
<AttributeGridRow
title={t("inventory.available")}
value={level!.stocked_quantity - reservedQuantity}
value={
level!.stocked_quantity -
(level.reserved_quantity - reservation.quantity) -
reservedQuantity
}
/>
</div>
<Form.Field

View File

@@ -82,7 +82,7 @@ export const ReservationGeneralSection = ({
/>
<SectionRow
title={t("inventory.reservation.reservedAtLocation")}
value={reservation.quantity}
value={locationLevel?.reserved_quantity}
/>
</Container>
)