From f2bff056e94dd999a09fa1ded656338d16775b95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20S=C3=A1nchez?= Date: Mon, 10 Aug 2020 10:36:37 +0200 Subject: [PATCH 01/29] Changes --- front/core/components/calendar/index.html | 49 +++++++++++++---------- front/core/components/calendar/style.scss | 9 ++++- 2 files changed, 34 insertions(+), 24 deletions(-) diff --git a/front/core/components/calendar/index.html b/front/core/components/calendar/index.html index eb6d196ba..fb600231b 100644 --- a/front/core/components/calendar/index.html +++ b/front/core/components/calendar/index.html @@ -19,28 +19,33 @@ ng-if="$ctrl.displayControls"> -
-
- {{::day.localeChar}} -
-
-
-
-
- {{::day | date: 'd'}} +
+
a
+
+
+
+ {{::day.localeChar}} +
-
+
+
+
+ {{::day | date: 'd'}} +
+
+
+
\ No newline at end of file diff --git a/front/core/components/calendar/style.scss b/front/core/components/calendar/style.scss index 28c87793b..4ef253f1f 100644 --- a/front/core/components/calendar/style.scss +++ b/front/core/components/calendar/style.scss @@ -19,7 +19,12 @@ color: inherit; } } - & > .weekdays { + & > .rows > .weeksNumber, + & > .rows > .weeks { + float: left + } + + & > .rows > .weeks > .weekdays { display: flex; color: $color-font-secondary; margin-bottom: 8px; @@ -33,7 +38,7 @@ cursor: pointer; } } - & > .days { + & > .rows > .weeks > .days { display: flex; justify-content: center; align-items: center; From 7833b87475c5c0751cde5bf4bf2633c251c51c03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20S=C3=A1nchez?= Date: Mon, 10 Aug 2020 14:44:57 +0200 Subject: [PATCH 02/29] Added filter --- modules/worker/front/calendar/index.html | 9 ++++++++ modules/worker/front/calendar/index.js | 23 +++++++++++++++++++++ modules/worker/front/calendar/locale/es.yml | 1 + 3 files changed, 33 insertions(+) diff --git a/modules/worker/front/calendar/index.html b/modules/worker/front/calendar/index.html index 197fb0797..621d6c23f 100644 --- a/modules/worker/front/calendar/index.html +++ b/modules/worker/front/calendar/index.html @@ -29,6 +29,15 @@ {{'of' | translate}} {{$ctrl.calendar.totalHolidays}} {{'days' | translate}} +
+ + +
diff --git a/modules/worker/front/calendar/index.js b/modules/worker/front/calendar/index.js index e47335804..676a91ee4 100644 --- a/modules/worker/front/calendar/index.js +++ b/modules/worker/front/calendar/index.js @@ -7,6 +7,18 @@ class Controller extends Section { super($element, $); this.date = new Date(); this.events = {}; + this.buildYearFilter(); + } + + get year() { + return this.date.getFullYear(); + } + + set year(value) { + const newYear = new Date(); + newYear.setFullYear(value); + + this.date = newYear; } get date() { @@ -50,6 +62,17 @@ class Controller extends Section { } } + buildYearFilter() { + const currentYear = new Date().getFullYear(); + const minRange = currentYear - 5; + + const years = []; + for (let i = currentYear; i > minRange; i--) + years.push({year: i}); + + this.yearFilter = years; + } + getIsSubordinate() { this.$http.get(`Workers/${this.worker.id}/isSubordinate`).then(res => this.isSubordinate = res.data diff --git a/modules/worker/front/calendar/locale/es.yml b/modules/worker/front/calendar/locale/es.yml index 6681f730f..f48a67c7b 100644 --- a/modules/worker/front/calendar/locale/es.yml +++ b/modules/worker/front/calendar/locale/es.yml @@ -1,6 +1,7 @@ Calendar: Calendario Holidays: Vacaciones Used: Utilizados +Year: Año of: de days: días Choose an absence type from the right menu: Elige un tipo de ausencia desde el menú de la derecha From 64abd2925756ae83b26c9731280883474136e321 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20S=C3=A1nchez?= Date: Tue, 11 Aug 2020 12:10:37 +0200 Subject: [PATCH 03/29] Reverted structure --- front/core/components/calendar/index.html | 47 ++++++++++------------- front/core/components/calendar/style.scss | 9 +---- 2 files changed, 23 insertions(+), 33 deletions(-) diff --git a/front/core/components/calendar/index.html b/front/core/components/calendar/index.html index fb600231b..eb6d196ba 100644 --- a/front/core/components/calendar/index.html +++ b/front/core/components/calendar/index.html @@ -19,33 +19,28 @@ ng-if="$ctrl.displayControls">
-
-
a
-
-
-
- {{::day.localeChar}} -
-
+
+
+ {{::day.localeChar}} +
+
+
+
-
-
- {{::day | date: 'd'}} -
-
+ class="day-number" + ng-click="$ctrl.select($event, day)"> + {{::day | date: 'd'}}
-
+
\ No newline at end of file diff --git a/front/core/components/calendar/style.scss b/front/core/components/calendar/style.scss index 4ef253f1f..28c87793b 100644 --- a/front/core/components/calendar/style.scss +++ b/front/core/components/calendar/style.scss @@ -19,12 +19,7 @@ color: inherit; } } - & > .rows > .weeksNumber, - & > .rows > .weeks { - float: left - } - - & > .rows > .weeks > .weekdays { + & > .weekdays { display: flex; color: $color-font-secondary; margin-bottom: 8px; @@ -38,7 +33,7 @@ cursor: pointer; } } - & > .rows > .weeks > .days { + & > .days { display: flex; justify-content: center; align-items: center; From b50b30c792a49b68e889e185879c37e426857673 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20S=C3=A1nchez?= Date: Tue, 11 Aug 2020 12:16:19 +0200 Subject: [PATCH 04/29] Updated unit test --- modules/worker/front/calendar/index.spec.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/modules/worker/front/calendar/index.spec.js b/modules/worker/front/calendar/index.spec.js index 97ea89787..6b5025dae 100644 --- a/modules/worker/front/calendar/index.spec.js +++ b/modules/worker/front/calendar/index.spec.js @@ -22,6 +22,22 @@ describe('Worker', () => { controller._worker = {id: 106}; })); + describe('year() getter', () => { + it(`should return the year number of the calendar date`, () => { + expect(controller.year).toEqual(year); + }); + }); + + describe('year() setter', () => { + it(`should set the year of the calendar date`, () => { + const previousYear = year - 1; + controller.year = previousYear; + + expect(controller.year).toEqual(previousYear); + expect(controller.date.getFullYear()).toEqual(previousYear); + }); + }); + describe('started property', () => { it(`should return first day and month of current year`, () => { let started = new Date(year, 0, 1); From 88c5b6f8a6c620d08edbbd098fdcf4d5607ba81e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20S=C3=A1nchez?= Date: Thu, 13 Aug 2020 08:23:55 +0200 Subject: [PATCH 05/29] Changed ticket problems min date --- modules/ticket/back/methods/ticket/filter.js | 8 +++++--- modules/ticket/front/main/index.html | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/modules/ticket/back/methods/ticket/filter.js b/modules/ticket/back/methods/ticket/filter.js index 801563b93..61f2bd267 100644 --- a/modules/ticket/back/methods/ticket/filter.js +++ b/modules/ticket/back/methods/ticket/filter.js @@ -241,9 +241,11 @@ module.exports = Self => { CREATE TEMPORARY TABLE tmp.ticketGetProblems (INDEX (ticketFk)) ENGINE = MEMORY - SELECT id ticketFk, clientFk, warehouseFk, shipped - FROM tmp.filter - WHERE alertLevel = 0 OR alertLevel IS NULL`); + SELECT f.id ticketFk, f.clientFk, f.warehouseFk, f.shipped + FROM tmp.filter f + LEFT JOIN alertLevel al ON al.alertLevel = f.alertLevel + WHERE (f.code = 'FREE' OR f.alertLevel IS NULL) + AND f.shipped >= CURDATE()`); stmts.push('CALL ticketGetProblems()'); stmts.push('DROP TEMPORARY TABLE IF EXISTS tmp.ticket'); diff --git a/modules/ticket/front/main/index.html b/modules/ticket/front/main/index.html index bcb77cca5..a21b28992 100644 --- a/modules/ticket/front/main/index.html +++ b/modules/ticket/front/main/index.html @@ -2,7 +2,7 @@ vn-id="model" url="Tickets/filter" limit="20" - order="shipped DESC, zoneHour ASC, zoneMinute ASC, clientFk"> + order="shipped DESC, zoneHour DESC, zoneMinute DESC, clientFk"> Date: Fri, 14 Aug 2020 09:23:23 +0200 Subject: [PATCH 06/29] #2390-calendar_date_filter e2e --- e2e/helpers/selectors.js | 16 +++ e2e/paths/03-worker/05_calendar.spec.js | 134 ++++++++++++++++++++++++ 2 files changed, 150 insertions(+) create mode 100644 e2e/paths/03-worker/05_calendar.spec.js diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index e1b6b1c65..9b7e4e2f3 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -803,6 +803,22 @@ export default { navigateBackToIndex: 'vn-worker-descriptor [name="goToModuleIndex"]', acceptDeleteDialog: '.vn-confirm.shown button[response="accept"]' }, + workerCalendar: { + year: 'vn-worker-calendar vn-autocomplete[ng-model="$ctrl.year"]', + totalHolidaysUsed: 'vn-worker-calendar div.totalBox > div', + januaryThirtyFirst: 'vn-worker-calendar vn-calendar:nth-child(2) section:nth-child(33) > div', + marchTwentyThird: 'vn-worker-calendar vn-calendar:nth-child(4) section:nth-child(29) > div', + mayFourth: 'vn-worker-calendar vn-calendar:nth-child(6) section:nth-child(8) > div', + mayEighth: 'vn-worker-calendar vn-calendar:nth-child(6) section:nth-child(12) > div', + mayTwelfth: 'vn-worker-calendar vn-calendar:nth-child(6) section:nth-child(16) > div', + mayThirteenth: 'vn-worker-calendar vn-calendar:nth-child(6) section:nth-child(17) > div', + mayFourteenth: 'vn-worker-calendar vn-calendar:nth-child(6) section:nth-child(18) > div', + holidays: 'vn-worker-calendar > vn-side-menu div:nth-child(3) > vn-chip:nth-child(1)', + absence: 'vn-worker-calendar > vn-side-menu div:nth-child(3) > vn-chip:nth-child(2)', + halfHoliday: 'vn-worker-calendar > vn-side-menu div:nth-child(3) > vn-chip:nth-child(3)', + furlough: 'vn-worker-calendar > vn-side-menu div:nth-child(3) > vn-chip:nth-child(4)', + halfFurlough: 'vn-worker-calendar > vn-side-menu div:nth-child(3) > vn-chip:nth-child(5)', + }, invoiceOutIndex: { topbarSearch: 'vn-searchbar', searchButton: 'vn-searchbar vn-icon[icon="search"]', diff --git a/e2e/paths/03-worker/05_calendar.spec.js b/e2e/paths/03-worker/05_calendar.spec.js new file mode 100644 index 000000000..a4d22c9fc --- /dev/null +++ b/e2e/paths/03-worker/05_calendar.spec.js @@ -0,0 +1,134 @@ +import selectors from '../../helpers/selectors.js'; +import getBrowser from '../../helpers/puppeteer'; + +// #2390-calendar_date_filter e2e +xdescribe('Worker calendar path', () => { + let browser; + let page; + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('hr', 'worker'); + await page.accessToSearchResult('coolerNick'); + await page.accessToSection('worker.card.calendar'); + }); + + afterAll(async() => { + await browser.close(); + }); + + describe('as hr', () => { + it('should check 0 total holidays have been used so far', async() => { + const result = await page.waitToGetProperty(selectors.workerCalendar.totalHolidaysUsed, 'innerText'); + + expect(result).toContain(' 0 '); + }); + + it('should set two days as holidays on the calendar', async() => { + await page.waitToClick(selectors.workerCalendar.holidays); + await page.waitFor(400); + await page.waitToClick(selectors.workerCalendar.januaryThirtyFirst); + + await page.waitFor(400); + await page.waitToClick(selectors.workerCalendar.absence); + await page.waitFor(400); + await page.waitToClick(selectors.workerCalendar.marchTwentyThird); + + await page.waitFor(400); + await page.waitToClick(selectors.workerCalendar.halfHoliday); + await page.waitFor(400); + await page.waitToClick(selectors.workerCalendar.mayFourth); + + await page.waitFor(400); + await page.waitToClick(selectors.workerCalendar.furlough); + await page.waitFor(400); + await page.waitToClick(selectors.workerCalendar.mayTwelfth); + await page.waitToClick(selectors.workerCalendar.mayThirteenth); + await page.waitToClick(selectors.workerCalendar.mayFourteenth); + + await page.waitFor(400); + await page.waitToClick(selectors.workerCalendar.halfFurlough); + await page.waitFor(400); + await page.waitToClick(selectors.workerCalendar.mayEighth); + }); + + it('should check the total holidays used now has 1.5 more days', async() => { + const result = await page.waitToGetProperty(selectors.workerCalendar.totalHolidaysUsed, 'innerText'); + + expect(result).toContain(' 1.5 '); + }); + }); + + describe(`as cool boss`, () => { + it(`should log in and get to cool's calendar`, async() => { + await page.loginAndModule('coolerBoss', 'worker'); + await page.accessToSearchResult('coolerNick'); + await page.accessToSection('worker.card.calendar'); + }); + + it('should undo what was done here', async() => { + await page.waitFor(4000); + await page.waitToClick(selectors.workerCalendar.holidays); + await page.waitFor(400); + await page.waitToClick(selectors.workerCalendar.januaryThirtyFirst); + + await page.waitFor(400); + await page.waitToClick(selectors.workerCalendar.absence); + await page.waitFor(400); + await page.waitToClick(selectors.workerCalendar.marchTwentyThird); + + await page.waitFor(400); + await page.waitToClick(selectors.workerCalendar.halfHoliday); + await page.waitFor(400); + await page.waitToClick(selectors.workerCalendar.mayFourth); + + await page.waitFor(400); + await page.waitToClick(selectors.workerCalendar.furlough); + await page.waitFor(400); + await page.waitToClick(selectors.workerCalendar.mayTwelfth); + await page.waitToClick(selectors.workerCalendar.mayThirteenth); + await page.waitToClick(selectors.workerCalendar.mayFourteenth); + + await page.waitFor(400); + await page.waitToClick(selectors.workerCalendar.halfFurlough); + await page.waitFor(400); + await page.waitToClick(selectors.workerCalendar.mayEighth); + }); + + it('should check the total holidays used are back to what it was', async() => { + const result = await page.waitToGetProperty(selectors.workerCalendar.totalHolidaysUsed, 'innerText'); + + expect(result).toContain(' 0 '); + }); + }); + + describe(`as cooler`, () => { + it(`should log in and get to his calendar`, async() => { + await page.loginAndModule('cooler', 'worker'); + await page.accessToSearchResult('coolerNick'); + await page.accessToSection('worker.card.calendar'); + }); + + it('should make a futile attempt to add holidays', async() => { + await page.waitFor(4000); + await page.waitToClick(selectors.workerCalendar.holidays); + await page.waitFor(400); + await page.waitToClick(selectors.workerCalendar.januaryThirtyFirst); + }); + + it('should check the total holidays used remain the same', async() => { + const result = await page.waitToGetProperty(selectors.workerCalendar.totalHolidaysUsed, 'innerText'); + + expect(result).toContain(' 0 '); + }); + + it('should use the year selector yo go to the previous year', async() => { + const date = new Date(); + const lastYear = (date.getFullYear() - 1).toString(); + + await page.autocompleteSearch(selectors.workerCalendar.year, lastYear); + + expect(result).toContain(' 0 '); + }); + }); +}); From 69ddf3a615434289ed22720187eee168a1b06946 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Fri, 14 Aug 2020 11:57:16 +0200 Subject: [PATCH 07/29] e2e path nearly as completed --- e2e/paths/03-worker/05_calendar.spec.js | 53 +++++++++++++------------ 1 file changed, 28 insertions(+), 25 deletions(-) diff --git a/e2e/paths/03-worker/05_calendar.spec.js b/e2e/paths/03-worker/05_calendar.spec.js index a4d22c9fc..9a1998c07 100644 --- a/e2e/paths/03-worker/05_calendar.spec.js +++ b/e2e/paths/03-worker/05_calendar.spec.js @@ -1,15 +1,14 @@ import selectors from '../../helpers/selectors.js'; import getBrowser from '../../helpers/puppeteer'; -// #2390-calendar_date_filter e2e -xdescribe('Worker calendar path', () => { +fdescribe('Worker calendar path', () => { let browser; let page; beforeAll(async() => { browser = await getBrowser(); page = browser.page; await page.loginAndModule('hr', 'worker'); - await page.accessToSearchResult('coolerNick'); + await page.accessToSearchResult('Hank Pym'); await page.accessToSection('worker.card.calendar'); }); @@ -18,10 +17,10 @@ xdescribe('Worker calendar path', () => { }); describe('as hr', () => { - it('should check 0 total holidays have been used so far', async() => { + it('should check 5 total holidays have been used so far before testing anything', async() => { const result = await page.waitToGetProperty(selectors.workerCalendar.totalHolidaysUsed, 'innerText'); - expect(result).toContain(' 0 '); + expect(result).toContain(' 5 '); }); it('should set two days as holidays on the calendar', async() => { @@ -52,22 +51,22 @@ xdescribe('Worker calendar path', () => { await page.waitToClick(selectors.workerCalendar.mayEighth); }); - it('should check the total holidays used now has 1.5 more days', async() => { + it('should check the total holidays increased by 1.5', async() => { const result = await page.waitToGetProperty(selectors.workerCalendar.totalHolidaysUsed, 'innerText'); - expect(result).toContain(' 1.5 '); + expect(result).toContain(' 6.5 '); }); }); - describe(`as cool boss`, () => { - it(`should log in and get to cool's calendar`, async() => { - await page.loginAndModule('coolerBoss', 'worker'); - await page.accessToSearchResult('coolerNick'); + describe(`as salesBoss`, () => { + it(`should log in and get to Hank's calendar`, async() => { + await page.loginAndModule('salesBoss', 'worker'); + await page.accessToSearchResult('Hank Pym'); await page.accessToSection('worker.card.calendar'); }); it('should undo what was done here', async() => { - await page.waitFor(4000); + await page.waitFor(400); await page.waitToClick(selectors.workerCalendar.holidays); await page.waitFor(400); await page.waitToClick(selectors.workerCalendar.januaryThirtyFirst); @@ -98,37 +97,41 @@ xdescribe('Worker calendar path', () => { it('should check the total holidays used are back to what it was', async() => { const result = await page.waitToGetProperty(selectors.workerCalendar.totalHolidaysUsed, 'innerText'); - expect(result).toContain(' 0 '); + expect(result).toContain(' 5 '); }); }); - describe(`as cooler`, () => { + describe(`as Hank`, () => { it(`should log in and get to his calendar`, async() => { - await page.loginAndModule('cooler', 'worker'); - await page.accessToSearchResult('coolerNick'); + await page.loginAndModule('HankPym', 'worker'); + await page.accessToSearchResult('Hank Pym'); await page.accessToSection('worker.card.calendar'); }); it('should make a futile attempt to add holidays', async() => { - await page.waitFor(4000); + await page.waitFor(400); await page.waitToClick(selectors.workerCalendar.holidays); await page.waitFor(400); await page.waitToClick(selectors.workerCalendar.januaryThirtyFirst); }); - it('should check the total holidays used remain the same', async() => { + it('should check the total holidays used are now the initial ones', async() => { const result = await page.waitToGetProperty(selectors.workerCalendar.totalHolidaysUsed, 'innerText'); - expect(result).toContain(' 0 '); + expect(result).toContain(' 5 '); }); - it('should use the year selector yo go to the previous year', async() => { - const date = new Date(); - const lastYear = (date.getFullYear() - 1).toString(); + // #1361 worker.calendar "hopefully this test works straight away after refreshing holidays per year on each filtering." + // it('should use the year selector to go to the previous year', async() => { + // const date = new Date(); + // const lastYear = (date.getFullYear() - 1).toString(); - await page.autocompleteSearch(selectors.workerCalendar.year, lastYear); + // await page.autocompleteSearch(selectors.workerCalendar.year, lastYear); - expect(result).toContain(' 0 '); - }); + // await page.waitFor(400); + // const result = await page.waitToGetProperty(selectors.workerCalendar.totalHolidaysUsed, 'innerText'); + + // expect(result).toContain(' 0 '); + // }); }); }); From caf5ad7a6331f9825fc3ee8607ecb592cf246b12 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Fri, 14 Aug 2020 11:57:53 +0200 Subject: [PATCH 08/29] the fdescribe wasn't needed at all XD --- e2e/paths/03-worker/05_calendar.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/paths/03-worker/05_calendar.spec.js b/e2e/paths/03-worker/05_calendar.spec.js index 9a1998c07..f3cb87ff5 100644 --- a/e2e/paths/03-worker/05_calendar.spec.js +++ b/e2e/paths/03-worker/05_calendar.spec.js @@ -1,7 +1,7 @@ import selectors from '../../helpers/selectors.js'; import getBrowser from '../../helpers/puppeteer'; -fdescribe('Worker calendar path', () => { +describe('Worker calendar path', () => { let browser; let page; beforeAll(async() => { From 3cfca5690f10fc459e20b2ec7c964413ba662c60 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Fri, 14 Aug 2020 12:02:27 +0200 Subject: [PATCH 09/29] minor refactor --- e2e/paths/03-worker/05_calendar.spec.js | 45 +++++++++++++------------ 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/e2e/paths/03-worker/05_calendar.spec.js b/e2e/paths/03-worker/05_calendar.spec.js index f3cb87ff5..8f3ab4ba3 100644 --- a/e2e/paths/03-worker/05_calendar.spec.js +++ b/e2e/paths/03-worker/05_calendar.spec.js @@ -2,6 +2,7 @@ import selectors from '../../helpers/selectors.js'; import getBrowser from '../../helpers/puppeteer'; describe('Worker calendar path', () => { + let reasonableTimeBetweenClicks = 400; let browser; let page; beforeAll(async() => { @@ -25,29 +26,29 @@ describe('Worker calendar path', () => { it('should set two days as holidays on the calendar', async() => { await page.waitToClick(selectors.workerCalendar.holidays); - await page.waitFor(400); + await page.waitFor(reasonableTimeBetweenClicks); await page.waitToClick(selectors.workerCalendar.januaryThirtyFirst); - await page.waitFor(400); + await page.waitFor(reasonableTimeBetweenClicks); await page.waitToClick(selectors.workerCalendar.absence); - await page.waitFor(400); + await page.waitFor(reasonableTimeBetweenClicks); await page.waitToClick(selectors.workerCalendar.marchTwentyThird); - await page.waitFor(400); + await page.waitFor(reasonableTimeBetweenClicks); await page.waitToClick(selectors.workerCalendar.halfHoliday); - await page.waitFor(400); + await page.waitFor(reasonableTimeBetweenClicks); await page.waitToClick(selectors.workerCalendar.mayFourth); - await page.waitFor(400); + await page.waitFor(reasonableTimeBetweenClicks); await page.waitToClick(selectors.workerCalendar.furlough); - await page.waitFor(400); + await page.waitFor(reasonableTimeBetweenClicks); await page.waitToClick(selectors.workerCalendar.mayTwelfth); await page.waitToClick(selectors.workerCalendar.mayThirteenth); await page.waitToClick(selectors.workerCalendar.mayFourteenth); - await page.waitFor(400); + await page.waitFor(reasonableTimeBetweenClicks); await page.waitToClick(selectors.workerCalendar.halfFurlough); - await page.waitFor(400); + await page.waitFor(reasonableTimeBetweenClicks); await page.waitToClick(selectors.workerCalendar.mayEighth); }); @@ -66,31 +67,31 @@ describe('Worker calendar path', () => { }); it('should undo what was done here', async() => { - await page.waitFor(400); + await page.waitFor(reasonableTimeBetweenClicks); await page.waitToClick(selectors.workerCalendar.holidays); - await page.waitFor(400); + await page.waitFor(reasonableTimeBetweenClicks); await page.waitToClick(selectors.workerCalendar.januaryThirtyFirst); - await page.waitFor(400); + await page.waitFor(reasonableTimeBetweenClicks); await page.waitToClick(selectors.workerCalendar.absence); - await page.waitFor(400); + await page.waitFor(reasonableTimeBetweenClicks); await page.waitToClick(selectors.workerCalendar.marchTwentyThird); - await page.waitFor(400); + await page.waitFor(reasonableTimeBetweenClicks); await page.waitToClick(selectors.workerCalendar.halfHoliday); - await page.waitFor(400); + await page.waitFor(reasonableTimeBetweenClicks); await page.waitToClick(selectors.workerCalendar.mayFourth); - await page.waitFor(400); + await page.waitFor(reasonableTimeBetweenClicks); await page.waitToClick(selectors.workerCalendar.furlough); - await page.waitFor(400); + await page.waitFor(reasonableTimeBetweenClicks); await page.waitToClick(selectors.workerCalendar.mayTwelfth); await page.waitToClick(selectors.workerCalendar.mayThirteenth); await page.waitToClick(selectors.workerCalendar.mayFourteenth); - await page.waitFor(400); + await page.waitFor(reasonableTimeBetweenClicks); await page.waitToClick(selectors.workerCalendar.halfFurlough); - await page.waitFor(400); + await page.waitFor(reasonableTimeBetweenClicks); await page.waitToClick(selectors.workerCalendar.mayEighth); }); @@ -109,9 +110,9 @@ describe('Worker calendar path', () => { }); it('should make a futile attempt to add holidays', async() => { - await page.waitFor(400); + await page.waitFor(reasonableTimeBetweenClicks); await page.waitToClick(selectors.workerCalendar.holidays); - await page.waitFor(400); + await page.waitFor(reasonableTimeBetweenClicks); await page.waitToClick(selectors.workerCalendar.januaryThirtyFirst); }); @@ -128,7 +129,7 @@ describe('Worker calendar path', () => { // await page.autocompleteSearch(selectors.workerCalendar.year, lastYear); - // await page.waitFor(400); + // await page.waitFor(reasonableTimeBetweenClicks); // const result = await page.waitToGetProperty(selectors.workerCalendar.totalHolidaysUsed, 'innerText'); // expect(result).toContain(' 0 '); From f13c47ce6d63cd2efd6b75c4ca6dab83a7dd346b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20S=C3=A1nchez?= Date: Mon, 17 Aug 2020 14:31:26 +0200 Subject: [PATCH 10/29] Ticket problems filter fix --- loopback/locale/es.json | 2 +- modules/ticket/back/methods/ticket/filter.js | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 9951df4a5..d28cceb41 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -134,5 +134,5 @@ "This ticket is deleted": "Este ticket está eliminado", "A travel with this data already exists": "Ya existe un travel con estos datos", "This thermograph id already exists": "La id del termógrafo ya existe", - "ORDER_ALREADY_CONFIRMED": "ORDER_ALREADY_CONFIRMED" + "Choose a date range or days forward": "Selecciona un rango de fechas o días en adelante" } \ No newline at end of file diff --git a/modules/ticket/back/methods/ticket/filter.js b/modules/ticket/back/methods/ticket/filter.js index 61f2bd267..ddb55301b 100644 --- a/modules/ticket/back/methods/ticket/filter.js +++ b/modules/ticket/back/methods/ticket/filter.js @@ -2,6 +2,7 @@ const ParameterizedSQL = require('loopback-connector').ParameterizedSQL; const buildFilter = require('vn-loopback/util/filter').buildFilter; const mergeFilters = require('vn-loopback/util/filter').mergeFilters; +const UserError = require('vn-loopback/util/user-error'); module.exports = Self => { Self.remoteMethod('filter', { @@ -233,7 +234,7 @@ module.exports = Self => { }); } - stmt.merge(conn.makeSuffix(filter)); + stmt.merge(conn.makeWhere(filter.where)); stmts.push(stmt); stmts.push('DROP TEMPORARY TABLE IF EXISTS tmp.ticketGetProblems'); @@ -244,7 +245,7 @@ module.exports = Self => { SELECT f.id ticketFk, f.clientFk, f.warehouseFk, f.shipped FROM tmp.filter f LEFT JOIN alertLevel al ON al.alertLevel = f.alertLevel - WHERE (f.code = 'FREE' OR f.alertLevel IS NULL) + WHERE (f.alertLevelCode = 'FREE' OR f.alertLevel IS NULL) AND f.shipped >= CURDATE()`); stmts.push('CALL ticketGetProblems()'); @@ -264,6 +265,9 @@ module.exports = Self => { LEFT JOIN tmp.ticketProblems tp ON tp.ticketFk = f.id LEFT JOIN tmp.ticketTotal tt ON tt.ticketFk = f.id`); + if (args.problems != undefined && (!args.from || !args.to)) + throw new UserError('Choose a date range or days forward'); + let condition; let hasProblem; let range; @@ -295,6 +299,7 @@ module.exports = Self => { stmt.merge(conn.makeWhere(problems)); stmt.merge(conn.makeOrderBy(filter.order)); + stmt.merge(conn.makeLimit(filter)); let ticketsIndex = stmts.push(stmt); stmts.push( From 8968f41b753414e793e0e5fc1af4de5b28ac200d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20S=C3=A1nchez?= Date: Tue, 18 Aug 2020 08:10:40 +0200 Subject: [PATCH 11/29] Queue changes --- .../item/back/methods/item-image-queue/downloadImages.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/item/back/methods/item-image-queue/downloadImages.js b/modules/item/back/methods/item-image-queue/downloadImages.js index e27b4516a..d6e38d97d 100644 --- a/modules/item/back/methods/item-image-queue/downloadImages.js +++ b/modules/item/back/methods/item-image-queue/downloadImages.js @@ -20,7 +20,6 @@ module.exports = Self => { const models = Self.app.models; try { - const imageQueue = await Self.find({where: {error: null}, limit: 25}); /* const tempPath = path.join('/tmp/salix-image'); */ const rootPath = models.Image.getPath(); const tempPath = path.join(rootPath, 'temp'); @@ -28,7 +27,8 @@ module.exports = Self => { // Create temporary path await fs.mkdir(tempPath, {recursive: true}); - for (let image of imageQueue) { + setInterval(async() => { + const image = await Self.findOne({where: {error: null}}); const fileName = `${image.itemFk}.png`; const filePath = path.join(tempPath, fileName); const file = fs.createWriteStream(filePath); @@ -58,7 +58,7 @@ module.exports = Self => { }).on('error', async error => { await errorHandler(image.itemFk, error, filePath); }); - } + }, 500); } catch (error) { await errorHandler(image.itemFk, error); } From 1ef6637ad3496213a7512f428b73bc9944a4e0a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20S=C3=A1nchez?= Date: Tue, 18 Aug 2020 08:37:39 +0200 Subject: [PATCH 12/29] Added clearInterval() --- .../item/back/methods/item-image-queue/downloadImages.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/item/back/methods/item-image-queue/downloadImages.js b/modules/item/back/methods/item-image-queue/downloadImages.js index d6e38d97d..dc6318813 100644 --- a/modules/item/back/methods/item-image-queue/downloadImages.js +++ b/modules/item/back/methods/item-image-queue/downloadImages.js @@ -27,12 +27,15 @@ module.exports = Self => { // Create temporary path await fs.mkdir(tempPath, {recursive: true}); - setInterval(async() => { + const timer = setInterval(async() => { const image = await Self.findOne({where: {error: null}}); const fileName = `${image.itemFk}.png`; const filePath = path.join(tempPath, fileName); - const file = fs.createWriteStream(filePath); + // Exit loop + if (!image) clearInterval(timer); + + const file = fs.createWriteStream(filePath); https.get(image.url, async response => { if (response.statusCode != 200) { const error = new Error(`Could not download the image. Status code ${response.statusCode}`); From 2a7495bac902116934009e98639f91071fd016de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20S=C3=A1nchez?= Date: Tue, 18 Aug 2020 09:45:26 +0200 Subject: [PATCH 13/29] Image queue fixes --- back/models/image.js | 9 ++-- .../item-image-queue/downloadImages.js | 52 ++++++++++--------- 2 files changed, 33 insertions(+), 28 deletions(-) diff --git a/back/models/image.js b/back/models/image.js index 079acd293..f1eb09c9e 100644 --- a/back/models/image.js +++ b/back/models/image.js @@ -4,7 +4,8 @@ const path = require('path'); module.exports = Self => { Self.getPath = function() { - return '/var/lib/salix/image'; + // return '/var/lib/salix/image'; + return 'C:\\Users\\jsanc\\Desktop\\image'; }; Self.registerImage = async(collectionName, file, srcFilePath) => { @@ -55,8 +56,9 @@ module.exports = Self => { }; await fs.mkdir(dstDir, {recursive: true}); - await sharp(srcFilePath) + await sharp(srcFilePath, {failOnError: false}) .resize(collection.maxWidth, collection.maxHeight, resizeOpts) + .png() .toFile(dstFile); const sizes = collection.sizes(); @@ -69,8 +71,9 @@ module.exports = Self => { }; await fs.mkdir(dstDir, {recursive: true}); - await sharp(srcFilePath) + await sharp(srcFilePath, {failOnError: false}) .resize(size.width, size.height, resizeOpts) + .png() .toFile(dstFile); } diff --git a/modules/item/back/methods/item-image-queue/downloadImages.js b/modules/item/back/methods/item-image-queue/downloadImages.js index dc6318813..f295f420e 100644 --- a/modules/item/back/methods/item-image-queue/downloadImages.js +++ b/modules/item/back/methods/item-image-queue/downloadImages.js @@ -29,39 +29,41 @@ module.exports = Self => { const timer = setInterval(async() => { const image = await Self.findOne({where: {error: null}}); + + // Exit loop + if (!image) return clearInterval(timer); + const fileName = `${image.itemFk}.png`; const filePath = path.join(tempPath, fileName); - // Exit loop - if (!image) clearInterval(timer); + const writeStream = fs.createWriteStream(filePath); + writeStream.on('open', () => { + https.get(image.url, async response => { + if (response.statusCode != 200) { + const error = new Error(`Could not download the image. Status code ${response.statusCode}`); - const file = fs.createWriteStream(filePath); - https.get(image.url, async response => { - if (response.statusCode != 200) { - const error = new Error(`Could not download the image. Status code ${response.statusCode}`); - - file.close(); - await errorHandler(image.itemFk, error, filePath); - } - - response.pipe(file); - - file.on('error', async error => { - await errorHandler(image.itemFk, error, filePath); - }); - - file.on('finish', async function() { - try { - await models.Image.registerImage('catalog', fileName, filePath); - await image.destroy(); - } catch (error) { - await errorHandler(image.itemFk, error, filePath); + return await errorHandler(image.itemFk, error, filePath); } + + response.pipe(writeStream); + }).on('error', async error => { + await errorHandler(image.itemFk, error, filePath); }); - }).on('error', async error => { + }); + + writeStream.on('error', async error => { await errorHandler(image.itemFk, error, filePath); }); - }, 500); + + writeStream.on('finish', async function() { + try { + await models.Image.registerImage('catalog', fileName, filePath); + await image.destroy(); + } catch (error) { + await errorHandler(image.itemFk, error, filePath); + } + }); + }, 1000); } catch (error) { await errorHandler(image.itemFk, error); } From 4ef540c8f3e8b94dfedca96574a8e67122a69feb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20S=C3=A1nchez?= Date: Tue, 18 Aug 2020 09:48:02 +0200 Subject: [PATCH 14/29] Changed download path --- back/models/image.js | 3 +-- modules/item/back/methods/item-image-queue/downloadImages.js | 4 +--- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/back/models/image.js b/back/models/image.js index f1eb09c9e..340b2e5a6 100644 --- a/back/models/image.js +++ b/back/models/image.js @@ -4,8 +4,7 @@ const path = require('path'); module.exports = Self => { Self.getPath = function() { - // return '/var/lib/salix/image'; - return 'C:\\Users\\jsanc\\Desktop\\image'; + return '/var/lib/salix/image'; }; Self.registerImage = async(collectionName, file, srcFilePath) => { diff --git a/modules/item/back/methods/item-image-queue/downloadImages.js b/modules/item/back/methods/item-image-queue/downloadImages.js index f295f420e..bd22bc281 100644 --- a/modules/item/back/methods/item-image-queue/downloadImages.js +++ b/modules/item/back/methods/item-image-queue/downloadImages.js @@ -20,9 +20,7 @@ module.exports = Self => { const models = Self.app.models; try { - /* const tempPath = path.join('/tmp/salix-image'); */ - const rootPath = models.Image.getPath(); - const tempPath = path.join(rootPath, 'temp'); + const tempPath = path.join('/tmp/salix-image'); // Create temporary path await fs.mkdir(tempPath, {recursive: true}); From 540d5e9e718df0af9eaa2ead1ad198baf354c51a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20S=C3=A1nchez?= Date: Tue, 18 Aug 2020 13:50:08 +0200 Subject: [PATCH 15/29] Fixed errors --- modules/worker/front/calendar/index.js | 5 +++++ modules/worker/front/calendar/index.spec.js | 25 +++++++++++++++++++++ modules/worker/front/calendar/locale/es.yml | 3 ++- 3 files changed, 32 insertions(+), 1 deletion(-) diff --git a/modules/worker/front/calendar/index.js b/modules/worker/front/calendar/index.js index 7bbdb894e..006725172 100644 --- a/modules/worker/front/calendar/index.js +++ b/modules/worker/front/calendar/index.js @@ -19,6 +19,8 @@ class Controller extends Section { newYear.setFullYear(value); this.date = newYear; + + this.refresh().then(() => this.repaint()); } get date() { @@ -140,6 +142,9 @@ class Controller extends Section { if (!this.absenceType) return this.vnApp.showMessage(this.$t('Choose an absence type from the right menu')); + if (this.year != new Date().getFullYear()) + return this.vnApp.showMessage(this.$t('You can just add absences within the current year')); + const day = $days[0]; const stamp = day.getTime(); const event = this.events[stamp]; diff --git a/modules/worker/front/calendar/index.spec.js b/modules/worker/front/calendar/index.spec.js index 6b5025dae..7637f3a16 100644 --- a/modules/worker/front/calendar/index.spec.js +++ b/modules/worker/front/calendar/index.spec.js @@ -30,11 +30,14 @@ describe('Worker', () => { describe('year() setter', () => { it(`should set the year of the calendar date`, () => { + jest.spyOn(controller, 'refresh').mockReturnValue(new Promise()); + const previousYear = year - 1; controller.year = previousYear; expect(controller.year).toEqual(previousYear); expect(controller.date.getFullYear()).toEqual(previousYear); + expect(controller.refresh).toHaveBeenCalledWith(); }); }); @@ -157,6 +160,28 @@ describe('Worker', () => { expect(controller.vnApp.showMessage).toHaveBeenCalledWith('Choose an absence type from the right menu'); }); + it(`should show an snackbar message if the selected day is not within the current year`, () => { + jest.spyOn(controller.vnApp, 'showMessage').mockReturnThis(); + + const selectedDay = new Date(); + const $event = { + target: { + closest: () => { + return {$ctrl: {}}; + } + } + }; + const $days = [selectedDay]; + const pastYear = new Date(); + pastYear.setFullYear(pastYear.getFullYear() - 1); + + controller.date = pastYear; + controller.absenceType = {id: 1}; + controller.onSelection($event, $days); + + expect(controller.vnApp.showMessage).toHaveBeenCalledWith('You can just add absences within the current year'); + }); + it(`should call to the create() method`, () => { jest.spyOn(controller, 'create').mockReturnThis(); diff --git a/modules/worker/front/calendar/locale/es.yml b/modules/worker/front/calendar/locale/es.yml index f48a67c7b..68a9cf54d 100644 --- a/modules/worker/front/calendar/locale/es.yml +++ b/modules/worker/front/calendar/locale/es.yml @@ -5,4 +5,5 @@ Year: Año of: de days: días Choose an absence type from the right menu: Elige un tipo de ausencia desde el menú de la derecha -To start adding absences, click an absence type from the right menu and then on the day you want to add an absence: Para empezar a añadir ausencias, haz clic en un tipo de ausencia desde el menu de la derecha y después en el día que quieres añadir la ausencia \ No newline at end of file +To start adding absences, click an absence type from the right menu and then on the day you want to add an absence: Para empezar a añadir ausencias, haz clic en un tipo de ausencia desde el menu de la derecha y después en el día que quieres añadir la ausencia +You can just add absences within the current year: Solo puedes añadir ausencias dentro del año actual \ No newline at end of file From 1bcf4ff8a6a63c413e1d229470355ed3b99d9bd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20S=C3=A1nchez?= Date: Tue, 18 Aug 2020 13:55:38 +0200 Subject: [PATCH 16/29] Descomentado test --- e2e/paths/03-worker/05_calendar.spec.js | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/e2e/paths/03-worker/05_calendar.spec.js b/e2e/paths/03-worker/05_calendar.spec.js index 8f3ab4ba3..9be92e242 100644 --- a/e2e/paths/03-worker/05_calendar.spec.js +++ b/e2e/paths/03-worker/05_calendar.spec.js @@ -1,7 +1,7 @@ import selectors from '../../helpers/selectors.js'; import getBrowser from '../../helpers/puppeteer'; -describe('Worker calendar path', () => { +fdescribe('Worker calendar path', () => { let reasonableTimeBetweenClicks = 400; let browser; let page; @@ -122,17 +122,16 @@ describe('Worker calendar path', () => { expect(result).toContain(' 5 '); }); - // #1361 worker.calendar "hopefully this test works straight away after refreshing holidays per year on each filtering." - // it('should use the year selector to go to the previous year', async() => { - // const date = new Date(); - // const lastYear = (date.getFullYear() - 1).toString(); + it('should use the year selector to go to the previous year', async() => { + const date = new Date(); + const lastYear = (date.getFullYear() - 1).toString(); - // await page.autocompleteSearch(selectors.workerCalendar.year, lastYear); + await page.autocompleteSearch(selectors.workerCalendar.year, lastYear); - // await page.waitFor(reasonableTimeBetweenClicks); - // const result = await page.waitToGetProperty(selectors.workerCalendar.totalHolidaysUsed, 'innerText'); + await page.waitFor(reasonableTimeBetweenClicks); + const result = await page.waitToGetProperty(selectors.workerCalendar.totalHolidaysUsed, 'innerText'); - // expect(result).toContain(' 0 '); - // }); + expect(result).toContain(' 0 '); + }); }); }); From 1990f5172c8d1cae9a47f4dda5ff5f59816de08f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20S=C3=A1nchez?= Date: Tue, 18 Aug 2020 13:57:34 +0200 Subject: [PATCH 17/29] Removed focus --- e2e/paths/03-worker/05_calendar.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/paths/03-worker/05_calendar.spec.js b/e2e/paths/03-worker/05_calendar.spec.js index 9be92e242..801ff4151 100644 --- a/e2e/paths/03-worker/05_calendar.spec.js +++ b/e2e/paths/03-worker/05_calendar.spec.js @@ -1,7 +1,7 @@ import selectors from '../../helpers/selectors.js'; import getBrowser from '../../helpers/puppeteer'; -fdescribe('Worker calendar path', () => { +describe('Worker calendar path', () => { let reasonableTimeBetweenClicks = 400; let browser; let page; From cacf562954bc09142d71146cde8ec48f10f798c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20S=C3=A1nchez?= Date: Tue, 18 Aug 2020 14:01:43 +0200 Subject: [PATCH 18/29] Audit fix --- package-lock.json | 38 +++--- print/package-lock.json | 278 ++++++---------------------------------- 2 files changed, 60 insertions(+), 256 deletions(-) diff --git a/package-lock.json b/package-lock.json index 92030199a..c405cbc0e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -170,9 +170,9 @@ }, "dependencies": { "lodash": { - "version": "4.17.15", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", - "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", + "version": "4.17.20", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz", + "integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==", "dev": true } } @@ -2132,9 +2132,9 @@ } }, "lodash": { - "version": "4.17.15", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", - "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", + "version": "4.17.20", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz", + "integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==", "dev": true }, "ms": { @@ -2157,9 +2157,9 @@ }, "dependencies": { "lodash": { - "version": "4.17.15", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", - "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", + "version": "4.17.20", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz", + "integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==", "dev": true } } @@ -7760,9 +7760,9 @@ "integrity": "sha512-ZjI4zqTaxveH2/tTlzS1wFp+7ncxNZaIEWYg3lzZRHkKf5zPT/MnEG6WL0BhHMJUabkh8GeU5NL5j+rEUCb7Ug==" }, "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==", + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-4.2.1.tgz", + "integrity": "sha512-l0p4+mIuJIua0mhxGoh4a+iNL9bmeK5DvnSVQa6T0OhrVmaEa1XScX5Etc673FePCJOArq/4Pa2cLGODUWTPOQ==", "requires": { "is-obj": "^1.0.0" } @@ -7873,9 +7873,9 @@ "dev": true }, "elliptic": { - "version": "6.5.2", - "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.2.tgz", - "integrity": "sha512-f4x70okzZbIQl/NSRLkI/+tteV/9WqL98zx+SQ69KbXxmVrmjwsNUPn/gYJJ0sHvEak24cZgHIPegRePAtA/xw==", + "version": "6.5.3", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.3.tgz", + "integrity": "sha512-IMqzv5wNQf+E6aHeIqATs0tOLeOTwj1QKbRcS3jBbYkl5oLAserA8yJTT7/VyHUYG91PRmPyeQDObKLPpeS4dw==", "dev": true, "requires": { "bn.js": "^4.4.0", @@ -12228,7 +12228,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=" }, "is-path-cwd": { @@ -17702,9 +17702,9 @@ } }, "lodash": { - "version": "4.17.15", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", - "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==" + "version": "4.17.20", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz", + "integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==" }, "lodash._basecopy": { "version": "3.0.1", diff --git a/print/package-lock.json b/print/package-lock.json index 1020b8750..c06003044 100644 --- a/print/package-lock.json +++ b/print/package-lock.json @@ -4,20 +4,10 @@ "lockfileVersion": 1, "requires": true, "dependencies": { - "@types/node": { - "version": "14.0.27", - "resolved": "https://registry.npmjs.org/@types/node/-/node-14.0.27.tgz", - "integrity": "sha512-kVrqXhbclHNHGu9ztnAwSncIgJv/FaxmzXJvGXNdcCpV1b8u1/Mi6z6m0vwy0LzKeXFTPLH0NzwmoJ3fNCIq0g==", - "optional": true - }, - "@types/yauzl": { - "version": "2.9.1", - "resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.9.1.tgz", - "integrity": "sha512-A1b8SU4D10uoPjwb0lnHmmu8wZhR9d+9o2PKBQT2jU5YPTKsxac6M2qGAdY7VcL+dHHhARVUDmeg0rOrcd9EjA==", - "optional": true, - "requires": { - "@types/node": "*" - } + "@types/mime-types": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@types/mime-types/-/mime-types-2.1.0.tgz", + "integrity": "sha1-nKUs2jY/aZxpRmwqbM2q2RPqenM=" }, "agent-base": { "version": "5.1.1", @@ -74,6 +64,11 @@ "resolved": "https://registry.npmjs.org/async/-/async-3.1.0.tgz", "integrity": "sha512-4vx/aaY6j/j3Lw3fbCHNWP0pPaTCew3F6F3hYyl/tHs/ndmV1q7NW9T5yuJ2XAGwdQrP+6Wu20x06U4APo/iQQ==" }, + "async-limiter": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz", + "integrity": "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ==" + }, "asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", @@ -94,11 +89,6 @@ "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" }, - "base64-js": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.1.tgz", - "integrity": "sha512-mLQ4i2QO1ytvGWFWmcngKO//JXAQueZvwEKtjgQFM4jIK0kU+ytMfplL8j+n5mspOfjHwoAg+9yhb7BwAHm36g==" - }, "bcrypt-pbkdf": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", @@ -107,23 +97,6 @@ "tweetnacl": "^0.14.3" } }, - "bl": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/bl/-/bl-4.0.2.tgz", - "integrity": "sha512-j4OH8f6Qg2bGuWfRiltT2HYGx0e1QcBTrK9KAHNMwMZdQnDZFk0ZSYIpADjYCB3U12nicC5tVJwSIhwOWjb4RQ==", - "requires": { - "buffer": "^5.5.0", - "inherits": "^2.0.4", - "readable-stream": "^3.4.0" - }, - "dependencies": { - "inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" - } - } - }, "boolbase": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", @@ -138,25 +111,10 @@ "concat-map": "0.0.1" } }, - "buffer": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.6.0.tgz", - "integrity": "sha512-/gDYp/UtU0eA1ys8bOs9J6a+E/KWIY+DZ+Q2WESNUA0jFRsJOc0SNUO6xJ5SGA1xueg3NL65W6s+NY5l9cunuw==", - "requires": { - "base64-js": "^1.0.2", - "ieee754": "^1.1.4" - } - }, - "buffer-crc32": { - "version": "0.2.13", - "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", - "integrity": "sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI=" - }, "buffer-from": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", - "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==", - "optional": true + "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==" }, "camelcase": { "version": "5.3.1", @@ -201,11 +159,6 @@ "lodash.some": "^4.4.0" } }, - "chownr": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz", - "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==" - }, "cliui": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz", @@ -266,7 +219,6 @@ "version": "1.6.2", "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", - "optional": true, "requires": { "buffer-from": "^1.0.0", "inherits": "^2.0.3", @@ -278,7 +230,6 @@ "version": "2.3.6", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", - "optional": true, "requires": { "core-util-is": "~1.0.0", "inherits": "~2.0.3", @@ -293,7 +244,6 @@ "version": "1.1.1", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "optional": true, "requires": { "safe-buffer": "~5.1.0" } @@ -354,7 +304,6 @@ "version": "2.6.9", "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "optional": true, "requires": { "ms": "2.0.0" } @@ -379,11 +328,6 @@ "resolved": "https://registry.npmjs.org/denque/-/denque-1.4.1.tgz", "integrity": "sha512-OfzPuSZKGcgr96rf1oODnfjqBFmr1DVoc/TrItj3Ohe0Ah1C5WX5Baquw/9U9KovnQ88EqmJbD66rKYUQYN1tQ==" }, - "devtools-protocol": { - "version": "0.0.781568", - "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.781568.tgz", - "integrity": "sha512-9Uqnzy6m6zEStluH9iyJ3iHyaQziFnMnLeC8vK0eN6smiJmIx7+yB64d67C2lH/LZra+5cGscJAJsNXO+MdPMg==" - }, "dijkstrajs": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/dijkstrajs/-/dijkstrajs-1.0.1.tgz", @@ -434,14 +378,6 @@ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==" }, - "end-of-stream": { - "version": "1.4.4", - "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", - "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", - "requires": { - "once": "^1.4.0" - } - }, "entities": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/entities/-/entities-1.1.2.tgz", @@ -472,7 +408,6 @@ "version": "1.6.7", "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-1.6.7.tgz", "integrity": "sha1-qEC0uK9kAyZMjbV/Txp0Mz74H+k=", - "optional": true, "requires": { "concat-stream": "1.6.2", "debug": "2.6.9", @@ -499,7 +434,6 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.0.1.tgz", "integrity": "sha1-i1vL2ewyfFBBv5qwI/1nUPEXfmU=", - "optional": true, "requires": { "pend": "~1.2.0" } @@ -527,11 +461,6 @@ "mime-types": "^2.1.12" } }, - "fs-constants": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", - "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==" - }, "fs-extra": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz", @@ -560,14 +489,6 @@ "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==" }, - "get-stream": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", - "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", - "requires": { - "pump": "^3.0.0" - } - }, "getpass": { "version": "0.1.7", "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", @@ -704,11 +625,6 @@ "safer-buffer": ">= 2.1.2 < 3" } }, - "ieee754": { - "version": "1.1.13", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.13.tgz", - "integrity": "sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg==" - }, "image-size": { "version": "0.7.5", "resolved": "https://registry.npmjs.org/image-size/-/image-size-0.7.5.tgz", @@ -757,8 +673,7 @@ "isarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "optional": true + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" }, "isexe": { "version": "2.0.0", @@ -1000,28 +915,20 @@ "minimist": { "version": "0.0.8", "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", - "optional": true + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=" }, "mkdirp": { "version": "0.5.1", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", - "optional": true, "requires": { "minimist": "0.0.8" } }, - "mkdirp-classic": { - "version": "0.5.3", - "resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz", - "integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==" - }, "ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "optional": true + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" }, "mysql2": { "version": "1.7.0", @@ -1198,46 +1105,6 @@ "pinkie": "^2.0.0" } }, - "pkg-dir": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", - "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", - "requires": { - "find-up": "^4.0.0" - }, - "dependencies": { - "find-up": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", - "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", - "requires": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - } - }, - "locate-path": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", - "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", - "requires": { - "p-locate": "^4.1.0" - } - }, - "p-locate": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", - "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", - "requires": { - "p-limit": "^2.2.0" - } - }, - "path-exists": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==" - } - } - }, "pngjs": { "version": "3.4.0", "resolved": "https://registry.npmjs.org/pngjs/-/pngjs-3.4.0.tgz", @@ -1246,8 +1113,7 @@ "process-nextick-args": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", - "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==", - "optional": true + "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==" }, "progress": { "version": "1.1.8", @@ -1270,37 +1136,26 @@ "resolved": "https://registry.npmjs.org/psl/-/psl-1.1.31.tgz", "integrity": "sha512-/6pt4+C+T+wZUieKR620OpzN/LlnNKuWjy1iFLQ/UG35JqHlR/89MP1d96dUfkf6Dne3TuLQzOYEYshJ+Hx8mw==" }, - "pump": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", - "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", - "requires": { - "end-of-stream": "^1.1.0", - "once": "^1.3.1" - } - }, "punycode": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==" }, "puppeteer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-5.2.1.tgz", - "integrity": "sha512-PZoZG7u+T6N1GFWBQmGVG162Ak5MAy8nYSVpeeQrwJK2oYUlDWpHEJPcd/zopyuEMTv7DiztS1blgny1txR2qw==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-2.1.1.tgz", + "integrity": "sha512-LWzaDVQkk1EPiuYeTOj+CZRIjda4k2s5w4MK4xoH2+kgWV/SDlkYHmxatDdtYrciHUKSXTsGgPgPP8ILVdBsxg==", "requires": { + "@types/mime-types": "^2.1.0", "debug": "^4.1.0", - "devtools-protocol": "0.0.781568", - "extract-zip": "^2.0.0", + "extract-zip": "^1.6.6", "https-proxy-agent": "^4.0.0", "mime": "^2.0.3", - "pkg-dir": "^4.2.0", + "mime-types": "^2.1.25", "progress": "^2.0.1", "proxy-from-env": "^1.0.0", - "rimraf": "^3.0.2", - "tar-fs": "^2.0.0", - "unbzip2-stream": "^1.3.3", - "ws": "^7.2.3" + "rimraf": "^2.6.1", + "ws": "^6.1.0" }, "dependencies": { "debug": { @@ -1311,23 +1166,17 @@ "ms": "^2.1.1" } }, - "extract-zip": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-2.0.1.tgz", - "integrity": "sha512-GDhU9ntwuKyGXdZBUgTIe+vXnWj0fppUEtMDL0+idd5Sta8TGpHssn/eusA9mrPr9qNDym6SxAYZjNvCn/9RBg==", - "requires": { - "@types/yauzl": "^2.9.1", - "debug": "^4.1.1", - "get-stream": "^5.1.0", - "yauzl": "^2.10.0" - } + "mime-db": { + "version": "1.44.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.44.0.tgz", + "integrity": "sha512-/NOTfLrsPBVeH7YtFPgsVWveuL+4SjjYxaQ1xtM1KMFj7HdxlBlxeyNLzhyJVx7r4rZGJAZ/6lkKCitSc/Nmpg==" }, - "fd-slicer": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", - "integrity": "sha1-JcfInLH5B3+IkbvmHY85Dq4lbx4=", + "mime-types": { + "version": "2.1.27", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.27.tgz", + "integrity": "sha512-JIhqnCasI9yD+SsmkquHBxTSEuZdQX5BuQnS2Vc7puQQQ+8yiP5AY5uWhpdv4YL4VM5c6iliiYWPgJ/nJQLp7w==", "requires": { - "pend": "~1.2.0" + "mime-db": "1.44.0" } }, "ms": { @@ -1339,15 +1188,6 @@ "version": "2.0.3", "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==" - }, - "yauzl": { - "version": "2.10.0", - "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz", - "integrity": "sha1-x+sXyT4RLLEIb6bY5R+wZnt5pfk=", - "requires": { - "buffer-crc32": "~0.2.3", - "fd-slicer": "~1.1.0" - } } } }, @@ -1439,9 +1279,9 @@ } }, "rimraf": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", - "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", "requires": { "glob": "^7.1.3" } @@ -1586,40 +1426,12 @@ "has-flag": "^3.0.0" } }, - "tar-fs": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.0.tgz", - "integrity": "sha512-9uW5iDvrIMCVpvasdFHW0wJPez0K4JnMZtsuIeDI7HyMGJNxmDZDOCQROr7lXyS+iL/QMpj07qcjGYTSdRFXUg==", - "requires": { - "chownr": "^1.1.1", - "mkdirp-classic": "^0.5.2", - "pump": "^3.0.0", - "tar-stream": "^2.0.0" - } - }, - "tar-stream": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.1.3.tgz", - "integrity": "sha512-Z9yri56Dih8IaK8gncVPx4Wqt86NDmQTSh49XLZgjWpGZL9GK9HKParS2scqHCC4w6X9Gh2jwaU45V47XTKwVA==", - "requires": { - "bl": "^4.0.1", - "end-of-stream": "^1.4.1", - "fs-constants": "^1.0.0", - "inherits": "^2.0.3", - "readable-stream": "^3.1.1" - } - }, "throttleit": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/throttleit/-/throttleit-1.0.0.tgz", "integrity": "sha1-nnhYNtr0Z0MUWlmEtiaNgoUorGw=", "optional": true }, - "through": { - "version": "2.3.8", - "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", - "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=" - }, "tough-cookie": { "version": "2.4.3", "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz", @@ -1652,17 +1464,7 @@ "typedarray": { "version": "0.0.6", "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", - "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=", - "optional": true - }, - "unbzip2-stream": { - "version": "1.4.3", - "resolved": "https://registry.npmjs.org/unbzip2-stream/-/unbzip2-stream-1.4.3.tgz", - "integrity": "sha512-mlExGW4w71ebDJviH16lQLtZS32VKqsSfk80GCfUlwT/4/hNRFsoscrF/c++9xinkMzECL1uL9DDwXqFWkruPg==", - "requires": { - "buffer": "^5.2.1", - "through": "^2.3.8" - } + "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=" }, "universalify": { "version": "0.1.2", @@ -1819,9 +1621,12 @@ "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" }, "ws": { - "version": "7.3.1", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.3.1.tgz", - "integrity": "sha512-D3RuNkynyHmEJIpD2qrgVkc9DQ23OrN/moAwZX4L8DfvszsJxpjQuUq3LMx6HoYji9fbIOBY18XWBsAux1ZZUA==" + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ws/-/ws-6.2.1.tgz", + "integrity": "sha512-GIyAXC2cB7LjvpgMt9EKS2ldqr0MTrORaleiOno6TweZ6r3TKtoFQWay/2PceJ3RuBasOHzXNn5Lrw1X0bEjqA==", + "requires": { + "async-limiter": "~1.0.0" + } }, "xtend": { "version": "4.0.2", @@ -1868,7 +1673,6 @@ "version": "2.4.1", "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.4.1.tgz", "integrity": "sha1-lSj0QtqxsihOWLQ3m7GU4i4MQAU=", - "optional": true, "requires": { "fd-slicer": "~1.0.1" } From a3d3ed4aba161908f1f82f694df69ce337daad7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20S=C3=A1nchez?= Date: Tue, 18 Aug 2020 14:14:34 +0200 Subject: [PATCH 19/29] Fixed unit test --- modules/worker/front/calendar/index.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/worker/front/calendar/index.spec.js b/modules/worker/front/calendar/index.spec.js index 7637f3a16..ebf52dc66 100644 --- a/modules/worker/front/calendar/index.spec.js +++ b/modules/worker/front/calendar/index.spec.js @@ -30,7 +30,7 @@ describe('Worker', () => { describe('year() setter', () => { it(`should set the year of the calendar date`, () => { - jest.spyOn(controller, 'refresh').mockReturnValue(new Promise()); + jest.spyOn(controller, 'refresh').mockReturnValue(Promise.resolve()); const previousYear = year - 1; controller.year = previousYear; From f0818acf32fab07d34bae05f9dcde2d7e74862cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20S=C3=A1nchez?= Date: Wed, 19 Aug 2020 13:04:12 +0200 Subject: [PATCH 20/29] 2387 - Fixed error when deleting a zone --- .../10210-summer/00-ticket_beforeUpdate.sql | 31 +++++++++++++++++++ modules/zone/back/methods/zone/deleteZone.js | 9 +++--- modules/zone/front/descriptor/locale/es.yml | 2 +- 3 files changed, 37 insertions(+), 5 deletions(-) create mode 100644 db/changes/10210-summer/00-ticket_beforeUpdate.sql diff --git a/db/changes/10210-summer/00-ticket_beforeUpdate.sql b/db/changes/10210-summer/00-ticket_beforeUpdate.sql new file mode 100644 index 000000000..fa1cb6c5f --- /dev/null +++ b/db/changes/10210-summer/00-ticket_beforeUpdate.sql @@ -0,0 +1,31 @@ +DROP TRIGGER IF EXISTS `vn`.`ticket_beforeUpdate`; + +DELIMITER $$ +USE `vn`$$ +CREATE DEFINER=`root`@`%` TRIGGER `ticket_beforeUpdate` + BEFORE UPDATE ON `ticket` + FOR EACH ROW +BEGIN + IF !(NEW.shipped <=> OLD.shipped) THEN + IF YEAR(NEW.shipped) < 2000 THEN + SIGNAL SQLSTATE '46000' + SET MESSAGE_TEXT = 'Year cannot be lesser than 2000'; + END IF; + + IF YEAR(NEW.shipped) = 2000 THEN + SET NEW.isDeleted = TRUE; + END IF; + END IF; + + IF !(NEW.isDeleted <=> OLD.isDeleted) AND NEW.isDeleted THEN + SET NEW.shipped = DATE_FORMAT(NEW.shipped, '2000-%m-%d %T'); + SET NEW.landed = DATE_FORMAT(NEW.landed, '2000-%m-%d %T'); + SET NEW.routeFk = NULL; + SET NEW.zoneFk = NULL; + END IF; + + IF NEW.routeFk AND NEW.isDeleted THEN + CALL util.throw ('This ticket is deleted'); + END IF; +END$$ +DELIMITER ; diff --git a/modules/zone/back/methods/zone/deleteZone.js b/modules/zone/back/methods/zone/deleteZone.js index baa442491..7bf807f7d 100644 --- a/modules/zone/back/methods/zone/deleteZone.js +++ b/modules/zone/back/methods/zone/deleteZone.js @@ -29,7 +29,8 @@ module.exports = Self => { const options = {transaction: tx}; const filter = { where: { - zoneFk: id + zoneFk: id, + shipped: {gte: today} }, include: { relation: 'ticketState', @@ -46,10 +47,10 @@ module.exports = Self => { where: {userFk: userId} }, options); - ticketList.forEach(ticket => { - promises.push(ticket.updateAttributes({zoneFk: null}, options)); + await models.Ticket.rawSql('UPDATE ticket SET zoneFk = NULL WHERE zoneFk = ?', [id], options); - if (ticket.ticketState().alertLevel == 0 && ticket.shipped >= today) { + ticketList.forEach(ticket => { + if (ticket.ticketState().alertLevel == 0) { promises.push(models.TicketTracking.create({ ticketFk: ticket.id, stateFk: fixingState.id, diff --git a/modules/zone/front/descriptor/locale/es.yml b/modules/zone/front/descriptor/locale/es.yml index 67bcbb5b7..0581ee93a 100644 --- a/modules/zone/front/descriptor/locale/es.yml +++ b/modules/zone/front/descriptor/locale/es.yml @@ -1,4 +1,4 @@ -This zone contains tickets: Esta zona contiene {{ticketsAmount}} tickets. ¿Seguro que quieres eliminar esta zona? +This zone contains tickets: Esta zona contiene {{ticketsAmount}} tickets por servir. ¿Seguro que quieres eliminar esta zona? Do you want to clone this zone?: ¿Quieres clonar esta zona? All it's properties will be copied: Todas sus propiedades serán copiadas Zone deleted: Zona eliminada \ No newline at end of file From 7fdfd92a1cf673cdfc40568c64cc0199ba1406cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20S=C3=A1nchez?= Date: Wed, 19 Aug 2020 13:13:16 +0200 Subject: [PATCH 21/29] Removed sql --- .../10210-summer/00-ticket_beforeUpdate.sql | 31 ------------------- 1 file changed, 31 deletions(-) delete mode 100644 db/changes/10210-summer/00-ticket_beforeUpdate.sql diff --git a/db/changes/10210-summer/00-ticket_beforeUpdate.sql b/db/changes/10210-summer/00-ticket_beforeUpdate.sql deleted file mode 100644 index fa1cb6c5f..000000000 --- a/db/changes/10210-summer/00-ticket_beforeUpdate.sql +++ /dev/null @@ -1,31 +0,0 @@ -DROP TRIGGER IF EXISTS `vn`.`ticket_beforeUpdate`; - -DELIMITER $$ -USE `vn`$$ -CREATE DEFINER=`root`@`%` TRIGGER `ticket_beforeUpdate` - BEFORE UPDATE ON `ticket` - FOR EACH ROW -BEGIN - IF !(NEW.shipped <=> OLD.shipped) THEN - IF YEAR(NEW.shipped) < 2000 THEN - SIGNAL SQLSTATE '46000' - SET MESSAGE_TEXT = 'Year cannot be lesser than 2000'; - END IF; - - IF YEAR(NEW.shipped) = 2000 THEN - SET NEW.isDeleted = TRUE; - END IF; - END IF; - - IF !(NEW.isDeleted <=> OLD.isDeleted) AND NEW.isDeleted THEN - SET NEW.shipped = DATE_FORMAT(NEW.shipped, '2000-%m-%d %T'); - SET NEW.landed = DATE_FORMAT(NEW.landed, '2000-%m-%d %T'); - SET NEW.routeFk = NULL; - SET NEW.zoneFk = NULL; - END IF; - - IF NEW.routeFk AND NEW.isDeleted THEN - CALL util.throw ('This ticket is deleted'); - END IF; -END$$ -DELIMITER ; From 4d8a84e774698fe41e57e5162547890dae26be78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20S=C3=A1nchez?= Date: Thu, 20 Aug 2020 08:45:03 +0200 Subject: [PATCH 22/29] Fixed back unit tests --- db/dump/fixtures.sql | 8 ++--- modules/ticket/back/methods/ticket/filter.js | 2 +- .../ticket/specs/deleteStowaway.spec.js | 4 +-- .../back/methods/ticket/specs/filter.spec.js | 33 +++++++++++++++---- modules/ticket/front/main/index.html | 3 +- modules/ticket/front/main/index.js | 11 +++++-- 6 files changed, 43 insertions(+), 18 deletions(-) diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index ccc1b7d1d..2b70cf2be 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -601,11 +601,11 @@ INSERT INTO `vn`.`ticketTracking`(`ticketFk`, `stateFk`, `workerFk`, `created`) (12, 3, 19, NOW()), (13, 3, 19, NOW()), (14, 3, 19, NOW()), - (15, 3, 19, NOW()), + (15, 2, 19, NOW()), (16, 3, 19, NOW()), - (17, 3, 19, NOW()), - (18, 3, 19, NOW()), - (19, 3, 19, NOW()), + (17, 2, 19, NOW()), + (18, 2, 19, NOW()), + (19, 2, 19, NOW()), (20, 1, 19, DATE_ADD(NOW(), INTERVAL +1 MONTH)), (21, 1, 19, DATE_ADD(NOW(), INTERVAL +1 MONTH)), (22, 1, 19, DATE_ADD(NOW(), INTERVAL +1 MONTH)), diff --git a/modules/ticket/back/methods/ticket/filter.js b/modules/ticket/back/methods/ticket/filter.js index ddb55301b..3a34be442 100644 --- a/modules/ticket/back/methods/ticket/filter.js +++ b/modules/ticket/back/methods/ticket/filter.js @@ -265,7 +265,7 @@ module.exports = Self => { LEFT JOIN tmp.ticketProblems tp ON tp.ticketFk = f.id LEFT JOIN tmp.ticketTotal tt ON tt.ticketFk = f.id`); - if (args.problems != undefined && (!args.from || !args.to)) + if (args.problems != undefined && (!args.from && !args.to)) throw new UserError('Choose a date range or days forward'); let condition; diff --git a/modules/ticket/back/methods/ticket/specs/deleteStowaway.spec.js b/modules/ticket/back/methods/ticket/specs/deleteStowaway.spec.js index bd6fd327a..56375940d 100644 --- a/modules/ticket/back/methods/ticket/specs/deleteStowaway.spec.js +++ b/modules/ticket/back/methods/ticket/specs/deleteStowaway.spec.js @@ -17,7 +17,7 @@ describe('ticket deleteStowaway()', () => { await app.models.Stowaway.rawSql( `CALL ticketStateUpdate(?, ?)`, [shipId, 'OK']); await app.models.Stowaway.rawSql( - `CALL ticketStateUpdate(?, ?)`, [stowawayId, 'OK']); + `CALL ticketStateUpdate(?, ?)`, [stowawayId, 'FREE']); }); it('should create an stowaway', async() => { @@ -97,6 +97,6 @@ describe('ticket deleteStowaway()', () => { } }); - expect(shipState.name).toEqual('OK'); + expect(shipState.name).toEqual('Libre'); }); }); diff --git a/modules/ticket/back/methods/ticket/specs/filter.spec.js b/modules/ticket/back/methods/ticket/specs/filter.spec.js index 4aa1b3a77..312b95ad5 100644 --- a/modules/ticket/back/methods/ticket/specs/filter.spec.js +++ b/modules/ticket/back/methods/ticket/specs/filter.spec.js @@ -11,7 +11,16 @@ describe('ticket filter()', () => { }); it('should return the tickets matching the problems on true', async() => { - const ctx = {req: {accessToken: {userId: 9}}, args: {problems: true}}; + const yesterday = new Date(); + yesterday.setHours(0, 0, 0, 0); + const today = new Date(); + today.setHours(23, 59, 59, 59); + + const ctx = {req: {accessToken: {userId: 9}}, args: { + problems: true, + from: yesterday, + to: today + }}; const filter = {}; const result = await app.models.Ticket.filter(ctx, filter); @@ -19,11 +28,21 @@ describe('ticket filter()', () => { }); it('should return the tickets matching the problems on false', async() => { - const ctx = {req: {accessToken: {userId: 9}}, args: {problems: false}}; + const yesterday = new Date(); + yesterday.setDate(yesterday.getDate() - 1); + yesterday.setHours(0, 0, 0, 0); + const today = new Date(); + today.setHours(23, 59, 59, 59); + + const ctx = {req: {accessToken: {userId: 9}}, args: { + problems: false, + from: yesterday, + to: today + }}; const filter = {}; const result = await app.models.Ticket.filter(ctx, filter); - expect(result.length).toEqual(20); + expect(result.length).toEqual(11); }); it('should return the tickets matching the problems on null', async() => { @@ -52,10 +71,10 @@ describe('ticket filter()', () => { const secondRow = result[1]; const thirdRow = result[2]; - expect(result.length).toEqual(3); - expect(firstRow.state).toEqual('Arreglar'); - expect(secondRow.state).toEqual('Arreglar'); - expect(thirdRow.state).toEqual('Arreglar'); + expect(result.length).toEqual(7); + expect(firstRow.state).toEqual('Libre'); + expect(secondRow.state).toEqual('Libre'); + expect(thirdRow.state).toEqual('Libre'); }); it('should return the tickets that are not pending', async() => { diff --git a/modules/ticket/front/main/index.html b/modules/ticket/front/main/index.html index a21b28992..7a02ce8ca 100644 --- a/modules/ticket/front/main/index.html +++ b/modules/ticket/front/main/index.html @@ -9,7 +9,8 @@ panel="vn-ticket-search-panel" info="Search ticket by id or alias" model="model" - fetch-params="$ctrl.fetchParams($params)"> + fetch-params="$ctrl.fetchParams($params)" + suggested-filter="$ctrl.defaultFilter"> diff --git a/modules/ticket/front/main/index.js b/modules/ticket/front/main/index.js index bd4718176..6b919c474 100644 --- a/modules/ticket/front/main/index.js +++ b/modules/ticket/front/main/index.js @@ -2,10 +2,15 @@ import ngModule from '../module'; import ModuleMain from 'salix/components/module-main'; export default class Ticket extends ModuleMain { - fetchParams($params) { - if (!Object.entries($params).length) - $params.scopeDays = 1; + constructor() { + super(); + this.defaultFilter = { + scopeDays: 1 + }; + } + + fetchParams($params) { if (typeof $params.scopeDays === 'number') { const from = new Date(); from.setHours(0, 0, 0, 0); From 80e1577d4ff8e0258129748a0920e560631fbbff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20S=C3=A1nchez?= Date: Thu, 20 Aug 2020 09:50:22 +0200 Subject: [PATCH 23/29] Updated e2e --- e2e/paths/05-ticket/18_index_payout.spec.js | 2 +- modules/ticket/front/main/index.js | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/e2e/paths/05-ticket/18_index_payout.spec.js b/e2e/paths/05-ticket/18_index_payout.spec.js index b1dc06e51..37e5261dc 100644 --- a/e2e/paths/05-ticket/18_index_payout.spec.js +++ b/e2e/paths/05-ticket/18_index_payout.spec.js @@ -19,7 +19,7 @@ describe('Ticket index payout path', () => { await page.waitForState('ticket.index'); }); - it('should check three tickets 2 of a clinet and 1 of another', async() => { + it('should check the second ticket from a client and 1 of another', async() => { await page.keyboard.press('Enter'); await page.waitToClick(selectors.ticketsIndex.secondTicketCheckbox); await page.waitToClick(selectors.ticketsIndex.sixthTicketCheckbox); diff --git a/modules/ticket/front/main/index.js b/modules/ticket/front/main/index.js index 6b919c474..9bbedbcc9 100644 --- a/modules/ticket/front/main/index.js +++ b/modules/ticket/front/main/index.js @@ -11,6 +11,9 @@ export default class Ticket extends ModuleMain { } fetchParams($params) { + if (!Object.entries($params).length) + $params.scopeDays = 1; + if (typeof $params.scopeDays === 'number') { const from = new Date(); from.setHours(0, 0, 0, 0); From 957c1c01b90c13cd16a7be7879ad12ab2329b4d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20S=C3=A1nchez?= Date: Mon, 24 Aug 2020 07:54:30 +0200 Subject: [PATCH 24/29] Html changes --- modules/client/front/address/index/index.html | 6 +++++- modules/client/front/address/index/index.js | 3 ++- modules/route/front/summary/index.html | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/modules/client/front/address/index/index.html b/modules/client/front/address/index/index.html index bd5d10fd2..51b310128 100644 --- a/modules/client/front/address/index/index.html +++ b/modules/client/front/address/index/index.html @@ -46,7 +46,11 @@ style="overflow: hidden; min-width: 14em;">
{{::address.nickname}} - #{{::address.id}}
{{::address.street}}
-
{{::address.city}}, {{::address.province.name}}
+
+ {{::address.postalCode}} - + {{::address.city}}, + {{::address.province.name}} +
{{::address.phone}}, {{::address.mobile}} diff --git a/modules/client/front/address/index/index.js b/modules/client/front/address/index/index.js index ea6a9f6b9..3a2b5dfa8 100644 --- a/modules/client/front/address/index/index.js +++ b/modules/client/front/address/index/index.js @@ -16,7 +16,8 @@ class Controller extends Section { 'provinceFk', 'phone', 'mobile', - 'isEqualizated' + 'isEqualizated', + 'postalCode' ], order: [ 'isDefaultAddress DESC', diff --git a/modules/route/front/summary/index.html b/modules/route/front/summary/index.html index d99f5e012..b2c9255e0 100644 --- a/modules/route/front/summary/index.html +++ b/modules/route/front/summary/index.html @@ -71,7 +71,7 @@ - {{ticket.id | zeroFill:6}} + {{ticket.id}} From cd74e9684a04b56f1d60afd306f1de347f5bd8c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20S=C3=A1nchez?= Date: Tue, 25 Aug 2020 10:00:21 +0200 Subject: [PATCH 25/29] Download route PDF on route index --- modules/route/front/index/index.html | 40 ++++++++++++++++--- modules/route/front/index/index.js | 34 ++++++++++++++++ modules/route/front/index/locale/es.yml | 1 + .../report-footer/assets/css/style.css | 5 ++- print/core/report.js | 1 + .../reports/driver-route/assets/css/style.css | 5 +++ .../reports/driver-route/driver-route.html | 9 +++-- .../reports/driver-route/driver-route.js | 31 +++++++++----- 8 files changed, 105 insertions(+), 21 deletions(-) diff --git a/modules/route/front/index/index.html b/modules/route/front/index/index.html index 16f6ad827..7258018f1 100644 --- a/modules/route/front/index/index.html +++ b/modules/route/front/index/index.html @@ -8,6 +8,11 @@ + + + + Id Worker Agency @@ -22,6 +27,12 @@ + + + + {{::route.id | dashIfEmpty}} - - - \ No newline at end of file + + + +
+ + + + + + + + + +
\ No newline at end of file diff --git a/modules/route/front/index/index.js b/modules/route/front/index/index.js index 400684a0d..9afaa862c 100644 --- a/modules/route/front/index/index.js +++ b/modules/route/front/index/index.js @@ -2,12 +2,46 @@ import ngModule from '../module'; import Section from 'salix/components/section'; export default class Controller extends Section { + constructor($element, $, vnReport) { + super($element, $); + this.vnReport = vnReport; + } + preview(route) { this.routeSelected = route; this.$.summary.show(); } + + get checked() { + const rows = this.$.model.data || []; + const checkedRows = []; + for (let row of rows) { + if (row.checked) + checkedRows.push(row); + } + + return checkedRows; + } + + get totalChecked() { + return this.checked.length; + } + + showRouteReport() { + const routes = []; + for (let route of this.checked) + routes.push(route.id); + const routesId = routes.join(','); + + this.vnReport.show('driver-route', { + authorization: this.vnToken.token, + routeId: routesId + }); + } } +Controller.$inject = ['$element', '$scope', 'vnReport']; + ngModule.vnComponent('vnRouteIndex', { template: require('./index.html'), controller: Controller diff --git a/modules/route/front/index/locale/es.yml b/modules/route/front/index/locale/es.yml index 5a21565b5..0c09b21ee 100644 --- a/modules/route/front/index/locale/es.yml +++ b/modules/route/front/index/locale/es.yml @@ -1 +1,2 @@ Vehicle: Vehículo +Download selected routes as PDF: Descargar rutas seleccionadas como PDF \ No newline at end of file diff --git a/print/core/components/report-footer/assets/css/style.css b/print/core/components/report-footer/assets/css/style.css index e06e8c0ad..9727e6f8f 100644 --- a/print/core/components/report-footer/assets/css/style.css +++ b/print/core/components/report-footer/assets/css/style.css @@ -24,8 +24,9 @@ p.privacy { text-align: center } -.page .pageCount { - text-align: right +.pageCount { + text-align: right; + float: right } .footer .page > div { diff --git a/print/core/report.js b/print/core/report.js index e773c6c91..c5847fda1 100644 --- a/print/core/report.js +++ b/print/core/report.js @@ -33,6 +33,7 @@ class Report extends Component { args: ['--no-sandbox', '--disable-setuid-sandbox'] }); const page = await browser.newPage(); + await page.emulateMedia('screen'); await page.setContent(template); const element = await page.$('#pageFooter'); diff --git a/print/templates/reports/driver-route/assets/css/style.css b/print/templates/reports/driver-route/assets/css/style.css index 2e7ec4dab..6b76748eb 100644 --- a/print/templates/reports/driver-route/assets/css/style.css +++ b/print/templates/reports/driver-route/assets/css/style.css @@ -47,3 +47,8 @@ section.text-area { padding-right: 1em; background-color: #e5e5e5; } + +.route-block { + margin-bottom: 100px; + page-break-after: always; +} \ No newline at end of file diff --git a/print/templates/reports/driver-route/driver-route.html b/print/templates/reports/driver-route/driver-route.html index 549aac060..a3bb0f478 100644 --- a/print/templates/reports/driver-route/driver-route.html +++ b/print/templates/reports/driver-route/driver-route.html @@ -8,9 +8,9 @@ -
+
-

{{route.id}}

+

{{$t('route')}} {{route.id}}

{{$t('information')}}
@@ -80,7 +80,8 @@
-
+ +
@@ -151,7 +152,7 @@ diff --git a/print/templates/reports/driver-route/driver-route.js b/print/templates/reports/driver-route/driver-route.js index 8785527bc..fcba7cb67 100755 --- a/print/templates/reports/driver-route/driver-route.js +++ b/print/templates/reports/driver-route/driver-route.js @@ -6,15 +6,27 @@ const reportFooter = new Component('report-footer'); module.exports = { name: 'driver-route', async serverPrefetch() { - this.route = await this.fetchRoute(this.routeId); - this.tickets = await this.fetchTickets(this.routeId); + const routesId = this.routeId.split(','); + const routes = await this.fetchRoutes(routesId); + const tickets = await this.fetchTickets(routesId); + console.log(tickets); - if (!this.route) + for (let route of routes) { + const routeTickets = tickets.filter(ticket => { + return ticket.routeFk == route.id; + }); + + route.tickets = routeTickets; + } + + this.routes = routes; + + if (!this.routes) throw new Error('Something went wrong'); }, methods: { - fetchRoute(id) { - return db.findOne( + fetchRoutes(routesId) { + return db.rawSql( `SELECT r.id, r.m3, @@ -30,9 +42,9 @@ module.exports = { LEFT JOIN worker w ON w.id = r.workerFk LEFT JOIN account.user u ON u.id = w.userFk LEFT JOIN agencyMode am ON am.id = r.agencyModeFk - WHERE r.id = :routeId`, {routeId: id}); + WHERE r.id IN(:routesId)`, {routesId}); }, - fetchTickets(routeId) { + fetchTickets(routesId) { return db.rawSql( `SELECT t.nickname addressName, @@ -41,6 +53,7 @@ module.exports = { t.id, t.clientFk, t.companyFk, + t.routeFk, if(a.phone, a.phone, c.phone) AS phone, if(a.mobile, a.mobile, c.mobile) AS mobile, wh.name warehouseName, @@ -65,8 +78,8 @@ module.exports = { LEFT JOIN warehouse wh ON wh.id = t.warehouseFk LEFT JOIN agencyMode am ON am.id = t.agencyModeFk LEFT JOIN stowaway s ON s.id = t.id - WHERE r.id = ? - ORDER BY t.priority, t.id`, [routeId]); + WHERE r.id IN(:routesId) + ORDER BY t.priority, t.id`, {routesId}); } }, components: { From 17497c3f2d75dc5f61bbf0ce629a41fdf2d5ecdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20S=C3=A1nchez?= Date: Tue, 25 Aug 2020 10:22:57 +0200 Subject: [PATCH 26/29] Added unit test --- modules/route/front/index/index.spec.js | 60 +++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 modules/route/front/index/index.spec.js diff --git a/modules/route/front/index/index.spec.js b/modules/route/front/index/index.spec.js new file mode 100644 index 000000000..8d71c91d6 --- /dev/null +++ b/modules/route/front/index/index.spec.js @@ -0,0 +1,60 @@ +import './index.js'; +import crudModel from 'core/mocks/crud-model'; + +describe('Component vnRouteIndex', () => { + let controller; + + beforeEach(ngModule('route')); + + beforeEach(inject($componentController => { + const $element = angular.element(''); + controller = $componentController('vnRouteIndex', {$element}); + controller.$.model = crudModel; + controller.$.model.data = [{id: 1}, {id: 2}, {id: 3}]; + })); + + describe('checked() getter', () => { + it('should should return the checked lines', () => { + const data = controller.$.model.data; + data[0].checked = true; + data[2].checked = true; + + const checkedRows = controller.checked; + + const firstCheckedRow = checkedRows[0]; + const secondCheckedRow = checkedRows[1]; + + expect(firstCheckedRow.id).toEqual(1); + expect(secondCheckedRow.id).toEqual(3); + }); + }); + + describe('totalCheked() getter', () => { + it('should should return the total checked lines', () => { + const data = controller.$.model.data; + data[0].checked = true; + + const checkedRows = controller.totalChecked; + + expect(checkedRows).toEqual(1); + }); + }); + + describe('showRouteReport()', () => { + it('should call to the vnReport show method', () => { + controller.vnReport.show = jest.fn(); + + const data = controller.$.model.data; + data[0].checked = true; + data[2].checked = true; + const expectedParams = { + authorization: null, + routeId: '1,3' + }; + + controller.showRouteReport(); + + expect(controller.vnReport.show).toHaveBeenCalledWith('driver-route', expectedParams); + }); + }); +}); From c15934aabcce114036019767e5bf9d8f71d4ceb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20S=C3=A1nchez?= Date: Tue, 25 Aug 2020 11:59:51 +0200 Subject: [PATCH 27/29] Updated e2e selector --- e2e/helpers/selectors.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 925347115..6eca623bd 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -371,7 +371,7 @@ export default { ticketsIndex: { openAdvancedSearchButton: 'vn-searchbar .append vn-icon[icon="arrow_drop_down"]', advancedSearchInvoiceOut: 'vn-ticket-search-panel vn-textfield[ng-model="filter.refFk"]', - newTicketButton: 'vn-ticket-index a', + newTicketButton: 'vn-ticket-index a[ui-sref="ticket.create"]', searchResult: 'vn-ticket-index vn-card > vn-table > div > vn-tbody > a.vn-tr', secondTicketCheckbox: 'vn-ticket-index vn-tbody > a:nth-child(2) > vn-td:nth-child(1) > vn-check', thirdTicketCheckbox: 'vn-ticket-index vn-tbody > a:nth-child(3) > vn-td:nth-child(1) > vn-check', @@ -689,7 +689,7 @@ export default { confirmButton: '.vn-confirm.shown button[response="accept"]', }, routeIndex: { - addNewRouteButton: 'vn-route-index > a[ui-sref="route.create"]' + addNewRouteButton: 'vn-route-index a[ui-sref="route.create"]' }, createRouteView: { worker: 'vn-route-create vn-autocomplete[ng-model="$ctrl.route.workerFk"]', From 9ef58cabd4353a5ef5ddb1021074c26986f02f4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20S=C3=A1nchez?= Date: Tue, 25 Aug 2020 14:10:38 +0200 Subject: [PATCH 28/29] Removed console log --- modules/route/front/index/index.spec.js | 4 ++-- print/templates/reports/driver-route/driver-route.js | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/modules/route/front/index/index.spec.js b/modules/route/front/index/index.spec.js index 8d71c91d6..e90fc7164 100644 --- a/modules/route/front/index/index.spec.js +++ b/modules/route/front/index/index.spec.js @@ -14,7 +14,7 @@ describe('Component vnRouteIndex', () => { })); describe('checked() getter', () => { - it('should should return the checked lines', () => { + it('should return the checked lines', () => { const data = controller.$.model.data; data[0].checked = true; data[2].checked = true; @@ -30,7 +30,7 @@ describe('Component vnRouteIndex', () => { }); describe('totalCheked() getter', () => { - it('should should return the total checked lines', () => { + it('should return the total checked lines', () => { const data = controller.$.model.data; data[0].checked = true; diff --git a/print/templates/reports/driver-route/driver-route.js b/print/templates/reports/driver-route/driver-route.js index fcba7cb67..cab5342e5 100755 --- a/print/templates/reports/driver-route/driver-route.js +++ b/print/templates/reports/driver-route/driver-route.js @@ -9,7 +9,6 @@ module.exports = { const routesId = this.routeId.split(','); const routes = await this.fetchRoutes(routesId); const tickets = await this.fetchTickets(routesId); - console.log(tickets); for (let route of routes) { const routeTickets = tickets.filter(ticket => { From ea4f561bcfb2320d22b008d62fb928008d1778c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20S=C3=A1nchez?= Date: Wed, 26 Aug 2020 07:33:00 +0200 Subject: [PATCH 29/29] Added try-catch --- .../item-image-queue/downloadImages.js | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/modules/item/back/methods/item-image-queue/downloadImages.js b/modules/item/back/methods/item-image-queue/downloadImages.js index bd22bc281..c49cb0702 100644 --- a/modules/item/back/methods/item-image-queue/downloadImages.js +++ b/modules/item/back/methods/item-image-queue/downloadImages.js @@ -19,6 +19,7 @@ module.exports = Self => { Self.downloadImages = async() => { const models = Self.app.models; + let image; try { const tempPath = path.join('/tmp/salix-image'); @@ -26,7 +27,7 @@ module.exports = Self => { await fs.mkdir(tempPath, {recursive: true}); const timer = setInterval(async() => { - const image = await Self.findOne({where: {error: null}}); + image = await Self.findOne({where: {error: null}}); // Exit loop if (!image) return clearInterval(timer); @@ -61,17 +62,25 @@ module.exports = Self => { await errorHandler(image.itemFk, error, filePath); } }); - }, 1000); + }, 1500); } catch (error) { await errorHandler(image.itemFk, error); } async function errorHandler(rowId, error, filePath) { - const row = await Self.findById(rowId); - await row.updateAttribute('error', error); + try { + const row = await Self.findById(rowId); - if (filePath) - await fs.unlink(filePath); + if (!row) + throw new Error(`Could not update due error ${error}`); + + await row.updateAttribute('error', error); + + if (filePath) + await fs.unlink(filePath); + } catch (error) { + throw error; + } } }; };