feat: add reconcile credit transactions table.

This commit is contained in:
elforjani13
2021-12-07 20:58:17 +02:00
parent 14f33c667b
commit ecaf23d269
8 changed files with 312 additions and 12 deletions

View File

@@ -1,6 +1,10 @@
import React from 'react';
import intl from 'react-intl-universal';
import { useCreditNote, useRefundCreditNote } from 'hooks/query';
import {
useCreditNote,
useRefundCreditNote,
useReconcileCreditNotes,
} from 'hooks/query';
import { DrawerHeaderContent, DrawerLoading } from 'components';
const CreditNoteDetailDrawerContext = React.createContext();
@@ -26,16 +30,33 @@ function CreditNoteDetailDrawerProvider({ creditNoteId, ...props }) {
enabled: !!creditNoteId,
});
// Handle fetch refund credit note.
const {
data: reconcileCreditNotes,
isFetching: isReconcileCreditNoteFetching,
isLoading: isReconcileCreditNoteLoading,
} = useReconcileCreditNotes(creditNoteId, {
enabled: !!creditNoteId,
});
const provider = {
creditNote,
refundCreditNote,
reconcileCreditNotes,
isRefundCreditNoteLoading,
isRefundCreditNoteFetching,
creditNoteId,
};
return (
<DrawerLoading loading={isCreditNoteLoading || isRefundCreditNoteLoading}>
<DrawerLoading
loading={
isCreditNoteLoading ||
isRefundCreditNoteLoading ||
isReconcileCreditNoteLoading
}
>
<DrawerHeaderContent
name="credit-note-detail-drawer"
title={intl.get('credit_note.drawer_credit_note_detail')}