From b9e3db61dbcd876b92835c428558c62b15cba433 Mon Sep 17 00:00:00 2001 From: carlosjr Date: Thu, 12 Nov 2020 13:33:33 +0100 Subject: [PATCH 1/2] ticket advanced search grouped state translations --- modules/ticket/front/search-panel/index.html | 12 ++++--- modules/ticket/front/search-panel/index.js | 22 +++++++++++- .../ticket/front/search-panel/index.spec.js | 35 +++++++++++++++++++ .../ticket/front/search-panel/locale/en.yml | 4 +++ .../ticket/front/search-panel/locale/es.yml | 6 +++- 5 files changed, 72 insertions(+), 7 deletions(-) create mode 100644 modules/ticket/front/search-panel/index.spec.js create mode 100644 modules/ticket/front/search-panel/locale/en.yml diff --git a/modules/ticket/front/search-panel/index.html b/modules/ticket/front/search-panel/index.html index 50bc42d46..8570036c0 100644 --- a/modules/ticket/front/search-panel/index.html +++ b/modules/ticket/front/search-panel/index.html @@ -76,13 +76,15 @@ ng-model="filter.stateFk" url="States"> - + show-field="name" + ng-model="filter.alertLevel"> + + {{name}} + diff --git a/modules/ticket/front/search-panel/index.js b/modules/ticket/front/search-panel/index.js index 22093784a..08b0fb244 100644 --- a/modules/ticket/front/search-panel/index.js +++ b/modules/ticket/front/search-panel/index.js @@ -1,7 +1,27 @@ import ngModule from '../module'; import SearchPanel from 'core/components/searchbar/search-panel'; +class Controller extends SearchPanel { + constructor($, $element) { + super($, $element); + this.getGroupedStates(); + } + + getGroupedStates() { + let groupedStates = []; + this.$http.get('AlertLevels').then(res => { + for (let state of res.data) { + groupedStates.push({ + alertLevel: state.alertLevel, + code: state.code, + name: this.$t(state.code) + }); + } + this.groupedStates = groupedStates; + }); + } +} ngModule.vnComponent('vnTicketSearchPanel', { template: require('./index.html'), - controller: SearchPanel + controller: Controller }); diff --git a/modules/ticket/front/search-panel/index.spec.js b/modules/ticket/front/search-panel/index.spec.js new file mode 100644 index 000000000..55d341d2a --- /dev/null +++ b/modules/ticket/front/search-panel/index.spec.js @@ -0,0 +1,35 @@ +import './index'; + +describe('Ticket Component vnTicketSearchPanel', () => { + let $httpBackend; + let controller; + + beforeEach(ngModule('ticket')); + + beforeEach(inject(($componentController, _$httpBackend_) => { + $httpBackend = _$httpBackend_; + controller = $componentController('vnTicketSearchPanel', {$element: null}); + controller.$t = () => {}; + })); + + describe('getGroupedStates()', () => { + it('should set an array of groupedStates with the aditionof a name translation', () => { + jest.spyOn(controller, '$t').mockReturnValue('miCodigo'); + const data = [ + { + alertLevel: 9999, + code: 'myCode' + } + ]; + $httpBackend.whenGET('AlertLevels').respond(data); + controller.getGroupedStates(); + $httpBackend.flush(); + + expect(controller.groupedStates).toEqual([{ + alertLevel: 9999, + code: 'myCode', + name: 'miCodigo' + }]); + }); + }); +}); diff --git a/modules/ticket/front/search-panel/locale/en.yml b/modules/ticket/front/search-panel/locale/en.yml new file mode 100644 index 000000000..21ba978db --- /dev/null +++ b/modules/ticket/front/search-panel/locale/en.yml @@ -0,0 +1,4 @@ +FREE: Free +DELIVERED: Delivered +ON_PREPARATION: On preparation +PACKED: Packed \ No newline at end of file diff --git a/modules/ticket/front/search-panel/locale/es.yml b/modules/ticket/front/search-panel/locale/es.yml index 0e338ab0b..5fa75ac09 100644 --- a/modules/ticket/front/search-panel/locale/es.yml +++ b/modules/ticket/front/search-panel/locale/es.yml @@ -12,4 +12,8 @@ Order id: Id cesta Grouped States: Estado agrupado Days onward: Días adelante With problems: Con problemas -Pending: Pendiente \ No newline at end of file +Pending: Pendiente +FREE: Libre +DELIVERED: Servido +ON_PREPARATION: En preparacion +PACKED: Encajado \ No newline at end of file -- 2.40.1 From 7f899cc4e95c74def98e4700e306d10bcf85ddea Mon Sep 17 00:00:00 2001 From: carlosjr Date: Thu, 12 Nov 2020 16:03:23 +0100 Subject: [PATCH 2/2] index navigation through anchors --- e2e/helpers/selectors.js | 2 +- modules/order/front/index/index.html | 6 +- modules/supplier/front/index/index.html | 108 ++++++++++++------------ modules/zone/front/index/index.html | 6 +- 4 files changed, 61 insertions(+), 61 deletions(-) diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index b94fbd221..ffcff8734 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -613,7 +613,7 @@ export default { isPaidWithManaCheckbox: 'vn-claim-action vn-check[ng-model="$ctrl.claim.isChargedToMana"]' }, ordersIndex: { - secondSearchResultTotal: 'vn-order-index vn-card > vn-table > div > vn-tbody vn-tr:nth-child(2) vn-td:nth-child(9)', + secondSearchResultTotal: 'vn-order-index vn-card > vn-table > div > vn-tbody .vn-tr:nth-child(2) vn-td:nth-child(9)', advancedSearchButton: 'vn-order-search-panel vn-submit[label="Search"]', openAdvancedSearch: 'vn-searchbar vn-icon[icon="arrow_drop_down"]', advancedSearchShowEmptyCheckbox: 'vn-order-search-panel vn-check[label="Show empty"]', diff --git a/modules/order/front/index/index.html b/modules/order/front/index/index.html index 0ef698855..07667f58f 100644 --- a/modules/order/front/index/index.html +++ b/modules/order/front/index/index.html @@ -21,9 +21,9 @@ - {{::order.id}} @@ -62,7 +62,7 @@ vn-tooltip="Preview"> - + diff --git a/modules/supplier/front/index/index.html b/modules/supplier/front/index/index.html index 9c4dd21d2..07e10cd84 100644 --- a/modules/supplier/front/index/index.html +++ b/modules/supplier/front/index/index.html @@ -1,61 +1,61 @@ + model="model"> - - - + model="model" + class="vn-w-sm"> + + + - - + + \ No newline at end of file diff --git a/modules/zone/front/index/index.html b/modules/zone/front/index/index.html index 55760d770..7f2540cb7 100644 --- a/modules/zone/front/index/index.html +++ b/modules/zone/front/index/index.html @@ -17,10 +17,10 @@ - + class="clickable n-tr search-result"> {{::zone.id}} {{::zone.name}} {{::zone.agencyMode.name}} @@ -42,7 +42,7 @@ - + -- 2.40.1