Bug #783 al abrir una reclamacion navegar a ella, no abrir nueva pestaña

This commit is contained in:
Carlos Jimenez 2018-11-06 13:58:13 +01:00
parent e06798cf90
commit d85a4da1ab
22 changed files with 45 additions and 22 deletions

View File

@ -70,6 +70,14 @@
</vn-check>
</vn-td>
<vn-td>
<a ui-sref="claim.card.basicData({id: sale.claim.claimFk})">
<vn-icon
ng-show="sale.claim.claimFk"
orange
icon="icon-claims"
vn-tooltip="{{::$ctrl.$translate.instant('Claim')}}: {{::sale.claim.claimFk}}">
</vn-icon>
</a>
<vn-icon
ng-show="sale.visible || sale.available"
orange

View File

@ -24,5 +24,6 @@ Friday: Viernes
Saturday: Sábado
Sunday: Domingo
Add claim: Crear reclamación
Claim: Reclamación
Transfer lines: Transferir líneas
Change ticket state to 'Ok': Cambiar estado del ticket a 'Ok'

View File

@ -7,9 +7,7 @@
"posttest": "npm run lint && nsp check"
},
"dependencies": {
"vn-loopback": "file:../loopback",
"object-diff": "0.0.4",
"object.pick": "^1.3.0"
"vn-loopback": "file:../loopback"
},
"repository": {
"type": "git",

View File

@ -1,13 +1,7 @@
{
"Claim": {
"dataSource": "vn"
},
"ClaimState": {
"dataSource": "vn"
},
"ClaimBeginning": {
"dataSource": "vn"
},
"ClaimReason": {
"dataSource": "vn"
},

View File

@ -6,7 +6,7 @@ describe('claimBeginning', () => {
let refundTicketSales;
let salesInsertedInClaimEnd;
afterAll(async() => {
afterAll(async () => {
let promises = [];
promises.push(app.models.Ticket.destroyById(ticket.id));
@ -16,7 +16,7 @@ describe('claimBeginning', () => {
});
describe('importToNewRefundTicket()', () => {
it('should create a new ticket with negative sales, save an observation, update the state and insert the negative sales into claimEnd', async() => {
it('should create a new ticket with negative sales, save an observation, update the state and insert the negative sales into claimEnd', async () => {
let ctxOfSalesAssistant = {req: {accessToken: {userId: 21}}};
let claimId = 1;
ticket = await app.models.ClaimBeginning.importToNewRefundTicket(ctxOfSalesAssistant, claimId);

View File

@ -1,6 +1,6 @@
const UserError = require('vn-loopback/common/helpers').UserError;
var pick = require('object.pick');
var diff = require('object-diff');
const UserError = require('../../../common/helpers').UserError;
let pick = require('object.pick');
let diff = require('object-diff');
module.exports = Self => {
Self.remoteMethodCtx('updateClaim', {
@ -23,7 +23,7 @@ module.exports = Self => {
}
});
Self.updateClaim = async(ctx, params) => {
Self.updateClaim = async (ctx, params) => {
let models = Self.app.models;
let isSalesAssistant;
let token = ctx.req.accessToken;

View File

@ -23,9 +23,12 @@ module.exports = Self => {
let query = `CALL vn.ticketGetVisibleAvailable(?)`;
let [lines] = await Self.rawSql(query, [ticketFk]);
let ids = [];
let salesIds = [];
for (line of lines)
for (line of lines) {
ids.push(line.itemFk);
salesIds.push(line.id);
}
let filter = {
fields: ['id', 'name', 'tag5', 'value5', 'tag6', 'value6', 'tag7', 'value7', 'tag8', 'value8', 'tag9', 'value9', 'tag10', 'value10'],
@ -33,12 +36,24 @@ module.exports = Self => {
};
let items = await Self.app.models.Item.find(filter);
filter = {
fields: ['claimFk', 'saleFk'],
where: {saleFk: {inq: salesIds}},
};
let claims = await Self.app.models.ClaimBeginning.find(filter);
let map = {};
for (item of items)
map[item.id] = item;
for (line of lines)
let claimMap = {};
for (claim of claims)
claimMap[claim.saleFk] = claim;
for (line of lines) {
line.tags = map[line.itemFk];
line.claim = claimMap[line.id];
}
return lines;
};

View File

@ -1,11 +1,11 @@
const app = require(`${servicesDir}/ticket/server/server`);
describe('ticket getSales()', () => {
it('should return the sales of a ticket', async() => {
let sales = await app.models.Ticket.getSales(1);
it('should return the sales of a ticket', async () => {
let sales = await app.models.Ticket.getSales(16);
expect(sales.length).toBe(4);
expect(sales[0].item).toBeDefined();
expect(sales[0].item.tags).toBeDefined();
expect(sales.length).toEqual(4);
expect(sales[0].tags).toBeDefined();
expect(sales[1].claim).toBeDefined();
});
});

View File

@ -20,6 +20,7 @@
"require-yaml": "0.0.1",
"serve-favicon": "^2.0.1",
"strong-error-handler": "^2.1.0",
"object-diff": "0.0.4",
"object.pick": "^1.3.0"
},
"devDependencies": {

View File

@ -15,6 +15,12 @@
"ACL": {
"dataSource": "salix"
},
"Claim": {
"dataSource": "vn"
},
"ClaimBeginning": {
"dataSource": "vn"
},
"FieldAcl": {
"dataSource": "salix"
},