Merge branch 'dev' of http://git.verdnatura.es/salix into dev

This commit is contained in:
Carlos Jimenez 2018-09-10 10:23:42 +02:00
commit f8ec125958
49 changed files with 190 additions and 722 deletions

View File

@ -15,7 +15,7 @@
"url": "/index?q",
"state": "claim.index",
"component": "vn-claim-index",
"description": "Listado",
"description": "List",
"acl": ["salesAssistant"]
},
{

View File

@ -1,7 +1,7 @@
<div>
<span ng-class="{'mdl-chip--deletable': !$ctrl.disabled}" class="mdl-chip">
<span class="mdl-chip__text" ng-transclude></span>
<button ng-show="!$ctrl.disabled" type="button" class="mdl-chip__action">
<button ng-click="$ctrl.remove()" ng-show="!$ctrl.disabled" type="button" class="mdl-chip__action">
<i class="material-icons">cancel</i>
</button>
</span>

View File

@ -6,12 +6,14 @@ export default class Chip {
$transclude($scope.$parent, clone => {
angular.element($element[0].querySelector('div')).append(clone);
});
/* this.mdlElement = this.element.querySelector('.mdl-slider');
componentHandler.upgradeElement(this.mdlElement); */
/* this.mdlElement.addEventListener('change', () => {
this._value = this.input.value;
this.$.$applyAsync();
}); */
}
/**
* Remove chip event
*/
remove() {
if (this.onRemove)
this.onRemove();
}
}
@ -22,6 +24,7 @@ ngModule.component('vnChip', {
controller: Chip,
transclude: true,
bindings: {
disabled: '<?'
disabled: '<?',
onRemove: '&?'
}
});

View File

@ -0,0 +1,31 @@
import './index.js';
import template from './index.html';
describe('Component vnChip', () => {
let $element;
let $scope;
let $httpBackend;
let controller;
beforeEach(() => {
angular.mock.module('client');
});
beforeEach(angular.mock.inject((_$componentController_, $rootScope, _$httpBackend_, _$timeout_) => {
$scope = $rootScope.$new();
$element = angular.element(`<div>${template}</div>`);
$httpBackend = _$httpBackend_;
$httpBackend.when('GET', /\/locale\/\w+\/[a-z]{2}\.json/).respond({});
controller = _$componentController_('vnChip', {$element, $scope, $httpBackend, $transclude: () => {}});
}));
describe('remove()', () => {
it(`should call onRemove()`, () => {
controller.onRemove = () => {};
spyOn(controller, 'onRemove');
controller.remove();
expect(controller.onRemove).toHaveBeenCalledWith();
});
});
});

View File

@ -2,6 +2,10 @@
vn-chip {
.mdl-chip {
background-color: rgba($main-01, 0.9);
}
.mdl-chip:active {
background-color: $main-01
}
}

View File

