feat: refs #7296 roadmapStop #2461
|
@ -62,12 +62,12 @@ module.exports = Self => {
|
|||
|
||||
const clone = await models.Roadmap.create(roadmap, options);
|
||||
|
||||
const expeditionTrucks = roadmap.expeditionTruck();
|
||||
expeditionTrucks.map(expeditionTruck => {
|
||||
expeditionTruck.roadmapFk = clone.id;
|
||||
return expeditionTruck;
|
||||
const roadmapStops = roadmap.roadmapStop();
|
||||
roadmapStops.map(roadmapStop => {
|
||||
roadmapStop.roadmapFk = clone.id;
|
||||
return roadmapStop;
|
||||
});
|
||||
await models.ExpeditionTruck.create(expeditionTrucks, options);
|
||||
await models.RoadmapStop.create(roadmapStops, options);
|
||||
}
|
||||
|
||||
await tx.commit();
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
"DeliveryPoint": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"ExpeditionTruck": {
|
||||
"RoadmapStop": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"Roadmap": {
|
||||
|
|
|
@ -54,9 +54,9 @@
|
|||
"model": "Supplier",
|
||||
"foreignKey": "supplierFk"
|
||||
},
|
||||
"expeditionTruck": {
|
||||
"roadmapStop": {
|
||||
robert marked this conversation as resolved
Outdated
|
||||
"type": "hasMany",
|
||||
"model": "ExpeditionTruck",
|
||||
"model": "RoadmapStop",
|
||||
robert marked this conversation as resolved
Outdated
alexm
commented
PascalCase PascalCase
|
||||
"foreignKey": "roadmapFk"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
{
|
||||
"name": "ExpeditionTruck",
|
||||
"name": "RoadmapStop",
|
||||
"base": "VnModel",
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "expeditionTruck"
|
||||
"table": "roadmapStop"
|
||||
}
|
||||
},
|
||||
"properties": {
|
|
@ -1,22 +1,22 @@
|
|||
<vn-crud-model
|
||||
vn-id="model"
|
||||
url="ExpeditionTrucks"
|
||||
url="RoadmapStops"
|
||||
where="{roadmapFk: $ctrl.$params.id}"
|
||||
order="eta ASC"
|
||||
data="$ctrl.expeditionTrucks"
|
||||
data="$ctrl.roadmapStops"
|
||||
auto-load="true">
|
||||
</vn-crud-model>
|
||||
<vn-watcher
|
||||
vn-id="watcher"
|
||||
data="$ctrl.expeditionTrucks"
|
||||
data="$ctrl.roadmapStops"
|
||||
form="form">
|
||||
</vn-watcher>
|
||||
<form class="vn-w-md" name="form" ng-submit="$ctrl.onSubmit()">
|
||||
<vn-card class="vn-pa-lg">
|
||||
<vn-horizontal ng-repeat="expeditionTruck in $ctrl.expeditionTrucks">
|
||||
<vn-horizontal ng-repeat="roadmapStop in $ctrl.roadmapStops">
|
||||
<vn-autocomplete vn-one
|
||||
label="Warehouse"
|
||||
ng-model="expeditionTruck.warehouseFk"
|
||||
ng-model="roadmapStop.warehouseFk"
|
||||
url="Warehouses"
|
||||
show-field="name"
|
||||
value-field="id"
|
||||
|
@ -25,18 +25,18 @@
|
|||
</vn-autocomplete>
|
||||
<vn-date-picker vn-one
|
||||
label="ETA date"
|
||||
ng-model="expeditionTruck.eta"
|
||||
ng-model="roadmapStop.eta"
|
||||
rule>
|
||||
</vn-date-picker>
|
||||
<vn-input-time
|
||||
vn-one
|
||||
label="ETA hour"
|
||||
ng-model="expeditionTruck.eta">
|
||||
ng-model="roadmapStop.eta">
|
||||
</vn-input-time>
|
||||
<vn-textArea
|
||||
vn-one
|
||||
label="Description"
|
||||
ng-model="expeditionTruck.description"
|
||||
ng-model="roadmapStop.description"
|
||||
rule>
|
||||
</vn-textArea>
|
||||
<vn-none>
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
vn-bind="+"
|
||||
vn-tooltip="Add stop"
|
||||
icon="add_circle"
|
||||
vn-click-stop="addExpeditionTruck.show()">
|
||||
vn-click-stop="addRoadmapStop.show()">
|
||||
</vn-icon-button>
|
||||
</a>
|
||||
</h4>
|
||||
|
@ -61,9 +61,9 @@
|
|||
</vn-tr>
|
||||
</vn-thead>
|
||||
<vn-tbody>
|
||||
<vn-tr ng-repeat="expeditionTruck in summary.expeditionTruck">
|
||||
<vn-td>{{expeditionTruck.warehouse.name}}</vn-td>
|
||||
<vn-td expand>{{expeditionTruck.eta | date:'dd/MM/yyyy HH:mm'}}</vn-td>
|
||||
<vn-tr ng-repeat="roadmapStop in summary.roadmapStop">
|
||||
<vn-td>{{roadmapStop.warehouse.name}}</vn-td>
|
||||
<vn-td expand>{{roadmapStop.eta | date:'dd/MM/yyyy HH:mm'}}</vn-td>
|
||||
</vn-tr>
|
||||
</vn-tbody>
|
||||
</vn-table>
|
||||
|
@ -75,14 +75,14 @@
|
|||
</vn-supplier-descriptor-popover>
|
||||
|
||||
<vn-dialog
|
||||
vn-id="addExpeditionTruck"
|
||||
vn-id="addRoadmapStop"
|
||||
on-open="$ctrl.getETD()"
|
||||
on-accept="$ctrl.onAddAccept()">
|
||||
<tpl-body>
|
||||
<vn-horizontal>
|
||||
<vn-autocomplete
|
||||
label="Warehouse"
|
||||
ng-model="$ctrl.expeditionTruck.warehouseFk"
|
||||
ng-model="$ctrl.roadmapStop.warehouseFk"
|
||||
url="Warehouses"
|
||||
show-field="name"
|
||||
value-field="id"
|
||||
|
@ -93,18 +93,18 @@
|
|||
<vn-horizontal>
|
||||
<vn-date-picker
|
||||
label="ETA date"
|
||||
ng-model="$ctrl.expeditionTruck.eta"
|
||||
ng-model="$ctrl.roadmapStop.eta"
|
||||
rule>
|
||||
</vn-date-picker>
|
||||
<vn-input-time
|
||||
label="ETA hour"
|
||||
ng-model="$ctrl.expeditionTruck.eta">
|
||||
ng-model="$ctrl.roadmapStop.eta">
|
||||
</vn-input-time>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal>
|
||||
<vn-textArea
|
||||
label="Description"
|
||||
ng-model="$ctrl.expeditionTruck.description"
|
||||
ng-model="$ctrl.roadmapStop.description"
|
||||
rule>
|
||||
</vn-textArea>
|
||||
</vn-horizontal>
|
||||
|
|
|
@ -20,7 +20,7 @@ class Controller extends Component {
|
|||
include: [
|
||||
{relation: 'supplier'},
|
||||
{relation: 'worker'},
|
||||
{relation: 'expeditionTruck',
|
||||
{relation: 'roadmapStop',
|
||||
robert marked this conversation as resolved
Outdated
alexm
commented
roadmapStop roadmapStop
|
||||
scope: {
|
||||
include: [
|
||||
{relation: 'warehouse'}
|
||||
|
@ -36,19 +36,19 @@ class Controller extends Component {
|
|||
const eta = new Date(this.roadmap.etd);
|
||||
eta.setDate(eta.getDate() + 1);
|
||||
|
||||
this.expeditionTruck = {eta: eta};
|
||||
this.roadmapStop = {eta: eta};
|
||||
}
|
||||
|
||||
onAddAccept() {
|
||||
try {
|
||||
const data = {
|
||||
roadmapFk: this.roadmap.id,
|
||||
warehouseFk: this.expeditionTruck.warehouseFk,
|
||||
eta: this.expeditionTruck.eta,
|
||||
description: this.expeditionTruck.description
|
||||
warehouseFk: this.roadmapStop.warehouseFk,
|
||||
eta: this.roadmapStop.eta,
|
||||
description: this.roadmapStop.description
|
||||
};
|
||||
|
||||
this.$http.post(`ExpeditionTrucks`, data)
|
||||
this.$http.post(`RoadmapStops`, data)
|
||||
robert marked this conversation as resolved
Outdated
alexm
commented
En PascalCase En PascalCase
|
||||
.then(() => {
|
||||
this.loadData();
|
||||
this.vnApp.showSuccess(this.$t('Data saved!'));
|
||||
|
|
|
@ -23,9 +23,9 @@
|
|||
}
|
||||
},
|
||||
"relations": {
|
||||
"expeditionTruck": {
|
||||
"roadmapStop": {
|
||||
robert marked this conversation as resolved
Outdated
alexm
commented
Hi ha que canviar també el nom de la relacio Hi ha que canviar també el nom de la relacio
alexm
commented
En camelCase En camelCase
|
||||
"type": "belongsTo",
|
||||
"model": "ExpeditionTruck",
|
||||
"model": "RoadmapStop",
|
||||
"foreignKey": "truckFk"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -227,7 +227,7 @@ localFixtures:
|
|||
- expeditionScan
|
||||
- expeditionState
|
||||
- expeditionStateType
|
||||
- expeditionTruck
|
||||
- roadmapStop
|
||||
- expense
|
||||
- genus
|
||||
- greuge
|
||||
|
|
Loading…
Reference in New Issue
Hi ha que canviar també el nom de la relacio