fixed print translations bug

This commit is contained in:
Joan Sanchez 2019-02-05 07:58:05 +01:00
parent d463130515
commit 333d853335
32 changed files with 259 additions and 71 deletions

View File

@ -6,8 +6,8 @@
{"type": "email", "name": "letter-debtor-nd"},
{"type": "email", "name": "claim-pickup-order"},
{"type": "email", "name": "sepa-core"},
{"type": "report", "name": "delivery-note"},
{"type": "report", "name": "invoice"},
{"type": "report", "name": "rpt-delivery-note"},
{"type": "report", "name": "rpt-invoice"},
{"type": "report", "name": "rpt-claim-pickup-order"},
{"type": "report", "name": "rpt-letter-debtor"},
{"type": "report", "name": "rpt-sepa-core"},

View File

@ -26,7 +26,7 @@
<p>{{$t('sections.howToBuy.stock')}}</p>
<p>{{$t('sections.howToBuy.delivery')}}</p> -->
</section>
<email-footer></email-footer>
<email-footer :locale="locale"></email-footer>
</section>
</body>
</html>

View File

@ -30,7 +30,8 @@ module.exports = {
});
},
created() {
this.$i18n.locale = this.locale;
if (this.locale)
this.$i18n.locale = this.locale;
},
methods: {
fetchClient(claimFk) {

View File

@ -62,7 +62,7 @@
</section>
</p>
</section>
<email-footer></email-footer>
<email-footer :locale="locale"></email-footer>
</section>
</body>
</html>

View File

@ -19,7 +19,8 @@ module.exports = {
});
},
created() {
this.$i18n.locale = this.locale;
if (this.locale)
this.$i18n.locale = this.locale;
},
methods: {
fetchClient(clientFk) {

View File

@ -1,3 +0,0 @@
.blue {
color: blue
}

View File

@ -1,4 +0,0 @@
<div>
<span class="red">{{$t('clientId')}}: {{ id1 }} {{ id2 }}</span>
<span class="blue">heey</span>
</div>

View File

@ -1,35 +0,0 @@
const database = require(`${appPath}/lib/database`);
const UserException = require(`${appPath}/lib/exceptions/userException`);
module.exports = {
name: 'delivery-note',
async asyncData(ctx, params) {
const promises = [];
const dataIndex = promises.push(this.methods.fetchData()) - 1;
const itemsIndex = promises.push(this.methods.fetchItems()) - 1;
return Promise.all(promises).then(result => {
const [[data]] = result[dataIndex];
const [[items]] = result[itemsIndex];
return {
id1: data.id,
id2: items.id,
};
});
},
data() {
return {
id: null,
};
},
methods: {
fetchData() {
return database.pool.query('SELECT 1 AS id');
},
fetchItems() {
return database.pool.query('SELECT 2 AS id');
},
},
};

View File

@ -1,8 +0,0 @@
module.exports = {
messages: {
es: {
clientId: 'Id cliente',
},
},
}
;

View File

@ -6,6 +6,9 @@ module.exports = {
};
},
created() {
if (this.locale)
this.$i18n.locale = this.locale;
const embeded = [];
this.files.map(file => {
const src = this.isPreview ? `/api/${file}` : `cid:${file}`;
@ -27,4 +30,5 @@ module.exports = {
],
};
},
props: ['locale']
};

View File

@ -19,5 +19,24 @@ module.exports = {
escrito al domicilio social de la entidad. La finalidad del fichero es la gestión administrativa, contabilidad, y facturación.`,
},
},
/* fr: {
buttons: {
webAcccess: 'Visitez notre site web',
info: 'Ayúdanos a mejorar',
},
privacy: {
fiscalAddress: 'VERDNATURA LEVANTE SL, B97367486 Avda. Espioca, 100, 46460 Silla · www.verdnatura.es · clientes@verdnatura.es',
disclaimer: `- AVISO - Ce message est privé et confidentiel et doit être utilisé.
exclusivamente por la persona destinataria del mismo. Si has recibido este mensaje
por error, te rogamos lo comuniques al remitente y borres dicho mensaje y cualquier documento
adjunto que pudiera contener. Verdnatura Levante SL no renuncia a la confidencialidad ni a
ningún privilegio por causa de transmisión errónea o mal funcionamiento. Igualmente no se hace
responsable de los cambios, alteraciones, errores u omisiones que pudieran hacerse al mensaje una vez enviado.`,
law: `En cumplimiento de lo dispuesto en la Ley Orgánica 15/1999, de Protección de Datos de Carácter Personal,
te comunicamos que los datos personales que facilites se incluirán en ficheros automatizados de VERDNATURA LEVANTE S.L.,
pudiendo en todo momento ejercitar los derechos de acceso, rectificación, cancelación y oposición, comunicándolo por
escrito al domicilio social de la entidad. La finalidad del fichero es la gestión administrativa, contabilidad, y facturación.`,
},
}, */
},
};

View File

@ -52,7 +52,7 @@
</p>
</section>
<!-- Footer component -->
<email-footer></email-footer>
<email-footer :locale="locale"></email-footer>
<!-- End footer component -->
</section>
</body>

View File

@ -30,7 +30,8 @@ module.exports = {
});
},
created() {
this.$i18n.locale = this.locale;
if (this.locale)
this.$i18n.locale = this.locale;
},
methods: {
fetchClient(clientFk, companyFk) {

View File

@ -35,7 +35,7 @@
</p>
</section>
<!-- Footer component -->
<email-footer></email-footer>
<email-footer :locale="locale"></email-footer>
<!-- End footer component -->
</section>
</body>

View File

@ -31,7 +31,8 @@ module.exports = {
});
},
created() {
this.$i18n.locale = this.locale;
if (this.locale)
this.$i18n.locale = this.locale;
},
methods: {
fetchClient(clientFk, companyFk) {

View File

@ -38,7 +38,7 @@
<p>{{ $t('notifyAnError') }}</p>
</section>
<!-- Footer component -->
<email-footer></email-footer>
<email-footer :locale="locale"></email-footer>
<!-- End footer component -->
</section>
</body>

View File

@ -21,7 +21,8 @@ module.exports = {
});
},
created() {
this.$i18n.locale = this.locale;
if (this.locale)
this.$i18n.locale = this.locale;
},
methods: {
fetchClient(clientFk) {

View File

@ -49,7 +49,7 @@
</p>
</section>
<!-- Footer component -->
<email-footer></email-footer>
<email-footer :locale="locale"></email-footer>
<!-- End footer component -->
</section>
</body>

View File

@ -19,7 +19,8 @@ module.exports = {
});
},
created() {
this.$i18n.locale = this.locale;
if (this.locale)
this.$i18n.locale = this.locale;
},
data() {
return {

View File

@ -1,4 +1,8 @@
module.exports = {
name: 'report-footer',
props: ['leftText', 'centerText']
created() {
if (this.locale)
this.$i18n.locale = this.locale;
},
props: ['leftText', 'centerText', 'locale']
};

View File

@ -1,6 +1,9 @@
module.exports = {
name: 'report-header',
created() {
if (this.locale)
this.$i18n.locale = this.locale;
const embeded = [];
this.files.map(file => {
embeded[file] = `file://${__dirname + file}`;
@ -12,4 +15,5 @@ module.exports = {
files: ['/assets/images/report-logo.svg'],
};
},
props: ['locale']
};

