Merge branch '4700-split-tour' of https://gitea.verdnatura.es/verdnatura/salix into 3963-ticket-advance
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Alexandre Riera 2022-12-16 13:45:25 +01:00
commit 45b02c3bc6
16 changed files with 220 additions and 113 deletions

View File

@ -19,11 +19,11 @@ describe('getStarredModules()', () => {
}); });
it(`should return the starred modules for a given user`, async() => { it(`should return the starred modules for a given user`, async() => {
const newStarred = await app.models.StarredModule.create({workerFk: 9, moduleFk: 'Clients', position: 1}); const newStarred = await app.models.StarredModule.create({workerFk: 9, moduleFk: 'customer', position: 1});
const starredModules = await app.models.StarredModule.getStarredModules(ctx); const starredModules = await app.models.StarredModule.getStarredModules(ctx);
expect(starredModules.length).toEqual(1); expect(starredModules.length).toEqual(1);
expect(starredModules[0].moduleFk).toEqual('Clients'); expect(starredModules[0].moduleFk).toEqual('customer');
// restores // restores
await app.models.StarredModule.destroyById(newStarred.id); await app.models.StarredModule.destroyById(newStarred.id);

View File

@ -26,29 +26,29 @@ describe('setPosition()', () => {
const filter = { const filter = {
where: { where: {
workerFk: ctx.req.accessToken.userId, workerFk: ctx.req.accessToken.userId,
moduleFk: 'Orders' moduleFk: 'order'
} }
}; };
try { try {
const options = {transaction: tx}; const options = {transaction: tx};
await app.models.StarredModule.toggleStarredModule(ctx, 'Orders', options); await app.models.StarredModule.toggleStarredModule(ctx, 'order', options);
await app.models.StarredModule.toggleStarredModule(ctx, 'Clients', options); await app.models.StarredModule.toggleStarredModule(ctx, 'customer', options);
let orders = await app.models.StarredModule.findOne(filter, options); let orders = await app.models.StarredModule.findOne(filter, options);
filter.where.moduleFk = 'Clients'; filter.where.moduleFk = 'customer';
let clients = await app.models.StarredModule.findOne(filter, options); let clients = await app.models.StarredModule.findOne(filter, options);
expect(orders.position).toEqual(1); expect(orders.position).toEqual(1);
expect(clients.position).toEqual(2); expect(clients.position).toEqual(2);
await app.models.StarredModule.setPosition(ctx, 'Clients', 'left', options); await app.models.StarredModule.setPosition(ctx, 'customer', 'left', options);
filter.where.moduleFk = 'Clients'; filter.where.moduleFk = 'customer';
clients = await app.models.StarredModule.findOne(filter, options); clients = await app.models.StarredModule.findOne(filter, options);
filter.where.moduleFk = 'Orders'; filter.where.moduleFk = 'order';
orders = await app.models.StarredModule.findOne(filter, options); orders = await app.models.StarredModule.findOne(filter, options);
expect(clients.position).toEqual(1); expect(clients.position).toEqual(1);
@ -67,29 +67,29 @@ describe('setPosition()', () => {
const filter = { const filter = {
where: { where: {
workerFk: ctx.req.accessToken.userId, workerFk: ctx.req.accessToken.userId,
moduleFk: 'Orders' moduleFk: 'order'
} }
}; };
try { try {
const options = {transaction: tx}; const options = {transaction: tx};
await app.models.StarredModule.toggleStarredModule(ctx, 'Orders', options); await app.models.StarredModule.toggleStarredModule(ctx, 'order', options);
await app.models.StarredModule.toggleStarredModule(ctx, 'Clients', options); await app.models.StarredModule.toggleStarredModule(ctx, 'customer', options);
let orders = await app.models.StarredModule.findOne(filter, options); let orders = await app.models.StarredModule.findOne(filter, options);
filter.where.moduleFk = 'Clients'; filter.where.moduleFk = 'customer';
let clients = await app.models.StarredModule.findOne(filter, options); let clients = await app.models.StarredModule.findOne(filter, options);
expect(orders.position).toEqual(1); expect(orders.position).toEqual(1);
expect(clients.position).toEqual(2); expect(clients.position).toEqual(2);
await app.models.StarredModule.setPosition(ctx, 'Orders', 'right', options); await app.models.StarredModule.setPosition(ctx, 'order', 'right', options);
filter.where.moduleFk = 'Orders'; filter.where.moduleFk = 'order';
orders = await app.models.StarredModule.findOne(filter, options); orders = await app.models.StarredModule.findOne(filter, options);
filter.where.moduleFk = 'Clients'; filter.where.moduleFk = 'customer';
clients = await app.models.StarredModule.findOne(filter, options); clients = await app.models.StarredModule.findOne(filter, options);
expect(orders.position).toEqual(2); expect(orders.position).toEqual(2);
@ -108,35 +108,35 @@ describe('setPosition()', () => {
const filter = { const filter = {
where: { where: {
workerFk: ctx.req.accessToken.userId, workerFk: ctx.req.accessToken.userId,
moduleFk: 'Items' moduleFk: 'item'
} }
}; };
try { try {
const options = {transaction: tx}; const options = {transaction: tx};
await app.models.StarredModule.toggleStarredModule(ctx, 'Clients', options); await app.models.StarredModule.toggleStarredModule(ctx, 'customer', options);
await app.models.StarredModule.toggleStarredModule(ctx, 'Orders', options); await app.models.StarredModule.toggleStarredModule(ctx, 'order', options);
await app.models.StarredModule.toggleStarredModule(ctx, 'Clients', options); await app.models.StarredModule.toggleStarredModule(ctx, 'customer', options);
await app.models.StarredModule.toggleStarredModule(ctx, 'Orders', options); await app.models.StarredModule.toggleStarredModule(ctx, 'order', options);
await app.models.StarredModule.toggleStarredModule(ctx, 'Items', options); await app.models.StarredModule.toggleStarredModule(ctx, 'item', options);
await app.models.StarredModule.toggleStarredModule(ctx, 'Claims', options); await app.models.StarredModule.toggleStarredModule(ctx, 'claim', options);
await app.models.StarredModule.toggleStarredModule(ctx, 'Clients', options); await app.models.StarredModule.toggleStarredModule(ctx, 'customer', options);
await app.models.StarredModule.toggleStarredModule(ctx, 'Orders', options); await app.models.StarredModule.toggleStarredModule(ctx, 'order', options);
await app.models.StarredModule.toggleStarredModule(ctx, 'Zones', options); await app.models.StarredModule.toggleStarredModule(ctx, 'zone', options);
const items = await app.models.StarredModule.findOne(filter, options); const items = await app.models.StarredModule.findOne(filter, options);
filter.where.moduleFk = 'Claims'; filter.where.moduleFk = 'claim';
const claims = await app.models.StarredModule.findOne(filter, options); const claims = await app.models.StarredModule.findOne(filter, options);
filter.where.moduleFk = 'Clients'; filter.where.moduleFk = 'customer';
let clients = await app.models.StarredModule.findOne(filter, options); let clients = await app.models.StarredModule.findOne(filter, options);
filter.where.moduleFk = 'Orders'; filter.where.moduleFk = 'order';
let orders = await app.models.StarredModule.findOne(filter, options); let orders = await app.models.StarredModule.findOne(filter, options);
filter.where.moduleFk = 'Zones'; filter.where.moduleFk = 'zone';
const zones = await app.models.StarredModule.findOne(filter, options); const zones = await app.models.StarredModule.findOne(filter, options);
expect(items.position).toEqual(1); expect(items.position).toEqual(1);
@ -145,12 +145,12 @@ describe('setPosition()', () => {
expect(orders.position).toEqual(4); expect(orders.position).toEqual(4);
expect(zones.position).toEqual(5); expect(zones.position).toEqual(5);
await app.models.StarredModule.setPosition(ctx, 'Clients', 'right', options); await app.models.StarredModule.setPosition(ctx, 'customer', 'right', options);
filter.where.moduleFk = 'Orders'; filter.where.moduleFk = 'order';
orders = await app.models.StarredModule.findOne(filter, options); orders = await app.models.StarredModule.findOne(filter, options);
filter.where.moduleFk = 'Clients'; filter.where.moduleFk = 'customer';
clients = await app.models.StarredModule.findOne(filter, options); clients = await app.models.StarredModule.findOne(filter, options);
expect(orders.position).toEqual(3); expect(orders.position).toEqual(3);
@ -169,31 +169,31 @@ describe('setPosition()', () => {
const filter = { const filter = {
where: { where: {
workerFk: ctx.req.accessToken.userId, workerFk: ctx.req.accessToken.userId,
moduleFk: 'Items' moduleFk: 'item'
} }
}; };
try { try {
const options = {transaction: tx}; const options = {transaction: tx};
await app.models.StarredModule.toggleStarredModule(ctx, 'Items', options); await app.models.StarredModule.toggleStarredModule(ctx, 'item', options);
await app.models.StarredModule.toggleStarredModule(ctx, 'Clients', options); await app.models.StarredModule.toggleStarredModule(ctx, 'customer', options);
await app.models.StarredModule.toggleStarredModule(ctx, 'Claims', options); await app.models.StarredModule.toggleStarredModule(ctx, 'claim', options);
await app.models.StarredModule.toggleStarredModule(ctx, 'Orders', options); await app.models.StarredModule.toggleStarredModule(ctx, 'order', options);
await app.models.StarredModule.toggleStarredModule(ctx, 'Zones', options); await app.models.StarredModule.toggleStarredModule(ctx, 'zone', options);
const items = await app.models.StarredModule.findOne(filter, options); const items = await app.models.StarredModule.findOne(filter, options);
filter.where.moduleFk = 'Clients'; filter.where.moduleFk = 'customer';
let clients = await app.models.StarredModule.findOne(filter, options); let clients = await app.models.StarredModule.findOne(filter, options);
filter.where.moduleFk = 'Claims'; filter.where.moduleFk = 'claim';
const claims = await app.models.StarredModule.findOne(filter, options); const claims = await app.models.StarredModule.findOne(filter, options);
filter.where.moduleFk = 'Orders'; filter.where.moduleFk = 'order';
let orders = await app.models.StarredModule.findOne(filter, options); let orders = await app.models.StarredModule.findOne(filter, options);
filter.where.moduleFk = 'Zones'; filter.where.moduleFk = 'zone';
const zones = await app.models.StarredModule.findOne(filter, options); const zones = await app.models.StarredModule.findOne(filter, options);
expect(items.position).toEqual(1); expect(items.position).toEqual(1);
@ -202,13 +202,13 @@ describe('setPosition()', () => {
expect(orders.position).toEqual(4); expect(orders.position).toEqual(4);
expect(zones.position).toEqual(5); expect(zones.position).toEqual(5);
await app.models.StarredModule.toggleStarredModule(ctx, 'Claims', options); await app.models.StarredModule.toggleStarredModule(ctx, 'claim', options);
await app.models.StarredModule.setPosition(ctx, 'Clients', 'right', options); await app.models.StarredModule.setPosition(ctx, 'customer', 'right', options);
filter.where.moduleFk = 'Clients'; filter.where.moduleFk = 'customer';
clients = await app.models.StarredModule.findOne(filter, options); clients = await app.models.StarredModule.findOne(filter, options);
filter.where.moduleFk = 'Orders'; filter.where.moduleFk = 'order';
orders = await app.models.StarredModule.findOne(filter, options); orders = await app.models.StarredModule.findOne(filter, options);
expect(orders.position).toEqual(2); expect(orders.position).toEqual(2);

View File

@ -21,15 +21,15 @@ describe('toggleStarredModule()', () => {
}); });
it('should create a new starred module and then remove it by calling the method again with same args', async() => { it('should create a new starred module and then remove it by calling the method again with same args', async() => {
const starredModule = await app.models.StarredModule.toggleStarredModule(ctx, 'Orders'); const starredModule = await app.models.StarredModule.toggleStarredModule(ctx, 'order');
let starredModules = await app.models.StarredModule.getStarredModules(ctx); let starredModules = await app.models.StarredModule.getStarredModules(ctx);
expect(starredModules.length).toEqual(1); expect(starredModules.length).toEqual(1);
expect(starredModule.moduleFk).toEqual('Orders'); expect(starredModule.moduleFk).toEqual('order');
expect(starredModule.workerFk).toEqual(activeCtx.accessToken.userId); expect(starredModule.workerFk).toEqual(activeCtx.accessToken.userId);
expect(starredModule.position).toEqual(starredModules.length); expect(starredModule.position).toEqual(starredModules.length);
await app.models.StarredModule.toggleStarredModule(ctx, 'Orders'); await app.models.StarredModule.toggleStarredModule(ctx, 'order');
starredModules = await app.models.StarredModule.getStarredModules(ctx); starredModules = await app.models.StarredModule.getStarredModules(ctx);
expect(starredModules.length).toEqual(0); expect(starredModules.length).toEqual(0);

View File

@ -0,0 +1,60 @@
UPDATE salix.module t
SET t.code = 'supplier'
WHERE t.code LIKE 'Suppliers' ESCAPE '#';
UPDATE salix.module t
SET t.code = 'travel'
WHERE t.code LIKE 'Travels' ESCAPE '#';
UPDATE salix.module t
SET t.code = 'ticket'
WHERE t.code LIKE 'Tickets' ESCAPE '#';
UPDATE salix.module t
SET t.code = 'zone'
WHERE t.code LIKE 'Zones' ESCAPE '#';
UPDATE salix.module t
SET t.code = 'monitor'
WHERE t.code LIKE 'Monitors' ESCAPE '#';
UPDATE salix.module t
SET t.code = 'entry'
WHERE t.code LIKE 'Entries' ESCAPE '#';
UPDATE salix.module t
SET t.code = 'invoiceIn'
WHERE t.code LIKE 'Invoices in' ESCAPE '#';
UPDATE salix.module t
SET t.code = 'customer'
WHERE t.code LIKE 'Clients' ESCAPE '#';
UPDATE salix.module t
SET t.code = 'route'
WHERE t.code LIKE 'Routes' ESCAPE '#';
UPDATE salix.module t
SET t.code = 'item'
WHERE t.code LIKE 'Items' ESCAPE '#';
UPDATE salix.module t
SET t.code = 'claim'
WHERE t.code LIKE 'Claims' ESCAPE '#';
UPDATE salix.module t
SET t.code = 'user'
WHERE t.code LIKE 'Users' ESCAPE '#';
UPDATE salix.module t
SET t.code = 'invoiceOut'
WHERE t.code LIKE 'Invoices out' ESCAPE '#';
UPDATE salix.module t
SET t.code = 'order'
WHERE t.code LIKE 'Orders' ESCAPE '#';
UPDATE salix.module t
SET t.code = 'worker'
WHERE t.code LIKE 'Workers' ESCAPE '#';

View File

@ -0,0 +1,16 @@
UPDATE `vn`.starredModule SET moduleFk = 'customer' WHERE moduleFk = 'Clients';
UPDATE `vn`.starredModule SET moduleFk = 'ticket' WHERE moduleFk = 'Tickets';
UPDATE `vn`.starredModule SET moduleFk = 'route' WHERE moduleFk = 'Routes';
UPDATE `vn`.starredModule SET moduleFk = 'zone' WHERE moduleFk = 'Zones';
UPDATE `vn`.starredModule SET moduleFk = 'order' WHERE moduleFk = 'Orders';
UPDATE `vn`.starredModule SET moduleFk = 'claim' WHERE moduleFk = 'Claims';
UPDATE `vn`.starredModule SET moduleFk = 'item' WHERE moduleFk = 'Items';
UPDATE `vn`.starredModule SET moduleFk = 'worker' WHERE moduleFk = 'Workers';
UPDATE `vn`.starredModule SET moduleFk = 'entry' WHERE moduleFk = 'Entries';
UPDATE `vn`.starredModule SET moduleFk = 'invoiceOut' WHERE moduleFk = 'Invoices out';
UPDATE `vn`.starredModule SET moduleFk = 'invoiceIn' WHERE moduleFk = 'Invoices in';
UPDATE `vn`.starredModule SET moduleFk = 'monitor' WHERE moduleFk = 'Monitors';
UPDATE `vn`.starredModule SET moduleFk = 'user' WHERE moduleFk = 'Users';
UPDATE `vn`.starredModule SET moduleFk = 'supplier' WHERE moduleFk = 'Suppliers';
UPDATE `vn`.starredModule SET moduleFk = 'travel' WHERE moduleFk = 'Travels';
UPDATE `vn`.starredModule SET moduleFk = 'shelving' WHERE moduleFk = 'Shelvings';

View File

@ -923,21 +923,21 @@ INSERT INTO `vn`.`expeditionStateType`(`id`, `description`, `code`)
(3, 'Perdida', 'LOST'); (3, 'Perdida', 'LOST');
INSERT INTO `vn`.`expedition`(`id`, `agencyModeFk`, `ticketFk`, `freightItemFk`, `created`, `itemFk__`, `counter`, `workerFk`, `externalId`, `packagingFk`, `stateTypeFk`, `hostFk`) INSERT INTO `vn`.`expedition`(`id`, `agencyModeFk`, `ticketFk`, `freightItemFk`, `created`, `counter`, `workerFk`, `externalId`, `packagingFk`, `stateTypeFk`, `hostFk`)
VALUES VALUES
(1, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 15, 1, 18, 'UR9000006041', 94, 1, 'pc1'), (1, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 18, 'UR9000006041', 94, 1, 'pc1'),
(2, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 16, 2, 18, 'UR9000006041', 94, 1, NULL), (2, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2, 18, 'UR9000006041', 94, 1, NULL),
(3, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), NULL, 3, 18, 'UR9000006041', 94, 2, NULL), (3, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 3, 18, 'UR9000006041', 94, 2, NULL),
(4, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), NULL, 4, 18, 'UR9000006041', 94, 2, NULL), (4, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 4, 18, 'UR9000006041', 94, 2, NULL),
(5, 1, 2, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), NULL, 1, 18, NULL, 94, 3, NULL), (5, 1, 2, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 18, NULL, 94, 3, NULL),
(6, 7, 3, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), NULL, 1, 18, NULL, 94, 3, NULL), (6, 7, 3, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), 1, 18, NULL, 94, 3, NULL),
(7, 2, 4, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -3 MONTH), NULL, 1, 18, NULL, 94, NULL,NULL), (7, 2, 4, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -3 MONTH), 1, 18, NULL, 94, NULL,NULL),
(8, 3, 5, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -4 MONTH), NULL, 1, 18, NULL, 94, 1, NULL), (8, 3, 5, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -4 MONTH), 1, 18, NULL, 94, 1, NULL),
(9, 3, 6, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), NULL, 1, 18, NULL, 94, 2, NULL), (9, 3, 6, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 18, NULL, 94, 2, NULL),
(10, 7, 7, 71, NOW(), NULL, 1, 18, NULL, 94, 3, NULL), (10, 7, 7, 71, NOW(), 1, 18, NULL, 94, 3, NULL),
(11, 7, 8, 71, NOW(), NULL, 1, 18, NULL, 94, 3, NULL), (11, 7, 8, 71, NOW(), 1, 18, NULL, 94, 3, NULL),
(12, 7, 9, 71, NOW(), NULL, 1, 18, NULL, 94, 3, NULL), (12, 7, 9, 71, NOW(), 1, 18, NULL, 94, 3, NULL),
(13, 1, 10,71, NOW(), NULL, 1, 18, NULL, 94, 3, NULL); (13, 1, 10,71, NOW(), 1, 18, NULL, 94, 3, NULL);
INSERT INTO `vn`.`expeditionState`(`id`, `created`, `expeditionFk`, `typeFk`, `userFk`) INSERT INTO `vn`.`expeditionState`(`id`, `created`, `expeditionFk`, `typeFk`, `userFk`)

View File

@ -147,7 +147,7 @@ export default class SmartTable extends Component {
for (const column of this.columns) { for (const column of this.columns) {
if (viewConfig.configuration[column.field] == false) { if (viewConfig.configuration[column.field] == false) {
const baseSelector = `smart-table[view-config-id="${this.viewConfigId}"] table`; const baseSelector = `smart-table[view-config-id="${this.viewConfigId}"] table`;
selectors.push(`${baseSelector} thead > tr > th:nth-child(${column.index + 1})`); selectors.push(`${baseSelector} thead > tr:not([second-header]) > th:nth-child(${column.index + 1})`);
selectors.push(`${baseSelector} tbody > tr > td:nth-child(${column.index + 1})`); selectors.push(`${baseSelector} tbody > tr > td:nth-child(${column.index + 1})`);
} }
} }
@ -235,7 +235,7 @@ export default class SmartTable extends Component {
} }
registerColumns() { registerColumns() {
const header = this.element.querySelector('thead > tr'); const header = this.element.querySelector('thead > tr:not([second-header])');
if (!header) return; if (!header) return;
const columns = header.querySelectorAll('th'); const columns = header.querySelectorAll('th');
@ -254,7 +254,7 @@ export default class SmartTable extends Component {
} }
emptyDataRows() { emptyDataRows() {
const header = this.element.querySelector('thead > tr'); const header = this.element.querySelector('thead > tr:not([second-header])');
const columns = header.querySelectorAll('th'); const columns = header.querySelectorAll('th');
const tbody = this.element.querySelector('tbody'); const tbody = this.element.querySelector('tbody');
if (tbody) { if (tbody) {
@ -333,7 +333,7 @@ export default class SmartTable extends Component {
} }
displaySearch() { displaySearch() {
const header = this.element.querySelector('thead > tr'); const header = this.element.querySelector('thead > tr:not([second-header])');
if (!header) return; if (!header) return;
const tbody = this.element.querySelector('tbody'); const tbody = this.element.querySelector('tbody');

View File

@ -8,6 +8,16 @@ smart-table table {
& > thead { & > thead {
border-bottom: $border; border-bottom: $border;
& > tr[second-header] {
& > th
{
text-align: center;
border-bottom-style: groove;
font-weight: bold;
text-transform: uppercase;
}
}
& > * > th { & > * > th {
font-weight: normal; font-weight: normal;
} }
@ -60,6 +70,9 @@ smart-table table {
vertical-align: middle; vertical-align: middle;
} }
} }
&[separator]{
border-left-style: groove;
}
vn-icon.bright, i.bright { vn-icon.bright, i.bright {
color: #f7931e; color: #f7931e;
} }

View File

@ -29,6 +29,7 @@ export default class Modules {
const module = { const module = {
name: mod.name || mod.module, name: mod.name || mod.module,
code: mod.module,
icon: mod.icon || null, icon: mod.icon || null,
route, route,
keyBind keyBind

View File

@ -33,7 +33,9 @@ export default class Controller extends Component {
if (!res.data.length) return; if (!res.data.length) return;
for (let starredModule of res.data) { for (let starredModule of res.data) {
const module = this.modules.find(mod => mod.name === starredModule.moduleFk); let moduleName = starredModule.moduleFk;
if (moduleName === 'customer') moduleName = 'client';
const module = this.modules.find(mod => mod.code === moduleName);
if (module) { if (module) {
module.starred = true; module.starred = true;
module.position = starredModule.position; module.position = starredModule.position;
@ -47,8 +49,10 @@ export default class Controller extends Component {
if (event.defaultPrevented) return; if (event.defaultPrevented) return;
event.preventDefault(); event.preventDefault();
event.stopPropagation(); event.stopPropagation();
let moduleName = module.code;
if (moduleName === 'client') moduleName = 'customer';
const params = {moduleName: module.name}; const params = {moduleName};
const query = `starredModules/toggleStarredModule`; const query = `starredModules/toggleStarredModule`;
this.$http.post(query, params).then(res => { this.$http.post(query, params).then(res => {
if (res.data) { if (res.data) {
@ -84,13 +88,16 @@ export default class Controller extends Component {
event.preventDefault(); event.preventDefault();
event.stopPropagation(); event.stopPropagation();
const params = {moduleName: module.name, direction: direction}; let moduleName = module.code;
if (moduleName === 'client') moduleName = 'customer';
const params = {moduleName: moduleName, direction: direction};
const query = `starredModules/setPosition`; const query = `starredModules/setPosition`;
this.$http.post(query, params).then(res => { this.$http.post(query, params).then(res => {
if (res.data) { if (res.data) {
module.position = res.data.movingModule.position; module.position = res.data.movingModule.position;
this.modules.forEach(mod => { this.modules.forEach(mod => {
if (mod.name == res.data.pushedModule.moduleFk) if (mod.code == res.data.pushedModule.moduleFk)
mod.position = res.data.pushedModule.position; mod.position = res.data.pushedModule.position;
}); });
this.vnApp.showSuccess(this.$t('Data saved!')); this.vnApp.showSuccess(this.$t('Data saved!'));

View File

@ -19,7 +19,7 @@ describe('Salix Component vnHome', () => {
describe('getStarredModules()', () => { describe('getStarredModules()', () => {
it('should not set any of the modules as starred if there are no starred modules for the user', () => { it('should not set any of the modules as starred if there are no starred modules for the user', () => {
const expectedResponse = []; const expectedResponse = [];
controller._modules = [{module: 'client', name: 'Clients'}]; controller._modules = [{code: 'client', name: 'Clients'}];
$httpBackend.whenRoute('GET', 'starredModules/getStarredModules').respond(expectedResponse); $httpBackend.whenRoute('GET', 'starredModules/getStarredModules').respond(expectedResponse);
$httpBackend.expectGET('starredModules/getStarredModules').respond(expectedResponse); $httpBackend.expectGET('starredModules/getStarredModules').respond(expectedResponse);
@ -31,8 +31,8 @@ describe('Salix Component vnHome', () => {
}); });
it('should set the example module as starred since its the starred module for the user', () => { it('should set the example module as starred since its the starred module for the user', () => {
const expectedResponse = [{id: 1, moduleFk: 'Clients', workerFk: 9}]; const expectedResponse = [{id: 1, moduleFk: 'customer', workerFk: 9}];
controller._modules = [{module: 'client', name: 'Clients'}]; controller._modules = [{code: 'client', name: 'Clients'}];
$httpBackend.whenRoute('GET', 'starredModules/getStarredModules').respond(expectedResponse); $httpBackend.whenRoute('GET', 'starredModules/getStarredModules').respond(expectedResponse);
$httpBackend.expectGET('starredModules/getStarredModules').respond(expectedResponse); $httpBackend.expectGET('starredModules/getStarredModules').respond(expectedResponse);
@ -48,7 +48,7 @@ describe('Salix Component vnHome', () => {
it(`should set the received module as starred if it wasn't starred`, () => { it(`should set the received module as starred if it wasn't starred`, () => {
const expectedResponse = [{id: 1, moduleFk: 'Clients', workerFk: 9}]; const expectedResponse = [{id: 1, moduleFk: 'Clients', workerFk: 9}];
const event = new Event('target'); const event = new Event('target');
controller._modules = [{module: 'client', name: 'Clients'}]; controller._modules = [{code: 'client', name: 'Clients'}];
$httpBackend.whenRoute('GET', 'starredModules/getStarredModules').respond(expectedResponse); $httpBackend.whenRoute('GET', 'starredModules/getStarredModules').respond(expectedResponse);
$httpBackend.expectPOST('starredModules/toggleStarredModule').respond(expectedResponse); $httpBackend.expectPOST('starredModules/toggleStarredModule').respond(expectedResponse);
@ -61,7 +61,7 @@ describe('Salix Component vnHome', () => {
it('should set the received module as regular if it was starred', () => { it('should set the received module as regular if it was starred', () => {
const event = new Event('target'); const event = new Event('target');
controller._modules = [{module: 'client', name: 'Clients', starred: true}]; controller._modules = [{code: 'client', name: 'Clients', starred: true}];
$httpBackend.whenRoute('GET', 'starredModules/getStarredModules').respond([]); $httpBackend.whenRoute('GET', 'starredModules/getStarredModules').respond([]);
$httpBackend.expectPOST('starredModules/toggleStarredModule').respond(undefined); $httpBackend.expectPOST('starredModules/toggleStarredModule').respond(undefined);
@ -76,18 +76,18 @@ describe('Salix Component vnHome', () => {
describe('moveModule()', () => { describe('moveModule()', () => {
it('should perform a query to setPosition and the apply the position to the moved and pushed modules', () => { it('should perform a query to setPosition and the apply the position to the moved and pushed modules', () => {
const starredModules = [ const starredModules = [
{id: 1, moduleFk: 'Clients', workerFk: 9}, {id: 1, moduleFk: 'customer', workerFk: 9},
{id: 2, moduleFk: 'Orders', workerFk: 9} {id: 2, moduleFk: 'order', workerFk: 9}
]; ];
const movedModules = { const movedModules = {
movingModule: {position: 2, moduleFk: 'Clients'}, movingModule: {position: 2, moduleFk: 'customer'},
pushedModule: {position: 1, moduleFk: 'Orders'} pushedModule: {position: 1, moduleFk: 'order'}
}; };
const event = new Event('target'); const event = new Event('target');
controller._modules = [ controller._modules = [
{module: 'client', name: 'Clients', position: 1}, {code: 'client', name: 'Clients', position: 1},
{module: 'orders', name: 'Orders', position: 2} {code: 'order', name: 'Orders', position: 2}
]; ];
$httpBackend.whenRoute('GET', 'starredModules/getStarredModules').respond(starredModules); $httpBackend.whenRoute('GET', 'starredModules/getStarredModules').respond(starredModules);

View File

@ -66,9 +66,9 @@
"MESSAGE_INSURANCE_CHANGE": "I have changed the insurence credit of client [{{clientName}} ({{clientId}})]({{{url}}}) to *{{credit}} €*", "MESSAGE_INSURANCE_CHANGE": "I have changed the insurence credit of client [{{clientName}} ({{clientId}})]({{{url}}}) to *{{credit}} €*",
"Changed client paymethod": "I have changed the pay method for client [{{clientName}} ({{clientId}})]({{{url}}})", "Changed client 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}}})", "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", "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*",
"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}}",
@ -136,7 +136,7 @@
"Password does not meet requirements": "Password does not meet requirements", "Password does not meet requirements": "Password does not meet requirements",
"You don't have privileges to change the zone": "You don't have privileges to change the zone or for these parameters there are more than one shipping options, talk to agencies", "You don't have privileges to change the zone": "You don't have privileges to change the zone or for these parameters there are more than one shipping options, talk to agencies",
"Not enough privileges to edit a client": "Not enough privileges to edit a client", "Not enough privileges to edit a client": "Not enough privileges to edit a client",
"Claim pickup order sent": "Claim pickup order sent [({{claimId}})]({{{claimUrl}}}) to client *{{clientName}}*", "Claim pickup order sent": "Claim pickup order sent [{{claimId}}]({{{claimUrl}}}) to client *{{clientName}}*",
"You don't have grant privilege": "You don't have grant privilege", "You don't have grant privilege": "You don't have grant privilege",
"You don't own the role and you can't assign it to another user": "You don't own the role and you can't assign it to another user", "You don't own the role and you can't assign it to another user": "You don't own the role and you can't assign it to another user",
"Email verify": "Email verify", "Email verify": "Email verify",

View File

@ -134,9 +134,9 @@
"MESSAGE_INSURANCE_CHANGE": "He cambiado el crédito asegurado del cliente [{{clientName}} ({{clientId}})]({{{url}}}) a *{{credit}} €*", "MESSAGE_INSURANCE_CHANGE": "He cambiado el crédito asegurado del cliente [{{clientName}} ({{clientId}})]({{{url}}}) a *{{credit}} €*",
"Changed client paymethod": "He cambiado la forma de pago del cliente [{{clientName}} ({{clientId}})]({{{url}}})", "Changed client 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}}})", "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}}*", "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*",
"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",
@ -238,7 +238,7 @@
"Modifiable password only via recovery or by an administrator": "Contraseña modificable solo a través de la recuperación o por un administrador", "Modifiable password only via recovery or by an administrator": "Contraseña modificable solo a través de la recuperación o por un administrador",
"Not enough privileges to edit a client": "No tienes suficientes privilegios para editar un cliente", "Not enough privileges to edit a client": "No tienes suficientes privilegios para editar un cliente",
"This route does not exists": "Esta ruta no existe", "This route does not exists": "Esta ruta no existe",
"Claim pickup order sent": "Reclamación Orden de recogida enviada [({{claimId}})]({{{claimUrl}}}) al cliente *{{clientName}}*", "Claim pickup order sent": "Reclamación Orden de recogida enviada [{{claimId}}]({{{claimUrl}}}) al cliente *{{clientName}}*",
"You don't have grant privilege": "No tienes privilegios para dar privilegios", "You don't have grant privilege": "No tienes privilegios para dar privilegios",
"You don't own the role and you can't assign it to another user": "No eres el propietario del rol y no puedes asignarlo a otro usuario", "You don't own the role and you can't assign it to another user": "No eres el propietario del rol y no puedes asignarlo a otro usuario",
"Ticket merged": "Ticket [{{id}}]({{{fullPath}}}) ({{{originDated}}}) fusionado con [{{tfId}}]({{{fullPathFuture}}}) ({{{futureDated}}})", "Ticket merged": "Ticket [{{id}}]({{{fullPath}}}) ({{{originDated}}}) fusionado con [{{tfId}}]({{{fullPathFuture}}}) ({{{futureDated}}})",

View File

@ -17,13 +17,13 @@
<vn-horizontal class="vn-px-lg"> <vn-horizontal class="vn-px-lg">
<vn-textfield <vn-textfield
vn-one vn-one
label="Max Lines" label="Max Liters"
ng-model="filter.lines"> ng-model="filter.liters">
</vn-textfield> </vn-textfield>
<vn-textfield <vn-textfield
vn-one vn-one
label="Max Liters" label="Max Lines"
ng-model="filter.liters"> ng-model="filter.lines">
</vn-textfield> </vn-textfield>
</vn-horizontal> </vn-horizontal>
<vn-horizontal class="vn-px-lg"> <vn-horizontal class="vn-px-lg">

View File

@ -1,7 +1,9 @@
<vn-crud-model <vn-crud-model
vn-id="model" vn-id="model"
url="Tickets/getTicketsFuture" url="Tickets/getTicketsFuture"
limit="20"> limit="20"
auto-load="true"
params="model.data">
</vn-crud-model> </vn-crud-model>
<vn-portal slot="topbar"> <vn-portal slot="topbar">
<vn-searchbar <vn-searchbar
@ -30,6 +32,11 @@
<slot-table> <slot-table>
<table> <table>
<thead> <thead>
<tr second-header>
<td></td>
<th colspan="7" translate>Origin</th>
<th colspan="4" translate>Destination</th>
</tr>
<tr> <tr>
<th shrink> <th shrink>
<vn-multi-check <vn-multi-check
@ -42,35 +49,35 @@
<span translate>Problems</span> <span translate>Problems</span>
</th> </th>
<th field="id"> <th field="id">
<span translate>Origin ID</span> <span translate>ID</span>
</th> </th>
<th field="shipped"> <th field="shipped">
<span translate>Origin Date</span> <span translate>Date</span>
</th>
<th field="state">
<span translate>Origin State</span>
</th> </th>
<th field="ipt" title="Item Packing Type"> <th field="ipt" title="Item Packing Type">
<span>IPT</span> <span>IPT</span>
</th> </th>
<th field="state">
<span translate>State</span>
</th>
<th field="liters"> <th field="liters">
<span translate>Liters</span> <span translate>Liters</span>
</th> </th>
<th field="lines"> <th shrink field="lines">
<span translate>Available Lines</span> <span translate>Available Lines</span>
</th> </th>
<th field="ticketFuture"> <th field="ticketFuture" separator>
<span translate>Destination ID</span> <span translate>ID</span>
</th> </th>
<th field="tfShipped"> <th field="tfShipped">
<span translate>Destination Date</span> <span translate>Date</span>
</th>
<th field="tfState">
<span translate>Destination State</span>
</th> </th>
<th field="tfIpt" title="Item Packing Type"> <th field="tfIpt" title="Item Packing Type">
<span>IPT</span> <span>IPT</span>
</th> </th>
<th shrink field="tfState">
<span translate>State</span>
</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -129,13 +136,13 @@
{{::ticket.shipped | date: 'dd/MM/yyyy'}} {{::ticket.shipped | date: 'dd/MM/yyyy'}}
</span> </span>
</td> </td>
<td>{{::ticket.ipt}}</td>
<td> <td>
<span <span
class="chip {{$ctrl.stateColor(ticket.state)}}"> class="chip {{$ctrl.stateColor(ticket.state)}}">
{{::ticket.state}} {{::ticket.state}}
</span> </span>
</td> </td>
<td>{{::ticket.ipt}}</td>
<td>{{::ticket.liters}}</td> <td>{{::ticket.liters}}</td>
<td>{{::ticket.lines}}</td> <td>{{::ticket.lines}}</td>
<td> <td>
@ -150,13 +157,13 @@
{{::ticket.tfShipped | date: 'dd/MM/yyyy'}} {{::ticket.tfShipped | date: 'dd/MM/yyyy'}}
</span> </span>
</td> </td>
<td>{{::ticket.tfIpt}}</td>
<td> <td>
<span <span
class="chip {{$ctrl.stateColor(ticket.tfState)}}"> class="chip {{$ctrl.stateColor(ticket.tfState)}}">
{{::ticket.tfState}} {{::ticket.tfState}}
</span> </span>
</td> </td>
<td>{{::ticket.tfIpt}}</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>

View File

@ -35,7 +35,7 @@ export default class Controller extends Section {
autocomplete: { autocomplete: {
url: 'ItemPackingTypes', url: 'ItemPackingTypes',
showField: 'description', showField: 'description',
valueField: 'description' valueField: 'code'
} }
}, },
{ {
@ -43,7 +43,7 @@ export default class Controller extends Section {
autocomplete: { autocomplete: {
url: 'ItemPackingTypes', url: 'ItemPackingTypes',
showField: 'description', showField: 'description',
valueField: 'description' valueField: 'code'
} }
}, },
] ]
@ -59,6 +59,9 @@ export default class Controller extends Section {
futureDated: today, futureDated: today,
warehouseFk: this.vnConfig.warehouseFk warehouseFk: this.vnConfig.warehouseFk
}; };
this.$.model = {
data: this.filterParams
};
} }
compareDate(date) { compareDate(date) {