Skip to content

Commit 732bfa8

Browse files
committed
fix: [EBE-563] closing drawer
1 parent f5383a2 commit 732bfa8

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/pages/refundRequests/detail/InvoiceDetail.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,15 @@ type Props = DetailDrawerProps & {
2424
batchId: string;
2525
storeId: string;
2626
onSuccess?: () => void;
27+
onCloseDrawer?: () => void;
2728
};
2829

2930
export default function InvoiceDetail({
3031
itemValues,
3132
listItem,
3233
batchId,
3334
onSuccess,
35+
onCloseDrawer,
3436
isOpen,
3537
setIsOpen,
3638
...rest
@@ -120,6 +122,7 @@ export default function InvoiceDetail({
120122
contentStyle: { position: 'unset', bottom: '0', right: '0' },
121123
});
122124
setInvoiceTransactionModal(false);
125+
onCloseDrawer?.();
123126
onSuccess?.();
124127
} catch (error) {
125128
setAlert({
@@ -137,6 +140,7 @@ export default function InvoiceDetail({
137140
contentStyle: { position: 'unset', bottom: '0', right: '0' },
138141
});
139142
setInvoiceTransactionModal(false);
143+
onCloseDrawer?.();
140144
} finally {
141145
setLoading(false);
142146
}

src/pages/refundRequests/invoiceDataTable.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ const InvoiceDataTable = ({
5656
pointOfSaleId,
5757
trxCode,
5858
fiscalCode,
59+
onDrawerClosed
5960
}: InvoiceDataTableProps) => {
6061
const [transactions, setTransactions] = useState<MerchantTransactionsListDTO["content"]>([]);
6162
const [pagination, setPagination] = useState({
@@ -78,9 +79,13 @@ const InvoiceDataTable = ({
7879
setDrawerOpened(true);
7980
};
8081

81-
const handleToggleDrawer = () => {
82+
const handleToggleDrawer = (open: boolean) => {
8283
setAlert({ ...alert, isOpen: false });
8384
setDrawerOpened(false);
85+
if (!open) {
86+
setRowDetail(null);
87+
onDrawerClosed?.();
88+
}
8489
};
8590

8691
const downloadFile = async (selectedTransaction: any) => {
@@ -347,6 +352,7 @@ const InvoiceDataTable = ({
347352
)}
348353
{rowDetail && (
349354
<InvoiceDetail
355+
onCloseDrawer={() => handleToggleDrawer(false)}
350356
isOpen={drawerOpened}
351357
setIsOpen={handleToggleDrawer}
352358
batchId={batchId ?? ''}

0 commit comments

Comments
 (0)