BIG-210 Refund credit & vendor drawer detail.

This commit is contained in:
elforjani13
2022-01-01 15:34:04 +02:00
parent a4a2d0c888
commit 3c73540b4e
24 changed files with 599 additions and 6 deletions

View File

@@ -26,6 +26,7 @@ const commonInvalidateQueries = (queryClient) => {
// Invalidate refund credit
queryClient.invalidateQueries(t.REFUND_CREDIT_NOTE);
queryClient.invalidateQueries(t.REFUND_CREDIT_NOTE_TRANSACTION);
// Invalidate reconcile.
queryClient.invalidateQueries(t.RECONCILE_CREDIT_NOTE);
@@ -35,6 +36,9 @@ const commonInvalidateQueries = (queryClient) => {
queryClient.invalidateQueries(t.SALE_INVOICES);
queryClient.invalidateQueries(t.SALE_INVOICE);
// Invalidate cashflow accounts.
queryClient.invalidateQueries(t.CASHFLOW_ACCOUNT_TRANSACTIONS_INFINITY);
// Invalidate financial reports.
queryClient.invalidateQueries(t.FINANCIAL_REPORT);
};
@@ -320,3 +324,20 @@ export function useDeleteReconcileCredit(props) {
},
);
}
/**
* Retrieve refund credit transaction detail.
* @param {number} id
*
*/
export function useRefundCreditTransaction(id, props, requestProps) {
return useRequestQuery(
[t.REFUND_CREDIT_NOTE_TRANSACTION, id],
{ method: 'get', url: `sales/credit_notes/refunds/${id}`, ...requestProps },
{
select: (res) => res.data.refund_credit,
defaultData: {},
...props,
},
);
}

View File

@@ -118,6 +118,7 @@ const CREDIT_NOTES = {
CREDIT_NOTE: 'CREDIT_NOTE',
CREDIT_NOTES: 'CREDIT_NOTES',
REFUND_CREDIT_NOTE: 'REFUND_CREDIT_NOTE',
REFUND_CREDIT_NOTE_TRANSACTION: 'REFUND_CREDIT_NOTE_TRANSACTION',
RECONCILE_CREDIT_NOTE: 'RECONCILE_CREDIT_NOTE',
RECONCILE_CREDIT_NOTES: 'RECONCILE_CREDIT_NOTES',
};
@@ -126,6 +127,7 @@ const VENDOR_CREDIT_NOTES = {
VENDOR_CREDITS: 'VENDOR_CREDITS',
VENDOR_CREDIT: 'VENDOR_CREDIT',
REFUND_VENDOR_CREDIT: 'REFUND_VENDOR_CREDIT',
REFUND_VENDOR_CREDIT_TRANSACTION: 'REFUND_VENDOR_CREDIT_TRANSACTION',
RECONCILE_VENDOR_CREDIT: 'RECONCILE_VENDOR_CREDIT',
RECONCILE_VENDOR_CREDITS: 'RECONCILE_VENDOR_CREDITS',
};

View File

@@ -26,6 +26,7 @@ const commonInvalidateQueries = (queryClient) => {
// Invalidate refund vendor credit
queryClient.invalidateQueries(t.REFUND_VENDOR_CREDIT);
queryClient.invalidateQueries(t.REFUND_VENDOR_CREDIT_TRANSACTION);
// Invalidate reconcile vendor credit.
queryClient.invalidateQueries(t.RECONCILE_VENDOR_CREDIT);
@@ -35,6 +36,9 @@ const commonInvalidateQueries = (queryClient) => {
queryClient.invalidateQueries(t.BILL);
queryClient.invalidateQueries(t.BILLS);
// Invalidate cashflow accounts.
queryClient.invalidateQueries(t.CASHFLOW_ACCOUNT_TRANSACTIONS_INFINITY);
// Invalidate financial reports.
queryClient.invalidateQueries(t.FINANCIAL_REPORT);
};
@@ -333,3 +337,24 @@ export function useDeleteReconcileVendorCredit(props) {
},
);
}
/**
* Retrieve refund vendor transaction detail.
* @param {number} id
*
*/
export function useRefundVendorCreditTransaction(id, props, requestProps) {
return useRequestQuery(
[t.REFUND_VENDOR_CREDIT_TRANSACTION, id],
{
method: 'get',
url: `purchases/vendor-credit/refunds/${id}`,
...requestProps,
},
{
select: (res) => res.data.refund_credit,
defaultData: {},
...props,
},
);
}