From f8ba2534cc39f5042e3fafeb6e9e3032693fdd8e Mon Sep 17 00:00:00 2001 From: joan Date: Fri, 8 Jan 2021 14:32:48 +0100 Subject: [PATCH 1/4] 2691 - Scope days changes --- modules/ticket/front/search-panel/index.html | 62 +++++++++++--------- modules/ticket/front/search-panel/index.js | 35 +++++++++++ modules/ticket/front/search-panel/style.scss | 22 +++++++ 3 files changed, 91 insertions(+), 28 deletions(-) create mode 100644 modules/ticket/front/search-panel/style.scss diff --git a/modules/ticket/front/search-panel/index.html b/modules/ticket/front/search-panel/index.html index 8570036c0..6928e10c6 100644 --- a/modules/ticket/front/search-panel/index.html +++ b/modules/ticket/front/search-panel/index.html @@ -1,6 +1,6 @@
-
- + + - + - - - - - - - - - +
+ + + + + + O + + + +
+ - + - + - + - + diff --git a/modules/ticket/front/search-panel/index.js b/modules/ticket/front/search-panel/index.js index 08b0fb244..3efeb576c 100644 --- a/modules/ticket/front/search-panel/index.js +++ b/modules/ticket/front/search-panel/index.js @@ -1,8 +1,12 @@ import ngModule from '../module'; import SearchPanel from 'core/components/searchbar/search-panel'; +import './style.scss'; + class Controller extends SearchPanel { constructor($, $element) { super($, $element); + this.filter = this.$.filter; + this.getGroupedStates(); } @@ -19,6 +23,37 @@ class Controller extends SearchPanel { this.groupedStates = groupedStates; }); } + + get from() { + return this._from; + } + + set from(value) { + this._from = value; + + this.filter.scopeDays = null; + } + + get to() { + return this._to; + } + + set to(value) { + this._to = value; + + this.filter.scopeDays = null; + } + + get scopeDays() { + return this._scopeDays; + } + + set scopeDays(value) { + this._scopeDays = value; + + this.filter.from = null; + this.filter.to = null; + } } ngModule.vnComponent('vnTicketSearchPanel', { diff --git a/modules/ticket/front/search-panel/style.scss b/modules/ticket/front/search-panel/style.scss new file mode 100644 index 000000000..374db22d7 --- /dev/null +++ b/modules/ticket/front/search-panel/style.scss @@ -0,0 +1,22 @@ +@import "./effects"; +@import "./variables"; + + +form#ticket-form { + padding: 0 +} + +.scope-days { + border: $border-thin-light; + text-align: right; + + & > p { + font-size: 1.2rem; + margin: 3px; + } + + .or { + font-weight: bold; + font-size: 26px + } +} \ No newline at end of file From ffdc753ad4b6b0fade2ad18a47a9248faf2b14a7 Mon Sep 17 00:00:00 2001 From: joan Date: Mon, 11 Jan 2021 08:48:53 +0100 Subject: [PATCH 2/4] 2691 - Added "or" between date ranges and scope days --- front/core/components/field/index.js | 5 ++++- modules/ticket/front/search-panel/index.html | 8 ++++++-- modules/ticket/front/search-panel/index.js | 20 ------------------- .../ticket/front/search-panel/index.spec.js | 13 ++++++++++++ .../ticket/front/search-panel/locale/es.yml | 3 ++- modules/ticket/front/search-panel/style.scss | 10 +++++++++- modules/ticket/front/weekly/locale/es.yml | 2 +- 7 files changed, 35 insertions(+), 26 deletions(-) diff --git a/front/core/components/field/index.js b/front/core/components/field/index.js index 8d619e4a3..d18973bbe 100644 --- a/front/core/components/field/index.js +++ b/front/core/components/field/index.js @@ -187,7 +187,10 @@ export default class Field extends FormInput { } onChange() { - this.emit('change', {value: this.field}); + // Changes doesn't reflect until appling async + this.$.$applyAsync(() => { + this.emit('change', {value: this.field}); + }); } } Field.$inject = ['$element', '$scope']; diff --git a/modules/ticket/front/search-panel/index.html b/modules/ticket/front/search-panel/index.html index 6928e10c6..934b1fc1f 100644 --- a/modules/ticket/front/search-panel/index.html +++ b/modules/ticket/front/search-panel/index.html @@ -27,13 +27,13 @@ vn-one label="From" ng-model="filter.from" - on-change="$ctrl.from = value"> + on-change="filter.scopeDays = null"> + on-change="filter.scopeDays = null"> O + + diff --git a/modules/ticket/front/search-panel/index.js b/modules/ticket/front/search-panel/index.js index 3efeb576c..71a339482 100644 --- a/modules/ticket/front/search-panel/index.js +++ b/modules/ticket/front/search-panel/index.js @@ -24,26 +24,6 @@ class Controller extends SearchPanel { }); } - get from() { - return this._from; - } - - set from(value) { - this._from = value; - - this.filter.scopeDays = null; - } - - get to() { - return this._to; - } - - set to(value) { - this._to = value; - - this.filter.scopeDays = null; - } - get scopeDays() { return this._scopeDays; } diff --git a/modules/ticket/front/search-panel/index.spec.js b/modules/ticket/front/search-panel/index.spec.js index 55d341d2a..99c9d8da0 100644 --- a/modules/ticket/front/search-panel/index.spec.js +++ b/modules/ticket/front/search-panel/index.spec.js @@ -10,6 +10,7 @@ describe('Ticket Component vnTicketSearchPanel', () => { $httpBackend = _$httpBackend_; controller = $componentController('vnTicketSearchPanel', {$element: null}); controller.$t = () => {}; + controller.filter = {}; })); describe('getGroupedStates()', () => { @@ -32,4 +33,16 @@ describe('Ticket Component vnTicketSearchPanel', () => { }]); }); }); + + describe('scopeDays() setter', () => { + it('should clear the date range', () => { + controller.filter.from = new Date(); + controller.filter.to = new Date(); + + controller.scopeDays = 1; + + expect(controller.filter.from).toBeNull(); + expect(controller.filter.to).toBeNull(); + }); + }); }); diff --git a/modules/ticket/front/search-panel/locale/es.yml b/modules/ticket/front/search-panel/locale/es.yml index 5fa75ac09..54a01c82f 100644 --- a/modules/ticket/front/search-panel/locale/es.yml +++ b/modules/ticket/front/search-panel/locale/es.yml @@ -16,4 +16,5 @@ Pending: Pendiente FREE: Libre DELIVERED: Servido ON_PREPARATION: En preparacion -PACKED: Encajado \ No newline at end of file +PACKED: Encajado +Cannot choose a range of dates and days onward at the same time: No se puede selecionar un rango de fechas y días en adelante a la vez \ No newline at end of file diff --git a/modules/ticket/front/search-panel/style.scss b/modules/ticket/front/search-panel/style.scss index 374db22d7..56c36fabd 100644 --- a/modules/ticket/front/search-panel/style.scss +++ b/modules/ticket/front/search-panel/style.scss @@ -8,6 +8,7 @@ form#ticket-form { .scope-days { border: $border-thin-light; + position: relative; text-align: right; & > p { @@ -17,6 +18,13 @@ form#ticket-form { .or { font-weight: bold; - font-size: 26px + font-size: 26px; + color: $color-font-secondary + } + + vn-icon[icon="info"] { + position: absolute; + top: 2px; + right: 2px } } \ No newline at end of file diff --git a/modules/ticket/front/weekly/locale/es.yml b/modules/ticket/front/weekly/locale/es.yml index 804467dae..62f0f5b53 100644 --- a/modules/ticket/front/weekly/locale/es.yml +++ b/modules/ticket/front/weekly/locale/es.yml @@ -4,4 +4,4 @@ You are going to delete this weekly ticket: Vas a eliminar este ticket programad This ticket will be removed from weekly tickets! Continue anyway?: Este ticket se eliminará de tickets programados! ¿Continuar de todas formas? Search weekly ticket by id or client id: Busca tickets programados por el identificador o el identificador del cliente Search by weekly ticket: Buscar por tickets programados -weekDay: Dia \ No newline at end of file +Weekday: Llegada \ No newline at end of file From 035bdfb1adf5032b1dd6e98dc28f16968f96cad4 Mon Sep 17 00:00:00 2001 From: joan Date: Mon, 11 Jan 2021 10:08:33 +0100 Subject: [PATCH 3/4] Rounded box --- modules/ticket/front/search-panel/style.scss | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/ticket/front/search-panel/style.scss b/modules/ticket/front/search-panel/style.scss index 56c36fabd..d90c66251 100644 --- a/modules/ticket/front/search-panel/style.scss +++ b/modules/ticket/front/search-panel/style.scss @@ -8,6 +8,7 @@ form#ticket-form { .scope-days { border: $border-thin-light; + border-radius: 5px; position: relative; text-align: right; From 7568a1c06663f58e9626f5b70d623db2348304b9 Mon Sep 17 00:00:00 2001 From: joan Date: Mon, 11 Jan 2021 14:54:24 +0100 Subject: [PATCH 4/4] Updated unit tests --- .../core/components/searchbar/search-panel.js | 1 + front/core/components/searchbar/style.scss | 25 ++++++++++++++- modules/ticket/front/search-panel/index.html | 8 ++--- modules/ticket/front/search-panel/index.js | 19 +++++++++++- .../ticket/front/search-panel/index.spec.js | 27 ++++++++++++++-- modules/ticket/front/search-panel/style.scss | 31 ------------------- 6 files changed, 72 insertions(+), 39 deletions(-) delete mode 100644 modules/ticket/front/search-panel/style.scss diff --git a/front/core/components/searchbar/search-panel.js b/front/core/components/searchbar/search-panel.js index f473c2b04..67fd3fae2 100644 --- a/front/core/components/searchbar/search-panel.js +++ b/front/core/components/searchbar/search-panel.js @@ -1,4 +1,5 @@ import Component from '../../lib/component'; +import './style.scss'; export default class SearchPanel extends Component { set filter(value) { diff --git a/front/core/components/searchbar/style.scss b/front/core/components/searchbar/style.scss index c1d4be21c..eab9c126b 100644 --- a/front/core/components/searchbar/style.scss +++ b/front/core/components/searchbar/style.scss @@ -1,4 +1,4 @@ -@import "variables"; +@import "./variables"; vn-searchbar { display: block; @@ -44,4 +44,27 @@ vn-searchbar { & > form { padding: $spacing-lg; } + + & > form#manifold-form { + padding: 0; + + .manifold-panel { + border: $border-thin-light; + border-radius: 5px; + position: relative; + text-align: right; + + .or { + font-weight: bold; + font-size: 26px; + color: $color-font-secondary + } + + vn-icon[icon="info"] { + position: absolute; + top: 2px; + right: 2px + } + } + } } \ No newline at end of file diff --git a/modules/ticket/front/search-panel/index.html b/modules/ticket/front/search-panel/index.html index 934b1fc1f..d9ab2ee91 100644 --- a/modules/ticket/front/search-panel/index.html +++ b/modules/ticket/front/search-panel/index.html @@ -1,5 +1,5 @@
-
+
- + + on-change="$ctrl.from = value"> + on-change="$ctrl.to = value"> O { })); describe('getGroupedStates()', () => { - it('should set an array of groupedStates with the aditionof a name translation', () => { + it('should set an array of groupedStates with the adition of a name translation', () => { jest.spyOn(controller, '$t').mockReturnValue('miCodigo'); const data = [ { @@ -34,8 +34,30 @@ describe('Ticket Component vnTicketSearchPanel', () => { }); }); + describe('from() setter', () => { + it('should clear the scope days when setting the from property', () => { + controller.filter.scopeDays = 1; + + controller.from = new Date(); + + expect(controller.filter.scopeDays).toBeNull(); + expect(controller.from).toBeDefined(); + }); + }); + + describe('to() setter', () => { + it('should clear the scope days when setting the to property', () => { + controller.filter.scopeDays = 1; + + controller.to = new Date(); + + expect(controller.filter.scopeDays).toBeNull(); + expect(controller.to).toBeDefined(); + }); + }); + describe('scopeDays() setter', () => { - it('should clear the date range', () => { + it('should clear the date range when setting the scopeDays property', () => { controller.filter.from = new Date(); controller.filter.to = new Date(); @@ -43,6 +65,7 @@ describe('Ticket Component vnTicketSearchPanel', () => { expect(controller.filter.from).toBeNull(); expect(controller.filter.to).toBeNull(); + expect(controller.scopeDays).toBeDefined(); }); }); }); diff --git a/modules/ticket/front/search-panel/style.scss b/modules/ticket/front/search-panel/style.scss deleted file mode 100644 index d90c66251..000000000 --- a/modules/ticket/front/search-panel/style.scss +++ /dev/null @@ -1,31 +0,0 @@ -@import "./effects"; -@import "./variables"; - - -form#ticket-form { - padding: 0 -} - -.scope-days { - border: $border-thin-light; - border-radius: 5px; - position: relative; - text-align: right; - - & > p { - font-size: 1.2rem; - margin: 3px; - } - - .or { - font-weight: bold; - font-size: 26px; - color: $color-font-secondary - } - - vn-icon[icon="info"] { - position: absolute; - top: 2px; - right: 2px - } -} \ No newline at end of file