From 0d680bdaed73cdc6666f81ef5643a25ff1181d49 Mon Sep 17 00:00:00 2001 From: Bernat Date: Tue, 16 Apr 2019 07:59:29 +0200 Subject: [PATCH 01/59] #1343 update worker filter --- modules/worker/back/methods/worker/filter.js | 7 +++++++ modules/worker/front/search-panel/index.html | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/modules/worker/back/methods/worker/filter.js b/modules/worker/back/methods/worker/filter.js index 961abf291..0673c0e59 100644 --- a/modules/worker/back/methods/worker/filter.js +++ b/modules/worker/back/methods/worker/filter.js @@ -28,6 +28,11 @@ module.exports = Self => { type: 'Integer', description: 'The worker id', http: {source: 'query'} + }, { + arg: 'userFk', + type: 'Integer', + description: 'The user id', + http: {source: 'query'} }, { arg: 'fi', type: 'String', @@ -85,6 +90,8 @@ module.exports = Self => { ]}; case 'id': return {'w.id': value}; + case 'userFk': + return {'w.userFk': value}; case 'name': return {'w.name': {like: `%${value}%`}}; case 'firstName': diff --git a/modules/worker/front/search-panel/index.html b/modules/worker/front/search-panel/index.html index 14abcad45..eda57c540 100644 --- a/modules/worker/front/search-panel/index.html +++ b/modules/worker/front/search-panel/index.html @@ -18,7 +18,7 @@ + model="filter.userFk"> From c2b3ff8d81617d6f79195636c013742609707068 Mon Sep 17 00:00:00 2001 From: Bernat Date: Tue, 16 Apr 2019 08:42:44 +0200 Subject: [PATCH 02/59] #1335 worker/filter renamed columns acordantly --- db/dump/fixtures.sql | 2 +- modules/client/back/methods/client/listWorkers.js | 4 ++-- modules/order/back/methods/order/catalogFilter.js | 2 +- modules/ticket/back/methods/ticket/filter.js | 2 +- modules/worker/back/methods/worker/filter.js | 11 ++++++----- print/report/client-welcome/index.js | 2 +- print/report/printer-setup/index.js | 2 +- 7 files changed, 13 insertions(+), 12 deletions(-) diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index ccc722c44..dda99aea5 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -1260,7 +1260,7 @@ INSERT INTO `pbx`.`sip`(`user_id`, `extension`, `secret`, `caller_id`) (9, 1201, '123456', 'developer'); INSERT INTO `postgresql`.`person`(`person_id`, `name`, `nickname`, `nif`, `firstname`, `id_trabajador`) - SELECT w.id, w.name, u.nickname,CONCAT(RPAD(CONCAT(w.id,9),8,w.id),'A'),w.firstName,w.id + SELECT w.id, w.lastName, u.nickname,CONCAT(RPAD(CONCAT(w.id,9),8,w.id),'A'),w.firstName,w.id FROM `vn`.`worker` `w` JOIN `account`.`user` `u` ON `u`.`id` = `w`.`userFk`; diff --git a/modules/client/back/methods/client/listWorkers.js b/modules/client/back/methods/client/listWorkers.js index 92339e32f..8fa4c085e 100644 --- a/modules/client/back/methods/client/listWorkers.js +++ b/modules/client/back/methods/client/listWorkers.js @@ -16,14 +16,14 @@ module.exports = function(Self) { Self.listWorkers = function() { let query = `SELECT w.id, - CONCAT(w.firstName, IFNULL(CONCAT(" ", w.name), "")) \`name\` + CONCAT(w.firstName, IFNULL(CONCAT(" ", w.lastName), "")) \`name\` FROM worker w JOIN account.user u ON w.userFk = u.id JOIN account.roleRole rr ON rr.role = u.role JOIN account.role r ON r.id = rr.inheritsFrom WHERE u.active AND r.\`name\` = 'employee' - ORDER BY w.name ASC`; + ORDER BY w.lastName ASC`; return Self.rawSql(query); }; diff --git a/modules/order/back/methods/order/catalogFilter.js b/modules/order/back/methods/order/catalogFilter.js index 9fa74647c..6e805d957 100644 --- a/modules/order/back/methods/order/catalogFilter.js +++ b/modules/order/back/methods/order/catalogFilter.js @@ -106,7 +106,7 @@ module.exports = Self => { i.value8, tci.price, tci.available, - w.name AS lastName, + w.lastName AS lastName, w.firstName FROM tmp.ticketCalculateItem tci JOIN vn.item i ON i.id = tci.itemFk diff --git a/modules/ticket/back/methods/ticket/filter.js b/modules/ticket/back/methods/ticket/filter.js index 9c6c5cbe6..b9c11d4fa 100644 --- a/modules/ticket/back/methods/ticket/filter.js +++ b/modules/ticket/back/methods/ticket/filter.js @@ -187,7 +187,7 @@ module.exports = Self => { w.name AS warehouse, am.name AS agencyMode, st.name AS state, - wk.name AS salesPerson, + wk.lastName AS salesPerson, ts.stateFk as stateFk, ts.alertLevel as alertLevel, ts.code as alertLevelCode, diff --git a/modules/worker/back/methods/worker/filter.js b/modules/worker/back/methods/worker/filter.js index 0673c0e59..21462eb42 100644 --- a/modules/worker/back/methods/worker/filter.js +++ b/modules/worker/back/methods/worker/filter.js @@ -61,7 +61,7 @@ module.exports = Self => { }, { arg: 'nickname', type: 'String', - description: 'The worker name', + description: 'The worker nickname', http: {source: 'query'} } ], @@ -85,15 +85,16 @@ module.exports = Self => { ? {'w.id': value} : {or: [ {'w.firstName': {like: `%${value}%`}}, - {'w.name': {like: `%${value}%`}}, - {'u.name': {like: `%${value}%`}} + {'w.lastName': {like: `%${value}%`}}, + {'u.name': {like: `%${value}%`}}, + {'u.nickname': {like: `%${value}%`}} ]}; case 'id': return {'w.id': value}; case 'userFk': return {'w.userFk': value}; case 'name': - return {'w.name': {like: `%${value}%`}}; + return {'w.lastName': {like: `%${value}%`}}; case 'firstName': return {'w.firstName': {like: `%${value}%`}}; case 'extension': @@ -114,7 +115,7 @@ module.exports = Self => { stmt = new ParameterizedSQL( `SELECT w.id, u.email, p.extension, u.name as userName, - d.name AS department, w.name, u.nickname, mu.email + d.name AS department, w.lastName, u.nickname, mu.email FROM worker w LEFT JOIN workerDepartment wd ON wd.workerFk = w.id LEFT JOIN department d ON d.id = wd.departmentFk diff --git a/print/report/client-welcome/index.js b/print/report/client-welcome/index.js index 1e6b7934c..b2278b4ee 100755 --- a/print/report/client-welcome/index.js +++ b/print/report/client-welcome/index.js @@ -30,7 +30,7 @@ module.exports = { u.lang locale, u.name AS userName, c.email recipient, - CONCAT(w.name, ' ', w.firstName) salesPersonName, + CONCAT(w.lastName, ' ', w.firstName) salesPersonName, w.phone AS salesPersonPhone, CONCAT(wu.name, '@verdnatura.es') AS salesPersonEmail FROM client c diff --git a/print/report/printer-setup/index.js b/print/report/printer-setup/index.js index 5a2c5758b..1353d996c 100755 --- a/print/report/printer-setup/index.js +++ b/print/report/printer-setup/index.js @@ -38,7 +38,7 @@ module.exports = { u.lang locale, u.name AS userName, c.email recipient, - CONCAT(w.name, ' ', w.firstName) salesPersonName, + CONCAT(w.lastName, ' ', w.firstName) salesPersonName, w.phone AS salesPersonPhone, CONCAT(wu.name, '@verdnatura.es') AS salesPersonEmail FROM client c From 02c63b0d5ff08cbdb343cbd4a6bfc87fc1b81bef Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Tue, 16 Apr 2019 08:46:59 +0200 Subject: [PATCH 03/59] refactor tests --- modules/claim/front/action/index.spec.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/claim/front/action/index.spec.js b/modules/claim/front/action/index.spec.js index 9842bf646..0823b19ef 100644 --- a/modules/claim/front/action/index.spec.js +++ b/modules/claim/front/action/index.spec.js @@ -161,11 +161,13 @@ describe('claim', () => { describe('onUpdateGreugeResponse()', () => { it('should do nothing', () => { + spyOn(controller.$http, 'post'); spyOn(controller.card, 'reload'); spyOn(controller.vnApp, 'showSuccess'); controller.onUpdateGreugeResponse('CANCEL'); + expect(controller.$http.post).not.toHaveBeenCalledWith(); expect(controller.card.reload).not.toHaveBeenCalledWith(); expect(controller.vnApp.showSuccess).not.toHaveBeenCalledWith('Greuge inserted!'); }); From a326fd2a658213e8cf501a914e3c09c557ada7cc Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Tue, 16 Apr 2019 11:32:45 +0200 Subject: [PATCH 04/59] #1306 Renombrar controladores, rutas y carpetas --- e2e/helpers/selectors.js | 2 +- .../04_edit_pay_method.spec.js | 68 +++++++++---------- modules/client/front/billing-data/index.html | 2 +- modules/client/front/locale/es.yml | 2 +- modules/client/front/routes.json | 2 +- 5 files changed, 38 insertions(+), 38 deletions(-) diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index a8c3d44dc..d01ae6622 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -75,7 +75,7 @@ export default { viesCheckbox: `vn-check[label='Vies'] md-checkbox`, saveButton: `${components.vnSubmit}` }, - clientPayMethod: { + clientBillingData: { payMethodAutocomplete: `vn-autocomplete[field="$ctrl.client.payMethodFk"]`, IBANInput: `${components.vnTextfield}[name="iban"]`, dueDayInput: `${components.vnInputNumber}[name="dueDay"]`, diff --git a/e2e/paths/02-client-module/04_edit_pay_method.spec.js b/e2e/paths/02-client-module/04_edit_pay_method.spec.js index c315371e0..a73172d00 100644 --- a/e2e/paths/02-client-module/04_edit_pay_method.spec.js +++ b/e2e/paths/02-client-module/04_edit_pay_method.spec.js @@ -1,7 +1,7 @@ import selectors from '../../helpers/selectors.js'; import createNightmare from '../../helpers/nightmare'; -describe('Client Edit pay method path', () => { +describe('Client Edit billing data path', () => { const nightmare = createNightmare(); beforeAll(() => { @@ -11,17 +11,17 @@ describe('Client Edit pay method path', () => { .accessToSection('client.card.billingData'); }); - it(`should attempt to edit the Pay method without an IBAN but fail`, async() => { + it(`should attempt to edit the billing data without an IBAN but fail`, async() => { const snackbarMessage = await nightmare - .autocompleteSearch(selectors.clientPayMethod.payMethodAutocomplete, 'PayMethod with IBAN') - .autocompleteSearch(selectors.clientPayMethod.swiftBicAutocomplete, 'BBKKESMMMMM') - .clearInput(selectors.clientPayMethod.dueDayInput) - .write(selectors.clientPayMethod.dueDayInput, '60') - .waitForTextInInput(selectors.clientPayMethod.dueDayInput, '60') - .waitToClick(selectors.clientPayMethod.receivedCoreLCRCheckbox) - .waitToClick(selectors.clientPayMethod.receivedCoreVNLCheckbox) - .waitToClick(selectors.clientPayMethod.receivedB2BVNLCheckbox) - .waitToClick(selectors.clientPayMethod.saveButton) + .autocompleteSearch(selectors.clientBillingData.payMethodAutocomplete, 'PayMethod with IBAN') + .autocompleteSearch(selectors.clientBillingData.swiftBicAutocomplete, 'BBKKESMMMMM') + .clearInput(selectors.clientBillingData.dueDayInput) + .write(selectors.clientBillingData.dueDayInput, '60') + .waitForTextInInput(selectors.clientBillingData.dueDayInput, '60') + .waitToClick(selectors.clientBillingData.receivedCoreLCRCheckbox) + .waitToClick(selectors.clientBillingData.receivedCoreVNLCheckbox) + .waitToClick(selectors.clientBillingData.receivedB2BVNLCheckbox) + .waitToClick(selectors.clientBillingData.saveButton) .waitForLastSnackbar(); expect(snackbarMessage).toEqual('That payment method requires an IBAN'); @@ -29,12 +29,12 @@ describe('Client Edit pay method path', () => { it(`should add the IBAN but fail as it requires a BIC code`, async() => { const snackbarMessage = await nightmare - .waitToClick(selectors.clientPayMethod.clearswiftBicButton) - .clearInput(selectors.clientPayMethod.IBANInput) - .write(selectors.clientPayMethod.IBANInput, 'FR9121000418450200051332') - .waitForTextInInput(selectors.clientPayMethod.IBANInput, 'FR9121000418450200051332') + .waitToClick(selectors.clientBillingData.clearswiftBicButton) + .clearInput(selectors.clientBillingData.IBANInput) + .write(selectors.clientBillingData.IBANInput, 'FR9121000418450200051332') + .waitForTextInInput(selectors.clientBillingData.IBANInput, 'FR9121000418450200051332') .wait(1000) - .waitToClick(selectors.clientPayMethod.saveButton) + .waitToClick(selectors.clientBillingData.saveButton) .waitForLastSnackbar(); expect(snackbarMessage).toEqual('That payment method requires a BIC'); @@ -42,36 +42,36 @@ describe('Client Edit pay method path', () => { it(`should create a new BIC code`, async() => { const newcode = await nightmare - .waitToClick(selectors.clientPayMethod.newBankEntityButton) - .write(selectors.clientPayMethod.newBankEntityName, 'Gotham City Bank') - .write(selectors.clientPayMethod.newBankEntityCode, 9999) - .write(selectors.clientPayMethod.newBankEntityBIC, 'GTHMCT') - .waitToClick(selectors.clientPayMethod.acceptBankEntityButton) - .waitToGetProperty(`${selectors.clientPayMethod.swiftBicAutocomplete} input`, 'value'); + .waitToClick(selectors.clientBillingData.newBankEntityButton) + .write(selectors.clientBillingData.newBankEntityName, 'Gotham City Bank') + .write(selectors.clientBillingData.newBankEntityCode, 9999) + .write(selectors.clientBillingData.newBankEntityBIC, 'GTHMCT') + .waitToClick(selectors.clientBillingData.acceptBankEntityButton) + .waitToGetProperty(`${selectors.clientBillingData.swiftBicAutocomplete} input`, 'value'); expect(newcode).toEqual('GTHMCT Gotham City Bank'); }); it(`should confirm the IBAN pay method is sucessfully saved`, async() => { const payMethod = await nightmare - .waitToGetProperty(`${selectors.clientPayMethod.payMethodAutocomplete} input`, 'value'); + .waitToGetProperty(`${selectors.clientBillingData.payMethodAutocomplete} input`, 'value'); expect(payMethod).toEqual('PayMethod with IBAN'); }); it(`should clear the BIC code field, update the IBAN to see how he BIC code autocompletes`, async() => { const AutomaticCode = await nightmare - .clearInput(selectors.clientPayMethod.IBANInput) - .waitToClick(selectors.clientPayMethod.clearswiftBicButton) - .write(selectors.clientPayMethod.IBANInput, 'ES9121000418450200051332') - .waitToGetProperty(`${selectors.clientPayMethod.swiftBicAutocomplete} input`, 'value'); + .clearInput(selectors.clientBillingData.IBANInput) + .waitToClick(selectors.clientBillingData.clearswiftBicButton) + .write(selectors.clientBillingData.IBANInput, 'ES9121000418450200051332') + .waitToGetProperty(`${selectors.clientBillingData.swiftBicAutocomplete} input`, 'value'); expect(AutomaticCode).toEqual('CAIXESBB Caixa Bank'); }); it(`should save the form with all its new data`, async() => { const snackbarMessages = await nightmare - .waitToClick(selectors.clientPayMethod.saveButton) + .waitToClick(selectors.clientBillingData.saveButton) .waitForSnackbar(); expect(snackbarMessages).toEqual(jasmine.arrayContaining(['Data saved!'])); @@ -79,42 +79,42 @@ describe('Client Edit pay method path', () => { it('should confirm the due day have been edited', async() => { const dueDate = await nightmare - .waitToGetProperty(selectors.clientPayMethod.dueDayInput, 'value'); + .waitToGetProperty(selectors.clientBillingData.dueDayInput, 'value'); expect(dueDate).toEqual('60'); }); it('should confirm the IBAN was saved', async() => { const IBAN = await nightmare - .waitToGetProperty(selectors.clientPayMethod.IBANInput, 'value'); + .waitToGetProperty(selectors.clientBillingData.IBANInput, 'value'); expect(IBAN).toEqual('ES9121000418450200051332'); }); it('should confirm the swift / BIC code was saved', async() => { const code = await nightmare - .waitToGetProperty(`${selectors.clientPayMethod.swiftBicAutocomplete} input`, 'value'); + .waitToGetProperty(`${selectors.clientBillingData.swiftBicAutocomplete} input`, 'value'); expect(code).toEqual('CAIXESBB Caixa Bank'); }); it('should confirm Received LCR checkbox is checked', async() => { const result = await nightmare - .checkboxState(selectors.clientPayMethod.receivedCoreLCRCheckbox); + .checkboxState(selectors.clientBillingData.receivedCoreLCRCheckbox); expect(result).toBe('checked'); }); it('should confirm Received core VNL checkbox is unchecked', async() => { const result = await nightmare - .checkboxState(selectors.clientPayMethod.receivedCoreVNLCheckbox); + .checkboxState(selectors.clientBillingData.receivedCoreVNLCheckbox); expect(result).toBe('unchecked'); }); it('should confirm Received B2B VNL checkbox is unchecked', async() => { const result = await nightmare - .checkboxState(selectors.clientPayMethod.receivedB2BVNLCheckbox); + .checkboxState(selectors.clientBillingData.receivedB2BVNLCheckbox); expect(result).toBe('unchecked'); }); diff --git a/modules/client/front/billing-data/index.html b/modules/client/front/billing-data/index.html index 0829381d8..b17f5dbf1 100644 --- a/modules/client/front/billing-data/index.html +++ b/modules/client/front/billing-data/index.html @@ -10,7 +10,7 @@ Date: Tue, 16 Apr 2019 12:11:06 +0200 Subject: [PATCH 05/59] fixed catalog price popover --- modules/order/front/prices-popover/index.html | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/modules/order/front/prices-popover/index.html b/modules/order/front/prices-popover/index.html index 82df68707..def04cb16 100644 --- a/modules/order/front/prices-popover/index.html +++ b/modules/order/front/prices-popover/index.html @@ -48,11 +48,10 @@ x {{::price.price | currency: 'EUR': 2}} - From 9a86929e3a1e98cf01a1b7307ad192b7ccbc8f0c Mon Sep 17 00:00:00 2001 From: Bernat Date: Tue, 16 Apr 2019 13:10:06 +0200 Subject: [PATCH 06/59] #1344 create test for worker filter --- .../back/methods/worker/specs/filter.spec.js | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 modules/worker/back/methods/worker/specs/filter.spec.js diff --git a/modules/worker/back/methods/worker/specs/filter.spec.js b/modules/worker/back/methods/worker/specs/filter.spec.js new file mode 100644 index 000000000..c1bc05ae8 --- /dev/null +++ b/modules/worker/back/methods/worker/specs/filter.spec.js @@ -0,0 +1,25 @@ +const app = require('vn-loopback/server/server'); + +describe('worker filter()', () => { + it('should return 1 result filtering by id', async() => { + let result = await app.models.Worker.filter({args: {filter: {}, search: 1}}); + + expect(result.length).toEqual(1); + expect(result[0].id).toEqual(1); + }); + + it('should return 1 result filtering by string', async() => { + let result = await app.models.Worker.filter({args: {filter: {}, search: 'administrativeNick'}}); + + expect(result.length).toEqual(1); + expect(result[0].id).toEqual(5); + }); + + it('should return 2 results filtering by name', async() => { + let result = await app.models.Worker.filter({args: {filter: {}, name: 'agency'}}); + + expect(result.length).toEqual(2); + expect(result[0].nickname).toEqual('agencyNick'); + expect(result[1].nickname).toEqual('agencyBossNick'); + }); +}); From 85851e7a33ee4c6d92789eeb70b1316f312f004f Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Tue, 16 Apr 2019 13:40:26 +0200 Subject: [PATCH 07/59] #1306 Renombrar controladores, rutas y carpetas --- e2e/helpers/selectors.js | 14 ++-- e2e/paths/02-client-module/14_risk.spec.js | 68 +++++++++---------- .../front/{risk => balance}/create/index.html | 0 .../front/{risk => balance}/create/index.js | 2 +- .../front/{risk => balance}/create/style.scss | 0 .../front/{risk => balance}/index/index.html | 10 +-- .../front/{risk => balance}/index/index.js | 12 ++-- .../{risk => balance}/index/index.spec.js | 4 +- .../{risk => balance}/index/locale/es.yml | 0 .../front/{risk => balance}/index/style.scss | 0 modules/client/front/index.js | 4 +- modules/client/front/routes.json | 14 ++-- 12 files changed, 64 insertions(+), 64 deletions(-) rename modules/client/front/{risk => balance}/create/index.html (100%) rename modules/client/front/{risk => balance}/create/index.js (97%) rename modules/client/front/{risk => balance}/create/style.scss (100%) rename modules/client/front/{risk => balance}/index/index.html (93%) rename modules/client/front/{risk => balance}/index/index.js (90%) rename modules/client/front/{risk => balance}/index/index.spec.js (92%) rename modules/client/front/{risk => balance}/index/locale/es.yml (100%) rename modules/client/front/{risk => balance}/index/style.scss (100%) diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index d01ae6622..751d17afc 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -157,14 +157,14 @@ export default { lastModificationCurrentValue: 'vn-client-log vn-table vn-td.after' }, - clientRisk: { - riskButton: `vn-left-menu a[ui-sref="client.card.risk.index"]`, - companyAutocomplete: 'vn-client-risk-index vn-autocomplete[field="$ctrl.companyFk"]', + clientBalance: { + balanceButton: `vn-left-menu a[ui-sref="client.card.balance.index"]`, + companyAutocomplete: 'vn-client-balance-index vn-autocomplete[field="$ctrl.companyFk"]', newPaymentButton: `${components.vnFloatButton}`, - newPaymentBankInut: `vn-client-risk-create vn-textfield[field="$ctrl.receipt.bankFk"] input`, - newPaymentAmountInput: `vn-client-risk-create vn-input-number[field="$ctrl.receipt.amountPaid"] input`, - saveButton: `vn-client-risk-create vn-button[label="Save"]`, - firstRiskLineBalance: 'vn-client-risk-index vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(8)' + newPaymentBankInut: `vn-client-balance-create vn-textfield[field="$ctrl.receipt.bankFk"] input`, + newPaymentAmountInput: `vn-client-balance-create vn-input-number[field="$ctrl.receipt.amountPaid"] input`, + saveButton: `vn-client-balance-create vn-button[label="Save"]`, + firstBalanceLine: 'vn-client-balance-index vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(8)' }, webPayment: { diff --git a/e2e/paths/02-client-module/14_risk.spec.js b/e2e/paths/02-client-module/14_risk.spec.js index 58cfb5b6e..93f68d144 100644 --- a/e2e/paths/02-client-module/14_risk.spec.js +++ b/e2e/paths/02-client-module/14_risk.spec.js @@ -1,7 +1,7 @@ import selectors from '../../helpers/selectors.js'; import createNightmare from '../../helpers/nightmare'; -describe('Client risk path', () => { +describe('Client balance path', () => { const nightmare = createNightmare(); beforeAll(() => { @@ -19,10 +19,10 @@ describe('Client risk path', () => { expect(result).toEqual('Data saved!'); }); - it('should access to the risk section to check the data shown matches the local settings', async() => { + it('should access to the balance section to check the data shown matches the local settings', async() => { let result = await nightmare - .accessToSection('client.card.risk.index') - .waitToGetProperty(`${selectors.clientRisk.companyAutocomplete} input`, 'value'); + .accessToSection('client.card.balance.index') + .waitToGetProperty(`${selectors.clientBalance.companyAutocomplete} input`, 'value'); expect(result).toEqual('CCs'); }); @@ -38,19 +38,19 @@ describe('Client risk path', () => { it('should click the new payment button', async() => { let url = await nightmare - .reloadSection('client.card.risk.index') - .waitToClick(selectors.clientRisk.newPaymentButton) - .waitForURL('/risk') + .reloadSection('client.card.balance.index') + .waitToClick(selectors.clientBalance.newPaymentButton) + .waitForURL('/balance') .parsedUrl(); - expect(url.hash).toContain('/risk'); + expect(url.hash).toContain('/balance'); }); it('should create a new payment that clears the debt', async() => { let result = await nightmare - .clearInput(selectors.clientRisk.newPaymentBankInut) - .write(selectors.clientRisk.newPaymentBankInut, '2') - .waitToClick(selectors.clientRisk.saveButton) + .clearInput(selectors.clientBalance.newPaymentBankInut) + .write(selectors.clientBalance.newPaymentBankInut, '2') + .waitToClick(selectors.clientBalance.saveButton) .waitForLastSnackbar(); expect(result).toContain('Data saved!'); @@ -58,30 +58,30 @@ describe('Client risk path', () => { it('should check balance is now 0 and the company is now VNL becouse the user local settings were removed', async() => { let company = await nightmare - .waitToGetProperty(`${selectors.clientRisk.companyAutocomplete} input`, 'value'); + .waitToGetProperty(`${selectors.clientBalance.companyAutocomplete} input`, 'value'); - let firstRiskLineBalance = await nightmare - .waitToGetProperty(selectors.clientRisk.firstRiskLineBalance, 'innerText'); + let firstBalanceLine = await nightmare + .waitToGetProperty(selectors.clientBalance.firstBalanceLine, 'innerText'); expect(company).toEqual('VNL'); - expect(firstRiskLineBalance).toContain('0.00'); + expect(firstBalanceLine).toContain('0.00'); }); it('should now click the new payment button', async() => { let url = await nightmare - .waitToClick(selectors.clientRisk.newPaymentButton) - .waitForURL('/risk') + .waitToClick(selectors.clientBalance.newPaymentButton) + .waitForURL('/balance') .parsedUrl(); - expect(url.hash).toContain('/risk'); + expect(url.hash).toContain('/balance'); }); it('should create a new payment that sets the balance to positive value', async() => { let result = await nightmare - .clearInput(selectors.clientRisk.newPaymentAmountInput) - .write(selectors.clientRisk.newPaymentAmountInput, '100') - .waitToClick(selectors.clientRisk.saveButton) + .clearInput(selectors.clientBalance.newPaymentAmountInput) + .write(selectors.clientBalance.newPaymentAmountInput, '100') + .waitToClick(selectors.clientBalance.saveButton) .waitForLastSnackbar(); expect(result).toContain('Data saved!'); @@ -89,26 +89,26 @@ describe('Client risk path', () => { it('should check balance is now 100', async() => { let result = await nightmare - .waitToGetProperty(selectors.clientRisk.firstRiskLineBalance, 'innerText'); + .waitToGetProperty(selectors.clientBalance.firstBalanceLine, 'innerText'); expect(result).toContain('100.00'); }); it('should again click the new payment button', async() => { let url = await nightmare - .waitToClick(selectors.clientRisk.newPaymentButton) - .waitForURL('/risk') + .waitToClick(selectors.clientBalance.newPaymentButton) + .waitForURL('/balance') .parsedUrl(); - expect(url.hash).toContain('/risk'); + expect(url.hash).toContain('/balance'); }); it('should create a new payment that sets the balance back to the original negative value', async() => { let result = await nightmare - .clearInput(selectors.clientRisk.newPaymentAmountInput) - .write(selectors.clientRisk.newPaymentAmountInput, '-150') + .clearInput(selectors.clientBalance.newPaymentAmountInput) + .write(selectors.clientBalance.newPaymentAmountInput, '-150') .wait(1999) - .waitToClick(selectors.clientRisk.saveButton) + .waitToClick(selectors.clientBalance.saveButton) .waitForLastSnackbar(); expect(result).toContain('Data saved!'); @@ -116,7 +116,7 @@ describe('Client risk path', () => { it('should check balance is now -50', async() => { let result = await nightmare - .waitToGetProperty(selectors.clientRisk.firstRiskLineBalance, 'innerText'); + .waitToGetProperty(selectors.clientBalance.firstBalanceLine, 'innerText'); expect(result).toContain('€50.00'); }); @@ -143,20 +143,20 @@ describe('Client risk path', () => { expect(resultCount).toEqual(1); }); - it(`should click on the search result to access to the client's risk`, async() => { + it(`should click on the search result to access to the client's balance`, async() => { let url = await nightmare .waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker') .waitToClick(selectors.clientsIndex.searchResult) - .waitToClick(selectors.clientRisk.riskButton) - .waitForURL('/risk') + .waitToClick(selectors.clientBalance.balanceButton) + .waitForURL('/balance') .parsedUrl(); - expect(url.hash).toContain('/risk'); + expect(url.hash).toContain('/balance'); }); it('should not be able to click the new payment button as it isnt present', async() => { let result = await nightmare - .exists(selectors.clientRisk.newPaymentButton); + .exists(selectors.clientBalance.newPaymentButton); expect(result).toBeFalsy(); }); diff --git a/modules/client/front/risk/create/index.html b/modules/client/front/balance/create/index.html similarity index 100% rename from modules/client/front/risk/create/index.html rename to modules/client/front/balance/create/index.html diff --git a/modules/client/front/risk/create/index.js b/modules/client/front/balance/create/index.js similarity index 97% rename from modules/client/front/risk/create/index.js rename to modules/client/front/balance/create/index.js index 11e701791..bdd62c4aa 100644 --- a/modules/client/front/risk/create/index.js +++ b/modules/client/front/balance/create/index.js @@ -68,7 +68,7 @@ class Controller { } Controller.$inject = ['$scope', '$state', '$http', 'vnApp', '$translate']; -ngModule.component('vnClientRiskCreate', { +ngModule.component('vnClientBalanceCreate', { template: require('./index.html'), controller: Controller, bindings: { diff --git a/modules/client/front/risk/create/style.scss b/modules/client/front/balance/create/style.scss similarity index 100% rename from modules/client/front/risk/create/style.scss rename to modules/client/front/balance/create/style.scss diff --git a/modules/client/front/risk/index/index.html b/modules/client/front/balance/index/index.html similarity index 93% rename from modules/client/front/risk/index/index.html rename to modules/client/front/balance/index/index.html index 4d40582dc..94bcc6a0e 100644 --- a/modules/client/front/risk/index/index.html +++ b/modules/client/front/balance/index/index.html @@ -9,7 +9,7 @@ vn-id="riskModel" url="/client/api/ClientRisks" filter="$ctrl.filter" - data="$ctrl.riskTotal"> + data="$ctrl.clientRisks"> @@ -28,9 +28,9 @@ -
+
Total by company
- + @@ -111,8 +111,8 @@ ng-click="$ctrl.openCreateDialog()"> - - + + { if (response.data) { - this.riskTotal = response.data; + this.clientRisks = response.data; this.getBalances(); } @@ -59,7 +59,7 @@ class Controller { getCurrentBalance() { const selectedCompany = this.$.company.selection; - const currentBalance = this.riskTotal.find(balance => { + const currentBalance = this.clientRisks.find(balance => { return balance.companyFk === selectedCompany.id; }); @@ -80,11 +80,11 @@ class Controller { openCreateDialog() { - this.$.riskCreateDialog.companyFk = this.companyFk; - this.$.riskCreateDialog.onResponse = () => { + this.$.balanceCreateDialog.companyFk = this.companyFk; + this.$.balanceCreateDialog.onResponse = () => { this.refresh(); }; - this.$.riskCreateDialog.show(); + this.$.balanceCreateDialog.show(); } onDownload() { @@ -117,7 +117,7 @@ class Controller { Controller.$inject = ['$stateParams', '$translate', '$scope', 'vnToken', '$http']; -ngModule.component('vnClientRiskIndex', { +ngModule.component('vnClientBalanceIndex', { template: require('./index.html'), controller: Controller, }); diff --git a/modules/client/front/risk/index/index.spec.js b/modules/client/front/balance/index/index.spec.js similarity index 92% rename from modules/client/front/risk/index/index.spec.js rename to modules/client/front/balance/index/index.spec.js index 1db4a7a8b..8c88b5f1c 100644 --- a/modules/client/front/risk/index/index.spec.js +++ b/modules/client/front/balance/index/index.spec.js @@ -1,7 +1,7 @@ import './index'; describe('Client', () => { - describe('Component vnClientRiskIndex', () => { + describe('Component vnClientBalanceIndex', () => { let $componentController; let $scope; let $httpBackend; @@ -15,7 +15,7 @@ describe('Client', () => { $httpBackend = _$httpBackend_; $httpParamSerializer = _$httpParamSerializer_; $scope = $rootScope.$new(); - controller = $componentController('vnClientRiskIndex', {$scope}); + controller = $componentController('vnClientBalanceIndex', {$scope}); })); describe('balances() setter', () => { diff --git a/modules/client/front/risk/index/locale/es.yml b/modules/client/front/balance/index/locale/es.yml similarity index 100% rename from modules/client/front/risk/index/locale/es.yml rename to modules/client/front/balance/index/locale/es.yml diff --git a/modules/client/front/risk/index/style.scss b/modules/client/front/balance/index/style.scss similarity index 100% rename from modules/client/front/risk/index/style.scss rename to modules/client/front/balance/index/style.scss diff --git a/modules/client/front/index.js b/modules/client/front/index.js index b4166676b..d6a910c86 100644 --- a/modules/client/front/index.js +++ b/modules/client/front/index.js @@ -19,8 +19,8 @@ import './credit/index'; import './credit/create'; import './greuge/index'; import './greuge/create'; -import './risk/index'; -import './risk/create'; +import './balance/index'; +import './balance/create'; import './mandate'; import './summary'; import './recovery/index'; diff --git a/modules/client/front/routes.json b/modules/client/front/routes.json index 58f075d11..a927d0aa7 100644 --- a/modules/client/front/routes.json +++ b/modules/client/front/routes.json @@ -12,7 +12,7 @@ {"state": "client.card.note.index", "icon": "insert_drive_file"}, {"state": "client.card.credit.index", "icon": "credit_card"}, {"state": "client.card.greuge.index", "icon": "work"}, - {"state": "client.card.risk.index", "icon": "icon-invoices"}, + {"state": "client.card.balance.index", "icon": "icon-invoices"}, {"state": "client.card.recovery.index", "icon": "icon-recovery"}, {"state": "client.card.log", "icon": "history"}, { @@ -188,22 +188,22 @@ "component": "vn-client-mandate", "description": "Mandates" }, { - "url": "/risk", + "url": "/balance", "abstract": true, - "state": "client.card.risk", + "state": "client.card.balance", "component": "ui-view" }, { "url": "/index", - "state": "client.card.risk.index", - "component": "vn-client-risk-index", + "state": "client.card.balance.index", + "component": "vn-client-balance-index", "description": "Balance", "params": { "client": "$ctrl.client" } }, { "url": "/create?payed&companyFk&bankFk&payedAmount", - "state": "client.card.risk.create", - "component": "vn-client-risk-create", + "state": "client.card.balance.create", + "component": "vn-client-balance-create", "description": "New payment", "params": { "client": "$ctrl.client" From 9baa37b833010da76c0030bc5025320bb42b386a Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Tue, 16 Apr 2019 14:30:01 +0200 Subject: [PATCH 08/59] #1306 Renombrar controladores, rutas y carpetas --- e2e/helpers/selectors.js | 2 +- e2e/paths/04-item-module/02_basic_data.spec.js | 4 ++-- e2e/paths/04-item-module/12_descriptor.spec.js | 4 ++-- modules/item/front/{data => basic-data}/index.html | 1 - modules/item/front/{data => basic-data}/index.js | 2 +- modules/item/front/{data => basic-data}/locale/es.yml | 0 modules/item/front/create/index.js | 2 +- modules/item/front/create/index.spec.js | 2 +- modules/item/front/index.js | 2 +- modules/item/front/routes.json | 8 ++++---- 10 files changed, 13 insertions(+), 14 deletions(-) rename modules/item/front/{data => basic-data}/index.html (97%) rename modules/item/front/{data => basic-data}/index.js (91%) rename modules/item/front/{data => basic-data}/locale/es.yml (100%) diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 751d17afc..3d945edc9 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -218,7 +218,7 @@ export default { navigateBackToIndex: 'vn-item-descriptor vn-icon[icon="chevron_left"]' }, itemBasicData: { - basicDataButton: `vn-left-menu a[ui-sref="item.card.data"]`, + basicDataButton: `vn-left-menu a[ui-sref="item.card.basicData"]`, goToItemIndexButton: 'vn-item-descriptor [ui-sref="item.index"]', typeAutocomplete: `vn-autocomplete[field="$ctrl.item.typeFk"]`, intrastatAutocomplete: `vn-autocomplete[field="$ctrl.item.intrastatFk"]`, diff --git a/e2e/paths/04-item-module/02_basic_data.spec.js b/e2e/paths/04-item-module/02_basic_data.spec.js index 257b12e17..8e6ecacfc 100644 --- a/e2e/paths/04-item-module/02_basic_data.spec.js +++ b/e2e/paths/04-item-module/02_basic_data.spec.js @@ -8,7 +8,7 @@ describe('Item Edit basic data path', () => { nightmare .loginAndModule('buyer', 'item') .accessToSearchResult('Melee weapon combat first 15cm') - .accessToSection('item.card.data'); + .accessToSection('item.card.basicData'); }); it(`should check the descritor edit button is visible for buyer`, async() => { @@ -39,7 +39,7 @@ describe('Item Edit basic data path', () => { it(`should confirm the item name was edited`, async() => { const result = await nightmare - .reloadSection('item.card.data') + .reloadSection('item.card.basicData') .waitToGetProperty(selectors.itemBasicData.nameInput, 'value'); expect(result).toEqual('Rose of Purity'); diff --git a/e2e/paths/04-item-module/12_descriptor.spec.js b/e2e/paths/04-item-module/12_descriptor.spec.js index e5b6b2c2f..d008d0d4e 100644 --- a/e2e/paths/04-item-module/12_descriptor.spec.js +++ b/e2e/paths/04-item-module/12_descriptor.spec.js @@ -7,7 +7,7 @@ describe('Item descriptor path', () => { nightmare .loginAndModule('buyer', 'item') .accessToSearchResult(1) - .accessToSection('item.card.data'); + .accessToSection('item.card.basicData'); }); it('should check the descriptor inactive icon is dark as the item is active', async() => { @@ -30,7 +30,7 @@ describe('Item descriptor path', () => { it('should reload the section and check the inactive icon is bright', async() => { let brightIcon = await nightmare - .reloadSection('item.card.data') + .reloadSection('item.card.basicData') .waitForClassPresent(selectors.itemDescriptor.inactiveIcon, 'bright') .isVisible(selectors.itemDescriptor.inactiveIcon); diff --git a/modules/item/front/data/index.html b/modules/item/front/basic-data/index.html similarity index 97% rename from modules/item/front/data/index.html rename to modules/item/front/basic-data/index.html index 4f9bf3366..b12e9fc53 100644 --- a/modules/item/front/data/index.html +++ b/modules/item/front/basic-data/index.html @@ -76,7 +76,6 @@ label="Density" field="$ctrl.item.density"> - diff --git a/modules/item/front/data/index.js b/modules/item/front/basic-data/index.js similarity index 91% rename from modules/item/front/data/index.js rename to modules/item/front/basic-data/index.js index 6096a4bfa..123aa59cd 100644 --- a/modules/item/front/data/index.js +++ b/modules/item/front/basic-data/index.js @@ -15,7 +15,7 @@ class Controller { Controller.$inject = ['$scope', '$timeout']; -ngModule.component('vnItemData', { +ngModule.component('vnItemBasicData', { template: require('./index.html'), bindings: { item: '<' diff --git a/modules/item/front/data/locale/es.yml b/modules/item/front/basic-data/locale/es.yml similarity index 100% rename from modules/item/front/data/locale/es.yml rename to modules/item/front/basic-data/locale/es.yml diff --git a/modules/item/front/create/index.js b/modules/item/front/create/index.js index b983078ea..646baa8cd 100644 --- a/modules/item/front/create/index.js +++ b/modules/item/front/create/index.js @@ -11,7 +11,7 @@ class Controller { onSubmit() { this.$.watcher.submit().then( - json => this.$state.go('item.card.data', {id: json.data.id}) + json => this.$state.go('item.card.basicData', {id: json.data.id}) ); } } diff --git a/modules/item/front/create/index.spec.js b/modules/item/front/create/index.spec.js index 14d7bf513..cb58cdaa3 100644 --- a/modules/item/front/create/index.spec.js +++ b/modules/item/front/create/index.spec.js @@ -30,7 +30,7 @@ describe('Item', () => { spyOn($state, 'go'); controller.onSubmit(); - expect(controller.$state.go).toHaveBeenCalledWith('item.card.data', {id: 1}); + expect(controller.$state.go).toHaveBeenCalledWith('item.card.basicData', {id: 1}); }); }); }); diff --git a/modules/item/front/index.js b/modules/item/front/index.js index 4ff9e3e3f..bc280d529 100644 --- a/modules/item/front/index.js +++ b/modules/item/front/index.js @@ -7,7 +7,7 @@ import './create'; import './card'; import './descriptor'; import './descriptor-popover'; -import './data'; +import './basic-data'; import './fetched-tags'; import './tags'; import './tax'; diff --git a/modules/item/front/routes.json b/modules/item/front/routes.json index 3271ebe3a..a85e31f37 100644 --- a/modules/item/front/routes.json +++ b/modules/item/front/routes.json @@ -5,7 +5,7 @@ "validations" : true, "dependencies": ["worker", "client", "ticket"], "menu": [ - {"state": "item.card.data", "icon": "settings"}, + {"state": "item.card.basicData", "icon": "settings"}, {"state": "item.card.tags", "icon": "icon-tags"}, {"state": "item.card.tax", "icon": "icon-tax"}, {"state": "item.card.niche", "icon": "place"}, @@ -41,9 +41,9 @@ "abstract": true, "component": "vn-item-card" }, { - "url" : "/data", - "state": "item.card.data", - "component": "vn-item-data", + "url" : "/basic-data", + "state": "item.card.basicData", + "component": "vn-item-basic-data", "description": "Basic data", "params": { "item": "$ctrl.item" From ab70201795096fdc47e209e5916eb50a9527b163 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Tue, 16 Apr 2019 15:00:12 +0200 Subject: [PATCH 09/59] #1306 Renombrar controladores, rutas y carpetas --- e2e/helpers/selectors.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 3d945edc9..dc3483d64 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -421,7 +421,7 @@ export default { cancelButton: `vn-ticket-tracking-edit vn-button[ui-sref="ticket.card.tracking.index"]` }, ticketBasicData: { - basicDataButton: `vn-left-menu a[ui-sref="ticket.card.data.stepOne"]`, + basicDataButton: `vn-left-menu a[ui-sref="ticket.card.basicData.stepOne"]`, clientAutocomplete: `vn-autocomplete[field="$ctrl.clientFk"]`, addressAutocomplete: `vn-autocomplete[field="$ctrl.ticket.addressFk"]`, agencyAutocomplete: `vn-autocomplete[field="$ctrl.ticket.agencyModeFk"]`, From d52f5077b010d743ec439b465a7993613f115a92 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Tue, 16 Apr 2019 15:00:21 +0200 Subject: [PATCH 10/59] #1306 Renombrar controladores, rutas y carpeta --- .../06_edit_basic_data_steps.spec.js | 2 +- .../front/{data => basic-data}/index.html | 6 +++--- .../front/{data => basic-data}/index.js | 2 +- .../{data => basic-data}/step-one/index.html | 0 .../{data => basic-data}/step-one/index.js | 4 ++-- .../step-one/index.spec.js | 4 ++-- .../step-one/locale/es.yml | 0 .../{data => basic-data}/step-one/style.scss | 0 .../step-three/index.html | 0 .../{data => basic-data}/step-three/index.js | 4 ++-- .../step-three/index.spec.js | 4 ++-- .../step-three/locale/es.yml | 0 .../{data => basic-data}/step-two/index.html | 0 .../{data => basic-data}/step-two/index.js | 4 ++-- .../step-two/index.spec.js | 4 ++-- .../step-two/locale/es.yml | 0 modules/ticket/front/index.js | 8 ++++---- modules/ticket/front/routes.json | 20 +++++++++---------- 18 files changed, 31 insertions(+), 31 deletions(-) rename modules/ticket/front/{data => basic-data}/index.html (51%) rename modules/ticket/front/{data => basic-data}/index.js (93%) rename modules/ticket/front/{data => basic-data}/step-one/index.html (100%) rename modules/ticket/front/{data => basic-data}/step-one/index.js (98%) rename modules/ticket/front/{data => basic-data}/step-one/index.spec.js (97%) rename modules/ticket/front/{data => basic-data}/step-one/locale/es.yml (100%) rename modules/ticket/front/{data => basic-data}/step-one/style.scss (100%) rename modules/ticket/front/{data => basic-data}/step-three/index.html (100%) rename modules/ticket/front/{data => basic-data}/step-three/index.js (95%) rename modules/ticket/front/{data => basic-data}/step-three/index.spec.js (93%) rename modules/ticket/front/{data => basic-data}/step-three/locale/es.yml (100%) rename modules/ticket/front/{data => basic-data}/step-two/index.html (100%) rename modules/ticket/front/{data => basic-data}/step-two/index.js (94%) rename modules/ticket/front/{data => basic-data}/step-two/index.spec.js (93%) rename modules/ticket/front/{data => basic-data}/step-two/locale/es.yml (100%) diff --git a/e2e/paths/05-ticket-module/06_edit_basic_data_steps.spec.js b/e2e/paths/05-ticket-module/06_edit_basic_data_steps.spec.js index ebdace2a7..7e44c473b 100644 --- a/e2e/paths/05-ticket-module/06_edit_basic_data_steps.spec.js +++ b/e2e/paths/05-ticket-module/06_edit_basic_data_steps.spec.js @@ -8,7 +8,7 @@ describe('Ticket Edit basic data path', () => { return nightmare .loginAndModule('employee', 'ticket') .accessToSearchResult('id:11') - .accessToSection('ticket.card.data.stepOne'); + .accessToSection('ticket.card.basicData.stepOne'); }); it(`should edit the client and address of the ticket then click next`, async() => { diff --git a/modules/ticket/front/data/index.html b/modules/ticket/front/basic-data/index.html similarity index 51% rename from modules/ticket/front/data/index.html rename to modules/ticket/front/basic-data/index.html index 4864c774f..4439069e8 100644 --- a/modules/ticket/front/data/index.html +++ b/modules/ticket/front/basic-data/index.html @@ -2,9 +2,9 @@ diff --git a/modules/ticket/front/data/index.js b/modules/ticket/front/basic-data/index.js similarity index 93% rename from modules/ticket/front/data/index.js rename to modules/ticket/front/basic-data/index.js index df04b75ea..1afe6f9aa 100644 --- a/modules/ticket/front/data/index.js +++ b/modules/ticket/front/basic-data/index.js @@ -27,7 +27,7 @@ class Controller { Controller.$inject = ['$scope', '$state']; -ngModule.component('vnTicketData', { +ngModule.component('vnTicketBasicData', { template: require('./index.html'), bindings: { ticket: '<' diff --git a/modules/ticket/front/data/step-one/index.html b/modules/ticket/front/basic-data/step-one/index.html similarity index 100% rename from modules/ticket/front/data/step-one/index.html rename to modules/ticket/front/basic-data/step-one/index.html diff --git a/modules/ticket/front/data/step-one/index.js b/modules/ticket/front/basic-data/step-one/index.js similarity index 98% rename from modules/ticket/front/data/step-one/index.js rename to modules/ticket/front/basic-data/step-one/index.js index 125c10a75..0a4708dfe 100644 --- a/modules/ticket/front/data/step-one/index.js +++ b/modules/ticket/front/basic-data/step-one/index.js @@ -159,13 +159,13 @@ class Controller { Controller.$inject = ['$scope', '$http', '$translate', 'vnApp']; -ngModule.component('vnTicketDataStepOne', { +ngModule.component('vnTicketBasicDataStepOne', { template: require('./index.html'), controller: Controller, bindings: { ticket: '<' }, require: { - data: '^vnTicketData' + data: '^vnTicketBasicData' } }); diff --git a/modules/ticket/front/data/step-one/index.spec.js b/modules/ticket/front/basic-data/step-one/index.spec.js similarity index 97% rename from modules/ticket/front/data/step-one/index.spec.js rename to modules/ticket/front/basic-data/step-one/index.spec.js index e7049394b..c3bac09d6 100644 --- a/modules/ticket/front/data/step-one/index.spec.js +++ b/modules/ticket/front/basic-data/step-one/index.spec.js @@ -1,7 +1,7 @@ import './index.js'; describe('Ticket', () => { - describe('Component vnTicketDataStepOne', () => { + describe('Component vnTicketBasicDataStepOne', () => { let $state; let controller; let $httpBackend; @@ -11,7 +11,7 @@ describe('Ticket', () => { beforeEach(angular.mock.inject(($componentController, _$state_, _$httpBackend_) => { $state = _$state_; $httpBackend = _$httpBackend_; - controller = $componentController('vnTicketDataStepOne', {$state}); + controller = $componentController('vnTicketBasicDataStepOne', {$state}); })); describe('ticket() setter', () => { diff --git a/modules/ticket/front/data/step-one/locale/es.yml b/modules/ticket/front/basic-data/step-one/locale/es.yml similarity index 100% rename from modules/ticket/front/data/step-one/locale/es.yml rename to modules/ticket/front/basic-data/step-one/locale/es.yml diff --git a/modules/ticket/front/data/step-one/style.scss b/modules/ticket/front/basic-data/step-one/style.scss similarity index 100% rename from modules/ticket/front/data/step-one/style.scss rename to modules/ticket/front/basic-data/step-one/style.scss diff --git a/modules/ticket/front/data/step-three/index.html b/modules/ticket/front/basic-data/step-three/index.html similarity index 100% rename from modules/ticket/front/data/step-three/index.html rename to modules/ticket/front/basic-data/step-three/index.html diff --git a/modules/ticket/front/data/step-three/index.js b/modules/ticket/front/basic-data/step-three/index.js similarity index 95% rename from modules/ticket/front/data/step-three/index.js rename to modules/ticket/front/basic-data/step-three/index.js index 67df50c97..f6ab66a37 100644 --- a/modules/ticket/front/data/step-three/index.js +++ b/modules/ticket/front/basic-data/step-three/index.js @@ -54,7 +54,7 @@ class Controller { Controller.$inject = ['$http', '$scope', '$state', '$translate', 'vnApp']; -ngModule.component('vnTicketDataStepThree', { +ngModule.component('vnTicketBasicDataStepThree', { template: require('./index.html'), controller: Controller, bindings: { @@ -62,6 +62,6 @@ ngModule.component('vnTicketDataStepThree', { }, require: { card: '^vnTicketCard', - data: '^vnTicketData' + data: '^vnTicketBasicData' } }); diff --git a/modules/ticket/front/data/step-three/index.spec.js b/modules/ticket/front/basic-data/step-three/index.spec.js similarity index 93% rename from modules/ticket/front/data/step-three/index.spec.js rename to modules/ticket/front/basic-data/step-three/index.spec.js index bb7f3430e..190a51f75 100644 --- a/modules/ticket/front/data/step-three/index.spec.js +++ b/modules/ticket/front/basic-data/step-three/index.spec.js @@ -1,7 +1,7 @@ import './index.js'; describe('ticket', () => { - describe('Component vnTicketDataStepThree', () => { + describe('Component vnTicketBasicDataStepThree', () => { let now = Date.now(); let $state; let controller; @@ -16,7 +16,7 @@ describe('ticket', () => { vnApp = _vnApp_; spyOn(vnApp, 'showError'); $httpBackend = _$httpBackend_; - controller = $componentController('vnTicketDataStepThree', {$state}); + controller = $componentController('vnTicketBasicDataStepThree', {$state}); })); describe('onSubmit()', () => { diff --git a/modules/ticket/front/data/step-three/locale/es.yml b/modules/ticket/front/basic-data/step-three/locale/es.yml similarity index 100% rename from modules/ticket/front/data/step-three/locale/es.yml rename to modules/ticket/front/basic-data/step-three/locale/es.yml diff --git a/modules/ticket/front/data/step-two/index.html b/modules/ticket/front/basic-data/step-two/index.html similarity index 100% rename from modules/ticket/front/data/step-two/index.html rename to modules/ticket/front/basic-data/step-two/index.html diff --git a/modules/ticket/front/data/step-two/index.js b/modules/ticket/front/basic-data/step-two/index.js similarity index 94% rename from modules/ticket/front/data/step-two/index.js rename to modules/ticket/front/basic-data/step-two/index.js index 02f44b8cb..739f08a87 100644 --- a/modules/ticket/front/data/step-two/index.js +++ b/modules/ticket/front/basic-data/step-two/index.js @@ -46,13 +46,13 @@ class Controller { Controller.$inject = ['$http']; -ngModule.component('vnTicketDataStepTwo', { +ngModule.component('vnTicketBasicDataStepTwo', { template: require('./index.html'), controller: Controller, bindings: { ticket: '<' }, require: { - data: '^vnTicketData' + data: '^vnTicketBasicData' } }); diff --git a/modules/ticket/front/data/step-two/index.spec.js b/modules/ticket/front/basic-data/step-two/index.spec.js similarity index 93% rename from modules/ticket/front/data/step-two/index.spec.js rename to modules/ticket/front/basic-data/step-two/index.spec.js index 8ee21da39..8fe400584 100644 --- a/modules/ticket/front/data/step-two/index.spec.js +++ b/modules/ticket/front/basic-data/step-two/index.spec.js @@ -1,13 +1,13 @@ import './index.js'; describe('Ticket', () => { - describe('Component vnTicketDataStepTwo', () => { + describe('Component vnTicketBasicDataStepTwo', () => { let controller; beforeEach(ngModule('ticket')); beforeEach(angular.mock.inject($componentController => { - controller = $componentController('vnTicketDataStepTwo'); + controller = $componentController('vnTicketBasicDataStepTwo'); })); describe('getTotalPrice()', () => { diff --git a/modules/ticket/front/data/step-two/locale/es.yml b/modules/ticket/front/basic-data/step-two/locale/es.yml similarity index 100% rename from modules/ticket/front/data/step-two/locale/es.yml rename to modules/ticket/front/basic-data/step-two/locale/es.yml diff --git a/modules/ticket/front/index.js b/modules/ticket/front/index.js index 1269a60db..b089734e9 100644 --- a/modules/ticket/front/index.js +++ b/modules/ticket/front/index.js @@ -10,10 +10,10 @@ import './descriptor-popover'; import './create/card'; import './create/index'; import './summary'; -import './data'; -import './data/step-one'; -import './data/step-two'; -import './data/step-three'; +import './basic-data'; +import './basic-data/step-one'; +import './basic-data/step-two'; +import './basic-data/step-three'; import './note'; import './expedition'; import './volume'; diff --git a/modules/ticket/front/routes.json b/modules/ticket/front/routes.json index de8b916d3..7ae2f4224 100644 --- a/modules/ticket/front/routes.json +++ b/modules/ticket/front/routes.json @@ -5,7 +5,7 @@ "validations": true, "dependencies": ["worker", "item", "client"], "menu": [ - {"state": "ticket.card.data.stepOne", "icon": "settings"}, + {"state": "ticket.card.basicData.stepOne", "icon": "settings"}, {"state": "ticket.card.sale", "icon": "icon-lines"}, {"state": "ticket.card.observation", "icon": "insert_drive_file"}, {"state": "ticket.card.volume", "icon": "icon-volume"}, @@ -49,33 +49,33 @@ "ticket": "$ctrl.ticket" } }, { - "url" : "/data", - "state": "ticket.card.data", - "component": "vn-ticket-data", + "url" : "/basic-data", + "state": "ticket.card.basicData", + "component": "vn-ticket-basic-data", "abstract": true, "params": { "ticket": "$ctrl.ticket" } }, { "url" : "/step-one", - "state": "ticket.card.data.stepOne", - "component": "vn-ticket-data-step-one", + "state": "ticket.card.basicData.stepOne", + "component": "vn-ticket-basic-data-step-one", "description": "Basic data", "params": { "ticket": "$ctrl.data" } }, { "url" : "/step-two", - "state": "ticket.card.data.stepTwo", - "component": "vn-ticket-data-step-two", + "state": "ticket.card.basicData.stepTwo", + "component": "vn-ticket-basic-data-step-two", "description": "Price difference", "params": { "ticket": "$ctrl.data" } }, { "url" : "/step-three", - "state": "ticket.card.data.stepThree", - "component": "vn-ticket-data-step-three", + "state": "ticket.card.basicData.stepThree", + "component": "vn-ticket-basic-data-step-three", "description": "Charge", "params": { "ticket": "$ctrl.data" From 7707acb43a2bab727c9def7c66322579cb94d00f Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Wed, 17 Apr 2019 07:30:38 +0200 Subject: [PATCH 11/59] #1306 Renombrar controladores, rutas y carpetas --- e2e/helpers/selectors.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index dc3483d64..0e117fb45 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -427,7 +427,7 @@ export default { agencyAutocomplete: `vn-autocomplete[field="$ctrl.ticket.agencyModeFk"]`, nextStepButton: `vn-step-control > section > section.buttons > section:nth-child(2) > vn-button`, finalizeButton: `vn-step-control > section > section.buttons > section:nth-child(2) > vn-submit`, - stepTwoTotalPriceDif: `vn-ticket-data-step-two > form > vn-card > div > vn-horizontal > table > tfoot > tr > td:nth-child(4)`, + stepTwoTotalPriceDif: `vn-ticket-basic-data-step-two > form > vn-card > div > vn-horizontal > table > tfoot > tr > td:nth-child(4)`, chargesReasonAutocomplete: `vn-autocomplete[field="$ctrl.ticket.option"]`, }, ticketComponents: { From bafbd928022175d83d7308574d9b992f6fe17494 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Wed, 17 Apr 2019 08:21:58 +0200 Subject: [PATCH 12/59] Bug/Test #1331 cambio de rol --- e2e/paths/02-client-module/01_create_client.spec.js | 2 +- e2e/paths/02-client-module/02_edit_basic_data.spec.js | 4 ++-- .../05-ticket-module/05_create_new_tracking_state.spec.js | 2 +- modules/item/front/routes.json | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/e2e/paths/02-client-module/01_create_client.spec.js b/e2e/paths/02-client-module/01_create_client.spec.js index 0a8396edc..2d7b58b20 100644 --- a/e2e/paths/02-client-module/01_create_client.spec.js +++ b/e2e/paths/02-client-module/01_create_client.spec.js @@ -41,7 +41,7 @@ describe('Client create path', () => { .write(selectors.createClientView.taxNumber, '74451390E') .write(selectors.createClientView.userName, 'CaptainMarvel') .write(selectors.createClientView.email, 'CarolDanvers@verdnatura.es') - .autocompleteSearch(selectors.createClientView.salesPersonAutocomplete, 'Accessory') + .autocompleteSearch(selectors.createClientView.salesPersonAutocomplete, 'replenisher') .waitToClick(selectors.createClientView.createButton) .waitForLastSnackbar(); diff --git a/e2e/paths/02-client-module/02_edit_basic_data.spec.js b/e2e/paths/02-client-module/02_edit_basic_data.spec.js index ddd1dc528..988ad82c8 100644 --- a/e2e/paths/02-client-module/02_edit_basic_data.spec.js +++ b/e2e/paths/02-client-module/02_edit_basic_data.spec.js @@ -114,7 +114,7 @@ describe('Client Edit basicData path', () => { .write(selectors.clientBasicData.mobileInput, '987654321') .clearInput(selectors.clientBasicData.emailInput) .write(selectors.clientBasicData.emailInput, 'Storm@verdnatura.es') - .autocompleteSearch(selectors.clientBasicData.salesPersonAutocomplete, 'AccessoryNick') + .autocompleteSearch(selectors.clientBasicData.salesPersonAutocomplete, 'replenisherNick') .autocompleteSearch(selectors.clientBasicData.channelAutocomplete, 'Metropolis newspaper') .waitToClick(selectors.clientBasicData.saveButton) .waitForLastSnackbar(); @@ -162,7 +162,7 @@ describe('Client Edit basicData path', () => { const result = await nightmare .waitToGetProperty(`${selectors.clientBasicData.salesPersonAutocomplete} input`, 'value'); - expect(result).toEqual('accessoryNick'); + expect(result).toEqual('replenisherNick'); }); it('should now confirm the channel have been selected', async() => { diff --git a/e2e/paths/05-ticket-module/05_create_new_tracking_state.spec.js b/e2e/paths/05-ticket-module/05_create_new_tracking_state.spec.js index 787809a86..a67c3fc1d 100644 --- a/e2e/paths/05-ticket-module/05_create_new_tracking_state.spec.js +++ b/e2e/paths/05-ticket-module/05_create_new_tracking_state.spec.js @@ -88,7 +88,7 @@ describe('Ticket Create new tracking state path', () => { it(`should create a new state with all it's data`, async() => { let result = await nightmare - .autocompleteSearch(selectors.createStateView.workerAutocomplete, 'accessory') + .autocompleteSearch(selectors.createStateView.workerAutocomplete, 'replenisher') .waitToClick(selectors.createStateView.saveStateButton) .waitForLastSnackbar(); diff --git a/modules/item/front/routes.json b/modules/item/front/routes.json index a85e31f37..b0dc7c26a 100644 --- a/modules/item/front/routes.json +++ b/modules/item/front/routes.json @@ -57,7 +57,7 @@ "params": { "item-tags": "$ctrl.itemTags" }, - "acl": ["buyer", "accessory"] + "acl": ["buyer", "replenisher"] }, { "url" : "/tax", "state": "item.card.tax", From e34cb8ce84282faca2f3bc7d7a6d5a2db0f2c4de Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Wed, 17 Apr 2019 09:37:55 +0200 Subject: [PATCH 13/59] #1351 e2e order.catalog --- db/dump/fixtures.sql | 18 +++++++++--------- e2e/paths/04-item-module/01_summary.spec.js | 12 ++++++------ e2e/paths/04-item-module/02_basic_data.spec.js | 2 +- .../back/methods/item/specs/filter.spec.js | 4 ++-- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index dda99aea5..0df460c3d 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -614,22 +614,22 @@ INSERT INTO `vn`.`ticketPackaging`(`id`, `ticketFk`, `packagingFk`, `quantity`, INSERT INTO `vn`.`sale`(`id`, `itemFk`, `ticketFk`, `concept`, `quantity`, `price`, `discount`, `reserved`, `isPicked`, `created`) VALUES (1, 1, 1, 'Ranged weapon longbow 2m', 5, 9.10, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL -15 DAY)), - (2, 2, 1, 'Melee weapon combat first 15cm', 10, 1.07, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL -15 DAY)), + (2, 2, 1, 'Melee weapon combat fist 15cm', 10, 1.07, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL -15 DAY)), (3, 1, 1, 'Ranged weapon longbow 2m', 2, 9.10, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL -15 DAY)), (4, 4, 1, 'Melee weapon heavy shield 1x0.5m', 20, 3.06, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL -15 DAY)), (5, 1, 2, 'Ranged weapon longbow 2m', 10, 9.10, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL -10 DAY)), (6, 1, 3, 'Ranged weapon longbow 2m', 15, 6.50, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL -5 DAY)), - (7, 2, 11, 'Melee weapon combat first 15cm', 15, 1.46, 0, 0, 0, CURDATE()), + (7, 2, 11, 'Melee weapon combat fist 15cm', 15, 1.46, 0, 0, 0, CURDATE()), (8, 4, 11, 'Melee weapon heavy shield 1x0.5m', 10, 3.04, 0, 0, 0, CURDATE()), (9, 1, 16, 'Ranged weapon longbow 2m', 5, 9.10, 0, 0, 0, CURDATE()), - (10, 2, 16, 'Melee weapon combat first 15cm', 10, 1.07, 0, 0, 0, CURDATE()), + (10, 2, 16, 'Melee weapon combat fist 15cm', 10, 1.07, 0, 0, 0, CURDATE()), (11, 1, 16, 'Ranged weapon longbow 2m', 2, 9.10, 0, 0, 0, CURDATE()), (12, 4, 16, 'Melee weapon heavy shield 1x0.5m', 20, 3.06, 0, 0, 0, CURDATE()), - (13, 2, 8, 'Melee weapon combat first 15cm', 15, 1.30, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL +1 MONTH)), + (13, 2, 8, 'Melee weapon combat fist 15cm', 15, 1.30, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL +1 MONTH)), (14, 1, 8, 'Ranged weapon longbow 2m', 10, 2.30, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL +1 MONTH)), (15, 1, 19, 'Ranged weapon longbow 2m', 10, 1.50, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL +1 DAY)), - (16, 2, 20, 'Melee weapon combat first 15cm', 15, 1.30, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL +1 DAY)), - (17, 2, 22, 'Melee weapon combat first 15cm', 30, 2.30, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL +1 DAY)), + (16, 2, 20, 'Melee weapon combat fist 15cm', 15, 1.30, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL +1 DAY)), + (17, 2, 22, 'Melee weapon combat fist 15cm', 30, 2.30, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL +1 DAY)), (18, 4, 22, 'Melee weapon heavy shield 1x0.5m', 20, 3.00, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL +1 DAY)), (19, 1, 4, 'Ranged weapon longbow 2m', 1, 9.10, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL -4 DAY)), (20, 1, 5, 'Ranged weapon longbow 2m', 1, 9.10, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL -3 DAY)), @@ -816,7 +816,7 @@ INSERT INTO `vn`.`itemTag`(`id`,`itemFk`,`tagFk`,`value`,`priority`) (6 , 1, 67, 'precission', 6), (7 , 1, 23, '1', 7), (8 , 2, 56, 'Melee weapon', 1), - (9 , 2, 58, 'combat first', 2), + (9 , 2, 58, 'combat fist', 2), (10, 2, 27, '15cm', 3), (11, 2, 36, 'Stark Industries', 4), (12, 2, 1, 'Silver', 5), @@ -1211,9 +1211,9 @@ INSERT INTO `vn2008`.`workerTeam`(`id`, `team`, `user`) INSERT INTO `vn`.`ticketRequest`(`id`, `description`, `requesterFk`, `atenderFk`, `quantity`, `itemFk`, `price`, `isOk`, `saleFk`, `ticketFk`, `created`) VALUES (1, 'Ranged weapon longbow 2m', 18, 35, 5, 1, 9.10, 1, 1, 1, DATE_ADD(CURDATE(), INTERVAL -15 DAY)), - (2, 'Melee weapon combat first 15cm', 18, 35, 10, 2, 1.07, 0, NULL, 1, DATE_ADD(CURDATE(), INTERVAL -15 DAY)), + (2, 'Melee weapon combat fist 15cm', 18, 35, 10, 2, 1.07, 0, NULL, 1, DATE_ADD(CURDATE(), INTERVAL -15 DAY)), (3, 'Melee weapon heavy shield 1x0.5m', 18, 35, 20, 4, 3.06, 0, NULL, 1, DATE_ADD(CURDATE(), INTERVAL -15 DAY)), - (4, 'Melee weapon combat first 15cm', 18, 35, 15, 2, 1.30, NULL, NULL, 11, CURDATE()); + (4, 'Melee weapon combat fist 15cm', 18, 35, 15, 2, 1.30, NULL, NULL, 11, CURDATE()); INSERT INTO `vn`.`ticketService`(`id`, `description`, `quantity`, `price`, `taxClassFk`, `ticketFk`) VALUES diff --git a/e2e/paths/04-item-module/01_summary.spec.js b/e2e/paths/04-item-module/01_summary.spec.js index e4b27d127..1cbfc4af8 100644 --- a/e2e/paths/04-item-module/01_summary.spec.js +++ b/e2e/paths/04-item-module/01_summary.spec.js @@ -84,7 +84,7 @@ describe('Item summary path', () => { const result = await nightmare .clearInput('vn-item-index vn-searchbar input') .waitToClick(selectors.itemsIndex.searchButton) - .write(selectors.itemsIndex.searchItemInput, 'Melee weapon combat first 15cm') + .write(selectors.itemsIndex.searchItemInput, 'Melee weapon combat fist 15cm') .waitToClick(selectors.itemsIndex.searchButton) .waitForNumberOfElements(selectors.itemsIndex.searchResult, 1) .countElement(selectors.itemsIndex.searchResult); @@ -94,7 +94,7 @@ describe('Item summary path', () => { it(`should now click on the search result summary button to open the item summary popup`, async() => { const isVisibleBefore = await nightmare - .waitForTextInElement(selectors.itemsIndex.searchResult, 'Melee weapon combat first 15cm') + .waitForTextInElement(selectors.itemsIndex.searchResult, 'Melee weapon combat fist 15cm') .isVisible(selectors.itemSummary.basicData); const isVisibleAfter = await nightmare @@ -108,10 +108,10 @@ describe('Item summary path', () => { it(`should now check the item summary preview shows fields from basic data`, async() => { const result = await nightmare - .waitForTextInElement(selectors.itemSummary.basicData, 'Melee weapon combat first 15cm') + .waitForTextInElement(selectors.itemSummary.basicData, 'Melee weapon combat fist 15cm') .waitToGetProperty(selectors.itemSummary.basicData, 'innerText'); - expect(result).toContain('Melee weapon combat first 15cm'); + expect(result).toContain('Melee weapon combat fist 15cm'); }); it(`should now check the item summary preview shows fields from tags`, async() => { @@ -172,10 +172,10 @@ describe('Item summary path', () => { it(`should check the item summary shows fields from basic data section`, async() => { const result = await nightmare - .waitForTextInElement(selectors.itemSummary.basicData, 'Melee weapon combat first 15cm') + .waitForTextInElement(selectors.itemSummary.basicData, 'Melee weapon combat fist 15cm') .waitToGetProperty(selectors.itemSummary.basicData, 'innerText'); - expect(result).toContain('Melee weapon combat first 15cm'); + expect(result).toContain('Melee weapon combat fist 15cm'); }); it(`should check the item summary shows fields from tags section`, async() => { diff --git a/e2e/paths/04-item-module/02_basic_data.spec.js b/e2e/paths/04-item-module/02_basic_data.spec.js index 8e6ecacfc..ebab836bf 100644 --- a/e2e/paths/04-item-module/02_basic_data.spec.js +++ b/e2e/paths/04-item-module/02_basic_data.spec.js @@ -7,7 +7,7 @@ describe('Item Edit basic data path', () => { beforeAll(() => { nightmare .loginAndModule('buyer', 'item') - .accessToSearchResult('Melee weapon combat first 15cm') + .accessToSearchResult('Melee weapon combat fist 15cm') .accessToSection('item.card.basicData'); }); diff --git a/modules/item/back/methods/item/specs/filter.spec.js b/modules/item/back/methods/item/specs/filter.spec.js index 7efb50033..7344b3116 100644 --- a/modules/item/back/methods/item/specs/filter.spec.js +++ b/modules/item/back/methods/item/specs/filter.spec.js @@ -22,12 +22,12 @@ describe('item filter()', () => { order: 'isActive ASC, name', limit: 8 }; - let tags = [{value: 'combat first', tagFk: 58}]; + let tags = [{value: 'combat fist', tagFk: 58}]; let result = await app.models.Item.filter({args: {filter: filter, typeFk: 2, tags: tags}}); expect(result.length).toEqual(1); expect(result[0].id).toEqual(2); - expect(result[0].name).toEqual('Melee weapon combat first 15cm'); + expect(result[0].name).toEqual('Melee weapon combat fist 15cm'); expect(result[0].type).toEqual('Anthurium'); }); }); From 7595905c5e20bd68c71695c1664f0790bbacfa5c Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Wed, 17 Apr 2019 11:31:37 +0200 Subject: [PATCH 14/59] front unit test from invoiceOut now included in the index file --- front/test-index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/front/test-index.js b/front/test-index.js index 5a7c5c713..e5113f0db 100644 --- a/front/test-index.js +++ b/front/test-index.js @@ -24,5 +24,5 @@ window.ngModule = function(moduleName) { let testsContext = require.context('./', true, /\.spec\.js$/); testsContext.keys().forEach(testsContext); -let modulesContext = require.context('../modules/', true, /^\.\/[a-z0-9]+\/front\/.+\.spec\.js$/); +let modulesContext = require.context('../modules/', true, /^\.\/[a-zA-Z0-9-]+\/front\/.+\.spec\.js$/); modulesContext.keys().forEach(modulesContext); From 2876f1910112f91f602b7da5cf73f337dfb6c086 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Wed, 17 Apr 2019 11:44:00 +0200 Subject: [PATCH 15/59] #1348 invoiceOut.summary --- .../invoiceOut/front/summary/index.spec.js | 28 +++++-------------- 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/modules/invoiceOut/front/summary/index.spec.js b/modules/invoiceOut/front/summary/index.spec.js index 34b306de8..b4d5b743e 100644 --- a/modules/invoiceOut/front/summary/index.spec.js +++ b/modules/invoiceOut/front/summary/index.spec.js @@ -1,40 +1,26 @@ import './index.js'; -describe('Route', () => { +describe('InvoiceOut', () => { describe('Component summary', () => { let controller; let $httpBackend; - beforeEach(ngModule('route')); + beforeEach(ngModule('invoiceOut')); beforeEach(angular.mock.inject(($componentController, _$httpBackend_) => { $httpBackend = _$httpBackend_; - controller = $componentController('vnRouteSummary'); - controller.route = {id: 1}; + controller = $componentController('vnInvoiceOutSummary'); + controller.invoiceOut = {id: 1}; })); describe('getSummary()', () => { it('should perform a query to set summary', () => { - $httpBackend.when('GET', `/api/Routes/1/summary`).respond(200, 24); - $httpBackend.expect('GET', `/api/Routes/1/summary`); + $httpBackend.when('GET', `/api/InvoiceOuts/1/summary`).respond(200, 'the data you are looking for'); + $httpBackend.expect('GET', `/api/InvoiceOuts/1/summary`); controller.getSummary(); $httpBackend.flush(); - expect(controller.summary).toEqual(24); - }); - }); - - describe('sumPackages()', () => { - it('should calculate the packages total', () => { - controller.summary = { - tickets: [ - {packages: 3}, - {packages: 1} - ] - }; - controller.sumPackages(); - - expect(controller.packagesTotal).toEqual(4); + expect(controller.summary).toEqual('the data you are looking for'); }); }); }); From bc005b23103c7c20bd6f94b863fa45d7d209fade Mon Sep 17 00:00:00 2001 From: Bernat Date: Thu, 18 Apr 2019 11:02:28 +0200 Subject: [PATCH 16/59] #1346 fix confirm.js and update item request --- db/dump/fixtures.sql | 8 ++-- loopback/locale/es.json | 2 +- modules/item/front/locale/es.yml | 2 + .../front/request-search-panel/index.html | 10 ++++ modules/item/front/request/index.html | 48 ++++++++++++++----- modules/item/front/request/index.js | 47 +++++++++--------- .../back/methods/ticket-request/confirm.js | 5 +- .../back/methods/ticket-request/filter.js | 8 +++- 8 files changed, 88 insertions(+), 42 deletions(-) diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index 0df460c3d..191431073 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -1210,10 +1210,10 @@ INSERT INTO `vn2008`.`workerTeam`(`id`, `team`, `user`) INSERT INTO `vn`.`ticketRequest`(`id`, `description`, `requesterFk`, `atenderFk`, `quantity`, `itemFk`, `price`, `isOk`, `saleFk`, `ticketFk`, `created`) VALUES - (1, 'Ranged weapon longbow 2m', 18, 35, 5, 1, 9.10, 1, 1, 1, DATE_ADD(CURDATE(), INTERVAL -15 DAY)), - (2, 'Melee weapon combat fist 15cm', 18, 35, 10, 2, 1.07, 0, NULL, 1, DATE_ADD(CURDATE(), INTERVAL -15 DAY)), - (3, 'Melee weapon heavy shield 1x0.5m', 18, 35, 20, 4, 3.06, 0, NULL, 1, DATE_ADD(CURDATE(), INTERVAL -15 DAY)), - (4, 'Melee weapon combat fist 15cm', 18, 35, 15, 2, 1.30, NULL, NULL, 11, CURDATE()); + (1, 'Ranged weapon longbow 2m', 18, 35, 5, 1, 9.10, 1, 1, 1, DATE_ADD(CURDATE(), INTERVAL -15 DAY)), + (2, 'Melee weapon combat first 15cm', 18, 35, 10, 2, 1.07, 0, NULL, 1, DATE_ADD(CURDATE(), INTERVAL -15 DAY)), + (3, 'Melee weapon heavy shield 1x0.5m', 18, 35, 20, 4, 3.06, 0, NULL, 1, DATE_ADD(CURDATE(), INTERVAL -15 DAY)), + (4, 'Melee weapon combat first 15cm', 18, 35, 15, NULL, 1.30, NULL, NULL, 11, CURDATE()); INSERT INTO `vn`.`ticketService`(`id`, `description`, `quantity`, `price`, `taxClassFk`, `ticketFk`) VALUES diff --git a/loopback/locale/es.json b/loopback/locale/es.json index d30886476..9d4504ce2 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -80,6 +80,6 @@ "We weren't able to send this SMS": "No hemos podido enviar el SMS", "This client can't be invoiced": "Este cliente no puede ser facturado", "This ticket can't be invoiced": "Este ticket no puede ser facturado", - "That item is not available on that day": "That item is not available on that day", + "That item is not available on that day": "El item no esta disponible para esa fecha", "That item doesn't exists": "That item doesn't exists" } \ No newline at end of file diff --git a/modules/item/front/locale/es.yml b/modules/item/front/locale/es.yml index 12522459a..56c96c403 100644 --- a/modules/item/front/locale/es.yml +++ b/modules/item/front/locale/es.yml @@ -45,6 +45,8 @@ stems: Tallos Compression: Compresión Density: Densidad Search items by id, name or barcode: Buscar articulos por identificador, nombre o codigo de barras +SalesPerson: Comercial +Concept: Concepto # Sections Items: Artículos diff --git a/modules/item/front/request-search-panel/index.html b/modules/item/front/request-search-panel/index.html index ba517d1ca..cb1734442 100644 --- a/modules/item/front/request-search-panel/index.html +++ b/modules/item/front/request-search-panel/index.html @@ -50,6 +50,16 @@ model="filter.to"> + + + + + + diff --git a/modules/item/front/request/index.html b/modules/item/front/request/index.html index 786e71e86..76a95a967 100644 --- a/modules/item/front/request/index.html +++ b/modules/item/front/request/index.html @@ -1,6 +1,6 @@ @@ -17,7 +17,7 @@ - + @@ -29,9 +29,9 @@ Quantity Price Atender - itemFk + Item Concept - Quantity + Quantity State @@ -43,15 +43,36 @@ {{request.ticketFk}} - - {{::request.shipped | dateTime: 'dd/MM/yyyy'}} + + + {{::request.shipped | dateTime: 'dd/MM/yyyy'}} + {{::request.warehouse}} - {{::request.salesPersonNickname}} - {{::request.description}} + + + {{::request.salesPersonNickname}} + + + + + {{::request.description}} + + {{::request.quantity}} - {{::request.price}} - {{::request.atenderNickname}} + {{::request.price | currency: 'EUR':2}} + + + {{::request.atenderNickname}} + + {{request.itemFk}} @@ -88,10 +109,15 @@
- + + + + diff --git a/modules/item/front/request/index.js b/modules/item/front/request/index.js index 5e3726d81..e4322cf7f 100644 --- a/modules/item/front/request/index.js +++ b/modules/item/front/request/index.js @@ -2,11 +2,11 @@ import ngModule from '../module'; import './style.scss'; export default class Controller { - constructor($scope, vnApp, $translate, $http, $state, $stateParams) { + constructor($, vnApp, $translate, $http, $state, $stateParams) { this.$state = $state; this.$stateParams = $stateParams; this.$http = $http; - this.$scope = $scope; + this.$ = $; this.vnApp = vnApp; this._ = $translate; if (!$stateParams.q) @@ -39,7 +39,7 @@ export default class Controller { this.$http.post(endpoint, params).then(() => { this.vnApp.showSuccess(this._.instant('Data saved!')); }).catch( e => { - this.$scope.model.refresh(); + this.$.model.refresh(); throw e; }); } @@ -56,7 +56,7 @@ export default class Controller { this.$http.patch(endpoint, params).then(() => { this.vnApp.showSuccess(this._.instant('Data saved!')); }).catch( e => { - this.$scope.model.refresh(); + this.$.model.refresh(); throw e; }); } @@ -78,15 +78,15 @@ export default class Controller { onSearch(params) { if (params) - this.$scope.model.applyFilter(null, params); + this.$.model.applyFilter(null, params); else - this.$scope.model.clear(); + this.$.model.clear(); } showDenyReason(event, requestId) { this.denyRequestId = requestId; - this.$scope.denyReason.parent = event.target; - this.$scope.denyReason.show(); + this.$.denyReason.parent = event.target; + this.$.denyReason.show(); } clear() { @@ -102,35 +102,38 @@ export default class Controller { this.$http.post(endpoint, params).then(() => { this.vnApp.showSuccess(this._.instant('Data saved!')); - this.$scope.model.refresh(); - this.$scope.denyReason.hide(); + this.$.model.refresh(); + this.$.denyReason.hide(); this.denyObservation = null; }); } - showClientDescriptor(event, clientFk) { - this.$scope.clientDescriptor.clientFk = clientFk; - this.$scope.clientDescriptor.parent = event.target; - this.$scope.clientDescriptor.show(); + showTicketDescriptor(event, ticketFk) { + this.$.ticketDescriptor.ticketFk = ticketFk; + this.$.ticketDescriptor.parent = event.target; + this.$.ticketDescriptor.show(); event.preventDefault(); event.stopImmediatePropagation(); } - showTicketDescriptor(event, ticketFk) { - this.$scope.ticketDescriptor.ticketFk = ticketFk; - this.$scope.ticketDescriptor.parent = event.target; - this.$scope.ticketDescriptor.show(); - event.preventDefault(); - event.stopImmediatePropagation(); + showItemDescriptor(event, itemFk) { + this.$.itemDescriptor.itemFk = itemFk; + this.$.itemDescriptor.parent = event.target; + this.$.itemDescriptor.show(); + } + + showWorkerDescriptor(event, userId) { + this.$.workerDescriptor.userId = userId; + this.$.workerDescriptor.parent = event.target; + this.$.workerDescriptor.show(); } onDescriptorLoad() { - this.$scope.popover.relocate(); + this.$.popover.relocate(); } preventNavigation(event) { event.preventDefault(); - event.stopImmediatePropagation(); } } diff --git a/modules/ticket/back/methods/ticket-request/confirm.js b/modules/ticket/back/methods/ticket-request/confirm.js index f9888f9e0..79676b9b2 100644 --- a/modules/ticket/back/methods/ticket-request/confirm.js +++ b/modules/ticket/back/methods/ticket-request/confirm.js @@ -48,14 +48,13 @@ module.exports = Self => { let params = [ ctx.args.itemFk, - request.ticket().warehouseFk, request.ticket().shipped, + request.ticket().warehouseFk, false ]; - + console.log(params); let [res] = await Self.rawSql(query, params); let available = res[0].available; - if (!available) throw new UserError(`That item is not available on that day`); diff --git a/modules/ticket/back/methods/ticket-request/filter.js b/modules/ticket/back/methods/ticket-request/filter.js index 1d19120ff..a2862c59b 100644 --- a/modules/ticket/back/methods/ticket-request/filter.js +++ b/modules/ticket/back/methods/ticket-request/filter.js @@ -43,6 +43,10 @@ module.exports = Self => { arg: 'to', type: 'Date', description: `Date to` + }, { + arg: 'isOk', + type: 'Boolean', + description: `Search request by request state` } ], returns: { @@ -111,7 +115,9 @@ module.exports = Self => { t.clientFk, w.name AS warehouse, u.nickname AS salesPersonNickname, - ua.nickname AS atenderNickname + ua.nickname AS atenderNickname, + u.id AS salesPersonUserFk, + ua.id AS atenderUserFk FROM ticketRequest tr LEFT JOIN ticket t ON t.id = tr.ticketFk LEFT JOIN warehouse w ON w.id = t.warehouseFk From 2107b577649daf22f0259ee7932b70365dcb9809 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Thu, 18 Apr 2019 11:12:48 +0200 Subject: [PATCH 17/59] small typo --- modules/ticket/front/descriptor/locale/es.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ticket/front/descriptor/locale/es.yml b/modules/ticket/front/descriptor/locale/es.yml index 0e0d0bdd6..a661c239f 100644 --- a/modules/ticket/front/descriptor/locale/es.yml +++ b/modules/ticket/front/descriptor/locale/es.yml @@ -8,7 +8,7 @@ Add stowaway: Añadir polizón Remove stowaway: Borrar polizón Are you sure you want to delete this stowaway?: ¿Seguro que quieres borrar este polizón? Show Delivery Note: Ver albarán -Show pallet report: Mostrar hoja de pallet +Show pallet report: Ver hoja de pallet Change shipped hour: Cambiar hora de envío Shipped hour: Hora de envío SMSPayment: >- From fb30a01fde09d171777c0fab6b0b318b9f6b34c4 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Thu, 18 Apr 2019 11:47:31 +0200 Subject: [PATCH 18/59] #1348 invoiceOut.summary --- .../back/methods/invoiceOut/summary.js | 13 +++---- .../invoiceOut/front/descriptor/index.html | 9 +++++ modules/invoiceOut/front/descriptor/index.js | 18 ++++++++- .../invoiceOut/front/descriptor/locale/es.yml | 3 +- modules/invoiceOut/front/summary/index.html | 38 +++++++++++-------- modules/invoiceOut/front/summary/index.js | 10 ----- .../invoiceOut/front/summary/locale/es.yml | 6 ++- 7 files changed, 61 insertions(+), 36 deletions(-) diff --git a/modules/invoiceOut/back/methods/invoiceOut/summary.js b/modules/invoiceOut/back/methods/invoiceOut/summary.js index 6369f3ca1..caa2a1c06 100644 --- a/modules/invoiceOut/back/methods/invoiceOut/summary.js +++ b/modules/invoiceOut/back/methods/invoiceOut/summary.js @@ -81,14 +81,11 @@ module.exports = Self => { let ticketTotalsIndex = stmts.push('SELECT * FROM tmp.ticketTotal') - 1; stmt = new ParameterizedSQL(` - SELECT tc.description as type, SUM(ROUND(s.quantity * s.price * (100 - s.discount) / 100,2)) AS base - FROM vn.sale s - JOIN vn.ticket t ON t.id = s.ticketFk - LEFT JOIN vn.itemTaxCountry itc ON itc.itemFk = s.itemFk - JOIN vn.country c ON c.id = itc.countryFK AND c.id = ? - LEFT JOIN vn.taxClass tc ON tc.id = itc.taxClassFk - WHERE t.refFk = ? - GROUP BY type`, [summary.invoiceOut.supplier().countryFk, summary.invoiceOut.ref]); + SELECT iot.* , pgc.*, IF(pe.equFk IS NULL, taxableBase, 0) AS Base, pgc.rate / 100 as vatPercent + FROM vn.invoiceOutTax iot + JOIN vn.pgc ON pgc.code = iot.pgcFk + LEFT JOIN vn.pgcEqu pe ON pe.equFk = pgc.code + WHERE invoiceOutFk = ?`, [summary.invoiceOut.id]); let invoiceOutTaxesIndex = stmts.push(stmt) - 1; stmts.push( diff --git a/modules/invoiceOut/front/descriptor/index.html b/modules/invoiceOut/front/descriptor/index.html index 65d4816fe..ae0694227 100644 --- a/modules/invoiceOut/front/descriptor/index.html +++ b/modules/invoiceOut/front/descriptor/index.html @@ -6,6 +6,15 @@ + +
diff --git a/modules/invoiceOut/front/descriptor/index.js b/modules/invoiceOut/front/descriptor/index.js index 777ab6bb1..f8ceab5e7 100644 --- a/modules/invoiceOut/front/descriptor/index.js +++ b/modules/invoiceOut/front/descriptor/index.js @@ -1,6 +1,17 @@ import ngModule from '../module'; class Controller { + constructor(vnToken) { + this.accessToken = vnToken.token; + this.moreOptions = [ + {callback: this.showInvoiceOutPdf, name: 'Show invoice out PDF'} + ]; + } + + onMoreChange(callback) { + callback.call(this); + } + set invoiceOut(value) { this._invoiceOut = value; @@ -24,6 +35,11 @@ class Controller { return this._invoiceOut; } + showInvoiceOutPdf() { + let url = `api/InvoiceOuts/${this.invoiceOut.id}/download?access_token=${this.accessToken}`; + window.open(url, '_blank'); + } + set quicklinks(value = {}) { this._quicklinks = Object.assign(value, this._quicklinks); } @@ -33,7 +49,7 @@ class Controller { } } -Controller.$inject = ['$http', '$state']; +Controller.$inject = ['vnToken']; ngModule.component('vnInvoiceOutDescriptor', { template: require('./index.html'), diff --git a/modules/invoiceOut/front/descriptor/locale/es.yml b/modules/invoiceOut/front/descriptor/locale/es.yml index 63ea7b6b5..490139184 100644 --- a/modules/invoiceOut/front/descriptor/locale/es.yml +++ b/modules/invoiceOut/front/descriptor/locale/es.yml @@ -1,4 +1,5 @@ Volume exceded: Volumen excedido Volume: Volumen Client card: Ficha del cliente -Invoice ticket list: Listado de tickets de la factura \ No newline at end of file +Invoice ticket list: Listado de tickets de la factura +Show invoice out PDF: Ver factura emitida en PDF \ No newline at end of file diff --git a/modules/invoiceOut/front/summary/index.html b/modules/invoiceOut/front/summary/index.html index 810c847f5..ab25cde92 100644 --- a/modules/invoiceOut/front/summary/index.html +++ b/modules/invoiceOut/front/summary/index.html @@ -14,25 +14,31 @@ - - - - - - - - + + + +

Desglose impositivo

+ + Type + Taxable base + Rate + Fee + +
+ + + {{tax.name}} + {{tax.taxableBase | currency: 'EUR': 2}} + {{tax.rate}}% + {{tax.vat | currency: 'EUR': 2}} + + +
+

Ticket

@@ -40,6 +46,7 @@ Ticket id Alias + Shipped Amount @@ -59,6 +66,7 @@ {{ticket.nickname}} + {{ticket.shipped | dateTime: 'dd/MM/yyyy'}} {{ticket.total | currency: 'EUR': 2}} diff --git a/modules/invoiceOut/front/summary/index.js b/modules/invoiceOut/front/summary/index.js index ed82242e8..6135942fb 100644 --- a/modules/invoiceOut/front/summary/index.js +++ b/modules/invoiceOut/front/summary/index.js @@ -18,13 +18,6 @@ class Controller { return this._invoiceOut; } - openPdf(id, event) { - let url = `api/InvoiceOuts/${id}/download?access_token=${this.accessToken}`; - window.open(url, '_blank'); - event.preventDefault(); - event.stopImmediatePropagation(); - } - getSummary() { this.$http.get(`/api/InvoiceOuts/${this.invoiceOut.id}/summary`).then(response => { this.summary = response.data; @@ -36,7 +29,6 @@ class Controller { this.$.clientDescriptor.parent = event.target; this.$.clientDescriptor.show(); event.preventDefault(); - event.stopImmediatePropagation(); } showTicketDescriptor(event, ticketFk) { @@ -44,14 +36,12 @@ class Controller { this.$.ticketDescriptor.parent = event.target; this.$.ticketDescriptor.show(); event.preventDefault(); - event.stopImmediatePropagation(); } preview(event, invoiceOut) { this.selectedInvoiceOut = invoiceOut; this.$.invoiceOutSummaryDialog.show(); event.preventDefault(); - event.stopImmediatePropagation(); } } diff --git a/modules/invoiceOut/front/summary/locale/es.yml b/modules/invoiceOut/front/summary/locale/es.yml index 74ddf1df3..4444939c7 100644 --- a/modules/invoiceOut/front/summary/locale/es.yml +++ b/modules/invoiceOut/front/summary/locale/es.yml @@ -12,4 +12,8 @@ Due: Vencimiento Booked: Asentado General VAT: IVA general Reduced VAT: IVA reducido - +Shipped: F. envío +Type: Tipo +Rate: Tasa +Fee: Cuota +Taxable base: Base imp. \ No newline at end of file From 76269a8a1686743a670b864beb80427ff61c8793 Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Tue, 23 Apr 2019 08:29:23 +0200 Subject: [PATCH 19/59] added drag & drop directives on worker department #1319 --- front/core/components/treeview/child.html | 4 +- front/core/components/treeview/child.js | 6 +- front/core/components/treeview/index.html | 3 +- front/core/components/treeview/index.js | 4 + front/core/components/treeview/style.scss | 14 +++- front/core/directives/draggable.js | 36 +++++++++ front/core/directives/droppable.js | 90 ++++++++++++++++++++++ front/core/directives/index.js | 2 + modules/order/front/catalog/index.html | 2 +- modules/worker/front/department/index.html | 1 + modules/worker/front/department/index.js | 14 ++++ 11 files changed, 170 insertions(+), 6 deletions(-) create mode 100644 front/core/directives/draggable.js create mode 100644 front/core/directives/droppable.js diff --git a/front/core/components/treeview/child.html b/front/core/components/treeview/child.html index a079d8f40..c1f20bcff 100644 --- a/front/core/components/treeview/child.html +++ b/front/core/components/treeview/child.html @@ -5,7 +5,7 @@ 'collapsed': !item.active, 'included': item.selected == 1, 'excluded': item.selected == 0 - }"> + }" vn-draggable vn-droppable on-drop="$ctrl.onDrop(item, dragged, dropped)"> diff --git a/front/core/components/treeview/child.js b/front/core/components/treeview/child.js index ca5b59efb..a26c47b5d 100644 --- a/front/core/components/treeview/child.js +++ b/front/core/components/treeview/child.js @@ -15,7 +15,7 @@ class Controller extends Component { this.treeview.onSelection(item, value); } - onClick(icon, item, parent, index) { + onIconClick(icon, item, parent, index) { let parentScope = this.$scope.$parent.$parent; let parentController = parentScope.$ctrl; icon.callback.call(parentController, item, parent, index); @@ -25,6 +25,10 @@ class Controller extends Component { this.treeview.onCreate(parent); } + onDrop(item, dragged, dropped) { + this.treeview.onDrop(item, dragged, dropped); + } + get isInsertable() { return Array.isArray(this.parent) || this.parent.childs; } diff --git a/front/core/components/treeview/index.html b/front/core/components/treeview/index.html index 85a4e4b6b..606526add 100644 --- a/front/core/components/treeview/index.html +++ b/front/core/components/treeview/index.html @@ -5,5 +5,6 @@ editable="$ctrl.editable" disabled="$ctrl.disabled" icons="$ctrl.icons" - acl-role="$ctrl.aclRole"> + acl-role="$ctrl.aclRole" + vn-droppable> diff --git a/front/core/components/treeview/index.js b/front/core/components/treeview/index.js index 9f2a0a3fa..c34ba2039 100644 --- a/front/core/components/treeview/index.js +++ b/front/core/components/treeview/index.js @@ -69,6 +69,10 @@ export default class Treeview extends Component { item.active = !item.active; } + + onDrop(item, dragged, dropped) { + this.emit('drop', {item, dragged, dropped}); + } } Treeview.$inject = ['$element', '$scope']; diff --git a/front/core/components/treeview/style.scss b/front/core/components/treeview/style.scss index ce51fe482..ff295636d 100644 --- a/front/core/components/treeview/style.scss +++ b/front/core/components/treeview/style.scss @@ -1,6 +1,10 @@ @import "variables"; vn-treeview { + vn-treeview-child { + display: block + } + ul { line-height: 24px; padding: 0; @@ -9,17 +13,25 @@ vn-treeview { li { list-style: none; - cursor: pointer; .actions { min-width: 24px; } .description { + pointer-events: none; padding-left: 5px } } + li[vn-draggable] { + cursor: move + } + + li vn-icon { + cursor: pointer; + } + li ul { padding-left: 1.8em; } diff --git a/front/core/directives/draggable.js b/front/core/directives/draggable.js new file mode 100644 index 000000000..588b97adf --- /dev/null +++ b/front/core/directives/draggable.js @@ -0,0 +1,36 @@ +import ngModule from '../module'; + +/** + * Enables a draggable element and his drag events + * + * @return {Object} The directive + */ +export function directive() { + return { + restrict: 'A', + link: function($scope, $element) { + const element = $element[0]; + + // Enable as draggable element + element.setAttribute('draggable', true); + + /** + * Fires when a drag event starts + */ + element.addEventListener('dragstart', event => { + element.style.opacity = 0.5; + event.stopPropagation(); + }); + + /** + * Fires when a drag event ends + */ + element.addEventListener('dragend', event => { + element.style.opacity = 1; + event.stopPropagation(); + }); + } + }; +} + +ngModule.directive('vnDraggable', directive); diff --git a/front/core/directives/droppable.js b/front/core/directives/droppable.js new file mode 100644 index 000000000..73f0db093 --- /dev/null +++ b/front/core/directives/droppable.js @@ -0,0 +1,90 @@ +import ngModule from '../module'; + + +export function directive($parse) { + return { + restrict: 'A', + link: function($scope, $element, $attrs) { + const element = $element[0]; + const onDropEvent = $parse($attrs.onDrop); + + /** + * Captures current dragging element + */ + element.addEventListener('dragstart', () => { + this.dragged = element; + }); + + /** + * Enter droppable area event + */ + element.addEventListener('dragenter', event => { + element.style.backgroundColor = 'yellow'; + + event.stopImmediatePropagation(); + event.preventDefault(); + }, false); + + + /** + * Exit droppable area event + */ + element.addEventListener('dragleave', event => { + element.style.backgroundColor = 'transparent'; + + event.stopImmediatePropagation(); + event.preventDefault(); + }); + + /** + * Prevent dragover for allowing + * dispatch drop event + */ + element.addEventListener('dragover', event => { + event.stopPropagation(); + event.preventDefault(); + }); + + /** + * Fires when a drop events + */ + element.addEventListener('drop', event => { + const draggedParent = this.dragged.parentNode; + const targetChild = element.querySelector('ul'); + + + element.style.transition = 'background 2s'; + element.style.backgroundColor = 'transparent'; + + if (this.dragged === element) + return event.preventDefault(); + + + if (targetChild) { + const targetNodes = targetChild.querySelectorAll('li'); + const before = targetNodes[targetNodes.length - 1]; + + targetChild.insertBefore(this.dragged, before); + } else + draggedParent.removeChild(this.dragged); + + onDropEvent($scope, { + dragged: { + element: this.dragged, + scope: angular.element(this.dragged).scope() + }, + dropped: { + element: element, + scope: angular.element(element).scope() + } + }); + + event.stopImmediatePropagation(); + }); + } + }; +} + +directive.$inject = ['$parse']; + +ngModule.directive('vnDroppable', directive); diff --git a/front/core/directives/index.js b/front/core/directives/index.js index 9aed1aea3..7db806caf 100644 --- a/front/core/directives/index.js +++ b/front/core/directives/index.js @@ -11,3 +11,5 @@ import './bind'; import './repeat-last'; import './title'; import './uvc'; +import './draggable'; +import './droppable'; diff --git a/modules/order/front/catalog/index.html b/modules/order/front/catalog/index.html index 1d834a66c..0e390d61c 100644 --- a/modules/order/front/catalog/index.html +++ b/modules/order/front/catalog/index.html @@ -7,7 +7,7 @@ on-data-change="$ctrl.onDataChange()">
- +
diff --git a/modules/worker/front/department/index.html b/modules/worker/front/department/index.html index 7cf4bade7..5dac26eca 100644 --- a/modules/worker/front/department/index.html +++ b/modules/worker/front/department/index.html @@ -11,6 +11,7 @@ diff --git a/modules/worker/front/department/index.js b/modules/worker/front/department/index.js index 99d65a478..2047c06c7 100644 --- a/modules/worker/front/department/index.js +++ b/modules/worker/front/department/index.js @@ -26,6 +26,20 @@ class Controller { this.$scope.deleteNode.show(); } + onDrop(item, dragged, dropped) { + if (dropped.scope.item) { + const droppedItem = dropped.scope.item; + const draggedItem = dragged.scope.item; + + if (droppedItem.childs) + droppedItem.childs.push(Object.assign({}, draggedItem)); + + dragged.element.remove(); + + this.$scope.$apply(); + } + } + onCreateDialogOpen() { this.newNode.name = ''; } From 2b04eebe844e93cc2cee2a9343f6ca2331f03921 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Tue, 23 Apr 2019 08:58:49 +0200 Subject: [PATCH 20/59] #1334 E2E ticket.descriptor - Make invoice --- e2e/helpers/selectors.js | 13 ++++--- .../05-ticket-module/12_descriptor.spec.js | 39 +++++++++++++++++++ loopback/locale/en.json | 3 +- modules/ticket/front/descriptor/index.html | 3 +- modules/ticket/front/descriptor/index.js | 5 +-- 5 files changed, 51 insertions(+), 12 deletions(-) diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 0e117fb45..b53863966 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -301,7 +301,8 @@ export default { firstSaleItemId: 'vn-ticket-summary [name="sales"] vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(2) > span', popoverDiaryButton: 'vn-ticket-summary vn-item-descriptor-popover vn-item-descriptor vn-icon[icon="icon-transaction"]', firstSaleQuantity: 'vn-ticket-summary [name="sales"] vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(3)', - firstSaleDiscount: 'vn-ticket-summary [name="sales"] vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(6)' + firstSaleDiscount: 'vn-ticket-summary [name="sales"] vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(6)', + invoiceOutRef: 'vn-ticket-summary > vn-card > div > vn-horizontal > vn-one:nth-child(1) > vn-label-value:nth-child(6) > section > span' }, ticketsIndex: { newTicketButton: 'vn-ticket-index > a', @@ -326,10 +327,11 @@ export default { }, ticketDescriptor: { moreMenu: `vn-ticket-descriptor vn-icon-menu > div > vn-icon`, - moreMenuAddStowaway: `vn-ticket-descriptor vn-icon-menu > div > vn-drop-down > vn-popover ul > li:nth-child(1)`, - moreMenuDeleteStowawayButton: 'vn-ticket-descriptor vn-icon-menu > div > vn-drop-down > vn-popover ul > li:nth-child(5)', - moreMenuAddToTurn: `vn-ticket-descriptor vn-icon-menu > div > vn-drop-down > vn-popover ul > li:nth-child(2)`, - moreMenuDeleteTicket: `vn-ticket-descriptor vn-icon-menu > div > vn-drop-down > vn-popover ul > li:nth-child(3)`, + moreMenuAddStowaway: `vn-ticket-descriptor vn-drop-down > vn-popover ul > li:nth-child(1)`, + moreMenuDeleteStowawayButton: 'vn-ticket-descriptor vn-drop-down > vn-popover ul > li:nth-child(5)', + moreMenuAddToTurn: `vn-ticket-descriptor vn-drop-down > vn-popover ul > li:nth-child(2)`, + moreMenuDeleteTicket: `vn-ticket-descriptor vn-drop-down > vn-popover ul > li:nth-child(3)`, + moreMenuMakeInvoice: 'vn-ticket-descriptor vn-drop-down > vn-popover ul > li:nth-child(5)', addStowawayDialogSecondTicket: 'vn-ticket-descriptor > vn-add-stowaway > vn-dialog vn-table vn-tr:nth-child(2)', shipSelectButton: 'vn-ticket-descriptor > div > div.body > div.quicklinks > vn-button-menu[icon="icon-stowaway"]', shipButton: 'vn-ticket-descriptor > div > div.body > div.quicklinks vn-icon[icon="icon-stowaway"]', @@ -338,6 +340,7 @@ export default { saturdayButton: `vn-ticket-descriptor > vn-dialog > div > form > div.body > tpl-body > div > vn-tool-bar > vn-button:nth-child(6)`, closeStowawayDialog: 'vn-ticket-descriptor > vn-add-stowaway > vn-dialog > div > button[class="close"]', acceptDeleteButton: 'vn-ticket-descriptor button[response="ACCEPT"]', + acceptInvoiceOutButton: 'vn-ticket-descriptor vn-confirm[vn-id="invoiceMakeConfirmation"] button[response="ACCEPT"]', acceptDeleteStowawayButton: 'vn-ticket-descriptor > vn-remove-stowaway button[response="ACCEPT"]' }, ticketNotes: { diff --git a/e2e/paths/05-ticket-module/12_descriptor.spec.js b/e2e/paths/05-ticket-module/12_descriptor.spec.js index b8e610891..1044fbd7e 100644 --- a/e2e/paths/05-ticket-module/12_descriptor.spec.js +++ b/e2e/paths/05-ticket-module/12_descriptor.spec.js @@ -148,4 +148,43 @@ describe('Ticket descriptor path', () => { expect(exists).toBeFalsy(); }); }); + + describe('Make invoice', () => { + it('should login as Invoicing role then search for a ticket', async() => { + const invoiceableTicketId = 11; + + const url = await nightmare + .loginAndModule('developer', 'ticket') + .accessToSearchResult(invoiceableTicketId) + .waitForURL('/summary') + .parsedUrl(); + + expect(url.hash).toContain(`ticket/${invoiceableTicketId}/summary`); + }); + + it(`should make sure the ticket doesn't have an invoiceOutFk yet`, async() => { + const result = await nightmare + .waitToGetProperty(selectors.ticketSummary.invoiceOutRef, 'innerText'); + + expect(result).toEqual('-'); + }); + + it('should invoice the ticket using the descriptor more menu', async() => { + const result = await nightmare + .waitToClick(selectors.ticketDescriptor.moreMenu) + .waitToClick(selectors.ticketDescriptor.moreMenuMakeInvoice) + .waitToClick(selectors.ticketDescriptor.acceptInvoiceOutButton) + .waitForLastSnackbar(); + + expect(result).toEqual('Ticket invoiced'); + }); + + it(`should make sure the ticket summary have an invoiceOutFk`, async() => { + const result = await nightmare + .waitForTextInElement(selectors.ticketSummary.invoiceOutRef, 'T4444445') + .waitToGetProperty(selectors.ticketSummary.invoiceOutRef, 'innerText'); + + expect(result).toEqual('T4444445'); + }); + }); }); diff --git a/loopback/locale/en.json b/loopback/locale/en.json index b323c1c36..26252d825 100644 --- a/loopback/locale/en.json +++ b/loopback/locale/en.json @@ -41,5 +41,6 @@ "City cannot be empty": "City cannot be empty", "EXTENSION_INVALID_FORMAT": "Invalid extension", "The secret can't be blank": "The secret can't be blank", - "Invalid TIN": "Invalid Tax number" + "Invalid TIN": "Invalid Tax number", + "This ticket can't be invoiced": "This ticket can't be invoiced" } \ No newline at end of file diff --git a/modules/ticket/front/descriptor/index.html b/modules/ticket/front/descriptor/index.html index 779ce7e53..326a72695 100644 --- a/modules/ticket/front/descriptor/index.html +++ b/modules/ticket/front/descriptor/index.html @@ -160,7 +160,6 @@ on-response="$ctrl.returnDialog(response)" question="Pickup order" message="Do you want to send it directly?"> - asd diff --git a/modules/ticket/front/descriptor/index.js b/modules/ticket/front/descriptor/index.js index 0e153b8fc..5d1c6253d 100644 --- a/modules/ticket/front/descriptor/index.js +++ b/modules/ticket/front/descriptor/index.js @@ -21,7 +21,6 @@ class Controller { ]; } - // Change shipped hour showChangeShipped() { if (!this.isEditable) { this.vnApp.showError(this.$translate.instant('This ticket can\'t be modified')); @@ -84,7 +83,6 @@ class Controller { return true; } - // Add Turn showAddTurnDialog() { this.$scope.addTurn.show(); } @@ -97,7 +95,6 @@ class Controller { }); } - // Delete Ticket showDeleteTicketDialog() { if (!this.isEditable) { this.vnApp.showError(this.$translate.instant('This ticket cant be deleted')); @@ -202,7 +199,7 @@ class Controller { * * @param {String} response - Response result */ - invoiceMakeOut(response) { + makeInvoiceOut(response) { if (response === 'ACCEPT') { const query = `/ticket/api/Tickets/${this.ticket.id}/makeInvoice`; this.$http.post(query).then(() => { From 5501ff8f4fa2020775125d9d784e93d441b89441 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Tue, 23 Apr 2019 09:08:28 +0200 Subject: [PATCH 21/59] test repairs --- modules/ticket/front/descriptor/index.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ticket/front/descriptor/index.spec.js b/modules/ticket/front/descriptor/index.spec.js index 8e5a43f71..164ad8009 100644 --- a/modules/ticket/front/descriptor/index.spec.js +++ b/modules/ticket/front/descriptor/index.spec.js @@ -85,7 +85,7 @@ describe('Ticket Component vnTicketDescriptor', () => { $httpBackend.when('POST', `/ticket/api/Tickets/2/makeInvoice`).respond(); $httpBackend.expect('POST', `/ticket/api/Tickets/2/makeInvoice`).respond(); - controller.invoiceMakeOut('ACCEPT'); + controller.makeInvoiceOut('ACCEPT'); $httpBackend.flush(); expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Ticket invoiced'); From 75c9d1122c691be1547383c8ec40e4b1b00f239b Mon Sep 17 00:00:00 2001 From: Bernat Date: Tue, 23 Apr 2019 11:25:49 +0200 Subject: [PATCH 22/59] #1329 ticket.services validation --- loopback/locale/es.json | 3 ++- modules/ticket/back/models/ticket-service.js | 12 ++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 modules/ticket/back/models/ticket-service.js diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 9d4504ce2..e275cbb93 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -81,5 +81,6 @@ "This client can't be invoiced": "Este cliente no puede ser facturado", "This ticket can't be invoiced": "Este ticket no puede ser facturado", "That item is not available on that day": "El item no esta disponible para esa fecha", - "That item doesn't exists": "That item doesn't exists" + "That item doesn't exists": "That item doesn't exists", + "You cannot add services to an invoiced ticket": "No puedes añadir servicios a un ticket facturado" } \ No newline at end of file diff --git a/modules/ticket/back/models/ticket-service.js b/modules/ticket/back/models/ticket-service.js new file mode 100644 index 000000000..3f54a960e --- /dev/null +++ b/modules/ticket/back/models/ticket-service.js @@ -0,0 +1,12 @@ +const UserError = require('vn-loopback/util/user-error'); + +module.exports = Self => { + Self.observe('before save', async ctx => { + if (ctx.isNewInstance) { + let ticketId = ctx.instance.ticketFk; + let ticket = await Self.app.models.Ticket.findById(ticketId); + if (ticket.refFk) + throw new UserError('You cannot add services to an invoiced ticket'); + } + }); +}; From 8d5cc93ddba0f966854ce05a1ecccf8343a76bac Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Tue, 23 Apr 2019 13:29:52 +0200 Subject: [PATCH 23/59] #1359 refactor absences --- db/dump/fixtures.sql | 2 +- .../05-ticket-module/12_descriptor.spec.js | 4 +- .../back/methods/worker-calendar/absences.js | 18 ++- .../worker-calendar/specs/absences.spec.js | 129 +++++++++++++++++- 4 files changed, 145 insertions(+), 8 deletions(-) diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index 191431073..1d075939f 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -1273,7 +1273,7 @@ INSERT INTO `postgresql`.`profile`(`profile_id`, `person_id`, `profile_type_id`) FROM `postgresql`.`person` `p`; INSERT INTO `postgresql`.`business`(`business_id`, `client_id`, `provider_id`, `date_start`, `date_end`, `workerBusiness`, `reasonEndFk`) - SELECT p.profile_id, p.profile_id, 1000, DATE_ADD(CURDATE(), INTERVAL -15 DAY), DATE_ADD(CURDATE(), INTERVAL +6 MONTH), CONCAT('E-46-',RPAD(CONCAT(p.profile_id,9),8,p.profile_id)), NULL + SELECT p.profile_id, p.profile_id, 1000, CONCAT(YEAR(DATE_ADD(CURDATE(), INTERVAL -1 YEAR)), '-12-31'), CONCAT(YEAR(DATE_ADD(CURDATE(), INTERVAL +1 YEAR)), '-01-01'), CONCAT('E-46-',RPAD(CONCAT(p.profile_id,9),8,p.profile_id)), NULL FROM `postgresql`.`profile` `p`; INSERT INTO `postgresql`.`business_labour`(`business_id`, `notes`, `department_id`, `professional_category_id`, `incentivo`, `calendar_labour_type_id`, `porhoras`, `labour_agreement_id`, `workcenter_id`) diff --git a/e2e/paths/05-ticket-module/12_descriptor.spec.js b/e2e/paths/05-ticket-module/12_descriptor.spec.js index 1044fbd7e..5d47d504d 100644 --- a/e2e/paths/05-ticket-module/12_descriptor.spec.js +++ b/e2e/paths/05-ticket-module/12_descriptor.spec.js @@ -150,11 +150,11 @@ describe('Ticket descriptor path', () => { }); describe('Make invoice', () => { - it('should login as Invoicing role then search for a ticket', async() => { + it('should login as adminBoss role then search for a ticket', async() => { const invoiceableTicketId = 11; const url = await nightmare - .loginAndModule('developer', 'ticket') + .loginAndModule('adminBoss', 'ticket') .accessToSearchResult(invoiceableTicketId) .waitForURL('/summary') .parsedUrl(); diff --git a/modules/worker/back/methods/worker-calendar/absences.js b/modules/worker/back/methods/worker-calendar/absences.js index 1ca212863..b6eae8a13 100644 --- a/modules/worker/back/methods/worker-calendar/absences.js +++ b/modules/worker/back/methods/worker-calendar/absences.js @@ -25,10 +25,12 @@ module.exports = Self => { arg: 'calendar' }, { - arg: 'absences' + arg: 'absences', + type: 'Number' }, { - arg: 'holidays' + arg: 'holidays', + type: 'Number' }], http: { path: `/absences`, @@ -147,8 +149,16 @@ module.exports = Self => { const startedTime = started.getTime(); const contractDays = Math.floor((endedTime - startedTime) / dayTimestamp); - if (contractDays < 365) - return Math.floor(contract.holidays().days * (contractDays + 1) / 365); + if (contractDays < 365) { + let holidays = contract.holidays().days * (contractDays + 1) / 365; + let integerPart = parseInt(holidays); + let decimalPart = holidays - integerPart; + let decimal = decimalPart >= 0.5 ? 0.5 : 0; + + holidays = integerPart + decimal; + + return holidays; + } return contract.holidays().days; } diff --git a/modules/worker/back/methods/worker-calendar/specs/absences.spec.js b/modules/worker/back/methods/worker-calendar/specs/absences.spec.js index 526366d6f..336f55636 100644 --- a/modules/worker/back/methods/worker-calendar/specs/absences.spec.js +++ b/modules/worker/back/methods/worker-calendar/specs/absences.spec.js @@ -1,6 +1,19 @@ const app = require('vn-loopback/server/server'); describe('Worker absences()', () => { + afterAll(async done => { + const hiredWorker = await app.models.WorkerLabour.findById(106); + + const endedDate = new Date(); + endedDate.setFullYear(endedDate.getFullYear() + 1); + endedDate.setHours(0, 0, 0, 0); + endedDate.setMonth(0); + endedDate.setDate(1); + + await hiredWorker.updateAttributes({ended: endedDate}); + done(); + }); + it('should get the absence calendar for the given dates then evaluate the type of absences', async() => { let ctx = {req: {accessToken: {userId: 106}}}; let workerFk = 106; @@ -20,7 +33,121 @@ describe('Worker absences()', () => { let calendar = result[0]; let absences = result[1]; - expect(calendar.totalHolidays).toEqual(21); + expect(calendar.totalHolidays).toEqual(27.5); + expect(calendar.holidaysEnjoyed).toEqual(5); + + let firstType = absences[0].absenceType().name; + let sixthType = absences[5].absenceType().name; + + expect(firstType).toEqual('Leave of absence'); + expect(sixthType).toEqual('Holidays'); + }); + + it(`should fire the worker 106 on July and see he/she has 13.75`, async() => { + const firedWorker = await app.models.WorkerLabour.findById(106); + + const endedDate = new Date(); + endedDate.setHours(0, 0, 0, 0); + endedDate.setMonth(5); + endedDate.setDate(31); + + await firedWorker.updateAttributes({ended: endedDate}); + + let ctx = {req: {accessToken: {userId: 106}}}; + let workerFk = 106; + + const started = new Date(); + started.setHours(0, 0, 0, 0); + started.setMonth(0); + started.setDate(1); + + const monthIndex = 11; + const ended = new Date(); + ended.setHours(0, 0, 0, 0); + ended.setMonth(monthIndex + 1); + ended.setDate(0); + + let result = await app.models.WorkerCalendar.absences(ctx, workerFk, started, ended); + let calendar = result[0]; + let absences = result[1]; + + expect(calendar.totalHolidays).toEqual(13.5); + expect(calendar.holidaysEnjoyed).toEqual(5); + + let firstType = absences[0].absenceType().name; + let sixthType = absences[5].absenceType().name; + + expect(firstType).toEqual('Leave of absence'); + expect(sixthType).toEqual('Holidays'); + }); + + it(`should fire the worker 106 on March and see he/she has 6.5`, async() => { + const firedWorker = await app.models.WorkerLabour.findById(106); + + const endedDate = new Date(); + endedDate.setHours(0, 0, 0, 0); + endedDate.setMonth(2); + endedDate.setDate(31); + + await firedWorker.updateAttributes({ended: endedDate}); + + let ctx = {req: {accessToken: {userId: 106}}}; + let workerFk = 106; + + const started = new Date(); + started.setHours(0, 0, 0, 0); + started.setMonth(0); + started.setDate(1); + + const monthIndex = 11; + const ended = new Date(); + ended.setHours(0, 0, 0, 0); + ended.setMonth(monthIndex + 1); + ended.setDate(0); + + let result = await app.models.WorkerCalendar.absences(ctx, workerFk, started, ended); + let calendar = result[0]; + let absences = result[1]; + + expect(calendar.totalHolidays).toEqual(6.5); + expect(calendar.holidaysEnjoyed).toEqual(5); + + let firstType = absences[0].absenceType().name; + let sixthType = absences[5].absenceType().name; + + expect(firstType).toEqual('Leave of absence'); + expect(sixthType).toEqual('Holidays'); + }); + + it(`should fire the worker 106 on january and see he/she has x`, async() => { + const firedWorker = await app.models.WorkerLabour.findById(106); + + const endedDate = new Date(); + endedDate.setHours(0, 0, 0, 0); + endedDate.setMonth(0); + endedDate.setDate(28); + + await firedWorker.updateAttributes({ended: endedDate}); + + let ctx = {req: {accessToken: {userId: 106}}}; + let workerFk = 106; + + const started = new Date(); + started.setHours(0, 0, 0, 0); + started.setMonth(0); + started.setDate(1); + + const monthIndex = 11; + const ended = new Date(); + ended.setHours(0, 0, 0, 0); + ended.setMonth(monthIndex + 1); + ended.setDate(0); + + let result = await app.models.WorkerCalendar.absences(ctx, workerFk, started, ended); + let calendar = result[0]; + let absences = result[1]; + + expect(calendar.totalHolidays).toEqual(2); expect(calendar.holidaysEnjoyed).toEqual(5); let firstType = absences[0].absenceType().name; From 94480a81890b59440d3eeaf5f33241f62fec81f5 Mon Sep 17 00:00:00 2001 From: Bernat Date: Wed, 24 Apr 2019 07:43:11 +0200 Subject: [PATCH 24/59] #1329 fix test and fixtures, update ticket-service --- db/dump/fixtures.sql | 7 ++++--- .../05-ticket-module/13_create_ticket_services.spec.js | 2 +- loopback/locale/es.json | 2 +- modules/ticket/back/models/ticket-service.js | 7 ++++--- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index 1d075939f..09387acee 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -1217,9 +1217,10 @@ INSERT INTO `vn`.`ticketRequest`(`id`, `description`, `requesterFk`, `atenderFk` INSERT INTO `vn`.`ticketService`(`id`, `description`, `quantity`, `price`, `taxClassFk`, `ticketFk`) VALUES - (1, 'delivery charge', 1, 2.00, 1, 1), - (2, 'training course', 1, 10.00, 1, 2), - (3, 'delivery charge', 1, 5.50, 1, 11); + (1, 'Documentos', 1, 2.00, 1, 1), + (2, 'Porte Agencia', 1, 10.00, 1, 2), + (3, 'Documentos', 1, 5.50, 1, 11), + (4, 'Documentos', 1, 2.00, 1, 9); INSERT INTO `vn`.`zone` (`id`, `name`, `hour`, `warehouseFk`, `agencyModeFk`, `travelingDays`, `price`, `bonus`) diff --git a/e2e/paths/05-ticket-module/13_create_ticket_services.spec.js b/e2e/paths/05-ticket-module/13_create_ticket_services.spec.js index 5a35ba337..5b6bfff49 100644 --- a/e2e/paths/05-ticket-module/13_create_ticket_services.spec.js +++ b/e2e/paths/05-ticket-module/13_create_ticket_services.spec.js @@ -7,7 +7,7 @@ describe('Ticket services path', () => { beforeAll(() => { nightmare .loginAndModule('employee', 'ticket') - .accessToSearchResult('1') + .accessToSearchResult(9) .accessToSection('ticket.card.service'); }); diff --git a/loopback/locale/es.json b/loopback/locale/es.json index e275cbb93..e842c760c 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -82,5 +82,5 @@ "This ticket can't be invoiced": "Este ticket no puede ser facturado", "That item is not available on that day": "El item no esta disponible para esa fecha", "That item doesn't exists": "That item doesn't exists", - "You cannot add services to an invoiced ticket": "No puedes añadir servicios a un ticket facturado" + "You cannot add or modify services to an invoiced ticket": "No puedes añadir o modificar servicios a un ticket facturado" } \ No newline at end of file diff --git a/modules/ticket/back/models/ticket-service.js b/modules/ticket/back/models/ticket-service.js index 3f54a960e..751885116 100644 --- a/modules/ticket/back/models/ticket-service.js +++ b/modules/ticket/back/models/ticket-service.js @@ -2,11 +2,12 @@ const UserError = require('vn-loopback/util/user-error'); module.exports = Self => { Self.observe('before save', async ctx => { - if (ctx.isNewInstance) { - let ticketId = ctx.instance.ticketFk; + let changes = ctx.currentInstance || ctx.instance; + if (changes) { + let ticketId = changes.ticketFk; let ticket = await Self.app.models.Ticket.findById(ticketId); if (ticket.refFk) - throw new UserError('You cannot add services to an invoiced ticket'); + throw new UserError('You cannot add or modify services to an invoiced ticket'); } }); }; From b2f88872fa211a57ad81e32251d6ba7f4c80e1f8 Mon Sep 17 00:00:00 2001 From: Bernat Date: Wed, 24 Apr 2019 09:10:56 +0200 Subject: [PATCH 25/59] #1366 bug in claim-index --- modules/claim/back/methods/claim/filter.js | 2 +- modules/claim/front/index/index.html | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/claim/back/methods/claim/filter.js b/modules/claim/back/methods/claim/filter.js index 7a8f3c40c..38212d004 100644 --- a/modules/claim/back/methods/claim/filter.js +++ b/modules/claim/back/methods/claim/filter.js @@ -99,7 +99,7 @@ module.exports = Self => { let stmt; stmt = new ParameterizedSQL( - `SELECT cl.id, c.name, u.nickName, cs.description, cl.created + `SELECT cl.id, c.name, cl.clientFk, cl.workerFk, u.nickName, cs.description, cl.created FROM claim cl LEFT JOIN client c ON c.id = cl.clientFk LEFT JOIN worker w ON w.id = cl.workerFk diff --git a/modules/claim/front/index/index.html b/modules/claim/front/index/index.html index f6945e834..3d0006f2d 100644 --- a/modules/claim/front/index/index.html +++ b/modules/claim/front/index/index.html @@ -35,7 +35,7 @@ ui-sref="claim.card.summary({id: claim.id})"> {{::claim.id}} - + {{::claim.name}} @@ -43,7 +43,7 @@ + ng-click="$ctrl.showWorkerDescriptor($event, claim.workerFk)"> {{::claim.nickName}} From 00c11a95c6e8f89ad02dcf8a7c3b7b98b8a6e2c8 Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Wed, 24 Apr 2019 09:21:24 +0200 Subject: [PATCH 26/59] fixed catalog filter bugs #1352 --- modules/order/front/catalog/index.html | 6 ++++-- modules/order/front/catalog/index.js | 6 ++---- modules/order/front/filter/index.js | 8 ++++---- modules/order/front/filter/index.spec.js | 2 ++ 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/modules/order/front/catalog/index.html b/modules/order/front/catalog/index.html index 0e390d61c..7f6e13ee1 100644 --- a/modules/order/front/catalog/index.html +++ b/modules/order/front/catalog/index.html @@ -23,7 +23,8 @@ order="name" show-field="name" value-field="field" - label="Order by"> + label="Order by" + disabled="!model.data"> + label="Order" + disabled="!model.data"> diff --git a/modules/order/front/catalog/index.js b/modules/order/front/catalog/index.js index bc9bd20d5..a21d9dc18 100644 --- a/modules/order/front/catalog/index.js +++ b/modules/order/front/catalog/index.js @@ -74,8 +74,7 @@ class Controller { set way(value) { this._way = value; - if (value) - this.applyOrder(); + if (value) this.applyOrder(); } /** @@ -88,8 +87,7 @@ class Controller { set field(value) { this._field = value; - if (value) - this.applyOrder(); + if (value) this.applyOrder(); } /** diff --git a/modules/order/front/filter/index.js b/modules/order/front/filter/index.js index 26495b025..3a738ee5b 100644 --- a/modules/order/front/filter/index.js +++ b/modules/order/front/filter/index.js @@ -64,7 +64,7 @@ class Controller { if (this.tags.length > 0) this.applyFilters(); - if (value) + if (this._category) this.updateItemTypes(); } @@ -97,8 +97,8 @@ class Controller { } onSearchById(event) { - if (event.key !== 'Enter' || !this.itemFk) return; - this.applyFilters(); + if (event.key === 'Enter' && (this.tags.length > 0 || this.itemFk || this.type)) + this.applyFilters(); } onSearchByTag(event) { @@ -113,7 +113,7 @@ class Controller { remove(index) { this.tags.splice(index, 1); - if (this.tags.length == 0 && this.category && this.type) + if (this.tags.length >= 0 || this.itemFk || this.type) this.applyFilters(); } diff --git a/modules/order/front/filter/index.spec.js b/modules/order/front/filter/index.spec.js index 88075e820..6c9ecee34 100644 --- a/modules/order/front/filter/index.spec.js +++ b/modules/order/front/filter/index.spec.js @@ -137,11 +137,13 @@ describe('Order', () => { describe('remove()', () => { it(`should remove a tag from tags property`, () => { + spyOn(controller, 'applyFilters'); controller.tags = [{tagFk: 1, value: 'Blue'}, {tagFk: 2, value: '70'}]; controller.remove(0); expect(controller.tags.length).toEqual(1); expect(controller.tags[0].tagFk).toEqual(2); + expect(controller.applyFilters).toHaveBeenCalledWith(); }); it(`should remove a tag from tags property and call applyFilters() if there's no more tags`, () => { From 6747a809435725ba00d9456d27e473160ea59534 Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Wed, 24 Apr 2019 09:54:25 +0200 Subject: [PATCH 27/59] fixed available/visible icon on ticket sales #1363 --- modules/ticket/front/sale/index.html | 2 +- modules/ticket/front/summary/index.html | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/ticket/front/sale/index.html b/modules/ticket/front/sale/index.html index 12b381773..89848a99f 100644 --- a/modules/ticket/front/sale/index.html +++ b/modules/ticket/front/sale/index.html @@ -85,7 +85,7 @@ diff --git a/modules/ticket/front/summary/index.html b/modules/ticket/front/summary/index.html index 20a603802..866283a6a 100644 --- a/modules/ticket/front/summary/index.html +++ b/modules/ticket/front/summary/index.html @@ -63,8 +63,8 @@ - Item - Quantity + Item + Quantity Description Price Discount @@ -89,14 +89,14 @@ - + {{sale.itemFk | zeroFill:6}} - {{::sale.quantity}} + {{::sale.quantity}} Date: Wed, 24 Apr 2019 11:02:31 +0200 Subject: [PATCH 28/59] #1364 bug create ticket --- loopback/locale/es.json | 1 - modules/ticket/back/methods/ticket/new.js | 7 ------- 2 files changed, 8 deletions(-) diff --git a/loopback/locale/es.json b/loopback/locale/es.json index e842c760c..96d3ad070 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -67,7 +67,6 @@ "Tag value cannot be blank": "El valor del tag no puede quedar en blanco", "ORDER_EMPTY": "Cesta vacía", "You don't have enough privileges to do that": "No tienes permisos para cambiar esto", - "You can't create a ticket for a client that has a debt": "No puedes crear un ticket para un client con deuda", "NO SE PUEDE DESACTIVAR EL CONSIGNAT": "NO SE PUEDE DESACTIVAR EL CONSIGNAT", "Error. El NIF/CIF está repetido": "Error. El NIF/CIF está repetido", "Street cannot be empty": "Dirección no puede estar en blanco", diff --git a/modules/ticket/back/methods/ticket/new.js b/modules/ticket/back/methods/ticket/new.js index 3c3a4a8d4..bb0a11cb7 100644 --- a/modules/ticket/back/methods/ticket/new.js +++ b/modules/ticket/back/methods/ticket/new.js @@ -49,13 +49,6 @@ module.exports = Self => { if (!address.client().isActive) throw new UserError(`You can't create a ticket for a inactive client`); - - let clientFk = address.clientFk; - let query = `SELECT vn.clientGetDebt(?, CURDATE()) AS debt`; - let clientDebt = await Self.rawSql(query, [clientFk]); - - if (address.client().credit - clientDebt[0].debt <= 0) - throw new UserError(`You can't create a ticket for a client that has a debt`); } if (!transaction || !transaction.commit) From d88e2e81ca85bd6b3e8e9a5bdd2c13cd35d57403 Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Wed, 24 Apr 2019 11:23:24 +0200 Subject: [PATCH 29/59] update ticket line discount until invoiced #1365 --- modules/ticket/back/methods/sale/updateDiscount.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/modules/ticket/back/methods/sale/updateDiscount.js b/modules/ticket/back/methods/sale/updateDiscount.js index e1793241b..18ad5eb33 100644 --- a/modules/ticket/back/methods/sale/updateDiscount.js +++ b/modules/ticket/back/methods/sale/updateDiscount.js @@ -26,7 +26,6 @@ module.exports = Self => { throw new UserError(`The value should be a number`); let model = Self.app.models; - let thisTicketIsEditable = await model.Ticket.isEditable(params.editLines[0].ticketFk); let ticket = await model.Ticket.find({ where: { id: params.editLines[0].ticketFk @@ -40,13 +39,9 @@ module.exports = Self => { fields: ['id', 'clientFk', 'refFk'] }); - let userId = ctx.req.accessToken.userId; - let isSalesAssistant = await Self.app.models.Account.hasRole(userId, 'salesAssistant'); - - if ((!thisTicketIsEditable && !isSalesAssistant) || (ticket.refFk && isSalesAssistant)) + if (ticket.refFk) throw new UserError(`The sales of this ticket can't be modified`); - let componentToUse; let usesMana = await model.WorkerMana.findOne({where: {workerFk: ticket[0].client().salesPersonFk}, fields: 'amount'}); From 4ac36e6bf23a568c0ee420d16c6e9c16cc966d4d Mon Sep 17 00:00:00 2001 From: Bernat Date: Wed, 24 Apr 2019 11:36:13 +0200 Subject: [PATCH 30/59] #1362 ticket.packaging negative quantity --- .../04_create_ticket_packages.spec.js | 17 +++-------------- modules/ticket/front/package/index.html | 2 +- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/e2e/paths/05-ticket-module/04_create_ticket_packages.spec.js b/e2e/paths/05-ticket-module/04_create_ticket_packages.spec.js index ac6c4b4f6..3c2f0b123 100644 --- a/e2e/paths/05-ticket-module/04_create_ticket_packages.spec.js +++ b/e2e/paths/05-ticket-module/04_create_ticket_packages.spec.js @@ -41,21 +41,10 @@ describe('Ticket Create packages path', () => { expect(result).toBeTruthy(); }); - it(`should attempt create a new package but receive an error if the quantity is invalid`, async() => { - const result = await nightmare - .write(selectors.ticketPackages.firstQuantityInput, -99) - .waitToClick(selectors.ticketPackages.savePackagesButton) - .evaluate(selector => { - return document.querySelector(selector).checkValidity(); - }, selectors.ticketPackages.firstQuantityInput); - - expect(result).toBeFalsy(); - }); - it(`should create a new package with correct data`, async() => { const result = await nightmare .clearInput(selectors.ticketPackages.firstQuantityInput) - .write(selectors.ticketPackages.firstQuantityInput, 99) + .write(selectors.ticketPackages.firstQuantityInput, -99) .waitToClick(selectors.ticketPackages.savePackagesButton) .waitForLastSnackbar(); @@ -73,9 +62,9 @@ describe('Ticket Create packages path', () => { it(`should confirm the first quantity is just a number and the string part was ignored by the imput number`, async() => { const result = await nightmare - .waitForTextInInput(selectors.ticketPackages.firstQuantityInput, '99') + .waitForTextInInput(selectors.ticketPackages.firstQuantityInput, '-99') .waitToGetProperty(selectors.ticketPackages.firstQuantityInput, 'value'); - expect(result).toEqual('99'); + expect(result).toEqual('-99'); }); }); diff --git a/modules/ticket/front/package/index.html b/modules/ticket/front/package/index.html index 5fbfffcf5..7478bac5d 100644 --- a/modules/ticket/front/package/index.html +++ b/modules/ticket/front/package/index.html @@ -25,7 +25,7 @@ field="package.packagingFk"> {{itemFk}} : {{name}} - From 47e55580ad325e28a11d267766ca6f46be73d7a5 Mon Sep 17 00:00:00 2001 From: "LaptopVerdnatura\\Javi" Date: Thu, 25 Apr 2019 07:57:26 +0200 Subject: [PATCH 31/59] #1258 ticket.index sumatorio --- modules/client/back/models/receipt.json | 11 +- modules/client/front/balance/create/index.js | 26 +- modules/ticket/front/index/index.html | 19 +- modules/ticket/front/index/index.js | 27 +- modules/ticket/front/index/index.spec.js | 46 +++- modules/ticket/front/index/locale/es.yml | 3 +- package-lock.json | 260 +++++++++---------- 7 files changed, 232 insertions(+), 160 deletions(-) diff --git a/modules/client/back/models/receipt.json b/modules/client/back/models/receipt.json index 6ff863535..c953ae507 100644 --- a/modules/client/back/models/receipt.json +++ b/modules/client/back/models/receipt.json @@ -26,6 +26,12 @@ }, "isConciliate": { "type": "date" + }, + "description": { + "type": "string", + "mysql": { + "columnName": "invoiceFk" + } } }, "relations": { @@ -48,11 +54,6 @@ "type": "belongsTo", "model": "Bank", "foreignKey": "bankFk" - }, - "invoice": { - "type": "belongsTo", - "model": "InvoiceOut", - "foreignKey": "invoiceFk" } } } \ No newline at end of file diff --git a/modules/client/front/balance/create/index.js b/modules/client/front/balance/create/index.js index bdd62c4aa..2558488ce 100644 --- a/modules/client/front/balance/create/index.js +++ b/modules/client/front/balance/create/index.js @@ -29,11 +29,31 @@ class Controller { this.receipt.amountPaid = value; } + get amountPaid() { + return this.receipt.amountPaid; + } + + set clientFk(value) { + this.receipt.clientFk = value; + } + + get clientFk() { + return this.receipt.clientFk; + } + set companyFk(value) { this.receipt.companyFk = value; this.getAmountPaid(); } + set description(value) { + this.receipt.description = value; + } + + get description() { + return this.receipt.description; + } + getAmountPaid() { let filter = { where: { @@ -68,7 +88,7 @@ class Controller { } Controller.$inject = ['$scope', '$state', '$http', 'vnApp', '$translate']; -ngModule.component('vnClientBalanceCreate', { +ngModule.component('vnClientBalance', { template: require('./index.html'), controller: Controller, bindings: { @@ -76,6 +96,8 @@ ngModule.component('vnClientBalanceCreate', { bankFk: ' + + + + Id Salesperson @@ -53,6 +58,12 @@ + + + + - + - \ No newline at end of file + + + \ No newline at end of file diff --git a/modules/ticket/front/index/index.js b/modules/ticket/front/index/index.js index 01b95dcd1..6875bcb62 100644 --- a/modules/ticket/front/index/index.js +++ b/modules/ticket/front/index/index.js @@ -11,8 +11,12 @@ export default class Controller { this.selectedTicket = null; this.moreOptions = [ {callback: () => { - this.goToTurns('ticket.weekly'); + this.$state.go('ticket.weekly'); }, name: 'Turns', always: true}, + {callback: () => { + this.setBalanceCreateDialog(); + this.$.balanceCreateDialog.show(); + }, name: 'Payment on account...', always: true} ]; if (!$stateParams.q) @@ -29,6 +33,23 @@ export default class Controller { }); } + setBalanceCreateDialog() { + let data = this.$.tickets; + let description = []; + this.$.balanceCreateDialog.amountPaid = 0; + if (data) { + for (let i = 0; i < data.length; i++) { + if (data[i].checked) { + this.$.balanceCreateDialog.amountPaid += data[i].total; + this.$.balanceCreateDialog.clientFk = data[i].clientFk; + description.push(`${data[i].id}`); + } + } + } + this.$.balanceCreateDialog.description = 'Albaran: '; + this.$.balanceCreateDialog.description += description.join(','); + } + buildFilterDates() { let today = new Date(); this.today = today.setHours(0, 0, 0, 0); @@ -64,10 +85,6 @@ export default class Controller { window.open(url, '_blank'); } - goToTurns() { - this.$state.go('ticket.weekly'); - } - onMoreOpen() { let options = this.moreOptions.filter(o => o.always || this.isChecked); this.$.moreButton.data = options; diff --git a/modules/ticket/front/index/index.spec.js b/modules/ticket/front/index/index.spec.js index e529f552f..b3d3a0f02 100644 --- a/modules/ticket/front/index/index.spec.js +++ b/modules/ticket/front/index/index.spec.js @@ -1,6 +1,6 @@ import './index.js'; -describe('Component vnTicketIndex', () => { +xdescribe('Component vnTicketIndex', () => { let $element; let controller; let $window; @@ -10,19 +10,37 @@ describe('Component vnTicketIndex', () => { salesPersonFk: 9, shipped: new Date(), nickname: 'Test', - total: 10.5 + total: 10.5, + isChecked: false + }, { + id: 2, + clientFk: 1, + salesPersonFk: 9, + shipped: new Date(), + nickname: 'Test', + total: 20.5, + isChecked: true + }, { + id: 3, + clientFk: 1, + salesPersonFk: 9, + shipped: new Date(), + nickname: 'Test', + total: 30, + isChecked: true }]; beforeEach(() => { - ngModule('worker'); ngModule('client'); + ngModule('worker'); ngModule('item'); ngModule('ticket'); }); beforeEach(inject(($compile, $rootScope, _$window_) => { $window = _$window_; - $element = $compile('')($rootScope); + let $scope = $rootScope.$new(); + $element = $compile('')($scope); controller = $element.controller('vnTicketIndex'); })); @@ -84,4 +102,24 @@ describe('Component vnTicketIndex', () => { expect(controller.$.summary.show).toHaveBeenCalledWith(); }); }); + + describe('setBalanceCreateDialog()', () => { + it('should fill the object for the component balanceCreateDialog', () => { + console.log('2'); + console.log(controller); + controller.$.balanceCreateDialog = {}; + let result = controller.setBalanceCreateDialog(); + + expect(result).toEqual(50.5); + }); + + it('should', () => { + // spyOn(controller.$.balanceCreateDialog, 'show'); + // spyOn(controller.$, 'balanceCreateDialog'); + // controller.setBalanceCreateDialog(); + + // expect(controller.$.balanceCreateDialog.description).toEqual(''); + expect(true).toBeTruthy(); + }); + }); }); diff --git a/modules/ticket/front/index/locale/es.yml b/modules/ticket/front/index/locale/es.yml index 293ef9fdc..34fca7fb0 100644 --- a/modules/ticket/front/index/locale/es.yml +++ b/modules/ticket/front/index/locale/es.yml @@ -1,3 +1,4 @@ Turns: Turnos Go to lines: Ir a lineas -Not available: No disponible \ No newline at end of file +Not available: No disponible +Payment on account...: Pago a cuenta... \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 0c1499004..567453ea1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1505,7 +1505,7 @@ }, "util": { "version": "0.10.3", - "resolved": "http://registry.npmjs.org/util/-/util-0.10.3.tgz", + "resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz", "integrity": "sha1-evsa/lCAUkZInj23/g7TeTNqwPk=", "dev": true, "requires": { @@ -1733,7 +1733,7 @@ "base": { "version": "0.11.2", "resolved": "https://registry.npmjs.org/base/-/base-0.11.2.tgz", - "integrity": "sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg==", + "integrity": "sha1-e95c7RRbbVUakNuH+DxVi060io8=", "dev": true, "requires": { "cache-base": "^1.0.1", @@ -2097,7 +2097,7 @@ }, "browserify-rsa": { "version": "4.0.1", - "resolved": "http://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.0.1.tgz", + "resolved": "https://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.0.1.tgz", "integrity": "sha1-IeCr+vbyApzy+vsTNWenAdQTVSQ=", "dev": true, "requires": { @@ -2147,7 +2147,7 @@ }, "buffer": { "version": "4.9.1", - "resolved": "http://registry.npmjs.org/buffer/-/buffer-4.9.1.tgz", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-4.9.1.tgz", "integrity": "sha1-bRu2AbB6TvztlwlBMgkwJ8lbwpg=", "dev": true, "requires": { @@ -2321,7 +2321,7 @@ "cache-base": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz", - "integrity": "sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ==", + "integrity": "sha1-Cn9GQWgxyLZi7jb+TnxZ129marI=", "dev": true, "requires": { "collection-visit": "^1.0.0", @@ -2365,7 +2365,7 @@ }, "camelcase-keys": { "version": "2.1.0", - "resolved": "http://registry.npmjs.org/camelcase-keys/-/camelcase-keys-2.1.0.tgz", + "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-2.1.0.tgz", "integrity": "sha1-MIvur/3ygRkFHvodkyITyRuPkuc=", "dev": true, "requires": { @@ -2496,7 +2496,7 @@ "class-utils": { "version": "0.3.6", "resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.6.tgz", - "integrity": "sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg==", + "integrity": "sha1-+TNprouafOAv1B+q0MqDAzGQxGM=", "dev": true, "requires": { "arr-union": "^3.1.0", @@ -2656,7 +2656,7 @@ }, "string_decoder": { "version": "1.1.1", - "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { @@ -2730,7 +2730,7 @@ }, "colors": { "version": "1.1.2", - "resolved": "http://registry.npmjs.org/colors/-/colors-1.1.2.tgz", + "resolved": "https://registry.npmjs.org/colors/-/colors-1.1.2.tgz", "integrity": "sha1-FopHAXVran9RoSzgyXv6KMCE7WM=", "dev": true }, @@ -2925,7 +2925,7 @@ }, "content-disposition": { "version": "0.5.2", - "resolved": "http://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz", "integrity": "sha1-DPaLud318r55YcOoUXjLhdunjLQ=" }, "content-security-policy-builder": { @@ -3194,13 +3194,13 @@ "dependencies": { "jsesc": { "version": "0.5.0", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", + "resolved": "http://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", "integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=", "dev": true }, "regexpu-core": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-1.0.0.tgz", + "resolved": "http://registry.npmjs.org/regexpu-core/-/regexpu-core-1.0.0.tgz", "integrity": "sha1-hqdj9Y7k18L2sQLkdkBQ3n7ZDGs=", "dev": true, "requires": { @@ -3211,13 +3211,13 @@ }, "regjsgen": { "version": "0.2.0", - "resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.2.0.tgz", + "resolved": "http://registry.npmjs.org/regjsgen/-/regjsgen-0.2.0.tgz", "integrity": "sha1-bAFq3qxVT3WCP+N6wFuS1aTtsfc=", "dev": true }, "regjsparser": { "version": "0.1.5", - "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.1.5.tgz", + "resolved": "http://registry.npmjs.org/regjsparser/-/regjsparser-0.1.5.tgz", "integrity": "sha1-fuj4Tcb6eS0/0K4ijSS9lJ6tIFw=", "dev": true, "requires": { @@ -3687,7 +3687,7 @@ "dot-prop": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-4.2.0.tgz", - "integrity": "sha512-tUMXrxlExSW6U2EXiiKGSBVdYgtV8qlHL+C10TsW4PURY/ic+eaysnSkwB4kA/mBlCyy/IKDJ+Lc3wbWeaXtuQ==", + "integrity": "sha1-HxngwuGqDjJ5fEl5nyg3rGr2nFc=", "dev": true, "requires": { "is-obj": "^1.0.0" @@ -3720,7 +3720,7 @@ }, "readable-stream": { "version": "1.1.14", - "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", "dev": true, "requires": { @@ -3847,7 +3847,7 @@ "dependencies": { "fs-extra": { "version": "0.30.0", - "resolved": "http://registry.npmjs.org/fs-extra/-/fs-extra-0.30.0.tgz", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-0.30.0.tgz", "integrity": "sha1-8jP/zAjU2n1DLapEl3aYnbHfk/A=", "dev": true, "requires": { @@ -3860,7 +3860,7 @@ }, "jsonfile": { "version": "2.4.0", - "resolved": "http://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz", "integrity": "sha1-NzaitCi4e72gzIO1P6PWM6NcKug=", "dev": true, "requires": { @@ -4271,9 +4271,9 @@ } }, "js-yaml": { - "version": "3.12.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.12.1.tgz", - "integrity": "sha512-um46hB9wNOKlwkHgiuyEVAybXBjwFUV0Z/RaHJblRd9DXltue9FTYvzCr9ErQrK9Adz5MU4gHWVaNUfdmrC8qA==", + "version": "3.13.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", + "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", "dev": true, "requires": { "argparse": "^1.0.7", @@ -4844,7 +4844,7 @@ }, "file-loader": { "version": "1.1.11", - "resolved": "http://registry.npmjs.org/file-loader/-/file-loader-1.1.11.tgz", + "resolved": "https://registry.npmjs.org/file-loader/-/file-loader-1.1.11.tgz", "integrity": "sha512-TGR4HU7HUsGg6GCOPJnFk06RhWgEWFLAGWiT6rcD+GRC2keU3s9RGJ+b3Z6/U73jwwNb2gKLJ7YCrp+jvU4ALg==", "dev": true, "requires": { @@ -5108,7 +5108,7 @@ }, "fs-access": { "version": "1.0.1", - "resolved": "http://registry.npmjs.org/fs-access/-/fs-access-1.0.1.tgz", + "resolved": "https://registry.npmjs.org/fs-access/-/fs-access-1.0.1.tgz", "integrity": "sha1-1qh/JiJxzv6+wwxVNAf7mV2od3o=", "dev": true, "requires": { @@ -5162,14 +5162,14 @@ "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" }, "fsevents": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.4.tgz", - "integrity": "sha512-z8H8/diyk76B7q5wg+Ud0+CqzcAF3mBBI/bA5ne5zrRUUIvNkJY//D3BqyH571KuAC4Nr7Rw7CjWX4r0y9DvNg==", + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.8.tgz", + "integrity": "sha512-tPvHgPGB7m40CZ68xqFGkKuzN+RnpGmSV+hgeKxhRpbxdqKXUFJGC3yonBOLzQBcJyGpdZFDfCsdOC2KFsXzeA==", "dev": true, "optional": true, "requires": { - "nan": "^2.9.2", - "node-pre-gyp": "^0.10.0" + "nan": "^2.12.1", + "node-pre-gyp": "^0.12.0" }, "dependencies": { "abbrev": { @@ -5181,8 +5181,7 @@ "ansi-regex": { "version": "2.1.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "aproba": { "version": "1.2.0", @@ -5191,7 +5190,7 @@ "optional": true }, "are-we-there-yet": { - "version": "1.1.4", + "version": "1.1.5", "bundled": true, "dev": true, "optional": true, @@ -5217,7 +5216,7 @@ } }, "chownr": { - "version": "1.0.1", + "version": "1.1.1", "bundled": true, "dev": true, "optional": true @@ -5247,16 +5246,16 @@ "optional": true }, "debug": { - "version": "2.6.9", + "version": "4.1.1", "bundled": true, "dev": true, "optional": true, "requires": { - "ms": "2.0.0" + "ms": "^2.1.1" } }, "deep-extend": { - "version": "0.5.1", + "version": "0.6.0", "bundled": true, "dev": true, "optional": true @@ -5305,7 +5304,7 @@ } }, "glob": { - "version": "7.1.2", + "version": "7.1.3", "bundled": true, "dev": true, "optional": true, @@ -5325,12 +5324,12 @@ "optional": true }, "iconv-lite": { - "version": "0.4.21", + "version": "0.4.24", "bundled": true, "dev": true, "optional": true, "requires": { - "safer-buffer": "^2.1.0" + "safer-buffer": ">= 2.1.2 < 3" } }, "ignore-walk": { @@ -5395,17 +5394,17 @@ "optional": true }, "minipass": { - "version": "2.2.4", + "version": "2.3.5", "bundled": true, "dev": true, "optional": true, "requires": { - "safe-buffer": "^5.1.1", + "safe-buffer": "^5.1.2", "yallist": "^3.0.0" } }, "minizlib": { - "version": "1.1.0", + "version": "1.2.1", "bundled": true, "dev": true, "optional": true, @@ -5423,35 +5422,35 @@ } }, "ms": { - "version": "2.0.0", + "version": "2.1.1", "bundled": true, "dev": true, "optional": true }, "needle": { - "version": "2.2.0", + "version": "2.3.0", "bundled": true, "dev": true, "optional": true, "requires": { - "debug": "^2.1.2", + "debug": "^4.1.0", "iconv-lite": "^0.4.4", "sax": "^1.2.4" } }, "node-pre-gyp": { - "version": "0.10.0", + "version": "0.12.0", "bundled": true, "dev": true, "optional": true, "requires": { "detect-libc": "^1.0.2", "mkdirp": "^0.5.1", - "needle": "^2.2.0", + "needle": "^2.2.1", "nopt": "^4.0.1", "npm-packlist": "^1.1.6", "npmlog": "^4.0.2", - "rc": "^1.1.7", + "rc": "^1.2.7", "rimraf": "^2.6.1", "semver": "^5.3.0", "tar": "^4" @@ -5468,13 +5467,13 @@ } }, "npm-bundled": { - "version": "1.0.3", + "version": "1.0.6", "bundled": true, "dev": true, "optional": true }, "npm-packlist": { - "version": "1.1.10", + "version": "1.4.1", "bundled": true, "dev": true, "optional": true, @@ -5551,12 +5550,12 @@ "optional": true }, "rc": { - "version": "1.2.7", + "version": "1.2.8", "bundled": true, "dev": true, "optional": true, "requires": { - "deep-extend": "^0.5.1", + "deep-extend": "^0.6.0", "ini": "~1.3.0", "minimist": "^1.2.0", "strip-json-comments": "~2.0.1" @@ -5586,19 +5585,18 @@ } }, "rimraf": { - "version": "2.6.2", + "version": "2.6.3", "bundled": true, "dev": true, "optional": true, "requires": { - "glob": "^7.0.5" + "glob": "^7.1.3" } }, "safe-buffer": { - "version": "5.1.1", + "version": "5.1.2", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "safer-buffer": { "version": "2.1.2", @@ -5613,7 +5611,7 @@ "optional": true }, "semver": { - "version": "5.5.0", + "version": "5.7.0", "bundled": true, "dev": true, "optional": true @@ -5654,7 +5652,6 @@ "version": "3.0.1", "bundled": true, "dev": true, - "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -5666,17 +5663,17 @@ "optional": true }, "tar": { - "version": "4.4.1", + "version": "4.4.8", "bundled": true, "dev": true, "optional": true, "requires": { - "chownr": "^1.0.1", + "chownr": "^1.1.1", "fs-minipass": "^1.2.5", - "minipass": "^2.2.4", - "minizlib": "^1.1.0", + "minipass": "^2.3.4", + "minizlib": "^1.1.1", "mkdirp": "^0.5.0", - "safe-buffer": "^5.1.1", + "safe-buffer": "^5.1.2", "yallist": "^3.0.2" } }, @@ -5687,25 +5684,23 @@ "optional": true }, "wide-align": { - "version": "1.1.2", + "version": "1.1.3", "bundled": true, "dev": true, "optional": true, "requires": { - "string-width": "^1.0.2" + "string-width": "^1.0.2 || 2" } }, "wrappy": { "version": "1.0.2", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "yallist": { - "version": "3.0.2", + "version": "3.0.3", "bundled": true, - "dev": true, - "optional": true + "dev": true } } }, @@ -5907,7 +5902,7 @@ "global-modules": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/global-modules/-/global-modules-1.0.0.tgz", - "integrity": "sha512-sKzpEkf11GpOFuw0Zzjzmt4B4UZwjOcG757PPvrfhxcLFbq0wpsgpOqxpxtxFiCG4DtG93M6XRVbF2oGdev7bg==", + "integrity": "sha1-bXcPDrUjrHgWTXK15xqIdyZcw+o=", "dev": true, "requires": { "global-prefix": "^1.0.1", @@ -5944,7 +5939,7 @@ }, "globby": { "version": "5.0.0", - "resolved": "http://registry.npmjs.org/globby/-/globby-5.0.0.tgz", + "resolved": "https://registry.npmjs.org/globby/-/globby-5.0.0.tgz", "integrity": "sha1-69hGZ8oNuzMLmbz8aOrCvFQ3Dg0=", "dev": true, "requires": { @@ -5989,7 +5984,7 @@ }, "got": { "version": "6.7.1", - "resolved": "http://registry.npmjs.org/got/-/got-6.7.1.tgz", + "resolved": "https://registry.npmjs.org/got/-/got-6.7.1.tgz", "integrity": "sha1-JAzQV4WpoY5WHcG0S0HHY+8ejbA=", "dev": true, "requires": { @@ -6259,7 +6254,7 @@ }, "kind-of": { "version": "1.1.0", - "resolved": "http://registry.npmjs.org/kind-of/-/kind-of-1.1.0.tgz", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-1.1.0.tgz", "integrity": "sha1-FAo9LUGjbS78+pN3tiwk+ElaXEQ=", "dev": true }, @@ -6443,7 +6438,7 @@ "dependencies": { "es6-promise": { "version": "3.3.1", - "resolved": "http://registry.npmjs.org/es6-promise/-/es6-promise-3.3.1.tgz", + "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-3.3.1.tgz", "integrity": "sha1-oIzd6EzNvzTQJ6FFG8kdS80ophM=", "dev": true }, @@ -7280,7 +7275,7 @@ }, "is-builtin-module": { "version": "1.0.0", - "resolved": "http://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz", + "resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz", "integrity": "sha1-VAVy0096wxGfj3bDDLwbHgN6/74=", "dev": true, "requires": { @@ -7427,7 +7422,7 @@ }, "is-obj": { "version": "1.0.1", - "resolved": "http://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz", + "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz", "integrity": "sha1-PkcprB9f3gJc19g6iW2rn09n2w8=", "dev": true }, @@ -7458,7 +7453,7 @@ "is-plain-object": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", - "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", + "integrity": "sha1-LBY7P6+xtgbZ0Xko8FwqHDjgdnc=", "dev": true, "requires": { "isobject": "^3.0.1" @@ -7628,7 +7623,7 @@ }, "jasmine-core": { "version": "2.99.1", - "resolved": "http://registry.npmjs.org/jasmine-core/-/jasmine-core-2.99.1.tgz", + "resolved": "https://registry.npmjs.org/jasmine-core/-/jasmine-core-2.99.1.tgz", "integrity": "sha1-5kAN8ea1bhMLYcS80JPap/boyhU=", "dev": true }, @@ -7703,9 +7698,9 @@ "dev": true }, "js-yaml": { - "version": "3.10.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.10.0.tgz", - "integrity": "sha1-LnhEFka9RoLpY/IrbpKCPDCcYtw=", + "version": "3.13.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", + "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", "dev": true, "requires": { "argparse": "^1.0.7", @@ -8070,7 +8065,7 @@ }, "load-json-file": { "version": "1.1.0", - "resolved": "http://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", "dev": true, "requires": { @@ -9544,7 +9539,7 @@ }, "media-typer": { "version": "0.3.0", - "resolved": "http://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=" }, "mem": { @@ -9567,7 +9562,7 @@ }, "meow": { "version": "3.7.0", - "resolved": "http://registry.npmjs.org/meow/-/meow-3.7.0.tgz", + "resolved": "https://registry.npmjs.org/meow/-/meow-3.7.0.tgz", "integrity": "sha1-cstmi0JSKCkKu/qFaJJYcwioAfs=", "dev": true, "requires": { @@ -9690,7 +9685,7 @@ }, "minimist": { "version": "1.2.0", - "resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=" }, "minstache": { @@ -9772,7 +9767,7 @@ }, "mkdirp": { "version": "0.5.1", - "resolved": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "requires": { "minimist": "0.0.8" @@ -9780,7 +9775,7 @@ "dependencies": { "minimist": { "version": "0.0.8", - "resolved": "http://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=" } } @@ -9932,7 +9927,7 @@ }, "multipipe": { "version": "0.1.2", - "resolved": "http://registry.npmjs.org/multipipe/-/multipipe-0.1.2.tgz", + "resolved": "https://registry.npmjs.org/multipipe/-/multipipe-0.1.2.tgz", "integrity": "sha1-Ko8t33Du1WTf8tV/HhoTfZ8FB4s=", "dev": true, "requires": { @@ -10162,7 +10157,7 @@ "dependencies": { "jsesc": { "version": "0.5.0", - "resolved": "http://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", "integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=", "dev": true } @@ -10792,8 +10787,7 @@ "ansi-regex": { "version": "2.1.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "aproba": { "version": "1.2.0", @@ -10821,7 +10815,6 @@ "version": "1.1.11", "bundled": true, "dev": true, - "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -10836,8 +10829,7 @@ "code-point-at": { "version": "1.1.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "concat-map": { "version": "0.0.1", @@ -10848,8 +10840,7 @@ "console-control-strings": { "version": "1.1.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "core-util-is": { "version": "1.0.2", @@ -10966,8 +10957,7 @@ "inherits": { "version": "2.0.3", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "ini": { "version": "1.3.5", @@ -10979,7 +10969,6 @@ "version": "1.0.0", "bundled": true, "dev": true, - "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -10994,7 +10983,6 @@ "version": "3.0.4", "bundled": true, "dev": true, - "optional": true, "requires": { "brace-expansion": "^1.1.7" } @@ -11002,14 +10990,12 @@ "minimist": { "version": "0.0.8", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "minipass": { "version": "2.3.5", "bundled": true, "dev": true, - "optional": true, "requires": { "safe-buffer": "^5.1.2", "yallist": "^3.0.0" @@ -11028,7 +11014,6 @@ "version": "0.5.1", "bundled": true, "dev": true, - "optional": true, "requires": { "minimist": "0.0.8" } @@ -11109,8 +11094,7 @@ "number-is-nan": { "version": "1.0.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "object-assign": { "version": "4.1.1", @@ -11122,7 +11106,6 @@ "version": "1.4.0", "bundled": true, "dev": true, - "optional": true, "requires": { "wrappy": "1" } @@ -11208,8 +11191,7 @@ "safe-buffer": { "version": "5.1.2", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "safer-buffer": { "version": "2.1.2", @@ -11245,7 +11227,6 @@ "version": "1.0.2", "bundled": true, "dev": true, - "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -11265,7 +11246,6 @@ "version": "3.0.1", "bundled": true, "dev": true, - "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -11309,14 +11289,12 @@ "wrappy": { "version": "1.0.2", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "yallist": { "version": "3.0.3", "bundled": true, - "dev": true, - "optional": true + "dev": true } } }, @@ -11615,7 +11593,7 @@ "dependencies": { "minimist": { "version": "0.0.10", - "resolved": "http://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz", "integrity": "sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8=", "dev": true }, @@ -11677,7 +11655,7 @@ }, "os-homedir": { "version": "1.0.2", - "resolved": "http://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", "dev": true }, @@ -11693,7 +11671,7 @@ }, "os-tmpdir": { "version": "1.0.2", - "resolved": "http://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", "dev": true }, @@ -11882,7 +11860,7 @@ }, "path-browserify": { "version": "0.0.0", - "resolved": "http://registry.npmjs.org/path-browserify/-/path-browserify-0.0.0.tgz", + "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-0.0.0.tgz", "integrity": "sha1-oLhwcpquIUAFt9UDLsLLuw+0RRo=", "dev": true }, @@ -12171,7 +12149,7 @@ }, "pretty-bytes": { "version": "1.0.4", - "resolved": "http://registry.npmjs.org/pretty-bytes/-/pretty-bytes-1.0.4.tgz", + "resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-1.0.4.tgz", "integrity": "sha1-CiLoIQYJrTVUL4yNXSFZr/B1HIQ=", "dev": true, "requires": { @@ -12242,7 +12220,7 @@ }, "readable-stream": { "version": "1.1.14", - "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", "dev": true, "requires": { @@ -12260,7 +12238,7 @@ }, "through2": { "version": "0.2.3", - "resolved": "http://registry.npmjs.org/through2/-/through2-0.2.3.tgz", + "resolved": "https://registry.npmjs.org/through2/-/through2-0.2.3.tgz", "integrity": "sha1-6zKE2k6jEbbMis42U3SKUqvyWj8=", "dev": true, "requires": { @@ -12983,13 +12961,13 @@ "resolved": "https://registry.npmjs.org/require-yaml/-/require-yaml-0.0.1.tgz", "integrity": "sha1-LhsY2RPDuqcqWk03O28Tjd0sMr0=", "requires": { - "js-yaml": "^3.10.0" + "js-yaml": "^3.13.1" }, "dependencies": { "js-yaml": { - "version": "3.10.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.10.0.tgz", - "integrity": "sha512-O2v52ffjLa9VeM43J4XocZE//WT9N0IiwDa3KSHH7Tu8CtH+1qM8SIZvnsTh6v+4yFy5KUY3BHUVwjpfAWsjIA==", + "version": "3.13.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", + "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", "requires": { "argparse": "^1.0.7", "esprima": "^4.0.0" @@ -13151,7 +13129,7 @@ }, "safe-regex": { "version": "1.1.0", - "resolved": "http://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", + "resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", "integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=", "dev": true, "requires": { @@ -13276,7 +13254,7 @@ "dependencies": { "source-map": { "version": "0.4.4", - "resolved": "http://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz", "integrity": "sha1-66T12pwNyZneaAMti092FzZSA2s=", "dev": true, "requires": { @@ -13416,7 +13394,7 @@ "set-value": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.0.tgz", - "integrity": "sha512-hw0yxk9GT/Hr5yJEYnHNKYXkIA8mVJgd9ditYZCe16ZczcaELYYcfvaXesNACk2O8O0nTiPQcQhGUQj8JLzeeg==", + "integrity": "sha1-ca5KiPD+77v1LR6mBPP7MV67YnQ=", "dev": true, "requires": { "extend-shallow": "^2.0.1", @@ -13603,7 +13581,7 @@ "snapdragon-node": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/snapdragon-node/-/snapdragon-node-2.1.1.tgz", - "integrity": "sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw==", + "integrity": "sha1-bBdfhv8UvbByRWPo88GwIaKGhTs=", "dev": true, "requires": { "define-property": "^1.0.0", @@ -13654,7 +13632,7 @@ "snapdragon-util": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/snapdragon-util/-/snapdragon-util-3.0.1.tgz", - "integrity": "sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ==", + "integrity": "sha1-+VZHlIbyrNeXAGk/b3uAXkWrVuI=", "dev": true, "requires": { "kind-of": "^3.2.0" @@ -14010,7 +13988,7 @@ "split-string": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz", - "integrity": "sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw==", + "integrity": "sha1-fLCd2jqGWFcFxks5pkZgOGguj+I=", "dev": true, "requires": { "extend-shallow": "^3.0.0" @@ -14019,7 +13997,7 @@ "split2": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/split2/-/split2-2.2.0.tgz", - "integrity": "sha512-RAb22TG39LhI31MbreBgIuKiIKhVsawfTgEGqKHTK87aG+ul/PB8Sqoi3I7kVdRWiCfrKxK3uo4/YUkpNvhPbw==", + "integrity": "sha1-GGsldbz4PoW30YRldWI47k7kJJM=", "dev": true, "requires": { "through2": "^2.0.2" @@ -14194,7 +14172,7 @@ }, "string_decoder": { "version": "1.1.1", - "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { @@ -14301,7 +14279,7 @@ }, "strip-ansi": { "version": "3.0.1", - "resolved": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "dev": true, "requires": { @@ -14726,7 +14704,7 @@ }, "tar": { "version": "2.2.1", - "resolved": "http://registry.npmjs.org/tar/-/tar-2.2.1.tgz", + "resolved": "https://registry.npmjs.org/tar/-/tar-2.2.1.tgz", "integrity": "sha1-jk0qJWwOIYXGsYrWlK7JaLg8sdE=", "dev": true, "requires": { @@ -14896,7 +14874,7 @@ }, "through": { "version": "2.3.8", - "resolved": "http://registry.npmjs.org/through/-/through-2.3.8.tgz", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=" }, "through2": { @@ -15079,7 +15057,7 @@ "touch": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.0.tgz", - "integrity": "sha512-WBx8Uy5TLtOSRtIq+M03/sKDrXCLHxwDcquSP2c43Le03/9serjQBIztjRz6FkJez9D/hleyAXTBGLwwZUw9lA==", + "integrity": "sha1-/jZfX3XsntTlaCXgu3bSSrdK+Ds=", "dev": true, "requires": { "nopt": "~1.0.10" @@ -15168,7 +15146,7 @@ }, "tty-browserify": { "version": "0.0.0", - "resolved": "http://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.0.tgz", + "resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.0.tgz", "integrity": "sha1-oVe6QC2iTpv5V/mqadUk7tQpAaY=", "dev": true }, @@ -15799,7 +15777,7 @@ }, "vm-browserify": { "version": "0.0.4", - "resolved": "http://registry.npmjs.org/vm-browserify/-/vm-browserify-0.0.4.tgz", + "resolved": "https://registry.npmjs.org/vm-browserify/-/vm-browserify-0.0.4.tgz", "integrity": "sha1-XX6kW7755Kb/ZflUOOCofDV9WnM=", "dev": true, "requires": { From 4e5c6ff882061ed3b09fe9724223eb3868965a2e Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Thu, 25 Apr 2019 08:28:08 +0200 Subject: [PATCH 32/59] #1356 advanced search refactor --- .../back/methods/invoiceOut/filter.js | 128 +++++++++++++++++ modules/invoiceOut/back/models/invoiceOut.js | 1 + modules/invoiceOut/front/index/index.html | 18 +-- modules/invoiceOut/front/index/index.js | 43 +----- modules/invoiceOut/front/summary/index.html | 2 +- .../invoiceOut/front/summary/locale/es.yml | 8 -- modules/invoiceOut/front/summary/style.scss | 2 +- modules/item/back/methods/item/filter.js | 2 +- modules/route/back/methods/route/filter.js | 131 ++++++++++++++++++ modules/route/back/models/route.js | 1 + modules/route/front/index/index.html | 17 +-- modules/route/front/index/index.js | 59 ++------ 12 files changed, 295 insertions(+), 117 deletions(-) create mode 100644 modules/invoiceOut/back/methods/invoiceOut/filter.js create mode 100644 modules/route/back/methods/route/filter.js diff --git a/modules/invoiceOut/back/methods/invoiceOut/filter.js b/modules/invoiceOut/back/methods/invoiceOut/filter.js new file mode 100644 index 000000000..e9f60473a --- /dev/null +++ b/modules/invoiceOut/back/methods/invoiceOut/filter.js @@ -0,0 +1,128 @@ + +const ParameterizedSQL = require('loopback-connector').ParameterizedSQL; +const buildFilter = require('vn-loopback/util/filter').buildFilter; +const mergeFilters = require('vn-loopback/util/filter').mergeFilters; + +module.exports = Self => { + Self.remoteMethodCtx('filter', { + description: 'Find all instances of the model matched by filter from the data source.', + accessType: 'READ', + accepts: [ + { + arg: 'filter', + type: 'Object', + description: 'Filter defining where, order, offset, and limit - must be a JSON-encoded string', + http: {source: 'query'} + }, + { + arg: 'search', + type: 'String', + description: 'Searchs the invoiceOut by id', + http: {source: 'query'} + }, { + arg: 'clientFk', + type: 'Integer', + description: 'The client id', + http: {source: 'query'} + }, { + arg: 'hasPdf', + type: 'Boolean', + description: 'Whether the the invoiceOut has PDF or not', + http: {source: 'query'} + }, { + arg: 'amount', + type: 'Number', + description: 'The amount filter', + http: {source: 'query'} + }, { + arg: 'min', + type: 'Number', + description: 'The minimun amount flter', + http: {source: 'query'} + }, { + arg: 'max', + type: 'Number', + description: 'The maximun amount flter', + http: {source: 'query'} + }, { + arg: 'issued', + type: 'Date', + description: 'The issued date filter', + http: {source: 'query'} + }, { + arg: 'created', + type: 'Date', + description: 'The created date filter', + http: {source: 'query'} + }, { + arg: 'dued', + type: 'Date', + description: 'The due date filter', + http: {source: 'query'} + } + ], + returns: { + type: ['Object'], + root: true + }, + http: { + path: `/filter`, + verb: 'GET' + } + }); + + Self.filter = async(ctx, filter) => { + let conn = Self.dataSource.connector; + + let where = buildFilter(ctx.args, (param, value) => { + switch (param) { + case 'search': + return {ref: {like: `%${value}%`}}; + case 'min': + return {amount: {gte: value}}; + case 'max': + return {amount: {lte: value}}; + case 'hasPdf': + return {'i.pdf': value}; + case 'created': + return {'i.created': value}; + case 'amount': + case 'clientFk': + case 'companyFk': + case 'issued': + case 'dued': + return {[param]: value}; + } + }); + + filter = mergeFilters(ctx.args.filter, {where}); + + let stmts = []; + let stmt; + + stmt = new ParameterizedSQL( + `SELECT + i.id, + i.ref, + i.issued, + i.amount, + i.created, + i.dued, + i.clientFk, + i.pdf AS hasPdf, + c.socialName AS clientSocialName, + co.code AS companyCode + FROM invoiceOut i + LEFT JOIN client c ON c.id = i.clientFk + LEFT JOIN company co ON co.id = i.companyFk` + ); + + stmt.merge(conn.makeSuffix(filter)); + let itemsIndex = stmts.push(stmt) - 1; + + let sql = ParameterizedSQL.join(stmts, ';'); + let result = await conn.executeStmt(sql); + return itemsIndex === 0 ? result : result[itemsIndex]; + }; +}; + diff --git a/modules/invoiceOut/back/models/invoiceOut.js b/modules/invoiceOut/back/models/invoiceOut.js index a3edaa28f..2d7c691fc 100644 --- a/modules/invoiceOut/back/models/invoiceOut.js +++ b/modules/invoiceOut/back/models/invoiceOut.js @@ -1,4 +1,5 @@ module.exports = Self => { + require('../methods/invoiceOut/filter')(Self); require('../methods/invoiceOut/summary')(Self); require('../methods/invoiceOut/download')(Self); }; diff --git a/modules/invoiceOut/front/index/index.html b/modules/invoiceOut/front/index/index.html index 98c286dbc..8a7db4f25 100644 --- a/modules/invoiceOut/front/index/index.html +++ b/modules/invoiceOut/front/index/index.html @@ -1,20 +1,16 @@ + data="invoiceOuts" + order="issued DESC">
@@ -36,7 +32,7 @@ - {{::invoiceOut.ref | dashIfEmpty}} @@ -46,11 +42,11 @@ - {{::invoiceOut.client.name | dashIfEmpty}} + {{::invoiceOut.clientSocialName | dashIfEmpty}} {{::invoiceOut.created | dateTime:'dd/MM/yyyy' | dashIfEmpty}} - {{::invoiceOut.company.code | dashIfEmpty}} + {{::invoiceOut.companyCode | dashIfEmpty}} {{::invoiceOut.dued | dateTime:'dd/MM/yyyy' | dashIfEmpty}} +

Desglose impositivo

-

Desglose impositivo

Type Taxable base diff --git a/modules/invoiceOut/front/summary/locale/es.yml b/modules/invoiceOut/front/summary/locale/es.yml index 4444939c7..d1b4a2406 100644 --- a/modules/invoiceOut/front/summary/locale/es.yml +++ b/modules/invoiceOut/front/summary/locale/es.yml @@ -1,11 +1,3 @@ -Driver: Conductor -Vehicle: Vehículo -Packages: Bultos -Starting time: H. Inicio -Finishing time: H. Fin -Km Start: Km de inicio -Km End: Km de fin -PC: CP Date: Fecha Created: Creada Due: Vencimiento diff --git a/modules/invoiceOut/front/summary/style.scss b/modules/invoiceOut/front/summary/style.scss index aef44fbf9..f2cf53381 100644 --- a/modules/invoiceOut/front/summary/style.scss +++ b/modules/invoiceOut/front/summary/style.scss @@ -1,7 +1,7 @@ @import "variables"; -vn-route-summary .summary { +vn-invoice-out-summary .summary { max-width: $width-large; vn-icon[icon=insert_drive_file]{ diff --git a/modules/item/back/methods/item/filter.js b/modules/item/back/methods/item/filter.js index 0da463ad4..d1ad0aab7 100644 --- a/modules/item/back/methods/item/filter.js +++ b/modules/item/back/methods/item/filter.js @@ -41,7 +41,7 @@ module.exports = Self => { }, { arg: 'hasVisible', type: 'Boolean', - description: 'Whether the the item has o not visible', + description: 'Whether the the item has visible or not', http: {source: 'query'} }, { arg: 'isActive', diff --git a/modules/route/back/methods/route/filter.js b/modules/route/back/methods/route/filter.js new file mode 100644 index 000000000..b45680642 --- /dev/null +++ b/modules/route/back/methods/route/filter.js @@ -0,0 +1,131 @@ + +const ParameterizedSQL = require('loopback-connector').ParameterizedSQL; +const buildFilter = require('vn-loopback/util/filter').buildFilter; +const mergeFilters = require('vn-loopback/util/filter').mergeFilters; + +module.exports = Self => { + Self.remoteMethodCtx('filter', { + description: 'Find all instances of the model matched by filter from the data source.', + accessType: 'READ', + accepts: [ + { + arg: 'filter', + type: 'Object', + description: 'Filter defining where, order, offset, and limit - must be a JSON-encoded string', + http: {source: 'query'} + }, { + arg: 'search', + type: 'String', + description: 'Searchs the route by id', + http: {source: 'query'} + }, { + arg: 'workerFk', + type: 'Integer', + description: 'The worker id', + http: {source: 'query'} + }, { + arg: 'agencyModeFk', + type: 'Integer', + description: 'The agencyMode id', + http: {source: 'query'} + }, { + arg: 'to', + type: 'Date', + description: 'The to date filter', + http: {source: 'query'} + }, { + arg: 'from', + type: 'Date', + description: 'The to date filter', + http: {source: 'query'} + }, { + arg: 'vehicleFk', + type: 'Integer', + description: 'The vehicle id', + http: {source: 'query'} + }, { + arg: 'm3', + type: 'Number', + description: 'The m3 filter', + http: {source: 'query'} + }, { + arg: 'description', + type: 'String', + description: 'The description filter', + http: {source: 'query'} + } + ], + returns: { + type: ['Object'], + root: true + }, + http: { + path: `/filter`, + verb: 'GET' + } + }); + + Self.filter = async(ctx, filter) => { + let conn = Self.dataSource.connector; + + let where = buildFilter(ctx.args, (param, value) => { + switch (param) { + case 'search': + return {'r.id': value}; + case 'from': + return {'r.created': {gte: value}}; + case 'to': + return {'r.created': {lte: value}}; + case 'm3': + return {'r.m3': value}; + case 'description': + return {'r.description': {like: `%${value}%`}}; + case 'workerFk': + case 'vehicleFk': + case 'agencyModeFk': + return {[param]: value}; + } + }); + + filter = mergeFilters(ctx.args.filter, {where}); + + let stmts = []; + let stmt; + + stmt = new ParameterizedSQL( + `SELECT + r.id, + r.workerFk, + r.created, + r.vehicleFk, + r.agencyModeFk, + r.time, + r.isOk, + r.kmStart, + r.kmEnd, + r.started, + r.finished, + r.gestdocFk, + r.cost, + r.m3, + r.description, + am.name agencyName, + u.nickname AS workerNickname, + v.numberPlate AS vehiclePlateNumber + FROM route r + LEFT JOIN agencyMode am ON am.id = r.agencyModeFk + LEFT JOIN vehicle v ON v.id = r.vehicleFk + LEFT JOIN worker w ON w.id = r.workerFk + LEFT JOIN account.user u ON u.id = w.userFk` + ); + + + stmt.merge(conn.makeSuffix(filter)); + let itemsIndex = stmts.push(stmt) - 1; + + let sql = ParameterizedSQL.join(stmts, ';'); + let result = await conn.executeStmt(sql); + return itemsIndex === 0 ? result : result[itemsIndex]; + }; +}; + diff --git a/modules/route/back/models/route.js b/modules/route/back/models/route.js index e3ebabb68..bd637822f 100644 --- a/modules/route/back/models/route.js +++ b/modules/route/back/models/route.js @@ -1,4 +1,5 @@ module.exports = Self => { + require('../methods/route/filter')(Self); require('../methods/route/summary')(Self); require('../methods/route/getTickets')(Self); require('../methods/route/guessPriority')(Self); diff --git a/modules/route/front/index/index.html b/modules/route/front/index/index.html index 43238fd4d..b9935ba45 100644 --- a/modules/route/front/index/index.html +++ b/modules/route/front/index/index.html @@ -1,7 +1,6 @@ @@ -11,9 +10,7 @@ @@ -41,12 +38,12 @@ - {{::route.worker.user.nickname}} + ng-click="$ctrl.showWorkerDescriptor($event, route.workerFk)"> + {{::route.workerNickname}} - {{::route.agencyMode.name | dashIfEmpty}} - {{::route.vehicle.numberPlate | dashIfEmpty}} + {{::route.agencyName | dashIfEmpty}} + {{::route.vehiclePlateNumber | dashIfEmpty}} {{::route.created | dateTime:'dd/MM/yyyy' | dashIfEmpty}} {{::route.m3 | dashIfEmpty}} {{::route.description | dashIfEmpty}} @@ -72,7 +69,7 @@ + worker-fk="$ctrl.selectedWorker">
diff --git a/modules/route/front/index/index.js b/modules/route/front/index/index.js index 0fa102c4d..4b0536fd0 100644 --- a/modules/route/front/index/index.js +++ b/modules/route/front/index/index.js @@ -4,61 +4,15 @@ export default class Controller { constructor($scope, vnToken) { this.accessToken = vnToken.token; this.$ = $scope; - - this.filter = { - include: [ - { - relation: 'agencyMode', - scope: { - fields: ['name'] - } - }, - { - relation: 'vehicle', - scope: { - fields: ['numberPlate'] - } - }, - { - relation: 'worker', - scope: { - fields: ['userFk'], - include: { - relation: 'user', - scope: { - fields: ['nickname'] - } - } - } - }, - ] - }; } - exprBuilder(param, value) { - switch (param) { - case 'search': - return {id: value}; - case 'from': - return {created: {gte: value}}; - case 'to': - return {created: {lte: value}}; - case 'workerFk': - case 'vehicleFk': - case 'agencyModeFk': - case 'm3': - case 'description': - return {[param]: value}; - } - } - - showWorkerDescriptor(event, userId) { + showWorkerDescriptor(event, workerFk) { if (event.defaultPrevented) return; event.preventDefault(); - event.stopPropagation(); + event.stopImmediatePropagation(); - this.selectedWorker = userId; + this.selectedWorker = workerFk; this.$.workerDescriptor.parent = event.target; this.$.workerDescriptor.show(); } @@ -69,6 +23,13 @@ export default class Controller { event.preventDefault(); event.stopImmediatePropagation(); } + + onSearch(params) { + if (params) + this.$.model.applyFilter(null, params); + else + this.$.model.clear(); + } } Controller.$inject = ['$scope', 'vnToken']; From e11d33eb27db0bd80107cc476f6043b93d4202e8 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Thu, 25 Apr 2019 08:28:23 +0200 Subject: [PATCH 33/59] worker descriptor refactor --- modules/worker/front/descriptor-popover/index.js | 14 +++++++------- .../front/descriptor-popover/index.spec.js | 16 ++++++++-------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/modules/worker/front/descriptor-popover/index.js b/modules/worker/front/descriptor-popover/index.js index cd8916ec5..168b2f423 100644 --- a/modules/worker/front/descriptor-popover/index.js +++ b/modules/worker/front/descriptor-popover/index.js @@ -11,16 +11,16 @@ class Controller extends Component { this.worker = null; } - set userId(id) { - if (id == this._userId) return; + set workerFk(workerFk) { + if (workerFk == this._workerFk) return; - this._userId = id; + this._workerFk = workerFk; this.worker = null; this.loadData(); } - get userId() { - return this._userId; + get workerFk() { + return this._workerFk; } set quicklinks(value = {}) { @@ -40,7 +40,7 @@ class Controller extends Component { let query = `api/Workers/findOne`; let filter = { where: { - userFk: this._userId + id: this._workerFk }, include: [ { @@ -88,7 +88,7 @@ ngModule.component('vnWorkerDescriptorPopover', { template: require('./index.html'), controller: Controller, bindings: { - userId: '<', + workerFk: '<', quicklinks: '<' } }); diff --git a/modules/worker/front/descriptor-popover/index.spec.js b/modules/worker/front/descriptor-popover/index.spec.js index d6c04e9e7..74dc3164b 100644 --- a/modules/worker/front/descriptor-popover/index.spec.js +++ b/modules/worker/front/descriptor-popover/index.spec.js @@ -21,23 +21,23 @@ describe('worker Component vnWorkerDescriptorPopover', () => { describe('workerFk()', () => { it(`should not apply any changes if the received id is the same stored in _workerFk`, () => { controller.worker = 'I exist!'; - controller._userId = 1; + controller._workerFk = 1; spyOn(controller, 'loadData'); - controller.userId = 1; + controller.workerFk = 1; expect(controller.worker).toEqual('I exist!'); - expect(controller._userId).toEqual(1); + expect(controller._workerFk).toEqual(1); expect(controller.loadData).not.toHaveBeenCalled(); }); it(`should set the received id into _workerFk, set the worker to null and then call loadData()`, () => { controller.worker = `Please don't`; - controller._userId = 1; + controller._workerFk = 1; spyOn(controller, 'loadData'); - controller.userId = 999; + controller.workerFk = 999; expect(controller.worker).toBeNull(); - expect(controller._userId).toEqual(999); + expect(controller._workerFk).toEqual(999); expect(controller.loadData).toHaveBeenCalledWith(); }); }); @@ -53,14 +53,14 @@ describe('worker Component vnWorkerDescriptorPopover', () => { describe('loadData()', () => { it(`should perform a get query to store the worker data into the controller`, () => { - controller.userId = 1; + controller.workerFk = 1; controller.canceler = null; let response = {}; let config = { filter: { where: { - userFk: controller.userId + id: controller.workerFk }, include: [ { From 59e8990db974b84caf8613a6af7e50b67b04aace Mon Sep 17 00:00:00 2001 From: "LaptopVerdnatura\\Javi" Date: Thu, 25 Apr 2019 09:26:42 +0200 Subject: [PATCH 34/59] bug solved --- modules/client/front/balance/create/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/client/front/balance/create/index.js b/modules/client/front/balance/create/index.js index 2558488ce..6d028e885 100644 --- a/modules/client/front/balance/create/index.js +++ b/modules/client/front/balance/create/index.js @@ -88,7 +88,7 @@ class Controller { } Controller.$inject = ['$scope', '$state', '$http', 'vnApp', '$translate']; -ngModule.component('vnClientBalance', { +ngModule.component('vnClientBalanceCreate', { template: require('./index.html'), controller: Controller, bindings: { From aec46bb8559742ffda56babd2aab418782362956 Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Thu, 25 Apr 2019 13:32:14 +0200 Subject: [PATCH 35/59] fix send notification to salesPerson #1382 --- .../back/methods/claim/regularizeClaim.js | 33 ++++++++----------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/modules/claim/back/methods/claim/regularizeClaim.js b/modules/claim/back/methods/claim/regularizeClaim.js index 8a897ba5c..8ae47a3fa 100644 --- a/modules/claim/back/methods/claim/regularizeClaim.js +++ b/modules/claim/back/methods/claim/regularizeClaim.js @@ -70,14 +70,16 @@ module.exports = Self => { discount: 100 }, {transaction: transaction}); - await sendMessage(ctx, { - itemFk: sale.itemFk, - ticketFk: sale.ticketFk, - recipientFk: sale.item().itemType().worker().userFk, - quantity: sale.quantity, - concept: sale.concept, - nickname: address.nickname - }, transaction); + if (sale.ticket().client().salesPerson()) { + await sendMessage(ctx, { + itemFk: sale.itemFk, + ticketFk: sale.ticketFk, + recipientFk: sale.ticket().client().salesPerson().userFk, + quantity: sale.quantity, + concept: sale.concept, + nickname: address.nickname + }, transaction); + } } let claim = await Self.findById(params.claimFk); @@ -99,23 +101,14 @@ module.exports = Self => { include: [ { relation: 'ticket', - scope: {fields: ['warehouseFk', 'companyFk']} - }, - { - relation: 'item', scope: { - fields: ['typeFk'], + fields: ['clientFk', 'warehouseFk', 'companyFk'], include: { - relation: 'itemType', + relation: 'client', scope: { - fields: ['workerFk'], include: { - relation: 'worker', - scope: { - fields: ['id', 'userFk'], - } + relation: 'salesPerson' } - } } } From 4465f48afe4ae22fb033906272f874ee345bfc8a Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Thu, 25 Apr 2019 13:51:34 +0200 Subject: [PATCH 36/59] fix search by string barcode #1381 --- modules/item/back/methods/item/filter.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/item/back/methods/item/filter.js b/modules/item/back/methods/item/filter.js index 0da463ad4..dc4c838c4 100644 --- a/modules/item/back/methods/item/filter.js +++ b/modules/item/back/methods/item/filter.js @@ -73,7 +73,7 @@ module.exports = Self => { case 'search': return /^\d+$/.test(value) ? {or: [{'i.id': value}, {'ib.code': value}]} - : {'i.name': {like: `%${value}%`}}; + : {or: [{'i.name': {like: `%${value}%`}}, {'ib.code': value}]}; case 'id': return {'i.id': value}; case 'description': From 511e33b835c5adc220e96c7fd20d41257635ba54 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Thu, 25 Apr 2019 14:24:02 +0200 Subject: [PATCH 37/59] #1350 route.index worker descriptor + filters --- e2e/helpers/selectors.js | 13 +- modules/claim/front/index/index.html | 2 +- modules/claim/front/index/index.js | 4 +- modules/claim/front/summary/index.html | 4 +- modules/claim/front/summary/index.js | 4 +- modules/client/back/methods/receipt/filter.js | 2 +- modules/client/front/balance/index/index.html | 4 +- modules/client/front/balance/index/index.js | 4 +- modules/item/back/methods/item/filter.js | 34 ++-- modules/item/front/index/index.html | 4 +- modules/item/front/index/index.js | 4 +- modules/item/front/request/index.html | 4 +- modules/item/front/request/index.js | 4 +- modules/order/back/methods/order/filter.js | 2 +- modules/order/front/index/index.html | 4 +- modules/order/front/index/index.js | 4 +- .../ticket/back/methods/expedition/filter.js | 17 +- .../methods/sale-tracking/listSaleTracking.js | 1 - .../back/methods/ticket-request/filter.js | 3 +- modules/ticket/back/methods/ticket/filter.js | 2 +- modules/ticket/front/expedition/index.html | 4 +- modules/ticket/front/expedition/index.js | 4 +- modules/ticket/front/index/index.html | 4 +- modules/ticket/front/index/index.js | 4 +- modules/ticket/front/request/index/index.html | 6 +- modules/ticket/front/request/index/index.js | 4 +- modules/ticket/front/sale-tracking/index.html | 4 +- modules/ticket/front/sale-tracking/index.js | 4 +- .../ticket/front/tracking/index/index.html | 2 +- modules/ticket/front/tracking/index/index.js | 4 +- modules/worker/front/log/index.html | 2 +- modules/worker/front/log/index.js | 4 +- package-lock.json | 164 ++++++++++-------- 33 files changed, 185 insertions(+), 145 deletions(-) diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index b53863966..41246bd13 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -307,15 +307,14 @@ export default { ticketsIndex: { newTicketButton: 'vn-ticket-index > a', searchResult: `vn-ticket-index vn-card > div > vn-table > div > vn-tbody > a.vn-tr`, - searchResultDate: `vn-ticket-index vn-table vn-tbody > a:nth-child(1) > vn-td:nth-child(4)`, - searchResultAddress: `vn-ticket-index vn-table vn-tbody > a:nth-child(1) > vn-td:nth-child(6)`, + searchResultDate: 'vn-ticket-index vn-table vn-tbody > a:nth-child(1) > vn-td:nth-child(5)', searchTicketInput: `vn-ticket-index ${components.vnTextfield}`, searchButton: `vn-ticket-index vn-searchbar vn-icon[icon="search"]`, - moreMenu: `vn-ticket-index vn-icon-menu[vn-id="more-button"] > div > vn-icon`, - moreMenuTurns: `vn-ticket-index vn-icon-menu vn-drop-down > vn-popover li`, - sixthWeeklyTicketTurn: `vn-ticket-weekly > form > div > vn-card > div > vn-table > div > vn-tbody > vn-tr:nth-child(6) > vn-td:nth-child(3) > vn-autocomplete > div > div > input`, - weeklyTicket: `vn-ticket-weekly vn-table > div > vn-tbody > vn-tr`, - sixthWeeklyTicketDeleteIcon: `vn-ticket-weekly > form vn-tbody > vn-tr:nth-child(6) > vn-td:nth-child(6) > vn-icon-button[icon="delete"]` + moreMenu: 'vn-ticket-index vn-icon-menu[vn-id="more-button"] > div > vn-icon', + moreMenuTurns: 'vn-ticket-index vn-icon-menu vn-drop-down > vn-popover li:nth-child(2)', + sixthWeeklyTicketTurn: 'vn-ticket-weekly > form > div > vn-card > div > vn-table > div > vn-tbody > vn-tr:nth-child(6) > vn-td:nth-child(3) > vn-autocomplete > div > div > input', + weeklyTicket: 'vn-ticket-weekly vn-table > div > vn-tbody > vn-tr', + sixthWeeklyTicketDeleteIcon: 'vn-ticket-weekly > form vn-tbody > vn-tr:nth-child(6) > vn-td:nth-child(6) > vn-icon-button[icon="delete"]' }, createTicketView: { clientAutocomplete: 'vn-ticket-create vn-autocomplete[field="$ctrl.clientFk"]', diff --git a/modules/claim/front/index/index.html b/modules/claim/front/index/index.html index 3d0006f2d..4d15eaba5 100644 --- a/modules/claim/front/index/index.html +++ b/modules/claim/front/index/index.html @@ -68,7 +68,7 @@ + worker-fk="$ctrl.selectedWorker"> diff --git a/modules/claim/front/index/index.js b/modules/claim/front/index/index.js index c8462bc48..21464fea9 100644 --- a/modules/claim/front/index/index.js +++ b/modules/claim/front/index/index.js @@ -25,10 +25,10 @@ export default class Controller { event.stopImmediatePropagation(); } - showWorkerDescriptor(event, userId) { + showWorkerDescriptor(event, workerFk) { event.preventDefault(); event.stopImmediatePropagation(); - this.selectedWorker = userId; + this.selectedWorker = workerFk; this.$.workerDescriptor.parent = event.target; this.$.workerDescriptor.show(); } diff --git a/modules/claim/front/summary/index.html b/modules/claim/front/summary/index.html index ec650c86e..0e4b62a09 100644 --- a/modules/claim/front/summary/index.html +++ b/modules/claim/front/summary/index.html @@ -93,7 +93,7 @@ + ng-click="$ctrl.showWorkerDescriptor($event, development.workerFk)"> {{::development.worker.user.nickname}} @@ -156,7 +156,7 @@ + worker-fk="$ctrl.selectedWorker"> diff --git a/modules/claim/front/summary/index.js b/modules/claim/front/summary/index.js index b8fedca7a..4a953ca9e 100644 --- a/modules/claim/front/summary/index.js +++ b/modules/claim/front/summary/index.js @@ -32,8 +32,8 @@ class Controller { this.$.itemDescriptor.show(); } - showWorkerDescriptor(event, userId) { - this.selectedWorker = userId; + showWorkerDescriptor(event, workerFk) { + this.selectedWorker = workerFk; this.$.workerDescriptor.parent = event.target; this.$.workerDescriptor.show(); } diff --git a/modules/client/back/methods/receipt/filter.js b/modules/client/back/methods/receipt/filter.js index 4de7e72f8..17a8fcadd 100644 --- a/modules/client/back/methods/receipt/filter.js +++ b/modules/client/back/methods/receipt/filter.js @@ -34,6 +34,7 @@ module.exports = Self => { r.id, r.isConciliate, r.payed, + r.workerFk, c.code company, r.created, r.invoiceFk ref, @@ -41,7 +42,6 @@ module.exports = Self => { r.amountPaid credit, r.bankFk, u.nickname userNickname, - u.id userId, r.clientFk, FALSE pdf, FALSE isInvoice diff --git a/modules/client/front/balance/index/index.html b/modules/client/front/balance/index/index.html index 94bcc6a0e..eeec5675b 100644 --- a/modules/client/front/balance/index/index.html +++ b/modules/client/front/balance/index/index.html @@ -62,7 +62,7 @@ + ng-click="$ctrl.showWorkerDescriptor($event, balance.workerFk)"> {{::balance.userNickname}} @@ -116,7 +116,7 @@ + worker-fk="$ctrl.selectedWorker"> { let stmt; stmt = new ParameterizedSQL( - `SELECT i.id, i.image, i.name, i.description, - i.size, i.tag5, i.value5, i.tag6, i.value6, - i.tag7, i.value7, i.tag8, i.value8, - i.tag9, i.value9, i.tag10, i.value10, i.subName, - i.isActive, t.name type, u.nickname userNickname, - t.name type, u.id userId, - intr.description AS intrastat, i.stems, - ori.code AS origin, t.name AS type, - ic.name AS category, i.density, - b.grouping, b.packing, itn.code AS niche, @visibleCalc + `SELECT i.id, + i.image, + i.name, + i.description, + i.size, + i.tag5, i.value5, + i.tag6, i.value6, + i.tag7, i.value7, + i.tag8, i.value8, + i.tag9, i.value9, + i.tag10, i.value10, + i.subName, + i.isActive, + t.name type, + t.workerFk buyerFk, + u.nickname userNickname, + intr.description AS intrastat, + i.stems, + ori.code AS origin, + ic.name AS category, + i.density, + b.grouping, + b.packing, + itn.code AS niche, @visibleCalc FROM item i LEFT JOIN itemType t ON t.id = i.typeFk LEFT JOIN itemCategory ic ON ic.id = t.categoryFk diff --git a/modules/item/front/index/index.html b/modules/item/front/index/index.html index 6fb0fdfb5..6054c7bb7 100644 --- a/modules/item/front/index/index.html +++ b/modules/item/front/index/index.html @@ -94,7 +94,7 @@ + ng-click="$ctrl.showWorkerDescriptor($event, item.buyerFk)"> {{::item.userNickname}} @@ -143,5 +143,5 @@ + worker-fk="$ctrl.selectedWorker"> \ No newline at end of file diff --git a/modules/item/front/index/index.js b/modules/item/front/index/index.js index 524587afb..14529d402 100644 --- a/modules/item/front/index/index.js +++ b/modules/item/front/index/index.js @@ -68,13 +68,13 @@ class Controller { } - showWorkerDescriptor(event, userId) { + showWorkerDescriptor(event, workerFk) { if (event.defaultPrevented) return; event.preventDefault(); event.stopPropagation(); - this.selectedWorker = userId; + this.selectedWorker = workerFk; this.$.workerDescriptor.parent = event.target; this.$.workerDescriptor.show(); } diff --git a/modules/item/front/request/index.html b/modules/item/front/request/index.html index 76a95a967..700e70dec 100644 --- a/modules/item/front/request/index.html +++ b/modules/item/front/request/index.html @@ -53,7 +53,7 @@ + ng-click="$ctrl.showWorkerDescriptor($event, request.salesPersonFk)"> {{::request.salesPersonNickname}} @@ -69,7 +69,7 @@ + ng-click="$ctrl.showWorkerDescriptor($event, request.atenderFk)"> {{::request.atenderNickname}} diff --git a/modules/item/front/request/index.js b/modules/item/front/request/index.js index e4322cf7f..2f110bf48 100644 --- a/modules/item/front/request/index.js +++ b/modules/item/front/request/index.js @@ -122,8 +122,8 @@ export default class Controller { this.$.itemDescriptor.show(); } - showWorkerDescriptor(event, userId) { - this.$.workerDescriptor.userId = userId; + showWorkerDescriptor(event, workerFk) { + this.$.workerDescriptor.workerFk = workerFk; this.$.workerDescriptor.parent = event.target; this.$.workerDescriptor.show(); } diff --git a/modules/order/back/methods/order/filter.js b/modules/order/back/methods/order/filter.js index 628b85343..e5d18b44a 100644 --- a/modules/order/back/methods/order/filter.js +++ b/modules/order/back/methods/order/filter.js @@ -114,8 +114,8 @@ module.exports = Self => { o.source_app sourceApp, o.confirmed isConfirmed, c.name clientName, + c.salesPersonFk, u.nickname workerNickname, - u.id userId, co.code companyCode FROM hedera.order o LEFT JOIN address a ON a.id = o.address_id diff --git a/modules/order/front/index/index.html b/modules/order/front/index/index.html index c5d29c292..0fd53f2f6 100644 --- a/modules/order/front/index/index.html +++ b/modules/order/front/index/index.html @@ -45,7 +45,7 @@ + ng-click="$ctrl.showWorkerDescriptor($event, order.salesPersonFk)"> {{::order.workerNickname | dashIfEmpty}} @@ -81,7 +81,7 @@ + worker-fk="$ctrl.selectedWorker"> { Self.filter = async filter => { const stmt = new ParameterizedSQL( `SELECT - e.id, e.ticketFk, e.isBox, - i1.name namePackage, e.counter, - e.checked, i2.name nameBox, - e.itemFk, u.nickname userNickname, - u.id userId, e.created, e.externalId + e.id, + e.ticketFk, + e.isBox, + e.workerFk, + i1.name namePackage, + e.counter, + e.checked, + i2.name nameBox, + e.itemFk, + u.nickname userNickname, + e.created, + e.externalId FROM vn.expedition e LEFT JOIN vn.item i2 ON i2.id = e.itemFk diff --git a/modules/ticket/back/methods/sale-tracking/listSaleTracking.js b/modules/ticket/back/methods/sale-tracking/listSaleTracking.js index 7ee037161..8d3e0c248 100644 --- a/modules/ticket/back/methods/sale-tracking/listSaleTracking.js +++ b/modules/ticket/back/methods/sale-tracking/listSaleTracking.js @@ -32,7 +32,6 @@ module.exports = Self => { st.created, st.workerFk, u.nickname userNickname, - u.id userId, ste.name AS state FROM saleTracking st JOIN sale s ON s.id = st.saleFk diff --git a/modules/ticket/back/methods/ticket-request/filter.js b/modules/ticket/back/methods/ticket-request/filter.js index a2862c59b..4e0db40f8 100644 --- a/modules/ticket/back/methods/ticket-request/filter.js +++ b/modules/ticket/back/methods/ticket-request/filter.js @@ -116,8 +116,7 @@ module.exports = Self => { w.name AS warehouse, u.nickname AS salesPersonNickname, ua.nickname AS atenderNickname, - u.id AS salesPersonUserFk, - ua.id AS atenderUserFk + c.salesPersonFk FROM ticketRequest tr LEFT JOIN ticket t ON t.id = tr.ticketFk LEFT JOIN warehouse w ON w.id = t.warehouseFk diff --git a/modules/ticket/back/methods/ticket/filter.js b/modules/ticket/back/methods/ticket/filter.js index b9c11d4fa..c006f0985 100644 --- a/modules/ticket/back/methods/ticket/filter.js +++ b/modules/ticket/back/methods/ticket/filter.js @@ -192,7 +192,7 @@ module.exports = Self => { ts.alertLevel as alertLevel, ts.code as alertLevelCode, u.nickname userNickname, - u.id userId + c.salesPersonFk FROM ticket t LEFT JOIN address a ON a.id = t.addressFk LEFT JOIN province p ON p.id = a.provinceFk diff --git a/modules/ticket/front/expedition/index.html b/modules/ticket/front/expedition/index.html index 118206c75..eafd318a2 100644 --- a/modules/ticket/front/expedition/index.html +++ b/modules/ticket/front/expedition/index.html @@ -48,7 +48,7 @@ + ng-click="$ctrl.showWorkerDescriptor($event, expedition.workerFk)"> {{::expedition.userNickname | dashIfEmpty}} @@ -67,7 +67,7 @@ + worker-fk="$ctrl.selectedWorker"> + ng-click="$ctrl.showWorkerDescriptor($event, ticket.salesPersonFk)"> {{::ticket.userNickname | dashIfEmpty}} @@ -154,7 +154,7 @@ + worker-fk="$ctrl.selectedWorker"> diff --git a/modules/ticket/front/index/index.js b/modules/ticket/front/index/index.js index 6875bcb62..be1b5af33 100644 --- a/modules/ticket/front/index/index.js +++ b/modules/ticket/front/index/index.js @@ -126,9 +126,9 @@ export default class Controller { this.$.clientDescriptor.show(); } - showWorkerDescriptor(event, userId) { + showWorkerDescriptor(event, workerFk) { this.preventDefault(event); - this.selectedWorker = userId; + this.selectedWorker = workerFk; this.$.workerDescriptor.parent = event.target; this.$.workerDescriptor.show(); } diff --git a/modules/ticket/front/request/index/index.html b/modules/ticket/front/request/index/index.html index eb2de0af0..015aa0615 100644 --- a/modules/ticket/front/request/index/index.html +++ b/modules/ticket/front/request/index/index.html @@ -38,14 +38,14 @@ + ng-click="$ctrl.showWorkerDescriptor($event, request.requesterFk)"> {{::request.requester.user.nickname | dashIfEmpty}} + ng-click="$ctrl.showWorkerDescriptor($event, request.atenderFk)"> {{::request.atender.user.nickname | dashIfEmpty}} @@ -87,7 +87,7 @@ + worker-fk="$ctrl.selectedWorker"> + ng-click="$ctrl.showWorkerDescriptor($event, sale.workerFk)"> {{::sale.userNickname | dashIfEmpty}} @@ -67,5 +67,5 @@ + worker-fk="$ctrl.selectedWorker"> \ No newline at end of file diff --git a/modules/ticket/front/sale-tracking/index.js b/modules/ticket/front/sale-tracking/index.js index b0f7e8041..41ff12a4a 100644 --- a/modules/ticket/front/sale-tracking/index.js +++ b/modules/ticket/front/sale-tracking/index.js @@ -23,10 +23,10 @@ class Controller { this.$.itemDescriptor.show(); } - showWorkerDescriptor(event, userId) { + showWorkerDescriptor(event, workerFk) { event.preventDefault(); event.stopImmediatePropagation(); - this.selectedWorker = userId; + this.selectedWorker = workerFk; this.$.workerDescriptor.parent = event.target; this.$.workerDescriptor.show(); } diff --git a/modules/ticket/front/tracking/index/index.html b/modules/ticket/front/tracking/index/index.html index 3252385a8..1292c797e 100644 --- a/modules/ticket/front/tracking/index/index.html +++ b/modules/ticket/front/tracking/index/index.html @@ -41,5 +41,5 @@ + worker-fk="$ctrl.selectedWorker"> \ No newline at end of file diff --git a/modules/ticket/front/tracking/index/index.js b/modules/ticket/front/tracking/index/index.js index 58db5f774..adc1ac5a2 100644 --- a/modules/ticket/front/tracking/index/index.js +++ b/modules/ticket/front/tracking/index/index.js @@ -28,10 +28,10 @@ class Controller { }; } - showWorkerDescriptor(event, userId) { + showWorkerDescriptor(event, workerFk) { event.preventDefault(); event.stopImmediatePropagation(); - this.selectedWorker = userId; + this.selectedWorker = workerFk; this.$.workerDescriptor.parent = event.target; this.$.workerDescriptor.show(); } diff --git a/modules/worker/front/log/index.html b/modules/worker/front/log/index.html index a060289a6..1c3c76459 100644 --- a/modules/worker/front/log/index.html +++ b/modules/worker/front/log/index.html @@ -94,5 +94,5 @@ + worker-fk="$ctrl.selectedWorker"> diff --git a/modules/worker/front/log/index.js b/modules/worker/front/log/index.js index 6cd36d47c..632b1c889 100644 --- a/modules/worker/front/log/index.js +++ b/modules/worker/front/log/index.js @@ -12,13 +12,13 @@ export default class Controller { }; } - showWorkerDescriptor(event, userId) { + showWorkerDescriptor(event, workerFk) { if (event.defaultPrevented) return; event.preventDefault(); event.stopPropagation(); - this.selectedWorker = userId; + this.selectedWorker = workerFk; this.$.workerDescriptor.parent = event.target; this.$.workerDescriptor.show(); } diff --git a/package-lock.json b/package-lock.json index 567453ea1..21ae3042c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1505,7 +1505,7 @@ }, "util": { "version": "0.10.3", - "resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz", + "resolved": "http://registry.npmjs.org/util/-/util-0.10.3.tgz", "integrity": "sha1-evsa/lCAUkZInj23/g7TeTNqwPk=", "dev": true, "requires": { @@ -1733,7 +1733,7 @@ "base": { "version": "0.11.2", "resolved": "https://registry.npmjs.org/base/-/base-0.11.2.tgz", - "integrity": "sha1-e95c7RRbbVUakNuH+DxVi060io8=", + "integrity": "sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg==", "dev": true, "requires": { "cache-base": "^1.0.1", @@ -2097,7 +2097,7 @@ }, "browserify-rsa": { "version": "4.0.1", - "resolved": "https://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.0.1.tgz", + "resolved": "http://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.0.1.tgz", "integrity": "sha1-IeCr+vbyApzy+vsTNWenAdQTVSQ=", "dev": true, "requires": { @@ -2147,7 +2147,7 @@ }, "buffer": { "version": "4.9.1", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-4.9.1.tgz", + "resolved": "http://registry.npmjs.org/buffer/-/buffer-4.9.1.tgz", "integrity": "sha1-bRu2AbB6TvztlwlBMgkwJ8lbwpg=", "dev": true, "requires": { @@ -2321,7 +2321,7 @@ "cache-base": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz", - "integrity": "sha1-Cn9GQWgxyLZi7jb+TnxZ129marI=", + "integrity": "sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ==", "dev": true, "requires": { "collection-visit": "^1.0.0", @@ -2365,7 +2365,7 @@ }, "camelcase-keys": { "version": "2.1.0", - "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-2.1.0.tgz", + "resolved": "http://registry.npmjs.org/camelcase-keys/-/camelcase-keys-2.1.0.tgz", "integrity": "sha1-MIvur/3ygRkFHvodkyITyRuPkuc=", "dev": true, "requires": { @@ -2496,7 +2496,7 @@ "class-utils": { "version": "0.3.6", "resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.6.tgz", - "integrity": "sha1-+TNprouafOAv1B+q0MqDAzGQxGM=", + "integrity": "sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg==", "dev": true, "requires": { "arr-union": "^3.1.0", @@ -2656,7 +2656,7 @@ }, "string_decoder": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { @@ -2730,7 +2730,7 @@ }, "colors": { "version": "1.1.2", - "resolved": "https://registry.npmjs.org/colors/-/colors-1.1.2.tgz", + "resolved": "http://registry.npmjs.org/colors/-/colors-1.1.2.tgz", "integrity": "sha1-FopHAXVran9RoSzgyXv6KMCE7WM=", "dev": true }, @@ -2925,7 +2925,7 @@ }, "content-disposition": { "version": "0.5.2", - "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz", + "resolved": "http://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz", "integrity": "sha1-DPaLud318r55YcOoUXjLhdunjLQ=" }, "content-security-policy-builder": { @@ -3194,13 +3194,13 @@ "dependencies": { "jsesc": { "version": "0.5.0", - "resolved": "http://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", "integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=", "dev": true }, "regexpu-core": { "version": "1.0.0", - "resolved": "http://registry.npmjs.org/regexpu-core/-/regexpu-core-1.0.0.tgz", + "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-1.0.0.tgz", "integrity": "sha1-hqdj9Y7k18L2sQLkdkBQ3n7ZDGs=", "dev": true, "requires": { @@ -3211,13 +3211,13 @@ }, "regjsgen": { "version": "0.2.0", - "resolved": "http://registry.npmjs.org/regjsgen/-/regjsgen-0.2.0.tgz", + "resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.2.0.tgz", "integrity": "sha1-bAFq3qxVT3WCP+N6wFuS1aTtsfc=", "dev": true }, "regjsparser": { "version": "0.1.5", - "resolved": "http://registry.npmjs.org/regjsparser/-/regjsparser-0.1.5.tgz", + "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.1.5.tgz", "integrity": "sha1-fuj4Tcb6eS0/0K4ijSS9lJ6tIFw=", "dev": true, "requires": { @@ -3720,7 +3720,7 @@ }, "readable-stream": { "version": "1.1.14", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", + "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", "dev": true, "requires": { @@ -3847,7 +3847,7 @@ "dependencies": { "fs-extra": { "version": "0.30.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-0.30.0.tgz", + "resolved": "http://registry.npmjs.org/fs-extra/-/fs-extra-0.30.0.tgz", "integrity": "sha1-8jP/zAjU2n1DLapEl3aYnbHfk/A=", "dev": true, "requires": { @@ -4844,7 +4844,7 @@ }, "file-loader": { "version": "1.1.11", - "resolved": "https://registry.npmjs.org/file-loader/-/file-loader-1.1.11.tgz", + "resolved": "http://registry.npmjs.org/file-loader/-/file-loader-1.1.11.tgz", "integrity": "sha512-TGR4HU7HUsGg6GCOPJnFk06RhWgEWFLAGWiT6rcD+GRC2keU3s9RGJ+b3Z6/U73jwwNb2gKLJ7YCrp+jvU4ALg==", "dev": true, "requires": { @@ -5108,7 +5108,7 @@ }, "fs-access": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/fs-access/-/fs-access-1.0.1.tgz", + "resolved": "http://registry.npmjs.org/fs-access/-/fs-access-1.0.1.tgz", "integrity": "sha1-1qh/JiJxzv6+wwxVNAf7mV2od3o=", "dev": true, "requires": { @@ -5181,7 +5181,8 @@ "ansi-regex": { "version": "2.1.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "aproba": { "version": "1.2.0", @@ -5596,7 +5597,8 @@ "safe-buffer": { "version": "5.1.2", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "safer-buffer": { "version": "2.1.2", @@ -5652,6 +5654,7 @@ "version": "3.0.1", "bundled": true, "dev": true, + "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -5695,12 +5698,14 @@ "wrappy": { "version": "1.0.2", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "yallist": { "version": "3.0.3", "bundled": true, - "dev": true + "dev": true, + "optional": true } } }, @@ -5902,7 +5907,7 @@ "global-modules": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/global-modules/-/global-modules-1.0.0.tgz", - "integrity": "sha1-bXcPDrUjrHgWTXK15xqIdyZcw+o=", + "integrity": "sha512-sKzpEkf11GpOFuw0Zzjzmt4B4UZwjOcG757PPvrfhxcLFbq0wpsgpOqxpxtxFiCG4DtG93M6XRVbF2oGdev7bg==", "dev": true, "requires": { "global-prefix": "^1.0.1", @@ -5939,7 +5944,7 @@ }, "globby": { "version": "5.0.0", - "resolved": "https://registry.npmjs.org/globby/-/globby-5.0.0.tgz", + "resolved": "http://registry.npmjs.org/globby/-/globby-5.0.0.tgz", "integrity": "sha1-69hGZ8oNuzMLmbz8aOrCvFQ3Dg0=", "dev": true, "requires": { @@ -5984,7 +5989,7 @@ }, "got": { "version": "6.7.1", - "resolved": "https://registry.npmjs.org/got/-/got-6.7.1.tgz", + "resolved": "http://registry.npmjs.org/got/-/got-6.7.1.tgz", "integrity": "sha1-JAzQV4WpoY5WHcG0S0HHY+8ejbA=", "dev": true, "requires": { @@ -6254,7 +6259,7 @@ }, "kind-of": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-1.1.0.tgz", + "resolved": "http://registry.npmjs.org/kind-of/-/kind-of-1.1.0.tgz", "integrity": "sha1-FAo9LUGjbS78+pN3tiwk+ElaXEQ=", "dev": true }, @@ -6438,7 +6443,7 @@ "dependencies": { "es6-promise": { "version": "3.3.1", - "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-3.3.1.tgz", + "resolved": "http://registry.npmjs.org/es6-promise/-/es6-promise-3.3.1.tgz", "integrity": "sha1-oIzd6EzNvzTQJ6FFG8kdS80ophM=", "dev": true }, @@ -7275,7 +7280,7 @@ }, "is-builtin-module": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz", + "resolved": "http://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz", "integrity": "sha1-VAVy0096wxGfj3bDDLwbHgN6/74=", "dev": true, "requires": { @@ -7422,7 +7427,7 @@ }, "is-obj": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz", + "resolved": "http://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz", "integrity": "sha1-PkcprB9f3gJc19g6iW2rn09n2w8=", "dev": true }, @@ -7453,7 +7458,7 @@ "is-plain-object": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", - "integrity": "sha1-LBY7P6+xtgbZ0Xko8FwqHDjgdnc=", + "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", "dev": true, "requires": { "isobject": "^3.0.1" @@ -7623,7 +7628,7 @@ }, "jasmine-core": { "version": "2.99.1", - "resolved": "https://registry.npmjs.org/jasmine-core/-/jasmine-core-2.99.1.tgz", + "resolved": "http://registry.npmjs.org/jasmine-core/-/jasmine-core-2.99.1.tgz", "integrity": "sha1-5kAN8ea1bhMLYcS80JPap/boyhU=", "dev": true }, @@ -7875,7 +7880,7 @@ "karma-chrome-launcher": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/karma-chrome-launcher/-/karma-chrome-launcher-2.2.0.tgz", - "integrity": "sha512-uf/ZVpAabDBPvdPdveyk1EPgbnloPvFFGgmRhYLTDH7gEB4nZdSBk8yTU47w1g/drLSx5uMOkjKk7IWKfWg/+w==", + "integrity": "sha1-zxudBxNswY/iOTJ9JGVMPbw2is8=", "dev": true, "requires": { "fs-access": "^1.0.0", @@ -8065,7 +8070,7 @@ }, "load-json-file": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", + "resolved": "http://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", "dev": true, "requires": { @@ -9539,7 +9544,7 @@ }, "media-typer": { "version": "0.3.0", - "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "resolved": "http://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=" }, "mem": { @@ -9562,7 +9567,7 @@ }, "meow": { "version": "3.7.0", - "resolved": "https://registry.npmjs.org/meow/-/meow-3.7.0.tgz", + "resolved": "http://registry.npmjs.org/meow/-/meow-3.7.0.tgz", "integrity": "sha1-cstmi0JSKCkKu/qFaJJYcwioAfs=", "dev": true, "requires": { @@ -9685,7 +9690,7 @@ }, "minimist": { "version": "1.2.0", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=" }, "minstache": { @@ -9699,7 +9704,7 @@ "dependencies": { "commander": { "version": "1.0.4", - "resolved": "http://registry.npmjs.org/commander/-/commander-1.0.4.tgz", + "resolved": "https://registry.npmjs.org/commander/-/commander-1.0.4.tgz", "integrity": "sha1-Xt6xruI8T7VBprcNaSq+8ZZpotM=", "dev": true, "requires": { @@ -9767,7 +9772,7 @@ }, "mkdirp": { "version": "0.5.1", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "resolved": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "requires": { "minimist": "0.0.8" @@ -9775,7 +9780,7 @@ "dependencies": { "minimist": { "version": "0.0.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "resolved": "http://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=" } } @@ -9927,7 +9932,7 @@ }, "multipipe": { "version": "0.1.2", - "resolved": "https://registry.npmjs.org/multipipe/-/multipipe-0.1.2.tgz", + "resolved": "http://registry.npmjs.org/multipipe/-/multipipe-0.1.2.tgz", "integrity": "sha1-Ko8t33Du1WTf8tV/HhoTfZ8FB4s=", "dev": true, "requires": { @@ -10157,7 +10162,7 @@ "dependencies": { "jsesc": { "version": "0.5.0", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", + "resolved": "http://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", "integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=", "dev": true } @@ -10787,7 +10792,8 @@ "ansi-regex": { "version": "2.1.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "aproba": { "version": "1.2.0", @@ -10815,6 +10821,7 @@ "version": "1.1.11", "bundled": true, "dev": true, + "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -10829,7 +10836,8 @@ "code-point-at": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "concat-map": { "version": "0.0.1", @@ -10840,7 +10848,8 @@ "console-control-strings": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "core-util-is": { "version": "1.0.2", @@ -10957,7 +10966,8 @@ "inherits": { "version": "2.0.3", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "ini": { "version": "1.3.5", @@ -10969,6 +10979,7 @@ "version": "1.0.0", "bundled": true, "dev": true, + "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -10983,6 +10994,7 @@ "version": "3.0.4", "bundled": true, "dev": true, + "optional": true, "requires": { "brace-expansion": "^1.1.7" } @@ -10990,12 +11002,14 @@ "minimist": { "version": "0.0.8", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "minipass": { "version": "2.3.5", "bundled": true, "dev": true, + "optional": true, "requires": { "safe-buffer": "^5.1.2", "yallist": "^3.0.0" @@ -11014,6 +11028,7 @@ "version": "0.5.1", "bundled": true, "dev": true, + "optional": true, "requires": { "minimist": "0.0.8" } @@ -11094,7 +11109,8 @@ "number-is-nan": { "version": "1.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "object-assign": { "version": "4.1.1", @@ -11106,6 +11122,7 @@ "version": "1.4.0", "bundled": true, "dev": true, + "optional": true, "requires": { "wrappy": "1" } @@ -11191,7 +11208,8 @@ "safe-buffer": { "version": "5.1.2", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "safer-buffer": { "version": "2.1.2", @@ -11227,6 +11245,7 @@ "version": "1.0.2", "bundled": true, "dev": true, + "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -11246,6 +11265,7 @@ "version": "3.0.1", "bundled": true, "dev": true, + "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -11289,12 +11309,14 @@ "wrappy": { "version": "1.0.2", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "yallist": { "version": "3.0.3", "bundled": true, - "dev": true + "dev": true, + "optional": true } } }, @@ -11593,7 +11615,7 @@ "dependencies": { "minimist": { "version": "0.0.10", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz", + "resolved": "http://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz", "integrity": "sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8=", "dev": true }, @@ -11655,7 +11677,7 @@ }, "os-homedir": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "resolved": "http://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", "dev": true }, @@ -11671,7 +11693,7 @@ }, "os-tmpdir": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "resolved": "http://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", "dev": true }, @@ -11860,7 +11882,7 @@ }, "path-browserify": { "version": "0.0.0", - "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-0.0.0.tgz", + "resolved": "http://registry.npmjs.org/path-browserify/-/path-browserify-0.0.0.tgz", "integrity": "sha1-oLhwcpquIUAFt9UDLsLLuw+0RRo=", "dev": true }, @@ -12149,7 +12171,7 @@ }, "pretty-bytes": { "version": "1.0.4", - "resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-1.0.4.tgz", + "resolved": "http://registry.npmjs.org/pretty-bytes/-/pretty-bytes-1.0.4.tgz", "integrity": "sha1-CiLoIQYJrTVUL4yNXSFZr/B1HIQ=", "dev": true, "requires": { @@ -12232,13 +12254,13 @@ }, "string_decoder": { "version": "0.10.31", - "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", "dev": true }, "through2": { "version": "0.2.3", - "resolved": "https://registry.npmjs.org/through2/-/through2-0.2.3.tgz", + "resolved": "http://registry.npmjs.org/through2/-/through2-0.2.3.tgz", "integrity": "sha1-6zKE2k6jEbbMis42U3SKUqvyWj8=", "dev": true, "requires": { @@ -13129,7 +13151,7 @@ }, "safe-regex": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", + "resolved": "http://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", "integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=", "dev": true, "requires": { @@ -13254,7 +13276,7 @@ "dependencies": { "source-map": { "version": "0.4.4", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz", + "resolved": "http://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz", "integrity": "sha1-66T12pwNyZneaAMti092FzZSA2s=", "dev": true, "requires": { @@ -13394,7 +13416,7 @@ "set-value": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.0.tgz", - "integrity": "sha1-ca5KiPD+77v1LR6mBPP7MV67YnQ=", + "integrity": "sha512-hw0yxk9GT/Hr5yJEYnHNKYXkIA8mVJgd9ditYZCe16ZczcaELYYcfvaXesNACk2O8O0nTiPQcQhGUQj8JLzeeg==", "dev": true, "requires": { "extend-shallow": "^2.0.1", @@ -13505,7 +13527,7 @@ }, "string-width": { "version": "1.0.2", - "resolved": "http://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", "dev": true, "requires": { @@ -13581,7 +13603,7 @@ "snapdragon-node": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/snapdragon-node/-/snapdragon-node-2.1.1.tgz", - "integrity": "sha1-bBdfhv8UvbByRWPo88GwIaKGhTs=", + "integrity": "sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw==", "dev": true, "requires": { "define-property": "^1.0.0", @@ -13632,7 +13654,7 @@ "snapdragon-util": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/snapdragon-util/-/snapdragon-util-3.0.1.tgz", - "integrity": "sha1-+VZHlIbyrNeXAGk/b3uAXkWrVuI=", + "integrity": "sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ==", "dev": true, "requires": { "kind-of": "^3.2.0" @@ -13988,7 +14010,7 @@ "split-string": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz", - "integrity": "sha1-fLCd2jqGWFcFxks5pkZgOGguj+I=", + "integrity": "sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw==", "dev": true, "requires": { "extend-shallow": "^3.0.0" @@ -13997,7 +14019,7 @@ "split2": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/split2/-/split2-2.2.0.tgz", - "integrity": "sha1-GGsldbz4PoW30YRldWI47k7kJJM=", + "integrity": "sha512-RAb22TG39LhI31MbreBgIuKiIKhVsawfTgEGqKHTK87aG+ul/PB8Sqoi3I7kVdRWiCfrKxK3uo4/YUkpNvhPbw==", "dev": true, "requires": { "through2": "^2.0.2" @@ -14172,7 +14194,7 @@ }, "string_decoder": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { @@ -14279,7 +14301,7 @@ }, "strip-ansi": { "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "resolved": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "dev": true, "requires": { @@ -14704,7 +14726,7 @@ }, "tar": { "version": "2.2.1", - "resolved": "https://registry.npmjs.org/tar/-/tar-2.2.1.tgz", + "resolved": "http://registry.npmjs.org/tar/-/tar-2.2.1.tgz", "integrity": "sha1-jk0qJWwOIYXGsYrWlK7JaLg8sdE=", "dev": true, "requires": { @@ -14874,7 +14896,7 @@ }, "through": { "version": "2.3.8", - "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "resolved": "http://registry.npmjs.org/through/-/through-2.3.8.tgz", "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=" }, "through2": { @@ -15146,7 +15168,7 @@ }, "tty-browserify": { "version": "0.0.0", - "resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.0.tgz", + "resolved": "http://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.0.tgz", "integrity": "sha1-oVe6QC2iTpv5V/mqadUk7tQpAaY=", "dev": true }, @@ -15777,7 +15799,7 @@ }, "vm-browserify": { "version": "0.0.4", - "resolved": "https://registry.npmjs.org/vm-browserify/-/vm-browserify-0.0.4.tgz", + "resolved": "http://registry.npmjs.org/vm-browserify/-/vm-browserify-0.0.4.tgz", "integrity": "sha1-XX6kW7755Kb/ZflUOOCofDV9WnM=", "dev": true, "requires": { From fabe4f396faca944a36ca99b2d33c81fc6975f09 Mon Sep 17 00:00:00 2001 From: Bernat Date: Thu, 25 Apr 2019 14:51:22 +0200 Subject: [PATCH 38/59] #1371 claim descriptor hour --- modules/claim/front/descriptor/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/claim/front/descriptor/index.html b/modules/claim/front/descriptor/index.html index 27d984fb6..2c6af5965 100644 --- a/modules/claim/front/descriptor/index.html +++ b/modules/claim/front/descriptor/index.html @@ -26,7 +26,7 @@ value="{{$ctrl.claim.claimState.description}}"> + value="{{$ctrl.claim.created | dateTime: 'dd/MM/yyyy HH:mm'}}"> From a920bc1d8f757668efaec13b2984fa32ba421855 Mon Sep 17 00:00:00 2001 From: jgallego Date: Thu, 25 Apr 2019 18:30:11 +0200 Subject: [PATCH 39/59] tablas dms --- back/model-config.json | 6 +++ back/models/dms.json | 51 +++++++++++++++++++ back/models/dmsType.json | 33 ++++++++++++ db/changes/10003-easter/00-dmsView.sql | 20 ++++++++ .../10003-easter/01-dmsTicketRename.sql | 11 ++++ .../10003-easter/02-dmsTypeAddRoleFields.sql | 3 ++ modules/ticket/back/model-config.json | 3 ++ modules/ticket/back/models/ticket-dms.json | 38 ++++++++++++++ 8 files changed, 165 insertions(+) create mode 100644 back/models/dms.json create mode 100644 back/models/dmsType.json create mode 100644 db/changes/10003-easter/00-dmsView.sql create mode 100644 db/changes/10003-easter/01-dmsTicketRename.sql create mode 100644 db/changes/10003-easter/02-dmsTypeAddRoleFields.sql create mode 100644 modules/ticket/back/models/ticket-dms.json diff --git a/back/model-config.json b/back/model-config.json index d471f3230..dc67a5422 100644 --- a/back/model-config.json +++ b/back/model-config.json @@ -37,6 +37,12 @@ }, "EmailUser": { "dataSource": "vn" + }, + "Dms": { + "dataSource": "vn" + }, + "DmsType": { + "dataSource": "vn" } } diff --git a/back/models/dms.json b/back/models/dms.json new file mode 100644 index 000000000..d5ec4b8b7 --- /dev/null +++ b/back/models/dms.json @@ -0,0 +1,51 @@ +{ + "name": "Dms", + "description": "Documental Managment system", + "base": "VnModel", + "options": { + "mysql": { + "table": "dms" + } + }, + "properties": { + "id": { + "type": "Number", + "id": true, + "description": "Identifier" + }, + "file": { + "type": "string" + }, + "reference": { + "type": "string" + }, + "description": { + "type": "string" + }, + "created": { + "type": "Date" + } + }, + "relations": { + "dmsType": { + "type": "belongsTo", + "model": "DmsType", + "foreignKey": "dmsTypeFk" + }, + "worker": { + "type": "belongsTo", + "model": "Worker", + "foreignKey": "workerFk" + }, + "warehouse": { + "type": "belongsTo", + "model": "Warehouse", + "foreignKey": "warehouseFk" + }, + "company": { + "type": "belongsTo", + "model": "Company", + "foreignKey": "companyFk" + } + } +} \ No newline at end of file diff --git a/back/models/dmsType.json b/back/models/dmsType.json new file mode 100644 index 000000000..0d55647f3 --- /dev/null +++ b/back/models/dmsType.json @@ -0,0 +1,33 @@ +{ + "name": "DmsType", + "description": "Documental Managment system types", + "base": "VnModel", + "options": { + "mysql": { + "table": "dmsType" + } + }, + "properties": { + "id": { + "type": "Number", + "id": true, + "description": "Identifier" + }, + "name": { + "type": "string", + "required": true + }, + "path": { + "type": "string", + "required": true + } + }, + "acls": [ + { + "accessType": "READ", + "principalType": "ROLE", + "principalId": "$everyone", + "permission": "ALLOW" + } + ] +} \ No newline at end of file diff --git a/db/changes/10003-easter/00-dmsView.sql b/db/changes/10003-easter/00-dmsView.sql new file mode 100644 index 000000000..88d32f93c --- /dev/null +++ b/db/changes/10003-easter/00-dmsView.sql @@ -0,0 +1,20 @@ +USE `vn`; +CREATE + OR REPLACE ALGORITHM = UNDEFINED + DEFINER = `root`@`%` + SQL SECURITY DEFINER +VIEW `vn`.`dms` AS + SELECT + `g`.`id` AS `id`, + `g`.`gesttip_id` AS `dmsTypeFk`, + `g`.`file` AS `file`, + `g`.`trabajador_id` AS `workerFk`, + `g`.`warehouse_id` AS `warehouseFk`, + `g`.`emp_id` AS `companyFk`, + `g`.`orden` AS `priority`, + `g`.`file` AS `hasFile`, + `g`.`sref` AS `reference`, + `g`.`brief` AS `description`, + `g`.`odbc_date` AS `created` + FROM + `vn2008`.`gestdoc` `g` \ No newline at end of file diff --git a/db/changes/10003-easter/01-dmsTicketRename.sql b/db/changes/10003-easter/01-dmsTicketRename.sql new file mode 100644 index 000000000..3554be6bd --- /dev/null +++ b/db/changes/10003-easter/01-dmsTicketRename.sql @@ -0,0 +1,11 @@ +DROP VIEW IF EXISTS `vn`.`dmsTicket` ; +USE `vn`; +CREATE + OR REPLACE ALGORITHM = UNDEFINED + DEFINER = `root`@`%` + SQL SECURITY DEFINER +VIEW `vn`.`ticketDms` AS + SELECT + `g`.`Id_Ticket` AS `ticketFk`, `g`.`gestdoc_id` AS `dmsFk` + FROM + `vn2008`.`tickets_gestdoc` `g`; diff --git a/db/changes/10003-easter/02-dmsTypeAddRoleFields.sql b/db/changes/10003-easter/02-dmsTypeAddRoleFields.sql new file mode 100644 index 000000000..5e65bf299 --- /dev/null +++ b/db/changes/10003-easter/02-dmsTypeAddRoleFields.sql @@ -0,0 +1,3 @@ +ALTER TABLE `vn2008`.`gesttip` +ADD COLUMN `writeRoleFk` INT(10) UNSIGNED NULL AFTER `path`, +ADD COLUMN `ReadRoleFk` INT(10) UNSIGNED NULL AFTER `writeRoleFk`; diff --git a/modules/ticket/back/model-config.json b/modules/ticket/back/model-config.json index a919827b4..3b38f1a16 100644 --- a/modules/ticket/back/model-config.json +++ b/modules/ticket/back/model-config.json @@ -38,6 +38,9 @@ "Ticket": { "dataSource": "vn" }, + "TicketDms": { + "dataSource": "vn" + }, "TicketLog": { "dataSource": "vn" }, diff --git a/modules/ticket/back/models/ticket-dms.json b/modules/ticket/back/models/ticket-dms.json new file mode 100644 index 000000000..b725d47cd --- /dev/null +++ b/modules/ticket/back/models/ticket-dms.json @@ -0,0 +1,38 @@ +{ + "name": "TicketDms", + "base": "Loggable", + "log": { + "model": "TicketLog", + "relation": "ticket", + "showField": "dmsFk" + }, + "options": { + "mysql": { + "table": "ticketDms" + } + }, + "properties": { + "ticketFk": { + "type": "Number", + "id": true, + "required": true + }, + "dmsFk": { + "type": "Number", + "id": true, + "required": true + } + }, + "relations": { + "ticket": { + "type": "belongsTo", + "model": "Ticket", + "foreignKey": "ticketFk" + }, + "dms": { + "type": "belongsTo", + "model": "Dms", + "foreignKey": "dmsFk" + } + } +} \ No newline at end of file From 16bf0b34484cef1711d90c172f17fcceed7a8fc0 Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Fri, 26 Apr 2019 08:52:43 +0200 Subject: [PATCH 40/59] regenerate invoice #1342 --- .eslintrc.yml | 1 + e2e/helpers/selectors.js | 4 +- front/core/components/drop-down/drop-down.js | 2 + .../back/methods/invoiceOut/regenerate.js | 48 ++++++++++++ .../invoiceOut/specs/regenerate.spec.js | 39 ++++++++++ modules/invoiceOut/back/models/invoiceOut.js | 1 + .../invoiceOut/back/models/invoiceOut.json | 2 +- modules/ticket/front/card/index.js | 1 + modules/ticket/front/descriptor/index.html | 13 +++- modules/ticket/front/descriptor/index.js | 77 ++++++++++++++++--- modules/ticket/front/descriptor/index.spec.js | 19 ++++- modules/ticket/front/descriptor/locale/es.yml | 8 +- 12 files changed, 193 insertions(+), 22 deletions(-) create mode 100644 modules/invoiceOut/back/methods/invoiceOut/regenerate.js create mode 100644 modules/invoiceOut/back/methods/invoiceOut/specs/regenerate.spec.js diff --git a/.eslintrc.yml b/.eslintrc.yml index 247319137..163ff22a7 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -31,3 +31,4 @@ rules: curly: [error, multi-or-nest] indent: [error, 4] arrow-parens: [error, as-needed] + jasmine/no-focused-tests: 0 diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 41246bd13..d163c809d 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -330,7 +330,7 @@ export default { moreMenuDeleteStowawayButton: 'vn-ticket-descriptor vn-drop-down > vn-popover ul > li:nth-child(5)', moreMenuAddToTurn: `vn-ticket-descriptor vn-drop-down > vn-popover ul > li:nth-child(2)`, moreMenuDeleteTicket: `vn-ticket-descriptor vn-drop-down > vn-popover ul > li:nth-child(3)`, - moreMenuMakeInvoice: 'vn-ticket-descriptor vn-drop-down > vn-popover ul > li:nth-child(5)', + moreMenuMakeInvoice: 'vn-ticket-descriptor vn-drop-down > vn-popover ul > li[name="Make invoice"]', addStowawayDialogSecondTicket: 'vn-ticket-descriptor > vn-add-stowaway > vn-dialog vn-table vn-tr:nth-child(2)', shipSelectButton: 'vn-ticket-descriptor > div > div.body > div.quicklinks > vn-button-menu[icon="icon-stowaway"]', shipButton: 'vn-ticket-descriptor > div > div.body > div.quicklinks vn-icon[icon="icon-stowaway"]', @@ -339,7 +339,7 @@ export default { saturdayButton: `vn-ticket-descriptor > vn-dialog > div > form > div.body > tpl-body > div > vn-tool-bar > vn-button:nth-child(6)`, closeStowawayDialog: 'vn-ticket-descriptor > vn-add-stowaway > vn-dialog > div > button[class="close"]', acceptDeleteButton: 'vn-ticket-descriptor button[response="ACCEPT"]', - acceptInvoiceOutButton: 'vn-ticket-descriptor vn-confirm[vn-id="invoiceMakeConfirmation"] button[response="ACCEPT"]', + acceptInvoiceOutButton: 'vn-ticket-descriptor vn-confirm[vn-id="makeInvoiceConfirmation"] button[response="ACCEPT"]', acceptDeleteStowawayButton: 'vn-ticket-descriptor > vn-remove-stowaway button[response="ACCEPT"]' }, ticketNotes: { diff --git a/front/core/components/drop-down/drop-down.js b/front/core/components/drop-down/drop-down.js index 123df1994..af9fc0bfa 100755 --- a/front/core/components/drop-down/drop-down.js +++ b/front/core/components/drop-down/drop-down.js @@ -285,6 +285,8 @@ export default class DropDown extends Component { } let li = this.document.createElement('li'); + + li.setAttribute('name', option[this.showField]); fragment.appendChild(li); if (this.multiple) { diff --git a/modules/invoiceOut/back/methods/invoiceOut/regenerate.js b/modules/invoiceOut/back/methods/invoiceOut/regenerate.js new file mode 100644 index 000000000..cf95d5af9 --- /dev/null +++ b/modules/invoiceOut/back/methods/invoiceOut/regenerate.js @@ -0,0 +1,48 @@ +module.exports = Self => { + Self.remoteMethodCtx('regenerate', { + description: 'Sends an invoice to a regeneration queue', + accepts: [{ + arg: 'id', + type: 'number', + required: true, + description: 'The invoiceOut id', + http: {source: 'path'} + }], + returns: { + type: 'object', + root: true + }, + http: { + path: `/:id/regenerate`, + verb: 'POST' + } + }); + + Self.regenerate = async(ctx, id) => { + const userId = ctx.req.accessToken.userId; + const models = Self.app.models; + const invoiceReportFk = 30; // FIXME - Should be deprecated + const worker = await models.Worker.findOne({where: {userFk: userId}}); + const transaction = await Self.beginTransaction({}); + + try { + // Remove all invoice references from tickets + const invoiceOut = await models.InvoiceOut.findById(id, {transaction}); + await invoiceOut.updateAttributes({ + hasPdf: false + }); + + // Send to print queue + await Self.rawSql(` + INSERT INTO vn.printServerQueue (reportFk, param1, workerFk) + VALUES (?, ?, ?)`, [invoiceReportFk, id, worker.id], {transaction}); + + await transaction.commit(); + + return invoiceOut; + } catch (e) { + await transaction.rollback(); + throw e; + } + }; +}; diff --git a/modules/invoiceOut/back/methods/invoiceOut/specs/regenerate.spec.js b/modules/invoiceOut/back/methods/invoiceOut/specs/regenerate.spec.js new file mode 100644 index 000000000..39e5f5171 --- /dev/null +++ b/modules/invoiceOut/back/methods/invoiceOut/specs/regenerate.spec.js @@ -0,0 +1,39 @@ +const app = require('vn-loopback/server/server'); + +describe('invoiceOut regenerate()', () => { + const invoiceReportFk = 30; // FIXME - Should be deprecated + const invoiceOutId = 1; + + afterAll(async done => { + const invoiceOut = await app.models.InvoiceOut.findById(invoiceOutId); + await invoiceOut.updateAttributes({hasPdf: true}); + await app.models.InvoiceOut.rawSql(` + DELETE FROM vn.printServerQueue + WHERE reportFk = ?`, [invoiceReportFk]); + + done(); + }); + + it('should check that the invoice has a PDF and is not in print generation queue', async() => { + const invoiceOut = await app.models.InvoiceOut.findById(invoiceOutId); + const [queue] = await app.models.InvoiceOut.rawSql(` + SELECT COUNT(*) AS total + FROM vn.printServerQueue + WHERE reportFk = ?`, [invoiceReportFk]); + + expect(invoiceOut.hasPdf).toBeTruthy(); + expect(queue.total).toEqual(0); + }); + + it(`should mark the invoice as doesn't have PDF and add it to a print queue`, async() => { + const ctx = {req: {accessToken: {userId: 5}}}; + const invoiceOut = await app.models.InvoiceOut.regenerate(ctx, invoiceOutId); + const [queue] = await app.models.InvoiceOut.rawSql(` + SELECT COUNT(*) AS total + FROM vn.printServerQueue + WHERE reportFk = ?`, [invoiceReportFk]); + + expect(invoiceOut.hasPdf).toBeFalsy(); + expect(queue.total).toEqual(1); + }); +}); diff --git a/modules/invoiceOut/back/models/invoiceOut.js b/modules/invoiceOut/back/models/invoiceOut.js index 2d7c691fc..726f26540 100644 --- a/modules/invoiceOut/back/models/invoiceOut.js +++ b/modules/invoiceOut/back/models/invoiceOut.js @@ -2,4 +2,5 @@ module.exports = Self => { require('../methods/invoiceOut/filter')(Self); require('../methods/invoiceOut/summary')(Self); require('../methods/invoiceOut/download')(Self); + require('../methods/invoiceOut/regenerate')(Self); }; diff --git a/modules/invoiceOut/back/models/invoiceOut.json b/modules/invoiceOut/back/models/invoiceOut.json index 7990949e9..0d8881de2 100644 --- a/modules/invoiceOut/back/models/invoiceOut.json +++ b/modules/invoiceOut/back/models/invoiceOut.json @@ -35,7 +35,7 @@ "type": "date" }, "hasPdf": { - "type": "Number", + "type": "Boolean", "mysql": { "columnName": "pdf" } diff --git a/modules/ticket/front/card/index.js b/modules/ticket/front/card/index.js index 9c1e45e78..2386b1bb6 100644 --- a/modules/ticket/front/card/index.js +++ b/modules/ticket/front/card/index.js @@ -7,6 +7,7 @@ class Controller { this.filter = { include: [ {relation: 'warehouse', scope: {fields: ['name']}}, + {relation: 'invoiceOut', scope: {fields: ['id']}}, {relation: 'address'}, {relation: 'ship'}, {relation: 'agencyMode', scope: {fields: ['name']}}, diff --git a/modules/ticket/front/descriptor/index.html b/modules/ticket/front/descriptor/index.html index 326a72695..6e77365c1 100644 --- a/modules/ticket/front/descriptor/index.html +++ b/modules/ticket/front/descriptor/index.html @@ -180,13 +180,22 @@ + + + + + \ No newline at end of file diff --git a/modules/ticket/front/descriptor/index.js b/modules/ticket/front/descriptor/index.js index 5d1c6253d..9578b7128 100644 --- a/modules/ticket/front/descriptor/index.js +++ b/modules/ticket/front/descriptor/index.js @@ -9,15 +9,34 @@ class Controller { this.$translate = $translate; this.aclService = aclService; this.moreOptions = [ - {callback: this.showAddTurnDialog, name: 'Add turn'}, - {callback: this.showAddStowaway, name: 'Add stowaway', show: () => this.isTicketModule()}, - {callback: this.showRemoveStowaway, name: 'Remove stowaway', show: () => this.shouldShowRemoveStowaway()}, - {callback: this.showInvoiceOutMakeDialog, name: 'Make invoice', acl: 'invoicing'}, - {callback: this.showDeliveryNote, name: 'Show Delivery Note'}, - {callback: this.showDeleteTicketDialog, name: 'Delete ticket'}, - {callback: this.showChangeShipped, name: 'Change shipped hour'}, - {callback: this.showSMSDialog, name: 'Send SMS'}, - {callback: this.openRptRoute, name: 'Show pallet report'} + {name: 'Add turn', callback: this.showAddTurnDialog}, + {name: 'Show Delivery Note', callback: this.showDeliveryNote}, + {name: 'Delete ticket', callback: this.showDeleteTicketDialog}, + {name: 'Change shipped hour', callback: this.showChangeShipped}, + {name: 'Send SMS', callback: this.showSMSDialog}, + {name: 'Show pallet report', callback: this.openRptRoute}, + { + name: 'Add stowaway', + callback: this.showAddStowaway, + show: () => this.isTicketModule() + }, + { + name: 'Remove stowaway', + callback: this.showRemoveStowaway, + show: () => this.shouldShowRemoveStowaway() + }, + { + name: 'Make invoice', + acl: 'invoicing', + callback: this.showMakeInvoiceDialog, + show: () => !this.hasInvoice() + }, + { + name: 'Regenerate invoice', + acl: 'invoicing', + callback: this.showRegenerateInvoiceDialog, + show: () => this.hasInvoice() + }, ]; } @@ -189,8 +208,8 @@ class Controller { /** * Shows an invoice confirmation */ - showInvoiceOutMakeDialog() { - this.$scope.invoiceMakeConfirmation.show(); + showMakeInvoiceDialog() { + this.$scope.makeInvoiceConfirmation.show(); } /** @@ -199,7 +218,7 @@ class Controller { * * @param {String} response - Response result */ - makeInvoiceOut(response) { + makeInvoice(response) { if (response === 'ACCEPT') { const query = `/ticket/api/Tickets/${this.ticket.id}/makeInvoice`; this.$http.post(query).then(() => { @@ -208,6 +227,40 @@ class Controller { }); } } + + /** + * Shows an invoice confirmation + */ + showRegenerateInvoiceDialog() { + this.$scope.regenerateInvoiceConfirmation.show(); + } + + /** + * Sends an invoice to a regeneration queue + * for the current ticket + * + * @param {String} response - Response result + */ + regenerateInvoice(response) { + if (response === 'ACCEPT') { + const invoiceId = this.ticket.invoiceOut.id; + const query = `/invoiceOut/api/InvoiceOuts/${invoiceId}/regenerate`; + this.$http.post(query).then(() => { + const snackbarMessage = this.$translate.instant( + `Invoice sent for a regeneration, will be available in a few minutes`); + this.vnApp.showSuccess(snackbarMessage); + }); + } + } + + /** + * Returns if the current ticket + * is already invoiced + * @return {Boolean} - True if invoiced + */ + hasInvoice() { + return this.ticket.refFk !== null; + } } Controller.$inject = ['$state', '$scope', '$http', 'vnApp', '$translate', 'aclService']; diff --git a/modules/ticket/front/descriptor/index.spec.js b/modules/ticket/front/descriptor/index.spec.js index 164ad8009..c799b16ec 100644 --- a/modules/ticket/front/descriptor/index.spec.js +++ b/modules/ticket/front/descriptor/index.spec.js @@ -9,7 +9,7 @@ describe('Ticket Component vnTicketDescriptor', () => { beforeEach(angular.mock.inject(($componentController, _$httpBackend_) => { $httpBackend = _$httpBackend_; controller = $componentController('vnTicketDescriptor'); - controller.ticket = {id: 2}; + controller.ticket = {id: 2, invoiceOut: {id: 1}}; })); describe('showAddTurnDialog()', () => { @@ -78,19 +78,32 @@ describe('Ticket Component vnTicketDescriptor', () => { }); }); - describe('invoiceMakeOut(response)', () => { + describe('makeInvoice(response)', () => { it('should make a query and call $state.reload() method if the response is ACCEPT', () => { spyOn(controller.$state, 'reload'); spyOn(controller.vnApp, 'showSuccess'); $httpBackend.when('POST', `/ticket/api/Tickets/2/makeInvoice`).respond(); $httpBackend.expect('POST', `/ticket/api/Tickets/2/makeInvoice`).respond(); - controller.makeInvoiceOut('ACCEPT'); + controller.makeInvoice('ACCEPT'); $httpBackend.flush(); expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Ticket invoiced'); expect(controller.$state.reload).toHaveBeenCalledWith(); }); }); + + describe('regenerateInvoice(response)', () => { + it('should make a query and show a success snackbar if the response is ACCEPT', () => { + spyOn(controller.vnApp, 'showSuccess'); + + $httpBackend.when('POST', `/invoiceOut/api/InvoiceOuts/1/regenerate`).respond(); + $httpBackend.expect('POST', `/invoiceOut/api/InvoiceOuts/1/regenerate`).respond(); + controller.regenerateInvoice('ACCEPT'); + $httpBackend.flush(); + + expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Invoice sent for a regeneration, will be available in a few minutes'); + }); + }); }); diff --git a/modules/ticket/front/descriptor/locale/es.yml b/modules/ticket/front/descriptor/locale/es.yml index a661c239f..1b6baed2a 100644 --- a/modules/ticket/front/descriptor/locale/es.yml +++ b/modules/ticket/front/descriptor/locale/es.yml @@ -15,6 +15,10 @@ SMSPayment: >- Verdnatura le comunica: Su pedido está pendiente de pago. Por favor, entre en la página web y efectue el pago con tarjeta. Muchas gracias. Ticket invoiced: Ticket facturado -Make invoice: Facturar +Make invoice: Crear factura +Regenerate invoice: Regenerar factura You are going to invoice this ticket: Vas a facturar este ticket -Are you sure you want to invoice this ticket?: ¿Seguro que quieres facturar este ticket? \ No newline at end of file +Are you sure you want to invoice this ticket?: ¿Seguro que quieres facturar este ticket? +You are going to regenerate the invoice: Vas a regenerar la factura +Are you sure you want to regenerate the invoice?: ¿Seguro que quieres regenerar la factura? +Invoice sent for a regeneration, will be available in a few minutes: La factura ha sido enviada para ser regenerada, estará disponible en unos minutos \ No newline at end of file From ed8705a50cc4cc326d78587aa0b9569cbdb684ec Mon Sep 17 00:00:00 2001 From: Bernat Date: Fri, 26 Apr 2019 12:05:49 +0200 Subject: [PATCH 41/59] #1340 invoiceOut.descriptor delete invoiceOut --- db/changes/10003-easter/00-ACL.sql | 1 + .../back/methods/invoiceOut/delete.js | 45 +++++++++++++++++++ .../methods/invoiceOut/specs/delete.spec.js | 38 ++++++++++++++++ modules/invoiceOut/back/models/invoiceOut.js | 1 + .../invoiceOut/front/descriptor/index.html | 18 ++++---- modules/invoiceOut/front/descriptor/index.js | 36 +++++++++++++-- .../invoiceOut/front/descriptor/locale/es.yml | 5 ++- 7 files changed, 130 insertions(+), 14 deletions(-) create mode 100644 db/changes/10003-easter/00-ACL.sql create mode 100644 modules/invoiceOut/back/methods/invoiceOut/delete.js create mode 100644 modules/invoiceOut/back/methods/invoiceOut/specs/delete.spec.js diff --git a/db/changes/10003-easter/00-ACL.sql b/db/changes/10003-easter/00-ACL.sql new file mode 100644 index 000000000..e92e14f8a --- /dev/null +++ b/db/changes/10003-easter/00-ACL.sql @@ -0,0 +1 @@ +INSERT INTO `salix`.`ACL` (`id`, `model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES (162, 'InvoiceOut', 'delete', 'WRITE', 'ALLOW', 'ROLE', 'invoicing'); diff --git a/modules/invoiceOut/back/methods/invoiceOut/delete.js b/modules/invoiceOut/back/methods/invoiceOut/delete.js new file mode 100644 index 000000000..0883952e8 --- /dev/null +++ b/modules/invoiceOut/back/methods/invoiceOut/delete.js @@ -0,0 +1,45 @@ + +module.exports = Self => { + Self.remoteMethod('delete', { + description: 'Delete a invoiceOut', + accessType: 'WRITE', + accepts: { + arg: 'id', + type: 'string', + required: true, + description: 'The invoiceOut id', + http: {source: 'path'} + }, + returns: { + type: 'object', + root: true + }, + http: { + path: `/:id/delete`, + verb: 'POST' + } + }); + + Self.delete = async id => { + const transaction = await Self.beginTransaction({}); + try { + let invoiceOut = await Self.findById(id); + let tickets = await Self.app.models.Ticket.find({where: {refFk: invoiceOut.ref}}); + + const promises = []; + tickets.forEach(ticket => { + promises.push(ticket.updateAttribute('refFk', null, {transaction})); + }); + + return Promise.all(promises).then(async() => { + await invoiceOut.destroy({transaction}); + await transaction.commit(); + + return tickets; + }); + } catch (e) { + await transaction.rollback(); + throw e; + } + }; +}; diff --git a/modules/invoiceOut/back/methods/invoiceOut/specs/delete.spec.js b/modules/invoiceOut/back/methods/invoiceOut/specs/delete.spec.js new file mode 100644 index 000000000..560837a68 --- /dev/null +++ b/modules/invoiceOut/back/methods/invoiceOut/specs/delete.spec.js @@ -0,0 +1,38 @@ +const app = require('vn-loopback/server/server'); + +describe('invoiceOut delete()', () => { + const invoiceOutId = 2; + let OriginalInvoice; + let OriginalTickets; + afterAll(async done => { + const newInvoice = await app.models.InvoiceOut.create(OriginalInvoice); + await newInvoice.updateAttribute('ref', OriginalInvoice.ref); + + const promises = []; + OriginalTickets.forEach(ticket => { + promises.push(ticket.updateAttribute('refFk', newInvoice.ref)); + }); + Promise.all(promises); + + done(); + }); + + it('should check that there is two tickets from the invoice id 2', async() => { + const invoiceOut = await app.models.InvoiceOut.findById(invoiceOutId); + const tickets = await app.models.Ticket.find({where: {refFk: invoiceOut.ref}}); + + expect(tickets.length).toEqual(2); + expect(tickets[0].id).toEqual(2); + }); + + it(`should check the two tickets from the invoice id 2 that are not invoiced`, async() => { + OriginalInvoice = await app.models.InvoiceOut.findById(invoiceOutId); + await app.models.InvoiceOut.delete(invoiceOutId); + OriginalTickets = await app.models.Ticket.find({where: {id: {inq: [2, 3]}}}); + const invoice = await app.models.InvoiceOut.findById(invoiceOutId); + + expect(OriginalTickets[0].refFk).toBeNull(); + expect(OriginalTickets[1].refFk).toBeNull(); + expect(invoice).toBeNull(); + }); +}); diff --git a/modules/invoiceOut/back/models/invoiceOut.js b/modules/invoiceOut/back/models/invoiceOut.js index 726f26540..ccc598989 100644 --- a/modules/invoiceOut/back/models/invoiceOut.js +++ b/modules/invoiceOut/back/models/invoiceOut.js @@ -3,4 +3,5 @@ module.exports = Self => { require('../methods/invoiceOut/summary')(Self); require('../methods/invoiceOut/download')(Self); require('../methods/invoiceOut/regenerate')(Self); + require('../methods/invoiceOut/delete')(Self); }; diff --git a/modules/invoiceOut/front/descriptor/index.html b/modules/invoiceOut/front/descriptor/index.html index ae0694227..ccc5d424e 100644 --- a/modules/invoiceOut/front/descriptor/index.html +++ b/modules/invoiceOut/front/descriptor/index.html @@ -13,7 +13,8 @@ value-field="callback" translate-fields="['name']" data="$ctrl.moreOptions" - on-change="$ctrl.onMoreChange(value)"> + on-change="$ctrl.onMoreChange(value)" + on-open="$ctrl.onMoreOpen()">
@@ -49,14 +50,11 @@ icon="{{::$ctrl.quicklinks.btnTwo.icon}}"> - - - -
-
\ No newline at end of file +
+ + \ No newline at end of file diff --git a/modules/invoiceOut/front/descriptor/index.js b/modules/invoiceOut/front/descriptor/index.js index f8ceab5e7..957b3ac4d 100644 --- a/modules/invoiceOut/front/descriptor/index.js +++ b/modules/invoiceOut/front/descriptor/index.js @@ -1,13 +1,29 @@ import ngModule from '../module'; class Controller { - constructor(vnToken) { + constructor($scope, vnToken, vnApp, $state, $translate, $http, aclService) { + this.$scope = $scope; this.accessToken = vnToken.token; + this.vnApp = vnApp; + this.$state = $state; + this.$translate = $translate; + this.$http = $http; + this.aclService = aclService; this.moreOptions = [ - {callback: this.showInvoiceOutPdf, name: 'Show invoice out PDF'} + {callback: this.showInvoiceOutPdf, name: 'Show invoice out PDF'}, + {callback: this.showDeleteInvoiceOutDialog, name: 'Delete InvoiceOut', acl: 'invoicing'} ]; } + onMoreOpen() { + let options = this.moreOptions.filter(option => { + const hasAclProperty = Object.hasOwnProperty.call(option, 'acl'); + + return !hasAclProperty || (hasAclProperty && this.aclService.hasAny([option.acl])); + }); + this.$scope.moreButton.data = options; + } + onMoreChange(callback) { callback.call(this); } @@ -40,6 +56,20 @@ class Controller { window.open(url, '_blank'); } + showDeleteInvoiceOutDialog() { + this.$scope.deleteConfirmation.show(); + } + + deleteInvoiceOut(response) { + if (response === 'ACCEPT') { + const query = `/invoiceOut/api/InvoiceOuts/${this.invoiceOut.id}/delete`; + this.$http.post(query).then(() => { + this.vnApp.showSuccess(this.$translate.instant('InvoiceOut deleted')); + this.$state.go('invoiceOut.index'); + }); + } + } + set quicklinks(value = {}) { this._quicklinks = Object.assign(value, this._quicklinks); } @@ -49,7 +79,7 @@ class Controller { } } -Controller.$inject = ['vnToken']; +Controller.$inject = ['$scope', 'vnToken', 'vnApp', '$state', '$translate', '$http', 'aclService']; ngModule.component('vnInvoiceOutDescriptor', { template: require('./index.html'), diff --git a/modules/invoiceOut/front/descriptor/locale/es.yml b/modules/invoiceOut/front/descriptor/locale/es.yml index 490139184..6a77a268c 100644 --- a/modules/invoiceOut/front/descriptor/locale/es.yml +++ b/modules/invoiceOut/front/descriptor/locale/es.yml @@ -2,4 +2,7 @@ Volume exceded: Volumen excedido Volume: Volumen Client card: Ficha del cliente Invoice ticket list: Listado de tickets de la factura -Show invoice out PDF: Ver factura emitida en PDF \ No newline at end of file +Show invoice out PDF: Ver factura emitida en PDF +Delete InvoiceOut: Borrar factura +InvoiceOut deleted: Factura eliminada +Are you sure you want to delete this invoice?: Estas seguro de eliminar esta factura? \ No newline at end of file From 145a5e85eb291f8f1688a81902f502327b3c6a3a Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Fri, 26 Apr 2019 12:41:30 +0200 Subject: [PATCH 42/59] dropdown element name without translation --- front/core/components/drop-down/drop-down.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/front/core/components/drop-down/drop-down.js b/front/core/components/drop-down/drop-down.js index af9fc0bfa..d1cc11601 100755 --- a/front/core/components/drop-down/drop-down.js +++ b/front/core/components/drop-down/drop-down.js @@ -277,6 +277,7 @@ export default class DropDown extends Component { if (data) { for (let i = 0; i < data.length; i++) { let option = data[i]; + option.orgShowField = option[this.showField]; if (this.translateFields) { option = Object.assign({}, option); @@ -286,7 +287,7 @@ export default class DropDown extends Component { let li = this.document.createElement('li'); - li.setAttribute('name', option[this.showField]); + li.setAttribute('name', option.orgShowField); fragment.appendChild(li); if (this.multiple) { From b6a1e884df881535d9a28d874f157dda60e972f0 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Fri, 26 Apr 2019 14:15:37 +0200 Subject: [PATCH 43/59] #1383 Drop down selectors --- e2e/helpers/components_selectors.js | 3 - e2e/helpers/selectors.js | 419 ++++++++++++++-------------- 2 files changed, 206 insertions(+), 216 deletions(-) diff --git a/e2e/helpers/components_selectors.js b/e2e/helpers/components_selectors.js index 9afd06374..4cd8241ab 100644 --- a/e2e/helpers/components_selectors.js +++ b/e2e/helpers/components_selectors.js @@ -1,6 +1,3 @@ -// eslint max-len: ["error", 500] -// eslint key-spacing: ["error", 500] - export default { vnTextfield: 'vn-textfield > div > div > div > input', vnInputNumber: 'vn-input-number > div > div > div > input', diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index d163c809d..ec6bd1348 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -2,30 +2,30 @@ import components from './components_selectors.js'; export default { globalItems: { - applicationsMenuButton: `#apps`, - applicationsMenuVisible: `vn-main-menu [vn-id="apps-menu"] ul`, - clientsButton: `vn-main-menu [vn-id="apps-menu"] ul > li[ui-sref="client.index"]`, - itemsButton: `vn-main-menu [vn-id="apps-menu"] ul > li[ui-sref="item.index"]`, - ticketsButton: `vn-main-menu [vn-id="apps-menu"] ul > li[ui-sref="ticket.index"]`, - claimsButton: `vn-main-menu [vn-id="apps-menu"] ul > li[ui-sref="claim.index"]`, + applicationsMenuButton: '#apps', + applicationsMenuVisible: 'vn-main-menu [vn-id="apps-menu"] ul', + clientsButton: 'vn-main-menu [vn-id="apps-menu"] ul > li[ui-sref="client.index"]', + itemsButton: 'vn-main-menu [vn-id="apps-menu"] ul > li[ui-sref="item.index"]', + ticketsButton: 'vn-main-menu [vn-id="apps-menu"] ul > li[ui-sref="ticket.index"]', + claimsButton: 'vn-main-menu [vn-id="apps-menu"] ul > li[ui-sref="claim.index"]', returnToModuleIndexButton: `a[translate-attr="{title: 'Return to module index'}"]`, - userMenuButton: `vn-topbar #user`, - userLocalWarehouse: `vn-topbar vn-popover vn-autocomplete[field="$ctrl.localWarehouseFk"]`, - userLocalBank: `vn-topbar vn-popover vn-autocomplete[field="$ctrl.localBankFk"]`, - userLocalCompany: `vn-topbar vn-popover vn-autocomplete[field="$ctrl.localCompanyFk"]`, - userWarehouse: `vn-topbar vn-popover vn-autocomplete[field="$ctrl.warehouseFk"]`, - userCompany: `vn-topbar vn-popover vn-autocomplete[field="$ctrl.companyFk"]`, + userMenuButton: 'vn-topbar #user', + userLocalWarehouse: 'vn-topbar vn-popover vn-autocomplete[field="$ctrl.localWarehouseFk"]', + userLocalBank: 'vn-topbar vn-popover vn-autocomplete[field="$ctrl.localBankFk"]', + userLocalCompany: 'vn-topbar vn-popover vn-autocomplete[field="$ctrl.localCompanyFk"]', + userWarehouse: 'vn-topbar vn-popover vn-autocomplete[field="$ctrl.warehouseFk"]', + userCompany: 'vn-topbar vn-popover vn-autocomplete[field="$ctrl.companyFk"]', userConfigFirstAutocompleteClear: '#localWarehouse > div > div > div > vn-icon.clear', userConfigSecondAutocompleteClear: '#localBank > div > div > div > vn-icon.clear', userConfigThirdAutocompleteClear: '#localCompany > div > div > div > vn-icon.clear', - acceptVnConfirm: `vn-confirm button[response=ACCEPT]` + acceptVnConfirm: 'vn-confirm button[response=ACCEPT]' }, clientsIndex: { searchClientInput: `${components.vnTextfield}`, - searchButton: `vn-searchbar vn-icon[icon="search"]`, - searchResult: `vn-client-index .vn-list-item`, + searchButton: 'vn-searchbar vn-icon[icon="search"]', + searchResult: 'vn-client-index .vn-list-item', createClientButton: `${components.vnFloatButton}`, - othersButton: `vn-left-menu li[name="Others"] > a` + othersButton: 'vn-left-menu li[name="Others"] > a' }, createClientView: { name: `${components.vnTextfield}[name="name"]`, @@ -37,53 +37,53 @@ export default { email: `${components.vnTextfield}[name="email"]`, salesPersonAutocomplete: `vn-autocomplete[field="$ctrl.client.salesPersonFk"]`, createButton: `${components.vnSubmit}`, - cancelButton: `vn-button[href="#!/client/index"]` + cancelButton: 'vn-button[href="#!/client/index"]' }, clientDescriptor: { - moreMenu: `vn-client-descriptor vn-icon-menu > div > vn-icon`, + moreMenu: 'vn-client-descriptor vn-icon-menu > div > vn-icon', simpleTicketButton: 'vn-client-descriptor vn-popover > div > div.content > div > div.list > ul > li' }, clientBasicData: { - basicDataButton: `vn-left-menu a[ui-sref="client.card.basicData"]`, + basicDataButton: 'vn-left-menu a[ui-sref="client.card.basicData"]', nameInput: `${components.vnTextfield}[name="name"]`, contactInput: `${components.vnTextfield}[name="contact"]`, phoneInput: `${components.vnTextfield}[name="phone"]`, mobileInput: `${components.vnTextfield}[name="mobile"]`, faxInput: `${components.vnTextfield}[name="fax"]`, emailInput: `${components.vnTextfield}[name="email"]`, - salesPersonAutocomplete: `vn-autocomplete[field="$ctrl.client.salesPersonFk"]`, - channelAutocomplete: `vn-autocomplete[field="$ctrl.client.contactChannelFk"]`, + salesPersonAutocomplete: 'vn-autocomplete[field="$ctrl.client.salesPersonFk"]', + channelAutocomplete: 'vn-autocomplete[field="$ctrl.client.contactChannelFk"]', saveButton: `${components.vnSubmit}` }, clientFiscalData: { - fiscalDataButton: `vn-left-menu a[ui-sref="client.card.fiscalData"]`, + fiscalDataButton: 'vn-left-menu a[ui-sref="client.card.fiscalData"]', socialNameInput: `${components.vnTextfield}[name="socialName"]`, fiscalIdInput: `${components.vnTextfield}[name="fi"]`, - equalizationTaxCheckbox: `vn-check[label='Is equalizated'] md-checkbox`, - acceptPropagationButton: `vn-client-fiscal-data > vn-confirm button[response=ACCEPT]`, + equalizationTaxCheckbox: 'vn-check[label="Is equalizated"] md-checkbox', + acceptPropagationButton: 'vn-client-fiscal-data > vn-confirm button[response=ACCEPT]', addressInput: `${components.vnTextfield}[name="street"]`, cityInput: `${components.vnTextfield}[name="city"]`, postcodeInput: `${components.vnTextfield}[name="postcode"]`, - provinceAutocomplete: `vn-autocomplete[field="$ctrl.client.provinceFk"]`, - countryAutocomplete: `vn-autocomplete[field="$ctrl.client.countryFk"]`, - activeCheckbox: `vn-check[label="Active"] md-checkbox`, - frozenCheckbox: `vn-check[label="Frozen"] md-checkbox`, - invoiceByAddressCheckbox: `vn-check[label='Invoice by address'] md-checkbox`, - verifiedDataCheckbox: `vn-check[label="Verified data"] md-checkbox`, - hasToInvoiceCheckbox: `vn-check[label='Has to invoice'] md-checkbox`, - invoiceByMailCheckbox: `vn-check[label='Invoice by mail'] md-checkbox`, - viesCheckbox: `vn-check[label='Vies'] md-checkbox`, + provinceAutocomplete: 'vn-autocomplete[field="$ctrl.client.provinceFk"]', + countryAutocomplete: 'vn-autocomplete[field="$ctrl.client.countryFk"]', + activeCheckbox: 'vn-check[label="Active"] md-checkbox', + frozenCheckbox: 'vn-check[label="Frozen"] md-checkbox', + invoiceByAddressCheckbox: 'vn-check[label="Invoice by address"] md-checkbox', + verifiedDataCheckbox: 'vn-check[label="Verified data"] md-checkbox', + hasToInvoiceCheckbox: 'vn-check[label="Has to invoice"] md-checkbox', + invoiceByMailCheckbox: 'vn-check[label="Invoice by mail"] md-checkbox', + viesCheckbox: 'vn-check[label="Vies"] md-checkbox', saveButton: `${components.vnSubmit}` }, clientBillingData: { - payMethodAutocomplete: `vn-autocomplete[field="$ctrl.client.payMethodFk"]`, + payMethodAutocomplete: 'vn-autocomplete[field="$ctrl.client.payMethodFk"]', IBANInput: `${components.vnTextfield}[name="iban"]`, dueDayInput: `${components.vnInputNumber}[name="dueDay"]`, - receivedCoreLCRCheckbox: `vn-check[label='Received LCR'] md-checkbox`, - receivedCoreVNLCheckbox: `vn-check[label='Received core VNL'] md-checkbox`, - receivedB2BVNLCheckbox: `vn-check[label='Received B2B VNL'] md-checkbox`, + receivedCoreLCRCheckbox: 'vn-check[label="Received LCR"] md-checkbox', + receivedCoreVNLCheckbox: 'vn-check[label="Received core VNL"] md-checkbox', + receivedB2BVNLCheckbox: 'vn-check[label="Received B2B VNL"] md-checkbox', swiftBicAutocomplete: 'vn-client-billing-data vn-autocomplete[field="$ctrl.client.bankEntityFk"]', - clearswiftBicButton: `vn-client-billing-data vn-autocomplete[field="$ctrl.client.bankEntityFk"] > div > div > div > vn-icon > i`, + clearswiftBicButton: 'vn-client-billing-data vn-autocomplete[field="$ctrl.client.bankEntityFk"] > div > div > div > vn-icon > i', newBankEntityButton: 'vn-client-billing-data vn-icon-button[vn-tooltip="New bank entity"] > button', newBankEntityName: 'vn-client-billing-data > vn-dialog vn-textfield[label="Name"] input', newBankEntityBIC: 'vn-client-billing-data > vn-dialog vn-textfield[label="Swift / BIC"] input', @@ -92,41 +92,41 @@ export default { saveButton: `${components.vnSubmit}` }, clientAddresses: { - addressesButton: `vn-left-menu a[ui-sref="client.card.address.index"]`, + addressesButton: 'vn-left-menu a[ui-sref="client.card.address.index"]', createAddress: `vn-client-address-index ${components.vnFloatButton}`, - defaultCheckboxInput: `vn-check[label='Default'] md-checkbox`, + defaultCheckboxInput: 'vn-check[label="Default"] md-checkbox', consigneeInput: `${components.vnTextfield}[name="nickname"]`, streetAddressInput: `${components.vnTextfield}[name="street"]`, postcodeInput: `${components.vnTextfield}[name="postalCode"]`, cityInput: `${components.vnTextfield}[name="city"]`, - provinceAutocomplete: `vn-autocomplete[field="$ctrl.address.provinceFk"]`, - agencyAutocomplete: `vn-autocomplete[field="$ctrl.address.agencyModeFk"]`, + provinceAutocomplete: 'vn-autocomplete[field="$ctrl.address.provinceFk"]', + agencyAutocomplete: 'vn-autocomplete[field="$ctrl.address.agencyModeFk"]', phoneInput: `${components.vnTextfield}[name="phone"]`, mobileInput: `${components.vnTextfield}[name="mobile"]`, defaultAddress: 'vn-client-address-index vn-horizontal:nth-child(1) div[name="street"]', secondMakeDefaultStar: 'vn-client-address-index vn-card vn-horizontal:nth-child(2) vn-icon-button[icon="star_border"]', - firstEditButton: `vn-client-address-index vn-icon-button[icon='edit']`, - secondEditButton: `vn-client-address-index vn-horizontal:nth-child(2) vn-icon-button[icon='edit']`, - activeCheckbox: `vn-check[label='Enabled'] md-checkbox`, - equalizationTaxCheckbox: `vn-client-address-edit vn-check[label="Is equalizated"] md-checkbox`, - firstObservationTypeAutocomplete: `vn-client-address-edit [name=observations] :nth-child(1) [field="observation.observationTypeFk"]`, - firstObservationDescriptionInput: `vn-client-address-edit [name=observations] :nth-child(1) [model="observation.description"] input`, - secondObservationTypeAutocomplete: `vn-client-address-edit [name=observations] :nth-child(2) [field="observation.observationTypeFk"]`, - secondObservationDescriptionInput: `vn-client-address-edit [name=observations] :nth-child(2) [model="observation.description"] input`, - addObservationButton: `vn-client-address-edit vn-icon-button[icon="add_circle"]`, + firstEditButton: 'vn-client-address-index vn-icon-button[icon="edit"]', + secondEditButton: 'vn-client-address-index vn-horizontal:nth-child(2) vn-icon-button[icon="edit"]', + activeCheckbox: 'vn-check[label="Enabled"] md-checkbox', + equalizationTaxCheckbox: 'vn-client-address-edit vn-check[label="Is equalizated"] md-checkbox', + firstObservationTypeAutocomplete: 'vn-client-address-edit [name=observations] :nth-child(1) [field="observation.observationTypeFk"]', + firstObservationDescriptionInput: 'vn-client-address-edit [name=observations] :nth-child(1) [model="observation.description"] input', + secondObservationTypeAutocomplete: 'vn-client-address-edit [name=observations] :nth-child(2) [field="observation.observationTypeFk"]', + secondObservationDescriptionInput: 'vn-client-address-edit [name=observations] :nth-child(2) [model="observation.description"] input', + addObservationButton: 'vn-client-address-edit vn-icon-button[icon="add_circle"]', saveButton: `${components.vnSubmit}`, - cancelCreateAddressButton: `button[ui-sref="client.card.address.index"]`, + cancelCreateAddressButton: 'button[ui-sref="client.card.address.index"]', cancelEditAddressButton: 'vn-client-address-edit > form > vn-button-bar > vn-button > button' }, clientWebAccess: { - webAccessButton: `vn-left-menu a[ui-sref="client.card.webAccess"]`, - enableWebAccessCheckbox: `vn-check[label='Enable web access'] md-checkbox`, + webAccessButton: 'vn-left-menu a[ui-sref="client.card.webAccess"]', + enableWebAccessCheckbox: 'vn-check[label="Enable web access"] md-checkbox', userNameInput: `${components.vnTextfield}[name="name"]`, saveButton: `${components.vnSubmit}` }, clientNotes: { addNoteFloatButton: `${components.vnFloatButton}`, - noteInput: `vn-textarea[label="Note"]`, + noteInput: 'vn-textarea[label="Note"]', saveButton: `${components.vnSubmit}`, firstNoteText: 'vn-client-note .text' }, @@ -140,7 +140,7 @@ export default { addGreugeFloatButton: `${components.vnFloatButton}`, amountInput: `${components.vnInputNumber}[name="amount"]`, descriptionInput: `${components.vnTextfield}[name="description"]`, - typeAutocomplete: `vn-autocomplete[field="$ctrl.greuge.greugeTypeFk"]`, + typeAutocomplete: 'vn-autocomplete[field="$ctrl.greuge.greugeTypeFk"]', saveButton: `${components.vnSubmit}`, firstGreugeText: 'vn-client-greuge-index vn-card > div vn-table vn-tbody > vn-tr' }, @@ -151,19 +151,19 @@ export default { firstInvoiceText: 'vn-client-invoice vn-card > div vn-table vn-tbody > vn-tr' }, clientLog: { - logButton: `vn-left-menu a[ui-sref="client.card.log"]`, + logButton: 'vn-left-menu a[ui-sref="client.card.log"]', lastModificationDate: 'vn-client-log > vn-log vn-table vn-tbody > vn-tr > vn-td:nth-child(1)', lastModificationPreviousValue: 'vn-client-log vn-table vn-td.before', lastModificationCurrentValue: 'vn-client-log vn-table vn-td.after' }, clientBalance: { - balanceButton: `vn-left-menu a[ui-sref="client.card.balance.index"]`, + balanceButton: 'vn-left-menu a[ui-sref="client.card.balance.index"]', companyAutocomplete: 'vn-client-balance-index vn-autocomplete[field="$ctrl.companyFk"]', newPaymentButton: `${components.vnFloatButton}`, - newPaymentBankInut: `vn-client-balance-create vn-textfield[field="$ctrl.receipt.bankFk"] input`, - newPaymentAmountInput: `vn-client-balance-create vn-input-number[field="$ctrl.receipt.amountPaid"] input`, - saveButton: `vn-client-balance-create vn-button[label="Save"]`, + newPaymentBankInut: 'vn-client-balance-create vn-textfield[field="$ctrl.receipt.bankFk"] input', + newPaymentAmountInput: 'vn-client-balance-create vn-input-number[field="$ctrl.receipt.amountPaid"] input', + saveButton: 'vn-client-balance-create vn-button[label="Save"]', firstBalanceLine: 'vn-client-balance-index vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(8)' }, @@ -172,15 +172,15 @@ export default { firstPaymentConfirmed: 'vn-client-web-payment vn-tr:nth-child(1) vn-icon[icon="check"][aria-hidden="false"]' }, itemsIndex: { - searchIcon: `vn-item-index vn-searchbar vn-icon[icon="search"]`, - goBackToModuleIndexButton: `vn-item-descriptor a[href="#!/item/index"]`, + searchIcon: 'vn-item-index vn-searchbar vn-icon[icon="search"]', + goBackToModuleIndexButton: 'vn-item-descriptor a[href="#!/item/index"]', createItemButton: `${components.vnFloatButton}`, - searchResult: `vn-item-index a.vn-tr`, - searchResultPreviewButton: `vn-item-index .buttons > [icon="desktop_windows"]`, - searchResultCloneButton: `vn-item-index .buttons > [icon="icon-clone"]`, - acceptClonationAlertButton: `vn-item-index [vn-id="clone"] [response="ACCEPT"]`, - searchItemInput: `vn-searchbar vn-textfield input`, - searchButton: `vn-searchbar vn-icon[icon="search"]`, + searchResult: 'vn-item-index a.vn-tr', + searchResultPreviewButton: 'vn-item-index .buttons > [icon="desktop_windows"]', + searchResultCloneButton: 'vn-item-index .buttons > [icon="icon-clone"]', + acceptClonationAlertButton: 'vn-item-index [vn-id="clone"] [response="ACCEPT"]', + searchItemInput: 'vn-searchbar vn-textfield input', + searchButton: 'vn-searchbar vn-icon[icon="search"]', closeItemSummaryPreview: 'vn-item-index [vn-id="preview"] button.close', fieldsToShowButton: 'vn-item-index vn-table > div.ng-scope > div > vn-icon-button[icon="menu"]', fieldsToShowForm: 'vn-item-index > div > vn-card > div > vn-table > div.ng-scope > div > vn-dialog > div > form', @@ -201,90 +201,90 @@ export default { }, itemCreateView: { temporalName: `${components.vnTextfield}[name="provisionalName"]`, - typeAutocomplete: `vn-autocomplete[field="$ctrl.item.typeFk"]`, - intrastatAutocomplete: `vn-autocomplete[field="$ctrl.item.intrastatFk"]`, - originAutocomplete: `vn-autocomplete[field="$ctrl.item.originFk"]`, + typeAutocomplete: 'vn-autocomplete[field="$ctrl.item.typeFk"]', + intrastatAutocomplete: 'vn-autocomplete[field="$ctrl.item.intrastatFk"]', + originAutocomplete: 'vn-autocomplete[field="$ctrl.item.originFk"]', createButton: `${components.vnSubmit}`, - cancelButton: `button[ui-sref="item.index"]` + cancelButton: 'button[ui-sref="item.index"]' }, itemDescriptor: { - moreMenu: `vn-item-descriptor vn-icon-menu > div > vn-icon`, - moreMenuRegularizeButton: `vn-item-descriptor vn-icon-menu > div > vn-drop-down > vn-popover ul > li:nth-child(1)`, - regularizeQuantityInput: `vn-item-descriptor > vn-dialog > div > form > div.body > tpl-body > div > vn-textfield > div > div > div.infix > input`, + moreMenu: 'vn-item-descriptor vn-icon-menu > div > vn-icon', + moreMenuRegularizeButton: 'vn-item-descriptor vn-drop-down > vn-popover ul > li[name="Regularize stock"]', + regularizeQuantityInput: 'vn-item-descriptor > vn-dialog > div > form > div.body > tpl-body > div > vn-textfield > div > div > div.infix > input', regularizeWarehouseAutocomplete: 'vn-item-descriptor vn-dialog vn-autocomplete[field="$ctrl.warehouseFk"]', editButton: 'vn-item-card vn-item-descriptor vn-float-button[icon="edit"]', - regularizeSaveButton: `vn-item-descriptor > vn-dialog > div > form > div.buttons > tpl-buttons > button`, + regularizeSaveButton: 'vn-item-descriptor > vn-dialog > div > form > div.buttons > tpl-buttons > button', inactiveIcon: 'vn-item-descriptor vn-icon[icon="icon-unavailable"]', navigateBackToIndex: 'vn-item-descriptor vn-icon[icon="chevron_left"]' }, itemBasicData: { - basicDataButton: `vn-left-menu a[ui-sref="item.card.basicData"]`, + basicDataButton: 'vn-left-menu a[ui-sref="item.card.basicData"]', goToItemIndexButton: 'vn-item-descriptor [ui-sref="item.index"]', - typeAutocomplete: `vn-autocomplete[field="$ctrl.item.typeFk"]`, - intrastatAutocomplete: `vn-autocomplete[field="$ctrl.item.intrastatFk"]`, - nameInput: `vn-textfield[label="Name"] input`, - relevancyInput: `vn-input-number[label="Relevancy"] input`, - originAutocomplete: `vn-autocomplete[field="$ctrl.item.originFk"]`, - expenceAutocomplete: `vn-autocomplete[field="$ctrl.item.expenceFk"]`, - longNameInput: `vn-textfield[field="$ctrl.item.longName"] input`, - isActiveCheckbox: `vn-check[label='Active'] md-checkbox`, + typeAutocomplete: 'vn-autocomplete[field="$ctrl.item.typeFk"]', + intrastatAutocomplete: 'vn-autocomplete[field="$ctrl.item.intrastatFk"]', + nameInput: 'vn-textfield[label="Name"] input', + relevancyInput: 'vn-input-number[label="Relevancy"] input', + originAutocomplete: 'vn-autocomplete[field="$ctrl.item.originFk"]', + expenceAutocomplete: 'vn-autocomplete[field="$ctrl.item.expenceFk"]', + longNameInput: 'vn-textfield[field="$ctrl.item.longName"] input', + isActiveCheckbox: 'vn-check[label="Active"] md-checkbox', submitBasicDataButton: `${components.vnSubmit}` }, itemTags: { goToItemIndexButton: 'vn-item-descriptor [ui-sref="item.index"]', - tagsButton: `vn-left-menu a[ui-sref="item.card.tags"]`, - fourthTagAutocomplete: `vn-item-tags vn-horizontal:nth-child(4) > vn-autocomplete[field="itemTag.tagFk"]`, - fourthValueInput: `vn-item-tags vn-horizontal:nth-child(4) > vn-textfield[label="Value"] input`, - fourthRelevancyInput: `vn-item-tags vn-horizontal:nth-child(4) > vn-textfield[label="Relevancy"] input`, - fourthRemoveTagButton: `vn-item-tags vn-horizontal:nth-child(4) vn-icon-button[icon="delete"]`, - fifthTagAutocomplete: `vn-item-tags vn-horizontal:nth-child(5) > vn-autocomplete[field="itemTag.tagFk"]`, - fifthValueInput: `vn-item-tags vn-horizontal:nth-child(5) > vn-textfield[label="Value"] input`, - fifthRelevancyInput: `vn-item-tags vn-horizontal:nth-child(5) > vn-textfield[label="Relevancy"] input`, - sixthTagAutocomplete: `vn-item-tags vn-horizontal:nth-child(6) > vn-autocomplete[field="itemTag.tagFk"]`, - sixthValueInput: `vn-item-tags vn-horizontal:nth-child(6) > vn-textfield[label="Value"] input`, - sixthRelevancyInput: `vn-item-tags vn-horizontal:nth-child(6) > vn-textfield[label="Relevancy"] input`, - seventhTagAutocomplete: `vn-item-tags vn-horizontal:nth-child(7) > vn-autocomplete[field="itemTag.tagFk"]`, - seventhValueInput: `vn-item-tags vn-horizontal:nth-child(7) > vn-textfield[label="Value"] input`, - seventhRelevancyInput: `vn-item-tags vn-horizontal:nth-child(7) > vn-textfield[label="Relevancy"] input`, - addItemTagButton: `vn-item-tags vn-icon-button[icon="add_circle"]`, + tagsButton: 'vn-left-menu a[ui-sref="item.card.tags"]', + fourthTagAutocomplete: 'vn-item-tags vn-horizontal:nth-child(4) > vn-autocomplete[field="itemTag.tagFk"]', + fourthValueInput: 'vn-item-tags vn-horizontal:nth-child(4) > vn-textfield[label="Value"] input', + fourthRelevancyInput: 'vn-item-tags vn-horizontal:nth-child(4) > vn-textfield[label="Relevancy"] input', + fourthRemoveTagButton: 'vn-item-tags vn-horizontal:nth-child(4) vn-icon-button[icon="delete"]', + fifthTagAutocomplete: 'vn-item-tags vn-horizontal:nth-child(5) > vn-autocomplete[field="itemTag.tagFk"]', + fifthValueInput: 'vn-item-tags vn-horizontal:nth-child(5) > vn-textfield[label="Value"] input', + fifthRelevancyInput: 'vn-item-tags vn-horizontal:nth-child(5) > vn-textfield[label="Relevancy"] input', + sixthTagAutocomplete: 'vn-item-tags vn-horizontal:nth-child(6) > vn-autocomplete[field="itemTag.tagFk"]', + sixthValueInput: 'vn-item-tags vn-horizontal:nth-child(6) > vn-textfield[label="Value"] input', + sixthRelevancyInput: 'vn-item-tags vn-horizontal:nth-child(6) > vn-textfield[label="Relevancy"] input', + seventhTagAutocomplete: 'vn-item-tags vn-horizontal:nth-child(7) > vn-autocomplete[field="itemTag.tagFk"]', + seventhValueInput: 'vn-item-tags vn-horizontal:nth-child(7) > vn-textfield[label="Value"] input', + seventhRelevancyInput: 'vn-item-tags vn-horizontal:nth-child(7) > vn-textfield[label="Relevancy"] input', + addItemTagButton: 'vn-item-tags vn-icon-button[icon="add_circle"]', submitItemTagsButton: `vn-item-tags ${components.vnSubmit}` }, itemTax: { - firstClassAutocomplete: `vn-item-tax vn-horizontal:nth-child(1) > vn-autocomplete[field="tax.taxClassFk"]`, - secondClassAutocomplete: `vn-item-tax vn-horizontal:nth-child(2) > vn-autocomplete[field="tax.taxClassFk"]`, - thirdClassAutocomplete: `vn-item-tax vn-horizontal:nth-child(3) > vn-autocomplete[field="tax.taxClassFk"]`, + firstClassAutocomplete: 'vn-item-tax vn-horizontal:nth-child(1) > vn-autocomplete[field="tax.taxClassFk"]', + secondClassAutocomplete: 'vn-item-tax vn-horizontal:nth-child(2) > vn-autocomplete[field="tax.taxClassFk"]', + thirdClassAutocomplete: 'vn-item-tax vn-horizontal:nth-child(3) > vn-autocomplete[field="tax.taxClassFk"]', submitTaxButton: `vn-item-tax ${components.vnSubmit}` }, itemBarcodes: { - addBarcodeButton: `vn-item-barcode vn-icon[icon="add_circle"]`, + addBarcodeButton: 'vn-item-barcode vn-icon[icon="add_circle"]', thirdCodeInput: `vn-item-barcode vn-horizontal:nth-child(3) > ${components.vnTextfield}`, submitBarcodesButton: `vn-item-barcode ${components.vnSubmit}`, - firstCodeRemoveButton: `vn-item-barcode vn-horizontal vn-none vn-icon[icon="delete"]` + firstCodeRemoveButton: 'vn-item-barcode vn-horizontal vn-none vn-icon[icon="delete"]' }, itemNiches: { - addNicheButton: `vn-item-niche vn-icon[icon="add_circle"]`, - firstWarehouseAutocomplete: `vn-item-niche vn-autocomplete[field="niche.warehouseFk"]`, - firstCodeInput: `vn-item-niche vn-horizontal:nth-child(1) > vn-textfield[label="Code"] input`, - secondWarehouseAutocomplete: `vn-item-niche vn-horizontal:nth-child(2) > vn-autocomplete[field="niche.warehouseFk"]`, - secondCodeInput: `vn-item-niche vn-horizontal:nth-child(2) > vn-textfield[label="Code"] input`, - secondNicheRemoveButton: `vn-item-niche vn-horizontal:nth-child(2) > vn-none > vn-icon-button[icon="delete"]`, - thirdWarehouseAutocomplete: `vn-item-niche vn-horizontal:nth-child(3) > vn-autocomplete[field="niche.warehouseFk"]`, - thirdCodeInput: `vn-item-niche vn-horizontal:nth-child(3) > vn-textfield[label="Code"] input`, + addNicheButton: 'vn-item-niche vn-icon[icon="add_circle"]', + firstWarehouseAutocomplete: 'vn-item-niche vn-autocomplete[field="niche.warehouseFk"]', + firstCodeInput: 'vn-item-niche vn-horizontal:nth-child(1) > vn-textfield[label="Code"] input', + secondWarehouseAutocomplete: 'vn-item-niche vn-horizontal:nth-child(2) > vn-autocomplete[field="niche.warehouseFk"]', + secondCodeInput: 'vn-item-niche vn-horizontal:nth-child(2) > vn-textfield[label="Code"] input', + secondNicheRemoveButton: 'vn-item-niche vn-horizontal:nth-child(2) > vn-none > vn-icon-button[icon="delete"]', + thirdWarehouseAutocomplete: 'vn-item-niche vn-horizontal:nth-child(3) > vn-autocomplete[field="niche.warehouseFk"]', + thirdCodeInput: 'vn-item-niche vn-horizontal:nth-child(3) > vn-textfield[label="Code"] input', submitNichesButton: `vn-item-niche ${components.vnSubmit}` }, itemBotanical: { botanicalInput: `vn-item-botanical vn-horizontal:nth-child(1) > ${components.vnTextfield}`, - genusAutocomplete: `vn-item-botanical vn-autocomplete[field="$ctrl.botanical.genusFk"]`, - speciesAutocomplete: `vn-item-botanical vn-autocomplete[field="$ctrl.botanical.specieFk"]`, + genusAutocomplete: 'vn-item-botanical vn-autocomplete[field="$ctrl.botanical.genusFk"]', + speciesAutocomplete: 'vn-item-botanical vn-autocomplete[field="$ctrl.botanical.specieFk"]', submitBotanicalButton: `vn-item-botanical ${components.vnSubmit}` }, itemSummary: { - basicData: `vn-item-summary [name="basicData"]`, - vat: `vn-item-summary [name="tax"]`, - tags: `vn-item-summary [name="tags"]`, - niche: `vn-item-summary [name="niche"]`, - botanical: `vn-item-summary [name="botanical"]`, - barcode: `vn-item-summary [name="barcode"]` + basicData: 'vn-item-summary [name="basicData"]', + vat: 'vn-item-summary [name="tax"]', + tags: 'vn-item-summary [name="tags"]', + niche: 'vn-item-summary [name="niche"]', + botanical: 'vn-item-summary [name="botanical"]', + barcode: 'vn-item-summary [name="barcode"]' }, itemDiary: { thirdTicketId: 'vn-item-diary vn-tbody > vn-tr:nth-child(3) > vn-td:nth-child(2) > span', @@ -306,10 +306,10 @@ export default { }, ticketsIndex: { newTicketButton: 'vn-ticket-index > a', - searchResult: `vn-ticket-index vn-card > div > vn-table > div > vn-tbody > a.vn-tr`, + searchResult: 'vn-ticket-index vn-card > div > vn-table > div > vn-tbody > a.vn-tr', searchResultDate: 'vn-ticket-index vn-table vn-tbody > a:nth-child(1) > vn-td:nth-child(5)', searchTicketInput: `vn-ticket-index ${components.vnTextfield}`, - searchButton: `vn-ticket-index vn-searchbar vn-icon[icon="search"]`, + searchButton: 'vn-ticket-index vn-searchbar vn-icon[icon="search"]', moreMenu: 'vn-ticket-index vn-icon-menu[vn-id="more-button"] > div > vn-icon', moreMenuTurns: 'vn-ticket-index vn-icon-menu vn-drop-down > vn-popover li:nth-child(2)', sixthWeeklyTicketTurn: 'vn-ticket-weekly > form > div > vn-card > div > vn-table > div > vn-tbody > vn-tr:nth-child(6) > vn-td:nth-child(3) > vn-autocomplete > div > div > input', @@ -325,59 +325,59 @@ export default { createButton: `${components.vnSubmit}` }, ticketDescriptor: { - moreMenu: `vn-ticket-descriptor vn-icon-menu > div > vn-icon`, - moreMenuAddStowaway: `vn-ticket-descriptor vn-drop-down > vn-popover ul > li:nth-child(1)`, - moreMenuDeleteStowawayButton: 'vn-ticket-descriptor vn-drop-down > vn-popover ul > li:nth-child(5)', - moreMenuAddToTurn: `vn-ticket-descriptor vn-drop-down > vn-popover ul > li:nth-child(2)`, - moreMenuDeleteTicket: `vn-ticket-descriptor vn-drop-down > vn-popover ul > li:nth-child(3)`, + moreMenu: 'vn-ticket-descriptor vn-icon-menu > div > vn-icon', + moreMenuAddStowaway: 'vn-ticket-descriptor vn-drop-down > vn-popover ul > li[name="Add stowaway"]', + moreMenuDeleteStowawayButton: 'vn-ticket-descriptor vn-drop-down > vn-popover ul > li[name="Remove stowaway"]', + moreMenuAddToTurn: 'vn-ticket-descriptor vn-drop-down > vn-popover ul > li[name="Add turn"]', + moreMenuDeleteTicket: 'vn-ticket-descriptor vn-drop-down > vn-popover ul > li[name="Delete ticket"]', moreMenuMakeInvoice: 'vn-ticket-descriptor vn-drop-down > vn-popover ul > li[name="Make invoice"]', addStowawayDialogSecondTicket: 'vn-ticket-descriptor > vn-add-stowaway > vn-dialog vn-table vn-tr:nth-child(2)', shipSelectButton: 'vn-ticket-descriptor > div > div.body > div.quicklinks > vn-button-menu[icon="icon-stowaway"]', shipButton: 'vn-ticket-descriptor > div > div.body > div.quicklinks vn-icon[icon="icon-stowaway"]', shipMenuSecondTicket: 'vn-ticket-descriptor div.quicklinks vn-drop-down li:nth-child(2)', - thursdayButton: `vn-ticket-descriptor > vn-dialog > div > form > div.body > tpl-body > div > vn-tool-bar > vn-button:nth-child(4)`, - saturdayButton: `vn-ticket-descriptor > vn-dialog > div > form > div.body > tpl-body > div > vn-tool-bar > vn-button:nth-child(6)`, + thursdayButton: 'vn-ticket-descriptor > vn-dialog > div > form > div.body > tpl-body > div > vn-tool-bar > vn-button:nth-child(4)', + saturdayButton: 'vn-ticket-descriptor > vn-dialog > div > form > div.body > tpl-body > div > vn-tool-bar > vn-button:nth-child(6)', closeStowawayDialog: 'vn-ticket-descriptor > vn-add-stowaway > vn-dialog > div > button[class="close"]', acceptDeleteButton: 'vn-ticket-descriptor button[response="ACCEPT"]', acceptInvoiceOutButton: 'vn-ticket-descriptor vn-confirm[vn-id="makeInvoiceConfirmation"] button[response="ACCEPT"]', acceptDeleteStowawayButton: 'vn-ticket-descriptor > vn-remove-stowaway button[response="ACCEPT"]' }, ticketNotes: { - firstNoteRemoveButton: `vn-icon[icon="delete"]`, - addNoteButton: `vn-icon[icon="add_circle"]`, - firstNoteTypeAutocomplete: `vn-autocomplete[field="observation.observationTypeFk"]`, - firstDescriptionInput: `vn-textfield[label="Description"] input`, + firstNoteRemoveButton: 'vn-icon[icon="delete"]', + addNoteButton: 'vn-icon[icon="add_circle"]', + firstNoteTypeAutocomplete: 'vn-autocomplete[field="observation.observationTypeFk"]', + firstDescriptionInput: 'vn-textfield[label="Description"] input', submitNotesButton: `${components.vnSubmit}` }, ticketExpedition: { - expeditionButton: `vn-left-menu a[ui-sref="ticket.card.expedition"]`, - secondExpeditionRemoveButton: `vn-ticket-expedition vn-table div > vn-tbody > vn-tr:nth-child(2) > vn-td:nth-child(1) > vn-icon-button[icon="delete"]`, - acceptDeleteRowButton: `vn-ticket-expedition > vn-confirm[vn-id="delete-expedition"] button[response=ACCEPT]`, - expeditionRow: `vn-ticket-expedition vn-table vn-tbody > vn-tr` + expeditionButton: 'vn-left-menu a[ui-sref="ticket.card.expedition"]', + secondExpeditionRemoveButton: 'vn-ticket-expedition vn-table div > vn-tbody > vn-tr:nth-child(2) > vn-td:nth-child(1) > vn-icon-button[icon="delete"]', + acceptDeleteRowButton: 'vn-ticket-expedition > vn-confirm[vn-id="delete-expedition"] button[response=ACCEPT]', + expeditionRow: 'vn-ticket-expedition vn-table vn-tbody > vn-tr' }, ticketPackages: { - packagesButton: `vn-left-menu a[ui-sref="ticket.card.package.index"]`, - firstPackageAutocomplete: `vn-autocomplete[label="Package"]`, - firstQuantityInput: `vn-input-number[label="Quantity"] input`, - firstRemovePackageButton: `vn-icon-button[vn-tooltip="Remove package"]`, - addPackageButton: `vn-icon-button[vn-tooltip="Add package"]`, - clearPackageAutocompleteButton: `vn-autocomplete[label="Package"] > div > div > div > vn-icon > i`, + packagesButton: 'vn-left-menu a[ui-sref="ticket.card.package.index"]', + firstPackageAutocomplete: 'vn-autocomplete[label="Package"]', + firstQuantityInput: 'vn-input-number[label="Quantity"] input', + firstRemovePackageButton: 'vn-icon-button[vn-tooltip="Remove package"]', + addPackageButton: 'vn-icon-button[vn-tooltip="Add package"]', + clearPackageAutocompleteButton: 'vn-autocomplete[label="Package"] > div > div > div > vn-icon > i', savePackagesButton: `${components.vnSubmit}` }, ticketSales: { - saleButton: `vn-left-menu a[ui-sref="ticket.card.sale"]`, - saleLine: `vn-table div > vn-tbody > vn-tr`, + saleButton: 'vn-left-menu a[ui-sref="ticket.card.sale"]', + saleLine: 'vn-table div > vn-tbody > vn-tr', saleDescriptorPopover: 'vn-ticket-sale vn-item-descriptor-popover > vn-popover', saleDescriptorPopoverSummaryButton: 'vn-item-descriptor-popover a[href="#!/item/1/summary"]', - descriptorItemDiaryButton: `vn-item-descriptor .quicklinks.ng-scope > vn-horizontal > a > vn-icon > i`, + descriptorItemDiaryButton: 'vn-item-descriptor .quicklinks.ng-scope > vn-horizontal > a > vn-icon > i', newItemButton: 'vn-float-button[icon="add"]', firstSaleDescriptorImage: 'vn-ticket-sale vn-item-descriptor-popover > vn-popover vn-item-descriptor img', - firstSaleText: `vn-table div > vn-tbody > vn-tr:nth-child(1)`, + firstSaleText: 'vn-table div > vn-tbody > vn-tr:nth-child(1)', firstSaleThumbnailImage: 'vn-ticket-sale:nth-child(1) vn-tr:nth-child(1) vn-td:nth-child(3) > img', firstSaleZoomedImage: 'body > div > div > img', - firstSaleQuantity: `vn-textfield[model="sale.quantity"]:nth-child(1) input`, - firstSaleQuantityCell: `vn-ticket-sale vn-tr:nth-child(1) > vn-td-editable`, - firstSaleQuantityClearInput: `vn-textfield[model="sale.quantity"] div.suffix > i`, + firstSaleQuantity: 'vn-textfield[model="sale.quantity"]:nth-child(1) input', + firstSaleQuantityCell: 'vn-ticket-sale vn-tr:nth-child(1) > vn-td-editable', + firstSaleQuantityClearInput: 'vn-textfield[model="sale.quantity"] div.suffix > i', firstSaleID: 'vn-ticket-sale:nth-child(1) vn-td:nth-child(4) > span', firstSalePrice: 'vn-ticket-sale:nth-child(1) vn-tr:nth-child(1) > vn-td:nth-child(7) > span', firstSalePriceInput: 'vn-ticket-sale:nth-child(1) vn-popover.edit.dialog-summary.ng-isolate-scope.vn-popover.shown vn-textfield input', @@ -385,52 +385,45 @@ export default { firstSaleDiscountInput: 'vn-ticket-sale:nth-child(1) vn-ticket-sale-edit-discount vn-textfield input', firstSaleImport: 'vn-ticket-sale:nth-child(1) vn-td:nth-child(9)', firstSaleReservedIcon: 'vn-ticket-sale vn-tr:nth-child(1) > vn-td:nth-child(2) > vn-icon:nth-child(3)', - firstSaleColour: `vn-ticket-sale vn-tr:nth-child(1) vn-td:nth-child(6) section:nth-child(1)`, - firstSaleLength: `vn-ticket-sale vn-tr:nth-child(1) vn-td:nth-child(6) section:nth-child(3)`, - firstSaleCheckbox: `vn-ticket-sale vn-tr:nth-child(1) vn-check[field="sale.checked"] md-checkbox`, + firstSaleColour: 'vn-ticket-sale vn-tr:nth-child(1) vn-td:nth-child(6) section:nth-child(1)', + firstSaleLength: 'vn-ticket-sale vn-tr:nth-child(1) vn-td:nth-child(6) section:nth-child(3)', + firstSaleCheckbox: 'vn-ticket-sale vn-tr:nth-child(1) vn-check[field="sale.checked"] md-checkbox', secondSaleClaimIcon: 'vn-ticket-sale > vn-vertical > vn-card > div > vn-vertical > vn-table > div > vn-tbody > vn-tr:nth-child(2) > vn-td:nth-child(2) > a > vn-icon', - secondSaleColour: `vn-ticket-sale vn-tr:nth-child(2) vn-td:nth-child(6) section:nth-child(5)`, - secondSalePrice: `vn-ticket-sale vn-tr:nth-child(2) vn-td:nth-child(7) > span`, - secondSaleDiscount: `vn-ticket-sale vn-tr:nth-child(2) vn-td:nth-child(8)`, - secondSaleImport: `vn-ticket-sale vn-tr:nth-child(2) vn-td:nth-child(9)`, - secondSaleText: `vn-table div > vn-tbody > vn-tr:nth-child(2)`, + secondSaleColour: 'vn-ticket-sale vn-tr:nth-child(2) vn-td:nth-child(6) section:nth-child(5)', + secondSalePrice: 'vn-ticket-sale vn-tr:nth-child(2) vn-td:nth-child(7) > span', + secondSaleDiscount: 'vn-ticket-sale vn-tr:nth-child(2) vn-td:nth-child(8)', + secondSaleImport: 'vn-ticket-sale vn-tr:nth-child(2) vn-td:nth-child(9)', + secondSaleText: 'vn-table div > vn-tbody > vn-tr:nth-child(2)', totalImport: 'vn-ticket-sale > vn-vertical > vn-card > div > vn-vertical > vn-horizontal > vn-one > p:nth-child(3) > strong', - selectAllSalesCheckbox: `vn-ticket-sale vn-thead vn-check md-checkbox`, - secondSaleCheckbox: `vn-ticket-sale vn-tr:nth-child(2) vn-check[field="sale.checked"] md-checkbox`, - thirdSaleCheckbox: `vn-ticket-sale vn-tr:nth-child(3) vn-check[field="sale.checked"] md-checkbox`, + selectAllSalesCheckbox: 'vn-ticket-sale vn-thead vn-check md-checkbox', + secondSaleCheckbox: 'vn-ticket-sale vn-tr:nth-child(2) vn-check[field="sale.checked"] md-checkbox', + thirdSaleCheckbox: 'vn-ticket-sale vn-tr:nth-child(3) vn-check[field="sale.checked"] md-checkbox', deleteSaleButton: 'vn-ticket-sale vn-tool-bar > vn-button[icon="delete"]', transferSaleButton: 'vn-ticket-sale vn-tool-bar > vn-button[icon="call_split"]', moveToTicketInput: 'vn-ticket-sale vn-popover.transfer vn-textfield[model="$ctrl.moveToTicketFk"] input', moveToTicketInputClearButton: 'vn-popover.shown i[title="Clear"]', moveToTicketButton: 'vn-ticket-sale vn-popover.transfer vn-icon[icon="arrow_forward_ios"]', moveToNewTicketButton: 'vn-ticket-sale vn-popover.transfer vn-button[label="New ticket"]', - acceptDeleteLineButton: `vn-ticket-sale > vn-confirm[vn-id="delete-lines"] button[response=ACCEPT]`, - acceptDeleteTicketButton: `vn-ticket-sale > vn-confirm[vn-id="deleteConfirmation"] button[response=ACCEPT]`, - stateMenuButton: 'vn-ticket-sale vn-tool-bar > vn-button-menu[label="State"] button', - stateMenuOptions: 'vn-ticket-sale vn-drop-down > vn-popover ul > li:nth-child(1)', - moreMenuButton: 'vn-ticket-sale vn-tool-bar > vn-button-menu[label="More"] button', - moreMenuReseveOption: 'vn-ticket-sale vn-drop-down > vn-popover ul > li:nth-child(2)', - moreMenuUnmarkResevedOption: 'vn-ticket-sale vn-drop-down > vn-popover ul > li:nth-child(3)', - moreMenuUpdateDiscount: 'vn-ticket-sale vn-drop-down > vn-popover ul > li:nth-child(4)', - moreMenuUpdateDiscountInput: 'vn-ticket-sale vn-dialog.shown vn-ticket-sale-edit-discount input', - moreMenuCreateClaim: 'vn-ticket-sale vn-drop-down > vn-popover ul > li:nth-child(1)' + acceptDeleteLineButton: 'vn-ticket-sale > vn-confirm[vn-id="delete-lines"] button[response=ACCEPT]', + acceptDeleteTicketButton: 'vn-ticket-sale > vn-confirm[vn-id="deleteConfirmation"] button[response=ACCEPT]', + stateMenuButton: 'vn-ticket-sale vn-tool-bar > vn-button-menu[label="State"]' }, ticketTracking: { - trackingButton: `vn-left-menu a[ui-sref="ticket.card.tracking.index"]`, + trackingButton: 'vn-left-menu a[ui-sref="ticket.card.tracking.index"]', createStateButton: `${components.vnFloatButton}`, stateAutocomplete: 'vn-ticket-tracking-edit vn-autocomplete[field="$ctrl.stateFk"]', saveButton: `${components.vnSubmit}`, - cancelButton: `vn-ticket-tracking-edit vn-button[ui-sref="ticket.card.tracking.index"]` + cancelButton: 'vn-ticket-tracking-edit vn-button[ui-sref="ticket.card.tracking.index"]' }, ticketBasicData: { - basicDataButton: `vn-left-menu a[ui-sref="ticket.card.basicData.stepOne"]`, - clientAutocomplete: `vn-autocomplete[field="$ctrl.clientFk"]`, - addressAutocomplete: `vn-autocomplete[field="$ctrl.ticket.addressFk"]`, - agencyAutocomplete: `vn-autocomplete[field="$ctrl.ticket.agencyModeFk"]`, - nextStepButton: `vn-step-control > section > section.buttons > section:nth-child(2) > vn-button`, - finalizeButton: `vn-step-control > section > section.buttons > section:nth-child(2) > vn-submit`, - stepTwoTotalPriceDif: `vn-ticket-basic-data-step-two > form > vn-card > div > vn-horizontal > table > tfoot > tr > td:nth-child(4)`, - chargesReasonAutocomplete: `vn-autocomplete[field="$ctrl.ticket.option"]`, + basicDataButton: 'vn-left-menu a[ui-sref="ticket.card.basicData.stepOne"]', + clientAutocomplete: 'vn-autocomplete[field="$ctrl.clientFk"]', + addressAutocomplete: 'vn-autocomplete[field="$ctrl.ticket.addressFk"]', + agencyAutocomplete: 'vn-autocomplete[field="$ctrl.ticket.agencyModeFk"]', + nextStepButton: 'vn-step-control > section > section.buttons > section:nth-child(2) > vn-button', + finalizeButton: 'vn-step-control > section > section.buttons > section:nth-child(2) > vn-submit', + stepTwoTotalPriceDif: 'vn-ticket-basic-data-step-two > form > vn-card > div > vn-horizontal > table > tfoot > tr > td:nth-child(4)', + chargesReasonAutocomplete: 'vn-autocomplete[field="$ctrl.ticket.option"]', }, ticketComponents: { base: 'vn-ticket-components tfoot > tr:nth-child(1) > td', @@ -438,19 +431,19 @@ export default { total: 'vn-ticket-components tfoot > tr:nth-child(3) > td' }, ticketRequests: { - addRequestButton: `vn-ticket-request-index > a > vn-float-button > button`, + addRequestButton: 'vn-ticket-request-index > a > vn-float-button > button', request: 'vn-ticket-request-index > form > vn-card > div > vn-horizontal > vn-table > div > vn-tbody > vn-tr', - descriptionInput: `vn-ticket-request-create > form > div > vn-card > div > vn-horizontal:nth-child(1) > vn-textfield > div > div > div.infix > input`, - atenderAutocomplete: `vn-ticket-request-create vn-autocomplete[field="$ctrl.ticketRequest.atenderFk"]`, - quantityInput: `vn-ticket-request-create > form > div > vn-card > div > vn-horizontal:nth-child(2) > vn-input-number:nth-child(1) > div > div > div.infix > input`, - priceInput: `vn-ticket-request-create > form > div > vn-card > div > vn-horizontal:nth-child(2) > vn-input-number:nth-child(2) > div > div > div.infix > input`, - firstRemoveRequestButton: `vn-ticket-request-index vn-icon[icon="delete"]:nth-child(1)`, - saveButton: `vn-ticket-request-create > form > div > vn-button-bar > vn-submit[label="Create"] input`, + descriptionInput: 'vn-ticket-request-create > form > div > vn-card > div > vn-horizontal:nth-child(1) > vn-textfield > div > div > div.infix > input', + atenderAutocomplete: 'vn-ticket-request-create vn-autocomplete[field="$ctrl.ticketRequest.atenderFk"]', + quantityInput: 'vn-ticket-request-create > form > div > vn-card > div > vn-horizontal:nth-child(2) > vn-input-number:nth-child(1) > div > div > div.infix > input', + priceInput: 'vn-ticket-request-create > form > div > vn-card > div > vn-horizontal:nth-child(2) > vn-input-number:nth-child(2) > div > div > div.infix > input', + firstRemoveRequestButton: 'vn-ticket-request-index vn-icon[icon="delete"]:nth-child(1)', + saveButton: 'vn-ticket-request-create > form > div > vn-button-bar > vn-submit[label="Create"] input', firstDescription: 'vn-ticket-request-index > form > vn-card > div > vn-horizontal > vn-table > div > vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(2)', }, ticketLog: { - logButton: `vn-left-menu a[ui-sref="ticket.card.log"]`, + logButton: 'vn-left-menu a[ui-sref="ticket.card.log"]', changedBy: 'vn-ticket-log > vn-log > vn-vertical > vn-card > div > vn-vertical > vn-table > div > vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(2) > span', actionTaken: 'vn-ticket-log > vn-log > vn-vertical > vn-card > div > vn-vertical > vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(1) > div > div:nth-child(3) > span.value.ng-scope.ng-binding', id: 'vn-ticket-log > vn-log > vn-vertical > vn-card > div > vn-vertical > vn-table > div > vn-tbody > vn-tr > vn-td.before > vn-one:nth-child(1) > div > span.value.ng-scope.ng-binding' @@ -466,25 +459,25 @@ export default { saveServiceButton: `${components.vnSubmit}` }, createStateView: { - stateAutocomplete: `vn-autocomplete[field="$ctrl.stateFk"]`, - workerAutocomplete: `vn-autocomplete[field="$ctrl.workerFk"]`, - clearStateInputButton: `vn-autocomplete[field="$ctrl.stateFk"] > div > div > div > vn-icon > i`, + stateAutocomplete: 'vn-autocomplete[field="$ctrl.stateFk"]', + workerAutocomplete: 'vn-autocomplete[field="$ctrl.workerFk"]', + clearStateInputButton: 'vn-autocomplete[field="$ctrl.stateFk"] > div > div > div > vn-icon > i', saveStateButton: `${components.vnSubmit}` }, claimsIndex: { searchClaimInput: `vn-claim-index ${components.vnTextfield}`, - searchResult: `vn-claim-index vn-card > div > vn-table > div > vn-tbody > a`, - searchButton: `vn-claim-index vn-searchbar vn-icon[icon="search"]` + searchResult: 'vn-claim-index vn-card > div > vn-table > div > vn-tbody > a', + searchButton: 'vn-claim-index vn-searchbar vn-icon[icon="search"]' }, claimBasicData: { claimStateAutocomplete: 'vn-claim-basic-data vn-autocomplete[field="$ctrl.claim.claimStateFk"]', isPaidWithManaCheckbox: 'vn-check[field="$ctrl.claim.isChargedToMana"] md-checkbox', - responsabilityInputRange: `vn-input-range`, - observationInput: `vn-textarea[label="Observation"] textarea`, + responsabilityInputRange: 'vn-input-range', + observationInput: 'vn-textarea[label="Observation"] textarea', saveButton: `${components.vnSubmit}` }, claimDetail: { - addItemButton: `vn-claim-detail a vn-float-button`, + addItemButton: 'vn-claim-detail a vn-float-button', firstClaimableSaleFromTicket: 'vn-claim-detail > vn-dialog vn-tbody > vn-tr', claimDetailLine: 'vn-claim-detail > vn-vertical > vn-card > div > vn-vertical > vn-table > div > vn-tbody > vn-tr', secondItemQuantityInput: 'vn-claim-detail vn-tr:nth-child(2) vn-input-number[model="saleClaimed.quantity"] input', @@ -518,29 +511,29 @@ export default { }, ordersIndex: { - searchResult: `vn-order-index vn-card > div > vn-table > div > vn-tbody > a.vn-tr`, - searchResultDate: `vn-order-index vn-table vn-tbody > a:nth-child(1) > vn-td:nth-child(4)`, - searchResultAddress: `vn-order-index vn-table vn-tbody > a:nth-child(1) > vn-td:nth-child(6)`, + searchResult: 'vn-order-index vn-card > div > vn-table > div > vn-tbody > a.vn-tr', + searchResultDate: 'vn-order-index vn-table vn-tbody > a:nth-child(1) > vn-td:nth-child(4)', + searchResultAddress: 'vn-order-index vn-table vn-tbody > a:nth-child(1) > vn-td:nth-child(6)', searchOrderInput: `vn-order-index ${components.vnTextfield}`, - searchButton: `vn-order-index vn-searchbar vn-icon[icon="search"]`, + searchButton: 'vn-order-index vn-searchbar vn-icon[icon="search"]', createOrderButton: `${components.vnFloatButton}`, }, createOrderView: { - clientAutocomplete: `vn-autocomplete[label="Client"]`, - addressAutocomplete: `vn-autocomplete[label="Address"]`, - agencyAutocomplete: `vn-autocomplete[label="Agency"]`, - landedDatePicker: `vn-date-picker[label="Landed"]`, + clientAutocomplete: 'vn-autocomplete[label="Client"]', + addressAutocomplete: 'vn-autocomplete[label="Address"]', + agencyAutocomplete: 'vn-autocomplete[label="Agency"]', + landedDatePicker: 'vn-date-picker[label="Landed"]', createButton: `${components.vnSubmit}`, - cancelButton: `vn-button[href="#!/client/index"]` + cancelButton: 'vn-button[href="#!/client/index"]' }, orderCatalog: { - orderByAutocomplete: `vn-autocomplete[label="Order by"]`, + orderByAutocomplete: 'vn-autocomplete[label="Order by"]', }, orderBasicData: { - clientAutocomplete: `vn-autocomplete[label="Client"]`, - addressAutocomplete: `vn-autocomplete[label="Address"]`, - agencyAutocomplete: `vn-autocomplete[label="Agency"]`, - observationInput: `vn-textarea[label="Observation"] textarea`, + clientAutocomplete: 'vn-autocomplete[label="Client"]', + addressAutocomplete: 'vn-autocomplete[label="Address"]', + agencyAutocomplete: 'vn-autocomplete[label="Agency"]', + observationInput: 'vn-textarea[label="Observation"] textarea', saveButton: `${components.vnSubmit}` }, orderLine: { From 2ca85394f3d322cfa3350c9b0b4395b5961f2b99 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Fri, 26 Apr 2019 16:10:51 +0200 Subject: [PATCH 44/59] #1385 excluded tests --- .../04-item-module/09_regularize.spec.js | 2 +- .../05-ticket-module/07_edit_sale.spec.js | 2 +- .../date-picker/date-picker.spec.js | 3 +- loopback/locale/en.json | 3 +- modules/agency/front/card/index.spec.js | 52 +++++++++--------- modules/agency/front/create/index.spec.js | 53 +++++++++--------- modules/agency/front/index/index.spec.js | 54 +++++++++---------- modules/ticket/front/index/index.spec.js | 2 +- 8 files changed, 83 insertions(+), 88 deletions(-) diff --git a/e2e/paths/04-item-module/09_regularize.spec.js b/e2e/paths/04-item-module/09_regularize.spec.js index 23d8904e4..7b5f71009 100644 --- a/e2e/paths/04-item-module/09_regularize.spec.js +++ b/e2e/paths/04-item-module/09_regularize.spec.js @@ -1,7 +1,7 @@ import selectors from '../../helpers/selectors.js'; import createNightmare from '../../helpers/nightmare'; -// #1186 repearar e2e ticket.sale, item.regularize. +// #1386 e2e Item regularize path xdescribe('Item regularize path', () => { const nightmare = createNightmare(); beforeAll(() => { diff --git a/e2e/paths/05-ticket-module/07_edit_sale.spec.js b/e2e/paths/05-ticket-module/07_edit_sale.spec.js index f339f6a57..3deffa33b 100644 --- a/e2e/paths/05-ticket-module/07_edit_sale.spec.js +++ b/e2e/paths/05-ticket-module/07_edit_sale.spec.js @@ -1,7 +1,7 @@ import selectors from '../../helpers/selectors.js'; import createNightmare from '../../helpers/nightmare'; -// #1186 repearar e2e ticket.sale, item.regularize. +// #1387 e2e Ticket Edit sale path xdescribe('Ticket Edit sale path', () => { const nightmare = createNightmare(); diff --git a/front/core/components/date-picker/date-picker.spec.js b/front/core/components/date-picker/date-picker.spec.js index 0a81136a0..55bfb0f83 100644 --- a/front/core/components/date-picker/date-picker.spec.js +++ b/front/core/components/date-picker/date-picker.spec.js @@ -1,5 +1,4 @@ -// #937 front test datePicker awaiting loopback connector refactor to store dates correctly. -xdescribe('Component vnDatePicker', () => { +describe('Component vnDatePicker', () => { let controller; let $attrs; let $element; diff --git a/loopback/locale/en.json b/loopback/locale/en.json index 26252d825..f7792a56a 100644 --- a/loopback/locale/en.json +++ b/loopback/locale/en.json @@ -42,5 +42,6 @@ "EXTENSION_INVALID_FORMAT": "Invalid extension", "The secret can't be blank": "The secret can't be blank", "Invalid TIN": "Invalid Tax number", - "This ticket can't be invoiced": "This ticket can't be invoiced" + "This ticket can't be invoiced": "This ticket can't be invoiced", + "The value should be a number": "The value should be a number" } \ No newline at end of file diff --git a/modules/agency/front/card/index.spec.js b/modules/agency/front/card/index.spec.js index 15e8fada9..072ce5175 100644 --- a/modules/agency/front/card/index.spec.js +++ b/modules/agency/front/card/index.spec.js @@ -1,36 +1,34 @@ import './index.js'; -xdescribe('Agency', () => { - describe('Component vnZoneCard', () => { - let $scope; - let controller; - let $httpBackend; - let $stateParams; +describe('Agency Component vnZoneCard', () => { + let $scope; + let controller; + let $httpBackend; + let $stateParams; - beforeEach(ngModule('agency')); + beforeEach(ngModule('agency')); - beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_) => { - $httpBackend = _$httpBackend_; - $scope = $rootScope.$new(); - $stateParams = {id: 1}; - controller = $componentController('vnZoneCard', {$scope, $stateParams}); - })); + beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_) => { + $httpBackend = _$httpBackend_; + $scope = $rootScope.$new(); + $stateParams = {id: 1}; + controller = $componentController('vnZoneCard', {$scope, $stateParams}); + })); - describe('getCard()', () => { - it(`should make a query and define zone property`, () => { - let filter = { - include: [ - {relation: 'warehouse', fields: ['name']}, - {relation: 'agencyMode', fields: ['name']} - ] - }; - let json = encodeURIComponent(JSON.stringify(filter)); - $httpBackend.expectGET(`/agency/api/Zones/1?filter=${json}`).respond({id: 1}); - controller.getCard(); - $httpBackend.flush(); + describe('getCard()', () => { + it(`should make a query and define zone property`, () => { + let filter = { + include: [ + {relation: 'warehouse', fields: ['name']}, + {relation: 'agencyMode', fields: ['name']} + ] + }; + let json = encodeURIComponent(JSON.stringify(filter)); + $httpBackend.expectGET(`/agency/api/Zones/1?filter=${json}`).respond({id: 1}); + controller.getCard(); + $httpBackend.flush(); - expect(controller.zone).toEqual({id: 1}); - }); + expect(controller.zone).toEqual({id: 1}); }); }); }); diff --git a/modules/agency/front/create/index.spec.js b/modules/agency/front/create/index.spec.js index 70e061612..5b2a022f8 100644 --- a/modules/agency/front/create/index.spec.js +++ b/modules/agency/front/create/index.spec.js @@ -1,40 +1,39 @@ import './index'; import watcher from 'core/mocks/watcher'; -xdescribe('Agency', () => { - describe('Component vnZoneCreate', () => { - let $scope; - let $state; - let controller; +describe('Agency Component vnZoneCreate', () => { + let $scope; + let $state; + let controller; - beforeEach(ngModule('agency')); + beforeEach(ngModule('agency')); - beforeEach(angular.mock.inject(($componentController, $rootScope, _$state_) => { - $scope = $rootScope.$new(); - $state = _$state_; - $scope.watcher = watcher; - $scope.watcher.submit = () => { - return { - then: callback => { - callback({data: {id: 1234}}); - } - }; + beforeEach(angular.mock.inject(($componentController, $rootScope, _$state_) => { + $scope = $rootScope.$new(); + $state = _$state_; + $scope.watcher = watcher; + $scope.watcher.submit = () => { + return { + then: callback => { + callback({data: {id: 1234}}); + } }; - controller = $componentController('vnZoneCreate', {$scope}); - })); + }; + controller = $componentController('vnZoneCreate', {$scope}); + })); - describe('onSubmit()', () => { - it(`should call submit() on the watcher then expect a callback`, () => { - spyOn($state, 'go'); + describe('onSubmit()', () => { + it(`should call submit() on the watcher then expect a callback`, () => { + spyOn($state, 'go'); - controller.zone = { - name: 'Zone One' - }; + controller.zone = { + name: 'Zone One' + }; - controller.onSubmit(); + controller.onSubmit(); - expect(controller.$state.go).toHaveBeenCalledWith('zone.card.basicData', {id: 1234}); - }); + expect(controller.$state.go).toHaveBeenCalledWith('zone.card.location', Object({id: 1234})); }); }); }); + diff --git a/modules/agency/front/index/index.spec.js b/modules/agency/front/index/index.spec.js index 2e5e5d013..8ded387bd 100644 --- a/modules/agency/front/index/index.spec.js +++ b/modules/agency/front/index/index.spec.js @@ -1,41 +1,39 @@ import './index.js'; -xdescribe('Agency', () => { - describe('Component vnZoneIndex', () => { - let $componentController; - let controller; +describe('Agency Component vnZoneIndex', () => { + let $componentController; + let controller; - beforeEach(ngModule('agency')); + beforeEach(ngModule('agency')); - beforeEach(angular.mock.inject(_$componentController_ => { - $componentController = _$componentController_; - controller = $componentController('vnZoneIndex'); - })); + beforeEach(angular.mock.inject(_$componentController_ => { + $componentController = _$componentController_; + controller = $componentController('vnZoneIndex'); + })); - describe('exprBuilder()', () => { - it('should return a formated object with the id in case of search', () => { - let param = 'search'; - let value = 1; - let result = controller.exprBuilder(param, value); + describe('exprBuilder()', () => { + it('should return a formated object with the id in case of search', () => { + let param = 'search'; + let value = 1; + let result = controller.exprBuilder(param, value); - expect(result).toEqual({id: 1}); - }); + expect(result).toEqual({id: 1}); + }); - it('should return a formated object with the warehouseFk in case of warehouseFk', () => { - let param = 'warehouseFk'; - let value = 'Silla'; - let result = controller.exprBuilder(param, value); + it('should return a formated object with the warehouseFk in case of warehouseFk', () => { + let param = 'warehouseFk'; + let value = 'Silla'; + let result = controller.exprBuilder(param, value); - expect(result).toEqual({warehouseFk: 'Silla'}); - }); + expect(result).toEqual({warehouseFk: 'Silla'}); + }); - it('should return a formated object with the warehouseFk in case of warehouseFk', () => { - let param = 'agencyModeFk'; - let value = 'My Delivery'; - let result = controller.exprBuilder(param, value); + it('should return a formated object with the warehouseFk in case of agencyModeFk', () => { + let param = 'agencyModeFk'; + let value = 'My Delivery'; + let result = controller.exprBuilder(param, value); - expect(result).toEqual({agencyModeFk: 'My Delivery'}); - }); + expect(result).toEqual({agencyModeFk: 'My Delivery'}); }); }); }); diff --git a/modules/ticket/front/index/index.spec.js b/modules/ticket/front/index/index.spec.js index b3d3a0f02..bc246ef21 100644 --- a/modules/ticket/front/index/index.spec.js +++ b/modules/ticket/front/index/index.spec.js @@ -1,5 +1,5 @@ import './index.js'; - +// #1258 ticket.index sumatorio xdescribe('Component vnTicketIndex', () => { let $element; let controller; From 5bc6f5107e2d587f382bf3e2aa88efec63e5da05 Mon Sep 17 00:00:00 2001 From: Bernat Date: Mon, 29 Apr 2019 07:48:59 +0200 Subject: [PATCH 45/59] #1370 ticket.descriptor change shipped hour --- modules/ticket/front/descriptor/index.html | 2 +- modules/ticket/front/descriptor/index.js | 4 ++-- modules/ticket/front/descriptor/index.spec.js | 17 +++++++++++++++++ modules/ticket/front/descriptor/locale/es.yml | 3 ++- 4 files changed, 22 insertions(+), 4 deletions(-) diff --git a/modules/ticket/front/descriptor/index.html b/modules/ticket/front/descriptor/index.html index 6e77365c1..6d3d74d7f 100644 --- a/modules/ticket/front/descriptor/index.html +++ b/modules/ticket/front/descriptor/index.html @@ -169,7 +169,7 @@
Change shipped hour
- +
diff --git a/modules/ticket/front/descriptor/index.js b/modules/ticket/front/descriptor/index.js index 9578b7128..307c88833 100644 --- a/modules/ticket/front/descriptor/index.js +++ b/modules/ticket/front/descriptor/index.js @@ -45,14 +45,14 @@ class Controller { this.vnApp.showError(this.$translate.instant('This ticket can\'t be modified')); return; } - this.newShipped = new Date(this.ticket.shipped); + this.newShipped = this.ticket.shipped; this.$scope.changeShippedDialog.show(); } changeShipped(response) { if (response === 'ACCEPT') { let params = {shipped: this.newShipped}; - this.$http.patch(`/ticket/api/Tickets/${this.ticket.id}/`, params).then(() => { + this.$http.patch(`/ticket/api/Tickets/${this.ticket.id}`, params).then(() => { this.vnApp.showSuccess(this.$translate.instant('Shipped hour updated')); this.cardReload(); }); diff --git a/modules/ticket/front/descriptor/index.spec.js b/modules/ticket/front/descriptor/index.spec.js index c799b16ec..92939c246 100644 --- a/modules/ticket/front/descriptor/index.spec.js +++ b/modules/ticket/front/descriptor/index.spec.js @@ -10,6 +10,9 @@ describe('Ticket Component vnTicketDescriptor', () => { $httpBackend = _$httpBackend_; controller = $componentController('vnTicketDescriptor'); controller.ticket = {id: 2, invoiceOut: {id: 1}}; + controller.cardReload = ()=> { + return true; + }; })); describe('showAddTurnDialog()', () => { @@ -105,5 +108,19 @@ describe('Ticket Component vnTicketDescriptor', () => { expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Invoice sent for a regeneration, will be available in a few minutes'); }); }); + + describe('changeShipped(response)', () => { + it('should make a query and change the shipped hour if the response is ACCEPT', () => { + spyOn(controller.vnApp, 'showSuccess'); + spyOn(controller, 'cardReload'); + $httpBackend.when('PATCH', `/ticket/api/Tickets/2`,).respond(); + $httpBackend.expect('PATCH', `/ticket/api/Tickets/2`).respond(); + controller.changeShipped('ACCEPT'); + $httpBackend.flush(); + + expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Shipped hour updated'); + expect(controller.cardReload).toHaveBeenCalledWith(); + }); + }); }); diff --git a/modules/ticket/front/descriptor/locale/es.yml b/modules/ticket/front/descriptor/locale/es.yml index 1b6baed2a..e12c95f64 100644 --- a/modules/ticket/front/descriptor/locale/es.yml +++ b/modules/ticket/front/descriptor/locale/es.yml @@ -21,4 +21,5 @@ You are going to invoice this ticket: Vas a facturar este ticket Are you sure you want to invoice this ticket?: ¿Seguro que quieres facturar este ticket? You are going to regenerate the invoice: Vas a regenerar la factura Are you sure you want to regenerate the invoice?: ¿Seguro que quieres regenerar la factura? -Invoice sent for a regeneration, will be available in a few minutes: La factura ha sido enviada para ser regenerada, estará disponible en unos minutos \ No newline at end of file +Invoice sent for a regeneration, will be available in a few minutes: La factura ha sido enviada para ser regenerada, estará disponible en unos minutos +Shipped hour updated: Hora de envio modificada \ No newline at end of file From 10669f01f3a649602e875248d99ef88a926d31ec Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Mon, 29 Apr 2019 10:21:36 +0200 Subject: [PATCH 46/59] #1258 ticket.index sumatorio unit test fixed --- modules/ticket/front/index/index.js | 2 +- modules/ticket/front/index/index.spec.js | 47 ++++++++---------------- 2 files changed, 17 insertions(+), 32 deletions(-) diff --git a/modules/ticket/front/index/index.js b/modules/ticket/front/index/index.js index be1b5af33..d88662604 100644 --- a/modules/ticket/front/index/index.js +++ b/modules/ticket/front/index/index.js @@ -47,7 +47,7 @@ export default class Controller { } } this.$.balanceCreateDialog.description = 'Albaran: '; - this.$.balanceCreateDialog.description += description.join(','); + this.$.balanceCreateDialog.description += description.join(', '); } buildFilterDates() { diff --git a/modules/ticket/front/index/index.spec.js b/modules/ticket/front/index/index.spec.js index bc246ef21..aa78a8752 100644 --- a/modules/ticket/front/index/index.spec.js +++ b/modules/ticket/front/index/index.spec.js @@ -1,7 +1,5 @@ import './index.js'; -// #1258 ticket.index sumatorio -xdescribe('Component vnTicketIndex', () => { - let $element; +describe('Component vnTicketIndex', () => { let controller; let $window; let tickets = [{ @@ -11,7 +9,7 @@ xdescribe('Component vnTicketIndex', () => { shipped: new Date(), nickname: 'Test', total: 10.5, - isChecked: false + checked: false }, { id: 2, clientFk: 1, @@ -19,7 +17,7 @@ xdescribe('Component vnTicketIndex', () => { shipped: new Date(), nickname: 'Test', total: 20.5, - isChecked: true + checked: true }, { id: 3, clientFk: 1, @@ -27,27 +25,18 @@ xdescribe('Component vnTicketIndex', () => { shipped: new Date(), nickname: 'Test', total: 30, - isChecked: true + checked: true }]; beforeEach(() => { - ngModule('client'); - ngModule('worker'); - ngModule('item'); ngModule('ticket'); }); - beforeEach(inject(($compile, $rootScope, _$window_) => { + beforeEach(inject(($componentController, _$window_) => { $window = _$window_; - let $scope = $rootScope.$new(); - $element = $compile('')($scope); - controller = $element.controller('vnTicketIndex'); + controller = $componentController('vnTicketIndex'); })); - afterEach(() => { - $element.remove(); - }); - describe('compareDate()', () => { it('should return warning when the date is the present', () => { let curDate = new Date(); @@ -75,8 +64,8 @@ xdescribe('Component vnTicketIndex', () => { describe('showClientDescriptor()', () => { it('should show the client descriptor popover', () => { - spyOn(controller.$.clientDescriptor, 'show'); - + controller.$.clientDescriptor = {show: () => {}}; + controller.$.clientDescriptor.show = jasmine.createSpy('show'); let event = new MouseEvent('click', { view: $window, bubbles: true, @@ -90,6 +79,7 @@ xdescribe('Component vnTicketIndex', () => { describe('preview()', () => { it('should show the dialog summary', () => { + controller.$.summary = {show: () => {}}; spyOn(controller.$.summary, 'show'); let event = new MouseEvent('click', { @@ -105,21 +95,16 @@ xdescribe('Component vnTicketIndex', () => { describe('setBalanceCreateDialog()', () => { it('should fill the object for the component balanceCreateDialog', () => { - console.log('2'); - console.log(controller); + controller.$.tickets = tickets; controller.$.balanceCreateDialog = {}; - let result = controller.setBalanceCreateDialog(); + controller.$.balanceCreateDialog.amountPaid = 0; + controller.setBalanceCreateDialog(); - expect(result).toEqual(50.5); - }); + let description = controller.$.balanceCreateDialog.description; + let amountPaid = controller.$.balanceCreateDialog.amountPaid; - it('should', () => { - // spyOn(controller.$.balanceCreateDialog, 'show'); - // spyOn(controller.$, 'balanceCreateDialog'); - // controller.setBalanceCreateDialog(); - - // expect(controller.$.balanceCreateDialog.description).toEqual(''); - expect(true).toBeTruthy(); + expect(description).toEqual('Albaran: 2, 3'); + expect(amountPaid).toEqual(50.5); }); }); }); From 85dc6e51afc0adb9a8594bb25dcc3a6bb8721c5e Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Mon, 29 Apr 2019 10:35:46 +0200 Subject: [PATCH 47/59] #1258 ticket.index sumatorio removed unused code --- modules/ticket/front/index/index.spec.js | 9 --------- 1 file changed, 9 deletions(-) diff --git a/modules/ticket/front/index/index.spec.js b/modules/ticket/front/index/index.spec.js index aa78a8752..6ca026814 100644 --- a/modules/ticket/front/index/index.spec.js +++ b/modules/ticket/front/index/index.spec.js @@ -5,25 +5,16 @@ describe('Component vnTicketIndex', () => { let tickets = [{ id: 1, clientFk: 1, - salesPersonFk: 9, - shipped: new Date(), - nickname: 'Test', total: 10.5, checked: false }, { id: 2, clientFk: 1, - salesPersonFk: 9, - shipped: new Date(), - nickname: 'Test', total: 20.5, checked: true }, { id: 3, clientFk: 1, - salesPersonFk: 9, - shipped: new Date(), - nickname: 'Test', total: 30, checked: true }]; From a8a5193a86ba07c8f6ccc585af3fb84b1640ff68 Mon Sep 17 00:00:00 2001 From: Bernat Date: Mon, 29 Apr 2019 11:40:54 +0200 Subject: [PATCH 48/59] 1389 update fixtures for invoiceOut and fix test --- db/dump/fixtures.sql | 76 +++++++++++-------- .../13_create_ticket_services.spec.js | 2 +- .../back/methods/client/specs/getCard.spec.js | 2 +- .../back/methods/client/specs/getDebt.spec.js | 2 +- .../back/methods/client/specs/summary.spec.js | 2 +- 5 files changed, 49 insertions(+), 35 deletions(-) diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index 09387acee..2aa7bc22e 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -388,11 +388,11 @@ INSERT INTO `vn`.`company`(`id`, `code`, `supplierAccountFk`, `workerManagerFk`, INSERT INTO `vn`.`invoiceOut`(`id`, `serial`, `amount`, `issued`,`clientFk`, `created`, `companyFk`, `dued`, `booked`, `bankFk`, `pdf`) VALUES - ( 1, 'T', 500 , DATE_ADD(CURDATE(), INTERVAL -2 MONTH), 101, CURDATE(), 442, CURDATE(), CURDATE(), 1, 1), - ( 2, 'T', 350.50 , DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 102, CURDATE(), 442, CURDATE(), CURDATE(), 1, 1), - ( 3, 'T', 90.30 , CURDATE(), 103, CURDATE(), 442, CURDATE(), CURDATE(), 1, 1), - ( 4, 'T', 290.30 , DATE_ADD(CURDATE(), INTERVAL +1 MONTH), 103, CURDATE(), 442, CURDATE(), CURDATE(), 1, 1), - ( 5, 'A', 190.30 , DATE_ADD(CURDATE(), INTERVAL +2 MONTH), 103, CURDATE(), 442, CURDATE(), CURDATE(), 1, 1); + ( 1, 'T', 156.09, DATE_ADD(CURDATE(), INTERVAL -2 MONTH), 101, CURDATE(), 442, DATE_ADD(CURDATE(), INTERVAL -2 MONTH), CURDATE(), 1, 1), + ( 2, 'T', 208.35, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 102, CURDATE(), 442, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), CURDATE(), 1, 1), + ( 3, 'T', 20.02, CURDATE(), 103, CURDATE(), 442, CURDATE(), null, 1, 1), + ( 4, 'T', 20.02, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), 103, CURDATE(), 442, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), null, 1, 1), + ( 5, 'A', 20.22, DATE_ADD(CURDATE(), INTERVAL +2 MONTH), 103, CURDATE(), 442, DATE_ADD(CURDATE(), INTERVAL +2 MONTH), null, 1, 1); UPDATE `vn`.`invoiceOut` SET ref = 'T1111111' WHERE id = 1; UPDATE `vn`.`invoiceOut` SET ref = 'T2222222' WHERE id = 2; @@ -413,30 +413,43 @@ INSERT INTO `vn`.`invoiceOutTax` (`invoiceOutFk`, `taxableBase`, `vat`, `pgcFk`) (5, 100, 10, 4722000010), (5, 200, 21, 4722000021); +INSERT INTO `vn`.`taxArea` (`code`, `claveOperacionFactura`, `CodigoTransaccion`) + VALUES + ('CEE', 1, 10), + ('EQU', 0, 1), + ('NATIONAL', 0, 1), + ('WORLD', 2, 15); + +INSERT INTO `vn`.`invoiceOutSerial` (`code`, `description`, `isTaxed`, `taxAreaFk`, `isCEE`) + VALUES + ('A', 'Global nacional', 1, 'NATIONAL', 0), + ('T', 'Española rapida', 1, 'NATIONAL', 0), + ('V', 'Intracomunitaria global', 0, 'CEE', 1); + INSERT INTO `vn`.`ticket`(`id`, `agencyModeFk`,`warehouseFk`,`routeFk`, `shipped`, `landed`, `clientFk`,`nickname`, `addressFk`, `refFk`, `isDeleted`, `created`) VALUES - (1 , 1, 1, 1, DATE_ADD(CURDATE(), INTERVAL -15 DAY) , DATE_ADD(CURDATE(), INTERVAL -15 DAY) , 101, 'address 21', 121, 'T1111111', 0, DATE_ADD(CURDATE(), INTERVAL -15 DAY) ), - (2 , 1, 1, 1, DATE_ADD(CURDATE(), INTERVAL -10 DAY) , DATE_ADD(CURDATE(), INTERVAL -10 DAY) , 101, 'address 21', 121, 'T2222222', 0, DATE_ADD(CURDATE(), INTERVAL -10 DAY) ), - (3 , 2, 2, 2, DATE_ADD(CURDATE(), INTERVAL -5 DAY) , DATE_ADD(CURDATE(), INTERVAL -5 DAY) , 102, 'address 22', 122, 'T2222222', 0, DATE_ADD(CURDATE(), INTERVAL -5 DAY) ), - (4 , 2, 2, 2, DATE_ADD(CURDATE(), INTERVAL -4 DAY) , DATE_ADD(CURDATE(), INTERVAL -4 DAY) , 102, 'address 22', 122, 'T3333333', 0, DATE_ADD(CURDATE(), INTERVAL -4 DAY) ), - (5 , 3, 3, 3, DATE_ADD(CURDATE(), INTERVAL -3 DAY) , DATE_ADD(CURDATE(), INTERVAL -3 DAY) , 103, 'address 23', 123, 'T3333333', 0, DATE_ADD(CURDATE(), INTERVAL -3 DAY) ), - (6 , 3, 3, 4, DATE_ADD(CURDATE(), INTERVAL -2 DAY) , DATE_ADD(CURDATE(), INTERVAL -2 DAY) , 103, 'address 23', 123, 'T4444444', 0, DATE_ADD(CURDATE(), INTERVAL -2 DAY) ), - (7 , 4, 4, 4, DATE_ADD(CURDATE(), INTERVAL -1 DAY) , DATE_ADD(CURDATE(), INTERVAL -1 DAY) , 104, 'address 24', 124, 'T4444444', 0, DATE_ADD(CURDATE(), INTERVAL -1 DAY) ), - (8 , 1, 1, 4, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(CURDATE(), INTERVAL +1 MONTH), 104, 'address 24', 124, NULL, 0, DATE_ADD(CURDATE(), INTERVAL +1 MONTH) ), - (9 , 5, 5, 4, DATE_ADD(CURDATE(), INTERVAL -2 MONTH), DATE_ADD(CURDATE(), INTERVAL -2 MONTH), 105, 'address 25', 125, NULL, 0, DATE_ADD(CURDATE(), INTERVAL -2 MONTH) ), - (10, 6, 5, 5, DATE_ADD(CURDATE(), INTERVAL -3 MONTH), DATE_ADD(CURDATE(), INTERVAL -3 MONTH), 105, 'address 25', 125, NULL, 0, DATE_ADD(CURDATE(), INTERVAL -3 MONTH) ), - (11, 7, 1, 1, CURDATE() , CURDATE() , 101, 'address 21', 121, NULL, 0, CURDATE() ), - (12, 1, 1, 1, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(CURDATE(), INTERVAL +1 MONTH), 101, 'address 21', 121, NULL, 0, DATE_ADD(CURDATE(), INTERVAL +1 MONTH) ), - (13, 2, 2, 2, DATE_ADD(CURDATE(), INTERVAL +2 MONTH), DATE_ADD(CURDATE(), INTERVAL +2 MONTH), 101, 'address 21', 121, NULL, 0, DATE_ADD(CURDATE(), INTERVAL +2 MONTH) ), - (14, 2, 2, 2, DATE_ADD(CURDATE(), INTERVAL +3 MONTH), DATE_ADD(CURDATE(), INTERVAL +3 MONTH), 101, 'address 21', 121, NULL, 0, DATE_ADD(CURDATE(), INTERVAL +3 MONTH) ), - (15, 3, 3, 3, DATE_ADD(CURDATE(), INTERVAL +4 MONTH), DATE_ADD(CURDATE(), INTERVAL +4 MONTH), 101, 'address 21', 121, NULL, 0, DATE_ADD(CURDATE(), INTERVAL +4 MONTH) ), - (16, 1, 1, 1, CURDATE(), CURDATE(), 101, 'address 21', 121, NULL, 0, CURDATE() ), - (17, 4, 4, 4, CURDATE(), CURDATE(), 106, 'address 26', 126, NULL, 0, CURDATE() ), - (18, 4, 4, 4, CURDATE(), CURDATE(), 107, 'address 27', 127, NULL, 0, CURDATE() ), - (19, 5, 5, 4, DATE_ADD(CURDATE(), INTERVAL +1 DAY), DATE_ADD(CURDATE(), INTERVAL +1 DAY), 108, 'address 28', 128, NULL, 0, DATE_ADD(CURDATE(), INTERVAL +1 DAY) ), - (20, 5, 5, 4, DATE_ADD(CURDATE(), INTERVAL +1 DAY), DATE_ADD(CURDATE(), INTERVAL +1 DAY), 108, 'address 28', 128, NULL, 0, DATE_ADD(CURDATE(), INTERVAL +1 DAY) ), - (21, 5, 5, 4, CURDATE(), CURDATE(), 110, 'address 29', 129, NULL, 1, CURDATE() ), - (22, 5, 5, 4, DATE_ADD(CURDATE(), INTERVAL +1 DAY), DATE_ADD(CURDATE(), INTERVAL +1 DAY), 108, 'address 28', 128, NULL, 1, DATE_ADD(CURDATE(), INTERVAL +1 DAY) ); + (1 , 1, 1, 1, DATE_ADD(CURDATE(), INTERVAL -15 DAY) , DATE_ADD(CURDATE(), INTERVAL -15 DAY) , 101, 'address 21', 121, 'T1111111', 0, DATE_ADD(CURDATE(), INTERVAL -15 DAY) ), + (2 , 1, 1, 1, DATE_ADD(CURDATE(), INTERVAL -10 DAY) , DATE_ADD(CURDATE(), INTERVAL -10 DAY) , 101, 'address 21', 121, 'T2222222', 0, DATE_ADD(CURDATE(), INTERVAL -10 DAY) ), + (3 , 2, 2, 2, DATE_ADD(CURDATE(), INTERVAL -5 DAY) , DATE_ADD(CURDATE(), INTERVAL -5 DAY) , 102, 'address 22', 122, 'T2222222', 0, DATE_ADD(CURDATE(), INTERVAL -5 DAY) ), + (4 , 2, 2, 2, DATE_ADD(CURDATE(), INTERVAL -4 DAY) , DATE_ADD(CURDATE(), INTERVAL -4 DAY) , 102, 'address 22', 122, 'T3333333', 0, DATE_ADD(CURDATE(), INTERVAL -4 DAY) ), + (5 , 3, 3, 3, DATE_ADD(CURDATE(), INTERVAL -3 DAY) , DATE_ADD(CURDATE(), INTERVAL -3 DAY) , 103, 'address 23', 123, 'T3333333', 0, DATE_ADD(CURDATE(), INTERVAL -3 DAY) ), + (6 , 3, 3, 4, DATE_ADD(CURDATE(), INTERVAL -2 DAY) , DATE_ADD(CURDATE(), INTERVAL -2 DAY) , 103, 'address 23', 123, 'T4444444', 0, DATE_ADD(CURDATE(), INTERVAL -2 DAY) ), + (7 , 4, 4, 4, DATE_ADD(CURDATE(), INTERVAL -1 DAY) , DATE_ADD(CURDATE(), INTERVAL -1 DAY) , 104, 'address 24', 124, 'T4444444', 0, DATE_ADD(CURDATE(), INTERVAL -1 DAY) ), + (8 , 1, 1, 4, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(CURDATE(), INTERVAL +1 MONTH), 104, 'address 24', 124, NULL, 0, DATE_ADD(CURDATE(), INTERVAL +1 MONTH) ), + (9 , 5, 5, 4, DATE_ADD(CURDATE(), INTERVAL -2 MONTH), DATE_ADD(CURDATE(), INTERVAL -2 MONTH), 105, 'address 25', 125, 'A1111111', 0, DATE_ADD(CURDATE(), INTERVAL -2 MONTH) ), + (10, 6, 5, 5, DATE_ADD(CURDATE(), INTERVAL -3 MONTH), DATE_ADD(CURDATE(), INTERVAL -3 MONTH), 105, 'address 25', 125, 'A1111111', 0, DATE_ADD(CURDATE(), INTERVAL -3 MONTH) ), + (11, 7, 1, 1, CURDATE() , CURDATE() , 101, 'address 21', 121, NULL, 0, CURDATE() ), + (12, 1, 1, 1, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(CURDATE(), INTERVAL +1 MONTH), 101, 'address 21', 121, NULL, 0, DATE_ADD(CURDATE(), INTERVAL +1 MONTH) ), + (13, 2, 2, 2, DATE_ADD(CURDATE(), INTERVAL +2 MONTH), DATE_ADD(CURDATE(), INTERVAL +2 MONTH), 101, 'address 21', 121, NULL, 0, DATE_ADD(CURDATE(), INTERVAL +2 MONTH) ), + (14, 2, 2, 2, DATE_ADD(CURDATE(), INTERVAL +3 MONTH), DATE_ADD(CURDATE(), INTERVAL +3 MONTH), 101, 'address 21', 121, NULL, 0, DATE_ADD(CURDATE(), INTERVAL +3 MONTH) ), + (15, 3, 3, 3, DATE_ADD(CURDATE(), INTERVAL +4 MONTH), DATE_ADD(CURDATE(), INTERVAL +4 MONTH), 101, 'address 21', 121, NULL, 0, DATE_ADD(CURDATE(), INTERVAL +4 MONTH) ), + (16, 1, 1, 1, CURDATE(), CURDATE(), 101, 'address 21', 121, NULL, 0, CURDATE() ), + (17, 4, 4, 4, CURDATE(), CURDATE(), 106, 'address 26', 126, NULL, 0, CURDATE() ), + (18, 4, 4, 4, CURDATE(), CURDATE(), 107, 'address 27', 127, NULL, 0, CURDATE() ), + (19, 5, 5, 4, DATE_ADD(CURDATE(), INTERVAL +1 DAY), DATE_ADD(CURDATE(), INTERVAL +1 DAY), 108, 'address 28', 128, NULL, 0, DATE_ADD(CURDATE(), INTERVAL +1 DAY) ), + (20, 5, 5, 4, DATE_ADD(CURDATE(), INTERVAL +1 DAY), DATE_ADD(CURDATE(), INTERVAL +1 DAY), 108, 'address 28', 128, NULL, 0, DATE_ADD(CURDATE(), INTERVAL +1 DAY) ), + (21, 5, 5, 4, CURDATE(), CURDATE(), 110, 'address 29', 129, NULL, 1, CURDATE() ), + (22, 5, 5, 4, DATE_ADD(CURDATE(), INTERVAL +1 DAY), DATE_ADD(CURDATE(), INTERVAL +1 DAY), 108, 'address 28', 128, NULL, 1, DATE_ADD(CURDATE(), INTERVAL +1 DAY) ); INSERT INTO `vn`.`ticketObservation`(`id`, `ticketFk`, `observationTypeFk`, `description`) VALUES @@ -1217,10 +1230,11 @@ INSERT INTO `vn`.`ticketRequest`(`id`, `description`, `requesterFk`, `atenderFk` INSERT INTO `vn`.`ticketService`(`id`, `description`, `quantity`, `price`, `taxClassFk`, `ticketFk`) VALUES - (1, 'Documentos', 1, 2.00, 1, 1), - (2, 'Porte Agencia', 1, 10.00, 1, 2), - (3, 'Documentos', 1, 5.50, 1, 11), - (4, 'Documentos', 1, 2.00, 1, 9); + (1, 'Documentos', 1, 2.00, 1, 1), + (2, 'Porte Agencia', 1, 10.00, 1, 2), + (3, 'Documentos', 1, 5.50, 1, 11), + (4, 'Documentos', 1, 2.00, 1, 9), + (5, 'Documentos', 1, 2.00, 1, 8); INSERT INTO `vn`.`zone` (`id`, `name`, `hour`, `warehouseFk`, `agencyModeFk`, `travelingDays`, `price`, `bonus`) diff --git a/e2e/paths/05-ticket-module/13_create_ticket_services.spec.js b/e2e/paths/05-ticket-module/13_create_ticket_services.spec.js index 5b6bfff49..90373366b 100644 --- a/e2e/paths/05-ticket-module/13_create_ticket_services.spec.js +++ b/e2e/paths/05-ticket-module/13_create_ticket_services.spec.js @@ -7,7 +7,7 @@ describe('Ticket services path', () => { beforeAll(() => { nightmare .loginAndModule('employee', 'ticket') - .accessToSearchResult(9) + .accessToSearchResult(8) .accessToSection('ticket.card.service'); }); diff --git a/modules/client/back/methods/client/specs/getCard.spec.js b/modules/client/back/methods/client/specs/getCard.spec.js index 821dd23f7..04cb7918e 100644 --- a/modules/client/back/methods/client/specs/getCard.spec.js +++ b/modules/client/back/methods/client/specs/getCard.spec.js @@ -7,6 +7,6 @@ describe('Client get', () => { expect(result.id).toEqual(101); expect(result.name).toEqual('Bruce Wayne'); - expect(result.debt).toEqual(329.13); + expect(result.debt).toEqual(-14.78); }); }); diff --git a/modules/client/back/methods/client/specs/getDebt.spec.js b/modules/client/back/methods/client/specs/getDebt.spec.js index b69ae8624..2d4ebdb0d 100644 --- a/modules/client/back/methods/client/specs/getDebt.spec.js +++ b/modules/client/back/methods/client/specs/getDebt.spec.js @@ -4,7 +4,7 @@ describe('client getDebt()', () => { it('should return the client debt', async() => { let result = await app.models.Client.getDebt(101); - expect(result.debt).toEqual(329.13); + expect(result.debt).toEqual(-14.78); }); }); diff --git a/modules/client/back/methods/client/specs/summary.spec.js b/modules/client/back/methods/client/specs/summary.spec.js index 55801fdb9..d9847b2c1 100644 --- a/modules/client/back/methods/client/specs/summary.spec.js +++ b/modules/client/back/methods/client/specs/summary.spec.js @@ -17,7 +17,7 @@ describe('client summary()', () => { it('should return a summary object containing debt', async() => { let result = await app.models.Client.summary(101); - expect(result.debt.debt).toEqual(329.13); + expect(result.debt.debt).toEqual(-14.78); }); it('should return a summary object containing averageInvoiced', async() => { From 69403223d811b5e74ca1f1c0ba00125c100a8e60 Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Mon, 29 Apr 2019 11:49:43 +0200 Subject: [PATCH 49/59] fixed treeview #1374 --- db/changes/10003-easter/00-nodeAdd.sql | 71 ++++++++++++++ db/changes/10003-easter/00-nodeDelete.sql | 34 +++++++ db/changes/10003-easter/00-nodeRecalc.sql | 23 +++++ front/core/components/calendar/index.js | 2 +- front/core/components/treeview/child.html | 93 ++++++++++--------- front/core/components/treeview/child.js | 6 +- front/core/components/treeview/index.html | 8 +- front/core/components/treeview/index.js | 5 +- front/core/components/treeview/style.scss | 17 ++-- front/core/directives/draggable.js | 9 +- front/core/directives/droppable.js | 3 + modules/agency/front/location/index.html | 5 +- .../worker/back/methods/department/nodeAdd.js | 2 +- modules/worker/back/models/department.js | 4 - modules/worker/front/department/index.html | 4 +- 15 files changed, 215 insertions(+), 71 deletions(-) create mode 100644 db/changes/10003-easter/00-nodeAdd.sql create mode 100644 db/changes/10003-easter/00-nodeDelete.sql create mode 100644 db/changes/10003-easter/00-nodeRecalc.sql diff --git a/db/changes/10003-easter/00-nodeAdd.sql b/db/changes/10003-easter/00-nodeAdd.sql new file mode 100644 index 000000000..80c716b45 --- /dev/null +++ b/db/changes/10003-easter/00-nodeAdd.sql @@ -0,0 +1,71 @@ +DROP procedure IF EXISTS `nst`.`nodeAdd`; + +DELIMITER $$ +CREATE DEFINER=`root`@`%` PROCEDURE `nst`.`nodeAdd`(IN `vScheme` VARCHAR(45), IN `vTable` VARCHAR(45), IN `vParentFk` INT, IN `vChild` VARCHAR(100)) +BEGIN + DECLARE vSql TEXT; + DECLARE vTableClone VARCHAR(45); + + SET vTableClone = CONCAT(vTable, 'Clone'); + + CALL util.exec(CONCAT('DROP TEMPORARY TABLE IF EXISTS tmp.', vTableClone)); + CALL util.exec(CONCAT( + 'CREATE TEMPORARY TABLE tmp.', vTableClone, + ' ENGINE = MEMORY', + ' SELECT * FROM ', vScheme, '.', vTable + )); + + CALL util.exec(CONCAT( + 'SELECT COUNT(c.id) INTO @childs', + ' FROM ', vScheme, '.', vTable, ' p', + ' LEFT JOIN tmp.', vTableClone, ' c ON c.lft', + ' BETWEEN p.lft AND p.rgt AND c.id != ', vParentFk, + ' WHERE p.id = ', vParentFk + )); + + IF @childs = 0 THEN + CALL util.exec(CONCAT( + 'SELECT lft INTO @vLeft', + ' FROM ', vScheme, '.', vTable, + ' WHERE id = ', vParentFk + )); + ELSE + CALL util.exec(CONCAT( + 'SELECT c.rgt INTO @vLeft', + ' FROM ', vScheme, '.', vTable, ' p', + ' JOIN tmp.', vTableClone, ' c ON c.lft BETWEEN p.lft AND p.rgt', + ' WHERE p.id = ', vParentFk, + ' ORDER BY c.lft', + ' DESC LIMIT 1' + )); + END IF; + + CALL util.exec(CONCAT( + 'UPDATE ', vScheme, '.', vTable, ' SET rgt = rgt + 2', + ' WHERE rgt > @vLeft', + ' ORDER BY rgt DESC' + )); + CALL util.exec(CONCAT( + 'UPDATE ', vScheme, '.', vTable, ' SET lft = lft + 2', + ' WHERE lft > @vLeft', + ' ORDER BY lft DESC' + )); + + SET vChild = REPLACE(vChild, "'", "\\'"); + + CALL util.exec(CONCAT( + 'INSERT INTO ', vScheme, '.', vTable, ' (name, lft, rgt)', + ' VALUES ("', vChild, '", @vLeft + 1, @vLeft + 2)' + )); + + CALL util.exec(CONCAT( + 'SELECT id, name, lft, rgt, depth, sons', + ' FROM ', vScheme, '.', vTable, + ' WHERE id = LAST_INSERT_ID()' + )); + + CALL util.exec(CONCAT('DROP TEMPORARY TABLE tmp.', vTableClone)); +END$$ + +DELIMITER ; + diff --git a/db/changes/10003-easter/00-nodeDelete.sql b/db/changes/10003-easter/00-nodeDelete.sql new file mode 100644 index 000000000..906428c88 --- /dev/null +++ b/db/changes/10003-easter/00-nodeDelete.sql @@ -0,0 +1,34 @@ +DROP procedure IF EXISTS `nst`.`nodeDelete`; + +DELIMITER $$ +CREATE DEFINER=`root`@`%` PROCEDURE `nst`.`nodeDelete`(IN `vScheme` VARCHAR(45), IN `vTable` VARCHAR(45), IN `vNodeId` INT) +BEGIN + DECLARE vMyRight INT; + DECLARE vMyLeft INT; + DECLARE vMyWidth INT; + + CALL util.exec(CONCAT( + 'SELECT t.rgt, t.lft, t.rgt - t.lft + 1', + ' INTO @vMyRight, @vMyLeft, @vMyWidth', + ' FROM ', vScheme, '.', vTable, ' t', + ' WHERE t.id = ', vNodeId + )); + + CALL util.exec(CONCAT( + 'DELETE FROM ', vScheme, '.', vTable, + ' WHERE lft BETWEEN @vMyLeft AND @vMyRight' + )); + + CALL util.exec(CONCAT( + 'UPDATE ', vScheme, '.', vTable, ' SET rgt = rgt - @vMyWidth' + ' WHERE rgt > @vMyRight ORDER BY rgt' + )); + + CALL util.exec(CONCAT( + 'UPDATE ', vScheme, '.', vTable, ' SET lft = lft - @vMyWidth' + ' WHERE lft > @vMyRight ORDER BY lft' + )); +END$$ + +DELIMITER ; + diff --git a/db/changes/10003-easter/00-nodeRecalc.sql b/db/changes/10003-easter/00-nodeRecalc.sql new file mode 100644 index 000000000..ff103bda7 --- /dev/null +++ b/db/changes/10003-easter/00-nodeRecalc.sql @@ -0,0 +1,23 @@ +DROP procedure IF EXISTS `nst`.`nodeRecalc`; + +DELIMITER $$ +CREATE DEFINER=`root`@`%` PROCEDURE `nst`.`nodeRecalc`(IN `vScheme` VARCHAR(45), IN `vTable` VARCHAR(45)) +BEGIN + CALL util.exec(CONCAT ( + 'UPDATE ', vScheme, '.', vTable, ' d', + ' JOIN (SELECT', + ' node.id,', + ' COUNT(parent.id) - 1 as depth,', + ' cast((node.rgt - node.lft - 1) / 2 as DECIMAL) as sons', + ' FROM ', + ' ', vScheme, '.', vTable, ' AS node,', + ' ', vScheme, '.', vTable, ' AS parent', + ' WHERE node.lft BETWEEN parent.lft AND parent.rgt', + ' GROUP BY node.id', + ' ORDER BY node.lft) n ON n.id = d.id ', + ' SET d.`depth` = n.depth, d.sons = n.sons' + )); +END$$ + +DELIMITER ; + diff --git a/front/core/components/calendar/index.js b/front/core/components/calendar/index.js index 8948b5d65..bc356053b 100644 --- a/front/core/components/calendar/index.js +++ b/front/core/components/calendar/index.js @@ -3,7 +3,7 @@ import Component from '../../lib/component'; import './style.scss'; /** - * Calendar. + * Flat calendar. * */ export default class Calendar extends Component { diff --git a/front/core/components/treeview/child.html b/front/core/components/treeview/child.html index c1f20bcff..eedd63b19 100644 --- a/front/core/components/treeview/child.html +++ b/front/core/components/treeview/child.html @@ -1,18 +1,17 @@
    -
  • - - - - - - +
  • + + + + + - {{::item.name}} - - - - - - - - -
  • -
  • - - - - -
    - Create new one -
    -
    -
  • -
\ No newline at end of file + {{::item.name}} + + + + + + + + +
  • + + + + +
    + Create new one +
    +
    +
  • + \ No newline at end of file diff --git a/front/core/components/treeview/child.js b/front/core/components/treeview/child.js index a26c47b5d..8fecbd89b 100644 --- a/front/core/components/treeview/child.js +++ b/front/core/components/treeview/child.js @@ -16,8 +16,7 @@ class Controller extends Component { } onIconClick(icon, item, parent, index) { - let parentScope = this.$scope.$parent.$parent; - let parentController = parentScope.$ctrl; + let parentController = this.parentScope.$ctrl; icon.callback.call(parentController, item, parent, index); } @@ -44,7 +43,10 @@ ngModule.component('vnTreeviewChild', { disabled: ' + parent-scope="$ctrl.$scope.$parent" + draggable="$ctrl.draggable" + droppable="$ctrl.droppable" + vn-droppable="{{$ctrl.droppable}}"> diff --git a/front/core/components/treeview/index.js b/front/core/components/treeview/index.js index c34ba2039..ac4186c58 100644 --- a/front/core/components/treeview/index.js +++ b/front/core/components/treeview/index.js @@ -3,13 +3,14 @@ import Component from '../../lib/component'; import './style.scss'; /** - * A simple tooltip. + * Treeview * * @property {String} position The relative position to the parent */ export default class Treeview extends Component { constructor($element, $scope) { super($element, $scope); + this.$scope = $scope; this.data = []; } @@ -86,6 +87,8 @@ ngModule.component('vnTreeview', { disabled: ' vn-horizontal > .description { color: $color-notice; font-weight: bold; - - & > vn-check .md-icon { - background-color: $color-notice - } } + & > vn-horizontal > vn-check .md-icon { + background-color: $color-notice + } } li.excluded { & > vn-horizontal > .description { color: $color-alert; font-weight: bold; - + } + + & > vn-horizontal > vn-check .md-icon { + background-color: $color-alert; + border-color: transparent } } } diff --git a/front/core/directives/draggable.js b/front/core/directives/draggable.js index 588b97adf..3b68a6cb6 100644 --- a/front/core/directives/draggable.js +++ b/front/core/directives/draggable.js @@ -8,8 +8,15 @@ import ngModule from '../module'; export function directive() { return { restrict: 'A', - link: function($scope, $element) { + link: function($scope, $element, $attrs) { const element = $element[0]; + const isDraggable = $attrs.vnDraggable === 'true'; + + if (!isDraggable) return; + + // Set draggable style properties + element.style.cursor = 'move'; + // Enable as draggable element element.setAttribute('draggable', true); diff --git a/front/core/directives/droppable.js b/front/core/directives/droppable.js index 73f0db093..b99f397c7 100644 --- a/front/core/directives/droppable.js +++ b/front/core/directives/droppable.js @@ -7,6 +7,9 @@ export function directive($parse) { link: function($scope, $element, $attrs) { const element = $element[0]; const onDropEvent = $parse($attrs.onDrop); + const isDroppable = $attrs.vnDroppable === 'true'; + + if (!isDroppable) return; /** * Captures current dragging element diff --git a/modules/agency/front/location/index.html b/modules/agency/front/location/index.html index c33a71e3c..42662ef2b 100644 --- a/modules/agency/front/location/index.html +++ b/modules/agency/front/location/index.html @@ -12,8 +12,9 @@ on-search="$ctrl.onSearch()" vn-focus> - + diff --git a/modules/worker/back/methods/department/nodeAdd.js b/modules/worker/back/methods/department/nodeAdd.js index bbbcd82ef..58c50f0bd 100644 --- a/modules/worker/back/methods/department/nodeAdd.js +++ b/modules/worker/back/methods/department/nodeAdd.js @@ -29,7 +29,7 @@ module.exports = Self => { let stmts = []; let conn = Self.dataSource.connector; let nodeIndex = stmts.push(new ParameterizedSQL( - `CALL nst.NodeAdd('vn', 'department', ?, ?)`, [parentFk, name])) - 1; + `CALL nst.nodeAdd('vn', 'department', ?, ?)`, [parentFk, name])) - 1; stmts.push(`CALL nst.nodeRecalc('vn', 'department')`); diff --git a/modules/worker/back/models/department.js b/modules/worker/back/models/department.js index 99b470dbb..085c2bf9b 100644 --- a/modules/worker/back/models/department.js +++ b/modules/worker/back/models/department.js @@ -8,10 +8,6 @@ module.exports = Self => { Self.rewriteDbError(function(err) { if (err.code === 'ER_ROW_IS_REFERENCED_2') return new UserError(`You cannot remove this department`); - return err; - }); - - Self.rewriteDbError(function(err) { if (err.code === 'ER_DUP_ENTRY') return new UserError(`The department name can't be repeated`); return err; diff --git a/modules/worker/front/department/index.html b/modules/worker/front/department/index.html index 5dac26eca..6cf2cd063 100644 --- a/modules/worker/front/department/index.html +++ b/modules/worker/front/department/index.html @@ -12,7 +12,9 @@ on-selection="$ctrl.onSelection(item, value)" on-create="$ctrl.onCreate(parent)" on-drop="$ctrl.onDrop(item, dragged, dropped)" - icons="$ctrl.icons" editable="true" acl-role="hr"> + icons="$ctrl.icons" + draggable="true" droppable="true" + acl-role="hr" editable="true">
    From 6b6faff383b327985063da04e3536e579ad66856 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Mon, 29 Apr 2019 13:22:32 +0200 Subject: [PATCH 50/59] #1386 e2e Item regularize path --- e2e/paths/04-item-module/09_regularize.spec.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/e2e/paths/04-item-module/09_regularize.spec.js b/e2e/paths/04-item-module/09_regularize.spec.js index 7b5f71009..8d352b493 100644 --- a/e2e/paths/04-item-module/09_regularize.spec.js +++ b/e2e/paths/04-item-module/09_regularize.spec.js @@ -1,8 +1,7 @@ import selectors from '../../helpers/selectors.js'; import createNightmare from '../../helpers/nightmare'; -// #1386 e2e Item regularize path -xdescribe('Item regularize path', () => { +describe('Item regularize path', () => { const nightmare = createNightmare(); beforeAll(() => { nightmare @@ -177,7 +176,7 @@ xdescribe('Item regularize path', () => { it('should search for the ticket with id 23 once again', async() => { const result = await nightmare - .write(selectors.ticketsIndex.searchTicketInput, 'id:24') + .write(selectors.ticketsIndex.searchTicketInput, 23) .waitToClick(selectors.ticketsIndex.searchButton) .waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1) .countElement(selectors.ticketsIndex.searchResult); @@ -187,7 +186,7 @@ xdescribe('Item regularize path', () => { it(`should now click on the search result to access to the ticket summary`, async() => { const url = await nightmare - .waitForTextInElement(selectors.ticketsIndex.searchResult, '24') + .waitForTextInElement(selectors.ticketsIndex.searchResult, '23') .waitToClick(selectors.ticketsIndex.searchResult) .waitForURL('/summary') .parsedUrl(); From a572130b6c9a84c4acac4e74bfba60a94c2dbbd1 Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Tue, 30 Apr 2019 08:00:27 +0200 Subject: [PATCH 51/59] propagate check value to multicheck component for intermediate value #1305 --- ...d.spec.js => 04_edit_billing_data.spec.js} | 0 .../components/multi-check/multi-check.html | 6 +- .../components/multi-check/multi-check.js | 73 ++++++++++++++++--- front/core/locale/es.yml | 3 +- modules/route/front/tickets/index.html | 2 +- modules/ticket/front/index/index.html | 2 +- modules/ticket/front/sale/index.html | 2 +- 7 files changed, 73 insertions(+), 15 deletions(-) rename e2e/paths/02-client-module/{04_edit_pay_method.spec.js => 04_edit_billing_data.spec.js} (100%) diff --git a/e2e/paths/02-client-module/04_edit_pay_method.spec.js b/e2e/paths/02-client-module/04_edit_billing_data.spec.js similarity index 100% rename from e2e/paths/02-client-module/04_edit_pay_method.spec.js rename to e2e/paths/02-client-module/04_edit_billing_data.spec.js diff --git a/front/core/components/multi-check/multi-check.html b/front/core/components/multi-check/multi-check.html index 53c0262ed..2d51324f0 100644 --- a/front/core/components/multi-check/multi-check.html +++ b/front/core/components/multi-check/multi-check.html @@ -1 +1,5 @@ - \ No newline at end of file + + \ No newline at end of file diff --git a/front/core/components/multi-check/multi-check.js b/front/core/components/multi-check/multi-check.js index 14c5d6a9a..bb0279706 100644 --- a/front/core/components/multi-check/multi-check.js +++ b/front/core/components/multi-check/multi-check.js @@ -12,21 +12,74 @@ export default class MultiCheck extends Input { super($element, $scope); this._checkAll = false; this.checkField = 'checked'; + this.isIntermediate = false; } - get checkAll() { - return this._checkAll; + /** + * Gets array model instance + * + * @return {ArrayModel} - Array model instance + */ + get model() { + return this._model; } - set checkAll(value) { - this._checkAll = value; - this.switchChecks(); + /** + * Sets the array model instance + * Changes intermediate property for + * the check component + * + * @param {ArrayModel} value - Array model instance + */ + set model(value) { + this._model = value; + + if (value) { + value.on('rowChange', () => { + this.isIntermediate = this.allChecked && !this.areAllChecked(); + if (this.isIntermediate) + this._checked = undefined; + else if (this.areAllChecked()) + this._checked = true; + }); + } } - switchChecks() { - if (!this.data) return; - this.data.forEach(el => { - el[this.checkField] = this._checkAll; + /** + * Returns a bolean result for + * checked instances + * + * @return {Boolean} - True if all instances are checked + */ + areAllChecked() { + if (!this.model || !this.model.data) return; + + const data = this.model.data; + return data.every(item => { + return item[this.checkField] === true; + }); + } + + /** + * Gets current check state + */ + get checked() { + return this._checked; + } + + /** + * Sets current check state + * + * @param {Boolean} value - Checkbox state [undefined, true, false] + */ + set checked(value) { + this._checked = value; + this.allChecked = value; + + const data = this.model.data; + if (!data) return; + data.forEach(el => { + el[this.checkField] = value; }); } } @@ -35,7 +88,7 @@ ngModule.component('vnMultiCheck', { template: require('./multi-check.html'), controller: MultiCheck, bindings: { - data: '=', + model: '<', checkField: ' + model="model"> Order diff --git a/modules/ticket/front/index/index.html b/modules/ticket/front/index/index.html index c5c82bc75..7cfbbf244 100644 --- a/modules/ticket/front/index/index.html +++ b/modules/ticket/front/index/index.html @@ -36,7 +36,7 @@ + model="model"> diff --git a/modules/ticket/front/sale/index.html b/modules/ticket/front/sale/index.html index 89848a99f..d57c0b7c2 100644 --- a/modules/ticket/front/sale/index.html +++ b/modules/ticket/front/sale/index.html @@ -56,7 +56,7 @@ + model="model"> From 6c3cea56aa6b8cfb537508b05e5e27b2cddeee43 Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Tue, 30 Apr 2019 09:19:40 +0200 Subject: [PATCH 52/59] fixed multi-check karma unit tests --- .../components/multi-check/multi-check.js | 56 ++++++++--- .../multi-check/multi-check.spec.js | 98 +++++++++++++++---- front/core/mocks/crud-model.js | 9 +- 3 files changed, 128 insertions(+), 35 deletions(-) diff --git a/front/core/components/multi-check/multi-check.js b/front/core/components/multi-check/multi-check.js index bb0279706..b210d01d4 100644 --- a/front/core/components/multi-check/multi-check.js +++ b/front/core/components/multi-check/multi-check.js @@ -10,7 +10,7 @@ import Input from '../../lib/input'; export default class MultiCheck extends Input { constructor($element, $scope) { super($element, $scope); - this._checkAll = false; + this._checked = false; this.checkField = 'checked'; this.isIntermediate = false; } @@ -36,15 +36,35 @@ export default class MultiCheck extends Input { if (value) { value.on('rowChange', () => { - this.isIntermediate = this.allChecked && !this.areAllChecked(); - if (this.isIntermediate) - this._checked = undefined; - else if (this.areAllChecked()) + this.isIntermediate = !this.areAllUnchecked() && !this.areAllChecked(); + + if (this.areAllChecked()) this._checked = true; + else if (!this.areAllChecked()) + this._checked = false; }); } } + /** + * Gets current check state + */ + get checked() { + return this._checked; + } + + /** + * Sets current check state + * + * @param {Boolean} value - Checkbox state [undefined, true, false] + */ + set checked(value) { + this._checked = value; + this.checkAll = value; + + this.toggle(); + } + /** * Returns a bolean result for * checked instances @@ -61,25 +81,29 @@ export default class MultiCheck extends Input { } /** - * Gets current check state + * Returns a bolean result for + * checked instances + * + * @return {Boolean} - False if all instances are checked */ - get checked() { - return this._checked; + areAllUnchecked() { + if (!this.model || !this.model.data) return; + + const data = this.model.data; + return data.every(item => { + return item[this.checkField] === false; + }); } /** - * Sets current check state - * - * @param {Boolean} value - Checkbox state [undefined, true, false] + * Toggles checked property on + * all instances */ - set checked(value) { - this._checked = value; - this.allChecked = value; - + toggle() { const data = this.model.data; if (!data) return; data.forEach(el => { - el[this.checkField] = value; + el[this.checkField] = this.checkAll; }); } } diff --git a/front/core/components/multi-check/multi-check.spec.js b/front/core/components/multi-check/multi-check.spec.js index 748fa5871..c85b160c1 100644 --- a/front/core/components/multi-check/multi-check.spec.js +++ b/front/core/components/multi-check/multi-check.spec.js @@ -1,4 +1,5 @@ import './multi-check.js'; +import crudModel from 'core/mocks/crud-model'; describe('Component vnMultiCheck', () => { let controller; @@ -9,33 +10,94 @@ describe('Component vnMultiCheck', () => { beforeEach(angular.mock.inject($componentController => { $element = angular.element(`
    `); controller = $componentController('vnMultiCheck', {$element: $element}); + controller._model = crudModel; + controller._model.data = [ + {id: 1, name: 'My item 1'}, + {id: 2, name: 'My item 2'}, + {id: 3, name: 'My item 3'} + ]; })); - describe('checkAll() setter', () => { - it(`should set controller _checkAll property with the argument received then call switchChecks()`, () => { - let argument = 'I am the model'; - spyOn(controller, 'switchChecks'); - controller.checkAll = argument; + describe('checked() setter', () => { + it(`should set controller _checked property with the argument received then call toggle()`, () => { + spyOn(controller, 'toggle'); + controller.checked = crudModel; - expect(controller._checkAll).toEqual(argument); - expect(controller.switchChecks).toHaveBeenCalledWith(); + expect(controller._checked).toEqual(crudModel); + expect(controller.toggle).toHaveBeenCalledWith(); }); }); - describe('switchChecks()', () => { + describe('toggle()', () => { it(`should set checked property inside each existing element`, () => { - controller.data = [ - {name: 'name'}, - {name: null} - ]; + const data = controller.model.data; - expect(controller.data[0].checked).not.toBeDefined(); - expect(controller.data[1].checked).not.toBeDefined(); - controller._checkAll = 1; - controller.switchChecks(); + expect(data[0].checked).not.toBeDefined(); + expect(data[1].checked).not.toBeDefined(); + expect(data[2].checked).not.toBeDefined(); - expect(controller.data[0].checked).toBeTruthy(); - expect(controller.data[1].checked).toBeTruthy(); + controller._checked = true; + controller.checkAll = true; + controller.toggle(); + + expect(data[0].checked).toBeTruthy(); + expect(data[1].checked).toBeTruthy(); + expect(data[2].checked).toBeTruthy(); + }); + + it(`should unset checked property inside each existing element`, () => { + const data = controller.model.data; + data[0].checked = true; + data[1].checked = true; + data[2].checked = true; + + controller._checked = false; + controller.checkAll = false; + controller.toggle(); + + expect(data[0].checked).toBeFalsy(); + expect(data[1].checked).toBeFalsy(); + expect(data[2].checked).toBeFalsy(); + }); + }); + + describe('areAllChecked()', () => { + it(`should set return true if all elements are checked`, () => { + const data = controller.model.data; + data[0].checked = true; + data[1].checked = true; + data[2].checked = true; + + expect(controller.areAllChecked()).toBeTruthy(); + }); + + it(`should set return false if not all elements are checked`, () => { + const data = controller.model.data; + data[0].checked = true; + data[1].checked = false; + data[2].checked = true; + + expect(controller.areAllChecked()).toBeFalsy(); + }); + }); + + describe('areAllUnchecked()', () => { + it(`should set return true if all elements are unchecked`, () => { + const data = controller.model.data; + data[0].checked = false; + data[1].checked = false; + data[2].checked = false; + + expect(controller.areAllUnchecked()).toBeTruthy(); + }); + + it(`should set return false if not all elements are unchecked`, () => { + const data = controller.model.data; + data[0].checked = false; + data[1].checked = true; + data[2].checked = false; + + expect(controller.areAllUnchecked()).toBeFalsy(); }); }); }); diff --git a/front/core/mocks/crud-model.js b/front/core/mocks/crud-model.js index e86f9d63e..af6406eec 100644 --- a/front/core/mocks/crud-model.js +++ b/front/core/mocks/crud-model.js @@ -24,7 +24,14 @@ module.exports = { } }; }, + on: () => { + return { + then: callback => { + callback({data: {id: 1234}}); + } + }; + }, refresh: () => {}, addFilter: () => {}, - applyFilter: () => {} + applyFilter: () => {}, }; From a81e70525167fc5e00946af3fe588d692b031588 Mon Sep 17 00:00:00 2001 From: Bernat Date: Tue, 30 Apr 2019 11:03:48 +0200 Subject: [PATCH 53/59] #1341 invoiceOut.descriptor book invoiceOut --- db/changes/10003-easter/00-ACL.sql | 1 + .../back/methods/invoiceOut/book.js | 26 +++++++++++++++ .../methods/invoiceOut/specs/book.spec.js | 32 +++++++++++++++++++ modules/invoiceOut/back/models/invoiceOut.js | 1 + .../invoiceOut/front/descriptor/index.html | 5 +++ modules/invoiceOut/front/descriptor/index.js | 17 +++++++++- .../invoiceOut/front/descriptor/locale/es.yml | 5 ++- 7 files changed, 85 insertions(+), 2 deletions(-) create mode 100644 modules/invoiceOut/back/methods/invoiceOut/book.js create mode 100644 modules/invoiceOut/back/methods/invoiceOut/specs/book.spec.js diff --git a/db/changes/10003-easter/00-ACL.sql b/db/changes/10003-easter/00-ACL.sql index e92e14f8a..424d0546b 100644 --- a/db/changes/10003-easter/00-ACL.sql +++ b/db/changes/10003-easter/00-ACL.sql @@ -1 +1,2 @@ INSERT INTO `salix`.`ACL` (`id`, `model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES (162, 'InvoiceOut', 'delete', 'WRITE', 'ALLOW', 'ROLE', 'invoicing'); +INSERT INTO `salix`.`ACL` (`id`, `model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES (163, 'InvoiceOut', 'book', 'WRITE', 'ALLOW', 'ROLE', 'invoicing'); diff --git a/modules/invoiceOut/back/methods/invoiceOut/book.js b/modules/invoiceOut/back/methods/invoiceOut/book.js new file mode 100644 index 000000000..eeddcd7f5 --- /dev/null +++ b/modules/invoiceOut/back/methods/invoiceOut/book.js @@ -0,0 +1,26 @@ + +module.exports = Self => { + Self.remoteMethod('book', { + description: 'Book a invoiceOut', + accessType: 'WRITE', + accepts: { + arg: 'ref', + type: 'string', + required: true, + description: 'The invoiceOut ref', + http: {source: 'path'} + }, + returns: { + type: 'object', + root: true + }, + http: { + path: `/:ref/book`, + verb: 'POST' + } + }); + + Self.book = async ref => { + return Self.rawSql(`CALL vn.invoiceOutAgain(?)`, [ref]); + }; +}; diff --git a/modules/invoiceOut/back/methods/invoiceOut/specs/book.spec.js b/modules/invoiceOut/back/methods/invoiceOut/specs/book.spec.js new file mode 100644 index 000000000..383e952b6 --- /dev/null +++ b/modules/invoiceOut/back/methods/invoiceOut/specs/book.spec.js @@ -0,0 +1,32 @@ +const app = require('vn-loopback/server/server'); + +describe('invoiceOut book()', () => { + const invoiceOutId = 5; + let invoiceOutRef; + let OriginalInvoiceOut; + let updatedInvoiceOut; + afterAll(async done => { + updatedInvoiceOut.updateAttributes({booked: OriginalInvoiceOut.booked, hasPdf: OriginalInvoiceOut.hasPdf}); + + done(); + }); + + it('should check that invoice out booked is untainted', async() => { + const invoiceOut = await app.models.InvoiceOut.findById(invoiceOutId); + + expect(invoiceOut.booked).toBeNull(); + expect(invoiceOut.hasPdf).toBeTruthy(); + }); + + it(`should confirm the book property have been updated`, async() => { + OriginalInvoiceOut = await app.models.InvoiceOut.findById(invoiceOutId); + invoiceOutRef = OriginalInvoiceOut.ref; + + await app.models.InvoiceOut.book(invoiceOutRef); + + updatedInvoiceOut = await app.models.InvoiceOut.findById(invoiceOutId); + + expect(updatedInvoiceOut.booked).toEqual(jasmine.any(Object)); + expect(updatedInvoiceOut.hasPdf).toBeFalsy(); + }); +}); diff --git a/modules/invoiceOut/back/models/invoiceOut.js b/modules/invoiceOut/back/models/invoiceOut.js index ccc598989..8046f1dc4 100644 --- a/modules/invoiceOut/back/models/invoiceOut.js +++ b/modules/invoiceOut/back/models/invoiceOut.js @@ -4,4 +4,5 @@ module.exports = Self => { require('../methods/invoiceOut/download')(Self); require('../methods/invoiceOut/regenerate')(Self); require('../methods/invoiceOut/delete')(Self); + require('../methods/invoiceOut/book')(Self); }; diff --git a/modules/invoiceOut/front/descriptor/index.html b/modules/invoiceOut/front/descriptor/index.html index ccc5d424e..211560d28 100644 --- a/modules/invoiceOut/front/descriptor/index.html +++ b/modules/invoiceOut/front/descriptor/index.html @@ -57,4 +57,9 @@ vn-id="deleteConfirmation" on-response="$ctrl.deleteInvoiceOut(response)" question="Are you sure you want to delete this invoice?"> + + \ No newline at end of file diff --git a/modules/invoiceOut/front/descriptor/index.js b/modules/invoiceOut/front/descriptor/index.js index 957b3ac4d..036d0b261 100644 --- a/modules/invoiceOut/front/descriptor/index.js +++ b/modules/invoiceOut/front/descriptor/index.js @@ -11,7 +11,8 @@ class Controller { this.aclService = aclService; this.moreOptions = [ {callback: this.showInvoiceOutPdf, name: 'Show invoice out PDF'}, - {callback: this.showDeleteInvoiceOutDialog, name: 'Delete InvoiceOut', acl: 'invoicing'} + {callback: this.showDeleteInvoiceOutDialog, name: 'Delete InvoiceOut', acl: 'invoicing'}, + {callback: this.showBookInvoiceOutDialog, name: 'Book invoice', acl: 'invoicing'} ]; } @@ -60,6 +61,10 @@ class Controller { this.$scope.deleteConfirmation.show(); } + showBookInvoiceOutDialog() { + this.$scope.bookConfirmation.show(); + } + deleteInvoiceOut(response) { if (response === 'ACCEPT') { const query = `/invoiceOut/api/InvoiceOuts/${this.invoiceOut.id}/delete`; @@ -70,6 +75,16 @@ class Controller { } } + bookInvoiceOut(response) { + if (response === 'ACCEPT') { + const query = `/invoiceOut/api/InvoiceOuts/${this.invoiceOut.ref}/book`; + this.$http.post(query).then(() => { + this.vnApp.showSuccess(this.$translate.instant('InvoiceOut booked')); + this.$state.go('invoiceOut.index'); + }); + } + } + set quicklinks(value = {}) { this._quicklinks = Object.assign(value, this._quicklinks); } diff --git a/modules/invoiceOut/front/descriptor/locale/es.yml b/modules/invoiceOut/front/descriptor/locale/es.yml index 6a77a268c..cedd0e94e 100644 --- a/modules/invoiceOut/front/descriptor/locale/es.yml +++ b/modules/invoiceOut/front/descriptor/locale/es.yml @@ -5,4 +5,7 @@ Invoice ticket list: Listado de tickets de la factura Show invoice out PDF: Ver factura emitida en PDF Delete InvoiceOut: Borrar factura InvoiceOut deleted: Factura eliminada -Are you sure you want to delete this invoice?: Estas seguro de eliminar esta factura? \ No newline at end of file +Are you sure you want to delete this invoice?: Estas seguro de eliminar esta factura? +Book invoice: Asentar factura +InvoiceOut booked: Factura asentada +Are you sure you want to book this invoice?: Estas seguro de querer asentar esta factura? \ No newline at end of file From 6db35d744dc26462deb168e4323c44cec0486cc8 Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Tue, 30 Apr 2019 11:20:37 +0200 Subject: [PATCH 54/59] multicheck checking all elements on pagination if checked --- front/core/components/multi-check/multi-check.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/front/core/components/multi-check/multi-check.js b/front/core/components/multi-check/multi-check.js index b210d01d4..9eb9a5148 100644 --- a/front/core/components/multi-check/multi-check.js +++ b/front/core/components/multi-check/multi-check.js @@ -43,6 +43,10 @@ export default class MultiCheck extends Input { else if (!this.areAllChecked()) this._checked = false; }); + + value.on('dataChange', () => { + if (this.checked) this.toggle(); + }); } } From 1a524e33b14d86564a30fa20e41ae5851d860fc4 Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Tue, 30 Apr 2019 11:29:57 +0200 Subject: [PATCH 55/59] regenerate invoiceOut ACL --- db/changes/10003-easter/00-ACL.sql | 1 + modules/invoiceOut/back/methods/invoiceOut/regenerate.js | 1 + 2 files changed, 2 insertions(+) diff --git a/db/changes/10003-easter/00-ACL.sql b/db/changes/10003-easter/00-ACL.sql index 424d0546b..f8b86afb9 100644 --- a/db/changes/10003-easter/00-ACL.sql +++ b/db/changes/10003-easter/00-ACL.sql @@ -1,2 +1,3 @@ INSERT INTO `salix`.`ACL` (`id`, `model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES (162, 'InvoiceOut', 'delete', 'WRITE', 'ALLOW', 'ROLE', 'invoicing'); INSERT INTO `salix`.`ACL` (`id`, `model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES (163, 'InvoiceOut', 'book', 'WRITE', 'ALLOW', 'ROLE', 'invoicing'); +INSERT INTO `salix`.`ACL` (`id`, `model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES (164, 'InvoiceOut', 'regenerate', 'WRITE', 'ALLOW', 'ROLE', 'invoicing'); diff --git a/modules/invoiceOut/back/methods/invoiceOut/regenerate.js b/modules/invoiceOut/back/methods/invoiceOut/regenerate.js index cf95d5af9..762acfffc 100644 --- a/modules/invoiceOut/back/methods/invoiceOut/regenerate.js +++ b/modules/invoiceOut/back/methods/invoiceOut/regenerate.js @@ -1,6 +1,7 @@ module.exports = Self => { Self.remoteMethodCtx('regenerate', { description: 'Sends an invoice to a regeneration queue', + accessType: 'WRITE', accepts: [{ arg: 'id', type: 'number', From c8bf9d0d7ba311e0cd0c6bdfedddb42ac75afcdd Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Tue, 30 Apr 2019 11:43:26 +0200 Subject: [PATCH 56/59] fixed worker calendar error for local holidays --- modules/worker/front/calendar/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/worker/front/calendar/index.js b/modules/worker/front/calendar/index.js index dafa1d24d..bfb313630 100644 --- a/modules/worker/front/calendar/index.js +++ b/modules/worker/front/calendar/index.js @@ -40,10 +40,14 @@ class Controller { const holidays = data.holidays; const events = []; holidays.forEach(holiday => { + const holidayDetail = holiday.detail && holiday.detail.description; + const holidayType = holiday.type && holiday.type.name; + const holidayName = holidayDetail || holidayType; + events.push({ dated: holiday.dated, className: 'red', - title: holiday.detail.description || holiday.type.name, + title: holidayName, isRemovable: false }); }); From c68015fb884c40dc31cb86396b0f3f5c47f74490 Mon Sep 17 00:00:00 2001 From: Bernat Date: Tue, 30 Apr 2019 11:47:39 +0200 Subject: [PATCH 57/59] 1341 invoiceOut.descriptor asentar factura --- .../back/methods/invoiceOut/specs/delete.spec.js | 14 +++++++------- modules/invoiceOut/front/descriptor/index.js | 6 +++--- modules/invoiceOut/front/descriptor/locale/es.yml | 4 ++-- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/modules/invoiceOut/back/methods/invoiceOut/specs/delete.spec.js b/modules/invoiceOut/back/methods/invoiceOut/specs/delete.spec.js index 560837a68..1fba84cbd 100644 --- a/modules/invoiceOut/back/methods/invoiceOut/specs/delete.spec.js +++ b/modules/invoiceOut/back/methods/invoiceOut/specs/delete.spec.js @@ -2,15 +2,15 @@ const app = require('vn-loopback/server/server'); describe('invoiceOut delete()', () => { const invoiceOutId = 2; - let OriginalInvoice; + let OriginalInvoiceOut; let OriginalTickets; afterAll(async done => { - const newInvoice = await app.models.InvoiceOut.create(OriginalInvoice); - await newInvoice.updateAttribute('ref', OriginalInvoice.ref); + const newInvoiceOut = await app.models.InvoiceOut.create(OriginalInvoiceOut); + await newInvoiceOut.updateAttribute('ref', OriginalInvoiceOut.ref); const promises = []; OriginalTickets.forEach(ticket => { - promises.push(ticket.updateAttribute('refFk', newInvoice.ref)); + promises.push(ticket.updateAttribute('refFk', newInvoiceOut.ref)); }); Promise.all(promises); @@ -26,13 +26,13 @@ describe('invoiceOut delete()', () => { }); it(`should check the two tickets from the invoice id 2 that are not invoiced`, async() => { - OriginalInvoice = await app.models.InvoiceOut.findById(invoiceOutId); + OriginalInvoiceOut = await app.models.InvoiceOut.findById(invoiceOutId); await app.models.InvoiceOut.delete(invoiceOutId); OriginalTickets = await app.models.Ticket.find({where: {id: {inq: [2, 3]}}}); - const invoice = await app.models.InvoiceOut.findById(invoiceOutId); + const invoiceOut = await app.models.InvoiceOut.findById(invoiceOutId); expect(OriginalTickets[0].refFk).toBeNull(); expect(OriginalTickets[1].refFk).toBeNull(); - expect(invoice).toBeNull(); + expect(invoiceOut).toBeNull(); }); }); diff --git a/modules/invoiceOut/front/descriptor/index.js b/modules/invoiceOut/front/descriptor/index.js index 036d0b261..bd9891193 100644 --- a/modules/invoiceOut/front/descriptor/index.js +++ b/modules/invoiceOut/front/descriptor/index.js @@ -10,8 +10,8 @@ class Controller { this.$http = $http; this.aclService = aclService; this.moreOptions = [ - {callback: this.showInvoiceOutPdf, name: 'Show invoice out PDF'}, - {callback: this.showDeleteInvoiceOutDialog, name: 'Delete InvoiceOut', acl: 'invoicing'}, + {callback: this.showInvoiceOutPdf, name: 'Show invoice PDF'}, + {callback: this.showDeleteInvoiceOutDialog, name: 'Delete Invoice', acl: 'invoicing'}, {callback: this.showBookInvoiceOutDialog, name: 'Book invoice', acl: 'invoicing'} ]; } @@ -80,7 +80,7 @@ class Controller { const query = `/invoiceOut/api/InvoiceOuts/${this.invoiceOut.ref}/book`; this.$http.post(query).then(() => { this.vnApp.showSuccess(this.$translate.instant('InvoiceOut booked')); - this.$state.go('invoiceOut.index'); + this.$state.reload(); }); } } diff --git a/modules/invoiceOut/front/descriptor/locale/es.yml b/modules/invoiceOut/front/descriptor/locale/es.yml index cedd0e94e..4f6abcea3 100644 --- a/modules/invoiceOut/front/descriptor/locale/es.yml +++ b/modules/invoiceOut/front/descriptor/locale/es.yml @@ -2,8 +2,8 @@ Volume exceded: Volumen excedido Volume: Volumen Client card: Ficha del cliente Invoice ticket list: Listado de tickets de la factura -Show invoice out PDF: Ver factura emitida en PDF -Delete InvoiceOut: Borrar factura +Show invoice PDF: Ver factura en PDF +Delete Invoice: Borrar factura InvoiceOut deleted: Factura eliminada Are you sure you want to delete this invoice?: Estas seguro de eliminar esta factura? Book invoice: Asentar factura From 3615fe36a8840468624f4c205e150727d39ba04d Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Tue, 30 Apr 2019 14:25:07 +0200 Subject: [PATCH 58/59] removed template strings --- modules/invoiceOut/back/methods/invoiceOut/book.js | 2 +- modules/invoiceOut/back/methods/invoiceOut/delete.js | 2 +- modules/invoiceOut/back/methods/invoiceOut/regenerate.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/invoiceOut/back/methods/invoiceOut/book.js b/modules/invoiceOut/back/methods/invoiceOut/book.js index eeddcd7f5..745e8e3c5 100644 --- a/modules/invoiceOut/back/methods/invoiceOut/book.js +++ b/modules/invoiceOut/back/methods/invoiceOut/book.js @@ -15,7 +15,7 @@ module.exports = Self => { root: true }, http: { - path: `/:ref/book`, + path: '/:ref/book', verb: 'POST' } }); diff --git a/modules/invoiceOut/back/methods/invoiceOut/delete.js b/modules/invoiceOut/back/methods/invoiceOut/delete.js index 0883952e8..afbd226a8 100644 --- a/modules/invoiceOut/back/methods/invoiceOut/delete.js +++ b/modules/invoiceOut/back/methods/invoiceOut/delete.js @@ -15,7 +15,7 @@ module.exports = Self => { root: true }, http: { - path: `/:id/delete`, + path: '/:id/delete', verb: 'POST' } }); diff --git a/modules/invoiceOut/back/methods/invoiceOut/regenerate.js b/modules/invoiceOut/back/methods/invoiceOut/regenerate.js index 762acfffc..77123318a 100644 --- a/modules/invoiceOut/back/methods/invoiceOut/regenerate.js +++ b/modules/invoiceOut/back/methods/invoiceOut/regenerate.js @@ -14,7 +14,7 @@ module.exports = Self => { root: true }, http: { - path: `/:id/regenerate`, + path: '/:id/regenerate', verb: 'POST' } }); From 2b7287dabb7f2817420c964c20cbecae27b93217 Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Wed, 1 May 2019 18:49:39 +0200 Subject: [PATCH 59/59] added ticket.dms #1373 --- back/methods/dms/download.js | 76 +++++++++++++++++++ back/methods/dms/specs/download.spec.js | 30 ++++++++ back/models/dms.js | 3 + back/models/dmsType.json | 18 ++++- db/changes/10003-easter/00-ACL.sql | 2 + .../10003-easter/01-dmsTicketRename.sql | 3 +- .../10003-easter/02-dmsTypeAddRoleFields.sql | 6 +- db/changes/10003-easter/03-dmsType.sql | 13 ++++ docker-compose.yml | 3 +- e2e/helpers/selectors.js | 2 +- .../04_create_ticket_packages.spec.js | 4 +- modules/client/front/balance/index/index.html | 7 +- modules/client/front/balance/index/index.js | 4 - modules/client/front/balance/index/style.scss | 10 ++- modules/ticket/front/dms/index.html | 51 +++++++++++++ modules/ticket/front/dms/index.js | 51 +++++++++++++ modules/ticket/front/dms/index.spec.js | 44 +++++++++++ modules/ticket/front/dms/locale/es.yml | 2 + modules/ticket/front/dms/style.scss | 6 ++ modules/ticket/front/index.js | 2 + modules/ticket/front/package/index.js | 2 +- modules/ticket/front/routes.json | 18 +++-- modules/ticket/front/sale/locale/es.yml | 1 + 23 files changed, 328 insertions(+), 30 deletions(-) create mode 100644 back/methods/dms/download.js create mode 100644 back/methods/dms/specs/download.spec.js create mode 100644 back/models/dms.js create mode 100644 db/changes/10003-easter/03-dmsType.sql create mode 100644 modules/ticket/front/dms/index.html create mode 100644 modules/ticket/front/dms/index.js create mode 100644 modules/ticket/front/dms/index.spec.js create mode 100644 modules/ticket/front/dms/locale/es.yml create mode 100644 modules/ticket/front/dms/style.scss diff --git a/back/methods/dms/download.js b/back/methods/dms/download.js new file mode 100644 index 000000000..9211cc8f8 --- /dev/null +++ b/back/methods/dms/download.js @@ -0,0 +1,76 @@ +const UserError = require('vn-loopback/util/user-error'); +const fs = require('fs-extra'); + +module.exports = Self => { + Self.remoteMethodCtx('download', { + description: 'Download a document', + accessType: 'READ', + accepts: [ + { + arg: 'id', + type: 'String', + description: 'The document id', + http: {source: 'path'} + } + ], + returns: [ + { + arg: 'body', + type: 'file', + root: true + }, { + arg: 'Content-Type', + type: 'String', + http: {target: 'header'} + }, { + arg: 'Content-Disposition', + type: 'String', + http: {target: 'header'} + } + ], + http: { + path: `/:id/download`, + verb: 'GET' + } + }); + + Self.download = async function(ctx, id) { + const userId = ctx.req.accessToken.userId; + const env = process.env.NODE_ENV; + const document = await Self.findById(id, { + include: { + relation: 'dmsType', + scope: { + fields: ['path', 'readRoleFk'], + include: { + relation: 'readRole' + } + } + } + }); + const readRole = document.dmsType().readRole().name; + const hasRequiredRole = await Self.app.models.Account.hasRole(userId, readRole); + + if (!hasRequiredRole) + throw new UserError(`You don't have enough privileges`); + + if (env && env != 'development') { + const path = `/${document.companyFk}/${document.dmsType().path}/${document.file}`; + file = { + path: `/var/lib/salix/dms/${path}`, + contentType: 'application/octet-stream', + name: document.file + }; + } else { + file = { + path: `${process.cwd()}/README.md`, + contentType: 'text/plain', + name: `README.md` + }; + } + + await fs.access(file.path); + let stream = fs.createReadStream(file.path); + return [stream, file.contentType, `filename="${file.name}"`]; + }; +}; diff --git a/back/methods/dms/specs/download.spec.js b/back/methods/dms/specs/download.spec.js new file mode 100644 index 000000000..085662662 --- /dev/null +++ b/back/methods/dms/specs/download.spec.js @@ -0,0 +1,30 @@ +const app = require('vn-loopback/server/server'); + +/** + * Pendiente de fixtures dms, dmsType, ticketDms + * CAU: 10728 + */ +xdescribe('dms download()', () => { + let dmsId = 1; + it('should return a response for an employee with text content-type', async() => { + let workerFk = 107; + let ctx = {req: {accessToken: {userId: workerFk}}}; + const result = await app.models.Dms.download(ctx, dmsId); + + expect(result[1]).toEqual('text/plain'); + }); + + it(`should return an error for a user without enough privileges`, async() => { + let clientId = 101; + let ctx = {req: {accessToken: {userId: clientId}}}; + + let error; + await app.models.Dms.download(ctx, dmsId).catch(e => { + error = e; + }).finally(() => { + expect(error.message).toEqual(`You don't have enough privileges`); + }); + + expect(error).toBeDefined(); + }); +}); diff --git a/back/models/dms.js b/back/models/dms.js new file mode 100644 index 000000000..97a405eef --- /dev/null +++ b/back/models/dms.js @@ -0,0 +1,3 @@ +module.exports = Self => { + require('../methods/dms/download')(Self); +}; diff --git a/back/models/dmsType.json b/back/models/dmsType.json index 0d55647f3..9efc92cf5 100644 --- a/back/models/dmsType.json +++ b/back/models/dmsType.json @@ -22,12 +22,22 @@ "required": true } }, - "acls": [ - { + "relations": { + "readRole": { + "type": "belongsTo", + "model": "Role", + "foreignKey": "readRoleFk" + }, + "writeRole": { + "type": "belongsTo", + "model": "Role", + "foreignKey": "writeRoleFk" + } + }, + "acls": [{ "accessType": "READ", "principalType": "ROLE", "principalId": "$everyone", "permission": "ALLOW" - } - ] + }] } \ No newline at end of file diff --git a/db/changes/10003-easter/00-ACL.sql b/db/changes/10003-easter/00-ACL.sql index f8b86afb9..8dd09ff32 100644 --- a/db/changes/10003-easter/00-ACL.sql +++ b/db/changes/10003-easter/00-ACL.sql @@ -1,3 +1,5 @@ INSERT INTO `salix`.`ACL` (`id`, `model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES (162, 'InvoiceOut', 'delete', 'WRITE', 'ALLOW', 'ROLE', 'invoicing'); INSERT INTO `salix`.`ACL` (`id`, `model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES (163, 'InvoiceOut', 'book', 'WRITE', 'ALLOW', 'ROLE', 'invoicing'); INSERT INTO `salix`.`ACL` (`id`, `model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES (164, 'InvoiceOut', 'regenerate', 'WRITE', 'ALLOW', 'ROLE', 'invoicing'); +INSERT INTO `salix`.`ACL` (`id`, `model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES (165, 'TicketDms', '*', 'READ', 'ALLOW', 'ROLE', 'employee'); +INSERT INTO `salix`.`ACL` (`id`, `model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES (166, 'Dms', 'download', 'READ', 'ALLOW', 'ROLE', 'employee'); diff --git a/db/changes/10003-easter/01-dmsTicketRename.sql b/db/changes/10003-easter/01-dmsTicketRename.sql index 3554be6bd..60318dfdb 100644 --- a/db/changes/10003-easter/01-dmsTicketRename.sql +++ b/db/changes/10003-easter/01-dmsTicketRename.sql @@ -6,6 +6,7 @@ CREATE SQL SECURITY DEFINER VIEW `vn`.`ticketDms` AS SELECT - `g`.`Id_Ticket` AS `ticketFk`, `g`.`gestdoc_id` AS `dmsFk` + `g`.`Id_Ticket` AS `ticketFk`, + `g`.`gestdoc_id` AS `dmsFk` FROM `vn2008`.`tickets_gestdoc` `g`; diff --git a/db/changes/10003-easter/02-dmsTypeAddRoleFields.sql b/db/changes/10003-easter/02-dmsTypeAddRoleFields.sql index 5e65bf299..3898fb813 100644 --- a/db/changes/10003-easter/02-dmsTypeAddRoleFields.sql +++ b/db/changes/10003-easter/02-dmsTypeAddRoleFields.sql @@ -1,3 +1,7 @@ ALTER TABLE `vn2008`.`gesttip` ADD COLUMN `writeRoleFk` INT(10) UNSIGNED NULL AFTER `path`, -ADD COLUMN `ReadRoleFk` INT(10) UNSIGNED NULL AFTER `writeRoleFk`; +ADD COLUMN `readRoleFk` INT(10) UNSIGNED NULL AFTER `writeRoleFk`, +ADD CONSTRAINT `readRoleFk` FOREIGN KEY (`readRoleFk`) REFERENCES `account`.`role` (`id`), +ADD CONSTRAINT `writeRoleFk` FOREIGN KEY (`writeRoleFk`) REFERENCES `account`.`role` (`id`); + +UPDATE `vn2008`.`gesttip` SET `readRoleFk`='1' WHERE `id`='14'; diff --git a/db/changes/10003-easter/03-dmsType.sql b/db/changes/10003-easter/03-dmsType.sql new file mode 100644 index 000000000..6f38571e6 --- /dev/null +++ b/db/changes/10003-easter/03-dmsType.sql @@ -0,0 +1,13 @@ +CREATE + OR REPLACE ALGORITHM = UNDEFINED + DEFINER = `root`@`%` + SQL SECURITY DEFINER +VIEW `vn`.`dmsType` AS + SELECT + `g`.`id` AS `id`, + `g`.`tipo` AS `name`, + `g`.`path` AS `path`, + `g`.`readRoleFk` AS `readRoleFk`, + `g`.`writeRoleFk` AS `writeRoleFk` + FROM + `vn2008`.`gesttip` `g`; diff --git a/docker-compose.yml b/docker-compose.yml index 05135c454..7fcf95a79 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -18,4 +18,5 @@ services: - NODE_ENV volumes: - /containers/salix:/etc/salix - - /mnt/storage/pdfs:/var/lib/salix/pdfs \ No newline at end of file + - /mnt/storage/pdfs:/var/lib/salix/pdfs + - /mnt/storage/dms:/var/lib/salix/dms \ No newline at end of file diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index ec6bd1348..9c458b750 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -356,7 +356,7 @@ export default { expeditionRow: 'vn-ticket-expedition vn-table vn-tbody > vn-tr' }, ticketPackages: { - packagesButton: 'vn-left-menu a[ui-sref="ticket.card.package.index"]', + packagesButton: 'vn-left-menu a[ui-sref="ticket.card.package"]', firstPackageAutocomplete: 'vn-autocomplete[label="Package"]', firstQuantityInput: 'vn-input-number[label="Quantity"] input', firstRemovePackageButton: 'vn-icon-button[vn-tooltip="Remove package"]', diff --git a/e2e/paths/05-ticket-module/04_create_ticket_packages.spec.js b/e2e/paths/05-ticket-module/04_create_ticket_packages.spec.js index 3c2f0b123..30324aec2 100644 --- a/e2e/paths/05-ticket-module/04_create_ticket_packages.spec.js +++ b/e2e/paths/05-ticket-module/04_create_ticket_packages.spec.js @@ -8,7 +8,7 @@ describe('Ticket Create packages path', () => { return nightmare .loginAndModule('employee', 'ticket') .accessToSearchResult('id:1') - .accessToSection('ticket.card.package.index'); + .accessToSection('ticket.card.package'); }); it(`should attempt create a new package but receive an error if package is blank`, async() => { @@ -53,7 +53,7 @@ describe('Ticket Create packages path', () => { it(`should confirm the first select is the expected one`, async() => { const result = await nightmare - .reloadSection('ticket.card.package.index') + .reloadSection('ticket.card.package') .waitForTextInInput(`${selectors.ticketPackages.firstPackageAutocomplete} input`, 'Container medical box 1m') .waitToGetProperty(`${selectors.ticketPackages.firstPackageAutocomplete} input`, 'value'); diff --git a/modules/client/front/balance/index/index.html b/modules/client/front/balance/index/index.html index eeec5675b..708dd920d 100644 --- a/modules/client/front/balance/index/index.html +++ b/modules/client/front/balance/index/index.html @@ -14,10 +14,9 @@ + - - - + title="{{'Download PDF' | translate}}"> diff --git a/modules/client/front/balance/index/index.js b/modules/client/front/balance/index/index.js index 47c93a229..2f1676771 100644 --- a/modules/client/front/balance/index/index.js +++ b/modules/client/front/balance/index/index.js @@ -87,10 +87,6 @@ class Controller { this.$.balanceCreateDialog.show(); } - onDownload() { - alert('Not implemented yet'); - } - showWorkerDescriptor(event, workerFk) { if (event.defaultPrevented) return; diff --git a/modules/client/front/balance/index/style.scss b/modules/client/front/balance/index/style.scss index a6758e2e6..74d3bc09b 100644 --- a/modules/client/front/balance/index/style.scss +++ b/modules/client/front/balance/index/style.scss @@ -1,6 +1,10 @@ -vn-client-risk-index { + +@import "./variables"; + +vn-client-balance-index { .totalBox { - display: table; - float: right; + border: $border-thin-light; + text-align: left; + float: right } } \ No newline at end of file diff --git a/modules/ticket/front/dms/index.html b/modules/ticket/front/dms/index.html new file mode 100644 index 000000000..878fd3277 --- /dev/null +++ b/modules/ticket/front/dms/index.html @@ -0,0 +1,51 @@ + + + + + + + + + Id + Type + Employee + Created + + + + + + {{::document.dmsFk}} + {{::document.dms.dmsType.name}} + + + {{::document.dms.worker.user.nickname | dashIfEmpty}} + + {{::document.dms.created | dateTime:'dd/MM/yyyy HH:mm'}} + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/modules/ticket/front/dms/index.js b/modules/ticket/front/dms/index.js new file mode 100644 index 000000000..ab6456b5f --- /dev/null +++ b/modules/ticket/front/dms/index.js @@ -0,0 +1,51 @@ +import ngModule from '../module'; +import './style.scss'; + +class Controller { + constructor($stateParams, $scope, vnToken) { + this.$stateParams = $stateParams; + this.$ = $scope; + this.accessToken = vnToken.token; + this.filter = { + include: { + relation: 'dms', + scope: { + fields: ['dmsTypeFk', 'workerFk', 'file', 'created'], + include: [{ + relation: 'dmsType', + scope: { + fields: ['name'] + } + }, + { + relation: 'worker', + scope: { + fields: ['userFk'], + include: { + relation: 'user', + scope: { + fields: ['nickname'] + } + }, + } + }] + }, + } + }; + } + + showWorkerDescriptor(event, workerFk) { + event.preventDefault(); + event.stopImmediatePropagation(); + this.$.workerDescriptor.parent = event.target; + this.$.workerDescriptor.workerFk = workerFk; + this.$.workerDescriptor.show(); + } +} + +Controller.$inject = ['$stateParams', '$scope', 'vnToken']; + +ngModule.component('vnTicketDms', { + template: require('./index.html'), + controller: Controller, +}); diff --git a/modules/ticket/front/dms/index.spec.js b/modules/ticket/front/dms/index.spec.js new file mode 100644 index 000000000..8c88b5f1c --- /dev/null +++ b/modules/ticket/front/dms/index.spec.js @@ -0,0 +1,44 @@ +import './index'; + +describe('Client', () => { + describe('Component vnClientBalanceIndex', () => { + let $componentController; + let $scope; + let $httpBackend; + let $httpParamSerializer; + let controller; + + beforeEach(ngModule('client')); + + beforeEach(angular.mock.inject((_$componentController_, $rootScope, _$httpBackend_, _$httpParamSerializer_) => { + $componentController = _$componentController_; + $httpBackend = _$httpBackend_; + $httpParamSerializer = _$httpParamSerializer_; + $scope = $rootScope.$new(); + controller = $componentController('vnClientBalanceIndex', {$scope}); + })); + + describe('balances() setter', () => { + it('should calculate the balance for each line from the oldest date to the newest', () => { + controller.getCurrentBalance = jasmine.createSpy(controller, 'getCurrentBalance').and.returnValue(1000); + let balances = [ + {credit: -100, debit: 0}, + {credit: 0, debit: 300}, + {credit: 100, debit: 0}, + {credit: 0, debit: -300} + ]; + const params = {filter: controller.filter}; + let serializedParams = $httpParamSerializer(params); + $httpBackend.when('GET', `/client/api/ClientRisks?${serializedParams}`).respond(balances); + $httpBackend.expect('GET', `/client/api/ClientRisks?${serializedParams}`); + controller.balances = balances; + $httpBackend.flush(); + + expect(controller.balances[0].balance).toEqual(1000); + expect(controller.balances[1].balance).toEqual(900); + expect(controller.balances[2].balance).toEqual(600); + expect(controller.balances[3].balance).toEqual(700); + }); + }); + }); +}); diff --git a/modules/ticket/front/dms/locale/es.yml b/modules/ticket/front/dms/locale/es.yml new file mode 100644 index 000000000..6422279d9 --- /dev/null +++ b/modules/ticket/front/dms/locale/es.yml @@ -0,0 +1,2 @@ +Type: Tipo +File management: Gestión documental \ No newline at end of file diff --git a/modules/ticket/front/dms/style.scss b/modules/ticket/front/dms/style.scss new file mode 100644 index 000000000..a6758e2e6 --- /dev/null +++ b/modules/ticket/front/dms/style.scss @@ -0,0 +1,6 @@ +vn-client-risk-index { + .totalBox { + display: table; + float: right; + } +} \ No newline at end of file diff --git a/modules/ticket/front/index.js b/modules/ticket/front/index.js index b089734e9..027cb424b 100644 --- a/modules/ticket/front/index.js +++ b/modules/ticket/front/index.js @@ -31,3 +31,5 @@ import './request/index'; import './request/create'; import './log'; import './weekly'; +import './dms'; + diff --git a/modules/ticket/front/package/index.js b/modules/ticket/front/package/index.js index a225c4349..d73c000c7 100644 --- a/modules/ticket/front/package/index.js +++ b/modules/ticket/front/package/index.js @@ -26,7 +26,7 @@ class Controller { Controller.$inject = ['$scope', '$stateParams']; -ngModule.component('vnTicketPackageIndex', { +ngModule.component('vnTicketPackage', { template: require('./index.html'), controller: Controller }); diff --git a/modules/ticket/front/routes.json b/modules/ticket/front/routes.json index 7ae2f4224..e16de74f5 100644 --- a/modules/ticket/front/routes.json +++ b/modules/ticket/front/routes.json @@ -11,14 +11,15 @@ {"state": "ticket.card.volume", "icon": "icon-volume"}, {"state": "ticket.card.expedition", "icon": "icon-package"}, {"state": "ticket.card.service", "icon": "icon-services"}, - {"state": "ticket.card.package.index", "icon": "icon-bucket"}, + {"state": "ticket.card.package", "icon": "icon-bucket"}, {"state": "ticket.card.tracking.index", "icon": "remove_red_eye"}, {"state": "ticket.card.saleChecked", "icon": "assignment"}, {"state": "ticket.card.components", "icon": "icon-components"}, {"state": "ticket.card.saleTracking", "icon": "assignment"}, {"state": "ticket.card.picture", "icon": "image"}, {"state": "ticket.card.log", "icon": "history"}, - {"state": "ticket.card.request.index", "icon": "icon-100"} + {"state": "ticket.card.request.index", "icon": "icon-100"}, + {"state": "ticket.card.dms", "icon": "cloud_download"} ], "keybindings": [ {"key": "t", "state": "ticket.index"} @@ -114,13 +115,8 @@ } }, { "url" : "/package", - "abstract": true, "state": "ticket.card.package", - "component": "ui-view" - }, { - "url" : "/index", - "state": "ticket.card.package.index", - "component": "vn-ticket-package-index", + "component": "vn-ticket-package", "description": "Packages", "params": { "ticket": "$ctrl.ticket" @@ -216,6 +212,12 @@ "state": "ticket.create", "component": "vn-ticket-create", "description": "New ticket" + }, + { + "url": "/dms", + "state": "ticket.card.dms", + "component": "vn-ticket-dms", + "description": "File management" } ] } \ No newline at end of file diff --git a/modules/ticket/front/sale/locale/es.yml b/modules/ticket/front/sale/locale/es.yml index 9cb44405b..707de7c0f 100644 --- a/modules/ticket/front/sale/locale/es.yml +++ b/modules/ticket/front/sale/locale/es.yml @@ -31,3 +31,4 @@ Reserved: Reservado SMSAvailability: >- Verdnatura le comunica: Pedido {{ticketFk}} día {{created | date: "dd/MM/yyyy"}}. {{notAvailables}} no disponible/s. Disculpe las molestias. +Continue anyway?: ¿Continuar de todas formas? \ No newline at end of file