diff --git a/db/changes/10500-november/00-deletePickupContact.sql b/db/changes/10500-november/00-deletePickupContact.sql new file mode 100644 index 000000000..6bfa662c5 --- /dev/null +++ b/db/changes/10500-november/00-deletePickupContact.sql @@ -0,0 +1 @@ +ALTER TABLE `vn`.`claimConfig` DROP COLUMN `pickupContact`; diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index a744b21c3..3f364bb42 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -1778,10 +1778,10 @@ INSERT INTO `vn`.`claimEnd`(`id`, `saleFk`, `claimFk`, `workerFk`, `claimDestina (1, 31, 4, 21, 2), (2, 32, 3, 21, 3); -INSERT INTO `vn`.`claimConfig`(`id`, `pickupContact`, `maxResponsibility`) +INSERT INTO `vn`.`claimConfig`(`id`, `maxResponsibility`) VALUES - (1, 'Contact description', 50), - (2, 'Contact description', 30); + (1, 50), + (2, 30); INSERT INTO `vn`.`claimRatio`(`clientFk`, `yearSale`, `claimAmount`, `claimingRate`, `priceIncreasing`, `packingRate`) VALUES @@ -1791,7 +1791,7 @@ INSERT INTO `vn`.`claimRatio`(`clientFk`, `yearSale`, `claimAmount`, `claimingRa (1104, 2500, 150.00, 0.02, 0.10, 1.00); INSERT INTO vn.claimRma (`id`, `code`, `created`, `workerFk`) -VALUES + VALUES (1, '02676A049183', DEFAULT, 1106), (2, '02676A049183', DEFAULT, 1106), (3, '02676A049183', DEFAULT, 1107), diff --git a/loopback/locale/en.json b/loopback/locale/en.json index 1e151294f..f03441c0f 100644 --- a/loopback/locale/en.json +++ b/loopback/locale/en.json @@ -134,6 +134,7 @@ "Password does not meet requirements": "Password does not meet requirements", "You don't have privileges to change the zone": "You don't have privileges to change the zone or for these parameters there are more than one shipping options, talk to agencies", "Not enough privileges to edit a client": "Not enough privileges to edit a client", + "Claim pickup order sent": "Claim pickup order sent [({{claimId}})]({{{claimUrl}}}) to client *{{clientName}}*", "You don't have grant privilege": "You don't have grant privilege", "You don't own the role and you can't assign it to another user": "You don't own the role and you can't assign it to another user" } diff --git a/loopback/locale/es.json b/loopback/locale/es.json index a41315dd1..626e35b5b 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -236,6 +236,7 @@ "Modifiable user details only by an administrator": "Detalles de usuario modificables solo por un administrador", "Modifiable password only via recovery or by an administrator": "Contraseña modificable solo a través de la recuperación o por un administrador", "Not enough privileges to edit a client": "No tienes suficientes privilegios para editar un cliente", + "Claim pickup order sent": "Reclamación Orden de recogida enviada [({{claimId}})]({{{claimUrl}}}) al cliente *{{clientName}}*", "You don't have grant privilege": "No tienes privilegios para dar privilegios", "You don't own the role and you can't assign it to another user": "No eres el propietario del rol y no puedes asignarlo a otro usuario" } diff --git a/modules/claim/back/methods/claim/claimPickupEmail.js b/modules/claim/back/methods/claim/claimPickupEmail.js index 4d64cc66e..c688d6ded 100644 --- a/modules/claim/back/methods/claim/claimPickupEmail.js +++ b/modules/claim/back/methods/claim/claimPickupEmail.js @@ -9,7 +9,7 @@ module.exports = Self => { arg: 'id', type: 'number', required: true, - description: 'The client id', + description: 'The claim id', http: {source: 'path'} }, { @@ -42,6 +42,11 @@ module.exports = Self => { }); Self.claimPickupEmail = async ctx => { + const models = Self.app.models; + const userId = ctx.req.accessToken.userId; + const $t = ctx.req.__; // $translate + const origin = ctx.req.headers.origin; + const args = Object.assign({}, ctx.args); const params = { recipient: args.recipient, @@ -52,6 +57,34 @@ module.exports = Self => { for (const param in args) params[param] = args[param]; + const claim = await models.Claim.findById(args.id, { + fields: ['id', 'clientFk'], + include: { + relation: 'client', + scope: { + fields: ['name', 'salesPersonFk'] + } + } + }); + + const message = $t('Claim pickup order sent', { + claimId: args.id, + clientName: claim.client().name, + claimUrl: `${origin}/#!/claim/${args.id}/summary`, + }); + + const salesPersonId = claim.client().salesPersonFk; + if (salesPersonId) + await models.Chat.sendCheckingPresence(ctx, salesPersonId, message); + + await models.ClaimLog.create({ + originFk: args.id, + userFk: userId, + action: 'insert', + description: 'Claim-pickup-order sent', + changedModel: 'Mail' + }); + const email = new Email('claim-pickup-order', params); return email.send(); diff --git a/modules/claim/front/basic-data/index.html b/modules/claim/front/basic-data/index.html index 7a91e180a..16e134c60 100644 --- a/modules/claim/front/basic-data/index.html +++ b/modules/claim/front/basic-data/index.html @@ -19,7 +19,7 @@ readonly="true"> @@ -56,7 +56,7 @@ label="Pick up" ng-model="$ctrl.claim.hasToPickUp" vn-acl="claimManager" - info="When checked will notify to the salesPerson"> + title="{{'When checked will notify to the salesPerson' | translate}}"> diff --git a/modules/claim/front/basic-data/locale/es.yml b/modules/claim/front/basic-data/locale/es.yml index c51afee3f..5250d266c 100644 --- a/modules/claim/front/basic-data/locale/es.yml +++ b/modules/claim/front/basic-data/locale/es.yml @@ -5,5 +5,5 @@ Responsability: Responsabilidad Company: Empresa Sales/Client: Comercial/Cliente Pick up: Recoger -When checked will notify a pickup to the salesPerson: Cuando se marque enviará una notificación de recogida al comercial -Packages received: Bultos recibidos \ No newline at end of file +When checked will notify to the salesPerson: Cuando se marque enviará una notificación de recogida al comercial +Packages received: Bultos recibidos diff --git a/modules/claim/front/summary/index.html b/modules/claim/front/summary/index.html index 0c12aa2e6..6adbfd684 100644 --- a/modules/claim/front/summary/index.html +++ b/modules/claim/front/summary/index.html @@ -25,16 +25,23 @@ - - - - - - +

+ + Basic data + +

+ + + + + @@ -42,16 +49,23 @@ label="Attended by" value="{{$ctrl.summary.claim.worker.user.nickname}}">
-
+ + +

- Observations

-

Observations @@ -70,13 +84,13 @@

- Detail

-

Detail @@ -98,7 +112,7 @@ - {{::saleClaimed.sale.itemFk | zeroFill:6}} @@ -111,7 +125,7 @@ {{::saleClaimed.sale.price | currency: 'EUR':2}} {{::saleClaimed.sale.discount}} % - {{saleClaimed.sale.quantity * saleClaimed.sale.price * + {{saleClaimed.sale.quantity * saleClaimed.sale.price * ((100 - saleClaimed.sale.discount) / 100) | currency: 'EUR':2}} @@ -123,7 +137,7 @@

Photos

-
@@ -137,13 +151,13 @@

- Development

-

Development @@ -165,8 +179,8 @@ {{::development.claimResult.description}} {{::development.claimResponsible.description}} - {{::development.worker.user.nickname}} @@ -179,21 +193,21 @@

- Action

Action

- {{::action.sale.itemFk | zeroFill:6}} - {{::action.sale.ticket.id}} @@ -258,9 +272,9 @@ vn-id="item-descriptor" warehouse-fk="$ctrl.vnConfig.warehouseFk"> - - - \ No newline at end of file + diff --git a/print/templates/email/claim-pickup-order/claim-pickup-order.html b/print/templates/email/claim-pickup-order/claim-pickup-order.html index f674dcee8..32606bd7b 100644 --- a/print/templates/email/claim-pickup-order/claim-pickup-order.html +++ b/print/templates/email/claim-pickup-order/claim-pickup-order.html @@ -23,9 +23,10 @@
-

{{ $t('title') }}

-

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

-

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

+

{{ $t('title', [id]) }}

+

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

+

+

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

@@ -43,4 +44,4 @@ - \ No newline at end of file + diff --git a/print/templates/email/claim-pickup-order/claim-pickup-order.js b/print/templates/email/claim-pickup-order/claim-pickup-order.js index bdb338628..bff7be562 100755 --- a/print/templates/email/claim-pickup-order/claim-pickup-order.js +++ b/print/templates/email/claim-pickup-order/claim-pickup-order.js @@ -8,6 +8,19 @@ module.exports = { 'email-header': emailHeader.build(), 'email-footer': emailFooter.build() }, + async serverPrefetch() { + this.ticket = await this.fetchTicket(this.id); + + if (!this.ticket) + throw new Error('Something went wrong'); + + this.instructions = this.$t('description.instructions', [this.id, this.ticket.id]); + }, + methods: { + fetchTicket(id) { + return this.findOneFromDef('ticket', [id]); + } + }, props: { id: { type: Number, diff --git a/print/templates/email/claim-pickup-order/locale/es.yml b/print/templates/email/claim-pickup-order/locale/es.yml index fe08fb0a8..9ff30158e 100644 --- a/print/templates/email/claim-pickup-order/locale/es.yml +++ b/print/templates/email/claim-pickup-order/locale/es.yml @@ -1,5 +1,10 @@ -subject: Orden de recogida -title: Orden de recogida +subject: Reclamación Verdnatura +title: Reclamación Verdnatura {0} description: - dear: Estimado cliente - instructions: Aqui tienes tu orden de recogida. \ No newline at end of file + dear: Estimado cliente + instructions: 'Le informamos que se ha aceptado su solicitud de reclamación nº {0} correspondiente al pedido {1}. + Para tramitar la recogida, rellene el SIGUIENTE FORMULARIO en un plazo máximo de 24h. +

Cuando recibamos el género en nuestras instalaciones emitiremos el abono correspondiente. + Debe imprimir el archivo adjunto e incluirlo en la caja. En el caso de no poder imprimirlo, identifique la caja con el número de reclamación CLARAMENTE LEGIBLE.' + conclusion: Un saludo diff --git a/print/templates/email/claim-pickup-order/sql/ticket.sql b/print/templates/email/claim-pickup-order/sql/ticket.sql new file mode 100644 index 000000000..28b78c987 --- /dev/null +++ b/print/templates/email/claim-pickup-order/sql/ticket.sql @@ -0,0 +1,4 @@ +SELECT + c.ticketFk as id +FROM claim c +WHERE c.id = ? diff --git a/print/templates/reports/claim-pickup-order/claim-pickup-order.html b/print/templates/reports/claim-pickup-order/claim-pickup-order.html index 6764344b5..45f679e2b 100644 --- a/print/templates/reports/claim-pickup-order/claim-pickup-order.html +++ b/print/templates/reports/claim-pickup-order/claim-pickup-order.html @@ -52,7 +52,7 @@ - + @@ -71,16 +71,13 @@
- +
{{$t('clientSignature')}}

{{client.name}}

- -

-

{{claimConfig.pickupContact}}

@@ -94,4 +91,4 @@ - \ No newline at end of file + diff --git a/print/templates/reports/claim-pickup-order/claim-pickup-order.js b/print/templates/reports/claim-pickup-order/claim-pickup-order.js index 358adbadd..5799cdfcc 100755 --- a/print/templates/reports/claim-pickup-order/claim-pickup-order.js +++ b/print/templates/reports/claim-pickup-order/claim-pickup-order.js @@ -7,7 +7,6 @@ module.exports = { async serverPrefetch() { this.client = await this.fetchClient(this.id); this.sales = await this.fetchSales(this.id); - this.claimConfig = await this.fetchClaimConfig(); if (!this.client) throw new Error('Something went wrong'); @@ -25,10 +24,7 @@ module.exports = { }, fetchSales(id) { return this.rawSqlFromDef('sales', [id]); - }, - fetchClaimConfig() { - return this.findOneFromDef('claimConfig'); - }, + } }, components: { 'report-header': reportHeader.build(), diff --git a/print/templates/reports/claim-pickup-order/locale/es.yml b/print/templates/reports/claim-pickup-order/locale/es.yml index 388c1f1a6..5ee5ecda7 100644 --- a/print/templates/reports/claim-pickup-order/locale/es.yml +++ b/print/templates/reports/claim-pickup-order/locale/es.yml @@ -11,7 +11,3 @@ concept: Concepto clientSignature: Firma del cliente claim: Reclamación {0} phone: Teléfono -sections: - agency: - description: 'Para agilizar su recogida, por favor, póngase en contacto con la oficina - de Logista Parcel.' diff --git a/print/templates/reports/claim-pickup-order/sql/claimConfig.sql b/print/templates/reports/claim-pickup-order/sql/claimConfig.sql deleted file mode 100644 index 9d744ca6d..000000000 --- a/print/templates/reports/claim-pickup-order/sql/claimConfig.sql +++ /dev/null @@ -1,2 +0,0 @@ -SELECT pickupContact - FROM claimConfig; \ No newline at end of file