refs #5237 Ahora lee un conjunto de arrays
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Guillermo Bonet 2023-04-19 10:16:37 +02:00
parent e231b0e12b
commit 6f96820168
5 changed files with 71 additions and 42 deletions

View File

@ -0,0 +1,11 @@
const Stylesheet = require(`vn-print/core/stylesheet`);
const path = require('path');
const vnPrintPath = path.resolve('print');
module.exports = new Stylesheet([
`${vnPrintPath}/common/css/spacing.css`,
`${vnPrintPath}/common/css/misc.css`,
`${vnPrintPath}/common/css/layout.css`,
`${vnPrintPath}/common/css/email.css`])
.mergeStyles();

View File

@ -1,14 +1,15 @@
<!DOCTYPE html>
<html v-bind="$props">
<head>
<meta name="viewport" content="width=device-width">
<meta name="format-detection" content="telephone=no">
<title>{{ $t('subject') }}</title>
</head>
<body>
<h1>{{ $t('title') }} {{name}}</h1>
<p>{{ $t('ticketId') }} <a :href='url'>{{ticketId}}</a></p>
<p>{{ $t('amount') }} {{amount}}</p>
<p>{{ $t('description') }} {{description}}</p>
</body>
</html>
<email-body v-bind="$props">
<div class="grid-row">
<div class="grid-block vn-px-ml centered">
<h1>{{ $t('total') }}: {{tickets.length}}</h1>
<hr>
</div>
<div v-for="ticket in tickets" class="grid-block vn-px-ml">
<p v-if="ticket.ticketId"><b>{{ $t('ticketId') }}:</b> {{ticket.ticketId}}</p>
<p><b>{{ $t('clientId') }}:</b> <a :href="clientGreugeUrl(ticket.clientId)" target="_blank">{{ticket.clientId}}</a></p>
<p v-if="ticket.description"><b>{{ $t('description') }}:</b> {{ticket.description}}</p>
<p><b>{{ $t('amount') }}:</b> {{ticket.amount}} €</p>
<hr>
</div>
</div>
</email-body>

View File

@ -1,21 +1,36 @@
const Component = require(`vn-print/core/component`);
const emailBody = new Component('email-body');
const models = require('vn-loopback/server/server').models;
module.exports = {
name: 'greuge-wrong',
async serverPrefetch() {
this.url = await this.salixUrl();
if (!this.url)
throw new Error('Something went wrong');
},
components: {
'email-body': emailBody.build(),
},
methods: {
async salixUrl() {
const salix = await models.Url.findOne({
where: {
appName: 'salix',
environment: process.env.NODE_ENV || 'dev'
}
});
return salix.url;
},
clientGreugeUrl(clientId) {
return `${this.url}client/${clientId}/greuge/index`
},
},
props: {
ticketId: {
type: [Number],
required: false
},
clientId: {
type: [Number],
tickets: {
type: Array,
required: true
},
description: {
type: [String],
required: true
},
amount: {
type: [Number],
required: true
}
},
};

View File

@ -1,5 +1,6 @@
subject: A wrong greuge has been created
title: A wrong greuge has been created for the client
ticketId: The ticket is
amount: The amount is
description: The description is
subject: Abnormal greuges have been created
total: Total number of abnormal greuges
ticketId: Ticket
clientId: Client
description: Description
amount: Amount

View File

@ -1,5 +1,6 @@
subject: Se ha creado una gruge anormal
title: Se ha creado una gruge anormal para el cliente
ticketId: El ticket es
amount: El importe es
description: La descripción es
subject: Se han creado greuges anormales
total: Número total de greuges anormales
ticketId: Ticket
clientId: Cliente
description: Descipción
amount: Importe