Added zoneFk to routes. solved #1713
gitea/salix/dev This commit looks good Details

This commit is contained in:
Joan Sanchez 2019-10-16 07:18:05 +02:00
parent 25bd28990a
commit 6ed5695063
5 changed files with 35 additions and 12 deletions

View File

@ -0,0 +1,10 @@
ALTER TABLE `vn`.`route`
ADD COLUMN `zoneFk` INT NULL AFTER `description`,
ADD INDEX `fk_route_1_idx` (`zoneFk` ASC);
;
ALTER TABLE `vn`.`route`
ADD CONSTRAINT `fk_route_1`
FOREIGN KEY (`zoneFk`)
REFERENCES `vn`.`zone` (`id`)
ON DELETE RESTRICT
ON UPDATE CASCADE;

View File

@ -69,6 +69,11 @@
"type": "hasMany",
"model": "Ticket",
"foreignKey": "routeFk"
}
},
"zone": {
"type": "belongsTo",
"model": "Zone",
"foreignKey": "zoneFk"
}
}
}

View File

@ -19,7 +19,8 @@ export default class Controller {
'kmEnd',
'started',
'finished',
'cost'
'cost',
'zoneFk'
],
where: {id: $stateParams.id},
@ -35,6 +36,12 @@ export default class Controller {
scope: {
fields: ['id', 'm3']
}
},
{
relation: 'zone',
scope: {
fields: ['id', 'name']
}
}
]
};

View File

@ -29,6 +29,9 @@
<vn-label-value label="Agency"
value="{{$ctrl.route.agencyMode.name}}">
</vn-label-value>
<vn-label-value label="Zone"
value="{{$ctrl.route.zone.name}}">
</vn-label-value>
<vn-label-value label="Volume"
value="{{$ctrl.route.m3 | dashIfEmpty}} / {{$ctrl.route.vehicle.m3 | dashIfEmpty}} m³">
</vn-label-value>

View File

@ -34,8 +34,8 @@
</vn-multi-check>
</vn-th>
<vn-th>Order</vn-th>
<vn-th number>Ticket id</vn-th>
<vn-th>Alias</vn-th>
<vn-th number>Ticket</vn-th>
<vn-th>Client</vn-th>
<vn-th number shrink>Packages</vn-th>
<vn-th shrink></vn-th>
<vn-th shrink>Warehouse</vn-th>
@ -53,13 +53,11 @@
</vn-check>
</vn-td>
<vn-td>
<vn-textfield
tab-index="-1"
type="number"
<vn-input-number
on-change="$ctrl.setPriority(ticket.id, ticket.priority)"
ng-model="ticket.priority"
rule="Ticket">
</vn-textfield>
</vn-input-number>
</vn-td>
<vn-td number>
<span
@ -81,15 +79,15 @@
<vn-td shrink>{{ticket.client.postcode}}</vn-td>
<vn-td expand title="{{ticket.client.street}}">{{ticket.client.street}}</vn-td>
<vn-td shrink>
<vn-icon
<vn-icon-button
ng-if="ticket.notes.length"
vn-tooltip="{{ticket.notes[0].description}}"
title="::{{ticket.notes[0].description}}"
icon="insert_drive_file">
</vn-icon>
</vn-icon-button>
</vn-td>
<vn-td>
<vn-icon-button
vn-tooltip="Remove ticket"
translate-attr="::{title: 'Remove ticket'}"
icon="delete"
ng-click="$ctrl.showDeleteConfirm(ticket.id)"
tabindex="-1">