Merge pull request '2141-print_reply_to' (#272) from 2141-print_reply_to into dev
gitea/salix/pipeline/head This commit looks good Details

Reviewed-by: Carlos Jimenez <carlosjr@verdnatura.es>
This commit is contained in:
Carlos Jimenez Ruiz 2020-05-27 07:10:27 +00:00
commit 98157fc45a
52 changed files with 168 additions and 178 deletions

View File

@ -2,11 +2,11 @@
module="claim"
description="$ctrl.claim.client.name">
<slot-menu>
<a class="vn-item"
ui-sref="ticket.create({clientFk: $ctrl.client.id})"
<vn-item
ng-click="$ctrl.showPickupOrder()"
translate>
Show Pickup order
</a>
</vn-item>
<vn-item
ng-click="confirmPickupOrder.show()"
translate>

View File

@ -12,7 +12,7 @@ class Controller extends Descriptor {
showPickupOrder() {
this.showReport('claim-pickup-order', {
clientId: this.claim.clientFk,
recipientId: this.claim.clientFk,
claimId: this.claim.id
});
}
@ -20,7 +20,7 @@ class Controller extends Descriptor {
sendPickupOrder() {
return this.sendEmail('claim-pickup-order', {
recipient: this.claim.client.email,
clientId: this.claim.clientFk,
recipientId: this.claim.clientFk,
claimId: this.claim.id
});
}

View File

@ -23,7 +23,7 @@ describe('Item Component vnClaimDescriptor', () => {
controller.showReport = jest.fn();
const params = {
clientId: claim.clientFk,
recipientId: claim.clientFk,
claimId: claim.id
};
controller.showPickupOrder();
@ -38,7 +38,7 @@ describe('Item Component vnClaimDescriptor', () => {
const params = {
recipient: claim.client.email,
clientId: claim.clientFk,
recipientId: claim.clientFk,
claimId: claim.id
};
controller.sendPickupOrder();

View File

@ -257,7 +257,7 @@ module.exports = Self => {
if (!instance.email) return;
const params = {
authorization: authorization,
clientId: instance.id,
recipientId: instance.id,
recipient: instance.email
};
await request.get(`${origin}/api/email/payment-update`, {

View File

@ -42,7 +42,7 @@ class Controller extends Descriptor {
onConsumerReportAccept() {
this.showReport('campaign-metrics', {
clientId: this.id,
recipientId: this.id,
from: this.from,
to: this.to,
});

View File

@ -61,7 +61,7 @@ class Controller extends Section {
send(isPreview, cb) {
const sampleType = this.$.sampleType.selection;
const params = {
clientId: this.$params.id,
recipientId: this.$params.id,
recipient: this.clientSample.recipient
};

View File

@ -68,7 +68,7 @@ describe('Client', () => {
code: 'MyReport'
};
controller.clientSample = {
clientId: 101
recipientId: 101
};
controller.send(false, () => {});
@ -81,7 +81,7 @@ describe('Client', () => {
controller.$.sampleType.selection = null;
controller.clientSample = {
clientId: 101,
recipientId: 101,
recipient: 'client@email.com'
};
@ -98,7 +98,7 @@ describe('Client', () => {
code: 'MyReport'
};
controller.clientSample = {
clientId: 101,
recipientId: 101,
recipient: 'client@email.com'
};
@ -113,11 +113,11 @@ describe('Client', () => {
code: 'MyReport'
};
controller.clientSample = {
clientId: 101,
recipientId: 101,
recipient: 'client@email.com'
};
const expectedParams = {
clientId: 101,
recipientId: 101,
recipient: 'client@email.com'
};
const serializedParams = $httpParamSerializer(expectedParams);
@ -133,12 +133,12 @@ describe('Client', () => {
code: 'MyReport'
};
controller.clientSample = {
clientId: 101,
recipientId: 101,
recipient: 'client@email.com',
companyFk: 442
};
const expectedParams = {
clientId: 101,
recipientId: 101,
recipient: 'client@email.com',
companyId: 442
};

View File

@ -37,7 +37,6 @@ class Controller extends Descriptor {
showEntryReport() {
this.showReport('entry-order', {
clientId: this.vnConfig.storage.currentUserWorkerId,
entryId: this.entry.id
});
}

View File

@ -12,19 +12,16 @@ class Controller extends Descriptor {
showRouteReport() {
this.showReport('driver-route', {
clientId: this.vnConfig.storage.currentUserWorkerId,
routeId: this.id
});
}
sendRouteReport() {
const params = {
recipient: user.emailUser.email,
clientId: this.vnConfig.storage.currentUserWorkerId,
const workerUser = this.route.worker.user;
this.sendEmail('driver-route', {
recipient: workerUser.emailUser.email,
routeId: this.id
};
return this.$http.get(`email/driver-route`, {params})
.then(() => this.vnApp.showSuccess(this.$t('Report sent')));
});
}
updateVolume() {

View File

@ -102,15 +102,15 @@ class Controller extends Descriptor {
showDeliveryNote() {
this.showReport('delivery-note', {
clientId: this.ticket.client.id,
recipientId: this.ticket.client.id,
ticketId: this.id,
});
}
sendDeliveryNote() {
return this.sendEmail('delivery-note', {
recipientId: this.ticket.client.id,
recipient: this.ticket.client.email,
clientId: this.ticket.client.id,
ticketId: this.id
});
}

View File

@ -87,17 +87,29 @@ class Component {
return component;
}
async render() {
component() {
if (this._component)
return this._component;
const component = this.build();
const i18n = new VueI18n(config.i18n);
const app = new Vue({
this._component = new Vue({
i18n: i18n,
render: h => h(component, {
props: this.args
})
});
return renderer.renderToString(app);
return this._component;
}
/**
* @return {Promise} Rendered component
*/
async render() {
return renderer.renderToString(
this.component()
);
}
}

View File

@ -15,9 +15,10 @@ module.exports = {
const props = this.args;
let query = '';
for (let param in props) {
if (query != '')
query += '&';
query += `${param}=${props[param]}`;
if (!(props[param] instanceof Object)) {
if (query != '') query += '&';
query += `${param}=${props[param]}`;
}
}
return query;

View File

@ -1,9 +1,8 @@
const path = require('path');
const smtp = require('./smtp');
const config = require('./config');
const Component = require('./component');
const Report = require('./report');
const db = require('./database');
const config = require('./config');
if (!process.env.OPENSSL_CONF)
process.env.OPENSSL_CONF = '/etc/ssl/';
@ -20,27 +19,22 @@ class Email extends Component {
}
async getSubject() {
if (!this.lang) await this.getLang();
const locale = this.locale.messages;
const userLocale = locale[this.lang];
const component = await this.component();
let locale = this.args.auth.locale;
if (!userLocale) {
if (this.args.recipientId)
locale = await component.getLocale(this.args.recipientId);
const messages = this.locale.messages;
const userTranslations = messages[locale];
if (!userTranslations) {
const fallbackLocale = config.i18n.fallbackLocale;
return locale[fallbackLocale].subject;
return messages[fallbackLocale].subject;
}
return userLocale.subject;
}
async getLang() {
const clientId = this.args.clientId;
const lang = await db.findOne(`
SELECT lang FROM account.user
WHERE id = ?`, [clientId]).then(rows => {
return rows.lang;
});
this.lang = lang;
return userTranslations.subject;
}
async send() {
@ -80,6 +74,7 @@ class Email extends Component {
const localeSubject = await this.getSubject();
const options = {
to: this.args.recipient,
replyTo: this.args.auth.email,
subject: localeSubject,
html: rendered,
attachments: attachments

View File

@ -19,8 +19,7 @@ const validator = {
throw new Error(`Required properties not found [${required}]`);
}
},
props: ['isPreview']
props: ['isPreview', 'authorization']
};
Vue.mixin(validator);

View File

@ -4,28 +4,27 @@ const config = require('../config');
const fallbackLocale = config.i18n.fallbackLocale;
const userLocale = {
async serverPrefetch() {
if (this.clientId)
this.locale = await this.getLocale(this.clientId);
if (this.auth)
this.$i18n.locale = this.auth.locale;
if (this.locale)
this.$i18n.locale = this.locale;
if (this.recipientId)
this.$i18n.locale = await this.getLocale(this.recipientId);
},
methods: {
getLocale(clientId) {
getLocale(recipientId) {
return db.findOne(`
SELECT IF(u.lang IS NOT NULL, u.lang, LOWER(ct.code)) lang
FROM client c
JOIN country ct ON ct.id = c.countryFk
JOIN account.user u ON u.id = c.id
WHERE c.id = ?`, [clientId]).then(rows => {
WHERE c.id = ?`, [recipientId]).then(rows => {
if (rows)
return rows.lang;
else return fallbackLocale;
});
}
},
props: ['clientId']
props: ['auth', 'recipientId']
};
Vue.mixin(userLocale);

View File

@ -17,17 +17,32 @@ module.exports = app => {
for (let method of methods)
paths.push(`/api/${method}/*`);
app.use(paths, async function(request, response, next) {
const authorization = getToken(request);
const query = `SELECT userId, ttl, created
FROM salix.AccessToken WHERE id = ?`;
app.use(paths, async function(req, res, next) {
const token = getToken(req);
const query = `SELECT at.id, at.userId, eu.email, u.lang, at.ttl, at.created
FROM salix.AccessToken at
JOIN account.user u ON u.id = at.userid
JOIN account.emailUser eu ON eu.userFk = u.id
WHERE at.id = ?`;
try {
const authToken = await db.findOne(query, [authorization]);
const auth = await db.findOne(query, [token]);
if (!authToken || isTokenExpired(authToken.created, authToken.ttl))
if (!auth || isTokenExpired(auth.created, auth.ttl))
throw new Error('Invalid authorization token');
const args = Object.assign({}, req.query);
const props = Object.assign(args, req.body);
props.authorization = auth.id;
req.args = props;
req.args.auth = {
userId: auth.userId,
token: auth.id,
email: auth.email,
locale: auth.lang
};
next();
} catch (error) {
next(error);
@ -36,12 +51,9 @@ module.exports = app => {
function getToken(request) {
const headers = request.headers;
const params = request.query;
const queryParams = request.query;
if (headers.authorization)
params.authorization = headers.authorization;
return headers.authorization || params.authorization;
return headers.authorization || queryParams.authorization;
}
function isTokenExpired(created, ttl) {

View File

@ -27,7 +27,7 @@ module.exports = {
await db.rawSql(`
INSERT INTO vn.mail (sender, replyTo, sent, subject, body, status)
VALUES (:recipient, :sender, 1, :subject, :body, :status)`, {
sender: config.app.senderEmail,
sender: options.replyTo,
recipient: options.to,
subject: options.subject,
body: options.text || options.html,

View File

@ -29,7 +29,7 @@ module.exports = app => {
const args = {
ticketId: ticket.id,
clientId: ticket.clientFk,
recipientId: ticket.clientFk,
recipient: ticket.recipient
};
const email = new Email('delivery-note-link', args);

View File

@ -2,19 +2,11 @@ const Email = require('../core/email');
module.exports = app => {
app.get(`/api/email/:name`, async(req, res, next) => {
const args = req.query;
const requiredArgs = ['clientId', 'recipient'];
const argList = requiredArgs.join(',');
const hasRequiredArgs = requiredArgs.every(arg => {
return args[arg];
});
try {
if (!hasRequiredArgs)
throw new Error(`Required properties not found [${argList}]`);
const reportName = req.params.name;
const email = new Email(reportName, req.args);
const email = new Email(req.params.name, args);
if (args.isPreview === 'true') {
if (req.args.isPreview === 'true') {
const rendered = await email.render();
res.send(rendered);

View File

@ -2,20 +2,10 @@ const Report = require('../core/report');
module.exports = app => {
app.get(`/api/report/:name`, async(req, res, next) => {
const args = req.query;
const requiredArgs = ['clientId'];
const argList = requiredArgs.join(',');
const hasRequiredArgs = requiredArgs.every(arg => {
return args[arg];
});
try {
if (!hasRequiredArgs)
throw new Error(`Required properties not found [${argList}]`);
const reportName = req.params.name;
const fileName = getFileName(reportName, args);
const report = new Report(reportName, args);
const fileName = getFileName(reportName, req.args);
const report = new Report(reportName, req.args);
const stream = await report.toPdfStream();
res.setHeader('Content-type', 'application/pdf');
@ -38,8 +28,7 @@ module.exports = app => {
const keys = Object.keys(args);
for (let arg of keys) {
// FIXME: #2197 - Remove clientId as a required param
if (arg != 'clientId' && arg.endsWith('Id'))
if (arg.endsWith('Id'))
identifiers.push(arg);
}

View File

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html v-bind:lang="locale">
<html v-bind:lang="$i18n.locale">
<head>
<meta name="viewport" content="width=device-width">
<meta name="format-detection" content="telephone=no">
@ -43,9 +43,9 @@
<tbody>
<tr v-for="waste in wastes" v-bind:key="waste.buyer">
<td class="font gray">{{waste.buyer}}</td>
<td class="number">{{(waste.percentage / 100) | percentage(2, 2, locale)}}</td>
<td class="number">{{waste.dwindle | currency('EUR', locale)}}</td>
<td class="number">{{waste.total | currency('EUR', locale)}}</td>
<td class="number">{{(waste.percentage / 100) | percentage(2, 2, $i18n.locale)}}</td>
<td class="number">{{waste.dwindle | currency('EUR', $i18n.locale)}}</td>
<td class="number">{{waste.total | currency('EUR', $i18n.locale)}}</td>
</tr>
</tbody>
</table>

View File

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html v-bind:lang="locale">
<html v-bind:lang="$i18n.locale">
<head>
<meta name="viewport" content="width=device-width">
<meta name="format-detection" content="telephone=no">

View File

@ -10,7 +10,7 @@ module.exports = {
'email-footer': emailFooter.build()
},
props: {
clientId: {
recipientId: {
required: true
},
from: {

View File

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html v-bind:lang="locale">
<html v-bind:lang="$i18n.locale">
<head>
<meta name="viewport" content="width=device-width">
<meta name="format-detection" content="telephone=no">

View File

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html v-bind:lang="locale">
<html v-bind:lang="$i18n.locale">
<head>
<meta name="viewport" content="width=device-width">
<meta name="format-detection" content="telephone=no">

View File

@ -6,7 +6,7 @@ const emailFooter = new Component('email-footer');
module.exports = {
name: 'client-welcome',
async serverPrefetch() {
this.client = await this.fetchClient(this.clientId);
this.client = await this.fetchClient(this.recipientId);
},
methods: {
fetchClient(clientId) {
@ -29,7 +29,7 @@ module.exports = {
'email-footer': emailFooter.build()
},
props: {
clientId: {
recipientId: {
required: true
}
}

View File

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html v-bind:lang="locale">
<html v-bind:lang="$i18n.locale">
<head>
<meta name="viewport" content="width=device-width">
<meta name="format-detection" content="telephone=no">

View File

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html v-bind:lang="locale">
<html v-bind:lang="$i18n.locale">
<head>
<meta name="viewport" content="width=device-width">
<meta name="format-detection" content="telephone=no">

View File

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html v-bind:lang="locale">
<html v-bind:lang="$i18n.locale">
<head>
<meta name="viewport" content="width=device-width">
<meta name="format-detection" content="telephone=no">

View File

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html v-bind:lang="locale">
<html v-bind:lang="$i18n.locale">
<head>
<meta name="viewport" content="width=device-width">
<meta name="format-detection" content="telephone=no">

View File

@ -8,7 +8,7 @@ const attachments = require('./attachments.json');
module.exports = {
name: 'letter-debtor-nd',
async serverPrefetch() {
this.debtor = await this.fetchDebtor(this.clientId, this.companyId);
this.debtor = await this.fetchDebtor(this.recipientId, this.companyId);
if (!this.debtor)
throw new Error('Something went wrong');
@ -40,7 +40,7 @@ module.exports = {
authorization: {
required: true
},
clientId: {
recipientId: {
required: true
},
companyId: {

View File

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html v-bind:lang="locale">
<html v-bind:lang="$i18n.locale">
<head>
<meta name="viewport" content="width=device-width">
<meta name="format-detection" content="telephone=no">
@ -23,7 +23,7 @@
<!-- Block -->
<div class="grid-row">
<div class="grid-block vn-pa-lg">
<h1>{{ $t('title') }}</h1>
<h1>{{ $t('title') }} {{$i18n.locale}}</h1>
<p>{{ $t('sections.introduction.title') }},</p>
<p>{{ $t('sections.introduction.description') }}</p>

View File

@ -8,7 +8,7 @@ const attachments = require('./attachments.json');
module.exports = {
name: 'letter-debtor-st',
async serverPrefetch() {
this.debtor = await this.fetchDebtor(this.clientId, this.companyId);
this.debtor = await this.fetchDebtor(this.recipientId, this.companyId);
if (!this.debtor)
throw new Error('Something went wrong');
@ -37,10 +37,7 @@ module.exports = {
'attachment': attachment.build()
},
props: {
authorization: {
required: true
},
clientId: {
recipientId: {
required: true
},
companyId: {

View File

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html v-bind:lang="locale">
<html v-bind:lang="$i18n.locale">
<head>
<meta name="viewport" content="width=device-width">
<meta name="format-detection" content="telephone=no">

View File

@ -6,7 +6,7 @@ const emailFooter = new Component('email-footer');
module.exports = {
name: 'payment-update',
async serverPrefetch() {
this.payMethod = await this.fetchPayMethod(this.clientId);
this.payMethod = await this.fetchPayMethod(this.recipientId);
if (!this.payMethod)
throw new Error('Something went wrong');
@ -34,7 +34,7 @@ module.exports = {
'email-footer': emailFooter.build()
},
props: {
clientId: {
recipientId: {
required: true
}
}

View File

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html v-bind:lang="locale">
<html v-bind:lang="$i18n.locale">
<head>
<meta name="viewport" content="width=device-width">
<meta name="format-detection" content="telephone=no">

View File

@ -8,7 +8,7 @@ const attachments = require('./attachments.json');
module.exports = {
name: 'printer-setup',
async serverPrefetch() {
this.client = await this.fetchClient(this.clientId);
this.client = await this.fetchClient(this.recipientId);
},
data() {
return {attachments};
@ -16,19 +16,19 @@ module.exports = {
methods: {
fetchClient(clientId) {
return db.findOne(`
SELECT
c.id,
u.lang locale,
u.name AS userName,
c.email recipient,
CONCAT(w.lastName, ' ', w.firstName) salesPersonName,
w.phone AS salesPersonPhone,
CONCAT(wu.name, '@verdnatura.es') AS salesPersonEmail
FROM client c
JOIN account.user u ON u.id = c.id
LEFT JOIN worker w ON w.id = c.salesPersonFk
LEFT JOIN account.user wu ON wu.id = w.userFk
WHERE c.id = ?`, [clientId]);
SELECT
c.id,
u.lang locale,
u.name AS userName,
c.email recipient,
CONCAT(w.lastName, ' ', w.firstName) salesPersonName,
w.phone AS salesPersonPhone,
CONCAT(wu.name, '@verdnatura.es') AS salesPersonEmail
FROM client c
JOIN account.user u ON u.id = c.id
LEFT JOIN worker w ON w.id = c.salesPersonFk
LEFT JOIN account.user wu ON wu.id = w.userFk
WHERE c.id = ?`, [clientId]);
}
},
components: {
@ -37,7 +37,7 @@ module.exports = {
'attachment': attachment.build()
},
props: {
clientId: {
recipientId: {
required: true
}
}

View File

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html v-bind:lang="locale">
<html v-bind:lang="$i18n.locale">
<head>
<meta name="viewport" content="width=device-width">
<meta name="format-detection" content="telephone=no">

View File

@ -15,7 +15,7 @@ module.exports = {
'attachment': attachment.build()
},
props: {
clientId: {
recipientId: {
required: true
},
companyId: {

View File

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html v-bind:lang="locale">
<html v-bind:lang="$i18n.locale">
<body>
<table class="grid">
<tbody>

View File

@ -9,9 +9,8 @@ module.exports = {
this.to = new Date(this.to);
this.from = new Date(this.from);
this.client = await this.fetchClient(this.clientId);
this.sales = await this.fetchSales(this.clientId, this.from, this.to);
this.client = await this.fetchClient(this.recipientId);
this.sales = await this.fetchSales(this.recipientId, this.from, this.to);
if (!this.client)
throw new Error('Something went wrong');
@ -63,7 +62,7 @@ module.exports = {
'report-footer': reportFooter.build()
},
props: {
clientId: {
recipientId: {
required: true
},
from: {

View File

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html v-bind:lang="locale">
<html v-bind:lang="$i18n.locale">
<body>
<table class="grid">
<tbody>

View File

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html v-bind:lang="locale">
<html v-bind:lang="$i18n.locale">
<body>
<table class="grid">
<tbody>
@ -88,10 +88,10 @@
<td>{{sale.itemFk}}</td>
<td class="number">{{sale.quantity}}</td>
<td width="50%">{{sale.concept}}</td>
<td class="number">{{sale.price | currency('EUR', locale)}}</td>
<td class="number">{{sale.price | currency('EUR', $i18n.locale)}}</td>
<td class="centered">{{(sale.discount / 100) | percentage}}</td>
<td class="centered">{{sale.vatType}}</td>
<td class="number">{{sale.price * sale.quantity * (1 - sale.discount / 100) | currency('EUR', locale)}}</td>
<td class="number">{{sale.price * sale.quantity * (1 - sale.discount / 100) | currency('EUR', $i18n.locale)}}</td>
</tr>
<tr class="description">
<td colspan="2" class="centered">
@ -125,7 +125,7 @@
<td colspan="6">
<span class="pull-right">{{$t('subtotal')}}</span>
</td>
<td class="number">{{getSubTotal() | currency('EUR', locale)}}</td>
<td class="number">{{getSubTotal() | currency('EUR', $i18n.locale)}}</td>
</tr>
</tfoot>
</table>
@ -149,13 +149,13 @@
<td>{{service.description}}</td>
<td class="number">{{service.quantity}}</td>
<td>{{service.taxDescription}}</td>
<td class="number">{{service.price | currency('EUR', locale)}}</td>
<td class="number">{{service.price | currency('EUR', $i18n.locale)}}</td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="3"></td>
<td class="number">{{$t('total')}} {{serviceTotal | currency('EUR', locale)}}</td>
<td class="number">{{$t('total')}} {{serviceTotal | currency('EUR', $i18n.locale)}}</td>
</tr>
</tfoot>
</table>
@ -180,24 +180,24 @@
<tr v-for="tax in taxes">
<td width="45%">{{tax.name}}</td>
<td width="20%" class="number">
{{tax.Base | currency('EUR', locale)}}
{{tax.Base | currency('EUR', $i18n.locale)}}
</td>
<td>{{tax.vatPercent | percentage}}</td>
<td class="number">{{tax.tax | currency('EUR', locale)}}</td>
<td class="number">{{tax.tax | currency('EUR', $i18n.locale)}}</td>
</tr>
</tbody>
<tfoot>
<tr class="font bold">
<td width="45%">{{$t('subtotal')}}</td>
<td width="20%" class="number">
{{getTotalBase() | currency('EUR', locale)}}
{{getTotalBase() | currency('EUR', $i18n.locale)}}
</td>
<td></td>
<td class="number">{{getTotalTax()| currency('EUR', locale)}}</td>
<td class="number">{{getTotalTax()| currency('EUR', $i18n.locale)}}</td>
</tr>
<tr class="font bold">
<td colspan="2">{{$t('total')}}</td>
<td colspan="2" class="number">{{getTotal() | currency('EUR', locale)}}</td>
<td colspan="2" class="number">{{getTotal() | currency('EUR', $i18n.locale)}}</td>
</tr>
</tfoot>
</table>

View File

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html v-bind:lang="locale">
<html v-bind:lang="$i18n.locale">
<body>
<table class="grid">
<tbody>
@ -141,7 +141,7 @@
</tr>
<tr>
<th class="font gray align-right">{{$t('import')}}</th>
<td>{{ticket.import | currency('EUR', locale)}}</td>
<td>{{ticket.import | currency('EUR', $i18n.locale)}}</td>
</tr>
</tbody>
</table>

View File

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html v-bind:lang="locale">
<html v-bind:lang="$i18n.locale">
<body>
<table class="grid">
<tbody>
@ -77,8 +77,8 @@
<td class="number">{{buy.packing}}</td>
<td width="50%">{{buy.itemName}}</td>
<td width="10%" class="number">{{buy.quantity | number}}</td>
<td width="15%" class="number">{{buy.buyingValue | currency('EUR', locale)}}</td>
<td width="15%" class="number">{{buy.buyingValue * buy.quantity | currency('EUR', locale)}}</td>
<td width="15%" class="number">{{buy.buyingValue | currency('EUR', $i18n.locale)}}</td>
<td width="15%" class="number">{{buy.buyingValue * buy.quantity | currency('EUR', $i18n.locale)}}</td>
</tr>
<tr class="description">
<td colspan="2">
@ -106,7 +106,7 @@
<td colspan="5">
<span class="pull-right">{{$t('total')}}</span>
</td>
<td class="number">{{getTotal() | currency('EUR', locale)}}</td>
<td class="number">{{getTotal() | currency('EUR', $i18n.locale)}}</td>
</tr>
</tfoot>
</table>

View File

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html v-bind:lang="locale">
<html v-bind:lang="$i18n.locale">
<body>
<table class="grid">
<tbody>

View File

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html v-bind:lang="locale">
<html v-bind:lang="$i18n.locale">
<body>
<table class="grid">
<tbody>

View File

@ -6,8 +6,8 @@ const reportFooter = new Component('report-footer');
module.exports = {
name: 'letter-debtor',
async serverPrefetch() {
this.client = await this.fetchClient(this.clientId);
this.sales = await this.fetchSales(this.clientId, this.companyId);
this.client = await this.fetchClient(this.recipientId);
this.sales = await this.fetchSales(this.recipientId, this.companyId);
if (!this.client)
throw new Error('Something went wrong');
@ -79,7 +79,7 @@ module.exports = {
'report-footer': reportFooter.build()
},
props: {
clientId: {
recipientId: {
required: true
},
companyId: {

View File

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html v-bind:lang="locale">
<html v-bind:lang="$i18n.locale">
<body>
<table class="grid">
<tbody>

View File

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html v-bind:lang="locale">
<html v-bind:lang="$i18n.locale">
<body>
<table class="grid">
<tbody>

View File

@ -6,8 +6,8 @@ const reportFooter = new Component('report-footer');
const rptSepaCore = {
name: 'sepa-core',
async serverPrefetch() {
this.client = await this.fetchClient(this.clientId, this.companyId);
this.supplier = await this.fetchSupplier(this.clientId, this.companyId);
this.client = await this.fetchClient(this.recipientId, this.companyId);
this.supplier = await this.fetchSupplier(this.recipientId, this.companyId);
if (!this.client)
throw new Error('Something went wrong');
@ -67,7 +67,7 @@ const rptSepaCore = {
'report-footer': reportFooter.build()
},
props: {
clientId: {
recipientId: {
required: true
},
companyId: {
@ -76,5 +76,4 @@ const rptSepaCore = {
}
};
module.exports = rptSepaCore;

View File

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html v-bind:lang="locale">
<html v-bind:lang="$i18n.locale">
<body>
<table class="grid">
<tbody>