From 3c963b5ab2b2120fbce71501650cc80dd1b601f0 Mon Sep 17 00:00:00 2001 From: carlosjr Date: Wed, 22 Jun 2022 16:42:59 +0200 Subject: [PATCH 1/6] refactor(routes json): fixed indentation --- modules/claim/front/routes.json | 27 ++++--- modules/client/front/routes.json | 120 ++++++++++++++++++++----------- 2 files changed, 98 insertions(+), 49 deletions(-) diff --git a/modules/claim/front/routes.json b/modules/claim/front/routes.json index 5f08255be..e7e2e6395 100644 --- a/modules/claim/front/routes.json +++ b/modules/claim/front/routes.json @@ -27,17 +27,20 @@ "abstract": true, "component": "vn-claim", "description": "Claims" - }, { + }, + { "url": "/index?q", "state": "claim.index", "component": "vn-claim-index", "description": "Claims" - }, { + }, + { "url": "/:id", "state": "claim.card", "abstract": true, "component": "vn-claim-card" - }, { + }, + { "url": "/summary", "state": "claim.card.summary", "component": "vn-claim-summary", @@ -45,7 +48,8 @@ "params": { "claim": "$ctrl.claim" } - }, { + }, + { "url": "/basic-data", "state": "claim.card.basicData", "component": "vn-claim-basic-data", @@ -54,7 +58,8 @@ "claim": "$ctrl.claim" }, "acl": ["salesPerson"] - }, { + }, + { "url": "/detail", "state": "claim.card.detail", "component": "vn-claim-detail", @@ -63,7 +68,8 @@ "claim": "$ctrl.claim" }, "acl": ["salesPerson"] - }, { + }, + { "url": "/development", "state": "claim.card.development", "component": "vn-claim-development", @@ -72,7 +78,8 @@ "claim": "$ctrl.claim" }, "acl": ["claimManager"] - }, { + }, + { "url": "/action", "state": "claim.card.action", "component": "vn-claim-action", @@ -81,7 +88,8 @@ "claim": "$ctrl.claim" }, "acl": ["claimManager"] - }, { + }, + { "url": "/photos", "state": "claim.card.photos", "component": "vn-claim-photos", @@ -89,7 +97,8 @@ "params": { "claim": "$ctrl.claim" } - }, { + }, + { "url" : "/log", "state": "claim.card.log", "component": "vn-claim-log", diff --git a/modules/client/front/routes.json b/modules/client/front/routes.json index 6616443bb..b395b102a 100644 --- a/modules/client/front/routes.json +++ b/modules/client/front/routes.json @@ -50,22 +50,26 @@ "component": "vn-client", "description": "Clients", "acl": ["employee"] - }, { + }, + { "url": "/index?q", "state": "client.index", "component": "vn-client-index", "description": "Clients" - }, { + }, + { "url": "/create", "state": "client.create", "component": "vn-client-create", "description": "New client" - }, { + }, + { "url": "/:id?sendSMS&phone&message", "state": "client.card", "abstract": true, "component": "vn-client-card" - }, { + }, + { "url": "/summary", "state": "client.card.summary", "component": "vn-client-summary", @@ -73,7 +77,8 @@ "params": { "client": "$ctrl.client" } - }, { + }, + { "url": "/basic-data", "state": "client.card.basicData", "component": "vn-client-basic-data", @@ -81,7 +86,8 @@ "params": { "client": "$ctrl.client" } - }, { + }, + { "url": "/fiscal-data", "state": "client.card.fiscalData", "component": "vn-client-fiscal-data", @@ -89,7 +95,8 @@ "params": { "client": "$ctrl.client" } - }, { + }, + { "url": "/billing-data", "state": "client.card.billingData", "component": "vn-client-billing-data", @@ -97,12 +104,14 @@ "params": { "client": "$ctrl.client" } - }, { + }, + { "url": "/address", "state": "client.card.address", "component": "ui-view", "abstract": true - }, { + }, + { "url": "/index?q", "state": "client.card.address.index", "component": "vn-client-address-index", @@ -110,7 +119,8 @@ "params": { "client": "$ctrl.client" } - }, { + }, + { "url": "/create", "state": "client.card.address.create", "component": "vn-client-address-create", @@ -118,12 +128,14 @@ "params": { "client": "$ctrl.client" } - }, { + }, + { "url": "/:addressId/edit", "state": "client.card.address.edit", "component": "vn-client-address-edit", "description": "Edit address" - }, { + }, + { "url": "/web-access", "state": "client.card.webAccess", "component": "vn-client-web-access", @@ -131,12 +143,14 @@ "params": { "client": "$ctrl.client" } - }, { + }, + { "url": "/note", "state": "client.card.note", "component": "ui-view", "abstract": true - }, { + }, + { "url": "/index", "state": "client.card.note.index", "component": "vn-client-note", @@ -144,17 +158,20 @@ "params": { "client": "$ctrl.client" } - }, { + }, + { "url": "/create", "state": "client.card.note.create", "component": "vn-note-create", "description": "New note" - }, { + }, + { "url": "/credit", "abstract": true, "state": "client.card.credit", "component": "ui-view" - }, { + }, + { "url": "/index", "state": "client.card.credit.index", "component": "vn-client-credit-index", @@ -162,7 +179,8 @@ "params": { "client": "$ctrl.client" } - }, { + }, + { "url": "/create", "state": "client.card.credit.create", "component": "vn-client-credit-create", @@ -171,12 +189,14 @@ "params": { "client": "$ctrl.client" } - }, { + }, + { "url": "/greuge", "abstract": true, "state": "client.card.greuge", "component": "ui-view" - }, { + }, + { "url": "/index", "state": "client.card.greuge.index", "component": "vn-client-greuge-index", @@ -184,7 +204,8 @@ "params": { "client": "$ctrl.client" } - }, { + }, + { "url": "/create", "state": "client.card.greuge.create", "component": "vn-client-greuge-create", @@ -193,17 +214,20 @@ "params": { "client": "$ctrl.client" } - }, { + }, + { "url": "/mandate", "state": "client.card.mandate", "component": "vn-client-mandate", "description": "Mandates" - }, { + }, + { "url": "/balance", "abstract": true, "state": "client.card.balance", "component": "ui-view" - }, { + }, + { "url": "/index", "state": "client.card.balance.index", "component": "vn-client-balance-index", @@ -211,7 +235,8 @@ "params": { "client": "$ctrl.client" } - }, { + }, + { "url": "/create?payed&companyFk&bankFk&payedAmount", "state": "client.card.balance.create", "component": "vn-client-balance-create", @@ -219,12 +244,14 @@ "params": { "client": "$ctrl.client" } - }, { + }, + { "url": "/recovery", "abstract": true, "state": "client.card.recovery", "component": "ui-view" - }, { + }, + { "url": "/index", "state": "client.card.recovery.index", "component": "vn-client-recovery-index", @@ -232,7 +259,8 @@ "params": { "client": "$ctrl.client" } - }, { + }, + { "url": "/create", "state": "client.card.recovery.create", "component": "vn-client-recovery-create", @@ -240,12 +268,14 @@ "params": { "client": "$ctrl.client" } - }, { + }, + { "url": "/credit-insurance", "abstract": true, "state": "client.card.creditInsurance", "component": "ui-view" - }, { + }, + { "url": "/index", "state": "client.card.creditInsurance.index", "component": "vn-client-credit-insurance-index", @@ -253,7 +283,8 @@ "params": { "client": "$ctrl.client" } - }, { + }, + { "url": "/create", "state": "client.card.creditInsurance.create", "component": "vn-client-credit-insurance-create", @@ -262,13 +293,15 @@ "params": { "client": "$ctrl.client" } - }, { + }, + { "url": "/insurance", "abstract": true, "state": "client.card.creditInsurance.insurance", "component": "ui-view", "acl": ["insurance"] - }, { + }, + { "url": "/:classificationId/index", "state": "client.card.creditInsurance.insurance.index", "component": "vn-client-credit-insurance-insurance-index", @@ -277,7 +310,8 @@ "params": { "client": "$ctrl.client" } - }, { + }, + { "url": "/:classificationId/create", "state": "client.card.creditInsurance.insurance.create", "component": "vn-client-credit-insurance-insurance-create", @@ -286,7 +320,8 @@ "params": { "client": "$ctrl.client" } - }, { + }, + { "url": "/contact", "state": "client.card.contact", "component": "vn-client-contact", @@ -294,12 +329,14 @@ "params": { "client": "$ctrl.client" } - }, { + }, + { "url": "/sample", "abstract": true, "state": "client.card.sample", "component": "ui-view" - }, { + }, + { "url": "/index", "state": "client.card.sample.index", "component": "vn-client-sample-index", @@ -307,7 +344,8 @@ "params": { "client": "$ctrl.client" } - }, { + }, + { "url": "/create", "state": "client.card.sample.create", "component": "vn-client-sample-create", @@ -315,12 +353,14 @@ "params": { "client": "$ctrl.client" } - }, { + }, + { "url": "/web-payment", "state": "client.card.webPayment", "component": "vn-client-web-payment", "description": "Web Payment" - }, { + }, + { "url" : "/log", "state": "client.card.log", "component": "vn-client-log", From d183ccb843592ad1eecc5be7a231fcbd52fa39c2 Mon Sep 17 00:00:00 2001 From: carlosjr Date: Sat, 25 Jun 2022 15:22:47 +0200 Subject: [PATCH 2/6] feat(claim.notes): added the observations setction to claim plus refactors --- db/changes/10480-june/00-ACL.sql | 2 + db/changes/10480-june/01-claimObservation.sql | 13 +++++ db/dump/fixtures.sql | 7 +++ .../claim/back/methods/claim/getSummary.js | 19 +++++++- .../methods/claim/specs/getSummary.spec.js | 1 + modules/claim/back/model-config.json | 3 ++ .../claim/back/models/claim-observation.json | 34 +++++++++++++ modules/claim/front/basic-data/index.html | 7 --- modules/claim/front/index.js | 2 + modules/claim/front/locale/es.yml | 1 + modules/claim/front/note/create/index.html | 30 ++++++++++++ modules/claim/front/note/create/index.js | 22 +++++++++ modules/claim/front/note/index/index.html | 32 +++++++++++++ modules/claim/front/note/index/index.js | 25 ++++++++++ modules/claim/front/note/index/style.scss | 5 ++ modules/claim/front/routes.json | 25 ++++++++++ modules/claim/front/summary/index.html | 48 +++++++++++++------ 17 files changed, 252 insertions(+), 24 deletions(-) create mode 100644 db/changes/10480-june/01-claimObservation.sql create mode 100644 modules/claim/back/models/claim-observation.json create mode 100644 modules/claim/front/note/create/index.html create mode 100644 modules/claim/front/note/create/index.js create mode 100644 modules/claim/front/note/index/index.html create mode 100644 modules/claim/front/note/index/index.js create mode 100644 modules/claim/front/note/index/style.scss diff --git a/db/changes/10480-june/00-ACL.sql b/db/changes/10480-june/00-ACL.sql index 3236ff1fd..2e863be34 100644 --- a/db/changes/10480-june/00-ACL.sql +++ b/db/changes/10480-june/00-ACL.sql @@ -1,4 +1,6 @@ INSERT INTO `salix`.`ACL` (model,property,accessType,permission,principalType,principalId) VALUES + ('ClaimObservation','*','WRITE','ALLOW','ROLE','salesPerson'), + ('ClaimObservation','*','READ','ALLOW','ROLE','salesPerson'), ('Client','setPassword','WRITE','ALLOW','ROLE','salesPerson'), ('Client','updateUser','WRITE','ALLOW','ROLE','salesPerson'); diff --git a/db/changes/10480-june/01-claimObservation.sql b/db/changes/10480-june/01-claimObservation.sql new file mode 100644 index 000000000..33ed94d5a --- /dev/null +++ b/db/changes/10480-june/01-claimObservation.sql @@ -0,0 +1,13 @@ +CREATE TABLE `vn`.`claimObservation` ( + `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, + `claimFk` int(10) unsigned NOT NULL, + `workerFk` int(10) unsigned NOT NULL, + `text` text COLLATE utf8_unicode_ci NOT NULL, + `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`id`), + KEY `worker_key` (`workerFk`), + KEY `claim_key` (`claimFk`), + KEY `claimObservation_created_IDX` (`created`) USING BTREE, + CONSTRAINT `claimObservation_ibfk_1` FOREIGN KEY (`claimFk`) REFERENCES `vn`.`claim` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `claimObservation_ibfk_2` FOREIGN KEY (`workerFk`) REFERENCES `vn`.`worker` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Todas las observaciones referentes a una reclamación' \ No newline at end of file diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index 29d57073c..ec17cb5be 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -1744,6 +1744,13 @@ INSERT INTO `vn`.`claim`(`id`, `ticketCreated`, `claimStateFk`, `observation`, ` (3, util.VN_CURDATE(), 3, 'An vim commodo dolorem volutpat, cu expetendis voluptatum usu, et mutat consul adversarium his. His natum numquam legimus an, diam fabulas mei ut. Melius fabellas sadipscing vel id. Partem diceret mandamus mea ne, has te tempor nostrud. Aeque nostro eum no.', 1101, 18, 1, 1, util.VN_CURDATE(), 5), (4, util.VN_CURDATE(), 3, 'Wisi forensibus mnesarchum in cum. Per id impetus abhorreant, his no magna definiebas, inani rationibus in quo. Ut vidisse dolores est, ut quis nominavi mel. Ad pri quod apeirian concludaturque.', 1104, 18, 5, 0, util.VN_CURDATE(), 10); +INSERT INTO `vn`.`claimObservation` (`claimFk`, `workerFk`, `text`, `created`) + VALUES + (1, 18, 'Cu nam labores lobortis definiebas, ei aliquyam salutatus persequeris quo, cum eu nemore fierent dissentiunt. Per vero dolor id, vide democritum scribentur eu vim, pri erroribus temporibus ex.', util.VN_CURDATE()), + (2, 18, 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.', util.VN_CURDATE()), + (3, 18, 'An vim commodo dolorem volutpat, cu expetendis voluptatum usu, et mutat consul adversarium his. His natum numquam legimus an, diam fabulas mei ut. Melius fabellas sadipscing vel id. Partem diceret mandamus mea ne, has te tempor nostrud. Aeque nostro eum no.', util.VN_CURDATE()), + (4, 18, 'Wisi forensibus mnesarchum in cum. Per id impetus abhorreant, his no magna definiebas, inani rationibus in quo. Ut vidisse dolores est, ut quis nominavi mel. Ad pri quod apeirian concludaturque.', util.VN_CURDATE()); + INSERT INTO `vn`.`claimBeginning`(`id`, `claimFk`, `saleFk`, `quantity`) VALUES (1, 1, 7, 5), diff --git a/modules/claim/back/methods/claim/getSummary.js b/modules/claim/back/methods/claim/getSummary.js index 0accbf920..8ab39eb45 100644 --- a/modules/claim/back/methods/claim/getSummary.js +++ b/modules/claim/back/methods/claim/getSummary.js @@ -84,6 +84,20 @@ module.exports = Self => { }; promises.push(Self.app.models.ClaimBeginning.find(filter, myOptions)); + // Claim observations + filter = { + where: {claimFk: id}, + include: [ + { + relation: 'worker', + scope: { + fields: ['id', 'firstName', 'lastName'] + } + } + ] + }; + promises.push(Self.app.models.ClaimObservation.find(filter, myOptions)); + // Claim developments filter = { where: {claimFk: id}, @@ -138,8 +152,9 @@ module.exports = Self => { summary.isEditable = await Self.isEditable(ctx, id, myOptions); [summary.claim] = res[0]; summary.salesClaimed = res[1]; - summary.developments = res[2]; - summary.actions = res[3]; + summary.observations = res[2]; + summary.developments = res[3]; + summary.actions = res[4]; return summary; }; diff --git a/modules/claim/back/methods/claim/specs/getSummary.spec.js b/modules/claim/back/methods/claim/specs/getSummary.spec.js index 6eb920b29..c4d01ecdc 100644 --- a/modules/claim/back/methods/claim/specs/getSummary.spec.js +++ b/modules/claim/back/methods/claim/specs/getSummary.spec.js @@ -19,6 +19,7 @@ describe('claim getSummary()', () => { expect(keys).toContain('claim'); expect(keys).toContain('salesClaimed'); expect(keys).toContain('developments'); + expect(keys).toContain('observations'); expect(keys).toContain('actions'); expect(keys).toContain('isEditable'); diff --git a/modules/claim/back/model-config.json b/modules/claim/back/model-config.json index d4d772b58..e99a455ac 100644 --- a/modules/claim/back/model-config.json +++ b/modules/claim/back/model-config.json @@ -38,6 +38,9 @@ "ClaimLog": { "dataSource": "vn" }, + "ClaimObservation": { + "dataSource": "vn" + }, "ClaimContainer": { "dataSource": "claimStorage" } diff --git a/modules/claim/back/models/claim-observation.json b/modules/claim/back/models/claim-observation.json new file mode 100644 index 000000000..c44a74f76 --- /dev/null +++ b/modules/claim/back/models/claim-observation.json @@ -0,0 +1,34 @@ +{ + "name": "ClaimObservation", + "base": "VnModel", + "options": { + "mysql": { + "table": "claimObservation" + } + }, + "properties": { + "id": { + "type": "number", + "id": true, + "description": "Identifier" + }, + "claimFk": { + "type": "number", + "required": true + }, + "text": { + "type": "string", + "required": true + }, + "created": { + "type": "date" + } + }, + "relations": { + "worker": { + "type": "belongsTo", + "model": "Worker", + "foreignKey": "workerFk" + } + } +} \ No newline at end of file diff --git a/modules/claim/front/basic-data/index.html b/modules/claim/front/basic-data/index.html index 28fd92472..21c3b1be0 100644 --- a/modules/claim/front/basic-data/index.html +++ b/modules/claim/front/basic-data/index.html @@ -52,13 +52,6 @@ ng-model="$ctrl.claim.packages"> - - - - + +
+ + + + + + + + + + + + +
\ No newline at end of file diff --git a/modules/claim/front/note/create/index.js b/modules/claim/front/note/create/index.js new file mode 100644 index 000000000..40ae9309b --- /dev/null +++ b/modules/claim/front/note/create/index.js @@ -0,0 +1,22 @@ +import ngModule from '../../module'; +import Section from 'salix/components/section'; + +export default class Controller extends Section { + constructor($element, $) { + super($element, $); + this.note = { + claimFk: parseInt(this.$params.id), + workerFk: window.localStorage.currentUserWorkerId, + text: null + }; + } + + cancel() { + this.$state.go('claim.card.note.index', {id: this.$params.id}); + } +} + +ngModule.vnComponent('vnClaimNoteCreate', { + template: require('./index.html'), + controller: Controller +}); diff --git a/modules/claim/front/note/index/index.html b/modules/claim/front/note/index/index.html new file mode 100644 index 000000000..8ffe19c2b --- /dev/null +++ b/modules/claim/front/note/index/index.html @@ -0,0 +1,32 @@ + + + + +
+ + {{::note.worker.firstName}} {{::note.worker.lastName}} + {{::note.created | date:'dd/MM/yyyy HH:mm'}} + + + {{::note.text}} + +
+
+
+ + + \ No newline at end of file diff --git a/modules/claim/front/note/index/index.js b/modules/claim/front/note/index/index.js new file mode 100644 index 000000000..5a2fd96d3 --- /dev/null +++ b/modules/claim/front/note/index/index.js @@ -0,0 +1,25 @@ +import ngModule from '../../module'; +import Section from 'salix/components/section'; +import './style.scss'; + +export default class Controller extends Section { + constructor($element, $) { + super($element, $); + this.filter = { + order: 'created DESC', + }; + this.include = { + relation: 'worker', + scope: { + fields: ['id', 'firstName', 'lastName'] + } + }; + } +} + +Controller.$inject = ['$element', '$scope']; + +ngModule.vnComponent('vnClaimNote', { + template: require('./index.html'), + controller: Controller, +}); diff --git a/modules/claim/front/note/index/style.scss b/modules/claim/front/note/index/style.scss new file mode 100644 index 000000000..44ae2cee7 --- /dev/null +++ b/modules/claim/front/note/index/style.scss @@ -0,0 +1,5 @@ +vn-client-note { + .note:last-child { + margin-bottom: 0; + } +} \ No newline at end of file diff --git a/modules/claim/front/routes.json b/modules/claim/front/routes.json index e7e2e6395..d02ea6f6c 100644 --- a/modules/claim/front/routes.json +++ b/modules/claim/front/routes.json @@ -12,6 +12,7 @@ {"state": "claim.card.basicData", "icon": "settings"}, {"state": "claim.card.detail", "icon": "icon-details"}, {"state": "claim.card.photos", "icon": "image"}, + {"state": "claim.card.note.index", "icon": "insert_drive_file"}, {"state": "claim.card.development", "icon": "icon-traceability"}, {"state": "claim.card.action", "icon": "icon-actions"}, {"state": "claim.card.log", "icon": "history"} @@ -69,6 +70,30 @@ }, "acl": ["salesPerson"] }, + { + "url": "/note", + "state": "claim.card.note", + "component": "ui-view", + "abstract": true, + "acl": ["salesPerson"] + }, + { + "url": "/index", + "state": "claim.card.note.index", + "component": "vn-claim-note", + "description": "Notes", + "params": { + "claim": "$ctrl.claim" + }, + "acl": ["salesPerson"] + }, + { + "url": "/create", + "state": "claim.card.note.create", + "component": "vn-claim-note-create", + "description": "New note", + "acl": ["salesPerson"] + }, { "url": "/development", "state": "claim.card.development", diff --git a/modules/claim/front/summary/index.html b/modules/claim/front/summary/index.html index 5d90da516..0c12aa2e6 100644 --- a/modules/claim/front/summary/index.html +++ b/modules/claim/front/summary/index.html @@ -1,11 +1,12 @@ -
- {{::$ctrl.summary.claim.id}} - {{::$ctrl.summary.claim.client.name}} - - - - - + +

+ + Observations + +

+

+ Observations +

+
+ + {{::note.worker.firstName}} {{::note.worker.lastName}} + {{::note.created | date:'dd/MM/yyyy HH:mm'}} + + + {{::note.text}} + +
+

Date: Mon, 27 Jun 2022 11:01:29 +0200 Subject: [PATCH 3/6] data migration from claim.observation to claimObservations --- db/changes/10480-june/01-claimObservation.sql | 4 ++-- db/changes/10480-june/02-claimTextMigration.sql | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 db/changes/10480-june/02-claimTextMigration.sql diff --git a/db/changes/10480-june/01-claimObservation.sql b/db/changes/10480-june/01-claimObservation.sql index 33ed94d5a..8dc126a9e 100644 --- a/db/changes/10480-june/01-claimObservation.sql +++ b/db/changes/10480-june/01-claimObservation.sql @@ -1,7 +1,7 @@ CREATE TABLE `vn`.`claimObservation` ( `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, `claimFk` int(10) unsigned NOT NULL, - `workerFk` int(10) unsigned NOT NULL, + `workerFk` int(10) unsigned DEFAULT NULL, `text` text COLLATE utf8_unicode_ci NOT NULL, `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`), @@ -10,4 +10,4 @@ CREATE TABLE `vn`.`claimObservation` ( KEY `claimObservation_created_IDX` (`created`) USING BTREE, CONSTRAINT `claimObservation_ibfk_1` FOREIGN KEY (`claimFk`) REFERENCES `vn`.`claim` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `claimObservation_ibfk_2` FOREIGN KEY (`workerFk`) REFERENCES `vn`.`worker` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Todas las observaciones referentes a una reclamación' \ No newline at end of file +) COMMENT='Todas las observaciones referentes a una reclamación' \ No newline at end of file diff --git a/db/changes/10480-june/02-claimTextMigration.sql b/db/changes/10480-june/02-claimTextMigration.sql new file mode 100644 index 000000000..fa5f6fe83 --- /dev/null +++ b/db/changes/10480-june/02-claimTextMigration.sql @@ -0,0 +1,2 @@ +INSERT INTO `vn`.`claimObservation` (`claimFk`, `text`, `created`) +SELECT `id`, `observation`, `created` FROM `vn`.`claim` \ No newline at end of file From 57fd528e9ba33a86ab8b7268b50ec5b8c6241876 Mon Sep 17 00:00:00 2001 From: carlosjr Date: Mon, 27 Jun 2022 12:20:17 +0200 Subject: [PATCH 4/6] removed fixtures from deprecated column --- db/dump/fixtures.sql | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index 3e8170591..f116408be 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -1737,12 +1737,12 @@ INSERT INTO `vn`.`claimState`(`id`, `code`, `description`, `roleFk`, `priority`, ( 6, 'mana', 'Mana', 1, 4, 0), ( 7, 'lack', 'Faltas', 1, 2, 0); -INSERT INTO `vn`.`claim`(`id`, `ticketCreated`, `claimStateFk`, `observation`, `clientFk`, `workerFk`, `responsibility`, `isChargedToMana`, `created`, `packages`) +INSERT INTO `vn`.`claim`(`id`, `ticketCreated`, `claimStateFk`, `clientFk`, `workerFk`, `responsibility`, `isChargedToMana`, `created`, `packages`) VALUES - (1, util.VN_CURDATE(), 1, 'Cu nam labores lobortis definiebas, ei aliquyam salutatus persequeris quo, cum eu nemore fierent dissentiunt. Per vero dolor id, vide democritum scribentur eu vim, pri erroribus temporibus ex.', 1101, 18, 3, 0, util.VN_CURDATE(), 0), - (2, util.VN_CURDATE(), 2, 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.', 1101, 18, 3, 0, util.VN_CURDATE(), 1), - (3, util.VN_CURDATE(), 3, 'An vim commodo dolorem volutpat, cu expetendis voluptatum usu, et mutat consul adversarium his. His natum numquam legimus an, diam fabulas mei ut. Melius fabellas sadipscing vel id. Partem diceret mandamus mea ne, has te tempor nostrud. Aeque nostro eum no.', 1101, 18, 1, 1, util.VN_CURDATE(), 5), - (4, util.VN_CURDATE(), 3, 'Wisi forensibus mnesarchum in cum. Per id impetus abhorreant, his no magna definiebas, inani rationibus in quo. Ut vidisse dolores est, ut quis nominavi mel. Ad pri quod apeirian concludaturque.', 1104, 18, 5, 0, util.VN_CURDATE(), 10); + (1, util.VN_CURDATE(), 1, 1101, 18, 3, 0, util.VN_CURDATE(), 0), + (2, util.VN_CURDATE(), 2, 1101, 18, 3, 0, util.VN_CURDATE(), 1), + (3, util.VN_CURDATE(), 3, 1101, 18, 1, 1, util.VN_CURDATE(), 5), + (4, util.VN_CURDATE(), 3, 1104, 18, 5, 0, util.VN_CURDATE(), 10); INSERT INTO `vn`.`claimObservation` (`claimFk`, `workerFk`, `text`, `created`) VALUES From 84606de1da4184919ac3635ffbad3d7323964e0f Mon Sep 17 00:00:00 2001 From: carlosjr Date: Mon, 27 Jun 2022 17:25:35 +0200 Subject: [PATCH 5/6] e2e path for claim notes + refactor --- e2e/helpers/selectors.js | 9 +++-- e2e/paths/06-claim/01_basic_data.spec.js | 11 ------ e2e/paths/06-claim/05_summary.spec.js | 2 +- e2e/paths/06-claim/07_note.spec.js | 46 ++++++++++++++++++++++++ 4 files changed, 54 insertions(+), 14 deletions(-) create mode 100644 e2e/paths/06-claim/07_note.spec.js diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 3638c26e0..0e3fa3b78 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -730,7 +730,7 @@ export default { claimSummary: { header: 'vn-claim-summary > vn-card > h5', state: 'vn-claim-summary vn-label-value[label="State"] > section > span', - observation: 'vn-claim-summary vn-textarea[ng-model="$ctrl.summary.claim.observation"]', + observation: 'vn-claim-summary vn-horizontal.text', firstSaleItemId: 'vn-claim-summary vn-horizontal > vn-auto:nth-child(5) vn-table > div > vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(1) > span', firstSaleDescriptorImage: '.vn-popover.shown vn-item-descriptor img', itemDescriptorPopover: '.vn-popover.shown vn-item-descriptor', @@ -742,7 +742,6 @@ export default { }, claimBasicData: { claimState: 'vn-claim-basic-data vn-autocomplete[ng-model="$ctrl.claim.claimStateFk"]', - observation: 'vn-textarea[ng-model="$ctrl.claim.observation"]', packages: 'vn-input-number[ng-model="$ctrl.claim.packages"]', hasToPickUpCheckbox: 'vn-claim-basic-data vn-check[ng-model="$ctrl.claim.hasToPickUp"]', saveButton: `button[type=submit]` @@ -772,6 +771,12 @@ export default { secondClaimRedelivery: 'vn-claim-development vn-horizontal:nth-child(2) vn-autocomplete[ng-model="claimDevelopment.claimRedeliveryFk"]', saveDevelopmentButton: 'button[type=submit]' }, + claimNote: { + addNoteFloatButton: 'vn-float-button', + note: 'vn-textarea[ng-model="$ctrl.note.text"]', + saveButton: 'button[type=submit]', + firstNoteText: 'vn-claim-note .text' + }, claimAction: { importClaimButton: 'vn-claim-action vn-button[label="Import claim"]', anyLine: 'vn-claim-action vn-tbody > vn-tr', diff --git a/e2e/paths/06-claim/01_basic_data.spec.js b/e2e/paths/06-claim/01_basic_data.spec.js index 2e2286939..0a08cad9f 100644 --- a/e2e/paths/06-claim/01_basic_data.spec.js +++ b/e2e/paths/06-claim/01_basic_data.spec.js @@ -22,8 +22,6 @@ describe('Claim edit basic data path', () => { it(`should edit claim state and observation fields`, async() => { await page.autocompleteSearch(selectors.claimBasicData.claimState, 'Gestionado'); - await page.clearTextarea(selectors.claimBasicData.observation); - await page.write(selectors.claimBasicData.observation, 'edited observation'); await page.clearInput(selectors.claimBasicData.packages); await page.write(selectors.claimBasicData.packages, '2'); await page.waitToClick(selectors.claimBasicData.saveButton); @@ -59,13 +57,6 @@ describe('Claim edit basic data path', () => { expect(hasToPickUpCheckbox).toBe('checked'); }); - it('should confirm the claim observation was edited', async() => { - const result = await page - .waitToGetProperty(selectors.claimBasicData.observation, 'value'); - - expect(result).toEqual('edited observation'); - }); - it('should confirm the claim packages was edited', async() => { const result = await page .waitToGetProperty(selectors.claimBasicData.packages, 'value'); @@ -75,8 +66,6 @@ describe('Claim edit basic data path', () => { it(`should edit the claim to leave it untainted`, async() => { await page.autocompleteSearch(selectors.claimBasicData.claimState, 'Pendiente'); - await page.clearTextarea(selectors.claimBasicData.observation); - await page.write(selectors.claimBasicData.observation, 'Observation one'); await page.clearInput(selectors.claimBasicData.packages); await page.write(selectors.claimBasicData.packages, '0'); await page.waitToClick(selectors.claimBasicData.saveButton); diff --git a/e2e/paths/06-claim/05_summary.spec.js b/e2e/paths/06-claim/05_summary.spec.js index 589b3b6cb..00b021f88 100644 --- a/e2e/paths/06-claim/05_summary.spec.js +++ b/e2e/paths/06-claim/05_summary.spec.js @@ -37,7 +37,7 @@ describe('Claim summary path', () => { }); it('should display the observation', async() => { - const result = await page.waitToGetProperty(selectors.claimSummary.observation, 'value'); + const result = await page.waitToGetProperty(selectors.claimSummary.observation, 'innerText'); expect(result).toContain('Wisi forensibus mnesarchum in cum. Per id impetus abhorreant'); }); diff --git a/e2e/paths/06-claim/07_note.spec.js b/e2e/paths/06-claim/07_note.spec.js new file mode 100644 index 000000000..830f77cbe --- /dev/null +++ b/e2e/paths/06-claim/07_note.spec.js @@ -0,0 +1,46 @@ +import selectors from '../../helpers/selectors'; +import getBrowser from '../../helpers/puppeteer'; + +describe('Claim Add note path', () => { + let browser; + let page; + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('salesPerson', 'claim'); + await page.accessToSearchResult('2'); + await page.accessToSection('claim.card.note.index'); + }); + + afterAll(async() => { + await browser.close(); + }); + + it(`should reach the claim note index`, async() => { + await page.waitForState('claim.card.note.index'); + }); + + it(`should click on the add new note button`, async() => { + await page.waitToClick(selectors.claimNote.addNoteFloatButton); + await page.waitForState('claim.card.note.create'); + }); + + it(`should create a new note`, async() => { + await page.waitForSelector(selectors.claimNote.note); + await page.type(`${selectors.claimNote.note} textarea`, 'The delivery was unsuccessful'); + await page.waitToClick(selectors.claimNote.saveButton); + const message = await page.waitForSnackbar(); + + expect(message.text).toContain('Data saved!'); + }); + + it(`should redirect back to the claim notes page`, async() => { + await page.waitForState('claim.card.note.index'); + }); + + it('should confirm the note was created', async() => { + const result = await page.waitToGetProperty(selectors.claimNote.firstNoteText, 'innerText'); + + expect(result).toEqual('The delivery was unsuccessful'); + }); +}); From 4c5c51a31940b90fe7ff7960a3486678df60cfee Mon Sep 17 00:00:00 2001 From: jgallego Date: Mon, 27 Jun 2022 18:20:26 +0200 Subject: [PATCH 6/6] claim basic-data minor bug --- modules/claim/back/models/claim-observation.json | 11 ++++++++++- modules/claim/front/basic-data/index.html | 2 -- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/modules/claim/back/models/claim-observation.json b/modules/claim/back/models/claim-observation.json index c44a74f76..e882ad09d 100644 --- a/modules/claim/back/models/claim-observation.json +++ b/modules/claim/back/models/claim-observation.json @@ -1,6 +1,10 @@ { "name": "ClaimObservation", - "base": "VnModel", + "base": "Loggable", + "log": { + "model": "ClaimLog", + "relation": "claim" + }, "options": { "mysql": { "table": "claimObservation" @@ -29,6 +33,11 @@ "type": "belongsTo", "model": "Worker", "foreignKey": "workerFk" + }, + "claim": { + "type": "belongsTo", + "model": "Claim", + "foreignKey": "claimFk" } } } \ No newline at end of file diff --git a/modules/claim/front/basic-data/index.html b/modules/claim/front/basic-data/index.html index 21c3b1be0..7a91e180a 100644 --- a/modules/claim/front/basic-data/index.html +++ b/modules/claim/front/basic-data/index.html @@ -51,8 +51,6 @@ label="Packages received" ng-model="$ctrl.claim.packages"> - -