mirror of
https://github.com/mokuappio/serverless-invoices.git
synced 2025-10-27 16:01:07 -04:00
Init commit
This commit is contained in:
51
src/store/models/invoice.js
Normal file
51
src/store/models/invoice.js
Normal file
@ -0,0 +1,51 @@
|
||||
import { Model } from '@vuex-orm/core';
|
||||
import { uuidv4 } from '@/utils/helpers';
|
||||
import Client from '@/store/models/client';
|
||||
import InvoiceRow from '@/store/models/invoice-row';
|
||||
|
||||
export default class Invoice extends Model {
|
||||
// This is the name used as module name of the Vuex Store.
|
||||
static entity = 'invoices';
|
||||
|
||||
static fields() {
|
||||
return {
|
||||
id: this.attr(() => uuidv4()),
|
||||
number: this.attr(''),
|
||||
status: this.attr('draft'),
|
||||
issued_at: this.attr(''),
|
||||
due_at: this.attr(''),
|
||||
late_fee: this.attr(''),
|
||||
vat_rate: this.attr(''),
|
||||
currency: this.attr(''),
|
||||
from_name: this.attr(''),
|
||||
from_address: this.attr(''),
|
||||
from_postal_code: this.attr(''),
|
||||
from_city: this.attr(''),
|
||||
from_country: this.attr(''),
|
||||
from_county: this.attr(''),
|
||||
from_reg_no: this.attr(''),
|
||||
from_vat_no: this.attr(''),
|
||||
from_website: this.attr(''),
|
||||
from_email: this.attr(''),
|
||||
from_phone: this.attr(''),
|
||||
bank_name: this.attr(''),
|
||||
bank_account_no: this.attr(''),
|
||||
client_name: this.attr(''),
|
||||
client_address: this.attr(''),
|
||||
client_postal_code: this.attr(''),
|
||||
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'),
|
||||
rows: this.hasMany(InvoiceRow, 'invoice_id'),
|
||||
notes: this.attr(''),
|
||||
updated_at: this.attr(''),
|
||||
created_at: this.attr(''),
|
||||
total: this.attr(null), // Only used in lists.
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user