feat: payment made form in new and edit mode.

This commit is contained in:
Ahmed Bouhuolia
2020-11-01 17:40:40 +02:00
parent f76abb3f79
commit 70269d382a
24 changed files with 812 additions and 551 deletions

View File

@@ -106,7 +106,20 @@ export const fetchPaymentMade = ({ id }) => {
type: t.PAYMENT_MADE_SET,
payload: {
id,
bill_payment: response.data.bill_payment,
paymentMade: response.data.bill_payment,
},
});
dispatch({
type: t.BILLS_PAYABLE_BY_PAYMENT_ID,
payload: {
billPaymentId: id,
bills: response.data.bill_payment.payable_bills,
},
});
dispatch({
type: t.BILLS_ITEMS_SET,
payload: {
bills: response.data.bill_payment.payable_bills,
},
});
resovle(response);
@@ -118,3 +131,17 @@ export const fetchPaymentMade = ({ id }) => {
});
});
};
export const fetchPaymentMadeBills = ({ paymentMadeId }) => (dispatch) => {
return new Promise((resolve, reject) => {
ApiService.get(`purchases/bill_payments/${paymentMadeId}/bills`).then((response) => {
dispatch({
type: t.BILLS_ITEMS_SET,
payload: {
bills: response.data.bills,
},
});
resolve(response);
}).catch((error) => { reject(error) });
});
}