From fee55c95c89605bc703e94cef1d8c6600aed8c92 Mon Sep 17 00:00:00 2001 From: Keannu Bernasol Date: Wed, 3 Jan 2024 17:28:43 +0800 Subject: [PATCH] Added breakage handling for technician transaction view --- .../EditItemInstanceModal.tsx | 4 ++++ src/Components/Types/Types.tsx | 1 + .../TransactionsListPage.tsx | 23 +++++++++++++++++-- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/src/Components/EditItemInstanceModal/EditItemInstanceModal.tsx b/src/Components/EditItemInstanceModal/EditItemInstanceModal.tsx index 10e3415..1015735 100644 --- a/src/Components/EditItemInstanceModal/EditItemInstanceModal.tsx +++ b/src/Components/EditItemInstanceModal/EditItemInstanceModal.tsx @@ -61,6 +61,9 @@ export default function EditItemInstanceModal(props: { queryClient.invalidateQueries({ queryKey: ["equipment_instance", props.id], }); + queryClient.invalidateQueries({ + queryKey: ["transactions"], + }); setError("Updated successfully"); toast( `Item updated successfuly, ${ @@ -84,6 +87,7 @@ export default function EditItemInstanceModal(props: { status: data[1].status, }); } + props.setOpen(false); }, }); diff --git a/src/Components/Types/Types.tsx b/src/Components/Types/Types.tsx index ea60f65..c1d69f7 100644 --- a/src/Components/Types/Types.tsx +++ b/src/Components/Types/Types.tsx @@ -123,6 +123,7 @@ export type TransactionType = { equipments: Array<{ id: number; name: string; + status: string; }>; transaction_status: string; timestamp: string; diff --git a/src/Pages/TransactionsListPage/TransactionsListPage.tsx b/src/Pages/TransactionsListPage/TransactionsListPage.tsx index 3f322d0..a9ab305 100644 --- a/src/Pages/TransactionsListPage/TransactionsListPage.tsx +++ b/src/Pages/TransactionsListPage/TransactionsListPage.tsx @@ -15,11 +15,13 @@ import Popup from "reactjs-popup"; import { useState } from "react"; import EditTransactionModal from "../../Components/EditTransactionModal/EditTransactionModal"; import TransactionFilterMenu from "../../Components/TransactionFilterMenu/TransactionFilterMenu"; +import EditItemInstanceModal from "../../Components/EditItemInstanceModal/EditItemInstanceModal"; export default function TransactionsListPage() { const [EditTransactionOpen, SetEditTransactionOpen] = useState(false); const [SelectedTransaction, SetSelectedTransaction] = useState(0); const [EditEquipmentsOpen, SetEditEquipmentsOpen] = useState(false); + const [SelectedEquipment, SetSelectedEquipment] = useState(0); const transactions = useQuery({ queryKey: ["transactions"], queryFn: TransactionsAPI, @@ -197,7 +199,7 @@ export default function TransactionsListPage() { > {transaction.remarks} - + Name + + Status + {equipment.name} + + {equipment.status} + ))} @@ -299,7 +315,10 @@ export default function TransactionsListPage() { position={"top center"} contentStyle={styles.popup_center} > -

Edit Transaction Equipment Modal

+ );