diff --git a/modules/order/front/routes.json b/modules/order/front/routes.json index 7ebba32c7..c22ff24d1 100644 --- a/modules/order/front/routes.json +++ b/modules/order/front/routes.json @@ -22,17 +22,20 @@ "abstract": true, "component": "vn-order", "description": "Orders" - }, { + }, + { "url": "/index?q", "state": "order.index", "component": "vn-order-index", "description": "Orders" - }, { + }, + { "url": "/:id", "state": "order.card", "abstract": true, "component": "vn-order-card" - }, { + }, + { "url": "/summary", "state": "order.card.summary", "component": "vn-order-summary", @@ -40,7 +43,8 @@ "params": { "order": "$ctrl.order" } - }, { + }, + { "url": "/catalog?q&categoryId&typeId&tagGroups", "state": "order.card.catalog", "component": "vn-order-catalog", @@ -48,7 +52,8 @@ "params": { "order": "$ctrl.order" } - }, { + }, + { "url": "/volume", "state": "order.card.volume", "component": "vn-order-volume", @@ -56,7 +61,8 @@ "params": { "order": "$ctrl.order" } - }, { + }, + { "url": "/line", "state": "order.card.line", "component": "vn-order-line", @@ -64,12 +70,14 @@ "params": { "order": "$ctrl.order" } - }, { + }, + { "url": "/create?clientFk", "state": "order.create", "component": "vn-order-create", "description": "New order" - }, { + }, + { "url": "/basic-data", "state": "order.card.basicData", "component": "vn-order-basic-data", diff --git a/modules/zone/front/delivery-days/index.html b/modules/zone/front/delivery-days/index.html index 61c73c9d6..79ec5c2b1 100644 --- a/modules/zone/front/delivery-days/index.html +++ b/modules/zone/front/delivery-days/index.html @@ -5,24 +5,28 @@ -
+ + ng-model="$ctrl.deliveryMethodFk" + on-change="$ctrl.agencyModeFk = null" + tabindex="-1"> + on-change="$ctrl.agencyModeFk = null" + class="vn-mb-sm" + tabindex="-1"> diff --git a/modules/zone/front/delivery-days/index.js b/modules/zone/front/delivery-days/index.js index 408c77be2..0c6fdffb7 100644 --- a/modules/zone/front/delivery-days/index.js +++ b/modules/zone/front/delivery-days/index.js @@ -4,20 +4,44 @@ import './style.scss'; class Controller extends Section { $onInit() { - this.$.params = {}; + this.setParams(); } $postLink() { this.deliveryMethodFk = 'delivery'; } - onSubmit() { + + setParams() { + const hasParams = this.$params.deliveryMethodFk || this.$params.geoFk || this.$params.agencyModeFk; + if (hasParams) { + if (this.$params.deliveryMethodFk) + this.deliveryMethodFk = this.$params.deliveryMethodFk; + + if (this.$params.geoFk) + this.geoFk = this.$params.geoFk; + + if (this.$params.agencyModeFk) + this.agencyModeFk = this.$params.agencyModeFk; + + this.fetchData(); + } + } + + fetchData() { + const params = { + deliveryMethodFk: this.deliveryMethodFk, + geoFk: this.geoFk, + agencyModeFk: this.agencyModeFk + }; this.$.data = null; - this.$http.get(`Zones/getEvents`, {params: this.$.params}) + this.$http.get(`Zones/getEvents`, {params}) .then(res => { let data = res.data; this.$.data = data; if (!data.events.length) this.vnApp.showMessage(this.$t('No service for the specified zone')); + + this.$state.go(this.$state.current.name, params); }); } @@ -27,16 +51,16 @@ class Controller extends Section { set deliveryMethodFk(value) { this._deliveryMethodFk = value; - this.$.params.agencyModeFk = null; + let filter; - if (value === 'pickUp') { + + if (value === 'pickUp') filter = {where: {code: 'PICKUP'}}; - this.$.agencymode.focus(); - } else + else filter = {where: {code: {inq: ['DELIVERY', 'AGENCY']}}}; this.$http.get(`DeliveryMethods`, {filter}).then(res => { - let deliveryMethods = res.data.map(deliveryMethod => deliveryMethod.id); + const deliveryMethods = res.data.map(deliveryMethod => deliveryMethod.id); this.agencyFilter = {deliveryMethodFk: {inq: deliveryMethods}}; }); } diff --git a/modules/zone/front/routes.json b/modules/zone/front/routes.json index a0692cc3d..e08f97314 100644 --- a/modules/zone/front/routes.json +++ b/modules/zone/front/routes.json @@ -28,33 +28,39 @@ "abstract": true, "component": "vn-zone", "description": "Zones" - }, { + }, + { "url": "/index?q", "state": "zone.index", "component": "vn-zone-index", "description": "Zones" - }, { - "url": "/delivery-days?q", + }, + { + "url": "/delivery-days?q&deliveryMethodFk&geoFk&agencyModeFk", "state": "zone.deliveryDays", "component": "vn-zone-delivery-days", "description": "Delivery days" - }, { + }, + { "url": "/upcoming-deliveries", "state": "zone.upcomingDeliveries", "component": "vn-upcoming-deliveries", "description": "Upcoming deliveries" - }, { + }, + { "url": "/create", "state": "zone.create", "component": "vn-zone-create", "description": "New zone" - }, { + }, + { "url": "/:id", "state": "zone.card", "component": "vn-zone-card", "abstract": true, "description": "Detail" - }, { + }, + { "url": "/summary", "state": "zone.card.summary", "component": "vn-zone-summary", @@ -62,7 +68,8 @@ "params": { "zone": "$ctrl.zone" } - }, { + }, + { "url": "/basic-data", "state": "zone.card.basicData", "component": "vn-zone-basic-data", @@ -70,17 +77,20 @@ "params": { "zone": "$ctrl.zone" } - }, { + }, + { "url": "/warehouses", "state": "zone.card.warehouses", "component": "vn-zone-warehouses", "description": "Warehouses" - }, { + }, + { "url": "/events", "state": "zone.card.events", "component": "vn-zone-events", "description": "Calendar" - }, { + }, + { "url": "/location?q", "state": "zone.card.location", "component": "vn-zone-location", @@ -88,7 +98,8 @@ "params": { "zone": "$ctrl.zone" } - }, { + }, + { "url" : "/log", "state": "zone.card.log", "component": "vn-zone-log",