From ca7601a9f2116ff8b470de3ce85ff8f553b4504b Mon Sep 17 00:00:00 2001 From: joan Date: Thu, 15 Oct 2020 11:53:01 +0200 Subject: [PATCH 1/2] 2433 - Added sage fields --- .../client/specs/updateFiscalData.spec.js | 1 - .../back/methods/client/updateFiscalData.js | 12 ++++++ modules/client/back/model-config.json | 6 +++ modules/client/back/models/client.json | 28 ++++++++++++- modules/client/back/models/sage-tax-type.json | 33 +++++++++++++++ .../back/models/sage-transaction-type.json | 33 +++++++++++++++ modules/client/front/fiscal-data/index.html | 41 +++++++++++++++++++ modules/client/front/fiscal-data/index.js | 6 +++ .../client/front/fiscal-data/locale/es.yml | 6 ++- 9 files changed, 163 insertions(+), 3 deletions(-) create mode 100644 modules/client/back/models/sage-tax-type.json create mode 100644 modules/client/back/models/sage-transaction-type.json diff --git a/modules/client/back/methods/client/specs/updateFiscalData.spec.js b/modules/client/back/methods/client/specs/updateFiscalData.spec.js index a2b8f3d58..288183fb6 100644 --- a/modules/client/back/methods/client/specs/updateFiscalData.spec.js +++ b/modules/client/back/methods/client/specs/updateFiscalData.spec.js @@ -29,7 +29,6 @@ describe('Client updateFiscalData', () => { const ctx = {req: {accessToken: {userId: 5}}}; ctx.args = {postcode: 46680}; - const client = await app.models.Client.findById(clientId); expect(client.postcode).toEqual('46460'); diff --git a/modules/client/back/methods/client/updateFiscalData.js b/modules/client/back/methods/client/updateFiscalData.js index f16b0ef2b..48cc6df88 100644 --- a/modules/client/back/methods/client/updateFiscalData.js +++ b/modules/client/back/methods/client/updateFiscalData.js @@ -43,6 +43,18 @@ module.exports = Self => { arg: 'provinceFk', type: 'number' }, + { + arg: 'sageTaxTypeFk', + type: 'number' + }, + { + arg: 'sageTransactionTypeFk', + type: 'number' + }, + { + arg: 'transferorFk', + type: 'number' + }, { arg: 'hasToInvoiceByAddress', type: 'boolean' diff --git a/modules/client/back/model-config.json b/modules/client/back/model-config.json index cdb54f6b6..340ddeb18 100644 --- a/modules/client/back/model-config.json +++ b/modules/client/back/model-config.json @@ -83,6 +83,12 @@ "SmsConfig": { "dataSource": "vn" }, + "SageTaxType": { + "dataSource": "vn" + }, + "SageTransactionType": { + "dataSource": "vn" + }, "TpvError": { "dataSource": "vn" }, diff --git a/modules/client/back/models/client.json b/modules/client/back/models/client.json index 631fce3aa..b4682579a 100644 --- a/modules/client/back/models/client.json +++ b/modules/client/back/models/client.json @@ -118,6 +118,18 @@ }, "created": { "type": "Date" + }, + "sageTaxTypeFk": { + "type": "number", + "mysql": { + "columnName": "taxTypeSageFk" + } + }, + "sageTransactionTypeFk": { + "type": "number", + "mysql": { + "columnName": "transactionTypeSageFk" + } } }, "relations": { @@ -200,6 +212,20 @@ "type": "hasOne", "model": "ClaimRatio", "foreignKey": "clientFk" + }, + "transferor": { + "type": "belongsTo", + "model": "Client", + "foreignKey": "transferorFk" } - } + }, + "scopes": { + "isActive": { + "where": { + "isActive": { + "neq": false + } + } + } + } } \ No newline at end of file diff --git a/modules/client/back/models/sage-tax-type.json b/modules/client/back/models/sage-tax-type.json new file mode 100644 index 000000000..858627c05 --- /dev/null +++ b/modules/client/back/models/sage-tax-type.json @@ -0,0 +1,33 @@ +{ + "name": "SageTaxType", + "base": "VnModel", + "options": { + "mysql": { + "table": "sage.TiposIva" + } + }, + "properties": { + "id": { + "type": "Number", + "id": true, + "description": "Identifier", + "mysql": { + "columnName": "CodigoIva" + } + }, + "vat": { + "type": "string", + "mysql": { + "columnName": "Iva" + } + } + }, + "acls": [ + { + "accessType": "READ", + "principalType": "ROLE", + "principalId": "$everyone", + "permission": "ALLOW" + } + ] +} \ No newline at end of file diff --git a/modules/client/back/models/sage-transaction-type.json b/modules/client/back/models/sage-transaction-type.json new file mode 100644 index 000000000..dbe8f3b39 --- /dev/null +++ b/modules/client/back/models/sage-transaction-type.json @@ -0,0 +1,33 @@ +{ + "name": "SageTransactionType", + "base": "VnModel", + "options": { + "mysql": { + "table": "sage.TiposTransacciones" + } + }, + "properties": { + "id": { + "type": "Number", + "id": true, + "description": "Identifier", + "mysql": { + "columnName": "CodigoTransaccion" + } + }, + "transaction": { + "type": "string", + "mysql": { + "columnName": "Transaccion" + } + } + }, + "acls": [ + { + "accessType": "READ", + "principalType": "ROLE", + "principalId": "$everyone", + "permission": "ALLOW" + } + ] +} \ No newline at end of file diff --git a/modules/client/front/fiscal-data/index.html b/modules/client/front/fiscal-data/index.html index b3789b34a..9cd8f39f4 100644 --- a/modules/client/front/fiscal-data/index.html +++ b/modules/client/front/fiscal-data/index.html @@ -18,6 +18,18 @@ data="countries" order="country"> + + + +
@@ -44,6 +56,35 @@ rule> + + + + + + + + {{clientId}} ya tiene este teléfono o email.
¿Quieres continuar? \ No newline at end of file +Found a client with this phone or email: El cliente con id {{clientId}} ya tiene este teléfono o email.
¿Quieres continuar? +Sage tax type: Tipo de impuesto Sage +Sage transaction type: Tipo de transacción Sage +Previous client: Cliente anterior +In case of a company succession, specify the grantor company: En el caso de que haya habido una sucesión de empresa, indicar la empresa cedente \ No newline at end of file From 392bb420c6f716f21a4356597e0182252162075c Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Wed, 21 Oct 2020 09:29:42 +0200 Subject: [PATCH 2/2] updated client.fiscalData e2e path --- e2e/helpers/selectors.js | 3 +++ .../02-client/03_edit_fiscal_data.spec.js | 21 +++++++++++++++++++ package.json | 2 +- 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 3bcce51a2..a2ce49b8d 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -83,6 +83,9 @@ export default { equalizationTaxCheckbox: 'vn-client-fiscal-data vn-check[ng-model="$ctrl.client.isEqualizated"]', address: 'vn-client-fiscal-data vn-textfield[ng-model="$ctrl.client.street"]', postcode: 'vn-client-fiscal-data vn-datalist[ng-model="$ctrl.client.postcode"]', + sageTax: 'vn-client-fiscal-data vn-autocomplete[ng-model="$ctrl.client.sageTaxTypeFk"]', + sageTransaction: 'vn-client-fiscal-data vn-autocomplete[ng-model="$ctrl.client.sageTransactionTypeFk"]', + transferor: 'vn-client-fiscal-data vn-autocomplete[ng-model="$ctrl.client.transferorFk"]', city: 'vn-client-fiscal-data vn-datalist[ng-model="$ctrl.client.city"]', province: 'vn-client-fiscal-data vn-autocomplete[ng-model="$ctrl.client.provinceFk"]', country: 'vn-client-fiscal-data vn-autocomplete[ng-model="$ctrl.client.countryFk"]', diff --git a/e2e/paths/02-client/03_edit_fiscal_data.spec.js b/e2e/paths/02-client/03_edit_fiscal_data.spec.js index b2279062a..774f56b21 100644 --- a/e2e/paths/02-client/03_edit_fiscal_data.spec.js +++ b/e2e/paths/02-client/03_edit_fiscal_data.spec.js @@ -66,6 +66,9 @@ describe('Client Edit fiscalData path', () => { await page.autocompleteSearch(selectors.clientFiscalData.province, 'Province one'); await page.clearInput(selectors.clientFiscalData.city); await page.write(selectors.clientFiscalData.city, 'Valencia'); + await page.autocompleteSearch(selectors.clientFiscalData.sageTax, 'operaciones no sujetas'); + await page.autocompleteSearch(selectors.clientFiscalData.sageTransaction, 'regularización de inversiones'); + await page.autocompleteSearch(selectors.clientFiscalData.transferor, 'Max Eisenhardt'); await page.clearInput(selectors.clientFiscalData.postcode); await page.write(selectors.clientFiscalData.postcode, '46000'); await page.waitToClick(selectors.clientFiscalData.activeCheckbox); @@ -188,6 +191,24 @@ describe('Client Edit fiscalData path', () => { expect(result).toContain('46000'); }); + it('should confirm the sageTax have been edited', async() => { + const result = await page.waitToGetProperty(selectors.clientFiscalData.sageTax, 'value'); + + expect(result).toEqual('Operaciones no sujetas'); + }); + + it('should confirm the sageTransaction have been edited', async() => { + const result = await page.waitToGetProperty(selectors.clientFiscalData.sageTransaction, 'value'); + + expect(result).toEqual('Regularización de inversiones'); + }); + + it('should confirm the transferor have been edited', async() => { + const result = await page.waitToGetProperty(selectors.clientFiscalData.transferor, 'value'); + + expect(result).toEqual('Max Eisenhardt'); + }); + it('should confirm the city have been autocompleted', async() => { const result = await page.waitToGetProperty(selectors.clientFiscalData.city, 'value'); diff --git a/package.json b/package.json index 69d111117..5840384e4 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,7 @@ "babel-preset-es2015": "^6.24.1", "css-loader": "^2.1.0", "del": "^2.2.2", - "eslint": "^5.14.0", + "eslint": "^7.11.0", "eslint-config-google": "^0.11.0", "eslint-plugin-jasmine": "^2.10.1", "fancy-log": "^1.3.2",