feat: customer form styling.

feat: customers list.
This commit is contained in:
Ahmed Bouhuolia
2020-11-08 21:44:20 +02:00
parent 982420c8e5
commit 9241f8b8a5
17 changed files with 305 additions and 282 deletions

View File

@@ -17,17 +17,21 @@ export default class ContactsController extends BaseController {
check('work_phone').optional().trim().escape(),
check('personal_phone').optional().trim().escape(),
check('billing_address_1').optional().trim().escape(),
check('billing_address_2').optional().trim().escape(),
check('billing_address_city').optional().trim().escape(),
check('billing_address_country').optional().trim().escape(),
check('billing_address_email').optional().isEmail().trim().escape(),
check('billing_address_zipcode').optional().trim().escape(),
check('billing_address_postcode').optional().trim().escape(),
check('billing_address_phone').optional().trim().escape(),
check('billing_address_state').optional().trim().escape(),
check('shipping_address_1').optional().trim().escape(),
check('shipping_address_2').optional().trim().escape(),
check('shipping_address_city').optional().trim().escape(),
check('shipping_address_country').optional().trim().escape(),
check('shipping_address_email').optional().isEmail().trim().escape(),
check('shipping_address_zip_code').optional().trim().escape(),
check('shipping_address_postcode').optional().trim().escape(),
check('shipping_address_phone').optional().trim().escape(),
check('shipping_address_state').optional().trim().escape(),

View File

@@ -26,6 +26,7 @@ export default class CustomersController extends ContactsController {
...this.contactDTOSchema,
...this.contactNewDTOSchema,
...this.customerDTOSchema,
...this.createCustomerDTOSchema,
],
this.validationResult,
asyncMiddleware(this.newCustomer.bind(this)),
@@ -77,10 +78,24 @@ export default class CustomersController extends ContactsController {
get customerDTOSchema() {
return [
check('customer_type').exists().trim().escape(),
check('opening_balance').optional().isNumeric().toInt(),
];
}
/**
* Create customer DTO schema.
*/
get createCustomerDTOSchema() {
return [
check('opening_balance').optional().isNumeric().toInt(),
check('opening_balance_at').optional().isISO8601(),
check('currency_code').optional().trim().escape(),
];
}
/**
* List param query schema.
*/
get validateListQuerySchema() {
return [
query('column_sort_by').optional().trim().escape(),