fix(dashboard): reservation creation form (#7489)
**What** - refresh reservation creation flow, show available items without required search input - fix location details divider --- CLOSES CORE-2053
This commit is contained in:
+3
-2
@@ -161,7 +161,7 @@ function Location(props: LocationProps) {
|
||||
</div>
|
||||
|
||||
{/* ACTION*/}
|
||||
<div className="flex h-[12px] grow-0 items-center gap-4 divide-x overflow-hidden">
|
||||
<div className="flex grow-0 items-center gap-4 overflow-hidden">
|
||||
<ActionMenu
|
||||
groups={[
|
||||
{
|
||||
@@ -180,8 +180,9 @@ function Location(props: LocationProps) {
|
||||
},
|
||||
]}
|
||||
/>
|
||||
<div className="bg-ui-border-strong h-[12px] w-[1px]" />
|
||||
<Button
|
||||
className="text-ui-fg-interactive rounded-none pl-5 hover:bg-transparent active:bg-transparent"
|
||||
className="text-ui-fg-interactive -ml-1 rounded-none"
|
||||
onClick={() => navigate(`/settings/locations/${location.id}`)}
|
||||
variant="transparent"
|
||||
>
|
||||
|
||||
+8
-11
@@ -61,14 +61,9 @@ export const CreateReservationForm = () => {
|
||||
resolver: zodResolver(CreateReservationSchema),
|
||||
})
|
||||
|
||||
const { inventory_items } = useInventoryItems(
|
||||
{
|
||||
q: inventorySearch,
|
||||
},
|
||||
{
|
||||
enabled: !!inventorySearch,
|
||||
}
|
||||
)
|
||||
const { inventory_items } = useInventoryItems({
|
||||
q: inventorySearch,
|
||||
})
|
||||
|
||||
const inventoryItemId = form.watch("inventory_item_id")
|
||||
const selectedInventoryItem = inventory_items?.find(
|
||||
@@ -174,12 +169,12 @@ export const CreateReservationForm = () => {
|
||||
<Form.Label>{t("fields.location")}</Form.Label>
|
||||
<Form.Control>
|
||||
<Combobox
|
||||
disabled={!!selectedInventoryItem}
|
||||
value={value}
|
||||
onChange={(v) => {
|
||||
onChange(v)
|
||||
}}
|
||||
{...field}
|
||||
disabled={!inventoryItemId}
|
||||
options={(stock_locations ?? []).map(
|
||||
(stockLocation) => ({
|
||||
label: stockLocation.name,
|
||||
@@ -214,7 +209,7 @@ export const CreateReservationForm = () => {
|
||||
title={t("inventory.available")}
|
||||
value={
|
||||
selectedLocationLevel
|
||||
? selectedLocationLevel.available_quantity - quantity
|
||||
? selectedLocationLevel.available_quantity - (quantity || 0)
|
||||
: "-"
|
||||
}
|
||||
/>
|
||||
@@ -233,7 +228,7 @@ export const CreateReservationForm = () => {
|
||||
placeholder={t(
|
||||
"inventory.reservation.quantityPlaceholder"
|
||||
)}
|
||||
min={0}
|
||||
min={1}
|
||||
max={
|
||||
selectedLocationLevel
|
||||
? selectedLocationLevel.available_quantity
|
||||
@@ -250,6 +245,7 @@ export const CreateReservationForm = () => {
|
||||
}
|
||||
}}
|
||||
{...field}
|
||||
disabled={!inventoryItemId || !locationId}
|
||||
/>
|
||||
</Form.Control>
|
||||
<Form.ErrorMessage />
|
||||
@@ -268,6 +264,7 @@ export const CreateReservationForm = () => {
|
||||
<Form.Control>
|
||||
<Textarea
|
||||
{...field}
|
||||
disabled={!inventoryItemId || !locationId}
|
||||
placeholder={t(
|
||||
"inventory.reservation.descriptionPlaceholder"
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user