Merge pull request '4146-claim_pickup_order' (!1090) from 4146-claim_pickup_order into dev
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Alex Moreno 2022-11-02 12:08:05 +00:00
commit 40b6f64468
16 changed files with 124 additions and 64 deletions

View File

@ -0,0 +1 @@
ALTER TABLE `vn`.`claimConfig` DROP COLUMN `pickupContact`;

View File

@ -1778,10 +1778,10 @@ INSERT INTO `vn`.`claimEnd`(`id`, `saleFk`, `claimFk`, `workerFk`, `claimDestina
(1, 31, 4, 21, 2), (1, 31, 4, 21, 2),
(2, 32, 3, 21, 3); (2, 32, 3, 21, 3);
INSERT INTO `vn`.`claimConfig`(`id`, `pickupContact`, `maxResponsibility`) INSERT INTO `vn`.`claimConfig`(`id`, `maxResponsibility`)
VALUES VALUES
(1, 'Contact description', 50), (1, 50),
(2, 'Contact description', 30); (2, 30);
INSERT INTO `vn`.`claimRatio`(`clientFk`, `yearSale`, `claimAmount`, `claimingRate`, `priceIncreasing`, `packingRate`) INSERT INTO `vn`.`claimRatio`(`clientFk`, `yearSale`, `claimAmount`, `claimingRate`, `priceIncreasing`, `packingRate`)
VALUES VALUES
@ -1791,7 +1791,7 @@ INSERT INTO `vn`.`claimRatio`(`clientFk`, `yearSale`, `claimAmount`, `claimingRa
(1104, 2500, 150.00, 0.02, 0.10, 1.00); (1104, 2500, 150.00, 0.02, 0.10, 1.00);
INSERT INTO vn.claimRma (`id`, `code`, `created`, `workerFk`) INSERT INTO vn.claimRma (`id`, `code`, `created`, `workerFk`)
VALUES VALUES
(1, '02676A049183', DEFAULT, 1106), (1, '02676A049183', DEFAULT, 1106),
(2, '02676A049183', DEFAULT, 1106), (2, '02676A049183', DEFAULT, 1106),
(3, '02676A049183', DEFAULT, 1107), (3, '02676A049183', DEFAULT, 1107),

View File

@ -134,6 +134,7 @@
"Password does not meet requirements": "Password does not meet requirements", "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", "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", "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 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" "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"
} }

View File

@ -236,6 +236,7 @@
"Modifiable user details only by an administrator": "Detalles de usuario modificables solo por un administrador", "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", "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", "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 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" "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"
} }

View File

