-
-
-
-
-
-
-
-
-
-
-
- {{name}}
-
- {{categoryName}}
-
-
-
-
-
-
-
-
-
-
- More than {{model.limit}} results
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{category.selection.name}}
-
-
- {{type.selection.name}}
-
-
- {{::tag.value}}
-
-
-
\ No newline at end of file
diff --git a/modules/order/front/filter/index.js b/modules/order/front/filter/index.js
deleted file mode 100644
index ba563d05cb..0000000000
--- a/modules/order/front/filter/index.js
+++ /dev/null
@@ -1,175 +0,0 @@
-import ngModule from '../module';
-import './style.scss';
-
-class Controller {
- constructor($element, $http, $scope, $state, $compile, $transitions) {
- this.$element = $element;
- this.$http = $http;
- this.$ = $scope;
- this.$state = $state;
- this.$stateParams = $state.params;
- this.$compile = $compile;
- this.$transitions = $transitions;
- this.itemTypes = [];
- this.tags = [];
- }
-
- get order() {
- return this._order;
- }
-
- /**
- * Sets filter values from state params
- *
- * @param {Object} value - Order data
- */
- set order(value) {
- this._order = value;
-
- if (!value) return;
-
- this.$.$applyAsync(() => {
- if (this.$stateParams.categoryId)
- this.categoryId = this.$stateParams.categoryId;
-
- if (this.$stateParams.typeId)
- this.typeId = this.$stateParams.typeId;
- });
- }
-
- get categoryId() {
- return this._categoryId;
- }
-
- set categoryId(value) {
- if (!value || (this.categoryId == value))
- value = null;
-
- this._categoryId = value;
- this.itemTypes = [];
- this.typeId = null;
-
- this.updateStateParams();
-
- if (this.tags.length > 0)
- this.applyFilters();
-
- if (value)
- this.updateItemTypes();
- }
-
- get typeId() {
- return this._typeId;
- }
-
- set typeId(value) {
- this._typeId = value;
-
- this.updateStateParams();
-
- if ((value) || this.tags.length > 0)
- this.applyFilters();
- }
-
- /**
- * Refreshes item type dropdown data
- */
- updateItemTypes() {
- let params = {
- itemCategoryId: this.categoryId
- };
-
- const query = `Orders/${this.order.id}/getItemTypeAvailable`;
- this.$http.get(query, {params}).then(res =>
- this.itemTypes = res.data);
- }
-
- onSearchById(event) {
- const hasValue = this.tags.length > 0 || this.itemId || this.typeId;
- if (event.key === 'Enter' && hasValue)
- this.applyFilters();
- }
-
- onSearchByTag(event) {
- if (event.key !== 'Enter' || !this.value) return;
- this.tags.push({
- value: this.value,
- });
- this.$.search.value = null;
- this.applyFilters();
- }
-
- remove(index) {
- this.tags.splice(index, 1);
-
- if (this.tags.length >= 0 || this.itemId || this.typeId)
- this.applyFilters();
- }
-
- applyFilters() {
- let newParams = {};
- let newFilter = {};
- const model = this.catalog.$scope.model;
-
- if (this.categoryId)
- newFilter.categoryFk = this.categoryId;
-
- if (this.typeId)
- newFilter.typeFk = this.typeId;
-
- if (this.itemId)
- newFilter = {'i.id': this.itemId};
-
- newParams = {
- orderFk: this.order.id,
- orderBy: this.catalog.getOrderBy(),
- tags: this.tags,
- };
-
- model.applyFilter({where: newFilter}, newParams);
- }
-
- openPanel(event) {
- if (event.defaultPrevented) return;
- event.preventDefault();
-
- this.panelFilter = {};
- this.$.popover.show(this.$.search.element);
- }
-
- onPanelSubmit(filter) {
- this.$.popover.hide();
- this.tags.push(filter);
- this.applyFilters();
- }
-
- /**
- * Updates url state params from filter values
- */
- updateStateParams() {
- const params = {};
-
- if (this.categoryId)
- params.categoryId = this.categoryId;
- else params.categoryId = undefined;
-
- if (this.typeId)
- params.typeId = this.typeId;
- else params.typeId = undefined;
-
- this.$state.go(this.$state.current.name, params);
- }
-}
-
-Controller.$inject = ['$element', '$http', '$scope', '$state', '$compile', '$transitions'];
-
-ngModule.component('vnCatalogFilter', {
- template: require('./index.html'),
- controller: Controller,
- require: {
- catalog: '^vnOrderCatalog'
- },
- bindings: {
- order: '<'
- }
-});
diff --git a/modules/order/front/filter/index.spec.js b/modules/order/front/filter/index.spec.js
deleted file mode 100644
index 72a0f206bc..0000000000
--- a/modules/order/front/filter/index.spec.js
+++ /dev/null
@@ -1,172 +0,0 @@
-import './index.js';
-import crudModel from 'core/mocks/crud-model';
-
-describe('Order', () => {
- describe('Component vnCatalogFilter', () => {
- let $scope;
- let $state;
- let controller;
- let $httpBackend;
-
- beforeEach(ngModule('order'));
-
- beforeEach(angular.mock.inject(($componentController, _$state_, _$httpBackend_, $rootScope) => {
- $httpBackend = _$httpBackend_;
- $scope = $rootScope.$new();
- $scope.model = crudModel;
- $scope.search = {};
- $state = _$state_;
- $state.params.categoryId = 1;
- $state.params.typeId = 2;
- $state.current.name = 'my.current.state';
- controller = $componentController('vnCatalogFilter', {$element: null, $scope, $state});
- controller.catalog = {
- $scope: $scope,
- getOrderBy: () => {
- return {field: 'relevancy DESC, name', way: 'DESC'};
- }
- };
- }));
-
- describe('order() setter', () => {
- it(`should call scope $applyAsync() method and apply filters from state params`, () => {
- $httpBackend.expect('GET', `Orders/4/getItemTypeAvailable?itemCategoryId=1`).respond();
- controller.order = {id: 4};
-
- $scope.$apply();
-
- expect(controller.categoryId).toEqual(1);
- expect(controller.typeId).toEqual(2);
- });
- });
-
- describe('categoryId() setter', () => {
- it(`should set category property to null, call updateStateParams() method and not call applyFilters()`, () => {
- spyOn(controller, 'updateStateParams');
- controller.categoryId = null;
-
- expect(controller.updateStateParams).toHaveBeenCalledWith();
- });
-
- it(`should set category property and then call updateStateParams() and applyFilters() methods`, () => {
- spyOn(controller, 'updateStateParams');
- controller._order = {id: 4};
- controller.categoryId = 2;
-
- expect(controller.updateStateParams).toHaveBeenCalledWith();
- });
- });
-
- describe('typeId() setter', () => {
- it(`should set type property to null, call updateStateParams() method and not call applyFilters()`, () => {
- spyOn(controller, 'updateStateParams');
- spyOn(controller, 'applyFilters');
- controller.typeId = null;
-
- expect(controller.updateStateParams).toHaveBeenCalledWith();
- expect(controller.applyFilters).not.toHaveBeenCalledWith();
- });
-
- it(`should set category property and then call updateStateParams() and applyFilters() methods`, () => {
- spyOn(controller, 'updateStateParams');
- spyOn(controller, 'applyFilters');
- controller.typeId = 2;
-
- expect(controller.updateStateParams).toHaveBeenCalledWith();
- expect(controller.applyFilters).toHaveBeenCalledWith();
- });
- });
-
- describe('onSearchByTag()', () => {
- it(`should not add a new tag if the event key code doesn't equals to 'Enter'`, () => {
- spyOn(controller, 'applyFilters');
- controller.order = {id: 4};
- controller.value = 'Color';
- controller.onSearchByTag({key: 'Tab'});
-
- expect(controller.applyFilters).not.toHaveBeenCalledWith();
- });
-
- it(`should add a new tag if the event key code equals to 'Enter' an then call applyFilters()`, () => {
- spyOn(controller, 'applyFilters');
- controller.order = {id: 4};
- controller.value = 'Color';
-
- controller.onSearchByTag({key: 'Enter'});
-
- expect(controller.applyFilters).toHaveBeenCalledWith();
- });
- });
-
- describe('onSearchById()', () => {
- it(`should not filter by id if the event key code doesn't equals to 'Enter'`, () => {
- spyOn(controller, 'applyFilters');
- controller.itemId = 1;
- controller.onSearchById({key: 'Tab'});
-
- expect(controller.applyFilters).not.toHaveBeenCalledWith();
- });
-
- it(`should filter by id if the event key code equals to 'Enter' an then call applyFilters()`, () => {
- spyOn(controller, 'applyFilters');
- controller.itemId = 1;
-
- controller.onSearchById({key: 'Enter'});
-
- expect(controller.applyFilters).toHaveBeenCalledWith();
- });
- });
-
- describe('applyFilters()', () => {
- it(`should call model applyFilter() method with a new filter`, () => {
- let model = controller.catalog.$scope.model;
- spyOn(model, 'applyFilter');
- controller._categoryId = 2;
- controller._typeId = 4;
- controller._order = {id: 4};
-
- controller.applyFilters();
-
- expect(model.applyFilter).toHaveBeenCalledWith(
- {where: {categoryFk: 2, typeFk: 4}},
- {orderFk: 4, orderBy: controller.catalog.getOrderBy(), tags: []});
- });
- });
-
- describe('remove()', () => {
- it(`should remove a tag from tags property`, () => {
- spyOn(controller, 'applyFilters');
- controller.tags = [{tagFk: 1, value: 'Blue'}, {tagFk: 2, value: '70'}];
- controller.remove(0);
-
- expect(controller.tags.length).toEqual(1);
- expect(controller.tags[0].tagFk).toEqual(2);
- expect(controller.applyFilters).toHaveBeenCalledWith();
- });
-
- it(`should remove a tag from tags property and call applyFilters() if there's no more tags`, () => {
- spyOn(controller, 'applyFilters');
- controller._categoryId = 1;
- controller._typeId = 1;
- controller.tags = [{tagFk: 1, value: 'Blue'}];
- controller.remove(0);
-
- expect(controller.tags.length).toEqual(0);
- expect(controller.applyFilters).toHaveBeenCalledWith();
- });
- });
-
- describe('updateStateParams()', () => {
- it(`should call state go() method passing category and type state params`, () => {
- spyOn(controller.$state, 'go');
- controller._categoryId = 2;
- controller._typeId = 4;
- let result = {categoryId: 2, typeId: 4};
- controller.updateStateParams();
-
- expect(controller.$state.go).toHaveBeenCalledWith('my.current.state', result);
- });
- });
- });
-});
-
diff --git a/modules/order/front/filter/style.scss b/modules/order/front/filter/style.scss
deleted file mode 100644
index f4fe226f2e..0000000000
--- a/modules/order/front/filter/style.scss
+++ /dev/null
@@ -1,55 +0,0 @@
-@import "variables";
-@import "variables";
-
-vn-catalog-filter > div {
- & > .input {
- padding-left: $spacing-md;
- padding-right: $spacing-md;
- border-color: $color-spacer;
- border-bottom: $border-thin;
- }
- .item-category {
- padding: $spacing-sm;
- justify-content: flex-start;
- align-items: flex-start;
- flex-wrap: wrap;
-
- vn-autocomplete[vn-id="category"] {
- display: none
- }
-
- & > vn-one {
- padding: $spacing-sm;
- min-width: 33.33%;
- text-align: center;
- box-sizing: border-box;
-
- & > vn-icon {
- padding: $spacing-sm;
- background-color: $color-font-secondary;
- border-radius: 50%;
- cursor: pointer;
-
- &.active {
- background-color: $color-main;
- color: #FFF
- }
- & > i:before {
- font-size: 32pt;
- width: 1em;
- height: 1em;
- }
- }
- }
- }
- .chips {
- display: flex;
- flex-wrap: wrap;
- padding: $spacing-md;
- overflow: hidden;
- max-width: 100%;
- }
- vn-autocomplete[vn-id="type"] .list {
- max-height: 20em
- }
-}
\ No newline at end of file
diff --git a/modules/order/front/index.js b/modules/order/front/index.js
index 0d8d0d6861..4d5b5615ed 100644
--- a/modules/order/front/index.js
+++ b/modules/order/front/index.js
@@ -6,9 +6,9 @@ import './card';
import './descriptor';
import './search-panel';
import './catalog-search-panel';
-import './filter';
-import './summary';
+import './catalog-view';
import './catalog';
+import './summary';
import './line';
import './prices-popover';
import './volume';
diff --git a/modules/ticket/front/basic-data/step-one/index.html b/modules/ticket/front/basic-data/step-one/index.html
index ccdf8a15fb..0d2a7ecc65 100644
--- a/modules/ticket/front/basic-data/step-one/index.html
+++ b/modules/ticket/front/basic-data/step-one/index.html
@@ -32,6 +32,13 @@
, {{::street}}, {{::city}}, {{::province.name}} - {{::agencyMode.name}}
+