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 => {
|
module.exports = Self => {
|
||||||
Self.remoteMethod('getDeliveryPoint', {
|
Self.remoteMethod('getDeliveryPoint', {
|
||||||
description: 'get the deliveryPoint address ',
|
description: 'get the deliveryPoint address',
|
||||||
accessType: 'WRITE',
|
accessType: 'WRITE',
|
||||||
accepts: {
|
accepts: {
|
||||||
arg: 'vehicleId',
|
arg: 'vehicleId',
|
||||||
type: 'number',
|
type: 'number',
|
||||||
required: true,
|
|
||||||
description: 'vehicle id asigned in the route',
|
description: 'vehicle id asigned in the route',
|
||||||
|
required: true,
|
||||||
http: {source: 'path'}
|
http: {source: 'path'}
|
||||||
},
|
},
|
||||||
returns: {
|
returns: {
|
||||||
|
@ -21,8 +21,9 @@ module.exports = Self => {
|
||||||
Self.getDeliveryPoint = async vehicleId => {
|
Self.getDeliveryPoint = async vehicleId => {
|
||||||
let vehicle = await Self.app.models.Vehicle.findById(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;
|
return deliveryPoint.ubication;
|
||||||
};
|
};
|
||||||
|
|
|
@ -5,9 +5,12 @@
|
||||||
data="$ctrl.tickets"
|
data="$ctrl.tickets"
|
||||||
auto-load="true">
|
auto-load="true">
|
||||||
</vn-crud-model>
|
</vn-crud-model>
|
||||||
<vn-data-viewer model="model">
|
<vn-data-viewer
|
||||||
<form name="form">
|
model="model">
|
||||||
<vn-card class="vn-pa-md">
|
<form
|
||||||
|
class="vn-w-xl"
|
||||||
|
name="form">
|
||||||
|
<vn-card class="vn-pa-lg">
|
||||||
<vn-tool-bar>
|
<vn-tool-bar>
|
||||||
<vn-button
|
<vn-button
|
||||||
icon="icon-wand"
|
icon="icon-wand"
|
||||||
|
@ -22,7 +25,7 @@
|
||||||
</vn-button>
|
</vn-button>
|
||||||
</vn-tool-bar>
|
</vn-tool-bar>
|
||||||
</vn-card>
|
</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-table model="model" auto-load="false" vn-droppable="$ctrl.onDrop($event)">
|
||||||
<vn-thead>
|
<vn-thead>
|
||||||
<vn-tr>
|
<vn-tr>
|
||||||
|
@ -31,14 +34,14 @@
|
||||||
model="model">
|
model="model">
|
||||||
</vn-multi-check>
|
</vn-multi-check>
|
||||||
</vn-th>
|
</vn-th>
|
||||||
<vn-th class="order-field">Order</vn-th>
|
<vn-th>Order</vn-th>
|
||||||
<vn-th number>Ticket</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 expand>Client</vn-th>
|
||||||
<vn-th shrink>Packages</vn-th>
|
<vn-th shrink>Packages</vn-th>
|
||||||
<vn-th shrink>m³</vn-th>
|
<vn-th shrink>m³</vn-th>
|
||||||
<vn-th>Warehouse</vn-th>
|
<vn-th number>Ticket</vn-th>
|
||||||
<vn-th translate-attr="{title: 'Postcode'}" shrink>PC</vn-th>
|
|
||||||
<vn-th expand>Street</vn-th>
|
|
||||||
<vn-th shrink></vn-th>
|
<vn-th shrink></vn-th>
|
||||||
<vn-th shrink></vn-th>
|
<vn-th shrink></vn-th>
|
||||||
</vn-tr>
|
</vn-tr>
|
||||||
|
@ -50,21 +53,18 @@
|
||||||
ng-model="ticket.checked">
|
ng-model="ticket.checked">
|
||||||
</vn-check>
|
</vn-check>
|
||||||
</vn-td>
|
</vn-td>
|
||||||
<vn-td class="order-field">
|
<vn-td>
|
||||||
<vn-input-number
|
<vn-input-number
|
||||||
on-change="$ctrl.setPriority(ticket.id, ticket.priority)"
|
on-change="$ctrl.setPriority(ticket.id, ticket.priority)"
|
||||||
ng-model="ticket.priority"
|
ng-model="ticket.priority"
|
||||||
rule="Ticket"
|
rule="Ticket"
|
||||||
class="dense">
|
class="dense"
|
||||||
|
display-controls=true>
|
||||||
</vn-input-number>
|
</vn-input-number>
|
||||||
</vn-td>
|
</vn-td>
|
||||||
<vn-td number>
|
<vn-td expand title="{{ticket.address.street}}">{{ticket.address.street}}</vn-td>
|
||||||
<span
|
<vn-td expand>{{ticket.address.city}}</vn-td>
|
||||||
ng-click="ticketDescriptor.show($event, ticket.id)"
|
<vn-td shrink>{{ticket.address.postalCode}}</vn-td>
|
||||||
class="link">
|
|
||||||
{{ticket.id}}
|
|
||||||
</span>
|
|
||||||
</vn-td>
|
|
||||||
<vn-td expand>
|
<vn-td expand>
|
||||||
<span
|
<span
|
||||||
ng-click="clientDescriptor.show($event, ticket.clientFk)"
|
ng-click="clientDescriptor.show($event, ticket.clientFk)"
|
||||||
|
@ -74,9 +74,13 @@
|
||||||
</vn-td>
|
</vn-td>
|
||||||
<vn-td shrink>{{ticket.packages}}</vn-td>
|
<vn-td shrink>{{ticket.packages}}</vn-td>
|
||||||
<vn-td shrink>{{::ticket.volume | number:1}}</vn-td>
|
<vn-td shrink>{{::ticket.volume | number:1}}</vn-td>
|
||||||
<vn-td expand>{{ticket.warehouse.name}}</vn-td>
|
<vn-td number>
|
||||||
<vn-td shrink>{{ticket.address.postalCode}}</vn-td>
|
<span
|
||||||
<vn-td expand title="{{ticket.address.street}}">{{ticket.address.street}}</vn-td>
|
ng-click="ticketDescriptor.show($event, ticket.id)"
|
||||||
|
class="link">
|
||||||
|
{{ticket.id}}
|
||||||
|
</span>
|
||||||
|
</vn-td>
|
||||||
<vn-td shrink>
|
<vn-td shrink>
|
||||||
<vn-icon
|
<vn-icon
|
||||||
ng-if="ticket.notes.length"
|
ng-if="ticket.notes.length"
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import ngModule from '../module';
|
import ngModule from '../module';
|
||||||
import Section from 'salix/components/section';
|
import Section from 'salix/components/section';
|
||||||
import './style.scss';
|
import './style.scss';
|
||||||
|
import UserError from 'core/lib/user-error';
|
||||||
|
|
||||||
class Controller extends Section {
|
class Controller extends Section {
|
||||||
get route() {
|
get route() {
|
||||||
|
@ -49,14 +50,18 @@ class Controller extends Section {
|
||||||
}
|
}
|
||||||
|
|
||||||
goToBuscaman() {
|
goToBuscaman() {
|
||||||
|
if (!this.route.vehicleFk)
|
||||||
|
throw new UserError(`The route doesn't have a vehicle`);
|
||||||
let query = `Routes/${this.route.vehicleFk}/getDeliveryPoint`;
|
let query = `Routes/${this.route.vehicleFk}/getDeliveryPoint`;
|
||||||
let deliveryPointAddress;
|
|
||||||
let addresses;
|
|
||||||
|
|
||||||
this.$http.get(query).then(response => {
|
this.$http.get(query).then(response => {
|
||||||
deliveryPointAddress = response.data;
|
if (!response.data)
|
||||||
}).then(() => {
|
throw new UserError(`The route's vehicle doesn't have a departing warehouse`);
|
||||||
addresses = deliveryPointAddress;
|
|
||||||
|
return response.data;
|
||||||
|
}).then(address => {
|
||||||
|
let addresses;
|
||||||
|
if (address) addresses = address;
|
||||||
let lines = this.getSelectedItems(this.tickets);
|
let lines = this.getSelectedItems(this.tickets);
|
||||||
|
|
||||||
let url = 'http://gps.buscalia.com/usuario/localizar.aspx?bmi=true&addr=';
|
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
|
Tickets to add: Tickets a añadir
|
||||||
Ticket not found: No se ha encontrado el ticket
|
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
|
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