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",
"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"
}
}
],

View File

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

View File

@ -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)">
</vn-icon-menu>
</vn-horizontal>
<vn-horizontal pad-medium>
<vn-one>
<vn-label-value label="Id"
value="{{$ctrl.zone.id}}">
value="{{::$ctrl.zone.id}}">
</vn-label-value>
<vn-label-value label="Name"
value="{{$ctrl.zone.name}}">
value="{{::$ctrl.zone.name}}">
</vn-label-value>
<vn-label-value label="Warehouse"
value="{{$ctrl.zone.warehouse.name}}">
value="{{::$ctrl.zone.warehouse.name}}">
</vn-label-value>
<vn-label-value label="Agency"
value="{{$ctrl.zone.agencyMode.name}}">
value="{{::$ctrl.zone.agencyMode.name}}">
</vn-label-value>
</vn-one>
<vn-one>
<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 label="Traveling days"
value="{{$ctrl.zone.travelingDays}}">
</vn-label-value>
value="{{::$ctrl.zone.travelingDays}}">
</vn-label-value>
<vn-label-value label="Price"
value="{{$ctrl.zone.price | currency: '€': 2}}">
value="{{::$ctrl.zone.price | currency: '€': 2}}">
</vn-label-value>
<vn-label-value label="Bonus"
value="{{$ctrl.zone.price | currency: '€': 2}}">
value="{{::$ctrl.zone.price | currency: '€': 2}}">
</vn-label-value>
</vn-one>
</vn-horizontal>
</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';
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,

View File

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

View File

@ -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: {

View File

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

View File

@ -31,7 +31,7 @@
</vn-tr>
</vn-thead>
<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>{{::zone.name}}</vn-td>
<vn-td>{{::zone.agencyMode.name}}</vn-td>

View File

@ -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
Edit zone: Editar zona