Merge remote-tracking branch 'origin/main'

This commit is contained in:
Marek Fraczyk
2021-04-23 14:52:34 +03:00
3 changed files with 48 additions and 20 deletions

BIN
public/img/cover.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

View File

@ -7,6 +7,18 @@
<link rel="icon" href="<%= BASE_URL %>img/icons/favicon.ico"> <link rel="icon" href="<%= BASE_URL %>img/icons/favicon.ico">
<title>Serverless Invoices</title> <title>Serverless Invoices</title>
<meta property="og:type" content="website">
<meta property="og:url" content="<%= BASE_URL %>">
<meta property="og:title" content="Serverless Invoices - Free Invoice Generator - No signup required">
<meta property="og:image:url" content="<%= BASE_URL %>img/cover.png">
<meta property="og:image:secure_url" content="<%= BASE_URL %>img/cover.png">
<meta property="og:image:type" content="image/png">
<meta property="og:image:width" content="1200">
<meta property="og:image:height" content="630">
<meta property="og:description" content="Create and manage invoices in your browser. Serverless Invoices is a free open-source invoicing tool for freelancers and small businesses.">
<meta name="title" content="Serverless Invoices - Free Invoice Generator - No signup required">
<meta name="description" content="Create and manage invoices in your browser. Serverless Invoices is a free open-source invoicing tool for freelancers and small businesses.">
<!-- Google Material Icons --> <!-- Google Material Icons -->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons|Material+Icons+Round" rel="stylesheet"> <link href="https://fonts.googleapis.com/icon?family=Material+Icons|Material+Icons+Round" rel="stylesheet">

View File

@ -53,6 +53,9 @@ export default {
async createNewInvoice({ dispatch }) { async createNewInvoice({ dispatch }) {
const invoice = await Invoice.createNew(); const invoice = await Invoice.createNew();
await InvoiceService.createInvoice(invoice); await InvoiceService.createInvoice(invoice);
await dispatch('prefillInvoice', {
invoiceId: invoice.id,
});
await dispatch('prefillTeam', { await dispatch('prefillTeam', {
invoiceId: invoice.id, invoiceId: invoice.id,
}); });
@ -167,7 +170,26 @@ export default {
}, },
}); });
}, },
prefillTeam({ dispatch, getters, rootGetters }, payload) { prefillInvoice({ dispatch, getters, rootGetters }, payload) {
const team = rootGetters['teams/team'];
const props = {
issued_at: dayjs()
.format('YYYY-MM-DD'),
due_at: dayjs()
.add(team.invoice_due_days || 14, 'days')
.format('YYYY-MM-DD'),
number: generateInvoiceNumber(getters.all),
late_fee: team.invoice_late_fee || 0.5,
currency: team.currency || 'USD',
};
return dispatch('updateInvoice', {
invoiceId: payload.invoiceId,
props,
});
},
prefillTeam({ dispatch, rootGetters }, payload) {
const team = rootGetters['teams/team']; const team = rootGetters['teams/team'];
dispatch('invoiceTeamFields/removeInvoiceTeamFields', payload.invoiceId, { root: true }); dispatch('invoiceTeamFields/removeInvoiceTeamFields', payload.invoiceId, { root: true });
@ -182,27 +204,21 @@ export default {
}, { root: true }); }, { root: true });
}); });
const props = {
from_name: team.company_name,
from_address: team.company_address,
from_postal_code: team.company_postal_code,
from_city: team.company_city,
from_country: team.company_country,
from_county: team.company_county,
from_website: team.website,
from_email: team.contact_email,
from_phone: team.contact_phone,
};
return dispatch('updateInvoice', { return dispatch('updateInvoice', {
invoiceId: payload.invoiceId, invoiceId: payload.invoiceId,
props: { props,
issued_at: dayjs()
.format('YYYY-MM-DD'),
due_at: dayjs()
.add(team.invoice_due_days || 14, 'days')
.format('YYYY-MM-DD'),
number: generateInvoiceNumber(getters.all),
late_fee: team.invoice_late_fee || 0.5,
from_name: team.company_name,
from_address: team.company_address,
from_postal_code: team.company_postal_code,
from_city: team.company_city,
from_country: team.company_country,
from_county: team.company_county,
from_website: team.website,
from_email: team.contact_email,
from_phone: team.contact_phone,
currency: team.currency || 'USD',
},
}); });
}, },
}, },