#1235 route.basic-data
gitea/salix/dev This commit has test failures Details

This commit is contained in:
Carlos Jimenez Ruiz 2019-03-23 16:16:47 +01:00
parent ce43bd63c9
commit 92738759a3
7 changed files with 125 additions and 9 deletions

View File

@ -353,15 +353,15 @@ INSERT INTO `vn`.`creditInsurance`(`id`, `creditClassification`, `credit`, `crea
(2, 2 , 6000, DATE_ADD(CURDATE(), INTERVAL -2 MONTH), NULL),
(3, 3, 10000 , DATE_ADD(CURDATE(), INTERVAL -3 MONTH), NULL);
INSERT INTO `vn`.`route`(`id`, `workerFk`, `created`, `vehicleFk`, `agencyModeFk`, `description`, `m3`)
INSERT INTO `vn`.`route`(`id`, `workerFk`, `created`, `vehicleFk`, `agencyModeFk`, `description`, `m3`, `cost`, `started`, `finished`)
VALUES
(1, 56, CURDATE(), 1, 1, 'first route', null),
(2, 56, CURDATE(), 1, 1, 'second route', 4.2),
(3, 56, CURDATE(), 2, 7, 'third route', 5.3),
(4, 56, CURDATE(), 3, 7, 'fourth route', 6.4),
(5, 56, CURDATE(), 4, 8, 'fifth route', 7.5),
(6, 57, CURDATE(), 5, 8, 'sixth route', 8.6),
(7, 57, CURDATE(), 6, null, 'seventh route', 9.7);
(1, 56, CURDATE(), 1, 1, 'first route', null, 10, CURDATE(), CURDATE()),
(2, 56, CURDATE(), 1, 1, 'second route', 4.2, 20, CURDATE(), CURDATE()),
(3, 56, CURDATE(), 2, 7, 'third route', 5.3, 30, CURDATE(), CURDATE()),
(4, 56, CURDATE(), 3, 7, 'fourth route', 6.4, 40, CURDATE(), CURDATE()),
(5, 56, CURDATE(), 4, 8, 'fifth route', 7.5, 50, CURDATE(), CURDATE()),
(6, 57, CURDATE(), 5, 8, 'sixth route', 8.6, 60, CURDATE(), CURDATE()),
(7, 57, CURDATE(), 6, null, 'seventh route', 9.7, 70, CURDATE(), CURDATE());
INSERT INTO `vn2008`.`empresa_grupo`(`empresa_grupo_id`, `grupo`)
VALUES

View File

@ -0,0 +1,76 @@
<mg-ajax path="/api/Routes/{{patch.params.id}}" options="vnPatch"></mg-ajax>
<vn-watcher
vn-id="watcher"
data="$ctrl.route"
form="form"
save="patch">
</vn-watcher>
<form name="form" ng-submit="watcher.submit()" compact>
<vn-card pad-large>
<vn-horizontal>
<vn-autocomplete
vn-one
field="$ctrl.route.workerFk"
url="/api/Clients/activeWorkersWithRole"
show-field="nickname"
search-function="{firstName: $search}"
value-field="id"
where="{role: 'employee'}"
label="Worker">
</vn-autocomplete>
<vn-autocomplete
vn-one
field="$ctrl.route.vehicleFk"
url="/api/Vehicles"
show-field="numberPlate"
value-field="id"
label="Vehicle">
</vn-autocomplete>
</vn-horizontal>
<vn-horizontal>
<vn-date-picker
vn-one
label="Created"
model="$ctrl.route.created"
ini-options="{dateFormat: 'd-m-Y'}">
</vn-date-picker>
<vn-autocomplete
vn-one
field="$ctrl.route.agencyModeFk"
url="/api/AgencyModes"
show-field="name"
value-field="id"
label="Agency">
</vn-autocomplete>
</vn-horizontal>
<vn-horizontal>
<vn-textfield
vn-one
label="Km start"
field="$ctrl.route.kmStart">
</vn-textfield>
<vn-textfield
vn-one
label="Km end"
model="$ctrl.route.kmEnd">
</vn-textfield>
</vn-horizontal>
<vn-horizontal>
<vn-date-picker
vn-one
label="Date started"
model="$ctrl.route.started"
ini-options="{dateFormat: 'd-m-Y'}">
</vn-date-picker>
<vn-date-picker
vn-one
label="Date finished"
model="$ctrl.route.finished"
ini-options="{dateFormat: 'd-m-Y'}">
</vn-date-picker>
</vn-horizontal>
</vn-card>
<vn-button-bar>
<vn-submit label="Save"></vn-submit>
</vn-button-bar>
</form>

View File

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

View File

@ -0,0 +1,4 @@
Date finished: Fecha fin
Date started: Fecha inicio
Km start: Km de inicio
Km end: Km de fin

View File

@ -6,7 +6,22 @@ export default class Controller {
this.$stateParams = $stateParams;
this.route = null;
this.filter = {
fields: ['id', 'agencyModeFk', 'created', 'm3', 'warehouseFk', 'description', 'vehicleFk'],
fields: [
'id',
'workerFk',
'agencyModeFk',
'created',
'm3',
'warehouseFk',
'description',
'vehicleFk',
'kmStart',
'kmEnd',
'started',
'finished',
'cost'
],
where: {id: $stateParams.id},
include: [
{

View File

@ -6,3 +6,4 @@ import './descriptor';
import './summary';
import './card';
import './create';
import './basic-data';

View File

@ -4,6 +4,8 @@
"icon": "icon-delivery",
"validations" : true,
"dependencies": ["client", "worker", "ticket"],
"menu": [
{"state": "route.card.basicData", "icon": "settings"}],
"routes": [
{
"url": "/route",
@ -39,6 +41,16 @@
"params": {
"route": "$ctrl.route"
}
},
{
"url": "/basic-data",
"state": "route.card.basicData",
"component": "vn-route-basic-data",
"description": "Basic data",
"params": {
"route": "$ctrl.route"
},
"acl": ["delivery"]
}
]
}