agency descriptor update and remove zone

This commit is contained in:
Joan 2018-12-04 14:38:56 +01:00
parent 40ac2f18fc
commit 508534d2fd
9 changed files with 72 additions and 40 deletions

View File

@ -27,30 +27,26 @@
{ {
"url": "/:id", "url": "/:id",
"state": "zone.card", "state": "zone.card",
"component": "vn-zone-card" "component": "vn-zone-card",
"abstract": true,
"description": "Detail"
}, },
{ {
"url": "/basic-data", "url": "/location",
"state": "zone.card.basicData", "state": "zone.card.location",
"component": "vn-zone-basic-data", "component": "vn-zone-location",
"description": "Basic data", "description": "Location",
"params": { "params": {
"zone": "$ctrl.zone" "zone": "$ctrl.zone"
},
"menu": {
"icon": "settings"
} }
}, },
{ {
"url": "/delivery-day", "url": "/edit",
"state": "zone.card.deliveryDay", "state": "zone.card.edit",
"component": "vn-zone-delivery-day", "component": "vn-zone-edit",
"description": "Delivery days", "description": "Edit zone",
"params": { "params": {
"zone": "$ctrl.zone" "zone": "$ctrl.zone"
},
"menu": {
"icon": "today"
} }
} }
], ],

View File

@ -2,9 +2,7 @@
<vn-vertical margin-medium> <vn-vertical margin-medium>
<vn-zone-descriptor zone="$ctrl.zone"></vn-zone-descriptor> <vn-zone-descriptor zone="$ctrl.zone"></vn-zone-descriptor>
<vn-horizontal> <vn-horizontal>
<vn-one> <vn-one ui-view></vn-one>
<vn-zone-location zone="$ctrl.zone"></vn-zone-location>
</vn-one>
<vn-auto class="right-block"> <vn-auto class="right-block">
<vn-zone-calendar zone="$ctrl.zone"></vn-zone-calendar> <vn-zone-calendar zone="$ctrl.zone"></vn-zone-calendar>
</vn-auto> </vn-auto>

View File

@ -11,38 +11,44 @@
value-field="callback" value-field="callback"
translate-fields="['name']" translate-fields="['name']"
data="$ctrl.moreOptions" data="$ctrl.moreOptions"
on-change="$ctrl.onMoreChange(value)" on-change="$ctrl.onMoreChange(value)">
on-open="$ctrl.onMoreOpen()">
</vn-icon-menu> </vn-icon-menu>
</vn-horizontal> </vn-horizontal>
<vn-horizontal pad-medium> <vn-horizontal pad-medium>
<vn-one> <vn-one>
<vn-label-value label="Id" <vn-label-value label="Id"
value="{{$ctrl.zone.id}}"> value="{{::$ctrl.zone.id}}">
</vn-label-value> </vn-label-value>
<vn-label-value label="Name" <vn-label-value label="Name"
value="{{$ctrl.zone.name}}"> value="{{::$ctrl.zone.name}}">
</vn-label-value> </vn-label-value>
<vn-label-value label="Warehouse" <vn-label-value label="Warehouse"
value="{{$ctrl.zone.warehouse.name}}"> value="{{::$ctrl.zone.warehouse.name}}">
</vn-label-value> </vn-label-value>
<vn-label-value label="Agency" <vn-label-value label="Agency"
value="{{$ctrl.zone.agencyMode.name}}"> value="{{::$ctrl.zone.agencyMode.name}}">
</vn-label-value> </vn-label-value>
</vn-one> </vn-one>
<vn-one> <vn-one>
<vn-label-value label="Estimated hour (ETD)" <vn-label-value label="Estimated hour (ETD)"
value="{{$ctrl.zone.hour | date: 'HH:mm'}}"> value="{{::$ctrl.zone.hour | date: 'HH:mm'}}">
</vn-label-value> </vn-label-value>
<vn-label-value label="Traveling days" <vn-label-value label="Traveling days"
value="{{$ctrl.zone.travelingDays}}"> value="{{::$ctrl.zone.travelingDays}}">
</vn-label-value> </vn-label-value>
<vn-label-value label="Price" <vn-label-value label="Price"
value="{{$ctrl.zone.price | currency: '€': 2}}"> value="{{::$ctrl.zone.price | currency: '€': 2}}">
</vn-label-value> </vn-label-value>
<vn-label-value label="Bonus" <vn-label-value label="Bonus"
value="{{$ctrl.zone.price | currency: '€': 2}}"> value="{{::$ctrl.zone.price | currency: '€': 2}}">
</vn-label-value> </vn-label-value>
</vn-one> </vn-one>
</vn-horizontal> </vn-horizontal>
</vn-card> </vn-card>
<vn-confirm
vn-id="delete-zone"
on-response="$ctrl.returnDialog(response)"
question="Delete zone"
message="Are you sure you want to delete this zone?">
</vn-confirm>

