feat: empty status in credit & vednor.

This commit is contained in:
elforjani13
2021-12-26 20:56:25 +02:00
parent e1646e92a8
commit 99df627633
6 changed files with 23 additions and 15 deletions

View File

@@ -20,7 +20,7 @@ const VendorCreditNoteFormContext = React.createContext();
*/
function VendorCreditNoteFormProvider({ vendorCreditId, ...props }) {
const { state } = useLocation();
const billId = state?.billId;
// Handle fetching the items table based on the given query.
@@ -61,6 +61,12 @@ function VendorCreditNoteFormProvider({ vendorCreditId, ...props }) {
// Determines whether the form in new mode.
const isNewMode = !vendorCreditId;
const newVendorCredit = !isEmpty(bill)
? transformToEditForm({
...pick(bill, ['vendor_id', 'entries']),
})
: [];
// Provider payload.
const provider = {
items,
@@ -68,7 +74,7 @@ function VendorCreditNoteFormProvider({ vendorCreditId, ...props }) {
vendorCredit,
submitPayload,
isNewMode,
bill,
newVendorCredit,
isVendorCreditLoading,