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

@@ -151,7 +151,8 @@ export default class BillsController extends BaseController {
get dueBillsListingValidationSchema() {
return [
query('vendor_id').optional().trim().escape(),
]
query('payment_made_id').optional().trim().escape(),
];
}
/**
@@ -331,7 +332,13 @@ export default class BillsController extends BaseController {
errors: [{ type: 'BILL_ENTRIES_IDS_NOT_FOUND', code: 900 }],
});
}
if (error.errorType === 'ITEMS_NOT_FOUND') {
return res.boom.badRequest(null, {
errors: [{ type: 'ITEMS_NOT_FOUND', code: 1000 }],
});
}
}
console.log(error.errorType);
next(error);
}
}

View File

@@ -198,8 +198,14 @@ export default class BillsPayments extends BaseController {
const { id: billPaymentId } = req.params;
try {
const billPayment = await this.billPaymentService.getBillPayment(tenantId, billPaymentId);
return res.status(200).send({ bill_payment: billPayment });
const { billPayment, payableBills } = await this.billPaymentService.getBillPayment(tenantId, billPaymentId);
return res.status(200).send({
bill_payment: {
...this.transfromToResponse({ ...billPayment }),
payable_bills: payableBills,
},
});
} catch (error) {
next(error);
}