fixes #4962 Refactor Ticket Tour a Futuro #1212
|
@ -15,21 +15,21 @@ BEGIN
|
|||
CREATE TEMPORARY TABLE tmp.filter
|
||||
(INDEX (id))
|
||||
SELECT sv.ticketFk id,
|
||||
sub2.id futureId,
|
||||
GROUP_CONCAT(DISTINCT i.itemPackingTypeFk ORDER BY i.itemPackingTypeFk) ipt,
|
||||
CAST(sum(litros) AS DECIMAL(10,0)) liters,
|
||||
CAST(count(*) AS DECIMAL(10,0)) `lines`,
|
||||
st.name state,
|
||||
sub2.id ticketFuture,
|
||||
sub2.iptd tfIpt,
|
||||
sub2.state tfState,
|
||||
sub2.iptd futureIpt,
|
||||
sub2.state futureState,
|
||||
t.clientFk,
|
||||
t.warehouseFk,
|
||||
ts.alertLevel,
|
||||
t.shipped,
|
||||
sub2.shipped tfShipped,
|
||||
sub2.shipped futureShipped,
|
||||
t.workerFk,
|
||||
st.code stateCode,
|
||||
sub2.code tfStateCode
|
||||
sub2.code futureStateCode
|
||||
FROM vn.saleVolume sv
|
||||
JOIN vn.sale s ON s.id = sv.saleFk
|
||||
JOIN vn.item i ON i.id = s.itemFk
|
||||
|
@ -45,7 +45,7 @@ BEGIN
|
|||
SELECT *
|
||||
FROM (
|
||||
SELECT
|
||||
t.addressFk ,
|
||||
t.addressFk,
|
||||
t.id,
|
||||
t.shipped,
|
||||
st.name state,
|
||||
|
@ -68,6 +68,6 @@ BEGIN
|
|||
AND al.code = 'FREE'
|
||||
AND tp.ticketFk IS NULL
|
||||
GROUP BY sv.ticketFk
|
||||
HAVING ticketFuture;
|
||||
HAVING futureId;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -740,11 +740,11 @@ export default {
|
|||
linesMax: 'vn-textfield[label="Max Lines"]',
|
||||
litersMax: 'vn-textfield[label="Max Liters"]',
|
||||
ipt: 'vn-autocomplete[label="Origin IPT"]',
|
||||
tfIpt: 'vn-autocomplete[label="Destination IPT"]',
|
||||
futureIpt: 'vn-autocomplete[label="Destination IPT"]',
|
||||
tableIpt: 'vn-autocomplete[name="ipt"]',
|
||||
tableTfIpt: 'vn-autocomplete[name="tfIpt"]',
|
||||
tableFutureIpt: 'vn-autocomplete[name="futureIpt"]',
|
||||
state: 'vn-autocomplete[label="Origin Grouped State"]',
|
||||
tfState: 'vn-autocomplete[label="Destination Grouped State"]',
|
||||
futureState: 'vn-autocomplete[label="Destination Grouped State"]',
|
||||
warehouseFk: 'vn-autocomplete[label="Warehouse"]',
|
||||
problems: 'vn-check[label="With problems"]',
|
||||
tableButtonSearch: 'vn-button[vn-tooltip="Search"]',
|
||||
|
@ -753,7 +753,7 @@ export default {
|
|||
firstCheck: 'tbody > tr:nth-child(1) > td > vn-check',
|
||||
multiCheck: 'vn-multi-check',
|
||||
tableId: 'vn-textfield[name="id"]',
|
||||
tableTfId: 'vn-textfield[name="ticketFuture"]',
|
||||
tableFutureId: 'vn-textfield[name="futureId"]',
|
||||
tableLiters: 'vn-textfield[name="liters"]',
|
||||
|
||||
tableLines: 'vn-textfield[name="lines"]',
|
||||
submit: 'vn-submit[label="Search"]',
|
||||
|
|
|
@ -49,9 +49,9 @@ describe('Ticket Future path', () => {
|
|||
await page.waitToClick(selectors.ticketFuture.openAdvancedSearchButton);
|
||||
|
||||
await page.clearInput(selectors.ticketFuture.ipt);
|
||||
await page.clearInput(selectors.ticketFuture.tfIpt);
|
||||
await page.clearInput(selectors.ticketFuture.futureIpt);
|
||||
await page.clearInput(selectors.ticketFuture.state);
|
||||
await page.clearInput(selectors.ticketFuture.tfState);
|
||||
await page.clearInput(selectors.ticketFuture.futureState);
|
||||
|
||||
await page.autocompleteSearch(selectors.ticketFuture.ipt, 'Horizontal');
|
||||
await page.waitToClick(selectors.ticketFuture.submit);
|
||||
|
@ -62,11 +62,11 @@ describe('Ticket Future path', () => {
|
|||
await page.waitToClick(selectors.ticketFuture.openAdvancedSearchButton);
|
||||
|
||||
await page.clearInput(selectors.ticketFuture.ipt);
|
||||
await page.clearInput(selectors.ticketFuture.tfIpt);
|
||||
await page.clearInput(selectors.ticketFuture.futureIpt);
|
||||
await page.clearInput(selectors.ticketFuture.state);
|
||||
await page.clearInput(selectors.ticketFuture.tfState);
|
||||
await page.clearInput(selectors.ticketFuture.futureState);
|
||||
|
||||
await page.autocompleteSearch(selectors.ticketFuture.tfIpt, 'Horizontal');
|
||||
await page.autocompleteSearch(selectors.ticketFuture.futureIpt, 'Horizontal');
|
||||
await page.waitToClick(selectors.ticketFuture.submit);
|
||||
await page.waitForNumberOfElements(selectors.ticketFuture.table, 0);
|
||||
});
|
||||
|
@ -75,9 +75,9 @@ describe('Ticket Future path', () => {
|
|||
await page.waitToClick(selectors.ticketFuture.openAdvancedSearchButton);
|
||||
|
||||
await page.clearInput(selectors.ticketFuture.ipt);
|
||||
await page.clearInput(selectors.ticketFuture.tfIpt);
|
||||
await page.clearInput(selectors.ticketFuture.futureIpt);
|
||||
await page.clearInput(selectors.ticketFuture.state);
|
||||
await page.clearInput(selectors.ticketFuture.tfState);
|
||||
await page.clearInput(selectors.ticketFuture.futureState);
|
||||
|
||||
await page.autocompleteSearch(selectors.ticketFuture.state, 'Free');
|
||||
await page.waitToClick(selectors.ticketFuture.submit);
|
||||
|
@ -88,19 +88,19 @@ describe('Ticket Future path', () => {
|
|||
await page.waitToClick(selectors.ticketFuture.openAdvancedSearchButton);
|
||||
|
||||
await page.clearInput(selectors.ticketFuture.ipt);
|
||||
await page.clearInput(selectors.ticketFuture.tfIpt);
|
||||
await page.clearInput(selectors.ticketFuture.futureIpt);
|
||||
await page.clearInput(selectors.ticketFuture.state);
|
||||
await page.clearInput(selectors.ticketFuture.tfState);
|
||||
await page.clearInput(selectors.ticketFuture.futureState);
|
||||
|
||||
await page.autocompleteSearch(selectors.ticketFuture.tfState, 'Free');
|
||||
await page.autocompleteSearch(selectors.ticketFuture.futureState, 'Free');
|
||||
await page.waitToClick(selectors.ticketFuture.submit);
|
||||
await page.waitForNumberOfElements(selectors.ticketFuture.table, 0);
|
||||
|
||||
await page.waitToClick(selectors.ticketFuture.openAdvancedSearchButton);
|
||||
await page.clearInput(selectors.ticketFuture.ipt);
|
||||
await page.clearInput(selectors.ticketFuture.tfIpt);
|
||||
await page.clearInput(selectors.ticketFuture.futureIpt);
|
||||
await page.clearInput(selectors.ticketFuture.state);
|
||||
await page.clearInput(selectors.ticketFuture.tfState);
|
||||
await page.clearInput(selectors.ticketFuture.futureState);
|
||||
|
||||
await page.waitToClick(selectors.ticketFuture.submit);
|
||||
await page.waitForNumberOfElements(selectors.ticketFuture.table, 4);
|
||||
|
@ -120,7 +120,7 @@ describe('Ticket Future path', () => {
|
|||
|
||||
it('should search in smart-table with an ID Destination', async() => {
|
||||
await page.waitToClick(selectors.ticketFuture.tableButtonSearch);
|
||||
await page.write(selectors.ticketFuture.tableTfId, '12');
|
||||
await page.write(selectors.ticketFuture.tableFutureId, '12');
|
||||
await page.keyboard.press('Enter');
|
||||
await page.waitForNumberOfElements(selectors.ticketFuture.table, 5);
|
||||
|
||||
|
@ -143,7 +143,7 @@ describe('Ticket Future path', () => {
|
|||
|
||||
it('should search in smart-table with an IPT Destination', async() => {
|
||||
await page.waitToClick(selectors.ticketFuture.tableButtonSearch);
|
||||
await page.autocompleteSearch(selectors.ticketFuture.tableTfIpt, 'Vertical');
|
||||
await page.autocompleteSearch(selectors.ticketFuture.tableFutureIpt, 'Vertical');
|
||||
await page.waitForNumberOfElements(selectors.ticketFuture.table, 1);
|
||||
|
||||
await page.waitToClick(selectors.ticketFuture.tableButtonSearch);
|
||||
|
|
|
@ -140,7 +140,7 @@
|
|||
"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",
|
||||
"Email verify": "Email verify",
|
||||
"Ticket merged": "Ticket [{{id}}]({{{fullPath}}}) ({{{originDated}}}) merged with [{{tfId}}]({{{fullPathFuture}}}) ({{{futureDated}}})",
|
||||
"Ticket merged": "Ticket [{{originId}}]({{{originFullPath}}}) ({{{originDated}}}) merged with [{{destinationId}}]({{{destinationFullPath}}}) ({{{destinationDated}}})",
|
||||
"Sale(s) blocked, please contact production": "Sale(s) blocked, please contact production",
|
||||
"Receipt's bank was not found": "Receipt's bank was not found",
|
||||
"This receipt was not compensated": "This receipt was not compensated",
|
||||
|
|
|
@ -241,7 +241,7 @@
|
|||
"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",
|
||||
"Ticket merged": "Ticket [{{id}}]({{{fullPath}}}) ({{{originDated}}}) fusionado con [{{tfId}}]({{{fullPathFuture}}}) ({{{futureDated}}})",
|
||||
"Ticket merged": "Ticket [{{originId}}]({{{originFullPath}}}) ({{{originDated}}}) fusionado con [{{destinationId}}]({{{destinationFullPath}}}) ({{{destinationDated}}})",
|
||||
"Already has this status": "Ya tiene este estado",
|
||||
"There aren't records for this week": "No existen registros para esta semana",
|
||||
"Empty data source": "Origen de datos vacio",
|
||||
|
|
|
@ -27,13 +27,13 @@ module.exports = Self => {
|
|||
required: true
|
||||
},
|
||||
{
|
||||
arg: 'liters',
|
||||
arg: 'litersMax',
|
||||
type: 'number',
|
||||
description: 'Maximum volume of tickets to catapult',
|
||||
required: false
|
||||
},
|
||||
{
|
||||
arg: 'lines',
|
||||
arg: 'linesMax',
|
||||
type: 'number',
|
||||
description: 'Maximum number of lines of tickets to catapult',
|
||||
required: false
|
||||
|
@ -45,7 +45,7 @@ module.exports = Self => {
|
|||
required: false
|
||||
},
|
||||
{
|
||||
arg: 'tfIpt',
|
||||
arg: 'futureIpt',
|
||||
type: 'string',
|
||||
description: 'Destination Item Packaging Type',
|
||||
required: false
|
||||
|
@ -57,7 +57,7 @@ module.exports = Self => {
|
|||
required: false
|
||||
},
|
||||
{
|
||||
arg: 'tfId',
|
||||
arg: 'futureId',
|
||||
type: 'number',
|
||||
description: 'Destination id',
|
||||
required: false
|
||||
|
@ -69,7 +69,7 @@ module.exports = Self => {
|
|||
required: false
|
||||
},
|
||||
{
|
||||
arg: 'tfState',
|
||||
arg: 'futureState',
|
||||
type: 'string',
|
||||
description: 'Destination state',
|
||||
required: false
|
||||
|
@ -112,16 +112,16 @@ module.exports = Self => {
|
|||
return {'f.lines': {lte: value}};
|
||||
case 'liters':
|
||||
return {'f.liters': {lte: value}};
|
||||
case 'tfId':
|
||||
return {'f.ticketFuture': value};
|
||||
case 'futureId':
|
||||
return {'f.futureId': value};
|
||||
case 'ipt':
|
||||
return {'f.ipt': value};
|
||||
case 'tfIpt':
|
||||
return {'f.tfIpt': value};
|
||||
case 'futureIpt':
|
||||
return {'f.futureIpt': value};
|
||||
case 'state':
|
||||
return {'f.stateCode': {like: `%${value}%`}};
|
||||
case 'tfState':
|
||||
return {'f.tfStateCode': {like: `%${value}%`}};
|
||||
case 'futureState':
|
||||
return {'f.futureStateCode': {like: `%${value}%`}};
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@ const models = require('vn-loopback/server/server').models;
|
|||
describe('TicketFuture getTicketsFuture()', () => {
|
||||
const today = new Date();
|
||||
today.setHours(0, 0, 0, 0);
|
||||
const tomorrow = new Date(today.getDate() + 1);
|
||||
|
||||
it('should return the tickets passing the required data', async() => {
|
||||
const tx = await models.Ticket.beginTransaction({});
|
||||
|
@ -14,8 +13,6 @@ describe('TicketFuture getTicketsFuture()', () => {
|
|||
const args = {
|
||||
originDated: today,
|
||||
futureDated: today,
|
||||
litersMax: 9999,
|
||||
linesMax: 9999,
|
||||
warehouseFk: 1,
|
||||
};
|
||||
|
||||
|
@ -39,8 +36,6 @@ describe('TicketFuture getTicketsFuture()', () => {
|
|||
const args = {
|
||||
originDated: today,
|
||||
futureDated: today,
|
||||
litersMax: 9999,
|
||||
linesMax: 9999,
|
||||
warehouseFk: 1,
|
||||
problems: true
|
||||
};
|
||||
|
@ -66,8 +61,6 @@ describe('TicketFuture getTicketsFuture()', () => {
|
|||
const args = {
|
||||
originDated: today,
|
||||
futureDated: today,
|
||||
litersMax: 9999,
|
||||
linesMax: 9999,
|
||||
warehouseFk: 1,
|
||||
problems: false
|
||||
};
|
||||
|
@ -93,8 +86,6 @@ describe('TicketFuture getTicketsFuture()', () => {
|
|||
const args = {
|
||||
originDated: today,
|
||||
futureDated: today,
|
||||
litersMax: 9999,
|
||||
linesMax: 9999,
|
||||
warehouseFk: 1,
|
||||
problems: null
|
||||
};
|
||||
|
@ -120,8 +111,6 @@ describe('TicketFuture getTicketsFuture()', () => {
|
|||
const args = {
|
||||
originDated: today,
|
||||
futureDated: today,
|
||||
litersMax: 9999,
|
||||
linesMax: 9999,
|
||||
warehouseFk: 1,
|
||||
state: 'OK'
|
||||
};
|
||||
|
@ -147,10 +136,8 @@ describe('TicketFuture getTicketsFuture()', () => {
|
|||
const args = {
|
||||
originDated: today,
|
||||
futureDated: today,
|
||||
litersMax: 9999,
|
||||
linesMax: 9999,
|
||||
warehouseFk: 1,
|
||||
tfState: 'OK'
|
||||
futureState: 'OK'
|
||||
};
|
||||
|
||||
const ctx = {req: {accessToken: {userId: 9}}, args};
|
||||
|
@ -174,8 +161,6 @@ describe('TicketFuture getTicketsFuture()', () => {
|
|||
const args = {
|
||||
originDated: today,
|
||||
futureDated: today,
|
||||
litersMax: 9999,
|
||||
linesMax: 9999,
|
||||
warehouseFk: 1,
|
||||
ipt: null
|
||||
};
|
||||
|
@ -201,8 +186,6 @@ describe('TicketFuture getTicketsFuture()', () => {
|
|||
const args = {
|
||||
originDated: today,
|
||||
futureDated: today,
|
||||
litersMax: 9999,
|
||||
linesMax: 9999,
|
||||
warehouseFk: 1,
|
||||
ipt: 0
|
||||
};
|
||||
|
@ -228,10 +211,8 @@ describe('TicketFuture getTicketsFuture()', () => {
|
|||
const args = {
|
||||
originDated: today,
|
||||
futureDated: today,
|
||||
litersMax: 9999,
|
||||
linesMax: 9999,
|
||||
warehouseFk: 1,
|
||||
tfIpt: null
|
||||
futureIpt: null
|
||||
};
|
||||
|
||||
const ctx = {req: {accessToken: {userId: 9}}, args};
|
||||
|
@ -255,10 +236,8 @@ describe('TicketFuture getTicketsFuture()', () => {
|
|||
const args = {
|
||||
originDated: today,
|
||||
futureDated: today,
|
||||
litersMax: 9999,
|
||||
linesMax: 9999,
|
||||
warehouseFk: 1,
|
||||
tfIpt: 0
|
||||
futureIpt: 0
|
||||
};
|
||||
|
||||
const ctx = {req: {accessToken: {userId: 9}}, args};
|
||||
|
@ -282,8 +261,6 @@ describe('TicketFuture getTicketsFuture()', () => {
|
|||
const args = {
|
||||
originDated: today,
|
||||
futureDated: today,
|
||||
litersMax: 9999,
|
||||
linesMax: 9999,
|
||||
warehouseFk: 1,
|
||||
id: 13
|
||||
};
|
||||
|
@ -309,10 +286,8 @@ describe('TicketFuture getTicketsFuture()', () => {
|
|||
const args = {
|
||||
originDated: today,
|
||||
futureDated: today,
|
||||
litersMax: 9999,
|
||||
linesMax: 9999,
|
||||
warehouseFk: 1,
|
||||
tfId: 12
|
||||
futureId: 12
|
||||
};
|
||||
|
||||
const ctx = {req: {accessToken: {userId: 9}}, args};
|
||||
|
|
|
@ -40,32 +40,32 @@ module.exports = Self => {
|
|||
|
||||
try {
|
||||
for (let ticket of tickets) {
|
||||
const fullPath = `${origin}/#!/ticket/${ticket.id}/summary`;
|
||||
const fullPathFuture = `${origin}/#!/ticket/${ticket.ticketFuture}/summary`;
|
||||
const originFullPath = `${origin}/#!/ticket/${ticket.originId}/summary`;
|
||||
const destinationFullPath = `${origin}/#!/ticket/${ticket.destinationId}/summary`;
|
||||
const message = $t('Ticket merged', {
|
||||
originDated: dateUtil.toString(new Date(ticket.shipped)),
|
||||
futureDated: dateUtil.toString(new Date(ticket.tfShipped)),
|
||||
id: ticket.id,
|
||||
tfId: ticket.ticketFuture,
|
||||
fullPath,
|
||||
fullPathFuture
|
||||
originDated: dateUtil.toString(new Date(ticket.originShipped)),
|
||||
destinationDated: dateUtil.toString(new Date(ticket.destinationShipped)),
|
||||
alexandre marked this conversation as resolved
Outdated
jgallego
commented
que es tf? llegint veig que es abreviatura de ticket future. que es tf? llegint veig que es abreviatura de ticket future.
Com ticket ja es sap jo posaria ticket.futureShipped
|
||||
originId: ticket.originId,
|
||||
destinationId: ticket.destinationId,
|
||||
originFullPath,
|
||||
destinationFullPath
|
||||
});
|
||||
if (!ticket.id || !ticket.ticketFuture) continue;
|
||||
if (!ticket.originId || !ticket.destinationId) continue;
|
||||
|
||||
const ticketFutureLogRecord = {
|
||||
originFk: ticket.ticketFuture,
|
||||
const ticketDestinationLogRecord = {
|
||||
originFk: ticket.destinationId,
|
||||
userFk: ctx.req.accessToken.userId,
|
||||
action: 'update',
|
||||
changedModel: 'Ticket',
|
||||
changedModelId: ticket.ticketFuture,
|
||||
changedModelValue: ticket.ticketFuture,
|
||||
changedModelId: ticket.destinationId,
|
||||
changedModelValue: ticket.destinationId,
|
||||
oldInstance: {},
|
||||
newInstance: {mergedTicket: ticket.id}
|
||||
newInstance: {mergedTicket: ticket.originId}
|
||||
};
|
||||
|
||||
await models.TicketLog.create(ticketFutureLogRecord, myOptions);
|
||||
await models.Sale.updateAll({ticketFk: ticket.id}, {ticketFk: ticket.ticketFuture}, myOptions);
|
||||
await models.Ticket.setDeleted(ctx, ticket.id, myOptions);
|
||||
await models.TicketLog.create(ticketDestinationLogRecord, myOptions);
|
||||
await models.Sale.updateAll({ticketFk: ticket.originId}, {ticketFk: ticket.destinationId}, myOptions);
|
||||
await models.Ticket.setDeleted(ctx, ticket.originId, myOptions);
|
||||
await models.Chat.sendCheckingPresence(ctx, ticket.workerFk, message);
|
||||
}
|
||||
if (tx)
|
||||
|
|
|
@ -3,15 +3,15 @@ const LoopBackContext = require('loopback-context');
|
|||
|
||||
describe('ticket merge()', () => {
|
||||
const tickets = [{
|
||||
id: 13,
|
||||
ticketFuture: 12,
|
||||
workerFk: 1,
|
||||
originETD: new Date(),
|
||||
destETD: new Date()
|
||||
originId: 13,
|
||||
destinationId: 12,
|
||||
originShipped: new Date(),
|
||||
destinationShipped: new Date(),
|
||||
workerFk: 1
|
||||
}];
|
||||
|
||||
const activeCtx = {
|
||||
accessToken: { userId: 9 },
|
||||
accessToken: {userId: 9},
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
|
@ -22,26 +22,26 @@ describe('ticket merge()', () => {
|
|||
|
||||
const ctx = {
|
||||
req: {
|
||||
accessToken: { userId: 9 },
|
||||
headers: { origin: 'http://localhost:5000' },
|
||||
accessToken: {userId: 9},
|
||||
headers: {origin: 'http://localhost:5000'},
|
||||
}
|
||||
};
|
||||
ctx.req.__ = value => {
|
||||
return value;
|
||||
};
|
||||
|
||||
it('should merge two tickets', async () => {
|
||||
it('should merge two tickets', async() => {
|
||||
const tx = await models.Ticket.beginTransaction({});
|
||||
|
||||
try {
|
||||
const options = { transaction: tx };
|
||||
const options = {transaction: tx};
|
||||
const chatNotificationBeforeMerge = await models.Chat.find();
|
||||
|
||||
await models.Ticket.merge(ctx, tickets, options);
|
||||
|
||||
const createdTicketLog = await models.TicketLog.find({ where: { originFk: tickets[0].id } }, options);
|
||||
const deletedTicket = await models.Ticket.findOne({ where: { id: tickets[0].id } }, options);
|
||||
const salesTicketFuture = await models.Sale.find({ where: { ticketFk: tickets[0].ticketFuture } }, options);
|
||||
const createdTicketLog = await models.TicketLog.find({where: {originFk: tickets[0].originId}}, options);
|
||||
const deletedTicket = await models.Ticket.findOne({where: {id: tickets[0].originId}}, options);
|
||||
const salesTicketFuture = await models.Sale.find({where: {ticketFk: tickets[0].destinationId}}, options);
|
||||
const chatNotificationAfterMerge = await models.Chat.find();
|
||||
|
||||
expect(createdTicketLog.length).toEqual(1);
|
||||
|
|
|
@ -18,12 +18,12 @@
|
|||
<vn-textfield
|
||||
vn-one
|
||||
label="Max Liters"
|
||||
ng-model="filter.liters">
|
||||
ng-model="filter.litersMax">
|
||||
</vn-textfield>
|
||||
<vn-textfield
|
||||
vn-one
|
||||
label="Max Lines"
|
||||
ng-model="filter.lines">
|
||||
ng-model="filter.linesMax">
|
||||
</vn-textfield>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal class="vn-px-lg">
|
||||
|
@ -43,7 +43,7 @@
|
|||
label="Destination IPT"
|
||||
value-field="code"
|
||||
show-field="description"
|
||||
ng-model="filter.tfIpt"
|
||||
ng-model="filter.futureIpt"
|
||||
info="IPT">
|
||||
<tpl-item>
|
||||
{{description}}
|
||||
|
@ -66,7 +66,7 @@
|
|||
label="Destination Grouped State"
|
||||
value-field="code"
|
||||
show-field="name"
|
||||
ng-model="filter.tfState">
|
||||
ng-model="filter.futureState">
|
||||
<tpl-item>
|
||||
{{name}}
|
||||
</tpl-item>
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
<vn-crud-model
|
||||
vn-id="model"
|
||||
url="Tickets/getTicketsFuture"
|
||||
limit="20"
|
||||
auto-load="true"
|
||||
params="model.data">
|
||||
auto-load="false">
|
||||
</vn-crud-model>
|
||||
<vn-portal slot="topbar">
|
||||
<vn-searchbar
|
||||
|
@ -45,7 +43,7 @@
|
|||
check-field="checked">
|
||||
</vn-multi-check>
|
||||
</th>
|
||||
<th field="problems">
|
||||
<th field="totalProblems">
|
||||
<span translate>Problems</span>
|
||||
</th>
|
||||
<th field="id">
|
||||
|
@ -66,16 +64,16 @@
|
|||
<th shrink field="lines">
|
||||
<span translate>Available Lines</span>
|
||||
</th>
|
||||
<th field="ticketFuture" separator>
|
||||
<th field="futureId" separator>
|
||||
<span translate>ID</span>
|
||||
</th>
|
||||
<th field="tfShipped">
|
||||
<th field="futureShipped">
|
||||
<span translate>Date</span>
|
||||
</th>
|
||||
<th field="tfIpt" title="Item Packing Type">
|
||||
<th field="futureIpt" title="Item Packing Type">
|
||||
<span>IPT</span>
|
||||
</th>
|
||||
<th shrink field="tfState">
|
||||
<th shrink field="futureState">
|
||||
<span translate>State</span>
|
||||
</th>
|
||||
</tr>
|
||||
|
@ -147,21 +145,21 @@
|
|||
<td>{{::ticket.lines}}</td>
|
||||
<td>
|
||||
<span
|
||||
ng-click="ticketDescriptor.show($event, ticket.ticketFuture)"
|
||||
ng-click="ticketDescriptor.show($event, ticket.futureId)"
|
||||
class="link">
|
||||
{{::ticket.ticketFuture}}
|
||||
{{::ticket.futureId}}
|
||||
</span>
|
||||
</td>
|
||||
<td shrink-date>
|
||||
<span class="chip {{$ctrl.compareDate(ticket.tfShipped)}}">
|
||||
{{::ticket.tfShipped | date: 'dd/MM/yyyy'}}
|
||||
<span class="chip {{$ctrl.compareDate(ticket.futureShipped)}}">
|
||||
{{::ticket.futureShipped | date: 'dd/MM/yyyy'}}
|
||||
</span>
|
||||
</td>
|
||||
<td>{{::ticket.tfIpt}}</td>
|
||||
<td>{{::ticket.futureIpt}}</td>
|
||||
<td>
|
||||
<span
|
||||
class="chip {{$ctrl.stateColor(ticket.tfState)}}">
|
||||
{{::ticket.tfState}}
|
||||
class="chip {{$ctrl.stateColor(ticket.futureState)}}">
|
||||
{{::ticket.futureState}}
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
@ -11,15 +11,15 @@ export default class Controller extends Section {
|
|||
search: true,
|
||||
},
|
||||
columns: [{
|
||||
field: 'problems',
|
||||
searchable: false
|
||||
field: 'totalProblems',
|
||||
searchable: false,
|
||||
},
|
||||
{
|
||||
field: 'shipped',
|
||||
searchable: false
|
||||
},
|
||||
{
|
||||
field: 'tfShipped',
|
||||
field: 'futureShipped',
|
||||
searchable: false
|
||||
},
|
||||
{
|
||||
|
@ -27,7 +27,7 @@ export default class Controller extends Section {
|
|||
searchable: false
|
||||
},
|
||||
{
|
||||
field: 'tfState',
|
||||
field: 'futureState',
|
||||
searchable: false
|
||||
},
|
||||
{
|
||||
|
@ -39,7 +39,7 @@ export default class Controller extends Section {
|
|||
}
|
||||
},
|
||||
{
|
||||
field: 'tfIpt',
|
||||
field: 'futureIpt',
|
||||
autocomplete: {
|
||||
url: 'ItemPackingTypes',
|
||||
showField: 'description',
|
||||
|
@ -48,6 +48,9 @@ export default class Controller extends Section {
|
|||
},
|
||||
]
|
||||
};
|
||||
}
|
||||
|
||||
$postLink() {
|
||||
this.setDefaultFilter();
|
||||
}
|
||||
|
||||
|
@ -59,9 +62,7 @@ export default class Controller extends Section {
|
|||
futureDated: today,
|
||||
warehouseFk: this.vnConfig.warehouseFk
|
||||
};
|
||||
this.$.model = {
|
||||
data: this.filterParams
|
||||
};
|
||||
this.$.model.applyFilter(null, this.filterParams);
|
||||
}
|
||||
|
||||
compareDate(date) {
|
||||
|
@ -114,7 +115,17 @@ export default class Controller extends Section {
|
|||
}
|
||||
|
||||
moveTicketsFuture() {
|
||||
let params = {tickets: this.checked};
|
||||
let ticketsToMove = [];
|
||||
this.checked.forEach(ticket => {
|
||||
ticketsToMove.push({
|
||||
originId: ticket.id,
|
||||
destinationId: ticket.futureId,
|
||||
originShipped: ticket.shipped,
|
||||
destinationShipped: ticket.futureShipped,
|
||||
workerFk: ticket.workerFk
|
||||
});
|
||||
});
|
||||
let params = {tickets: ticketsToMove};
|
||||
return this.$http.post('Tickets/merge', params)
|
||||
.then(() => {
|
||||
this.$.model.refresh();
|
||||
|
@ -126,16 +137,16 @@ export default class Controller extends Section {
|
|||
switch (param) {
|
||||
case 'id':
|
||||
return {'id': value};
|
||||
case 'ticketFuture':
|
||||
return {'ticketFuture': value};
|
||||
case 'futureId':
|
||||
return {'futureId': value};
|
||||
case 'liters':
|
||||
return {'liters': value};
|
||||
case 'lines':
|
||||
return {'lines': value};
|
||||
case 'ipt':
|
||||
return {'ipt': value};
|
||||
case 'tfIpt':
|
||||
return {'tfIpt': value};
|
||||
case 'futureIpt':
|
||||
return {'futureIpt': value};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,16 +2,14 @@ import './index.js';
|
|||
import crudModel from 'core/mocks/crud-model';
|
||||
|
||||
describe('Component vnTicketFuture', () => {
|
||||
const today = new Date();
|
||||
let controller;
|
||||
let $httpBackend;
|
||||
let $window;
|
||||
|
||||
beforeEach(ngModule('ticket')
|
||||
);
|
||||
beforeEach(ngModule('ticket'));
|
||||
|
||||
beforeEach(inject(($componentController, _$window_, _$httpBackend_) => {
|
||||
beforeEach(inject(($componentController, _$httpBackend_) => {
|
||||
$httpBackend = _$httpBackend_;
|
||||
$window = _$window_;
|
||||
const $element = angular.element('<vn-ticket-future></vn-ticket-future>');
|
||||
controller = $componentController('vnTicketFuture', {$element});
|
||||
controller.$.model = crudModel;
|
||||
|
@ -28,7 +26,6 @@ describe('Component vnTicketFuture', () => {
|
|||
|
||||
describe('compareDate()', () => {
|
||||
it('should return warning when the date is the present', () => {
|
||||
let today = new Date();
|
||||
let result = controller.compareDate(today);
|
||||
|
||||
expect(result).toEqual('warning');
|
||||
|
@ -83,18 +80,14 @@ describe('Component vnTicketFuture', () => {
|
|||
|
||||
describe('dateRange()', () => {
|
||||
it('should return two dates with the hours at the start and end of the given date', () => {
|
||||
const now = new Date();
|
||||
|
||||
const today = now.getDate();
|
||||
|
||||
const dateRange = controller.dateRange(now);
|
||||
const dateRange = controller.dateRange(today);
|
||||
const start = dateRange[0].toString();
|
||||
const end = dateRange[1].toString();
|
||||
|
||||
expect(start).toContain(today);
|
||||
expect(start).toContain(today.getDate());
|
||||
expect(start).toContain('00:00:00');
|
||||
|
||||
expect(end).toContain(today);
|
||||
expect(end).toContain(today.getDate());
|
||||
expect(end).toContain('23:59:59');
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue
perque canvies el nom? l'anterior a mi em pareixia correcte, no son litros exactes, sino litros màxims
Ho he tingut que posar aixina perque com en el procediment se diu 'lines' i 'liters' al ordenar me donava error. En veritat no passa res perque en el buscador ja apareix que son litres i linies màximes.