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 inventory details #9535

Merged
merged 2 commits into from
Oct 14, 2024
Merged
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 @@ -7,6 +7,7 @@ import { useReservationItem } from "../../../hooks/api/reservations"
import { InventoryItemGeneralSection } from "../../inventory/inventory-detail/components/inventory-item-general-section"
import { ReservationGeneralSection } from "./components/reservation-general-section"
import { reservationItemLoader } from "./loader"
import { useInventoryItem } from "../../../hooks/api"

export const ReservationDetail = () => {
const { id } = useParams()
Expand All @@ -23,6 +24,13 @@ export const ReservationDetail = () => {
}
)

// TEMP: fetch directly since the fields are not populated with reservation call
Copy link
Collaborator

@srindom srindom Oct 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

q: where would it be more correct to fetch the item details?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what endpoint would you suggest, this is fetching inventory item

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am asking wrt. the comment you put here - what would be the optimal approach to make this not TEMP? Is it just adding the inventory_item field when fetching the reservation?

If so we should maybe either include that in this PR or create a separate task so that can be fixed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it just adding the inventory_item field when fetching the reservation?

Yup, ideally we would want that but with this approach computed properties such as reserved_quantity are not being returned. I'll open a ticket.

const { inventory_item } = useInventoryItem(
reservation?.inventory_item?.id!,
undefined,
{ enabled: !!reservation?.inventory_item?.id! }
)

const { getWidgets } = useDashboardExtension()

if (isLoading || !reservation) {
Expand Down Expand Up @@ -56,9 +64,9 @@ export const ReservationDetail = () => {
<ReservationGeneralSection reservation={reservation} />
</TwoColumnPage.Main>
<TwoColumnPage.Sidebar>
<InventoryItemGeneralSection
inventoryItem={reservation.inventory_item}
/>
{inventory_item && (
<InventoryItemGeneralSection inventoryItem={inventory_item} />
)}
</TwoColumnPage.Sidebar>
</TwoColumnPage>
)
Expand Down
Loading