@ -9,7 +9,7 @@ module.exports = Self => {
arg: 'id', arg: 'id',
type: 'number', type: 'number',
required: true, required: true,
description: 'The client id', description: 'The claim id',
http: {source: 'path'} http: {source: 'path'}
}, },
{ {
@ -42,6 +42,11 @@ module.exports = Self => {
}); });
Self.claimPickupEmail = async ctx => { 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 args = Object.assign({}, ctx.args);
const params = { const params = {
recipient: args.recipient, recipient: args.recipient,
@ -52,6 +57,34 @@ module.exports = Self => {
for (const param in args) for (const param in args)
params[param] = args[param]; 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); const email = new Email('claim-pickup-order', params);
return email.send(); return email.send();

View File

@ -19,7 +19,7 @@
readonly="true"> readonly="true">
</vn-textfield> </vn-textfield>
<vn-textfield <vn-textfield
label="Created" label="Created"
field="::$ctrl.claim.created | date:'yyyy-MM-dd HH:mm'" field="::$ctrl.claim.created | date:'yyyy-MM-dd HH:mm'"
readonly="true"> readonly="true">
</vn-textfield> </vn-textfield>
@ -56,7 +56,7 @@
label="Pick up" label="Pick up"
ng-model="$ctrl.claim.hasToPickUp" ng-model="$ctrl.claim.hasToPickUp"
vn-acl="claimManager" vn-acl="claimManager"
info="When checked will notify to the salesPerson"> title="{{'When checked will notify to the salesPerson' | translate}}">
</vn-check> </vn-check>
</vn-horizontal> </vn-horizontal>
</vn-card> </vn-card>

View File

@ -5,5 +5,5 @@ Responsability: Responsabilidad
Company: Empresa Company: Empresa
Sales/Client: Comercial/Cliente Sales/Client: Comercial/Cliente
Pick up: Recoger Pick up: Recoger
When checked will notify a pickup to the salesPerson: Cuando se marque enviará una notificación de recogida al comercial When checked will notify to the salesPerson: Cuando se marque enviará una notificación de recogida al comercial
Packages received: Bultos recibidos Packages received: Bultos recibidos

View File

@ -25,16 +25,23 @@
</vn-button-menu> </vn-button-menu>
</h5> </h5>
<vn-horizontal> <vn-horizontal>
<vn-one> <vn-auto>
<vn-label-value <h4>
label="Created" <a
value="{{$ctrl.summary.claim.created | date: 'dd/MM/yyyy'}}"> ui-sref="claim.card.basicData({id:$ctrl.claim.id})"
</vn-label-value> target="_self">
<vn-label-value <span translate vn-tooltip="Go to">Basic data</span>
label="State" </a>
value="{{$ctrl.summary.claim.claimState.description}}"> </h4>
</vn-label-value> <vn-label-value
<vn-label-value label="Created"
value="{{$ctrl.summary.claim.created | date: 'dd/MM/yyyy'}}">
</vn-label-value>
<vn-label-value
label="State"
value="{{$ctrl.summary.claim.claimState.description}}">
</vn-label-value>
<vn-label-value
label="Salesperson" label="Salesperson"
value="{{$ctrl.summary.claim.client.salesPersonUser.name}}"> value="{{$ctrl.summary.claim.client.salesPersonUser.name}}">
</vn-label-value> </vn-label-value>
@ -42,16 +49,23 @@
label="Attended by" label="Attended by"
value="{{$ctrl.summary.claim.worker.user.nickname}}"> value="{{$ctrl.summary.claim.worker.user.nickname}}">
</vn-label-value> </vn-label-value>
</vn-one> <vn-check
class="vn-mr-md"
label="Pick up"
ng-model="$ctrl.summary.claim.hasToPickUp"
title="{{'When checked will notify to the salesPerson' | translate}}"
disabled="true">
</vn-check>
</vn-auto>
<vn-auto> <vn-auto>
<h4 ng-show="$ctrl.isSalesPerson && $ctrl.summary.observations.length"> <h4 ng-show="$ctrl.isSalesPerson && $ctrl.summary.observations.length">
<a <a
ui-sref="claim.card.note.index({id:$ctrl.claim.id})" ui-sref="claim.card.note.index({id:$ctrl.claim.id})"
target="_self"> target="_self">
<span translate vn-tooltip="Go to">Observations</span> <span translate vn-tooltip="Go to">Observations</span>
</a> </a>
</h4> </h4>
<h4 <h4
ng-show="!$ctrl.isSalesPerson && $ctrl.summary.observations.length" ng-show="!$ctrl.isSalesPerson && $ctrl.summary.observations.length"
translate> translate>
Observations Observations
@ -70,13 +84,13 @@
</vn-auto> </vn-auto>
<vn-auto> <vn-auto>
<h4 ng-show="$ctrl.isSalesPerson"> <h4 ng-show="$ctrl.isSalesPerson">
<a <a
ui-sref="claim.card.detail({id:$ctrl.claim.id})" ui-sref="claim.card.detail({id:$ctrl.claim.id})"
target="_self"> target="_self">
<span translate vn-tooltip="Go to">Detail</span> <span translate vn-tooltip="Go to">Detail</span>
</a> </a>
</h4> </h4>
<h4 <h4
ng-show="!$ctrl.isSalesPerson" ng-show="!$ctrl.isSalesPerson"
translate> translate>
Detail Detail
@ -98,7 +112,7 @@
<vn-tbody> <vn-tbody>
<vn-tr ng-repeat="saleClaimed in $ctrl.summary.salesClaimed"> <vn-tr ng-repeat="saleClaimed in $ctrl.summary.salesClaimed">
<vn-td number> <vn-td number>
<span <span
ng-click="itemDescriptor.show($event, saleClaimed.sale.itemFk, saleClaimed.sale.id)" ng-click="itemDescriptor.show($event, saleClaimed.sale.itemFk, saleClaimed.sale.id)"
class="link"> class="link">
{{::saleClaimed.sale.itemFk | zeroFill:6}} {{::saleClaimed.sale.itemFk | zeroFill:6}}
@ -111,7 +125,7 @@
<vn-td number>{{::saleClaimed.sale.price | currency: 'EUR':2}}</vn-td> <vn-td number>{{::saleClaimed.sale.price | currency: 'EUR':2}}</vn-td>
<vn-td number>{{::saleClaimed.sale.discount}} %</vn-td> <vn-td number>{{::saleClaimed.sale.discount}} %</vn-td>
<vn-td number> <vn-td number>
{{saleClaimed.sale.quantity * saleClaimed.sale.price * {{saleClaimed.sale.quantity * saleClaimed.sale.price *
((100 - saleClaimed.sale.discount) / 100) | currency: 'EUR':2}} ((100 - saleClaimed.sale.discount) / 100) | currency: 'EUR':2}}
</vn-td> </vn-td>
</vn-tr> </vn-tr>
@ -123,7 +137,7 @@
<h4 translate>Photos</h4> <h4 translate>Photos</h4>
<vn-horizontal class="photo-list"> <vn-horizontal class="photo-list">
<section class="photo" ng-repeat="photo in photos"> <section class="photo" ng-repeat="photo in photos">
<section class="image" on-error-src <section class="image" on-error-src
ng-style="{'background': 'url(' + $ctrl.getImagePath(photo.dmsFk) + ')'}" ng-style="{'background': 'url(' + $ctrl.getImagePath(photo.dmsFk) + ')'}"
zoom-image="{{$ctrl.getImagePath(photo.dmsFk)}}" zoom-image="{{$ctrl.getImagePath(photo.dmsFk)}}"
ng-if="photo.dms.contentType != 'video/mp4'"> ng-if="photo.dms.contentType != 'video/mp4'">
@ -137,13 +151,13 @@
</vn-auto> </vn-auto>
<vn-auto> <vn-auto>
<h4 ng-show="$ctrl.isClaimManager"> <h4 ng-show="$ctrl.isClaimManager">
<a <a
ui-sref="claim.card.development({id:$ctrl.claim.id})" ui-sref="claim.card.development({id:$ctrl.claim.id})"
target="_self"> target="_self">
<span translate vn-tooltip="Go to">Development</span> <span translate vn-tooltip="Go to">Development</span>
</a> </a>
</h4> </h4>
<h4 <h4
translate translate
ng-show="!$ctrl.isClaimManager"> ng-show="!$ctrl.isClaimManager">
Development Development
@ -165,8 +179,8 @@
<vn-td>{{::development.claimResult.description}}</vn-td> <vn-td>{{::development.claimResult.description}}</vn-td>
<vn-td>{{::development.claimResponsible.description}}</vn-td> <vn-td>{{::development.claimResponsible.description}}</vn-td>
<vn-td expand> <vn-td expand>
<span <span
class="link" class="link"
ng-click="workerDescriptor.show($event, development.workerFk)"> ng-click="workerDescriptor.show($event, development.workerFk)">
{{::development.worker.user.nickname}} {{::development.worker.user.nickname}}
</span> </span>
@ -179,21 +193,21 @@
</vn-auto> </vn-auto>
<vn-auto> <vn-auto>
<h4 ng-show="$ctrl.isClaimManager"> <h4 ng-show="$ctrl.isClaimManager">
<a <a
ui-sref="claim.card.action({id:$ctrl.claim.id})" ui-sref="claim.card.action({id:$ctrl.claim.id})"
target="_self"> target="_self">
<span translate vn-tooltip="Go to">Action</span> <span translate vn-tooltip="Go to">Action</span>
</a> </a>
</h4> </h4>
<h4 <h4
translate translate
ng-show="!$ctrl.isClaimManager"> ng-show="!$ctrl.isClaimManager">
Action Action
</h4> </h4>
<vn-horizontal> <vn-horizontal>
<vn-one> <vn-one>
<vn-range <vn-range
vn-one vn-one
disabled="true" disabled="true"
label="Responsability" label="Responsability"
min-label="Company" min-label="Company"
@ -224,14 +238,14 @@
<vn-tbody> <vn-tbody>
<vn-tr ng-repeat="action in $ctrl.summary.actions"> <vn-tr ng-repeat="action in $ctrl.summary.actions">
<vn-td number> <vn-td number>
<span <span
ng-click="itemDescriptor.show($event, action.sale.itemFk, action.sale.id)" ng-click="itemDescriptor.show($event, action.sale.itemFk, action.sale.id)"
class="link"> class="link">
{{::action.sale.itemFk | zeroFill:6}} {{::action.sale.itemFk | zeroFill:6}}
</span> </span>
</vn-td> </vn-td>
<vn-td number> <vn-td number>
<span <span
ng-click="ticketDescriptor.show($event, action.sale.ticket.id)" ng-click="ticketDescriptor.show($event, action.sale.ticket.id)"
class="link"> class="link">
{{::action.sale.ticket.id}} {{::action.sale.ticket.id}}
@ -258,9 +272,9 @@
vn-id="item-descriptor" vn-id="item-descriptor"
warehouse-fk="$ctrl.vnConfig.warehouseFk"> warehouse-fk="$ctrl.vnConfig.warehouseFk">
</vn-item-descriptor-popover> </vn-item-descriptor-popover>
<vn-worker-descriptor-popover <vn-worker-descriptor-popover
vn-id="worker-descriptor"> vn-id="worker-descriptor">
</vn-worker-descriptor-popover> </vn-worker-descriptor-popover>
<vn-ticket-descriptor-popover <vn-ticket-descriptor-popover
vn-id="ticket-descriptor"> vn-id="ticket-descriptor">
</vn-ticket-descriptor-popover> </vn-ticket-descriptor-popover>

View File

@ -23,9 +23,10 @@
<!-- Block --> <!-- Block -->
<div class="grid-row"> <div class="grid-row">
<div class="grid-block vn-pa-ml"> <div class="grid-block vn-pa-ml">
<h1>{{ $t('title') }}</h1> <h1>{{ $t('title', [id]) }}</h1>
<p>{{$t('description.dear')}},</p> <p>{{ $t('description.dear') }},</p>
<p>{{$t('description.instructions')}}</p> <p v-html="instructions"></p>
<p>{{ $t('description.conclusion') }}</p>
</div> </div>
</div> </div>
<!-- Footer block --> <!-- Footer block -->
@ -43,4 +44,4 @@
</tbody> </tbody>
</table> </table>
</body> </body>
</html> </html>

View File

@ -8,6 +8,19 @@ module.exports = {
'email-header': emailHeader.build(), 'email-header': emailHeader.build(),
'email-footer': emailFooter.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: { props: {
id: { id: {
type: Number, type: Number,

View File

@ -1,5 +1,10 @@
subject: Orden de recogida subject: Reclamación Verdnatura
title: Orden de recogida title: Reclamación Verdnatura {0}
description: description:
dear: Estimado cliente dear: Estimado cliente
instructions: Aqui tienes tu orden de recogida. instructions: 'Le informamos que se ha aceptado su solicitud de reclamación <strong>nº {0}</strong> correspondiente al pedido <strong>{1}</strong>.
Para tramitar la recogida, rellene el <a href="https://form.jotform.com/verdnatura/recogida-verdnatura"
title="Formulario Recogida" target="_blank" style="color: #8dba25">SIGUIENTE FORMULARIO</a> en un <strong>plazo máximo de 24h.</strong>
<br/><br/>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, <strong>identifique la caja con el número de reclamación CLARAMENTE LEGIBLE.</strong>'
conclusion: Un saludo

View File

@ -0,0 +1,4 @@
SELECT
c.ticketFk as id
FROM claim c
WHERE c.id = ?

View File

@ -52,7 +52,7 @@
</div> </div>
</div> </div>
</div> </div>
<table class="column-oriented vn-mt-ml"> <table class="column-oriented vn-mt-ml">
<thead> <thead>
<tr> <tr>
@ -71,16 +71,13 @@
</tr> </tr>
</tbody> </tbody>
</table> </table>
<div class="panel sign"> <div class="panel sign">
<div class="header">{{$t('clientSignature')}}</div> <div class="header">{{$t('clientSignature')}}</div>
<div class="body centered"> <div class="body centered">
<h3>{{client.name}}</h3> <h3>{{client.name}}</h3>
</div> </div>
</div> </div>
<p v-html="$t('sections.agency.description')"></p>
<p>{{claimConfig.pickupContact}}</p>
</div> </div>
</div> </div>
<!-- Footer block --> <!-- Footer block -->
@ -94,4 +91,4 @@
</tbody> </tbody>
</table> </table>
</body> </body>
</html> </html>

View File

@ -7,7 +7,6 @@ module.exports = {
async serverPrefetch() { async serverPrefetch() {
this.client = await this.fetchClient(this.id); this.client = await this.fetchClient(this.id);
this.sales = await this.fetchSales(this.id); this.sales = await this.fetchSales(this.id);
this.claimConfig = await this.fetchClaimConfig();
if (!this.client) if (!this.client)
throw new Error('Something went wrong'); throw new Error('Something went wrong');
@ -25,10 +24,7 @@ module.exports = {
}, },
fetchSales(id) { fetchSales(id) {
return this.rawSqlFromDef('sales', [id]); return this.rawSqlFromDef('sales', [id]);
}, }
fetchClaimConfig() {
return this.findOneFromDef('claimConfig');
},
}, },
components: { components: {
'report-header': reportHeader.build(), 'report-header': reportHeader.build(),

View File

@ -11,7 +11,3 @@ concept: Concepto
clientSignature: Firma del cliente clientSignature: Firma del cliente
claim: Reclamación {0} claim: Reclamación {0}
phone: Teléfono phone: Teléfono
sections:
agency:
description: 'Para agilizar su recogida, por favor, póngase en contacto con la oficina
de Logista Parcel.'

View File

@ -1,2 +0,0 @@
SELECT pickupContact
FROM claimConfig;