diff --git a/db/changes/10440-fallas/00-claim_packages.sql b/db/changes/10440-fallas/00-claim_packages.sql new file mode 100644 index 000000000..54e8ff326 --- /dev/null +++ b/db/changes/10440-fallas/00-claim_packages.sql @@ -0,0 +1 @@ +ALTER TABLE vn.claim ADD packages smallint(10) unsigned DEFAULT 0 NULL COMMENT 'packages received by the client'; \ No newline at end of file diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index 6f7cc87e5..4888e6360 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -1705,12 +1705,12 @@ INSERT INTO `vn`.`claimState`(`id`, `code`, `description`, `roleFk`, `priority`) ( 6, 'mana', 'Mana', 1, 4), ( 7, 'lack', 'Faltas', 1, 2); -INSERT INTO `vn`.`claim`(`id`, `ticketCreated`, `claimStateFk`, `observation`, `clientFk`, `workerFk`, `responsibility`, `isChargedToMana`, `created` ) +INSERT INTO `vn`.`claim`(`id`, `ticketCreated`, `claimStateFk`, `observation`, `clientFk`, `workerFk`, `responsibility`, `isChargedToMana`, `created`, `packages`) VALUES - (1, 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, CURDATE()), - (2, 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, CURDATE()), - (3, 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, CURDATE()), - (4, 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, CURDATE()); + (1, 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, CURDATE(), 0), + (2, 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, CURDATE(), 1), + (3, 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, CURDATE(), 5), + (4, 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, CURDATE(), 10); INSERT INTO `vn`.`claimBeginning`(`id`, `claimFk`, `saleFk`, `quantity`) VALUES diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index d5b075e13..bab266479 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -692,6 +692,7 @@ 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]` }, diff --git a/e2e/paths/06-claim/01_basic_data.spec.js b/e2e/paths/06-claim/01_basic_data.spec.js index 5dfd54c4e..2e2286939 100644 --- a/e2e/paths/06-claim/01_basic_data.spec.js +++ b/e2e/paths/06-claim/01_basic_data.spec.js @@ -24,6 +24,8 @@ describe('Claim edit basic data path', () => { 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); const message = await page.waitForSnackbar(); @@ -64,10 +66,19 @@ describe('Claim edit basic data path', () => { expect(result).toEqual('edited observation'); }); + it('should confirm the claim packages was edited', async() => { + const result = await page + .waitToGetProperty(selectors.claimBasicData.packages, 'value'); + + expect(result).toEqual('2'); + }); + 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); const message = await page.waitForSnackbar(); diff --git a/modules/claim/back/methods/claim/updateClaim.js b/modules/claim/back/methods/claim/updateClaim.js index a646db355..50ad52a6e 100644 --- a/modules/claim/back/methods/claim/updateClaim.js +++ b/modules/claim/back/methods/claim/updateClaim.js @@ -28,6 +28,10 @@ module.exports = Self => { { arg: 'hasToPickUp', type: 'boolean' + }, + { + arg: 'packages', + type: 'number' }], returns: { type: 'object', diff --git a/modules/claim/back/models/claim.json b/modules/claim/back/models/claim.json index 761a3b4c9..431290812 100644 --- a/modules/claim/back/models/claim.json +++ b/modules/claim/back/models/claim.json @@ -43,6 +43,9 @@ }, "workerFk": { "type": "number" + }, + "packages": { + "type": "number" } }, "relations": { diff --git a/modules/claim/front/basic-data/index.html b/modules/claim/front/basic-data/index.html index a39ecc56e..28fd92472 100644 --- a/modules/claim/front/basic-data/index.html +++ b/modules/claim/front/basic-data/index.html @@ -43,7 +43,14 @@ order="priority ASC" vn-focus> - + + + + + +