diff --git a/db/changes/10470-family/00-sample.sql b/db/changes/10470-family/00-sample.sql new file mode 100644 index 000000000..e0fa7ceac --- /dev/null +++ b/db/changes/10470-family/00-sample.sql @@ -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); diff --git a/loopback/locale/es.json b/loopback/locale/es.json index a44ba2da8..9e2b8989b 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -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" } \ No newline at end of file diff --git a/print/methods/closure/closure.js b/print/methods/closure/closure.js index 2b58205e3..925eb6f67 100644 --- a/print/methods/closure/closure.js +++ b/print/methods/closure/closure.js @@ -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) diff --git a/print/templates/email/incoterms-authorization/assets/css/import.js b/print/templates/email/incoterms-authorization/assets/css/import.js new file mode 100644 index 000000000..b44d6bd37 --- /dev/null +++ b/print/templates/email/incoterms-authorization/assets/css/import.js @@ -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(); diff --git a/print/templates/email/incoterms-authorization/attachments.json b/print/templates/email/incoterms-authorization/attachments.json new file mode 100644 index 000000000..9dfd945db --- /dev/null +++ b/print/templates/email/incoterms-authorization/attachments.json @@ -0,0 +1,6 @@ +[ + { + "filename": "incoterms-authorization.pdf", + "component": "incoterms-authorization" + } +] \ No newline at end of file diff --git a/print/templates/email/incoterms-authorization/incoterms-authorization.html b/print/templates/email/incoterms-authorization/incoterms-authorization.html new file mode 100644 index 000000000..e50a40c6d --- /dev/null +++ b/print/templates/email/incoterms-authorization/incoterms-authorization.html @@ -0,0 +1,56 @@ + + + + + + {{ $t('subject') }} + + + + + + + + +
+ +
+
+
+ +
+
+ +
+
+ +
+
+

{{ $t('title') }}

+

{{$t('description.dear')}},

+

{{$t('description.instructions')}}

+
+
+ +
+
+ + +
+
+ +
+
+ +
+
+ +
+
+
+
+ + \ No newline at end of file diff --git a/print/templates/email/incoterms-authorization/incoterms-authorization.js b/print/templates/email/incoterms-authorization/incoterms-authorization.js new file mode 100755 index 000000000..dbf2c5bdc --- /dev/null +++ b/print/templates/email/incoterms-authorization/incoterms-authorization.js @@ -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 + } + } +}; diff --git a/print/templates/email/incoterms-authorization/locale/es.yml b/print/templates/email/incoterms-authorization/locale/es.yml new file mode 100644 index 000000000..fe08fb0a8 --- /dev/null +++ b/print/templates/email/incoterms-authorization/locale/es.yml @@ -0,0 +1,5 @@ +subject: Orden de recogida +title: Orden de recogida +description: + dear: Estimado cliente + instructions: Aqui tienes tu orden de recogida. \ No newline at end of file diff --git a/print/templates/reports/cmr-authorization/assets/css/import.js b/print/templates/reports/incoterms-authorization/assets/css/import.js similarity index 100% rename from print/templates/reports/cmr-authorization/assets/css/import.js rename to print/templates/reports/incoterms-authorization/assets/css/import.js diff --git a/print/templates/reports/cmr-authorization/assets/css/style.css b/print/templates/reports/incoterms-authorization/assets/css/style.css similarity index 100% rename from print/templates/reports/cmr-authorization/assets/css/style.css rename to print/templates/reports/incoterms-authorization/assets/css/style.css diff --git a/print/templates/reports/cmr-authorization/assets/images/signature.png b/print/templates/reports/incoterms-authorization/assets/images/signature.png similarity index 100% rename from print/templates/reports/cmr-authorization/assets/images/signature.png rename to print/templates/reports/incoterms-authorization/assets/images/signature.png diff --git a/print/templates/reports/cmr-authorization/cmr-authorization.html b/print/templates/reports/incoterms-authorization/incoterms-authorization.html similarity index 100% rename from print/templates/reports/cmr-authorization/cmr-authorization.html rename to print/templates/reports/incoterms-authorization/incoterms-authorization.html diff --git a/print/templates/reports/cmr-authorization/cmr-authorization.js b/print/templates/reports/incoterms-authorization/incoterms-authorization.js similarity index 100% rename from print/templates/reports/cmr-authorization/cmr-authorization.js rename to print/templates/reports/incoterms-authorization/incoterms-authorization.js diff --git a/print/templates/reports/cmr-authorization/locale/es.yml b/print/templates/reports/incoterms-authorization/locale/es.yml similarity index 100% rename from print/templates/reports/cmr-authorization/locale/es.yml rename to print/templates/reports/incoterms-authorization/locale/es.yml diff --git a/print/templates/reports/cmr-authorization/sql/client.sql b/print/templates/reports/incoterms-authorization/sql/client.sql similarity index 100% rename from print/templates/reports/cmr-authorization/sql/client.sql rename to print/templates/reports/incoterms-authorization/sql/client.sql diff --git a/print/templates/reports/cmr-authorization/sql/ticket.sql b/print/templates/reports/incoterms-authorization/sql/ticket.sql similarity index 100% rename from print/templates/reports/cmr-authorization/sql/ticket.sql rename to print/templates/reports/incoterms-authorization/sql/ticket.sql