routes without vehicle or vehicles without drop off now throw
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
deeb306b1a
commit
245243aa14
|
@ -1,12 +1,12 @@
|
|||
module.exports = Self => {
|
||||
Self.remoteMethod('getDeliveryPoint', {
|
||||
description: 'get the deliveryPoint address ',
|
||||
description: 'get the deliveryPoint address',
|
||||
accessType: 'WRITE',
|
||||
accepts: {
|
||||
arg: 'vehicleId',
|
||||
type: 'number',
|
||||
required: true,
|
||||
description: 'vehicle id asigned in the route',
|
||||
required: true,
|
||||
http: {source: 'path'}
|
||||
},
|
||||
returns: {
|
||||
|
@ -21,8 +21,9 @@ module.exports = Self => {
|
|||
Self.getDeliveryPoint = async vehicleId => {
|
||||
let vehicle = await Self.app.models.Vehicle.findById(vehicleId);
|
||||
|
||||
let deliveryPoint = await Self.app.models.DeliveryPoint.findById(vehicle.deliveryPointFk);
|
||||
if (!vehicle.deliveryPointFk) return;
|
||||
|
||||
let deliveryPoint = await Self.app.models.DeliveryPoint.findById(vehicle.deliveryPointFk);
|
||||
|
||||
return deliveryPoint.ubication;
|
||||
};
|
||||
|
|
|
@ -5,9 +5,10 @@
|
|||
data="$ctrl.tickets"
|
||||
auto-load="true">
|
||||
</vn-crud-model>
|
||||
<vn-data-viewer model="model">
|
||||
<vn-data-viewer
|
||||
model="model">
|
||||
<form name="form">
|
||||
<vn-card class="vn-pa-md">
|
||||
<vn-card class="vn-pa-lg">
|
||||
<vn-tool-bar>
|
||||
<vn-button
|
||||
icon="icon-wand"
|
||||
|
@ -22,7 +23,7 @@
|
|||
</vn-button>
|
||||
</vn-tool-bar>
|
||||
</vn-card>
|
||||
<vn-card class="vn-mt-md">
|
||||
<vn-card class="vn-mt-lg">
|
||||
<vn-table model="model" auto-load="false" vn-droppable="$ctrl.onDrop($event)">
|
||||
<vn-thead>
|
||||
<vn-tr>
|
||||
|
@ -31,14 +32,14 @@
|
|||
model="model">
|
||||
</vn-multi-check>
|
||||
</vn-th>
|
||||
<vn-th class="order-field">Order</vn-th>
|
||||
<vn-th number>Ticket</vn-th>
|
||||
<vn-th>Order</vn-th>
|
||||
<vn-th expand>Street</vn-th>
|
||||
<vn-th>City</vn-th>
|
||||
<vn-th translate-attr="{title: 'Postcode'}" shrink>PC</vn-th>
|
||||
<vn-th expand>Client</vn-th>
|
||||
<vn-th shrink>Packages</vn-th>
|
||||
<vn-th shrink>m³</vn-th>
|
||||
<vn-th>Warehouse</vn-th>
|
||||
<vn-th translate-attr="{title: 'Postcode'}" shrink>PC</vn-th>
|
||||
<vn-th expand>Street</vn-th>
|
||||
<vn-th number>Ticket</vn-th>
|
||||
<vn-th shrink></vn-th>
|
||||
<vn-th shrink></vn-th>
|
||||
</vn-tr>
|
||||
|
@ -50,21 +51,18 @@
|
|||
ng-model="ticket.checked">
|
||||
</vn-check>
|
||||
</vn-td>
|
||||
<vn-td class="order-field">
|
||||
<vn-td>
|
||||
<vn-input-number
|
||||
on-change="$ctrl.setPriority(ticket.id, ticket.priority)"
|
||||
ng-model="ticket.priority"
|
||||
rule="Ticket"
|
||||
class="dense">
|
||||
class="dense"
|
||||
display-controls=true>
|
||||
</vn-input-number>
|
||||
</vn-td>
|
||||
<vn-td number>
|
||||
<span
|
||||
ng-click="ticketDescriptor.show($event, ticket.id)"
|
||||
class="link">
|
||||
{{ticket.id}}
|
||||
</span>
|
||||
</vn-td>
|
||||
<vn-td expand title="{{ticket.address.street}}">{{ticket.address.street}}</vn-td>
|
||||
<vn-td expand>{{ticket.address.city}}</vn-td>
|
||||
<vn-td shrink>{{ticket.address.postalCode}}</vn-td>
|
||||
<vn-td expand>
|
||||
<span
|
||||
ng-click="clientDescriptor.show($event, ticket.clientFk)"
|
||||
|
@ -74,9 +72,13 @@
|
|||
</vn-td>
|
||||
<vn-td shrink>{{ticket.packages}}</vn-td>
|
||||
<vn-td shrink>{{::ticket.volume | number:1}}</vn-td>
|
||||
<vn-td expand>{{ticket.warehouse.name}}</vn-td>
|
||||
<vn-td shrink>{{ticket.address.postalCode}}</vn-td>
|
||||
<vn-td expand title="{{ticket.address.street}}">{{ticket.address.street}}</vn-td>
|
||||
<vn-td number>
|
||||
<span
|
||||
ng-click="ticketDescriptor.show($event, ticket.id)"
|
||||
class="link">
|
||||
{{ticket.id}}
|
||||
</span>
|
||||
</vn-td>
|
||||
<vn-td shrink>
|
||||
<vn-icon
|
||||
ng-if="ticket.notes.length"
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import ngModule from '../module';
|
||||
import Section from 'salix/components/section';
|
||||
import './style.scss';
|
||||
import UserError from 'core/lib/user-error';
|
||||
|
||||
class Controller extends Section {
|
||||
get route() {
|
||||
|
@ -49,14 +50,18 @@ class Controller extends Section {
|
|||
}
|
||||
|
||||
goToBuscaman() {
|
||||
if (!this.route.vehicleFk)
|
||||
throw new UserError(`The route doesn't have a vehicle`);
|
||||
let query = `Routes/${this.route.vehicleFk}/getDeliveryPoint`;
|
||||
let deliveryPointAddress;
|
||||
let addresses;
|
||||
|
||||
this.$http.get(query).then(response => {
|
||||
deliveryPointAddress = response.data;
|
||||
}).then(() => {
|
||||
addresses = deliveryPointAddress;
|
||||
if (!response.data)
|
||||
throw new UserError(`The route's vehicle doesn't have a delivery point`);
|
||||
|
||||
return response.data;
|
||||
}).then(address => {
|
||||
let addresses;
|
||||
if (address) addresses = address;
|
||||
let lines = this.getSelectedItems(this.tickets);
|
||||
|
||||
let url = 'http://gps.buscalia.com/usuario/localizar.aspx?bmi=true&addr=';
|
||||
|
|
|
@ -8,4 +8,6 @@ Add ticket: Añadir ticket
|
|||
Tickets to add: Tickets a añadir
|
||||
Ticket not found: No se ha encontrado el ticket
|
||||
The selected ticket is not suitable for this route: El ticket seleccionado no es apto para esta ruta
|
||||
PC: CP
|
||||
PC: CP
|
||||
The route's vehicle doesn't have a delivery point: El vehículo de la ruta no tiene un punto de entrega
|
||||
The route doesn't have a vehicle: La ruta no tiene un vehículo
|
Loading…
Reference in New Issue