From 508534d2fd62504eda98c55d6a9cf1ddd4fea2e7 Mon Sep 17 00:00:00 2001 From: Joan Date: Tue, 4 Dec 2018 14:38:56 +0100 Subject: [PATCH] agency descriptor update and remove zone --- client/agency/routes.json | 26 +++++++--------- client/agency/src/card/index.html | 4 +-- client/agency/src/descriptor/index.html | 28 ++++++++++------- client/agency/src/descriptor/index.js | 31 +++++++++++++++++-- .../src/{basic-data => edit}/index.html | 3 +- .../agency/src/{basic-data => edit}/index.js | 8 +++-- client/agency/src/index.js | 2 +- client/agency/src/index/index.html | 2 +- client/agency/src/locale/es.yml | 8 +++-- 9 files changed, 72 insertions(+), 40 deletions(-) rename client/agency/src/{basic-data => edit}/index.html (94%) rename client/agency/src/{basic-data => edit}/index.js (66%) diff --git a/client/agency/routes.json b/client/agency/routes.json index 7d33dddb9..b33c81fba 100644 --- a/client/agency/routes.json +++ b/client/agency/routes.json @@ -27,30 +27,26 @@ { "url": "/:id", "state": "zone.card", - "component": "vn-zone-card" + "component": "vn-zone-card", + "abstract": true, + "description": "Detail" }, { - "url": "/basic-data", - "state": "zone.card.basicData", - "component": "vn-zone-basic-data", - "description": "Basic data", + "url": "/location", + "state": "zone.card.location", + "component": "vn-zone-location", + "description": "Location", "params": { "zone": "$ctrl.zone" - }, - "menu": { - "icon": "settings" } }, { - "url": "/delivery-day", - "state": "zone.card.deliveryDay", - "component": "vn-zone-delivery-day", - "description": "Delivery days", + "url": "/edit", + "state": "zone.card.edit", + "component": "vn-zone-edit", + "description": "Edit zone", "params": { "zone": "$ctrl.zone" - }, - "menu": { - "icon": "today" } } ], diff --git a/client/agency/src/card/index.html b/client/agency/src/card/index.html index f0cace121..3b38cfc55 100644 --- a/client/agency/src/card/index.html +++ b/client/agency/src/card/index.html @@ -2,9 +2,7 @@ - - - + diff --git a/client/agency/src/descriptor/index.html b/client/agency/src/descriptor/index.html index abd1e34f7..011e3c2d9 100644 --- a/client/agency/src/descriptor/index.html +++ b/client/agency/src/descriptor/index.html @@ -11,38 +11,44 @@ value-field="callback" translate-fields="['name']" data="$ctrl.moreOptions" - on-change="$ctrl.onMoreChange(value)" - on-open="$ctrl.onMoreOpen()"> + on-change="$ctrl.onMoreChange(value)"> + value="{{::$ctrl.zone.id}}"> + value="{{::$ctrl.zone.name}}"> + value="{{::$ctrl.zone.warehouse.name}}"> + value="{{::$ctrl.zone.agencyMode.name}}"> + value="{{::$ctrl.zone.hour | date: 'HH:mm'}}"> - + value="{{::$ctrl.zone.travelingDays}}"> + + value="{{::$ctrl.zone.price | currency: '€': 2}}"> + value="{{::$ctrl.zone.price | currency: '€': 2}}"> + + + \ No newline at end of file diff --git a/client/agency/src/descriptor/index.js b/client/agency/src/descriptor/index.js index 98dc4b0df..b1a0523c7 100644 --- a/client/agency/src/descriptor/index.js +++ b/client/agency/src/descriptor/index.js @@ -1,14 +1,39 @@ import ngModule from '../module'; class Controller { - constructor() { + constructor($scope, $state, $http) { + this.$scope = $scope; + this.$state = $state; + this.$http = $http; this.moreOptions = [ - {callback: this.showAddTurnDialog, name: 'Settings'}, - {callback: this.showDeleteTicketDialog, name: 'Delete'} + {callback: this.editZone, name: 'Settings'}, + {callback: this.deleteZone, name: 'Delete'} ]; } + + onMoreChange(callback) { + callback.call(this); + } + + deleteZone() { + this.$scope.deleteZone.show(); + } + + editZone() { + this.$state.go('zone.card.edit', {zone: this.zone}); + } + + returnDialog(response) { + if (response === 'ACCEPT') { + this.$http.delete(`/agency/api/Zones/${this.zone.id}`).then(() => { + this.$state.go('zone.index'); + }); + } + } } +Controller.$inject = ['$scope', '$state', '$http']; + ngModule.component('vnZoneDescriptor', { template: require('./index.html'), controller: Controller, diff --git a/client/agency/src/basic-data/index.html b/client/agency/src/edit/index.html similarity index 94% rename from client/agency/src/basic-data/index.html rename to client/agency/src/edit/index.html index 4a2e03075..09cbc568d 100644 --- a/client/agency/src/basic-data/index.html +++ b/client/agency/src/edit/index.html @@ -7,7 +7,7 @@
- Basic data + Edit zone + diff --git a/client/agency/src/basic-data/index.js b/client/agency/src/edit/index.js similarity index 66% rename from client/agency/src/basic-data/index.js rename to client/agency/src/edit/index.js index cad11e285..3ff19fb1d 100644 --- a/client/agency/src/basic-data/index.js +++ b/client/agency/src/edit/index.js @@ -1,20 +1,22 @@ import ngModule from '../module'; class Controller { - constructor($scope) { + constructor($scope, $state) { this.$scope = $scope; + this.$state = $state; } onSubmit() { this.$scope.watcher.submit().then(() => { + this.$state.go('zone.card.location'); this.card.reload(); }); } } -Controller.$inject = ['$scope']; +Controller.$inject = ['$scope', '$state']; -ngModule.component('vnZoneBasicData', { +ngModule.component('vnZoneEdit', { template: require('./index.html'), controller: Controller, bindings: { diff --git a/client/agency/src/index.js b/client/agency/src/index.js index c8cd6a0e7..78336e6ee 100644 --- a/client/agency/src/index.js +++ b/client/agency/src/index.js @@ -7,6 +7,6 @@ import './card'; import './descriptor'; import './search-panel'; import './create'; -import './basic-data'; +import './edit'; import './location'; import './calendar'; diff --git a/client/agency/src/index/index.html b/client/agency/src/index/index.html index d58a9b457..a6b0e74e0 100644 --- a/client/agency/src/index/index.html +++ b/client/agency/src/index/index.html @@ -31,7 +31,7 @@ - + {{::zone.id}} {{::zone.name}} {{::zone.agencyMode.name}} diff --git a/client/agency/src/locale/es.yml b/client/agency/src/locale/es.yml index 40deb104d..58f0ef81e 100644 --- a/client/agency/src/locale/es.yml +++ b/client/agency/src/locale/es.yml @@ -4,11 +4,15 @@ Warehouse: Almacén Hour: Hora (ETD) Price: Precio Create: Crear +Delete: Eliminar +Settings: Ajustes +Delivery days: Días de envío Enter a new search: Introduce una nueva búsqueda +Delete zone: Eliminar zona +Are you sure you want to delete this zone?: ¿Estás seguro de querer eliminar esta zona? Zones: Zonas List: Listado Summary: Vista previa New zone: Nueva zona -Basic data: Datos básicos -Delivery days: Días de envío \ No newline at end of file +Edit zone: Editar zona \ No newline at end of file