View File

@ -1,14 +1,39 @@
import ngModule from '../module'; import ngModule from '../module';
class Controller { class Controller {
constructor() { constructor($scope, $state, $http) {
this.$scope = $scope;
this.$state = $state;
this.$http = $http;
this.moreOptions = [ this.moreOptions = [
{callback: this.showAddTurnDialog, name: 'Settings'}, {callback: this.editZone, name: 'Settings'},
{callback: this.showDeleteTicketDialog, name: 'Delete'} {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', { ngModule.component('vnZoneDescriptor', {
template: require('./index.html'), template: require('./index.html'),
controller: Controller, controller: Controller,

View File

@ -7,7 +7,7 @@
</vn-watcher> </vn-watcher>
<form name="form" ng-submit="$ctrl.onSubmit()"> <form name="form" ng-submit="$ctrl.onSubmit()">
<vn-card pad-large> <vn-card pad-large>
<vn-title>Basic data</vn-title> <vn-title>Edit zone</vn-title>
<vn-horizontal> <vn-horizontal>
<vn-textfield vn-two vn-focus <vn-textfield vn-two vn-focus
label="Name" label="Name"
@ -63,5 +63,6 @@
</vn-card> </vn-card>
<vn-button-bar> <vn-button-bar>
<vn-submit label="Save"></vn-submit> <vn-submit label="Save"></vn-submit>
<vn-button ui-sref="zone.card.location" label="Cancel"></vn-button>
</vn-button-bar> </vn-button-bar>
</form> </form>

View File

@ -1,20 +1,22 @@
import ngModule from '../module'; import ngModule from '../module';
class Controller { class Controller {
constructor($scope) { constructor($scope, $state) {
this.$scope = $scope; this.$scope = $scope;
this.$state = $state;
} }
onSubmit() { onSubmit() {
this.$scope.watcher.submit().then(() => { this.$scope.watcher.submit().then(() => {
this.$state.go('zone.card.location');
this.card.reload(); this.card.reload();
}); });
} }
} }
Controller.$inject = ['$scope']; Controller.$inject = ['$scope', '$state'];
ngModule.component('vnZoneBasicData', { ngModule.component('vnZoneEdit', {
template: require('./index.html'), template: require('./index.html'),
controller: Controller, controller: Controller,
bindings: { bindings: {

View File

@ -7,6 +7,6 @@ import './card';
import './descriptor'; import './descriptor';
import './search-panel'; import './search-panel';
import './create'; import './create';
import './basic-data'; import './edit';
import './location'; import './location';
import './calendar'; import './calendar';

View File

@ -31,7 +31,7 @@
</vn-tr> </vn-tr>
</vn-thead> </vn-thead>
<vn-tbody> <vn-tbody>
<vn-tr ng-repeat="zone in zones" ui-sref="zone.card.basicData({id: zone.id})" class=clickable> <vn-tr ng-repeat="zone in zones" ui-sref="zone.card.location({id: zone.id})" class=clickable>
<vn-td number>{{::zone.id}}</vn-td> <vn-td number>{{::zone.id}}</vn-td>
<vn-td>{{::zone.name}}</vn-td> <vn-td>{{::zone.name}}</vn-td>
<vn-td>{{::zone.agencyMode.name}}</vn-td> <vn-td>{{::zone.agencyMode.name}}</vn-td>

View File

@ -4,11 +4,15 @@ Warehouse: Almacén
Hour: Hora (ETD) Hour: Hora (ETD)
Price: Precio Price: Precio
Create: Crear Create: Crear
Delete: Eliminar
Settings: Ajustes
Delivery days: Días de envío
Enter a new search: Introduce una nueva búsqueda 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 Zones: Zonas
List: Listado List: Listado
Summary: Vista previa Summary: Vista previa
New zone: Nueva zona New zone: Nueva zona
Basic data: Datos básicos Edit zone: Editar zona
Delivery days: Días de envío