Merge pull request 'routes without vehicle or vehicles without drop off now throw' (#619) from 2896-route_tickets_refactor into dev
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
Reviewed-on: #619 Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
This commit is contained in:
commit
e384dd4a7a
|
@ -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,12 @@
|
|||
data="$ctrl.tickets"
|
||||
auto-load="true">
|
||||
</vn-crud-model>
|
||||
<vn-data-viewer model="model">
|
||||
<form name="form">
|
||||
<vn-card class="vn-pa-md">
|
||||
<vn-data-viewer
|
||||
model="model">
|
||||
<form
|
||||
class="vn-w-xl"
|
||||
name="form">
|
||||
<vn-card class="vn-pa-lg">
|
||||
<vn-tool-bar>
|
||||
<vn-button
|
||||
icon="icon-wand"
|
||||
|
@ -22,7 +25,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 +34,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 +53,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 +74,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 departing warehouse`);
|
||||
|
||||
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 departing warehouse: El vehículo de la ruta no tiene un almacén de salida
|
||||
The route doesn't have a vehicle: La ruta no tiene un vehículo
|
Loading…
Reference in New Issue