Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(dashboard): reservation creation form #7489

Merged
merged 3 commits into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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={[
{
Expand All @@ -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"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -214,7 +209,7 @@ export const CreateReservationForm = () => {
title={t("inventory.available")}
value={
selectedLocationLevel
? selectedLocationLevel.available_quantity - quantity
? selectedLocationLevel.available_quantity - (quantity || 0)
: "-"
}
/>
Expand All @@ -233,7 +228,7 @@ export const CreateReservationForm = () => {
placeholder={t(
"inventory.reservation.quantityPlaceholder"
)}
min={0}
min={1}
max={
selectedLocationLevel
? selectedLocationLevel.available_quantity
Expand All @@ -250,6 +245,7 @@ export const CreateReservationForm = () => {
}
}}
{...field}
disabled={!inventoryItemId || !locationId}
/>
</Form.Control>
<Form.ErrorMessage />
Expand All @@ -268,6 +264,7 @@ export const CreateReservationForm = () => {
<Form.Control>
<Textarea
{...field}
disabled={!inventoryItemId || !locationId}
placeholder={t(
"inventory.reservation.descriptionPlaceholder"
)}
Expand Down
Loading