Zone detail structure #898

This commit is contained in:
Joan 2018-12-04 13:18:27 +01:00
parent a72077e578
commit 40ac2f18fc
36 changed files with 171 additions and 163 deletions

View File

@ -27,18 +27,8 @@
{ {
"url": "/:id", "url": "/:id",
"state": "zone.card", "state": "zone.card",
"abstract": true,
"component": "vn-zone-card" "component": "vn-zone-card"
}, },
{
"url" : "/summary",
"state": "zone.card.summary",
"component": "vn-zone-summary",
"description": "Summary",
"params": {
"zone": "$ctrl.zone"
}
},
{ {
"url": "/basic-data", "url": "/basic-data",
"state": "zone.card.basicData", "state": "zone.card.basicData",
@ -64,8 +54,5 @@
} }
} }
], ],
"menu": [ "menu": []
{"state": "zone.card.basicData", "icon": "settings"},
{"state": "zone.card.deliveryDay", "icon": "today"}
]
} }

View File

@ -1,7 +1,6 @@
import ngModule from '../../module'; import ngModule from '../module';
class Controller { class Controller {
constructor($scope) { constructor($scope) {
this.$scope = $scope; this.$scope = $scope;
} }

View File

@ -1,4 +1,4 @@
import ngModule from '../../module'; import ngModule from '../module';
class Controller { class Controller {
constructor($scope) { constructor($scope) {
@ -18,9 +18,6 @@ Controller.$inject = ['$scope'];
ngModule.component('vnZoneCalendar', { ngModule.component('vnZoneCalendar', {
template: require('./index.html'), template: require('./index.html'),
controller: Controller, controller: Controller,
require: {
catalog: '^vnZoneDeliveryDay'
},
bindings: { bindings: {
zone: '<' zone: '<'
} }

View File

@ -0,0 +1,13 @@
<vn-main-block>
<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-auto class="right-block">
<vn-zone-calendar zone="$ctrl.zone"></vn-zone-calendar>
</vn-auto>
</vn-horizontal>
</vn-vertical>
</vn-main-block>

View File

@ -1,4 +1,4 @@
import ngModule from '../../module'; import ngModule from '../module';
class Controller { class Controller {
constructor($http, $stateParams) { constructor($http, $stateParams) {

View File

@ -1,4 +1,4 @@
import ngModule from '../../module'; import ngModule from '../module';
export default class Controller { export default class Controller {
constructor($scope, $state) { constructor($scope, $state) {

View File

@ -0,0 +1,48 @@
<vn-card margin-medium-v class="vn-descriptor">
<vn-horizontal class="header">
<a translate-attr="{title: 'Return to module index'}" ui-sref="zone.index">
<vn-icon icon="chevron_left"></vn-icon>
</a>
<vn-icon icon="my_location"></vn-icon>
<vn-icon-menu
vn-id="more-button"
icon="more_vert"
show-filter="false"
value-field="callback"
translate-fields="['name']"
data="$ctrl.moreOptions"
on-change="$ctrl.onMoreChange(value)"
on-open="$ctrl.onMoreOpen()">
</vn-icon-menu>
</vn-horizontal>
<vn-horizontal pad-medium>
<vn-one>
<vn-label-value label="Id"
value="{{$ctrl.zone.id}}">
</vn-label-value>
<vn-label-value label="Name"
value="{{$ctrl.zone.name}}">
</vn-label-value>
<vn-label-value label="Warehouse"
value="{{$ctrl.zone.warehouse.name}}">
</vn-label-value>
<vn-label-value label="Agency"
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'}}">
</vn-label-value>
<vn-label-value label="Traveling days"
value="{{$ctrl.zone.travelingDays}}">
</vn-label-value>
<vn-label-value label="Price"
value="{{$ctrl.zone.price | currency: '€': 2}}">
</vn-label-value>
<vn-label-value label="Bonus"
value="{{$ctrl.zone.price | currency: '€': 2}}">
</vn-label-value>
</vn-one>
</vn-horizontal>
</vn-card>

View File

@ -0,0 +1,18 @@
import ngModule from '../module';
class Controller {
constructor() {
this.moreOptions = [
{callback: this.showAddTurnDialog, name: 'Settings'},
{callback: this.showDeleteTicketDialog, name: 'Delete'}
];
}
}
ngModule.component('vnZoneDescriptor', {
template: require('./index.html'),
controller: Controller,
bindings: {
zone: '<'
}
});

View File

@ -1,12 +1,12 @@
export * from './module'; export * from './module';
// import components // import components
import './zone/card'; import './index/index';
import './zone/descriptor'; import './summary';
import './zone/search-panel'; import './card';
import './zone/index'; import './descriptor';
import './zone/create'; import './search-panel';
import './zone/summary'; import './create';
import './zone/basic-data'; import './basic-data';
import './zone/delivery-day'; import './location';
import './zone/calendar'; import './calendar';

View File

@ -58,13 +58,6 @@
</vn-pagination> </vn-pagination>
</div> </div>
<vn-dialog class="dialog-summary"
vn-id="dialog">
<tpl-body>
<vn-zone-summary vn-id="summary"></vn-zone-summary>
</tpl-body>
</vn-dialog>
<a ui-sref="zone.create" vn-tooltip="New zone" vn-bind="+" fixed-bottom-right> <a ui-sref="zone.create" vn-tooltip="New zone" vn-bind="+" fixed-bottom-right>
<vn-float-button icon="add"></vn-float-button> <vn-float-button icon="add"></vn-float-button>
</a> </a>

View File

@ -1,4 +1,4 @@
import ngModule from '../../module'; import ngModule from '../module';
export default class Controller { export default class Controller {
constructor($scope) { constructor($scope) {

View File

@ -4,6 +4,7 @@ Warehouse: Almacén
Hour: Hora (ETD) Hour: Hora (ETD)
Price: Precio Price: Precio
Create: Crear Create: Crear
Enter a new search: Introduce una nueva búsqueda
Zones: Zonas Zones: Zonas
List: Listado List: Listado

View File

@ -0,0 +1,7 @@
import ngModule from '../module';
import SearchPanel from 'core/src/components/searchbar/search-panel';
ngModule.component('vnLocationSearchPanel', {
template: require('./index.html'),
controller: SearchPanel
});

View File

@ -0,0 +1,18 @@
<vn-crud-model
vn-id="model"
url="/agency/api/ZoneGeos"
data="geos">
</vn-crud-model>
<vn-vertical vn-one>
<vn-card pad-large>
<vn-title>Delivery days</vn-title>
<vn-searchbar
panel="vn-calendar-search-panel"
model="model"
expr-builder="$ctrl.exprBuilder(param, value)"
vn-focus>
</vn-searchbar>
<vn-treeview model="model"></vn-treeview>
</vn-card>
</vn-vertical>

View File

@ -1,7 +1,6 @@
import ngModule from '../../module'; import ngModule from '../module';
class Controller { class Controller {
constructor($scope) { constructor($scope) {
this.$scope = $scope; this.$scope = $scope;
} }
@ -9,7 +8,7 @@ class Controller {
Controller.$inject = ['$scope']; Controller.$inject = ['$scope'];
ngModule.component('vnZoneDeliveryDay', { ngModule.component('vnZoneLocation', {
template: require('./index.html'), template: require('./index.html'),
controller: Controller, controller: Controller,
bindings: { bindings: {

View File

@ -0,0 +1,40 @@
<div pad-large style="min-width: 30em">
<form ng-submit="$ctrl.onSearch()">
<vn-horizontal>
<vn-textfield
vn-one
label="General search"
model="filter.search"
vn-focus>
</vn-textfield>
</vn-horizontal>
<vn-horizontal>
<vn-textfield
vn-one
label="Name"
model="filter.name">
</vn-textfield>
</vn-horizontal>
<vn-horizontal>
<vn-autocomplete
vn-one
label="Agency"
field="filter.agencyModeFk"
url="/agency/api/AgencyModes"
show-field="name"
value-field="id">
</vn-autocomplete>
<vn-autocomplete
vn-one
label="Warehouse"
field="filter.warehouseFk"
url="/agency/api/Warehouses"
show-field="name"
value-field="id">
</vn-autocomplete>
</vn-horizontal>
<vn-horizontal margin-large-top>
<vn-submit label="Search"></vn-submit>
</vn-horizontal>
</form>
</div>

View File

@ -1,4 +1,4 @@
import ngModule from '../../module'; import ngModule from '../module';
import SearchPanel from 'core/src/components/searchbar/search-panel'; import SearchPanel from 'core/src/components/searchbar/search-panel';
ngModule.component('vnZoneSearchPanel', { ngModule.component('vnZoneSearchPanel', {

View File

@ -1,4 +1,4 @@
import ngModule from '../../module'; import ngModule from '../module';
class Controller { class Controller {
constructor($http) { constructor($http) {

View File

@ -1,11 +0,0 @@
<vn-main-block>
<vn-horizontal>
<vn-auto class="left-block">
<vn-zone-descriptor zone="$ctrl.zone"></vn-zone-descriptor>
<vn-left-menu></vn-left-menu>
</vn-auto>
<vn-one>
<vn-vertical margin-medium ui-view></vn-vertical>
</vn-one>
</vn-horizontal>
</vn-main-block>

View File

@ -1,19 +0,0 @@
<vn-crud-model
vn-id="model"
url="/agency/api/ZoneGeos"
data="geos">
</vn-crud-model>
<vn-horizontal>
<vn-vertical vn-one>
<vn-card pad-large>
<vn-title>Delivery days</vn-title>
<vn-treeview model="model"></vn-treeview>
</vn-card>
</vn-vertical>
<vn-auto class="right-block">
<vn-zone-calendar zone="$ctrl.zone"></vn-zone-calendar>
</vn-auto>
</vn-horizontal>

View File

@ -1,34 +0,0 @@
<vn-card margin-medium-v class="vn-descriptor">
<vn-horizontal class="header">
<a translate-attr="{title: 'Return to module index'}" ui-sref="zone.index">
<vn-icon icon="chevron_left"></vn-icon>
</a>
<vn-icon icon="my_location"></vn-icon>
<a translate-attr="{title: 'Preview'}" ui-sref="zone.card.summary">
<vn-icon icon="desktop_windows"></vn-icon>
</a>
</vn-horizontal>
<div pad-medium>
<vn-label-value label="Id"
value="{{$ctrl.zone.id}}">
</vn-label-value>
<vn-label-value label="Name"
value="{{$ctrl.zone.name}}">
</vn-label-value>
<vn-label-value label="Warehouse"
value="{{$ctrl.zone.warehouse.name}}">
</vn-label-value>
<vn-label-value label="Agency"
value="{{$ctrl.zone.agencyMode.name}}">
</vn-label-value>
<vn-label-value label="Estimated hour (ETD)"
value="{{$ctrl.zone.hour | date: 'HH:mm'}}">
</vn-label-value>
<vn-label-value label="Price"
value="{{$ctrl.zone.price | currency: '€': 2}}">
</vn-label-value>
<vn-label-value label="Bonus"
value="{{$ctrl.zone.price | currency: '€': 2}}">
</vn-label-value>
</div>
</vn-card>

View File

@ -1,8 +0,0 @@
import ngModule from '../../module';
ngModule.component('vnZoneDescriptor', {
template: require('./index.html'),
bindings: {
zone: '<'
}
});

View File

@ -1,42 +0,0 @@
import './index.js';
describe('Agency', () => {
describe('Component summary', () => {
let $componentController;
let controller;
let $httpBackend;
beforeEach(() => {
angular.mock.module('agency');
});
beforeEach(angular.mock.inject((_$componentController_, _$httpBackend_) => {
$componentController = _$componentController_;
$httpBackend = _$httpBackend_;
$httpBackend.when('GET', /\/locale\/\w+\/[a-z]{2}\.json/).respond({});
controller = $componentController('vnZoneSummary');
controller.zone = {id: 1};
}));
describe('getSummary()', () => {
it("should perform a query to set summary", () => {
let data = {name: 'Zone One', price: 0};
$httpBackend.when('GET', `/agency/api/Zones/1`).respond(200, data);
$httpBackend.expect('GET', `/agency/api/Zones/1`);
controller.getSummary();
$httpBackend.flush();
expect(controller.summary).toEqual(data);
});
});
describe('setter zone()', () => {
it("should call getSummary and define summary property", () => {
spyOn(controller, 'getSummary');
controller.zone = {id: 1};
expect(controller.getSummary).toHaveBeenCalledWith();
});
});
});
});

View File

@ -1,2 +0,0 @@
Niche: Nichos
Barcode: Códigos de barras

View File

@ -147,6 +147,7 @@
<vn-crud-model <vn-crud-model
vn-id="lastTicketsModel" vn-id="lastTicketsModel"
url="/claim/api/Tickets" url="/claim/api/Tickets"
limit="20"
data="lastTickets" auto-load="false"> data="lastTickets" auto-load="false">
</vn-crud-model> </vn-crud-model>
<!-- Transfer Popover --> <!-- Transfer Popover -->

View File

@ -1,3 +1,5 @@
vn-icon-menu { vn-icon-menu {
vn-drop-down {
font-family: 'vn-font'
}
} }

View File

@ -81,3 +81,4 @@ INSERT INTO `salix`.`ACL` (`id`, `model`, `property`, `accessType`, `permission`
INSERT INTO `salix`.`fieldAcl` (`model`, `property`, `actionType`, `role`) VALUES ('TicketWeekly', '*', '*', 'employee'); INSERT INTO `salix`.`fieldAcl` (`model`, `property`, `actionType`, `role`) VALUES ('TicketWeekly', '*', '*', 'employee');
INSERT INTO `salix`.`fieldAcl` (`model`, `property`, `actionType`, `role`) VALUES ('Receipt', '*', '*', 'administrative'); INSERT INTO `salix`.`fieldAcl` (`model`, `property`, `actionType`, `role`) VALUES ('Receipt', '*', '*', 'administrative');
INSERT INTO salix.fieldAcl (model,property,actionType,`role`) VALUES ('Zone','*','*','agency');