From a343d5eb9a192780ba6ce27c3d980d75f89cf1a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20S=C3=A1nchez?= Date: Wed, 26 Aug 2020 11:27:36 +0200 Subject: [PATCH 01/10] 2394 - Removed call to order_total() --- modules/order/back/methods/order/filter.js | 39 ++++------------------ modules/order/back/models/order.json | 3 ++ 2 files changed, 9 insertions(+), 33 deletions(-) diff --git a/modules/order/back/methods/order/filter.js b/modules/order/back/methods/order/filter.js index bfa64c4dd..66b4244d0 100644 --- a/modules/order/back/methods/order/filter.js +++ b/modules/order/back/methods/order/filter.js @@ -136,14 +136,10 @@ module.exports = Self => { let stmts = []; let stmt; - stmts.push('DROP TEMPORARY TABLE IF EXISTS tmp.filter'); - stmt = new ParameterizedSQL( - `CREATE TEMPORARY TABLE tmp.filter - (INDEX (id)) - ENGINE = MEMORY - SELECT + `SELECT o.id, + o.total, o.date_send landed, o.date_make created, o.customer_id clientFk, @@ -178,36 +174,13 @@ module.exports = Self => { } stmt.merge(conn.makeWhere(filter.where)); - stmt.merge({ - sql: `GROUP BY o.id` - }); + stmt.merge(`GROUP BY o.id`); stmt.merge(conn.makePagination(filter)); stmts.push(stmt); - stmts.push(` - CREATE TEMPORARY TABLE tmp.order - (INDEX (orderFk)) - ENGINE = MEMORY - SELECT id AS orderFk - FROM tmp.filter`); + const sql = ParameterizedSQL.join(stmts, ';'); + const result = await conn.executeStmt(sql); - stmts.push('CALL hedera.order_getTotal()'); - - stmt = new ParameterizedSQL( - `SELECT f.*, ot.* - FROM tmp.filter f - LEFT JOIN tmp.orderTotal ot ON ot.orderFk = f.id`); - const orderIndex = stmts.push(stmt) - 1; - - stmts.push(` - DROP TEMPORARY TABLE - tmp.order, - tmp.orderTotal, - tmp.filter`); - - let sql = ParameterizedSQL.join(stmts, ';'); - let result = await conn.executeStmt(sql); - - return result[orderIndex]; + return result; }; }; diff --git a/modules/order/back/models/order.json b/modules/order/back/models/order.json index ab10ad194..38755c2a5 100644 --- a/modules/order/back/models/order.json +++ b/modules/order/back/models/order.json @@ -79,6 +79,9 @@ "mysql": { "columnName": "confirm_date" } + }, + "total": { + "type": "Number" } }, "relations": { From 17542472da68d9373bd80025e560de6c1a267878 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20S=C3=A1nchez?= Date: Thu, 27 Aug 2020 08:24:21 +0200 Subject: [PATCH 02/10] 2391 - Editable description --- back/model-config.json | 3 + back/models/accounting-type.json | 30 ++++++++ back/models/bank.json | 76 +++++++++++-------- db/changes/10210-summer/00-accountingType.sql | 2 + db/dump/fixtures.sql | 16 ++-- modules/client/back/methods/receipt/filter.js | 4 +- .../client/front/balance/create/index.html | 22 +++++- modules/client/front/balance/create/index.js | 13 ++++ modules/client/front/balance/index/index.html | 42 +++++----- modules/client/front/balance/index/index.js | 7 ++ 10 files changed, 153 insertions(+), 62 deletions(-) create mode 100644 back/models/accounting-type.json create mode 100644 db/changes/10210-summer/00-accountingType.sql diff --git a/back/model-config.json b/back/model-config.json index 323e5f233..dc5cde217 100644 --- a/back/model-config.json +++ b/back/model-config.json @@ -2,6 +2,9 @@ "Account": { "dataSource": "vn" }, + "AccountingType": { + "dataSource": "vn" + }, "Bank": { "dataSource": "vn" }, diff --git a/back/models/accounting-type.json b/back/models/accounting-type.json new file mode 100644 index 000000000..796793342 --- /dev/null +++ b/back/models/accounting-type.json @@ -0,0 +1,30 @@ +{ + "name": "AccountingType", + "base": "VnModel", + "options": { + "mysql": { + "table": "accountingType" + } + }, + "properties": { + "id": { + "type": "Number", + "id": true, + "description": "Identifier" + }, + "description": { + "type": "String", + "required": true + }, + "receiptDescription": { + "type": "String", + "required": true + } + }, + "acls": [{ + "accessType": "READ", + "principalType": "ROLE", + "principalId": "$everyone", + "permission": "ALLOW" + }] +} \ No newline at end of file diff --git a/back/models/bank.json b/back/models/bank.json index 119ea9743..33a2637d6 100644 --- a/back/models/bank.json +++ b/back/models/bank.json @@ -2,39 +2,49 @@ "name": "Bank", "base": "VnModel", "options": { - "mysql": { - "table": "bank" - } + "mysql": { + "table": "bank" + } }, "properties": { - "id": { - "type": "Number", - "id": true, - "description": "Identifier" - }, - "bank": { - "type": "string", - "required": true - }, - "account": { - "type": "string", - "required": true - }, - "cash": { - "type": "string", - "required": true - }, - "entityFk": { - "type": "string", - "required": true - }, - "isActive": { - "type": "string", - "required": true - }, - "currencyFk": { - "type": "string", - "required": true - } + "id": { + "type": "Number", + "id": true, + "description": "Identifier" + }, + "bank": { + "type": "String", + "required": true + }, + "account": { + "type": "String", + "required": true + }, + "accountingTypeFk": { + "type": "Number", + "required": true, + "mysql": { + "columnName": "cash" + } + }, + "entityFk": { + "type": "Number", + "required": true + }, + "isActive": { + "type": "Boolean", + "required": true + }, + "currencyFk": { + "type": "Number", + "required": true + } + }, + "relations": { + "accountingType": { + "type": "belongsTo", + "model": "AccountingType", + "foreignKey": "accountingTypeFk" + } } - } \ No newline at end of file +} \ No newline at end of file diff --git a/db/changes/10210-summer/00-accountingType.sql b/db/changes/10210-summer/00-accountingType.sql new file mode 100644 index 000000000..1dbe29952 --- /dev/null +++ b/db/changes/10210-summer/00-accountingType.sql @@ -0,0 +1,2 @@ +ALTER TABLE `vn`.`accountingType` +ADD COLUMN `receiptDescription` VARCHAR(50) NULL AFTER `description`; diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index 2b70cf2be..274d24139 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -116,13 +116,13 @@ INSERT INTO `vn`.`shelving` (`code`, `parkingFk`, `isPrinted`, `priority`, `park ('GVC', '1', '0', '1', '0', '106'), ('HEJ', '2', '0', '1', '0', '106'); -INSERT INTO `vn`.`accountingType`(`id`, `description`) +INSERT INTO `vn`.`accountingType`(`id`, `description`, `receiptDescription`) VALUES - (1, 'Digital money'), - (2, 'Cash'), - (3, 'Card'), - (4, 'Stolen Money'), - (5, 'Miscellaneous'); + (1, 'Digital money', ''), + (2, 'Cash', 'Cash'), + (3, 'Card', 'Pay on receipt'), + (4, 'Stolen Money', ''), + (5, 'Miscellaneous', ''); INSERT INTO `vn`.`currency`(`id`, `code`, `name`, `ratio`) VALUES @@ -133,8 +133,8 @@ INSERT INTO `vn`.`currency`(`id`, `code`, `name`, `ratio`) INSERT INTO `vn`.`bank`(`id`, `bank`, `account`, `cash`, `entityFk`, `isActive`, `currencyFk`) VALUES - (1, 'Pay on receipt', '0000000000', 4, 0, 1, 1), - (2, 'Cash', '1111111111', 1, 0, 1, 1); + (1, 'Pay on receipt', '0000000000', 3, 0, 1, 1), + (2, 'Cash', '1111111111', 2, 0, 1, 1); INSERT INTO `vn`.`deliveryMethod`(`id`, `code`, `description`) VALUES diff --git a/modules/client/back/methods/receipt/filter.js b/modules/client/back/methods/receipt/filter.js index 532d72811..b32249d4b 100644 --- a/modules/client/back/methods/receipt/filter.js +++ b/modules/client/back/methods/receipt/filter.js @@ -42,11 +42,11 @@ module.exports = Self => { r.workerFk, c.code company, r.created, - r.invoiceFk ref, + r.invoiceFk description, NULL debit, r.amountPaid credit, r.bankFk, - u.nickname userNickname, + u.name userName, r.clientFk, FALSE hasPdf, FALSE isInvoice diff --git a/modules/client/front/balance/create/index.html b/modules/client/front/balance/create/index.html index 506e86f4b..5a75445fe 100644 --- a/modules/client/front/balance/create/index.html +++ b/modules/client/front/balance/create/index.html @@ -2,6 +2,13 @@ New payment + + + order="id" + ng-model="$ctrl.receipt.bankFk" + search-function="{or: [{id: $search}, {bank: {like: '%'+ $search +'%'}}]}" + selection="$ctrl.bankSelection"> + {{id}}: {{bank}} + + + + diff --git a/modules/client/front/balance/create/index.js b/modules/client/front/balance/create/index.js index 880774f55..8b01cab4a 100644 --- a/modules/client/front/balance/create/index.js +++ b/modules/client/front/balance/create/index.js @@ -50,6 +50,19 @@ class Controller extends Dialog { return this.receipt.description; } + get bankSelection() { + return this._bankSelection; + } + + set bankSelection(value) { + this._bankSelection = value; + + if (value) { + const accountingType = value.accountingType; + this.receipt.description = accountingType && accountingType.receiptDescription; + } + } + getAmountPaid() { const filter = { where: { diff --git a/modules/client/front/balance/index/index.html b/modules/client/front/balance/index/index.html index 1ad7efad9..da8c40315 100644 --- a/modules/client/front/balance/index/index.html +++ b/modules/client/front/balance/index/index.html @@ -68,25 +68,33 @@ - {{::balance.userNickname}} + {{::balance.userName}} - -
- - {{'BILL' | translate: {ref: balance.ref} }} - - - {{::balance.ref}} - -
-
+ + +
+ + {{'BILL' | translate: {ref: balance.description} }} + + + {{balance.description}} + +
+
+ + + + +
{{::balance.bankFk}} {{::balance.debit | currency: 'EUR':2}} {{::balance.credit | currency: 'EUR':2}} diff --git a/modules/client/front/balance/index/index.js b/modules/client/front/balance/index/index.js index 8f5261176..40a6e4957 100644 --- a/modules/client/front/balance/index/index.js +++ b/modules/client/front/balance/index/index.js @@ -79,6 +79,13 @@ class Controller extends Section { this.$.invoiceOutDescriptor.show(event.target, balance.id); } + + changeDescription(balance) { + const params = {description: balance.description}; + const endpoint = `Receipts/${balance.id}`; + this.$http.patch(endpoint, params) + .then(() => this.vnApp.showSuccess(this.$t('Data saved!'))); + } } Controller.$inject = ['$element', '$scope']; From ac181bb845b10519de74db1e9191be6305c83c81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20S=C3=A1nchez?= Date: Thu, 27 Aug 2020 11:16:36 +0200 Subject: [PATCH 03/10] Updated unit tests --- .../client/front/balance/create/index.spec.js | 76 +++++++++++++++++++ modules/client/front/balance/index/index.js | 2 +- .../client/front/balance/index/index.spec.js | 20 ++++- 3 files changed, 96 insertions(+), 2 deletions(-) create mode 100644 modules/client/front/balance/create/index.spec.js diff --git a/modules/client/front/balance/create/index.spec.js b/modules/client/front/balance/create/index.spec.js new file mode 100644 index 000000000..11fdb1040 --- /dev/null +++ b/modules/client/front/balance/create/index.spec.js @@ -0,0 +1,76 @@ +import './index'; + +describe('Client', () => { + describe('Component vnClientBalancCreate', () => { + let controller; + let $httpBackend; + let $httpParamSerializer; + + beforeEach(ngModule('client')); + + beforeEach(inject(($componentController, $rootScope, _$httpBackend_, _$httpParamSerializer_) => { + $httpBackend = _$httpBackend_; + $httpParamSerializer = _$httpParamSerializer_; + let $scope = $rootScope.$new(); + const $element = angular.element(''); + const $transclude = { + $$boundTransclude: { + $$slots: [] + } + }; + controller = $componentController('vnClientBalanceCreate', {$element, $scope, $transclude}); + controller.receipt = { + clientFk: 101, + companyFk: 442 + }; + })); + + describe('bankSelection() setter', () => { + it('should set the receipt description property', () => { + controller.bankSelection = { + id: 1, + bank: 'Cash', + accountingType: { + id: 2, + receiptDescription: 'Cash' + } + }; + + expect(controller.receipt.description).toEqual('Cash'); + }); + }); + + describe('getAmountPaid()', () => { + it('should make an http GET query and then set the receipt amountPaid property', () => { + controller.$params = {id: 101}; + const receipt = controller.receipt; + const filter = { + where: { + clientFk: 101, + companyFk: 442 + } + }; + const serializedParams = $httpParamSerializer({filter}); + $httpBackend.expect('GET', `ClientRisks?${serializedParams}`,).respond([{amount: 20}]); + controller.getAmountPaid(); + $httpBackend.flush(); + + expect(receipt.amountPaid).toEqual(20); + }); + }); + + describe('responseHandler()', () => { + it('should make an http POST query and then call to the parent responseHandler() method', () => { + jest.spyOn(controller.vnApp, 'showSuccess'); + + controller.$params = {id: 101}; + + $httpBackend.expect('POST', `Receipts`,).respond({id: 1}); + controller.responseHandler('accept'); + $httpBackend.flush(); + + expect(controller.vnApp.showSuccess).toHaveBeenCalled(); + }); + }); + }); +}); diff --git a/modules/client/front/balance/index/index.js b/modules/client/front/balance/index/index.js index 40a6e4957..3c76feabc 100644 --- a/modules/client/front/balance/index/index.js +++ b/modules/client/front/balance/index/index.js @@ -58,7 +58,7 @@ class Controller extends Section { return balance.companyFk === selectedCompany; }); - return currentBalance.amount; + return currentBalance && currentBalance.amount; } getBalances() { diff --git a/modules/client/front/balance/index/index.spec.js b/modules/client/front/balance/index/index.spec.js index 496407847..bdbea3846 100644 --- a/modules/client/front/balance/index/index.spec.js +++ b/modules/client/front/balance/index/index.spec.js @@ -3,10 +3,12 @@ import './index'; describe('Client', () => { describe('Component vnClientBalanceIndex', () => { let controller; + let $httpBackend; beforeEach(ngModule('client')); - beforeEach(inject(($componentController, $rootScope) => { + beforeEach(inject(($componentController, $rootScope, _$httpBackend_) => { + $httpBackend = _$httpBackend_; let $scope = $rootScope.$new(); const $element = angular.element(''); controller = $componentController('vnClientBalanceIndex', {$element, $scope}); @@ -133,5 +135,21 @@ describe('Client', () => { expect(controller.getBalances).toHaveBeenCalledWith(); }); }); + + describe('changeDescription()', () => { + it('should make an http PATCH query', () => { + const expectedParams = {description: 'Web'}; + + $httpBackend.expect('PATCH', `Receipts/1`, expectedParams).respond(200); + controller.changeDescription({ + id: 1, + description: 'Web', + accountingType: { + description: 'Cash' + } + }); + $httpBackend.flush(); + }); + }); }); }); From f14b484faf69344322ec7bf642959557e49abdd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20S=C3=A1nchez?= Date: Thu, 27 Aug 2020 11:23:39 +0200 Subject: [PATCH 04/10] Added ACL to td-editable --- modules/client/front/balance/index/index.html | 4 ++-- modules/client/front/balance/index/index.js | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/client/front/balance/index/index.html b/modules/client/front/balance/index/index.html index da8c40315..cf0c07cfc 100644 --- a/modules/client/front/balance/index/index.html +++ b/modules/client/front/balance/index/index.html @@ -71,7 +71,7 @@ {{::balance.userName}} - +
- diff --git a/modules/client/front/balance/index/index.js b/modules/client/front/balance/index/index.js index 3c76feabc..7e09e018c 100644 --- a/modules/client/front/balance/index/index.js +++ b/modules/client/front/balance/index/index.js @@ -39,6 +39,10 @@ class Controller extends Section { this.getBalances(); } + get isAdministrative() { + return this.aclService.hasAny(['administrative']); + } + getData() { return this.$.model.applyFilter(null, { clientId: this.$params.id, From 914407012a0dabe006dd0a8cb92f5498e4b6096c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20S=C3=A1nchez?= Date: Thu, 27 Aug 2020 11:58:28 +0200 Subject: [PATCH 05/10] Fixed bank search expression --- e2e/paths/02-client/14_balance.spec.js | 2 +- modules/client/front/balance/create/index.html | 11 +++-------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/e2e/paths/02-client/14_balance.spec.js b/e2e/paths/02-client/14_balance.spec.js index 108f76710..6d9ab10c8 100644 --- a/e2e/paths/02-client/14_balance.spec.js +++ b/e2e/paths/02-client/14_balance.spec.js @@ -1,7 +1,7 @@ import selectors from '../../helpers/selectors'; import getBrowser from '../../helpers/puppeteer'; -describe('Client balance path', () => { +fdescribe('Client balance path', () => { let browser; let page; beforeAll(async() => { diff --git a/modules/client/front/balance/create/index.html b/modules/client/front/balance/create/index.html index 5a75445fe..6cfdc0666 100644 --- a/modules/client/front/balance/create/index.html +++ b/modules/client/front/balance/create/index.html @@ -2,13 +2,6 @@ New payment - - Date: Thu, 27 Aug 2020 12:43:57 +0200 Subject: [PATCH 06/10] Removed focus --- e2e/paths/02-client/14_balance.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/paths/02-client/14_balance.spec.js b/e2e/paths/02-client/14_balance.spec.js index 6d9ab10c8..108f76710 100644 --- a/e2e/paths/02-client/14_balance.spec.js +++ b/e2e/paths/02-client/14_balance.spec.js @@ -1,7 +1,7 @@ import selectors from '../../helpers/selectors'; import getBrowser from '../../helpers/puppeteer'; -fdescribe('Client balance path', () => { +describe('Client balance path', () => { let browser; let page; beforeAll(async() => { From baf9ec6e7052257702bfe8394fd5630964cfdd6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20S=C3=A1nchez?= Date: Mon, 31 Aug 2020 08:32:30 +0200 Subject: [PATCH 07/10] 2416 - Item request - Added state filter --- e2e/paths/04-item/13_request.spec.js | 4 +- front/core/components/contextmenu/index.js | 4 +- .../front/request-search-panel/index.html | 14 ++++--- .../item/front/request-search-panel/index.js | 14 ++++++- modules/item/front/request/index.html | 38 ++++++++++++++++--- modules/item/front/request/index.js | 34 +++++++++++++++-- modules/item/front/request/index.spec.js | 6 +-- modules/item/front/request/locale/es.yml | 5 ++- .../back/methods/ticket-request/filter.js | 10 +++-- .../ticket/front/search-panel/locale/es.yml | 2 +- 10 files changed, 102 insertions(+), 29 deletions(-) diff --git a/e2e/paths/04-item/13_request.spec.js b/e2e/paths/04-item/13_request.spec.js index ab48e0c37..66cd7a0f5 100644 --- a/e2e/paths/04-item/13_request.spec.js +++ b/e2e/paths/04-item/13_request.spec.js @@ -31,7 +31,7 @@ describe('Item request path', () => { it('should the status of the request should now be accepted', async() => { let status = await page.waitToGetProperty(selectors.itemRequest.firstRequestStatus, 'innerText'); - expect(status).toContain('Aceptada'); + expect(status).toContain('Accepted'); }); it('should now click on the second declain request icon then type the reason', async() => { @@ -40,6 +40,6 @@ describe('Item request path', () => { await page.respondToDialog('accept'); let status = await page.waitToGetProperty(selectors.itemRequest.firstRequestStatus, 'innerText'); - expect(status).toContain('Denegada'); + expect(status).toContain('Denied'); }); }); diff --git a/front/core/components/contextmenu/index.js b/front/core/components/contextmenu/index.js index 90c14b7e3..db74848a6 100755 --- a/front/core/components/contextmenu/index.js +++ b/front/core/components/contextmenu/index.js @@ -67,13 +67,13 @@ export default class Contextmenu { get cell() { if (!this.target) return null; - return this.target.closest('vn-td, .vn-td'); + return this.target.closest('vn-td, .vn-td, vn-td-editable'); } get cellIndex() { if (!this.row) return null; - const cells = this.row.querySelectorAll('vn-td, .vn-td'); + const cells = this.row.querySelectorAll('vn-td, .vn-td, vn-td-editable'); return Array.from(cells).findIndex( cellItem => cellItem == this.cell ); diff --git a/modules/item/front/request-search-panel/index.html b/modules/item/front/request-search-panel/index.html index 453f3105b..10d5f9762 100644 --- a/modules/item/front/request-search-panel/index.html +++ b/modules/item/front/request-search-panel/index.html @@ -56,12 +56,14 @@ label="For me" ng-model="filter.mine"> - - + + {{name}} + diff --git a/modules/item/front/request-search-panel/index.js b/modules/item/front/request-search-panel/index.js index 82639b6e2..823346e30 100644 --- a/modules/item/front/request-search-panel/index.js +++ b/modules/item/front/request-search-panel/index.js @@ -1,7 +1,19 @@ import ngModule from '../module'; import SearchPanel from 'core/components/searchbar/search-panel'; +class Controller extends SearchPanel { + constructor($element, $) { + super($element, $); + + this.states = [ + {code: 'pending', name: this.$t('Pending')}, + {code: 'accepted', name: this.$t('Accepted')}, + {code: 'denied', name: this.$t('Denied')} + ]; + } +} + ngModule.vnComponent('vnRequestSearchPanel', { template: require('./index.html'), - controller: SearchPanel + controller: Controller }); diff --git a/modules/item/front/request/index.html b/modules/item/front/request/index.html index a677d0754..29a103746 100644 --- a/modules/item/front/request/index.html +++ b/modules/item/front/request/index.html @@ -24,14 +24,15 @@ Ticket ID Shipped - Description + Description Requested Price - Atender - Item + Atender + Item Achieved - Concept + Concept State + @@ -83,7 +84,7 @@ {{request.itemDescription}} - {{$ctrl.getState(request.isOk)}} + {{$ctrl.getState(request.isOk)}} - \ No newline at end of file + + + + + + Filter by selection + + + Exclude selection + + + Remove filter + + + Remove all filters + + + \ No newline at end of file diff --git a/modules/item/front/request/index.js b/modules/item/front/request/index.js index 3801c926f..231d5eda7 100644 --- a/modules/item/front/request/index.js +++ b/modules/item/front/request/index.js @@ -17,18 +17,19 @@ export default class Controller extends Section { this.filterParams = { mine: true, from: today, - to: nextWeek + to: nextWeek, + state: 'pending' }; } } getState(isOk) { if (isOk === null) - return 'Nueva'; + return 'Pending'; else if (isOk) - return 'Aceptada'; + return 'Accepted'; else - return 'Denegada'; + return 'Denied'; } confirmRequest(request) { @@ -92,6 +93,31 @@ export default class Controller extends Section { this.vnApp.showSuccess(this.$t('Data saved!')); }); } + + exprBuilder(param, value) { + switch (param) { + case 'ticketFk': + case 'quantity': + case 'price': + case 'isOk': + return {[`tr.${param}`]: value}; + case 'attenderName': + return {[`ua.name`]: value}; + case 'shipped': + return {'t.shipped': { + between: this.dateRange(value)} + }; + } + } + + dateRange(value) { + const minHour = new Date(value); + minHour.setHours(0, 0, 0, 0); + const maxHour = new Date(value); + maxHour.setHours(23, 59, 59, 59); + + return [minHour, maxHour]; + } } ngModule.vnComponent('vnItemRequest', { diff --git a/modules/item/front/request/index.spec.js b/modules/item/front/request/index.spec.js index a33a21ec2..0fc061023 100644 --- a/modules/item/front/request/index.spec.js +++ b/modules/item/front/request/index.spec.js @@ -24,17 +24,17 @@ describe('Item', () => { let isOk = null; let result = controller.getState(isOk); - expect(result).toEqual('Nueva'); + expect(result).toEqual('Pending'); isOk = 1; result = controller.getState(isOk); - expect(result).toEqual('Aceptada'); + expect(result).toEqual('Accepted'); isOk = 0; result = controller.getState(isOk); - expect(result).toEqual('Denegada'); + expect(result).toEqual('Denied'); }); }); diff --git a/modules/item/front/request/locale/es.yml b/modules/item/front/request/locale/es.yml index 33710a327..c61a00130 100644 --- a/modules/item/front/request/locale/es.yml +++ b/modules/item/front/request/locale/es.yml @@ -3,4 +3,7 @@ Specify the reasons to deny this request: Especifica las razones para descartar Buy requests: Peticiones de compra Search request by id or alias: Buscar peticiones por identificador o alias Requested: Solicitado -Achieved: Conseguido \ No newline at end of file +Achieved: Conseguido +Pending: Pendiente +Accepted: Aceptada +Denied: Rechazada \ No newline at end of file diff --git a/modules/ticket/back/methods/ticket-request/filter.js b/modules/ticket/back/methods/ticket-request/filter.js index ecd88caeb..f1cd08662 100644 --- a/modules/ticket/back/methods/ticket-request/filter.js +++ b/modules/ticket/back/methods/ticket-request/filter.js @@ -44,8 +44,8 @@ module.exports = Self => { type: 'Date', description: `Date to` }, { - arg: 'isOk', - type: 'Boolean', + arg: 'state', + type: 'String', description: `Search request by request state` } ], @@ -77,7 +77,11 @@ module.exports = Self => { return {'t.id': value}; case 'attenderFk': return {'tr.attenderFk': value}; - case 'isOk': + case 'state': + switch (value) { + case 'pending': + return {'tr.isOk': null}; + } return {'tr.isOk': value}; case 'clientFk': return {'t.clientFk': value}; diff --git a/modules/ticket/front/search-panel/locale/es.yml b/modules/ticket/front/search-panel/locale/es.yml index d8cde5b2a..0e338ab0b 100644 --- a/modules/ticket/front/search-panel/locale/es.yml +++ b/modules/ticket/front/search-panel/locale/es.yml @@ -12,4 +12,4 @@ Order id: Id cesta Grouped States: Estado agrupado Days onward: Días adelante With problems: Con problemas -Pending: Pendientes \ No newline at end of file +Pending: Pendiente \ No newline at end of file From 95601f5d55dcf38a2fc51bada4c643edfa223825 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20S=C3=A1nchez?= Date: Mon, 31 Aug 2020 10:15:02 +0200 Subject: [PATCH 08/10] Updated translations --- modules/order/front/locale/es.yml | 3 ++- modules/order/front/search-panel/locale/es.yml | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/order/front/locale/es.yml b/modules/order/front/locale/es.yml index fbc384f21..c35898378 100644 --- a/modules/order/front/locale/es.yml +++ b/modules/order/front/locale/es.yml @@ -23,4 +23,5 @@ Created from: Creado desde Search order by id: Buscar el pedido por identificador order: pedido Confirm lines: Confirmar las lineas -Confirm: Confirmar \ No newline at end of file +Confirm: Confirmar +Real hour: Hora real \ No newline at end of file diff --git a/modules/order/front/search-panel/locale/es.yml b/modules/order/front/search-panel/locale/es.yml index 949f9b202..9546c7f74 100644 --- a/modules/order/front/search-panel/locale/es.yml +++ b/modules/order/front/search-panel/locale/es.yml @@ -7,4 +7,5 @@ Agency: Agencia Application: Aplicación SalesPerson: Comercial Order confirmed: Pedido confirmado -Show empty: Mostrar vacías \ No newline at end of file +Show empty: Mostrar vacías +Search orders by id: Buscar pedido por id \ No newline at end of file From 6297d09de281efef3209e80a2a588e8541846b43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20S=C3=A1nchez?= Date: Mon, 31 Aug 2020 12:14:39 +0200 Subject: [PATCH 09/10] Updated syntax --- modules/ticket/back/methods/ticket-request/filter.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/ticket/back/methods/ticket-request/filter.js b/modules/ticket/back/methods/ticket-request/filter.js index f1cd08662..4b7b088f4 100644 --- a/modules/ticket/back/methods/ticket-request/filter.js +++ b/modules/ticket/back/methods/ticket-request/filter.js @@ -81,8 +81,9 @@ module.exports = Self => { switch (value) { case 'pending': return {'tr.isOk': null}; + default: + return {'tr.isOk': value}; } - return {'tr.isOk': value}; case 'clientFk': return {'t.clientFk': value}; case 'from': From a156a26e19328a43249b1e6b567405f08a3b11fb Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Mon, 31 Aug 2020 15:00:11 +0200 Subject: [PATCH 10/10] e2e updated --- e2e/helpers/selectors.js | 5 +++-- e2e/paths/02-client/14_balance.spec.js | 21 +++++++++++++++++---- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 6eca623bd..d93b72483 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -189,8 +189,9 @@ export default { newPaymentBank: '.vn-dialog.shown vn-autocomplete[ng-model="$ctrl.receipt.bankFk"]', newPaymentAmount: '.vn-dialog.shown vn-input-number[ng-model="$ctrl.receipt.amountPaid"]', saveButton: '.vn-dialog.shown [response="accept"]', - firstBalanceLine: 'vn-client-balance-index vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(8)' - + firstLineBalance: 'vn-client-balance-index vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(8)', + firstLineReference: 'vn-client-balance-index vn-tbody > vn-tr:nth-child(1) > vn-td-editable', + firstLineReferenceInput: 'vn-client-balance-index vn-tbody > vn-tr:nth-child(1) > vn-td-editable > div > field > vn-textfield' }, webPayment: { confirmFirstPaymentButton: 'vn-client-web-payment vn-tr:nth-child(1) vn-icon-button[icon="done_all"]', diff --git a/e2e/paths/02-client/14_balance.spec.js b/e2e/paths/02-client/14_balance.spec.js index 108f76710..6c16d455d 100644 --- a/e2e/paths/02-client/14_balance.spec.js +++ b/e2e/paths/02-client/14_balance.spec.js @@ -53,15 +53,28 @@ describe('Client balance path', () => { expect(message.type).toBe('success'); }); - it('should check balance is now 0 and the company is now VNL becouse the user local settings were removed', async() => { + it('should edit the 1st line reference', async() => { + await page.waitToClick(selectors.clientBalance.firstLineReference); + await page.write(selectors.clientBalance.firstLineReferenceInput, 'Miscellaneous payment'); + await page.keyboard.press('Enter'); + const message = await page.waitForSnackbar(); + + expect(message.type).toBe('success'); + }); + + it('should check balance is now 0, the reference was saved and the company is now VNL becouse the user local settings were removed', async() => { await page.waitForSpinnerLoad(); let company = await page .waitToGetProperty(selectors.clientBalance.company, 'value'); + let reference = await page + .waitToGetProperty(selectors.clientBalance.firstLineReference, 'innerText'); + let firstBalanceLine = await page - .waitToGetProperty(selectors.clientBalance.firstBalanceLine, 'innerText'); + .waitToGetProperty(selectors.clientBalance.firstLineBalance, 'innerText'); expect(company).toEqual('VNL'); + expect(reference).toEqual('Miscellaneous payment'); expect(firstBalanceLine).toContain('0.00'); }); @@ -76,7 +89,7 @@ describe('Client balance path', () => { it('should check balance is now -100', async() => { let result = await page - .waitToGetProperty(selectors.clientBalance.firstBalanceLine, 'innerText'); + .waitToGetProperty(selectors.clientBalance.firstLineBalance, 'innerText'); expect(result).toContain('-€100.00'); }); @@ -92,7 +105,7 @@ describe('Client balance path', () => { it('should check balance is now 50', async() => { let result = await page - .waitToGetProperty(selectors.clientBalance.firstBalanceLine, 'innerText'); + .waitToGetProperty(selectors.clientBalance.firstLineBalance, 'innerText'); expect(result).toEqual('€50.00'); });