mirror of
https://github.com/mokuappio/serverless-invoices.git
synced 2025-11-02 17:53:17 -05:00
Init commit
This commit is contained in:
17
src/store/models/bank-account.js
Normal file
17
src/store/models/bank-account.js
Normal file
@ -0,0 +1,17 @@
|
||||
import { Model } from '@vuex-orm/core';
|
||||
import { uuidv4 } from '@/utils/helpers';
|
||||
|
||||
export default class BankAccount extends Model {
|
||||
// This is the name used as module name of the Vuex Store.
|
||||
static entity = 'bank_accounts';
|
||||
|
||||
static fields() {
|
||||
return {
|
||||
id: this.attr(() => uuidv4()),
|
||||
account_no: this.attr(''),
|
||||
bank_name: this.attr(''),
|
||||
updated_at: this.attr(''),
|
||||
created_at: this.attr(''),
|
||||
};
|
||||
}
|
||||
}
|
||||
30
src/store/models/client.js
Normal file
30
src/store/models/client.js
Normal file
@ -0,0 +1,30 @@
|
||||
import { Model } from '@vuex-orm/core';
|
||||
import { uuidv4 } from '@/utils/helpers';
|
||||
import BankAccount from '@/store/models/bank-account';
|
||||
|
||||
export default class Client extends Model {
|
||||
// This is the name used as module name of the Vuex Store.
|
||||
static entity = 'clients';
|
||||
|
||||
static fields() {
|
||||
return {
|
||||
id: this.attr(() => uuidv4()),
|
||||
company_name: this.attr(''),
|
||||
company_address: this.attr(''),
|
||||
company_postal_code: this.attr(''),
|
||||
company_country: this.attr(''),
|
||||
company_county: this.attr(''),
|
||||
company_city: this.attr(''),
|
||||
company_reg_no: this.attr(''),
|
||||
company_vat_no: this.attr(''),
|
||||
has_vat: this.attr(null),
|
||||
currency: this.attr(null),
|
||||
rate: this.attr(null),
|
||||
invoice_email: this.attr(''),
|
||||
bank_account_id: this.attr(null),
|
||||
bank_account: this.belongsTo(BankAccount, 'bank_account_id', 'id'),
|
||||
updated_at: this.attr(''),
|
||||
created_at: this.attr(''),
|
||||
};
|
||||
}
|
||||
}
|
||||
23
src/store/models/invoice-row.js
Normal file
23
src/store/models/invoice-row.js
Normal file
@ -0,0 +1,23 @@
|
||||
import { Model } from '@vuex-orm/core';
|
||||
import { uuidv4 } from '@/utils/helpers';
|
||||
import Invoice from '@/store/models/invoice';
|
||||
|
||||
export default class InvoiceRow extends Model {
|
||||
// This is the name used as module name of the Vuex Store.
|
||||
static entity = 'invoice_rows';
|
||||
|
||||
static fields() {
|
||||
return {
|
||||
id: this.attr(() => uuidv4()),
|
||||
invoice_id: this.attr(null),
|
||||
invoice: this.belongsTo(Invoice, 'invoice_id'),
|
||||
item: this.attr(''),
|
||||
quantity: this.attr(null),
|
||||
price: this.attr(null),
|
||||
unit: this.attr(''),
|
||||
order: this.attr(null),
|
||||
updated_at: this.attr(''),
|
||||
created_at: this.attr(''),
|
||||
};
|
||||
}
|
||||
}
|
||||
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.
|
||||
};
|
||||
}
|
||||
}
|
||||
30
src/store/models/team.js
Normal file
30
src/store/models/team.js
Normal file
@ -0,0 +1,30 @@
|
||||
import { Model } from '@vuex-orm/core';
|
||||
import { uuidv4 } from '@/utils/helpers';
|
||||
|
||||
export default class Team extends Model {
|
||||
// This is the name used as module name of the Vuex Store.
|
||||
static entity = 'teams';
|
||||
|
||||
static fields() {
|
||||
return {
|
||||
id: this.attr(() => uuidv4()),
|
||||
company_name: this.attr(''),
|
||||
company_address: this.attr(''),
|
||||
company_postal_code: this.attr(''),
|
||||
company_country: this.attr(''),
|
||||
company_county: this.attr(''),
|
||||
company_city: this.attr(''),
|
||||
company_reg_no: this.attr(''),
|
||||
company_vat_no: this.attr(''),
|
||||
website: this.attr(''),
|
||||
contact_email: this.attr(''),
|
||||
contact_phone: this.attr(''),
|
||||
vat_rate: this.attr(null),
|
||||
invoice_late_fee: this.attr(null),
|
||||
invoice_due_days: this.attr(null),
|
||||
updated_at: this.attr(''),
|
||||
created_at: this.attr(''),
|
||||
logo_url: this.attr(''),
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user