mirror of
https://github.com/mokuappio/serverless-invoices.git
synced 2025-10-28 00:11:08 -04:00
Separated client form into tabs. Fixed deleting client. Implemented custom fields for client and invoice client fields. Removed "hardcoded" client_reg_no and client_vat_no fields from client and invoice model - can be replaced with custom fields. Abstracted invoice-rows management to separate store namespace. Invoice client fields are prefilled from selected client.
This commit is contained in:
34
src/store/invoice-client-fields.js
Normal file
34
src/store/invoice-client-fields.js
Normal file
@ -0,0 +1,34 @@
|
||||
import InvoiceClientField from '@/store/models/invoice-client-field';
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {},
|
||||
mutations: {},
|
||||
actions: {
|
||||
init() {},
|
||||
terminate() {},
|
||||
invoiceClientFieldProps(store, payload) {
|
||||
return InvoiceClientField.update({
|
||||
where: payload.fieldId,
|
||||
data: payload.props,
|
||||
});
|
||||
},
|
||||
async updateInvoiceClientField({ dispatch }, payload) {
|
||||
await dispatch('invoiceClientFieldProps', payload);
|
||||
return dispatch('invoices/updateInvoice', null, { root: true });
|
||||
},
|
||||
async removeInvoiceClientFields(store, invoiceId) {
|
||||
return InvoiceClientField.delete(field => field.invoice_id === invoiceId);
|
||||
},
|
||||
async addInvoiceClientField(store, payload) {
|
||||
const field = await InvoiceClientField.createNew();
|
||||
await field.$update({
|
||||
...payload.props,
|
||||
invoice_id: payload.invoiceId,
|
||||
});
|
||||
},
|
||||
async removeInvoiceClientField(store, fieldId) {
|
||||
await InvoiceClientField.delete(fieldId);
|
||||
},
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user