@ -1,16 +1,18 @@
import './multi-check.js';
xdescribe('Component vnMultiCheck', () => {
describe('Component vnMultiCheck', () => {
let $componentController;
let controller;
let $element;
beforeEach(() => {
angular.mock.module('client');
angular.mock.module('ticket');
});
beforeEach(angular.mock.inject(_$componentController_ => {
$componentController = _$componentController_;
controller = $componentController('vnMultiCheck', {});
$element = angular.element(`<div class="shown"></div>`);
controller = $componentController('vnMultiCheck', {$element: $element});
}));
describe('checkAll() setter', () => {
@ -25,7 +27,7 @@ xdescribe('Component vnMultiCheck', () => {
});
describe('switchChecks()', () => {
it(`should set checked property inside each existing elemenet when id begings with no-`, () => {
it(`should set checked property inside each existing element`, () => {
controller.data = [
{name: 'name'},
{name: null}

View File

@ -125,7 +125,7 @@
"item": "$ctrl.item"
}
}, {
"url" : "/diary?q",
"url" : "/diary?warehouseFk",
"state": "item.card.diary",
"component": "vn-item-diary",
"description": "Diary",

View File

@ -2,8 +2,7 @@
vn-id="model"
url="item/api/Items/getDiary"
filter="::$ctrl.filter"
data="sales"
auto-load="false">
data="sales">
</vn-crud-model>
<vn-vertical>
<vn-card pad-large>
@ -15,9 +14,10 @@
url="/item/api/Warehouses"
show-field="name"
value-field="id"
initial-data="$ctrl.filter.where.warehouseFk"
field="$ctrl.filter.where.warehouseFk"
label="Select warehouse" on-change="$ctrl.onChange(value)">
initial-data="$ctrl.warehouseFk"
field="$ctrl.warehouseFk"
label="Select warehouse"
on-change="$ctrl.onChange(value)">
</vn-autocomplete>
</vn-horizontal>
<vn-table model="model">

View File

@ -2,61 +2,58 @@ import ngModule from '../module';
import './style.scss';
class Controller {
constructor($scope, $http, $state, $window, $translate) {
constructor($scope, $http, $state, $window, $translate, $stateParams) {
this.$scope = $scope;
this.$http = $http;
this.$state = $state;
this.$stateParams = $stateParams;
this.$window = $window;
this.$translate = $translate;
}
/*
$postLink() {
if (this.item)
this.filterBuilder();
}
*/
set item(value) {
this._item = value;
if (value && this.$scope.model)
this.filterBuilder();
this.filter = {
where: {itemFk: this.$stateParams.id}
};
if (this.$stateParams.warehouseFk)
this.warehouseFk = this.$stateParams.warehouseFk;
else if (value)
this.warehouseFk = value.itemType.warehouseFk;
}
get item() {
return this._item;
}
onChange(value) {
if (!value) return;
set warehouseFk(value) {
this._warehouseFk = value;
this.$state.go(this.$state.current.name, {
warehouseFk: value
});
this.filter.where.warehouseFk = value;
this.$scope.model.refresh();
}
/**
* Builds a filter with default values
* and aplies query params.
*/
filterBuilder() {
this.filter = {
where: {
itemFk: this.item.id,
warehouseFk: this.item.itemType.warehouseFk
}
};
let where = this.filter.where;
if (this.$state.params.q) {
let queryFilter = JSON.parse(this.$state.params.q);
where.warehouseFk = queryFilter.warehouseFk;
}
get warehouseFk() {
return this._warehouseFk;
}
get freeLineIndex() {
let lines = this.$scope.model.data;
let currentDate = new Date();
currentDate.setHours(0, 0, 0);
for (let i = 0; i < lines.length; i++) {
let isFutureDate = new Date(lines[i].date) > new Date();
let isFutureDate = new Date(lines[i].date) >= currentDate;
if (isFutureDate)
return i;
@ -140,7 +137,7 @@ class Controller {
}
}
Controller.$inject = ['$scope', '$http', '$state', '$window', '$translate'];
Controller.$inject = ['$scope', '$http', '$state', '$window', '$translate', '$stateParams'];
ngModule.component('vnItemDiary', {
template: require('./index.html'),

View File

@ -3,6 +3,7 @@ import './index.js';
describe('Item', () => {
describe('Component vnItemDiary', () => {
let $componentController;
let $stateParams;
let $scope;
let controller;
let $httpBackend;
@ -11,12 +12,14 @@ describe('Item', () => {
angular.mock.module('item');
});
beforeEach(angular.mock.inject((_$componentController_, $rootScope, _$httpBackend_) => {
beforeEach(angular.mock.inject((_$componentController_, $rootScope, _$stateParams_, _$httpBackend_) => {
$componentController = _$componentController_;
$stateParams = _$stateParams_;
$stateParams.id = 1;
$httpBackend = _$httpBackend_;
$httpBackend.when('GET', /\/locale\/\w+\/[a-z]{2}\.json/).respond({});
$scope = $rootScope.$new();
controller = $componentController('vnItemDiary', {$scope: $scope});
controller = $componentController('vnItemDiary', {$scope: $scope, $stateParams});
controller.$scope.model = {};
}));
@ -71,12 +74,19 @@ describe('Item', () => {
});
describe('set item()', () => {
it(`should call filterBuilder()`, () => {
spyOn(controller, 'filterBuilder');
controller.item = {id: 1};
it(`should set warehouseFk property based on itemType warehouseFk`, () => {
controller.item = {id: 1, itemType: {warehouseFk: 1}};
expect(controller.filterBuilder).toHaveBeenCalledWith();
expect(controller.item).toEqual({id: 1});
expect(controller.warehouseFk).toEqual(1);
expect(controller.item.id).toEqual(1);
});
it(`should set warehouseFk property based on url query warehouseFk`, () => {
controller.$stateParams.warehouseFk = 4;
controller.item = {id: 1, itemType: {warehouseFk: 1}};
expect(controller.warehouseFk).toEqual(4);
expect(controller.item.id).toEqual(1);
});
});
});

View File

@ -1 +1 @@
export * from './src/route';
export * from './src';

View File

@ -1,4 +1,4 @@
/* {
{
"module": "route",
"name": "Routes",
"icon" : "local_shipping",
@ -8,61 +8,15 @@
"url": "/routes",
"state": "routes",
"abstract": true,
"component": "ui-view"
"component": "ui-view",
"description": "Routes"
},
{
"url": "/list",
"url": "/index?q",
"state": "routes.index",
"component": "vn-route-index",
"description": "List",
"acl": ["developer"]
},
{
"url": "/create",
"state": "routes.create",
"component": "vn-route-create"
},
{
"url": "/:id",
"state": "routes.card",
"abstract": true,
"component": "vn-route-card"
},
{
"url": "/basicData",
"state": "routes.card.basicData",
"component": "vn-route-basic-data",
"params": {
"route": "$ctrl.route"
},
"menu": {
"description": "Basic data",
"icon": "person"
}
},
{
"url": "/logisticData",
"state": "routes.card.logisticData",
"component": "vn-route-logistic-data",
"acl": ["employee"],
"params": {
"route": "$ctrl.route"
},
"menu": {
"description": "Logistic data",
"icon": "local_shipping"
}
},
{
"url": "/tickets",
"state": "routes.card.tickets",
"component": "vn-route-tickets",
"params": {
"route": "$ctrl.route"
},
"menu": {
"description": "Assigned tickets",
"icon": "assignment"
}
}
]
} */
}

View File

@ -1,35 +0,0 @@
<vn-watcher
vn-id="watcher"
data="$ctrl.route"
form="form">
</vn-watcher>
<form name="form" pad-medium>
<vn-card>
<vn-vertical pad-large>
<vn-title>Basic data</vn-title>
<vn-horizontal>
<vn-date-picker vn-one label="Date" model="$ctrl.route.date"></vn-date-picker>
<vn-autocomplete vn-one
label="Agency"
url="/route/api/Agencies"
field="$ctrl.route.agency">
</vn-autocomplete>
<vn-autocomplete vn-one
field="$ctrl.route.driver"
url="/route/api/Vehicles/activeDrivers"
label="Driver">
</vn-autocomplete>
<vn-autocomplete vn-one
field="$ctrl.route.vehicle"
url="/route/api/Vehicles/comboVehicles"
label="Vehicle"
order="tradeMark ASC"
filter="{where: {isActive: 1, warehouseFk: 1}}">
</vn-autocomplete>
</vn-horizontal>
</vn-vertical>
</vn-card>
<vn-button-bar>
<vn-submit label="Save"></vn-submit>
</vn-button-bar>
</form>

View File

@ -1,8 +0,0 @@
import ngModule from '../module';
ngModule.component('vnRouteBasicData', {
template: require('./basic-data.html'),
bindings: {
route: '<'
}
});

View File

@ -1,27 +0,0 @@
<vn-horizontal>
<mg-ajax
path="/route/api/Deliveries/{{edit.params.id}}"
actions="$ctrl.route = edit.model"
options="mgEdit">
</mg-ajax>
<vn-one style="min-width: 18em; padding-left: 1em; padding-bottom: 1em;">
<vn-card>
<vn-vertical class="margin-medium" pad-medium-top pad-medium-bottom>
<vn-horizontal>
<a vn-one ui-sref="routes.index">
<i class="material-icons descriptor-icon">local_shipping</i>
</a>
<vn-vertical vn-two>
<div class="margin-none"><span translate>Route</span> {{::$ctrl.route.id}}</div>
<div class="margin-none">{{$ctrl.route.date | date:'dd/MM/yyyy'}}</div>
</vn-vertical>
</vn-horizontal>
</vn-vertical>
</vn-card>
<vn-left-menu></vn-left-menu>
</vn-one>
<vn-auto>
<vn-vertical style="max-width: 70em; margin: 0 auto;" ui-view></vn-vertical>
</vn-auto>
</vn-horizontal>

View File

@ -1,12 +0,0 @@
import ngModule from '../module';
class RouteCard {
constructor() {
this.route = null;
}
}
ngModule.component('vnRouteCard', {
template: require('./card.html'),
controller: RouteCard
});

View File

@ -1,43 +0,0 @@
<mg-ajax path="/route/api/Delivery/createRoute" options="vnPost"></mg-ajax>
<vn-watcher
vn-id="watcher"
data="$ctrl.delivery"
form="form"
save="post">
</vn-watcher>
<form name="form" ng-submit="$ctrl.onSubmit()" margin-medium>
<div style="max-width: 70em; margin: 0 auto;">
<vn-card>
<vn-vertical pad-large>
<vn-title>Create Route</vn-title>
<vn-horizontal>
<vn-date-picker vn-one label="Date" model="$ctrl.delivery.date"></vn-date-picker>
<vn-autocomplete
vn-one
label="Agency"
url="/route/api/Agencies"
field="$ctrl.delivery.agency">
</vn-autocomplete>
</vn-horizontal>
<vn-horizontal>
<vn-autocomplete vn-one
field="$ctrl.delivery.driver"
url="/route/api/Vehicles/activeDrivers"
label="Driver"></vn-autocomplete>
<vn-autocomplete vn-one
field="$ctrl.delivery.vehicle"
url="/route/api/Vehicles/comboVehicles"
label="Vehicle"
order="tradeMark ASC"
filter="{where: {isActive:1, warehouseFk:1}}">
</vn-autocomplete>
</vn-horizontal>
</vn-vertical>
</vn-card>
<vn-button-bar>
<vn-submit label="Create and edit"></vn-submit>
<vn-button label="Create" ng-click="watcher.submitBack()"></vn-button>
</vn-button-bar>
</div>
</form>

View File

@ -1,20 +0,0 @@
import ngModule from '../module';
class RouteCreate {
constructor($scope, $state) {
this.$ = $scope;
this.$state = $state;
this.delivery = {};
}
onSubmit() {
this.$.watcher.submit().then(
json => this.$state.go('routes.card.basicData', {id: json.data.id})
);
}
}
RouteCreate.$inject = ['$scope', '$state'];
ngModule.component('vnRouteCreate', {
template: require('./create.html'),
controller: RouteCreate
});

View File

@ -0,0 +1,3 @@
export * from './module';
// import components

View File

@ -1,12 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 48 48" version="1.1" width="528" height="528">
<g id="surface1">
<path style=" fill:#1C9957;" d="M 42 39 L 42 9 C 42 7.34375 40.65625 6 39 6 L 9 6 C 7.34375 6 6 7.34375 6 9 L 6 39 C 6 40.65625 7.34375 42 9 42 L 39 42 C 40.65625 42 42 40.65625 42 39 Z "/>
<path style=" fill:#3E7BF1;" d="M 9 42 L 39 42 C 40.65625 42 24 26 24 26 C 24 26 7.34375 42 9 42 Z "/>
<path style=" fill:#CBCCC9;" d="M 42 39 L 42 9 C 42 7.34375 26 24 26 24 C 26 24 42 40.65625 42 39 Z "/>
<path style=" fill:#EFEFEF;" d="M 39 42 C 40.65625 42 42 40.65625 42 39 L 42 38.753906 L 26.246094 23 L 23 26.246094 L 38.753906 42 Z "/>
<path style=" fill:#FFD73D;" d="M 42 9 C 42 7.34375 40.65625 6 39 6 L 38.753906 6 L 6 38.753906 L 6 39 C 6 40.65625 7.34375 42 9 42 L 9.246094 42 L 42 9.246094 Z "/>
<path style=" fill:#D73F35;" d="M 36 2 C 30.476563 2 26 6.476563 26 12 C 26 18.8125 33.664063 21.296875 35.332031 31.851563 C 35.441406 32.53125 35.449219 33 36 33 C 36.550781 33 36.558594 32.53125 36.667969 31.851563 C 38.335938 21.296875 46 18.8125 46 12 C 46 6.476563 41.523438 2 36 2 Z "/>
<path style=" fill:#752622;" d="M 39.5 12 C 39.5 13.933594 37.933594 15.5 36 15.5 C 34.066406 15.5 32.5 13.933594 32.5 12 C 32.5 10.066406 34.066406 8.5 36 8.5 C 37.933594 8.5 39.5 10.066406 39.5 12 Z "/>
<path style=" fill:#FFFFFF;" d="M 14.492188 12.53125 L 14.492188 14.632813 L 17.488281 14.632813 C 17.09375 15.90625 16.03125 16.816406 14.492188 16.816406 C 12.660156 16.816406 11.175781 15.332031 11.175781 13.5 C 11.175781 11.664063 12.660156 10.179688 14.492188 10.179688 C 15.316406 10.179688 16.070313 10.484375 16.648438 10.980469 L 18.195313 9.433594 C 17.21875 8.542969 15.921875 8 14.492188 8 C 11.453125 8 8.992188 10.464844 8.992188 13.5 C 8.992188 16.535156 11.453125 19 14.492188 19 C 19.304688 19 20.128906 14.683594 19.675781 12.539063 Z "/>
</g>
</svg>

View File

@ -1,23 +0,0 @@
<mg-ajax path="/route/api/Deliveries/filter" options="mgIndex"></mg-ajax>
<div margin-medium>
<div style="max-width: 40em; margin: 0 auto;">
<vn-card>
<vn-horizontal pad-medium>
<vn-searchbar vn-auto
index="index"
on-search="$ctrl.search(index)"
advanced="true"
search="$ctrl.model.search"
popover="vn-route-search-panel">
</vn-searchbar>
</vn-horizontal>
</vn-card>
<vn-card margin-medium-top>
<vn-item-route ng-repeat="route in index.model.instances" title="View Route" route="route"></vn-item-route>
</vn-card>
<vn-paging index="index" total="index.model.count"></vn-paging>
</div>
<a ui-sref="routes.create" vn-bind="+" fixed-bottom-right>
<vn-float-button icon="add"></vn-float-button>
</a>
</div>

View File

@ -1,18 +0,0 @@
import ngModule from '../module';
import './style.css';
import './item-route';
export default class Controller {
constructor() {
this.model = {};
}
search(index) {
index.filter.search = this.model.search;
index.accept();
}
}
ngModule.component('vnRouteIndex', {
template: require('./index.html'),
controller: Controller
});

View File

@ -1,21 +0,0 @@
<a vn-horizontal ui-sref="routes.card.basicData({id: {{$ctrl.route.id}} })" pad-medium border-solid-bottom>
<vn-one>
<vn-vertical>
<vn-one>
<span translate>ID_RUTA</span>:
<strong>{{$ctrl.route.id}}</strong>
</vn-one>
<vn-one>
<span translate>Fecha</span>:
<strong>{{$ctrl.route.date | date:'dd/MM/yyyy'}}</strong>
</vn-one>
<vn-one>
<span>m<sup>3</sup></span>:
<strong>{{$ctrl.route.m3}}</strong>
</vn-one>
</vn-vertical>
</vn-one>
<vn-none pad-medium-top>
<vn-icon icon="print"></vn-icon>
</vn-none>
</a>

View File

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

View File

@ -1,18 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 21.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 30.3 26.6" style="enable-background:new 0 0 30.3 26.6;" xml:space="preserve">
<style type="text/css">
.st0{fill:#FFFFFF;}
.st1{fill:#F7931E;}
</style>
<rect width="30.3" height="26.6"/>
<g>
<path class="st0" d="M24.9,9.7h-3.7v-5H4c-1.4,0-2.5,1.1-2.5,2.5v13.5H4c0,2,1.6,3.7,3.7,3.7s3.7-1.6,3.7-3.7h7.4
c0,2,1.6,3.7,3.7,3.7s3.7-1.6,3.7-3.7h2.5v-6.1L24.9,9.7z M7.7,22.5c-1,0-1.8-0.8-1.8-1.8s0.8-1.8,1.8-1.8s1.8,0.8,1.8,1.8
S8.7,22.5,7.7,22.5z M24.2,11.5l2.4,3.1h-5.5v-3.1H24.2z M22.4,22.5c-1,0-1.8-0.8-1.8-1.8s0.8-1.8,1.8-1.8s1.8,0.8,1.8,1.8
C24.2,21.7,23.4,22.5,22.4,22.5z"/>
<path class="st1" d="M12,7.2c-3,0-5.5,2.5-5.5,5.5S9,18.2,12,18.2s5.5-2.5,5.5-5.5S15,7.2,12,7.2z M14.8,13.3h-2.2v2.2h-1.1v-2.2
H9.3v-1.1h2.2V9.9h1.1v2.2h2.2V13.3z"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 1.0 KiB

View File

@ -1,18 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 21.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 30.3 26.6" style="enable-background:new 0 0 30.3 26.6;" xml:space="preserve">
<style type="text/css">
.st0{fill:#FFFFFF;}
.st1{fill:#F7931E;}
</style>
<rect width="30.3" height="26.6"/>
<g>
<path class="st0" d="M24.9,9.7h-3.7V4.7H4c-1.4,0-2.5,1.1-2.5,2.5v13.5H4c0,2,1.6,3.7,3.7,3.7s3.7-1.6,3.7-3.7h7.4
c0,2,1.6,3.7,3.7,3.7s3.7-1.6,3.7-3.7h2.5v-6.1L24.9,9.7z M7.7,22.5c-1,0-1.8-0.8-1.8-1.8c0-1,0.8-1.8,1.8-1.8s1.8,0.8,1.8,1.8
C9.5,21.7,8.7,22.5,7.7,22.5z M24.2,11.5l2.4,3.1h-5.5v-3.1H24.2z M22.4,22.5c-1,0-1.8-0.8-1.8-1.8c0-1,0.8-1.8,1.8-1.8
c1,0,1.8,0.8,1.8,1.8C24.2,21.7,23.4,22.5,22.4,22.5z"/>
<path class="st1" d="M12,7.2c-3,0-5.5,2.5-5.5,5.5s2.5,5.5,5.5,5.5s5.5-2.5,5.5-5.5S15,7.2,12,7.2z M14.7,13.3H9.2v-1.1h5.5V13.3z"
/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 1.0 KiB

View File

@ -1,12 +0,0 @@
vn-item-route {
display: block;
}
vn-item-route a {
display: block;
text-decoration: none;
color: inherit;
}
vn-item-route a:hover {
color: white;
background-color: #424242;
}

View File

@ -1,26 +0,0 @@
<vn-watcher
vn-id="watcher"
data="$ctrl.route"
form="form">
</vn-watcher>
<form name="form" pad-medium>
<vn-card>
<vn-vertical pad-large>
<vn-title>Logistic data</vn-title>
<vn-horizontal>
<vn-date-picker vn-one label="Start Hour" model="$ctrl.route.startHour" ini-options="{enableTime: true, noCalendar: true, enableSeconds: false, dateFormat: 'H:i'}"></vn-date-picker>
<vn-date-picker vn-one label="End Hour" model="$ctrl.route.endHour" ini-options="{enableTime: true, noCalendar: true, enableSeconds: false, dateFormat: 'H:i'}"></vn-date-picker>
<vn-textfield vn-one label="Start Km" model="$ctrl.route.starKm"></vn-textfield>
<vn-textfield vn-one label="End Km" model="$ctrl.route.endKm"></vn-textfield>
</vn-horizontal>
<vn-horizontal>
<vn-textfield vn-one label="Packages" model="$ctrl.route.packages"></vn-textfield>
<vn-textfield vn-one label="M3" model="$ctrl.route.m3"></vn-textfield>
<vn-one></vn-one>
</vn-horizontal>
</vn-vertical>
</vn-card>
<vn-button-bar>
<vn-submit label="Save"></vn-submit>
</vn-button-bar>
</form>

View File

@ -1,8 +0,0 @@
import ngModule from '../module';
ngModule.component('vnRouteLogisticData', {
template: require('./logistic-data.html'),
bindings: {
route: '<'
}
});

View File

@ -1,10 +0,0 @@
export * from './module';
// import components
import './index/index';
import './search-panel/search-panel';
import './create/create';
import './card/card';
import './basic-data/basic-data';
import './logistic-data/logistic-data';
import './tickets/tickets';

View File

@ -1,8 +0,0 @@
Client id: Id cliente
Tax number: NIF/CIF
Name: Nombre
Social name: Razon social
Town/City: Ciudad
Postcode: Código postal
Email: Correo electrónico
Phone: Teléfono

View File

@ -1,21 +0,0 @@
<div pad-large style="min-width: 30em">
<form ng-submit="$ctrl.onSearch()">
<vn-horizontal>
<vn-date-picker vn-one label="Date" model="$ctrl.filter.date"></vn-date-picker>
<vn-autocomplete
vn-one
label="Zone"
field="$ctrl.filter.zone"
url="/route/api/Zones"
order="printingOrder ASC">
</vn-autocomplete>
</vn-horizontal>
<vn-horizontal>
<vn-textfield vn-one label="Postcode" model="$ctrl.filter.postcode"></vn-textfield>
<vn-textfield vn-one label="Route_Id" model="$ctrl.filter.id"></vn-textfield>
</vn-horizontal>
<vn-horizontal margin-large-top>
<vn-submit label="Search"></vn-submit>
</vn-horizontal>
</form>
</div>

View File

@ -1,27 +0,0 @@
import ngModule from '../module';
export default class Controller {
constructor($window) {
this.$window = $window;
// onSubmit() is defined by @vnSearchbar
this.onSubmit = () => {};
}
onSearch() {
this.setStorageValue();
this.onSubmit(this.filter);
}
$onChanges() {
var value = JSON.parse(this.$window.sessionStorage.getItem('filter'));
if (value !== undefined)
this.filter = value;
}
setStorageValue() {
this.$window.sessionStorage.setItem('filter', JSON.stringify(this.filter));
}
}
Controller.$inject = ['$window'];
ngModule.component('vnRouteSearchPanel', {
template: require('./search-panel.html'),
controller: Controller
});

View File

@ -1,7 +0,0 @@
<vn-one pad-medium>
<vn-card>
<vn-vertical pad-large>
<vn-title>Assigned tickets</vn-title>
</vn-vertical>
</vn-card>
</vn-one>

View File

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

View File

@ -15,7 +15,7 @@
"url": "/index?q",
"state": "ticket.index",
"component": "vn-ticket-index",
"description": "Listado"
"description": "List"
},
{
"url": "/:id",

View File

@ -2,42 +2,46 @@
"name": "Greuge",
"base": "VnModel",
"options": {
"mysql": {
"table": "greuge"
}
"mysql": {
"table": "greuge"
}
},
"properties": {
"id": {
"id": true,
"type": "Number",
"description": "Identifier"
},
"description": {
"type": "String",
"required": true
},
"amount": {
"type": "Number",
"required": true
},
"shipped": {
"type": "date"
},
"created": {
"type": "date"
}
"id": {
"id": true,
"type": "Number",
"description": "Identifier"
},
"description": {
"type": "String",
"required": true
},
"amount": {
"type": "Number",
"required": true
},
"shipped": {
"type": "date"
},
"created": {
"type": "date"
},
"greugeTypeFk": {
"type": "Number",
"required": true
}
},
"relations": {
"client": {
"type": "belongsTo",
"model": "Client",
"foreignKey": "clientFk"
},
"greugeType": {
"type": "belongsTo",
"model": "GreugeType",
"foreignKey": "greugeTypeFk",
"required": true
}
"client": {
"type": "belongsTo",
"model": "Client",
"foreignKey": "clientFk"
},
"greugeType": {
"type": "belongsTo",
"model": "GreugeType",
"foreignKey": "greugeTypeFk"
}
}
}
}

View File

@ -4,7 +4,7 @@ mysqldump --defaults-file=connect.ini --no-create-info account role roleRole rol
echo USE `salix`; >> install/dump/03-dumpedFixtures.sql
mysqldump --defaults-file=connect.ini --no-create-info salix ACL >> install/dump/03-dumpedFixtures.sql
echo USE `vn`; >> install/dump/03-dumpedFixtures.sql
mysqldump --defaults-file=connect.ini --no-create-info vn cplusInvoiceType477 cplusSubjectOp cplusTaxBreak bookingPlanner pgc tag >> install/dump/03-dumpedFixtures.sql
mysqldump --defaults-file=connect.ini --no-create-info vn cplusInvoiceType477 cplusSubjectOp cplusTaxBreak bookingPlanner pgc tag alertLevel>> install/dump/03-dumpedFixtures.sql
echo USE `vn2008`; >> install/dump/03-dumpedFixtures.sql
mysqldump --defaults-file=connect.ini --no-create-info vn2008 accion_dits Gastos Tintas tarifa_componentes tarifa_componentes_series state bionic_updating_options Grupos Monedas container iva_group_codigo escritos cl_est cl_con cl_res cl_dev cl_mot cl_sol>> install/dump/03-dumpedFixtures.sql
echo USE `bi`; >> install/dump/03-dumpedFixtures.sql

View File

@ -5,13 +5,10 @@ mysqldump --defaults-file=connect.ini --no-create-info account role roleRole rol
echo "USE \`salix\`;" >> install/dump/03-dumpedFixtures.sql
mysqldump --defaults-file=connect.ini --no-create-info salix ACL >> install/dump/03-dumpedFixtures.sql
echo "USE \`vn\`;" >> install/dump/03-dumpedFixtures.sql
mysqldump --defaults-file=connect.ini --no-create-info vn cplusInvoiceType477 cplusSubjectOp cplusTaxBreak bookingPlanner pgc tag >> install/dump/03-dumpedFixtures.sql
mysqldump --defaults-file=connect.ini --no-create-info vn cplusInvoiceType477 cplusSubjectOp cplusTaxBreak bookingPlanner pgc tag alertLevel >> install/dump/03-dumpedFixtures.sql
echo "USE \`vn2008\`;" >> install/dump/03-dumpedFixtures.sql
mysqldump --defaults-file=connect.ini --no-create-info vn2008 accion_dits Gastos Tintas tarifa_componentes tarifa_componentes_series state bionic_updating_options Grupos Monedas container iva_group_codigo escritos cl_est cl_con cl_res cl_dev cl_mot cl_sol>> install/dump/03-dumpedFixtures.sql
echo "USE \`bi\`;" >> install/dump/03-dumpedFixtures.sql
mysqldump --defaults-file=connect.ini --no-create-info bi tarifa_componentes tarifa_componentes_series >> install/dump/03-dumpedFixtures.sql
echo "USE \`cache\`;" >> install/dump/03-dumpedFixtures.sql
mysqldump --defaults-file=connect.ini --no-create-info cache cache >> install/dump/03-dumpedFixtures.sql

View File

@ -55,7 +55,7 @@ UNLOCK TABLES;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2018-09-05 11:59:54
-- Dump completed on 2018-09-06 14:58:36
USE `salix`;
-- MySQL dump 10.13 Distrib 5.7.21, for osx10.13 (x86_64)
--
@ -93,7 +93,7 @@ UNLOCK TABLES;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2018-09-05 11:59:54
-- Dump completed on 2018-09-06 14:58:36
USE `vn`;
-- MySQL dump 10.13 Distrib 5.7.21, for osx10.13 (x86_64)
--
@ -171,6 +171,16 @@ LOCK TABLES `tag` WRITE;
INSERT INTO `tag` VALUES (1,'Color',0,1,'ink',NULL),(2,'Forma',1,1,NULL,NULL),(3,'Material',1,1,NULL,NULL),(4,'Longitud',1,0,NULL,NULL),(5,'Diámetro',1,0,NULL,'mm'),(6,'Perímetro',1,0,NULL,'mm'),(7,'Ancho de la base',1,0,NULL,'mm'),(8,'Altura',1,0,NULL,'mm'),(9,'Volumen',1,0,NULL,'ml'),(10,'Densidad',1,0,NULL,NULL),(11,'Calidad',1,1,NULL,NULL),(12,'Textura',1,1,NULL,NULL),(13,'Material del mango',1,1,NULL,NULL),(14,'Compra mínima',1,1,NULL,NULL),(15,'Nº pétalos',1,0,NULL,NULL),(16,'Ancho',1,0,NULL,'mm'),(17,'Alto',1,0,NULL,'mm'),(18,'Profundidad',1,0,NULL,'mm'),(19,'Largo',1,0,NULL,'mm'),(20,'Ancho superior',1,0,NULL,'mm'),(21,'Ancho inferior',1,0,NULL,'mm'),(22,'Gramaje',1,0,NULL,'g'),(23,'Tallos',1,0,NULL,NULL),(24,'Estado',0,1,NULL,NULL),(25,'Color principal',0,1,NULL,NULL),(26,'Color secundario',0,1,NULL,NULL),(27,'Longitud(cm)',1,0,NULL,'cm'),(28,'Diámetro base',1,0,NULL,NULL),(29,'Colección',1,1,NULL,NULL),(30,'Uds / caja',1,0,NULL,NULL),(31,'Contenido',1,1,NULL,NULL),(32,'Peso',1,0,NULL,'g'),(33,'Grosor',1,0,NULL,'mm'),(34,'Marca',1,1,NULL,NULL),(35,'Origen',0,1,'origin',NULL),(36,'Proveedor',1,1,NULL,NULL),(37,'Productor',1,1,'producer',NULL),(38,'Duración',1,0,NULL,'s'),(39,'Flor',1,1,NULL,NULL),(40,'Soporte',1,1,NULL,NULL),(41,'Tamaño flor',1,1,NULL,NULL),(42,'Apertura',1,1,NULL,NULL),(43,'Tallo',0,1,NULL,NULL),(44,'Numero hojas',1,1,NULL,NULL),(45,'Dimensiones',1,1,NULL,NULL),(46,'Diámetro boca',1,1,NULL,NULL),(47,'Nº flores',1,0,NULL,NULL),(48,'Uds / paquete',1,0,NULL,NULL),(49,'Maceta',1,1,NULL,NULL),(50,'Textura flor',1,1,NULL,NULL),(51,'Textura hoja',1,1,NULL,NULL),(52,'Tipo de iva',1,1,NULL,NULL),(53,'Tronco',1,1,NULL,NULL),(54,'Hoja',1,1,NULL,NULL),(55,'Formato',1,1,NULL,NULL),(56,'Genero',1,1,NULL,NULL),(57,'Especie',1,1,NULL,NULL),(58,'Variedad',1,1,NULL,NULL),(59,'Medida grande',1,0,NULL,NULL),(60,'Medida mediano',1,0,NULL,NULL),(61,'Medida pequeño',1,0,NULL,NULL),(62,'Medida pequeño',1,0,NULL,NULL),(63,'Recipiente interior',1,1,NULL,NULL),(64,'Material secundario',1,1,NULL,NULL),(65,'Colores',1,1,NULL,NULL),(66,'Referencia',1,1,NULL,NULL),(67,'Categoria',1,0,NULL,NULL),(68,'Amb',0,1,NULL,NULL),(69,'Anchura',1,1,NULL,'cm'),(70,'Hueco interior',-1,1,NULL,NULL),(71,'Tamaño',1,1,NULL,NULL),(72,'Color botón',1,1,NULL,NULL),(73,'Tamaño minimo del botón',1,1,NULL,NULL),(74,'Obtentor',1,1,NULL,NULL),(75,'Logitud del brote',1,1,NULL,NULL),(76,'Tallos / u.v.',1,1,NULL,NULL),(77,'Madera de',1,1,NULL,NULL),(78,'Unidad de venta',1,1,NULL,NULL),(79,'Temporal',1,1,NULL,NULL),(80,'Gramaje/tallo',1,1,NULL,NULL),(81,'Gramaje/paquete',1,1,NULL,NULL),(82,'Flexibilidad del tallo',1,1,NULL,NULL),(83,'Nº planchas',1,1,NULL,NULL);
/*!40000 ALTER TABLE `tag` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping data for table `alertLevel`
--
LOCK TABLES `alertLevel` WRITE;
/*!40000 ALTER TABLE `alertLevel` DISABLE KEYS */;
INSERT INTO `alertLevel` VALUES ('DELIVERED',3),('FREE',0),('ON_PREPARATION',1),('PACKED',2);
/*!40000 ALTER TABLE `alertLevel` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
@ -181,7 +191,7 @@ UNLOCK TABLES;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2018-09-05 11:59:54
-- Dump completed on 2018-09-06 14:58:37
USE `vn2008`;
-- MySQL dump 10.13 Distrib 5.7.21, for osx10.13 (x86_64)
--
@ -296,7 +306,7 @@ UNLOCK TABLES;
LOCK TABLES `escritos` WRITE;
/*!40000 ALTER TABLE `escritos` DISABLE KEYS */;
INSERT INTO `escritos` VALUES (1,'Carta_1','Aviso inicial por saldo deudor',0,'0'),(2,'Carta_2','Reiteracion de aviso por saldo deudor',0,'0'),(3,'Cred_Up','Notificación de aumento de crédito',0,'0'),(4,'Cred_down','Notificación de reducción de crédito',0,'0'),(5,'Pet_CC','Petición de datos bancarios B2B',0,'0'),(6,'SolCredito','Solicitud de crédito',0,'0'),(7,'LeyPago','Ley de pagos',0,'0'),(8,'Pet_CC_Core','Petición de datos bancarios CORE',0,'0'),(9,'nueva_alta','Documento de nueva alta de cliente',0,'0'),(10,'client_welcome','Email de bienvenida para nuevo cliente',0,'0'),(11,'setup_printer','Email de instalación de impresora',0,'0'),(12,'client-welcome','Email de bienvenida como nuevo cliente.',1,'0'),(13,'printer-setup','Email de instalación y configuración de impresora de coronas.',1,'0'),(14,'sepa-core','Email de solicitud de datos bancarios core.',1,'1'),(15,'letter-debtor-st','Email de aviso inicial por saldo deudor',1,'1'),(16,'letter-debtor-nd','Email de aviso reiterado por saldo deudor',1,'1');
INSERT INTO `escritos` VALUES (1,'Carta_1','Aviso inicial por saldo deudor',1,'0'),(2,'Carta_2','Reiteracion de aviso por saldo deudor',1,'0'),(3,'Cred_Up','Notificación de aumento de crédito',0,'0'),(4,'Cred_down','Notificación de reducción de crédito',0,'0'),(5,'Pet_CC','Petición de datos bancarios B2B',0,'0'),(6,'SolCredito','Solicitud de crédito',0,'0'),(7,'LeyPago','Ley de pagos',0,'0'),(8,'Pet_CC_Core','Petición de datos bancarios CORE',1,'0'),(9,'nueva_alta','Documento de nueva alta de cliente',0,'0'),(10,'client_welcome','Email de bienvenida para nuevo cliente',1,'0'),(11,'setup_printer','Email de instalación de impresora',1,'0'),(12,'client-welcome','Email de bienvenida como nuevo cliente.',0,'0'),(13,'printer-setup','Email de instalación y configuración de impresora de coronas.',0,'0'),(14,'sepa-core','Email de solicitud de datos bancarios core.',0,'1'),(15,'letter-debtor-st','Email de aviso inicial por saldo deudor',0,'1'),(16,'letter-debtor-nd','Email de aviso reiterado por saldo deudor',0,'1');
/*!40000 ALTER TABLE `escritos` ENABLE KEYS */;
UNLOCK TABLES;
@ -369,7 +379,7 @@ UNLOCK TABLES;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2018-09-05 11:59:55
-- Dump completed on 2018-09-06 14:58:37
USE `bi`;
-- MySQL dump 10.13 Distrib 5.7.21, for osx10.13 (x86_64)
--
@ -417,7 +427,7 @@ UNLOCK TABLES;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2018-09-05 11:59:55
-- Dump completed on 2018-09-06 14:58:37
USE `cache`;
-- MySQL dump 10.13 Distrib 5.7.21, for osx10.13 (x86_64)
--
@ -455,4 +465,4 @@ UNLOCK TABLES;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2018-09-05 11:59:55
-- Dump completed on 2018-09-06 14:58:37

View File

@ -0,0 +1,11 @@
const app = require(`${servicesDir}/item/server/server`);
describe('item getShipped()', () => {
it('should return 3 entries, the first one with the property balance -100', async() => {
let params = {where: {itemFk: 1, warehouseFk: 2}};
let result = await app.models.Item.getDiary(params);
expect(result.length).toBe(3);
expect(result[0].balance).toBe(-100);
});
});

View File

@ -0,0 +1,10 @@
const app = require(`${servicesDir}/ticket/server/server`);
describe('sale getClaimableFromTicket()', () => {
it('should throw an error if the ticket is not editable', async() => {
let claimableFromTicket = await app.models.Sale.getClaimableFromTicket(16);
expect(claimableFromTicket[0].concept).toBe('Gem of Time');
expect(claimableFromTicket.length).toBe(4);
});
});

View File

@ -1,42 +0,0 @@
module.exports = Self => {
Self.remoteMethod('comboVehicles', {
description: 'returns list of vehicles',
accessType: 'READ',
accepts: [{
arg: 'filter',
type: 'Object',
required: false,
description: 'Filter defining where and paginated data',
http: {source: 'query'}
}],
returns: {
arg: 'data',
type: 'Vehicle',
root: true
},
http: {
path: `/comboVehicles`,
verb: 'get'
}
});
Self.comboVehicles = (filter, callback) => {
Self.find(filter, (_, instances) => {
callback(null, formatOutput(instances));
});
};
function formatOutput(instances) {
let results = [];
for (let instance of instances) {
let numberPlate = ` ${instance.numberPlate}` || '';
results.push({
id: instance.id,
name: `${instance.tradeMark} ${instance.model}${numberPlate}`
});
}
return results;
}
};

View File

@ -1,79 +0,0 @@
module.exports = Self => {
Self.remoteMethod('activeDrivers', {
description: 'returns actives workers with driver role',
accessType: 'READ',
accepts: [{
arg: 'filter',
type: 'Object',
required: false,
description: 'Filter defining where and paginated data',
http: {source: 'query'}
}],
returns: {
arg: 'data',
type: 'Worker',
root: true
},
http: {
path: `/activeDrivers`,
verb: 'get'
}
});
Self.activeDrivers = (filter, callback) => {
let skip = filter.skip || 0;
let limit = filter.limit || 10;
let where = getCondition(filter.where);
// TODO: change salesPerson role to Driver role when it will be created
let query = `SELECT em.id, em.firstName, em.name
FROM worker em
JOIN account.user ac ON em.userFk = ac.id
JOIN account.role r ON r.id = ac.roleFK
WHERE ac.active AND r.\`name\` = 'salesPerson' ${where}
ORDER BY em.name ASC
LIMIT ${limit} OFFSET ${skip}`;
Self.rawSql(query, [], callback)
.then(response => {
callback(null, formatDriver(response));
})
.catch(reject => {
callback(reject, null);
});
};
function getCondition(where) {
let out = [];
if (typeof where === 'object') {
Object.keys(where).forEach(k => {
let value = where[k];
if (typeof value === 'number') {
out.push(`em.${k}=${value}`);
} else if (typeof value === 'string') {
out.push(`em.${k}='${value}'`);
} else if (typeof value === 'boolean' || value === null) {
out.push(`em.${k} IS ${String(value).toUpperCase()}`);
} else if (Object.keys(value).length) {
let firstProperty = Object.keys(value)[0];
out.push(`em.${k} ${firstProperty} '${value[firstProperty]}'`);
} else {
throw new Error('Error: unexpected type');
}
});
}
return out.length ? `AND (${out.join(' AND ')})` : '';
}
function formatDriver(response) {
let results = [];
response.forEach(person => {
results.push({
id: person.id,
name: `${person.firstName} ${person.name}`
});
});
return results;
}
};

View File

@ -1,48 +0,0 @@
module.exports = function(Self) {
Self.installMethod('filter', filterRoutes);
function filterRoutes(params) {
if (params.search)
return searchWhere(params);
return andWhere(params);
}
function searchWhere(params) {
return {
where: {
or: [
{id: params.search},
{name: {regexp: params.search}}
]
},
skip: (parseInt(params.page, 10) - 1) * parseInt(params.size, 10),
limit: parseInt(params.size, 10)
};
}
function andWhere(params) {
let filters = {
where: {},
skip: (parseInt(params.page, 10) - 1) * parseInt(params.size, 10),
limit: parseInt(params.size, 10)
};
delete params.page;
delete params.size;
if (params.phone) {
filters.where.or = [
{phone: params.phone},
{mobile: params.phone}
];
delete params.phone;
}
Object.keys(params).forEach(
key => {
filters.where[key] = {regexp: params[key]};
}
);
return filters;
}
};

View File

@ -1,4 +0,0 @@
module.exports = function(Self) {
require('../methods/filterRoutes.js')(Self);
};

View File

@ -1,5 +0,0 @@
module.exports = function(Self) {
require('../methods/comboVehicles.js')(Self);
require('../methods/drivers.js')(Self);
};