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:
HenriT
2021-04-08 19:54:45 +03:00
parent af22213b9b
commit 292fafe3a5
20 changed files with 465 additions and 138 deletions

View File

@ -2,6 +2,7 @@ import { Model } from '@vuex-orm/core';
import { uuidv4 } from '@/utils/helpers';
import Client from '@/store/models/client';
import InvoiceRow from '@/store/models/invoice-row';
import InvoiceClientField from '@/store/models/invoice-client-field';
export default class Invoice extends Model {
// This is the name used as module name of the Vuex Store.
@ -36,8 +37,6 @@ export default class Invoice extends Model {
client_country: this.attr(''),
client_county: this.attr(''),
client_city: this.attr(''),
client_reg_no: this.attr(''),
client_vat_no: this.attr(''),
client_email: this.attr(''),
client_id: this.attr(null),
client: this.belongsTo(Client, 'client_id'),
@ -46,6 +45,7 @@ export default class Invoice extends Model {
updated_at: this.attr(''),
created_at: this.attr(''),
total: this.attr(null), // Only used in lists.
client_fields: this.hasMany(InvoiceClientField, 'invoice_id'),
};
}