View File

@ -75,7 +75,8 @@
<report-footer id="pageFooter"
:left-text="$t('claim', [claimId])"
:center-text="clientName">
:center-text="clientName"
:locale="locale">
</report-footer>
</section>
</body>

View File

@ -27,7 +27,8 @@ module.exports = {
});
},
created() {
this.$i18n.locale = this.locale;
if (this.locale)
this.$i18n.locale = this.locale;
},
methods: {
dated: () => {

View File

@ -0,0 +1,7 @@
const CssReader = require(`${appPath}/lib/cssReader`);
module.exports = new CssReader([
`${appPath}/common/css/layout.css`,
`${appPath}/common/css/misc.css`,
`${__dirname}/style.css`])
.mergeStyles();

View File

@ -0,0 +1,14 @@
.container {
color: #000
}
.title {
font-weight: 100;
margin-top: 0;
margin-bottom: 20px;
font-size: 2em
}
table.column-oriented {
margin-top: 50px !important
}

View File

@ -0,0 +1,86 @@
<!DOCTYPE html>
<html lang="es">
<body>
<section class="container">
<report-header></report-header>
<section class="main">
<section class="columns">
<section class="size50">
<section class="size75">
<h1 class="title uppercase">{{$t('title')}}</h1>
<table class="row-oriented">
<tbody>
<tr>
<td class="font gray uppercase">{{$t('clientId')}}</td>
<th>{{clientId}}</th>
</tr>
<tr>
<td class="font gray uppercase">{{$t('ticketId')}}</td>
<th>{{ticketId}}</th>
</tr>
<tr>
<td class="font gray uppercase">{{$t('date')}}</td>
<th>{{dated()}}</th>
</tr>
</tbody>
</table>
</section>
</section>
<section class="size50">
<section class="panel">
<section class="header">{{$t('clientData')}}</section>
<section class="body">
<h3 class="uppercase">{{clientName}}</h3>
<section>
{{street}}
</section>
<section>
{{postcode}}, {{city}} ({{province}})
</section>
<section>
{{country}}
</section>
</section>
</section>
</section>
</section>
<table class="column-oriented">
<thead>
<tr>
<th>{{$t('date')}}</th>
<th>{{$t('concept')}}</th>
<th class="number">{{$t('invoiced')}}</th>
<th class="number">{{$t('payed')}}</th>
<th class="number">{{$t('balance')}}</th>
</tr>
</thead>
<tbody>
<tr v-for="sale in sales" :key="sale.id">
<td>{{toISOString(sale.issued)}}</td>
<td>{{sale.ref}}</td>
<td class="number">{{sale.debtOut}}</td>
<td class="number">{{sale.debtIn}}</td>
<td class="number">{{a}}</td>
</tr>
</tbody>
<tfoot>
<!-- <tr>
<td></td>
<td></td>
<td class="number"><strong class="pull-left">Total</strong> {{getTotalDebtOut()}}</td>
<td class="number">{{getTotalDebtIn()}}</td>
<td class="number">{{totalBalance}}</td>
</tr> -->
</tfoot>
</table>
</section>
<report-footer id="pageFooter"
:left-text="$t('ticket', [clientId])"
:center-text="clientName"
:locale="locale">
</report-footer>
</section>
</body>
</html>

View File

@ -0,0 +1,72 @@
const strftime = require('strftime');
const database = require(`${appPath}/lib/database`);
const UserException = require(`${appPath}/lib/exceptions/userException`);
module.exports = {
name: 'rpt-delivery-note',
async asyncData(ctx, params) {
const promises = [];
const data = {};
if (!params.ticketFk)
throw new UserException('No ticket id specified');
promises.push(this.methods.fetchClient(params.ticketFk));
// promises.push(this.methods.fetchSales(params.ticketFk));
return Promise.all(promises).then(result => {
const [[client]] = result[0];
// const [[sales]] = result[1];
if (!client)
throw new UserException('No client data found');
Object.assign(data, client);
return data;
});
},
created() {
if (this.locale)
this.$i18n.locale = this.locale;
},
data() {
return {totalBalance: 0.00};
},
methods: {
fetchClient(ticketFk) {
return database.pool.query(
`SELECT
c.id clientId,
u.lang locale,
c.email AS recipient,
c.socialName AS clientName,
c.street,
c.postcode,
c.city,
c.fi,
p.name AS province,
ct.country
FROM ticket t
JOIN client c ON c.id = t.clientFk
JOIN account.user u ON u.id = c.id
JOIN country ct ON ct.id = c.countryFk
LEFT JOIN province p ON p.id = c.provinceFk
WHERE t.id = ?`, [ticketFk]);
},
fetchSales(clientFk, companyFk) {
return database.pool.query(
`CALL vn.clientGetDebtDiary(?, ?)`, [clientFk, companyFk]);
},
dated: () => {
return strftime('%d-%m-%Y', new Date());
},
toISOString: date => {
return strftime('%d-%m-%Y', date);
},
},
components: {
'report-header': require('../report-header'),
'report-footer': require('../report-footer'),
},
};

View File

@ -0,0 +1,16 @@
module.exports = {
messages: {
es: {
title: 'Albarán',
ticketId: 'Albarán',
clientId: 'Cliente',
clientData: 'Datos del cliente',
date: 'Fecha',
concept: 'Concepto',
invoiced: 'Facturado',
payed: 'Pagado',
balance: 'Saldo',
ticket: 'Albarán {0}'
},
},
};

View File

@ -74,7 +74,8 @@
<report-footer id="pageFooter"
:left-text="$t('client', [clientId])"
:center-text="clientName">
:center-text="clientName"
:locale="locale">
</report-footer>
</section>
</body>

View File

@ -30,7 +30,8 @@ module.exports = {
});
},
created() {
this.$i18n.locale = this.locale;
if (this.locale)
this.$i18n.locale = this.locale;
},
data() {
return {totalBalance: 0.00};

View File

@ -142,7 +142,8 @@
<report-footer id="pageFooter"
:left-text="$t('order', [mandateCode])"
:center-text="clientName">
:center-text="clientName"
:locale="locale">
</report-footer>
</section>
</body>

View File

@ -27,7 +27,8 @@ module.exports = {
});
},
created() {
this.$i18n.locale = this.locale;
if (this.locale)
this.$i18n.locale = this.locale;
},
methods: {