feat(closure): send incoterms authorization
gitea/salix/pipeline/head This commit is unstable Details

This commit is contained in:
Joan Sanchez 2022-05-19 07:31:00 +02:00
parent bf8e7eed57
commit 6586595976
16 changed files with 128 additions and 1 deletions

View File

@ -0,0 +1,7 @@
INSERT INTO `vn`.`sample` (code, description, isVisible, hasCompany, hasPreview, datepickerEnabled)
VALUES ('incoterms-authorization', 'Autorización de incoterms', 1, 0, 1, 0);
INSERT INTO vn.expedition (agencyModeFk, ticketFk, isBox, created, isRefund, isPickUp, itemFk, counter, checked,
workerFk, externalId, packagingFk, itemPackingTypeFk, hostFk, stateTypeFk)
VALUES (7, 11, 71, '2022-05-18 11:40:56', false, false, null, 1, 1, 18, null, '94', null, '', 3);

View File

@ -224,5 +224,7 @@
"The agency is already assigned to another autonomous": "La agencia ya está asignada a otro autónomo",
"date in the future": "Fecha en el futuro",
"reference duplicated": "Referencia duplicada",
"This ticket is already a refund": "Este ticket ya es un abono"
"This ticket is already a refund": "Este ticket ya es un abono",
"isWithoutNegatives": "isWithoutNegatives",
"routeFk": "routeFk"
}

View File

@ -89,6 +89,26 @@ module.exports = {
const email = new Email('delivery-note-link', args);
await email.send();
}
// Incoterms authorization
const {firstOrder} = await db.findOne(`
SELECT COUNT(*) as firstOrder
FROM ticket t
WHERE t.clientFk = ?
AND NOT t.isDeleted
`, [ticket.clientFk]);
if (firstOrder == 1) {
const args = Object.assign({
ticketId: ticket.id,
recipientId: ticket.clientFk,
recipient: ticket.recipient,
replyTo: ticket.salesPersonEmail
}, reqArgs);
const email = new Email('incoterms-authorization', args);
await email.send();
}
} catch (error) {
// Domain not found
if (error.responseCode == 450)

View File

@ -0,0 +1,8 @@
const Stylesheet = require(`${appPath}/core/stylesheet`);
module.exports = new Stylesheet([
`${appPath}/common/css/spacing.css`,
`${appPath}/common/css/misc.css`,
`${appPath}/common/css/layout.css`,
`${appPath}/common/css/email.css`])
.mergeStyles();

View File

@ -0,0 +1,6 @@
[
{
"filename": "incoterms-authorization.pdf",
"component": "incoterms-authorization"
}
]

View File

@ -0,0 +1,56 @@
<!DOCTYPE html>
<html v-bind:lang="$i18n.locale">
<head>
<meta name="viewport" content="width=device-width">
<meta name="format-detection" content="telephone=no">
<title>{{ $t('subject') }}</title>
</head>
<body>
<table class="grid">
<tbody>
<tr>
<td>
<!-- Empty block -->
<div class="grid-row">
<div class="grid-block empty"></div>
</div>
<!-- Header block -->
<div class="grid-row">
<div class="grid-block">
<email-header v-bind="$props"></email-header>
</div>
</div>
<!-- Block -->
<div class="grid-row">
<div class="grid-block vn-pa-ml">
<h1>{{ $t('title') }}</h1>
<p>{{$t('description.dear')}},</p>
<p>{{$t('description.instructions')}}</p>
</div>
</div>
<!-- Attachments block -->
<div class="grid-row" v-if="isPreview">
<div class="grid-block vn-pa-ml">
<attachment v-for="attachment in attachments"
v-bind:key="attachment.filename"
v-bind:attachment="attachment"
v-bind:args="$props">
</attachment>
</div>
</div>
<!-- Footer block -->
<div class="grid-row">
<div class="grid-block">
<email-footer v-bind="$props"></email-footer>
</div>
</div>
<!-- Empty block -->
<div class="grid-row">
<div class="grid-block empty"></div>
</div>
</td>
</tr>
</tbody>
</table>
</body>
</html>

View File

@ -0,0 +1,23 @@
const Component = require(`${appPath}/core/component`);
const emailHeader = new Component('email-header');
const emailFooter = new Component('email-footer');
const attachment = new Component('attachment');
const attachments = require('./attachments.json');
module.exports = {
name: 'incoterms-authorization',
data() {
return {attachments};
},
components: {
'email-header': emailHeader.build(),
'email-footer': emailFooter.build(),
'attachment': attachment.build()
},
props: {
ticketId: {
type: [Number, String],
required: true
}
}
};

View File

@ -0,0 +1,5 @@
subject: Orden de recogida
title: Orden de recogida
description:
dear: Estimado cliente
instructions: Aqui tienes tu orden de recogida.