Merge pull request 'removed deprecated stowaway comp and usages' (#1019) from 3076-remove_stowaway into dev
gitea/salix/pipeline/head This commit is unstable Details

Reviewed-on: #1019
Reviewed-by: Joan Sanchez <joan@verdnatura.es>
This commit is contained in:
Joan Sanchez 2022-07-01 07:47:53 +00:00
commit e85cf47f6f
39 changed files with 27 additions and 888 deletions

View File

@ -24,9 +24,6 @@
}, },
"isManaged":{ "isManaged":{
"type": "boolean" "type": "boolean"
},
"hasStowaway":{
"type": "boolean"
} }
}, },
"acls": [ "acls": [

View File

@ -139,14 +139,14 @@ INSERT INTO `vn`.`warehouseAlias`(`id`, `name`)
(1, 'Main Warehouse'), (1, 'Main Warehouse'),
(2, 'Gotham'); (2, 'Gotham');
INSERT INTO `vn`.`warehouse`(`id`, `name`, `code`, `isComparative`, `isInventory`, `hasAvailable`, `isManaged`, `hasStowaway`, `hasDms`, `hasComission`, `aliasFk`, `countryFk`, `hasProduction`) INSERT INTO `vn`.`warehouse`(`id`, `name`, `code`, `isComparative`, `isInventory`, `hasAvailable`, `isManaged`, `hasDms`, `hasComission`, `aliasFk`, `countryFk`, `hasProduction`)
VALUES VALUES
(1, 'Warehouse One', 'ALG', 1, 1, 1, 1, 1, 1, 1, 2, 1, 1), (1, 'Warehouse One', 'ALG', 1, 1, 1, 1, 1, 1, 2, 1, 1),
(2, 'Warehouse Two', NULL, 1, 1, 1, 1, 0, 0, 1, 2, 13, 1), (2, 'Warehouse Two', NULL, 1, 1, 1, 1, 0, 1, 2, 13, 1),
(3, 'Warehouse Three', NULL, 1, 1, 1, 1, 0, 0, 0, 2, 1, 1), (3, 'Warehouse Three', NULL, 1, 1, 1, 1, 0, 0, 2, 1, 1),
(4, 'Warehouse Four', NULL, 1, 1, 1, 1, 0, 0, 0, 2, 1, 1), (4, 'Warehouse Four', NULL, 1, 1, 1, 1, 0, 0, 2, 1, 1),
(5, 'Warehouse Five', NULL, 1, 1, 1, 1, 0, 0, 0, 2, 1, 1), (5, 'Warehouse Five', NULL, 1, 1, 1, 1, 0, 0, 2, 1, 1),
(13, 'Inventory', NULL, 1, 1, 1, 0, 0, 0, 0, 2, 1, 0); (13, 'Inventory', NULL, 1, 1, 1, 0, 0, 0, 2, 1, 0);
INSERT INTO `vn`.`sector`(`id`, `description`, `warehouseFk`, `isPreviousPreparedByPacking`, `code`) INSERT INTO `vn`.`sector`(`id`, `description`, `warehouseFk`, `isPreviousPreparedByPacking`, `code`)
VALUES VALUES
@ -698,10 +698,6 @@ INSERT INTO `vn`.`ticketTracking`(`ticketFk`, `stateFk`, `workerFk`, `created`)
(23, 16, 21, util.VN_NOW()), (23, 16, 21, util.VN_NOW()),
(24, 16, 21, util.VN_NOW()); (24, 16, 21, util.VN_NOW());
INSERT INTO `vn`.`stowaway`(`id`, `shipFk`, `created`)
VALUES
(12, 13, util.VN_CURDATE());
INSERT INTO `vn`.`deliveryPoint` (`id`, `name`, `ubication`) INSERT INTO `vn`.`deliveryPoint` (`id`, `name`, `ubication`)
VALUES VALUES
(1, 'Gotham','1007 Mountain Drive, Gotham'); (1, 'Gotham','1007 Mountain Drive, Gotham');

View File

@ -565,8 +565,6 @@ export default {
isDeletedIcon: 'vn-ticket-descriptor vn-icon[icon="icon-deletedTicket"]', isDeletedIcon: 'vn-ticket-descriptor vn-icon[icon="icon-deletedTicket"]',
goBackToModuleIndexButton: 'vn-ticket-descriptor a[ui-sref="ticket.index"]', goBackToModuleIndexButton: 'vn-ticket-descriptor a[ui-sref="ticket.index"]',
moreMenu: 'vn-ticket-descriptor vn-ticket-descriptor-menu > vn-icon-button[icon=more_vert]', moreMenu: 'vn-ticket-descriptor vn-ticket-descriptor-menu > vn-icon-button[icon=more_vert]',
moreMenuAddStowaway: '.vn-menu [name="addStowaway"]',
moreMenuDeleteStowawayButton: '.vn-menu [name="deleteStowaway"]',
moreMenuAddToTurn: '.vn-menu [name="addTurn"]', moreMenuAddToTurn: '.vn-menu [name="addTurn"]',
moreMenuDeleteTicket: '.vn-menu [name="deleteTicket"]', moreMenuDeleteTicket: '.vn-menu [name="deleteTicket"]',
moreMenuRestoreTicket: '.vn-menu [name="restoreTicket"]', moreMenuRestoreTicket: '.vn-menu [name="restoreTicket"]',
@ -579,8 +577,6 @@ export default {
sendSMSbutton: 'button[response="accept"]', sendSMSbutton: 'button[response="accept"]',
changeShippedHourDialog: '.vn-dialog.shown', changeShippedHourDialog: '.vn-dialog.shown',
changeShippedHour: '.vn-dialog.shown vn-input-time[ng-model="$ctrl.newShipped"]', changeShippedHour: '.vn-dialog.shown vn-input-time[ng-model="$ctrl.newShipped"]',
addStowawayDialogFirstTicket: '.vn-dialog.shown vn-table vn-tbody vn-tr',
shipButton: 'vn-ticket-descriptor vn-icon[icon="icon-stowaway"]',
thursdayButton: '.vn-popup.shown vn-tool-bar > vn-button:nth-child(4)', thursdayButton: '.vn-popup.shown vn-tool-bar > vn-button:nth-child(4)',
saturdayButton: '.vn-popup.shown vn-tool-bar > vn-button:nth-child(6)', saturdayButton: '.vn-popup.shown vn-tool-bar > vn-button:nth-child(6)',
acceptDialog: '.vn-dialog.shown button[response="accept"]', acceptDialog: '.vn-dialog.shown button[response="accept"]',
@ -588,7 +584,6 @@ export default {
descriptorDeliveryDate: 'vn-ticket-descriptor slot-body > .attributes > vn-label-value:nth-child(4) > section > span', descriptorDeliveryDate: 'vn-ticket-descriptor slot-body > .attributes > vn-label-value:nth-child(4) > section > span',
descriptorDeliveryAgency: 'vn-ticket-descriptor slot-body > .attributes > vn-label-value:nth-child(5) > section > span', descriptorDeliveryAgency: 'vn-ticket-descriptor slot-body > .attributes > vn-label-value:nth-child(5) > section > span',
acceptInvoiceOutButton: '.vn-confirm.shown button[response="accept"]', acceptInvoiceOutButton: '.vn-confirm.shown button[response="accept"]',
acceptDeleteStowawayButton: '.vn-dialog.shown button[response="accept"]'
}, },
ticketNotes: { ticketNotes: {
firstNoteRemoveButton: 'vn-icon[icon="delete"]', firstNoteRemoveButton: 'vn-icon[icon="delete"]',

View File

@ -45,7 +45,7 @@ describe('Client Add address path', () => {
expect(province).toContain('Province five'); expect(province).toContain('Province five');
}); });
it(`should receive an error after clicking save button as consignee, incoterms and customsAgent are empty`, async() => { it(`should throw after clicking save button as consignee, incoterms and customsAgent are empty`, async() => {
await page.write(selectors.clientAddresses.consignee, 'Bruce Bunner'); await page.write(selectors.clientAddresses.consignee, 'Bruce Bunner');
await page.write(selectors.clientAddresses.streetAddress, '320 Park Avenue New York'); await page.write(selectors.clientAddresses.streetAddress, '320 Park Avenue New York');
await page.waitToClick(selectors.clientAddresses.saveButton); await page.waitToClick(selectors.clientAddresses.saveButton);

View File

@ -75,59 +75,6 @@ describe('Ticket descriptor path', () => {
}); });
}); });
describe('Add stowaway', () => {
it('should search for a ticket', async() => {
await page.accessToSearchResult('16');
await page.waitForState('ticket.card.summary');
});
it('should open the add stowaway dialog', async() => {
await page.waitForFunction(() => {
let element = document.querySelector('vn-ticket-descriptor-menu');
return element.$ctrl.canShowStowaway === true;
});
await page.waitToClick(selectors.ticketDescriptor.moreMenu);
await page.waitToClick(selectors.ticketDescriptor.moreMenuAddStowaway);
await page.waitForSelector(selectors.ticketDescriptor.addStowawayDialogFirstTicket);
const isVisible = await page.isVisible(selectors.ticketDescriptor.addStowawayDialogFirstTicket);
expect(isVisible).toBeTruthy();
});
it('should add a ticket as stowaway', async() => {
await page.waitToClick(selectors.ticketDescriptor.addStowawayDialogFirstTicket);
const message = await page.waitForSnackbar();
expect(message.text).toContain('Data saved!');
});
it(`should check the state of the stowaway ticket is embarked`, async() => {
await page.waitForState('ticket.card.summary');
const state = await page.waitToGetProperty(selectors.ticketDescriptor.stateLabelValue, 'innerText');
expect(state).toEqual('State Embarcando');
});
it(`should navigate back to the added ticket using the descriptors ship button`, async() => {
await page.waitToClick(selectors.ticketDescriptor.shipButton);
await page.waitForState('ticket.card.summary');
});
it('should delete the stowaway', async() => {
await page.waitToClick(selectors.ticketDescriptor.moreMenu);
await page.waitForContentLoaded();
await page.waitToClick(selectors.ticketDescriptor.moreMenuDeleteStowawayButton);
await page.waitToClick(selectors.ticketDescriptor.acceptDeleteStowawayButton);
const message = await page.waitForSnackbar();
expect(message.text).toContain('Data saved!');
});
it(`should confirm the ship buton doesn't exisist any more`, async() => {
await page.waitForSelector(selectors.ticketDescriptor.shipButton, {hidden: true});
});
});
describe('Make invoice', () => { describe('Make invoice', () => {
it('should login as administrative role then search for a ticket', async() => { it('should login as administrative role then search for a ticket', async() => {
const invoiceableTicketId = '14'; const invoiceableTicketId = '14';

View File

@ -6,7 +6,6 @@ describe('Ticket create path', () => {
let page; let page;
let nextMonth = new Date(); let nextMonth = new Date();
nextMonth.setMonth(nextMonth.getMonth() + 1); nextMonth.setMonth(nextMonth.getMonth() + 1);
let stowawayTicketId;
beforeAll(async() => { beforeAll(async() => {
browser = await getBrowser(); browser = await getBrowser();
@ -36,8 +35,6 @@ describe('Ticket create path', () => {
it('should check the url is now the summary of the ticket', async() => { it('should check the url is now the summary of the ticket', async() => {
await page.waitForState('ticket.card.summary'); await page.waitForState('ticket.card.summary');
stowawayTicketId = await page.waitToGetProperty(selectors.ticketSummary.descriptorTicketId, 'innerText');
stowawayTicketId = stowawayTicketId.substring(1);
}); });
it('should again open the new ticket form', async() => { it('should again open the new ticket form', async() => {
@ -61,15 +58,6 @@ describe('Ticket create path', () => {
await page.waitForState('ticket.card.summary'); await page.waitForState('ticket.card.summary');
}); });
it('should make the previously created ticket the stowaway of the current ticket', async() => {
await page.waitToClick(selectors.ticketDescriptor.moreMenu);
await page.waitToClick(selectors.ticketDescriptor.moreMenuAddStowaway);
await page.waitToClick(selectors.ticketDescriptor.addStowawayDialogFirstTicket);
const message = await page.waitForSnackbar();
expect(message.text).toContain('Data saved!');
});
it('should delete the current ticket', async() => { it('should delete the current ticket', async() => {
await page.waitToClick(selectors.ticketDescriptor.moreMenu); await page.waitToClick(selectors.ticketDescriptor.moreMenu);
await page.waitToClick(selectors.ticketDescriptor.moreMenuDeleteTicket); await page.waitToClick(selectors.ticketDescriptor.moreMenuDeleteTicket);
@ -78,11 +66,4 @@ describe('Ticket create path', () => {
expect(message.text).toContain('Ticket deleted. You can undo this action within the first hour'); expect(message.text).toContain('Ticket deleted. You can undo this action within the first hour');
}); });
it('should search for the stowaway ticket of the previously deleted ticket', async() => {
await page.accessToSearchResult(stowawayTicketId);
const result = await page.countElement(selectors.ticketDescriptor.shipButton);
expect(result).toBe(0);
});
}); });

View File

@ -343,9 +343,6 @@
.icon-splur:before { .icon-splur:before {
content: "\e970"; content: "\e970";
} }
.icon-stowaway:before {
content: "\e94f";
}
.icon-supplier:before { .icon-supplier:before {
content: "\e925"; content: "\e925";
} }

View File

@ -85,8 +85,6 @@
<glyph unicode="&#xe94b;" glyph-name="deaulter" d="M677.973-64c-30.72 35.84-61.867 70.827-91.307 107.52-40.96 51.2-80.64 103.253-121.173 154.88-16.64 21.333-21.76 20.48-30.72-4.693-13.227-36.693-25.6-73.387-40.107-109.653-5.12-12.8-13.227-26.88-24.32-34.56-51.627-34.987-104.107-69.12-157.867-100.693-10.667-6.4-30.72-5.547-41.813 0.853-8.107 4.693-12.373 23.893-11.093 35.84 0.853 8.96 11.093 19.627 19.627 25.6 39.253 26.453 78.933 51.627 119.040 76.8 18.347 11.52 30.293 26.027 35.84 47.787 12.373 48.213 27.307 95.573 39.253 143.36 8.533 33.707 26.88 58.88 56.32 77.227 40.533 25.173 80.64 52.053 120.747 78.507 6.4 4.267 10.24 11.52 15.36 17.493-7.253 2.56-14.933 7.253-22.187 6.827-75.52-6.4-151.467-13.227-226.987-20.48-2.133 0-4.693-0.853-6.827-0.853-22.613-1.707-39.253 10.24-40.96 29.867s12.373 33.707 35.413 35.84c45.227 4.267 90.88 8.96 136.107 12.8 65.707 5.547 131.84 10.667 197.547 15.36 26.027 1.707 53.76-21.76 67.413-55.467 9.813-23.893 5.12-46.080-18.347-65.28-49.92-40.107-100.693-78.933-151.040-118.187-23.040-17.92-23.893-23.467-6.4-46.507 58.453-78.080 116.48-156.587 174.933-234.667 27.307-36.693 25.173-50.773-12.373-75.52-5.12 0-9.813 0-14.080 0zM791.893 649.813c-43.093 1.28-76.373-31.573-77.227-75.52-0.853-44.373 29.44-76.8 72.107-77.653 45.227-1.28 77.653 29.44 78.080 73.813 0.427 45.227-29.44 78.080-72.96 79.36zM671.147 737.707c0-72.107-34.133-136.107-87.467-176.64l-235.52-21.76c-72.107 36.693-122.027 111.787-122.027 198.4 0 122.88 99.84 222.293 222.72 222.293 122.453 0 222.293-99.413 222.293-222.293zM592.213 680.533l-50.347 18.347c-2.133-8.533-5.12-16.213-9.813-22.613-5.12-6.4-10.24-11.947-16.213-17.067-5.973-4.267-12.373-8.107-19.2-11.093s-13.653-4.693-20.053-5.547c-17.92-2.987-33.707-0.427-48.64 6.827s-26.88 18.347-36.693 32.853l76.373 12.373 7.253 32.427-97.28-15.787c-1.28 5.547-2.987 11.093-3.84 16.64l-0.853 4.267 99.413 16.213 7.253 32.427-106.667-17.493c0.853 9.387 2.987 17.493 6.4 26.027 3.84 8.533 8.107 16.213 14.080 23.040 5.547 6.827 12.8 12.373 21.333 17.067s17.92 8.107 28.587 9.813c6.827 1.28 13.227 1.707 20.907 1.28s14.507-1.707 21.333-3.84c6.827-2.133 13.653-5.973 20.053-10.24 5.973-4.693 11.947-11.093 17.493-18.773l38.827 37.973c-13.227 17.92-30.293 31.147-52.053 39.253-21.76 8.533-46.080 10.667-73.387 6.4-19.627-2.987-36.267-9.387-51.2-17.92-14.507-8.533-26.88-19.2-37.547-32-10.667-12.373-18.773-26.027-23.893-40.96-5.547-14.507-8.96-29.867-9.813-45.653l-21.76-3.84-7.253-32.427 29.013 4.693 0.427-2.987c1.28-6.827 2.56-12.8 4.267-18.347l-23.467-3.84-8.107-32.427 43.52 7.253c6.827-13.653 15.787-26.027 26.027-36.693 10.24-11.52 22.187-20.48 35.413-27.733 13.227-7.68 27.307-12.8 42.667-15.787s31.573-3.413 47.36-0.853c12.373 2.133 24.32 5.12 35.84 10.667s22.613 11.52 32.853 19.2c10.24 8.107 18.347 16.64 26.027 26.453 6.827 9.387 12.373 20.48 15.36 32.427z" /> <glyph unicode="&#xe94b;" glyph-name="deaulter" d="M677.973-64c-30.72 35.84-61.867 70.827-91.307 107.52-40.96 51.2-80.64 103.253-121.173 154.88-16.64 21.333-21.76 20.48-30.72-4.693-13.227-36.693-25.6-73.387-40.107-109.653-5.12-12.8-13.227-26.88-24.32-34.56-51.627-34.987-104.107-69.12-157.867-100.693-10.667-6.4-30.72-5.547-41.813 0.853-8.107 4.693-12.373 23.893-11.093 35.84 0.853 8.96 11.093 19.627 19.627 25.6 39.253 26.453 78.933 51.627 119.040 76.8 18.347 11.52 30.293 26.027 35.84 47.787 12.373 48.213 27.307 95.573 39.253 143.36 8.533 33.707 26.88 58.88 56.32 77.227 40.533 25.173 80.64 52.053 120.747 78.507 6.4 4.267 10.24 11.52 15.36 17.493-7.253 2.56-14.933 7.253-22.187 6.827-75.52-6.4-151.467-13.227-226.987-20.48-2.133 0-4.693-0.853-6.827-0.853-22.613-1.707-39.253 10.24-40.96 29.867s12.373 33.707 35.413 35.84c45.227 4.267 90.88 8.96 136.107 12.8 65.707 5.547 131.84 10.667 197.547 15.36 26.027 1.707 53.76-21.76 67.413-55.467 9.813-23.893 5.12-46.080-18.347-65.28-49.92-40.107-100.693-78.933-151.040-118.187-23.040-17.92-23.893-23.467-6.4-46.507 58.453-78.080 116.48-156.587 174.933-234.667 27.307-36.693 25.173-50.773-12.373-75.52-5.12 0-9.813 0-14.080 0zM791.893 649.813c-43.093 1.28-76.373-31.573-77.227-75.52-0.853-44.373 29.44-76.8 72.107-77.653 45.227-1.28 77.653 29.44 78.080 73.813 0.427 45.227-29.44 78.080-72.96 79.36zM671.147 737.707c0-72.107-34.133-136.107-87.467-176.64l-235.52-21.76c-72.107 36.693-122.027 111.787-122.027 198.4 0 122.88 99.84 222.293 222.72 222.293 122.453 0 222.293-99.413 222.293-222.293zM592.213 680.533l-50.347 18.347c-2.133-8.533-5.12-16.213-9.813-22.613-5.12-6.4-10.24-11.947-16.213-17.067-5.973-4.267-12.373-8.107-19.2-11.093s-13.653-4.693-20.053-5.547c-17.92-2.987-33.707-0.427-48.64 6.827s-26.88 18.347-36.693 32.853l76.373 12.373 7.253 32.427-97.28-15.787c-1.28 5.547-2.987 11.093-3.84 16.64l-0.853 4.267 99.413 16.213 7.253 32.427-106.667-17.493c0.853 9.387 2.987 17.493 6.4 26.027 3.84 8.533 8.107 16.213 14.080 23.040 5.547 6.827 12.8 12.373 21.333 17.067s17.92 8.107 28.587 9.813c6.827 1.28 13.227 1.707 20.907 1.28s14.507-1.707 21.333-3.84c6.827-2.133 13.653-5.973 20.053-10.24 5.973-4.693 11.947-11.093 17.493-18.773l38.827 37.973c-13.227 17.92-30.293 31.147-52.053 39.253-21.76 8.533-46.080 10.667-73.387 6.4-19.627-2.987-36.267-9.387-51.2-17.92-14.507-8.533-26.88-19.2-37.547-32-10.667-12.373-18.773-26.027-23.893-40.96-5.547-14.507-8.96-29.867-9.813-45.653l-21.76-3.84-7.253-32.427 29.013 4.693 0.427-2.987c1.28-6.827 2.56-12.8 4.267-18.347l-23.467-3.84-8.107-32.427 43.52 7.253c6.827-13.653 15.787-26.027 26.027-36.693 10.24-11.52 22.187-20.48 35.413-27.733 13.227-7.68 27.307-12.8 42.667-15.787s31.573-3.413 47.36-0.853c12.373 2.133 24.32 5.12 35.84 10.667s22.613 11.52 32.853 19.2c10.24 8.107 18.347 16.64 26.027 26.453 6.827 9.387 12.373 20.48 15.36 32.427z" />
<glyph unicode="&#xe94c;" glyph-name="services" d="M951.467 217.6c0 8.533 0 21.333 0 29.867s0 21.333-4.267 29.867l64 51.2c4.267 4.267 8.533 12.8 4.267 21.333l-64 106.667c-4.267 8.533-12.8 8.533-17.067 8.533l-76.8-29.867c-17.067 12.8-34.133 21.333-51.2 29.867l-12.8 81.067c0 8.533-8.533 12.8-17.067 12.8h-123.733c-8.533 0-12.8-4.267-17.067-12.8l-12.8-81.067c-17.067-8.533-38.4-17.067-51.2-29.867l-76.8 29.867c-8.533 4.267-17.067 0-17.067-8.533l-64-106.667c-4.267-8.533-4.267-17.067 4.267-21.333l64-51.2c0-8.533-4.267-21.333-4.267-29.867s0-21.333 4.267-29.867l-55.467-51.2c-4.267-4.267-8.533-12.8-4.267-21.333l64-106.667c4.267-8.533 12.8-8.533 17.067-8.533l76.8 29.867c17.067-12.8 34.133-21.333 51.2-29.867l12.8-81.067c0-8.533 8.533-12.8 17.067-12.8h123.733c8.533 0 12.8 4.267 17.067 12.8l12.8 81.067c17.067 8.533 38.4 17.067 51.2 29.867l76.8-29.867c8.533-4.267 17.067 0 17.067 8.533l64 106.667c4.267 8.533 4.267 17.067-4.267 21.333 0 0-68.267 51.2-68.267 51.2zM721.067 132.267c-64 0-115.2 51.2-115.2 115.2s51.2 115.2 115.2 115.2 115.2-51.2 115.2-115.2c0-64-51.2-115.2-115.2-115.2zM345.6 174.933h-89.6v102.4h81.067c4.267 34.133 8.533 68.267 21.333 102.4h-102.4v102.4h162.133c34.133 42.667 72.533 76.8 119.467 102.4h-281.6v102.4h520.533v-59.733c51.2-8.533 102.4-25.6 145.067-51.2v281.6c0 55.467-46.933 102.4-102.4 102.4h-622.933c-55.467 0-102.4-46.933-102.4-102.4v-819.2c0-55.467 46.933-102.4 102.4-102.4h302.933c-81.067 55.467-136.533 140.8-153.6 238.933z" /> <glyph unicode="&#xe94c;" glyph-name="services" d="M951.467 217.6c0 8.533 0 21.333 0 29.867s0 21.333-4.267 29.867l64 51.2c4.267 4.267 8.533 12.8 4.267 21.333l-64 106.667c-4.267 8.533-12.8 8.533-17.067 8.533l-76.8-29.867c-17.067 12.8-34.133 21.333-51.2 29.867l-12.8 81.067c0 8.533-8.533 12.8-17.067 12.8h-123.733c-8.533 0-12.8-4.267-17.067-12.8l-12.8-81.067c-17.067-8.533-38.4-17.067-51.2-29.867l-76.8 29.867c-8.533 4.267-17.067 0-17.067-8.533l-64-106.667c-4.267-8.533-4.267-17.067 4.267-21.333l64-51.2c0-8.533-4.267-21.333-4.267-29.867s0-21.333 4.267-29.867l-55.467-51.2c-4.267-4.267-8.533-12.8-4.267-21.333l64-106.667c4.267-8.533 12.8-8.533 17.067-8.533l76.8 29.867c17.067-12.8 34.133-21.333 51.2-29.867l12.8-81.067c0-8.533 8.533-12.8 17.067-12.8h123.733c8.533 0 12.8 4.267 17.067 12.8l12.8 81.067c17.067 8.533 38.4 17.067 51.2 29.867l76.8-29.867c8.533-4.267 17.067 0 17.067 8.533l64 106.667c4.267 8.533 4.267 17.067-4.267 21.333 0 0-68.267 51.2-68.267 51.2zM721.067 132.267c-64 0-115.2 51.2-115.2 115.2s51.2 115.2 115.2 115.2 115.2-51.2 115.2-115.2c0-64-51.2-115.2-115.2-115.2zM345.6 174.933h-89.6v102.4h81.067c4.267 34.133 8.533 68.267 21.333 102.4h-102.4v102.4h162.133c34.133 42.667 72.533 76.8 119.467 102.4h-281.6v102.4h520.533v-59.733c51.2-8.533 102.4-25.6 145.067-51.2v281.6c0 55.467-46.933 102.4-102.4 102.4h-622.933c-55.467 0-102.4-46.933-102.4-102.4v-819.2c0-55.467 46.933-102.4 102.4-102.4h302.933c-81.067 55.467-136.533 140.8-153.6 238.933z" />
<glyph unicode="&#xe94d;" glyph-name="albaran" d="M819.2 960h-622.933c-55.467 0-102.4-46.933-102.4-102.4v-819.2c0-55.467 46.933-102.4 102.4-102.4h622.933c55.467 0 102.4 46.933 102.4 102.4v819.2c0 55.467-46.933 102.4-102.4 102.4zM358.4 174.933h-102.4v102.4h503.467v-102.4h-401.067zM256 379.733v102.4h503.467v-102.4h-503.467zM759.467 584.533h-503.467v102.4h503.467v-102.4z" /> <glyph unicode="&#xe94d;" glyph-name="albaran" d="M819.2 960h-622.933c-55.467 0-102.4-46.933-102.4-102.4v-819.2c0-55.467 46.933-102.4 102.4-102.4h622.933c55.467 0 102.4 46.933 102.4 102.4v819.2c0 55.467-46.933 102.4-102.4 102.4zM358.4 174.933h-102.4v102.4h503.467v-102.4h-401.067zM256 379.733v102.4h503.467v-102.4h-503.467zM759.467 584.533h-503.467v102.4h503.467v-102.4z" />
<glyph unicode="&#xe94e;" glyph-name="solunion" d="M759.467 870.4v-136.533h-601.6c0 0-128-341.333 106.667-341.333s469.333 0 469.333 0 34.133 0 34.133-34.133-8.533-98.133-8.533-98.133h-541.867c0 0-247.467 29.867-204.8 320 0 0 8.533 140.8 72.533 298.667 0 0 21.333-8.533 85.333-8.533h588.8zM853.333 25.6c64 0 85.333-8.533 85.333-8.533 64 153.6 72.533 298.667 72.533 298.667 42.667 290.133-204.8 320-204.8 320h-541.867c0 0-8.533-64-8.533-98.133s34.133-34.133 34.133-34.133 238.933 0 469.333 0 106.667-341.333 106.667-341.333h-601.6v-136.533h588.8z" />
<glyph unicode="&#xe94f;" glyph-name="stowaway" d="M1006.933 452.267l-260.267 106.667 29.867 29.867c4.267 4.267 4.267 12.8 4.267 17.067-4.267 4.267-8.533 8.533-12.8 8.533h-157.867c0 93.867 76.8 157.867 174.933 157.867 4.267 0 8.533 4.267 12.8 8.533s4.267 8.533 0 17.067l-81.067 153.6c-4.267 0-12.8 4.267-17.067 4.267-46.933 0-93.867-17.067-132.267-42.667-21.333-17.067-42.667-38.4-55.467-59.733-12.8 21.333-29.867 42.667-55.467 59.733-34.133 12.8-81.067 34.133-128 34.133-4.267 0-12.8-4.267-12.8-8.533l-85.333-153.6c-4.267-4.267-4.267-4.267 0-12.8 4.267-4.267 8.533-8.533 12.8-8.533 98.133 0 174.933-59.733 174.933-153.6v0h-140.8c-4.267 0-12.8-4.267-12.8-8.533-8.533-4.267-4.267-17.067 0-21.333l21.333-21.333-277.333-110.933c-8.533-8.533-12.8-12.8-8.533-21.333 0-8.533 8.533-12.8 17.067-12.8v0l98.133 4.267-81.067-85.333c0-4.267-4.267-8.533 0-12.8 0-4.267 4.267-8.533 8.533-8.533l85.333-34.133v-179.2c0-8.533 4.267-12.8 8.533-12.8l358.4-145.067h8.533l358.4 145.067c4.267 4.267 8.533 8.533 8.533 12.8v179.2l85.333 34.133c4.267 0 8.533 4.267 8.533 8.533s0 8.533-4.267 12.8l-68.267 98.133 102.4-4.267c8.533 0 12.8 4.267 17.067 12.8 8.533 0 4.267 4.267-4.267 12.8zM110.933 456.533l196.267 76.8 8.533-8.533-166.4-64-38.4-4.267zM153.6 285.867v0l-68.267 34.133 68.267 98.133 328.533-132.267-68.267-98.133-260.267 98.133zM490.667-29.867l-328.533 132.267v153.6l243.2-98.133h12.8c0 0 0 0 4.267 0v0c0 0 4.267 0 4.267 4.267l64 85.333c0-4.267 0-277.333 0-277.333zM490.667 324.267l-298.667 115.2 149.333 64 153.6-157.867v-17.067h-4.267zM529.067 337.067l157.867 157.867 140.8-55.467-298.667-115.2c0 0 0 12.8 0 12.8zM849.067 102.4l-328.533-132.267v281.6l64-85.333c0 0 0-4.267 4.267-4.267v0h17.067l243.2 98.133v-157.867zM938.667 324.267l-324.267-132.267-68.267 98.133 328.533 132.267 64-98.133zM870.4 460.8l-157.867 64 12.8 8.533 187.733-76.8-42.667 4.267z" />
<glyph unicode="&#xe950;" glyph-name="agency-term" d="M789.333 266.667c-55.467 0-102.4-46.933-102.4-102.4s46.933-102.4 102.4-102.4c55.467 0 102.4 46.933 102.4 102.4 0 59.733-46.933 102.4-102.4 102.4zM789.333 113.067c-29.867 0-51.2 21.333-51.2 51.2s21.333 51.2 51.2 51.2c29.867 0 51.2-21.333 51.2-51.2 0-25.6-25.6-51.2-51.2-51.2zM251.733 266.667c-55.467 0-102.4-46.933-102.4-102.4s46.933-102.4 102.4-102.4 102.4 46.933 102.4 102.4c0 59.733-46.933 102.4-102.4 102.4zM251.733 113.067c-29.867 0-51.2 21.333-51.2 51.2s21.333 51.2 51.2 51.2 51.2-21.333 51.2-51.2c0-25.6-25.6-51.2-51.2-51.2zM1006.933 539.733l-196.267 192c-12.8 12.8-29.867 17.067-46.933 17.067h-98.133v38.4c0 25.6-21.333 51.2-51.2 51.2h-563.2c-29.867 0-51.2-21.333-51.2-51.2v-554.667c0-29.867 25.6-51.2 51.2-51.2h68.267c8.533 64 64 115.2 132.267 115.2 64 0 123.733-51.2 132.267-115.2h268.8c8.533 64 64 115.2 132.267 115.2s128-51.2 136.533-115.2h51.2c29.867 0 51.2 25.6 51.2 51.2v260.267c0 17.067-8.533 34.133-17.067 46.933v0zM725.333 684.8c0 4.267 4.267 8.533 8.533 8.533h34.133c0 0 4.267 0 4.267-4.267l153.6-145.067c4.267 0 0-12.8-4.267-12.8h-187.733c-8.533 0-8.533 4.267-8.533 8.533v145.067zM509.013 556.373c0-113.92-92.16-206.080-206.080-206.080s-206.080 92.16-206.080 206.080 92.16 206.507 206.080 206.507 206.080-92.587 206.080-206.507zM342.613 494.080h-87.893l-15.36-40.107h-78.933l100.693 230.827h76.373l100.693-230.827h-80.213l-15.36 40.107zM321.28 550.4l-22.613 58.027-22.187-58.027h44.8z" /> <glyph unicode="&#xe950;" glyph-name="agency-term" d="M789.333 266.667c-55.467 0-102.4-46.933-102.4-102.4s46.933-102.4 102.4-102.4c55.467 0 102.4 46.933 102.4 102.4 0 59.733-46.933 102.4-102.4 102.4zM789.333 113.067c-29.867 0-51.2 21.333-51.2 51.2s21.333 51.2 51.2 51.2c29.867 0 51.2-21.333 51.2-51.2 0-25.6-25.6-51.2-51.2-51.2zM251.733 266.667c-55.467 0-102.4-46.933-102.4-102.4s46.933-102.4 102.4-102.4 102.4 46.933 102.4 102.4c0 59.733-46.933 102.4-102.4 102.4zM251.733 113.067c-29.867 0-51.2 21.333-51.2 51.2s21.333 51.2 51.2 51.2 51.2-21.333 51.2-51.2c0-25.6-25.6-51.2-51.2-51.2zM1006.933 539.733l-196.267 192c-12.8 12.8-29.867 17.067-46.933 17.067h-98.133v38.4c0 25.6-21.333 51.2-51.2 51.2h-563.2c-29.867 0-51.2-21.333-51.2-51.2v-554.667c0-29.867 25.6-51.2 51.2-51.2h68.267c8.533 64 64 115.2 132.267 115.2 64 0 123.733-51.2 132.267-115.2h268.8c8.533 64 64 115.2 132.267 115.2s128-51.2 136.533-115.2h51.2c29.867 0 51.2 25.6 51.2 51.2v260.267c0 17.067-8.533 34.133-17.067 46.933v0zM725.333 684.8c0 4.267 4.267 8.533 8.533 8.533h34.133c0 0 4.267 0 4.267-4.267l153.6-145.067c4.267 0 0-12.8-4.267-12.8h-187.733c-8.533 0-8.533 4.267-8.533 8.533v145.067zM509.013 556.373c0-113.92-92.16-206.080-206.080-206.080s-206.080 92.16-206.080 206.080 92.16 206.507 206.080 206.507 206.080-92.587 206.080-206.507zM342.613 494.080h-87.893l-15.36-40.107h-78.933l100.693 230.827h76.373l100.693-230.827h-80.213l-15.36 40.107zM321.28 550.4l-22.613 58.027-22.187-58.027h44.8z" />
<glyph unicode="&#xe951;" glyph-name="apps" d="M0 704h256v256h-256v-256zM384-64h256v256h-256v-256zM0-64h256v256h-256v-256zM0 320h256v256h-256v-256zM384 320h256v256h-256v-256zM768 960v-256h256v256h-256zM384 704h256v256h-256v-256zM768 320h256v256h-256v-256zM768-64h256v256h-256v-256z" /> <glyph unicode="&#xe951;" glyph-name="apps" d="M0 704h256v256h-256v-256zM384-64h256v256h-256v-256zM0-64h256v256h-256v-256zM0 320h256v256h-256v-256zM384 320h256v256h-256v-256zM768 960v-256h256v256h-256zM384 704h256v256h-256v-256zM768 320h256v256h-256v-256zM768-64h256v256h-256v-256z" />
<glyph unicode="&#xe952;" glyph-name="info" d="M512 960c-281.6 0-512-230.4-512-512s230.4-512 512-512 512 230.4 512 512-230.4 512-512 512zM563.2 192h-102.4v307.2h102.4v-307.2zM563.2 601.6h-102.4v102.4h102.4v-102.4z" /> <glyph unicode="&#xe952;" glyph-name="info" d="M512 960c-281.6 0-512-230.4-512-512s230.4-512 512-512 512 230.4 512 512-230.4 512-512 512zM563.2 192h-102.4v307.2h102.4v-307.2zM563.2 601.6h-102.4v102.4h102.4v-102.4z" />

Before

Width:  |  Height:  |  Size: 160 KiB

After

Width:  |  Height:  |  Size: 157 KiB

View File

@ -54,7 +54,6 @@
"You can't delete a confirmed order": "You can't delete a confirmed order", "You can't delete a confirmed order": "You can't delete a confirmed order",
"Value has an invalid format": "Value has an invalid format", "Value has an invalid format": "Value has an invalid format",
"The postcode doesn't exist. Please enter a correct one": "The postcode doesn't exist. Please enter a correct one", "The postcode doesn't exist. Please enter a correct one": "The postcode doesn't exist. Please enter a correct one",
"Can't create stowaway for this ticket": "Can't create stowaway for this ticket",
"Swift / BIC can't be empty": "Swift / BIC can't be empty", "Swift / BIC can't be empty": "Swift / BIC can't be empty",
"Deleted sales from ticket": "I have deleted the following lines from the ticket [{{ticketId}}]({{{ticketUrl}}}): {{{deletions}}}", "Deleted sales from ticket": "I have deleted the following lines from the ticket [{{ticketId}}]({{{ticketUrl}}}): {{{deletions}}}",
"Added sale to ticket": "I have added the following line to the ticket [{{ticketId}}]({{{ticketUrl}}}): {{{addition}}}", "Added sale to ticket": "I have added the following line to the ticket [{{ticketId}}]({{{ticketUrl}}}): {{{addition}}}",
@ -70,7 +69,6 @@
"Claim will be picked": "The product from the claim [({{claimId}})]({{{claimUrl}}}) from the client *{{clientName}}* will be picked", "Claim will be picked": "The product from the claim [({{claimId}})]({{{claimUrl}}}) from the client *{{clientName}}* will be picked",
"Claim state has changed to incomplete": "The state of the claim [({{claimId}})]({{{claimUrl}}}) from client *{{clientName}}* has changed to *incomplete*", "Claim state has changed to incomplete": "The state of the claim [({{claimId}})]({{{claimUrl}}}) from client *{{clientName}}* has changed to *incomplete*",
"Claim state has changed to canceled": "The state of the claim [({{claimId}})]({{{claimUrl}}}) from client *{{clientName}}* has changed to *canceled*", "Claim state has changed to canceled": "The state of the claim [({{claimId}})]({{{claimUrl}}}) from client *{{clientName}}* has changed to *canceled*",
"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", "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", "Incoterms is required for a non UEE member": "Incoterms is required for a non UEE member",
"Client checked as validated despite of duplication": "Client checked as validated despite of duplication from client id {{clientId}}", "Client checked as validated despite of duplication": "Client checked as validated despite of duplication from client id {{clientId}}",

View File

@ -101,7 +101,6 @@
"Ticket id cannot be blank": "El id de ticket no puede quedar en blanco", "Ticket id cannot be blank": "El id de ticket no puede quedar en blanco",
"Weekday cannot be blank": "El día de la semana no puede quedar en blanco", "Weekday cannot be blank": "El día de la semana no puede quedar en blanco",
"You can't delete a confirmed order": "No puedes borrar un pedido confirmado", "You can't delete a confirmed order": "No puedes borrar un pedido confirmado",
"Can't create stowaway for this ticket": "No se puede crear un polizon para este ticket",
"The social name has an invalid format": "El nombre fiscal tiene un formato incorrecto", "The social name has an invalid format": "El nombre fiscal tiene un formato incorrecto",
"Invalid quantity": "Cantidad invalida", "Invalid quantity": "Cantidad invalida",
"This postal code is not valid": "This postal code is not valid", "This postal code is not valid": "This postal code is not valid",
@ -138,7 +137,6 @@
"Claim will be picked": "Se recogerá el género de la reclamación [({{claimId}})]({{{claimUrl}}}) del cliente *{{clientName}}*", "Claim will be picked": "Se recogerá el género de la reclamación [({{claimId}})]({{{claimUrl}}}) del cliente *{{clientName}}*",
"Claim state has changed to incomplete": "Se ha cambiado el estado de la reclamación [({{claimId}})]({{{claimUrl}}}) del cliente *{{clientName}}* a *incompleta*", "Claim state has changed to incomplete": "Se ha cambiado el estado de la reclamación [({{claimId}})]({{{claimUrl}}}) del cliente *{{clientName}}* a *incompleta*",
"Claim state has changed to canceled": "Se ha cambiado el estado de la reclamación [({{claimId}})]({{{claimUrl}}}) del cliente *{{clientName}}* a *anulado*", "Claim state has changed to canceled": "Se ha cambiado el estado de la reclamación [({{claimId}})]({{{claimUrl}}}) del cliente *{{clientName}}* a *anulado*",
"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}}", "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", "ORDER_ROW_UNAVAILABLE": "No hay disponibilidad de este producto",
"Distance must be lesser than 1000": "La distancia debe ser inferior a 1000", "Distance must be lesser than 1000": "La distancia debe ser inferior a 1000",

View File

@ -1,6 +1,6 @@
module.exports = Self => { module.exports = Self => {
Self.remoteMethodCtx('importToNewRefundTicket', { Self.remoteMethodCtx('importToNewRefundTicket', {
description: 'Imports lines from claimBeginning to a new ticket with specific shipped, landed dates, agency and company', description: 'Import lines of claimBeginning to new ticket with shipped, landed dates, agency and company',
accessType: 'WRITE', accessType: 'WRITE',
accepts: [{ accepts: [{
arg: 'id', arg: 'id',

View File

@ -66,7 +66,9 @@ describe('InvoiceOut', () => {
controller.responseHandler('accept'); controller.responseHandler('accept');
expect(controller.vnApp.showError).toHaveBeenCalledWith(`Invoice date and the max date should be filled`); const expectedError = 'Invoice date and the max date should be filled';
expect(controller.vnApp.showError).toHaveBeenCalledWith(expectedError);
}); });
it('should throw an error when fromClientId or toClientId properties are not filled in', () => { it('should throw an error when fromClientId or toClientId properties are not filled in', () => {

View File

@ -1,48 +0,0 @@
module.exports = Self => {
Self.remoteMethod('canHaveStowaway', {
description: 'Returns if a ticket can have stowaway',
accessType: 'READ',
accepts: [{
arg: 'id',
type: 'number',
required: true,
description: 'ticket id',
http: {source: 'path'}
}],
returns: {
root: true
},
http: {
path: `/:id/canHaveStowaway`,
verb: 'GET'
}
});
Self.canHaveStowaway = async(id, options) => {
const models = Self.app.models;
const myOptions = {};
if (typeof options == 'object')
Object.assign(myOptions, options);
const ticket = await models.Ticket.findById(id, {
include: {
relation: 'ship',
scope: {
fields: ['id']
}
}
}, myOptions);
const warehouse = await models.Warehouse.findById(ticket.warehouseFk, null, myOptions);
const hasStowaway = ticket.ship() ? true : false;
const validStowaway = warehouse && warehouse.hasStowaway && !hasStowaway;
if (!ticket.isDeleted && validStowaway)
return true;
return false;
};
};

View File

@ -1,105 +0,0 @@
module.exports = Self => {
Self.remoteMethodCtx('deleteStowaway', {
description: 'Deletes an stowaway',
accessType: 'WRITE',
accepts: [{
arg: 'id',
type: 'number',
required: true,
description: 'The ticket id',
http: {source: 'path'}
}],
returns: {
root: true
},
http: {
path: `/:id/deleteStowaway`,
verb: 'POST'
}
});
Self.deleteStowaway = async(ctx, id, options) => {
const models = Self.app.models;
const $t = ctx.req.__; // $translate
const myOptions = {};
let tx;
if (typeof options == 'object')
Object.assign(myOptions, options);
if (!myOptions.transaction) {
tx = await Self.beginTransaction({});
myOptions.transaction = tx;
}
try {
const ticket = await Self.findById(id, {
include: [{
relation: 'ship'
}, {
relation: 'stowaway'
}, {
relation: 'client',
scope: {
include: {
relation: 'salesPersonUser',
scope: {
fields: ['id', 'name']
}
}
}
}]
}, myOptions);
let stowawayFk;
let shipFk;
if (ticket.stowaway()) {
shipFk = ticket.stowaway().shipFk;
stowawayFk = ticket.stowaway().id;
} else if (ticket.ship()) {
shipFk = ticket.ship().shipFk;
stowawayFk = ticket.ship().id;
}
const stowaway = await models.Stowaway.findOne({
where: {
id: stowawayFk,
shipFk: shipFk
}
}, myOptions);
const result = await stowaway.destroy(myOptions);
const state = await models.State.findOne({
where: {
code: 'BOARDING'
}
}, myOptions);
const ticketTracking = await models.TicketTracking.findOne({
where: {
ticketFk: shipFk,
stateFk: state.id
}
}, myOptions);
await ticketTracking.destroy(myOptions);
const salesPerson = ticket.client().salesPersonUser();
if (salesPerson) {
const origin = ctx.req.headers.origin;
const message = $t('This ticket is not an stowaway anymore', {
ticketId: stowawayFk,
ticketUrl: `${origin}/#!/ticket/${stowawayFk}/sale`
});
await models.Chat.sendCheckingPresence(ctx, salesPerson.id, message);
}
if (tx) await tx.commit();
return result;
} catch (e) {
if (tx) await tx.rollback();
throw e;
}
};
};

View File

@ -1,74 +0,0 @@
const UserError = require('vn-loopback/util/user-error');
module.exports = Self => {
Self.remoteMethod('getPossibleStowaways', {
description: 'Returns a list of allowed tickets for a stowaway ticket',
accessType: 'READ',
accepts: [{
arg: 'id',
type: 'number',
required: true,
description: 'ticket id',
http: {source: 'path'}
}],
returns: {
root: true
},
http: {
path: `/:id/getPossibleStowaways`,
verb: 'GET'
}
});
Self.getPossibleStowaways = async(ticketFk, options) => {
const models = Self.app.models;
const myOptions = {};
if (typeof options == 'object')
Object.assign(myOptions, options);
const canHaveStowaway = await models.Ticket.canHaveStowaway(ticketFk, myOptions);
if (!canHaveStowaway)
throw new UserError(`Can't create stowaway for this ticket`);
const ship = await models.Ticket.findById(ticketFk, null, myOptions);
if (!ship || !ship.shipped)
return [];
const lowestDate = new Date(ship.shipped.getTime());
lowestDate.setHours(0, 0, -1, 0);
const highestDate = new Date(ship.shipped.getTime());
highestDate.setHours(23, 59, 59);
const possibleStowaways = await models.Ticket.find({
where: {
id: {neq: ticketFk},
clientFk: ship.clientFk,
addressFk: ship.addressFk,
agencyModeFk: ship.agencyModeFk,
warehouseFk: {neq: ship.warehouseFk},
shipped: {
between: [lowestDate.toJSON(), highestDate.toJSON()]
}
},
include: [
{relation: 'agencyMode'},
{relation: 'warehouse'},
{relation: 'ticketState',
scope: {
fields: ['stateFk'],
include: {
relation: 'state',
fields: ['id', 'name'],
}
},
},
]
}, myOptions);
return possibleStowaways;
};
};

View File

@ -107,28 +107,9 @@ module.exports = Self => {
} }
} }
} }
}, {
relation: 'ship'
}, {
relation: 'stowaway'
}] }]
}, myOptions); }, myOptions);
// Change state to "fixing" if contains an stowaway and remove the link between them
let otherTicketId;
if (ticket.stowaway())
otherTicketId = ticket.stowaway().shipFk;
else if (ticket.ship())
otherTicketId = ticket.ship().id;
if (otherTicketId) {
await models.Ticket.deleteStowaway(ctx, otherTicketId, myOptions);
await models.TicketTracking.changeState(ctx, {
ticketFk: otherTicketId,
code: 'FIXING'
}, myOptions);
}
// Send notification to salesPerson // Send notification to salesPerson
const salesPersonUser = ticket.client().salesPersonUser(); const salesPersonUser = ticket.client().salesPersonUser();
if (salesPersonUser) { if (salesPersonUser) {

View File

@ -1,39 +0,0 @@
const models = require('vn-loopback/server/server').models;
describe('ticket canHaveStowaway()', () => {
it('should return true if the ticket warehouse have hasStowaway equal 1', async() => {
const tx = await models.Ticket.beginTransaction({});
try {
const options = {transaction: tx};
const ticketId = 16;
const canStowaway = await models.Ticket.canHaveStowaway(ticketId, options);
expect(canStowaway).toBeTruthy();
await tx.rollback();
} catch (e) {
await tx.rollback();
throw e;
}
});
it('should return false if the ticket warehouse dont have hasStowaway equal 0', async() => {
const tx = await models.Ticket.beginTransaction({});
try {
const options = {transaction: tx};
const ticketId = 10;
const canStowaway = await models.Ticket.canHaveStowaway(ticketId, options);
expect(canStowaway).toBeFalsy();
await tx.rollback();
} catch (e) {
await tx.rollback();
throw e;
}
});
});

View File

@ -1,75 +0,0 @@
const models = require('vn-loopback/server/server').models;
describe('ticket deleteStowaway()', () => {
const shipId = 16;
const stowawayId = 17;
const ctx = {
req: {
accessToken: {userId: 18},
headers: {origin: 'http://localhost'}
}
};
ctx.req.__ = (value, params) => {
return params.nickname;
};
it(`should create an stowaway, delete it and see the states of both stowaway and ship go back to the last states`, async() => {
const tx = await models.Ticket.beginTransaction({});
try {
const options = {transaction: tx};
await models.Stowaway.rawSql(`
INSERT INTO stowaway (id, shipFk) VALUES (?, ?)
`, [stowawayId, shipId], options);
await models.Stowaway.rawSql(
`CALL ticketStateUpdate(?, ?)`, [shipId, 'BOARDING'], options);
await models.Stowaway.rawSql(
`CALL ticketStateUpdate(?, ?)`, [stowawayId, 'BOARDING'], options);
let createdStowaways = await models.Stowaway.count({id: stowawayId, shipFk: shipId}, options);
expect(createdStowaways).toEqual(1);
let shipState = await models.TicketLastState.findOne({
where: {
ticketFk: shipId
}
}, options);
let stowawayState = await models.TicketLastState.findOne({
where: {
ticketFk: stowawayId
}
}, options);
expect(shipState.name).toEqual('Embarcando');
expect(stowawayState.name).toEqual('Embarcando');
await models.Ticket.deleteStowaway(ctx, shipId, options);
await models.Ticket.deleteStowaway(ctx, stowawayId, options);
createdStowaways = await models.Stowaway.count({id: stowawayId, shipFk: shipId}, options);
expect(createdStowaways).toEqual(0);
shipState = await models.TicketLastState.findOne({
where: {
ticketFk: shipId
}
}, options);
stowawayState = await models.TicketLastState.findOne({
where: {
ticketFk: stowawayId
}
}, options);
expect(shipState.name).toEqual('OK');
expect(stowawayState.name).toEqual('Libre');
await tx.rollback();
} catch (e) {
await tx.rollback();
throw e;
}
});
});

View File

@ -1,60 +0,0 @@
const models = require('vn-loopback/server/server').models;
let UserError = require('vn-loopback/util/user-error');
describe('ticket getPossibleStowaways()', () => {
it(`should throw an error if Can't create stowaway for this ticket`, async() => {
const tx = await models.Ticket.beginTransaction({});
let error;
try {
const options = {transaction: tx};
const ticketId = 10;
await models.Ticket.getPossibleStowaways(ticketId, options);
await tx.rollback();
} catch (e) {
await tx.rollback();
error = e;
}
expect(error).toEqual(new UserError(`Can't create stowaway for this ticket`));
});
it('should return an empty list of tickets for a valid ticket', async() => {
const tx = await models.Ticket.beginTransaction({});
try {
const options = {transaction: tx};
const ticketId = 12;
const possibleStowaways = await models.Ticket.getPossibleStowaways(ticketId, options);
expect(possibleStowaways.length).toEqual(0);
await tx.rollback();
} catch (e) {
await tx.rollback();
throw e;
}
});
it('should return allowed list of tickets for a valid ticket', async() => {
const tx = await models.Ticket.beginTransaction({});
try {
const options = {transaction: tx};
const ticketId = 16;
const possibleStowaways = await models.Ticket.getPossibleStowaways(ticketId, options);
expect(possibleStowaways.length).toEqual(1);
await tx.rollback();
} catch (e) {
await tx.rollback();
throw e;
}
});
});

View File

@ -98,92 +98,4 @@ describe('ticket setDeleted()', () => {
throw e; throw e;
} }
}); });
it('should delete ticket, remove stowaway and itemshelving then change stowaway state to "FIXING" ', async() => {
pending('test excluded by task #3693');
const tx = await models.Ticket.beginTransaction({});
try {
const options = {transaction: tx};
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
active: activeCtx
});
const ctx = {
req: {
accessToken: {userId: employeeUser},
headers: {
origin: 'http://localhost:5000'
},
__: () => {}
}
};
const sampleTicket = await models.Ticket.findById(12);
const sampleStowaway = await models.Ticket.findById(13);
sampleTicket.id = undefined;
const shipTicket = await models.Ticket.create(sampleTicket, options);
sampleStowaway.id = undefined;
const stowawayTicket = await models.Ticket.create(sampleStowaway, options);
await models.Stowaway.rawSql(`
INSERT INTO vn.stowaway(id, shipFk)
VALUES (?, ?)`, [stowawayTicket.id, shipTicket.id], options);
const boardingState = await models.State.findOne({
where: {
code: 'BOARDING'
}
}, options);
await models.TicketTracking.create({
ticketFk: stowawayTicket.id,
stateFk: boardingState.id,
workerFk: ctx.req.accessToken.userId
}, options);
const okState = await models.State.findOne({
where: {
code: 'OK'
}
}, options);
await models.TicketTracking.create({
ticketFk: shipTicket.id,
stateFk: okState.id,
workerFk: ctx.req.accessToken.userId
}, options);
let stowawayTicketState = await models.TicketState.findOne({
where: {
ticketFk: stowawayTicket.id
}
}, options);
let stowaway = await models.Stowaway.findById(shipTicket.id, null, options);
expect(stowaway).toBeDefined();
expect(stowawayTicketState.code).toEqual('BOARDING');
await models.Ticket.setDeleted(ctx, shipTicket.id, options);
stowawayTicketState = await models.TicketState.findOne({
where: {
ticketFk: stowawayTicket.id
}
}, options);
stowaway = await models.Stowaway.findById(shipTicket.id, null, options);
expect(stowaway).toBeNull();
expect(stowawayTicketState.code).toEqual('FIXING');
await tx.rollback();
} catch (e) {
await tx.rollback();
throw e;
}
});
}); });

View File

@ -38,9 +38,6 @@
"State":{ "State":{
"dataSource": "vn" "dataSource": "vn"
}, },
"Stowaway": {
"dataSource": "vn"
},
"Ticket": { "Ticket": {
"dataSource": "vn" "dataSource": "vn"
}, },

View File

@ -1,24 +0,0 @@
const LoopBackContext = require('loopback-context');
const UserError = require('vn-loopback/util/user-error');
module.exports = function(Self) {
Self.observe('before save', async function(ctx) {
const models = Self.app.models;
const canHaveStowaway = await models.Ticket.canHaveStowaway(ctx.instance.shipFk);
if (!canHaveStowaway)
throw new UserError(`Can't create stowaway for this ticket`);
if (ctx.isNewInstance) {
let where = {
code: 'BOARDING'
};
let state = await models.State.findOne({where});
let params = {ticketFk: ctx.instance.shipFk, stateFk: state.id};
const loopBackContext = LoopBackContext.getCurrentContext();
let httpCtx = {req: loopBackContext.active};
await models.TicketTracking.changeState(httpCtx, params);
}
});
};

View File

@ -1,36 +0,0 @@
{
"name": "Stowaway",
"base": "VnModel",
"options": {
"mysql": {
"table": "stowaway"
}
},
"properties": {
"id": {
"id": true,
"type": "number",
"forceId": false
},
"shipFk": {
"type": "number",
"required": false
},
"created":{
"type": "date",
"required": false
}
},
"relations": {
"ship": {
"type": "belongsTo",
"model": "Ticket",
"foreignKey": "shipFk"
},
"ticket": {
"type": "belongsTo",
"model": "Ticket",
"foreignKey": "id"
}
}
}

View File

@ -14,7 +14,6 @@ module.exports = Self => {
require('../methods/ticket/getSales')(Self); require('../methods/ticket/getSales')(Self);
require('../methods/ticket/getSalesPersonMana')(Self); require('../methods/ticket/getSalesPersonMana')(Self);
require('../methods/ticket/filter')(Self); require('../methods/ticket/filter')(Self);
require('../methods/ticket/getPossibleStowaways')(Self);
require('../methods/ticket/canBeInvoiced')(Self); require('../methods/ticket/canBeInvoiced')(Self);
require('../methods/ticket/makeInvoice')(Self); require('../methods/ticket/makeInvoice')(Self);
require('../methods/ticket/updateEditableTicket')(Self); require('../methods/ticket/updateEditableTicket')(Self);
@ -23,9 +22,7 @@ module.exports = Self => {
require('../methods/ticket/uploadFile')(Self); require('../methods/ticket/uploadFile')(Self);
require('../methods/ticket/addSale')(Self); require('../methods/ticket/addSale')(Self);
require('../methods/ticket/transferSales')(Self); require('../methods/ticket/transferSales')(Self);
require('../methods/ticket/canHaveStowaway')(Self);
require('../methods/ticket/recalculateComponents')(Self); require('../methods/ticket/recalculateComponents')(Self);
require('../methods/ticket/deleteStowaway')(Self);
require('../methods/ticket/sendSms')(Self); require('../methods/ticket/sendSms')(Self);
require('../methods/ticket/isLocked')(Self); require('../methods/ticket/isLocked')(Self);
require('../methods/ticket/freightCost')(Self); require('../methods/ticket/freightCost')(Self);

View File

@ -69,16 +69,6 @@
"model": "Client", "model": "Client",
"foreignKey": "clientFk" "foreignKey": "clientFk"
}, },
"ship": {
"type": "hasOne",
"model": "Stowaway",
"foreignKey": "shipFk"
},
"stowaway": {
"type": "hasOne",
"model": "Stowaway",
"foreignKey": "id"
},
"warehouse": { "warehouse": {
"type": "belongsTo", "type": "belongsTo",
"model": "Warehouse", "model": "Warehouse",

View File

@ -6,18 +6,15 @@ class Controller extends ModuleCard {
let filter = { let filter = {
include: [ include: [
{ {
relation: 'address'}, relation: 'address'
},
{ {
relation: 'ship'}, relation: 'zone'
{ },
relation: 'stowaway'},
{ {
relation: 'warehouse', relation: 'warehouse',
scope: {fields: ['name']} scope: {fields: ['name']}
}, },
{
relation: 'zone',
},
{ {
relation: 'invoiceOut', relation: 'invoiceOut',
scope: {fields: ['id']} scope: {fields: ['id']}
@ -47,7 +44,8 @@ class Controller extends ModuleCard {
} }
}, },
}, },
}, { },
{
relation: 'ticketState', relation: 'ticketState',
scope: { scope: {
fields: ['stateFk'], fields: ['stateFk'],

View File

@ -103,20 +103,6 @@
translate> translate>
SMS Minimum import SMS Minimum import
</vn-item> </vn-item>
<vn-item
ng-click="addStowaway.show()"
ng-show="$ctrl.canShowStowaway"
name="addStowaway"
translate>
Add stowaway
</vn-item>
<vn-item
ng-click="deleteStowaway.show()"
ng-show="$ctrl.canDeleteStowaway"
name="deleteStowaway"
translate>
Delete stowaway
</vn-item>
<vn-item <vn-item
ng-click="makeInvoiceConfirmation.show()" ng-click="makeInvoiceConfirmation.show()"
ng-show="$ctrl.isEditable" ng-show="$ctrl.isEditable"
@ -260,21 +246,6 @@
sms="$ctrl.newSMS"> sms="$ctrl.newSMS">
</vn-ticket-sms> </vn-ticket-sms>
<!-- Add stowaway dialog -->
<vn-add-stowaway
vn-id="addStowaway"
card-reload="$ctrl.reload()"
ticket="$ctrl.ticket">
</vn-add-stowaway>
<!-- Delete stowaway confirmation dialog -->
<vn-confirm
vn-id="deleteStowaway"
on-accept="$ctrl.deleteStowaway()"
question="Delete stowaway"
message="Are you sure you want to delete this stowaway?">
</vn-confirm>
<!-- Make invoice confirmation dialog --> <!-- Make invoice confirmation dialog -->
<vn-confirm <vn-confirm
vn-id="makeInvoiceConfirmation" vn-id="makeInvoiceConfirmation"

View File

@ -52,7 +52,8 @@ class Controller extends Section {
const filter = { const filter = {
include: [{ include: [{
relation: 'address', relation: 'address',
}, { },
{
relation: 'client', relation: 'client',
scope: { scope: {
fields: [ fields: [
@ -74,15 +75,14 @@ class Controller extends Section {
} }
} }
}, },
{relation: 'ship'}, {
{relation: 'stowaway'}, relation: 'invoiceOut'
{relation: 'invoiceOut'}] }]
}; };
return this.$http.get(`Tickets/${this.ticketId}`, {filter}) return this.$http.get(`Tickets/${this.ticketId}`, {filter})
.then(res => this.ticket = res.data) .then(res => this.ticket = res.data)
.then(() => { .then(() => {
this.canStowaway();
this.isTicketEditable(); this.isTicketEditable();
this.hasDocuware(); this.hasDocuware();
}); });
@ -228,27 +228,6 @@ class Controller extends Section {
this.$.sms.open(); this.$.sms.open();
} }
canStowaway() {
this.canShowStowaway = false;
if (!this.isTicketModule || !this.ticket) return;
this.$http.get(`Tickets/${this.id}/canHaveStowaway`)
.then(res => this.canShowStowaway = !!res.data);
}
get canDeleteStowaway() {
if (!this.ticket || !this.isTicketModule)
return false;
return this.ticket.stowaway || this.ticket.ship;
}
deleteStowaway() {
return this.$http.post(`Tickets/${this.id}/deleteStowaway`)
.then(() => this.reload())
.then(() => this.vnApp.showSuccess(this.$t('Data saved!')));
}
makeInvoice() { makeInvoice() {
const params = {ticketsIds: [this.id]}; const params = {ticketsIds: [this.id]};
return this.$http.post(`Tickets/makeInvoice`, params) return this.$http.post(`Tickets/makeInvoice`, params)

View File

@ -231,23 +231,6 @@ describe('Ticket Component vnTicketDescriptorMenu', () => {
}); });
}); });
describe('canStowaway()', () => {
it('should make a query and return if the ticket can be stowawayed', () => {
$httpBackend.expect('GET', `Tickets/${ticket.id}/canHaveStowaway`).respond(true);
controller.canStowaway();
$httpBackend.flush();
expect(controller.canShowStowaway).toBeTruthy();
});
it('should not make a query if is not on the ticket module', () => {
$state.getCurrentPath = () => [null, {state: {name: 'client'}}];
controller.canStowaway();
expect(controller.canShowStowaway).toBeFalsy();
});
});
describe('recalculateComponents()', () => { describe('recalculateComponents()', () => {
it('should make a query and show a success message', () => { it('should make a query and show a success message', () => {
jest.spyOn(controller, 'reload').mockReturnThis(); jest.spyOn(controller, 'reload').mockReturnThis();

View File

@ -1,36 +0,0 @@
<vn-crud-model vn-id="model"
url="Tickets/{{$ctrl.ticket.id}}/getPossibleStowaways"
data="possibleStowaways">
</vn-crud-model>
<vn-dialog
vn-id="dialog"
class="modal-form"
on-open="model.refresh()"
message="Stowaways to add">
<tpl-body>
<vn-horizontal class="add-stowaway">
<vn-data-viewer model="model">
<vn-table model="model" auto-load="false">
<vn-thead>
<vn-tr>
<vn-th number>Ticket id</vn-th>
<vn-th>Shipped</vn-th>
<vn-th>Agency</vn-th>
<vn-th>Warehouse</vn-th>
<vn-th>State</vn-th>
</vn-tr>
</vn-thead>
<vn-tbody>
<vn-tr ng-repeat="ticket in possibleStowaways" class="clickable" ng-click="$ctrl.addStowaway(ticket)">
<vn-td number>{{ticket.id}}</vn-td>
<vn-td>{{ticket.landed | date: 'dd/MM/yyyy'}}</vn-td>
<vn-td>{{ticket.agencyMode.name}}</vn-td>
<vn-td>{{ticket.warehouse.name}}</vn-td>
<vn-td>{{ticket.ticketState.state.name}}</vn-td>
</vn-tr>
</vn-tbody>
</vn-table>
</vn-data-viewer>
</vn-horizontal>
</tpl-body>
</vn-dialog>

View File

@ -1,32 +0,0 @@
import ngModule from '../module';
import Component from 'core/lib/component';
import './style.scss';
class Controller extends Component {
addStowaway(stowaway) {
let params = {id: stowaway.id, shipFk: this.ticket.id};
this.$http.post(`Stowaways/`, params)
.then(() => this.cardReload())
.then(() => {
this.vnApp.showSuccess(this.$t('Data saved!'));
this.$.dialog.hide();
});
}
show() {
this.$.dialog.show();
}
hide() {
this.$.dialog.hide();
}
}
ngModule.vnComponent('vnAddStowaway', {
template: require('./addStowaway.html'),
controller: Controller,
bindings: {
ticket: '<',
cardReload: '&?'
}
});

View File

@ -93,36 +93,6 @@
icon="icon-basketadd"> icon="icon-basketadd">
</vn-quick-link> </vn-quick-link>
</div> </div>
<div ng-transclude="btnFour">
<vn-quick-link
ng-if="$ctrl.ticket.stowaway"
tooltip="Ship stowaways"
state="['ticket.card.summary', {id: $ctrl.ticket.stowaway.shipFk}]"
icon="icon-stowaway">
</vn-quick-link>
</div>
<div ng-transclude="btnFour">
<vn-quick-link
ng-if="$ctrl.ticket.ship"
tooltip="Stowaway"
state="['ticket.card.summary', {id: $ctrl.ticket.ship.id}]"
icon="icon-stowaway">
</vn-quick-link>
</div>
</div>
<div style="text-align: center">
<vn-button-menu
ng-if="$ctrl.ticket.ship.length > 1"
vn-id="stowaways-button"
icon="icon-stowaway"
show-filter="false"
show-field="id"
value-field="id"
vn-tooltip="Ship stowaways"
tooltip-position="up"
data="$ctrl.ticket.ship"
ui-sref="ticket.card.sale({id: value})">
</vn-button-menu>
</div> </div>
</slot-body> </slot-body>
</vn-descriptor-content> </vn-descriptor-content>

View File

@ -1,12 +1,4 @@
Ship: Barco
Stowaway: Polizón
Cliente: Client Cliente: Client
Ship stowaways: Polizones del barco
Stowaways to add: Polizones a añadir
Stowaways of the ticket: Polizones del ticket
Add stowaway: Añadir polizón
Delete stowaway: Eliminar polizón
Are you sure you want to delete this stowaway?: ¿Seguro que quieres eliminar este polizón?
Are you sure you want to send it?: ¿Seguro que quieres enviarlo? Are you sure you want to send it?: ¿Seguro que quieres enviarlo?
Show pallet report: Ver hoja de pallet Show pallet report: Ver hoja de pallet
Change shipped hour: Cambiar hora de envío Change shipped hour: Cambiar hora de envío

View File

@ -1,11 +1,5 @@
@import "variables"; @import "variables";
.add-stowaway {
vn-data-viewer {
width: 640px
}
}
vn-dialog.modal-form { vn-dialog.modal-form {
section.header { section.header {
background-color: $color-main; background-color: $color-main;

View File

@ -5,7 +5,6 @@ import './index/';
import './search-panel'; import './search-panel';
import './card'; import './card';
import './descriptor'; import './descriptor';
import './descriptor/addStowaway';
import './descriptor-popover'; import './descriptor-popover';
import './descriptor-menu'; import './descriptor-menu';
import './create/card'; import './create/card';

View File

@ -1,4 +1,4 @@
const app = require('vn-loopback/server/server'); const models = require('vn-loopback/server/server').models;
describe('agency getLanded()', () => { describe('agency getLanded()', () => {
it('should return a landing date', async() => { it('should return a landing date', async() => {
@ -9,12 +9,12 @@ describe('agency getLanded()', () => {
const agencyModeFk = 7; const agencyModeFk = 7;
const warehouseFk = 1; const warehouseFk = 1;
const tx = await app.models.Zone.beginTransaction({}); const tx = await models.Zone.beginTransaction({});
try { try {
const options = {transaction: tx}; const options = {transaction: tx};
const result = await app.models.Agency.getLanded(ctx, shipped, addressFk, agencyModeFk, warehouseFk, options); const result = await models.Agency.getLanded(ctx, shipped, addressFk, agencyModeFk, warehouseFk, options);
expect(result.landed).toBeDefined(); expect(result.landed).toBeDefined();

View File

@ -141,9 +141,8 @@
</tr> </tr>
</tbody> </tbody>
</table> </table>
<div v-if="ticket.description || ticket.shipFk" class="text-area"> <div v-if="ticket.description class="text-area">
<p>{{ticket.description}}</p> <p>{{ticket.description}}</p>
<p v-if="ticket.shipFk">{{$t('stowaway')}}: {{ticket.shipFk}}</p>
</div> </div>
</div> </div>
</div> </div>

View File

@ -20,7 +20,6 @@ phone: Teléfono
warehouse: Almacén warehouse: Almacén
salesPerson: Comercial salesPerson: Comercial
import: Importe import: Importe
stowaway: Encajado dentro del ticket
route: Ruta route: Ruta
routeId: Ruta {0} routeId: Ruta {0}
ticket: Ticket ticket: Ticket

View File

@ -17,7 +17,6 @@ SELECT
0 AS import, 0 AS import,
am.name ticketAgency, am.name ticketAgency,
tob.description, tob.description,
s.shipFk,
u.nickName salesPersonName, u.nickName salesPersonName,
ipkg.itemPackingTypes ipkg.itemPackingTypes
FROM route r FROM route r
@ -30,7 +29,6 @@ FROM route r
LEFT JOIN province p ON a.provinceFk = p.id LEFT JOIN province p ON a.provinceFk = p.id
LEFT JOIN warehouse wh ON wh.id = t.warehouseFk LEFT JOIN warehouse wh ON wh.id = t.warehouseFk
LEFT JOIN agencyMode am ON am.id = t.agencyModeFk LEFT JOIN agencyMode am ON am.id = t.agencyModeFk
LEFT JOIN stowaway s ON s.id = t.id
LEFT JOIN ( LEFT JOIN (
SELECT t.id AS ticketFk, SELECT t.id AS ticketFk,
GROUP_CONCAT(DISTINCT(i.itemPackingTypeFk)) AS itemPackingTypes GROUP_CONCAT(DISTINCT(i.itemPackingTypeFk)) AS itemPackingTypes