2223 Added pickup checkbox
gitea/salix/pipeline/head There was a failure building this commit
Details
gitea/salix/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
58be5ef78e
commit
94a219760c
|
@ -0,0 +1,2 @@
|
|||
ALTER TABLE `vn`.`claim`
|
||||
ADD COLUMN `hasToPickUp` TINYINT(1) NOT NULL AFTER `ticketFk`;
|
|
@ -47,7 +47,7 @@ export default class Range extends FormInput {
|
|||
}
|
||||
|
||||
onValueUpdate() {
|
||||
this.change(this.input.value);
|
||||
this.change(parseInt(this.input.value));
|
||||
this.$.$applyAsync();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,6 +62,7 @@
|
|||
"MESSAGE_INSURANCE_CHANGE": "I have changed the insurence credit of client [{{clientName}} (#{{clientId}})]({{{url}}}) to *{{credit}} €*",
|
||||
"MESSAGE_CHANGED_PAYMETHOD": "I have changed the pay method for client [{{clientName}} (#{{clientId}})]({{{url}}})",
|
||||
"Sent units from ticket": "I sent *{{quantity}}* units of [{{concept}} (#{{itemId}})]({{{itemUrl}}}) to *\"{{nickname}}\"* coming from ticket id [#{{ticketId}}]({{{ticketUrl}}})",
|
||||
"Claim will be picked": "The product from the claim (#{{claimId}})]({{{claimUrl}}}) from the client *{{clientName}}* will be picked",
|
||||
"This ticket is not an stowaway anymore": "The ticket id [#{{ticketId}}]({{{ticketUrl}}}) is not an stowaway anymore",
|
||||
"Customs agent is required for a non UEE member": "Customs agent is required for a non UEE member",
|
||||
"Incoterms is required for a non UEE member": "Incoterms is required for a non UEE member",
|
||||
|
|
|
@ -125,6 +125,7 @@
|
|||
"MESSAGE_INSURANCE_CHANGE": "He cambiado el crédito asegurado del cliente [{{clientName}} (#{{clientId}})]({{{url}}}) a *{{credit}} €*",
|
||||
"MESSAGE_CHANGED_PAYMETHOD": "He cambiado la forma de pago del cliente [{{clientName}} (#{{clientId}})]({{{url}}})",
|
||||
"Sent units from ticket": "Envio *{{quantity}}* unidades de [{{concept}} (#{{itemId}})]({{{itemUrl}}}) a *\"{{nickname}}\"* provenientes del ticket id [#{{ticketId}}]({{{ticketUrl}}})",
|
||||
"Claim will be picked": "Se recogerá el género de la reclamación (#{{claimId}})]({{{claimUrl}}}) del cliente *{{clientName}}*",
|
||||
"This ticket is not an stowaway anymore": "El ticket id [#{{ticketId}}]({{{ticketUrl}}}) ha dejado de ser un polizón",
|
||||
"Client checked as validated despite of duplication": "Cliente comprobado a pesar de que existe el cliente id {{clientId}}",
|
||||
"ORDER_ROW_UNAVAILABLE": "No hay disponibilidad de este producto",
|
||||
|
|
|
@ -3,21 +3,22 @@ module.exports = Self => {
|
|||
description: 'Imports lines from claimBeginning to a new ticket with specific shipped, landed dates, agency and company',
|
||||
accessType: 'WRITE',
|
||||
accepts: [{
|
||||
arg: 'params',
|
||||
type: 'object',
|
||||
http: {source: 'body'}
|
||||
arg: 'id',
|
||||
type: 'number',
|
||||
description: 'The claim id',
|
||||
http: {source: 'path'}
|
||||
}],
|
||||
returns: {
|
||||
type: ['Object'],
|
||||
root: true
|
||||
},
|
||||
http: {
|
||||
path: `/regularizeClaim`,
|
||||
path: `/:id/regularizeClaim`,
|
||||
verb: 'POST'
|
||||
}
|
||||
});
|
||||
|
||||
Self.regularizeClaim = async(ctx, params) => {
|
||||
Self.regularizeClaim = async(ctx, claimFk) => {
|
||||
const models = Self.app.models;
|
||||
const $t = ctx.req.__; // $translate
|
||||
const resolvedState = 3;
|
||||
|
@ -31,7 +32,7 @@ module.exports = Self => {
|
|||
relation: 'claimDestination',
|
||||
fields: ['addressFk']
|
||||
},
|
||||
where: {claimFk: params.claimFk}
|
||||
where: {claimFk: claimFk}
|
||||
}, options);
|
||||
|
||||
for (let i = 0; i < claimEnds.length; i++) {
|
||||
|
@ -87,11 +88,32 @@ module.exports = Self => {
|
|||
}, options);
|
||||
}
|
||||
|
||||
let claim = await Self.findById(params.claimFk, null, options);
|
||||
let claim = await Self.findById(claimFk, {
|
||||
include: {
|
||||
relation: 'client',
|
||||
scope: {
|
||||
include: {
|
||||
relation: 'salesPerson'
|
||||
}
|
||||
}
|
||||
}
|
||||
}, options);
|
||||
claim = await claim.updateAttributes({
|
||||
claimStateFk: resolvedState
|
||||
}, options);
|
||||
|
||||
// Get sales person from claim client
|
||||
const salesPerson = claim.client().salesPerson();
|
||||
if (salesPerson) {
|
||||
const origin = ctx.req.headers.origin;
|
||||
const message = $t('Claim will be picked', {
|
||||
claimId: claim.id,
|
||||
clientName: claim.client().name,
|
||||
claimUrl: `${origin}/#!/claim/${claim.id}/summary`
|
||||
});
|
||||
await models.Chat.sendCheckingPresence(ctx, salesPerson.id, message);
|
||||
}
|
||||
|
||||
await tx.commit();
|
||||
|
||||
return claim;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
module.exports = Self => {
|
||||
Self.remoteMethod('updateClaimAction', {
|
||||
Self.remoteMethodCtx('updateClaimAction', {
|
||||
description: 'Update a claim with privileges',
|
||||
accessType: 'WRITE',
|
||||
accepts: [{
|
||||
|
@ -10,11 +10,17 @@ module.exports = Self => {
|
|||
description: 'Claim id',
|
||||
http: {source: 'path'}
|
||||
}, {
|
||||
arg: 'data',
|
||||
type: 'object',
|
||||
required: true,
|
||||
description: 'Data to update on the model',
|
||||
http: {source: 'body'}
|
||||
arg: 'responsibility',
|
||||
type: 'number',
|
||||
required: false
|
||||
}, {
|
||||
arg: 'isChargedToMana',
|
||||
type: 'boolean',
|
||||
required: false
|
||||
}, {
|
||||
arg: 'hasToPickUp',
|
||||
type: 'boolean',
|
||||
required: false
|
||||
}],
|
||||
returns: {
|
||||
type: 'object',
|
||||
|
@ -22,22 +28,16 @@ module.exports = Self => {
|
|||
},
|
||||
http: {
|
||||
path: `/:id/updateClaimAction`,
|
||||
verb: 'post'
|
||||
verb: 'patch'
|
||||
}
|
||||
});
|
||||
|
||||
Self.updateClaimAction = async(id, data) => {
|
||||
let models = Self.app.models;
|
||||
Self.updateClaimAction = async(ctx, id) => {
|
||||
const models = Self.app.models;
|
||||
const claim = await models.Claim.findById(id);
|
||||
const args = ctx.args;
|
||||
delete args.ctx;
|
||||
|
||||
let claim = await models.Claim.findById(id);
|
||||
let updatedData = {};
|
||||
|
||||
if (data.hasOwnProperty('responsibility'))
|
||||
updatedData.responsibility = data.responsibility;
|
||||
|
||||
if (data.hasOwnProperty('isChargedToMana'))
|
||||
updatedData.isChargedToMana = data.isChargedToMana;
|
||||
|
||||
return await claim.updateAttributes(updatedData);
|
||||
return await claim.updateAttributes(args);
|
||||
};
|
||||
};
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
"description": "Identifier"
|
||||
},
|
||||
"observation": {
|
||||
"type": "String"
|
||||
"type": "string"
|
||||
},
|
||||
"ticketCreated": {
|
||||
"type": "date",
|
||||
|
@ -26,16 +26,19 @@
|
|||
"type": "date"
|
||||
},
|
||||
"responsibility": {
|
||||
"type": "Number"
|
||||
"type": "number"
|
||||
},
|
||||
"hasToPickUp": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"ticketFk": {
|
||||
"type": "Number"
|
||||
"type": "number"
|
||||
},
|
||||
"claimStateFk": {
|
||||
"type": "Number"
|
||||
"type": "number"
|
||||
},
|
||||
"workerFk": {
|
||||
"type": "Number"
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
"relations": {
|
||||
|
|
|
@ -42,15 +42,18 @@
|
|||
max="$ctrl.maxResponsibility"
|
||||
min="1"
|
||||
step="1"
|
||||
vn-acl="salesAssistant"
|
||||
on-change="$ctrl.saveResponsibility(value)">
|
||||
on-change="$ctrl.save({responsibility: value})">
|
||||
</vn-range>
|
||||
</vn-tool-bar>
|
||||
<vn-check vn-one class="vn-mr-md"
|
||||
label="Pickup"
|
||||
ng-model="::$ctrl.claim.hasToPickUp"
|
||||
on-change="$ctrl.save({hasToPickUp: value})">
|
||||
</vn-check>
|
||||
<vn-check vn-one
|
||||
label="Is paid with mana"
|
||||
ng-model="$ctrl.claim.isChargedToMana"
|
||||
vn-acl="salesAssistant"
|
||||
on-change="$ctrl.saveMana(value)">
|
||||
on-change="$ctrl.save({isChargedToMana: value})">
|
||||
</vn-check>
|
||||
</section>
|
||||
|
||||
|
|
|
@ -116,8 +116,8 @@ export default class Controller extends Section {
|
|||
}
|
||||
|
||||
regularize() {
|
||||
let data = {claimFk: this.$params.id};
|
||||
let query = `Claims/regularizeClaim`;
|
||||
let data = {hasToPickUp: this.hasToPickUp};
|
||||
let query = `Claims/${this.$params.id}/regularizeClaim`;
|
||||
return this.$http.post(query, data).then(() => {
|
||||
if (this.claim.responsibility >= Math.ceil(this.maxResponsibility) / 2)
|
||||
this.$.updateGreuge.show();
|
||||
|
@ -179,18 +179,9 @@ export default class Controller extends Section {
|
|||
this.$.descriptor.show();
|
||||
}
|
||||
|
||||
saveResponsibility(value) {
|
||||
let query = `Claims/${this.$params.id}/updateClaimAction`;
|
||||
|
||||
this.$http.post(query, {responsibility: value}).then(() => {
|
||||
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
|
||||
});
|
||||
}
|
||||
|
||||
saveMana(value) {
|
||||
let query = `Claims/${this.$params.id}/updateClaimAction`;
|
||||
|
||||
this.$http.post(query, {isChargedToMana: value}).then(() => {
|
||||
save(data) {
|
||||
const query = `Claims/${this.$params.id}/updateClaimAction`;
|
||||
this.$http.patch(query, data).then(() => {
|
||||
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
|
||||
});
|
||||
}
|
||||
|
|
|
@ -10,3 +10,4 @@ Do you want to insert greuges?: Desea insertar greuges?
|
|||
Insert greuges on client card: Insertar greuges en la ficha del cliente
|
||||
Greuge inserted: Greuge insertado
|
||||
ClaimGreugeDescription: Reclamación id {{claimId}}
|
||||
Pickup: Recoger
|
Loading…
Reference in New Issue