route.basicData validations
gitea/salix/2124-route_basic_data This commit looks good
Details
gitea/salix/2124-route_basic_data This commit looks good
Details
This commit is contained in:
parent
af51c2632e
commit
bfb8c5e138
|
@ -126,5 +126,6 @@
|
|||
"MESSAGE_CHANGED_PAYMETHOD": "He cambiado la forma de pago del cliente [{{clientName}} (#{{clientId}})]({{{url}}})",
|
||||
"Sent units from ticket": "Envio *{{quantity}}* unidades de [{{concept}} (#{{itemId}})]({{{itemUrl}}}) a *\"{{nickname}}\"* provenientes del ticket id [#{{ticketId}}]({{{ticketUrl}}})",
|
||||
"Client checked as validated despite of duplication": "Cliente comprobado a pesar de que existe el cliente id {{clientId}}",
|
||||
"ORDER_ROW_UNAVAILABLE": "No hay disponibilidad de este producto"
|
||||
"ORDER_ROW_UNAVAILABLE": "No hay disponibilidad de este producto",
|
||||
"Distance must be lesser than 1000": "La distancia debe ser inferior a 1000"
|
||||
}
|
|
@ -5,4 +5,21 @@ module.exports = Self => {
|
|||
require('../methods/route/guessPriority')(Self);
|
||||
require('../methods/route/updateVolume')(Self);
|
||||
require('../methods/route/getDeliveryPoint')(Self);
|
||||
|
||||
Self.validate('kmStart', validateDistance, {
|
||||
message: 'Distance must be lesser than 1000'
|
||||
});
|
||||
|
||||
Self.validate('kmEnd', validateDistance, {
|
||||
message: 'Distance must be lesser than 1000'
|
||||
});
|
||||
|
||||
function validateDistance(err) {
|
||||
const routeTotalKm = this.kmEnd - this.kmStart;
|
||||
const routeMaxKm = 1000;
|
||||
if ( routeTotalKm > routeMaxKm || this.kmStart > this.kmEnd)
|
||||
err();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
import ngModule from '../module';
|
||||
|
||||
class Controller {
|
||||
constructor($scope) {
|
||||
constructor($scope, vnApp, $translate) {
|
||||
this.$ = $scope;
|
||||
this.vnApp = vnApp;
|
||||
this.$translate = $translate;
|
||||
}
|
||||
|
||||
onSubmit() {
|
||||
|
@ -11,7 +13,7 @@ class Controller {
|
|||
});
|
||||
}
|
||||
}
|
||||
Controller.$inject = ['$scope'];
|
||||
Controller.$inject = ['$scope', 'vnApp', '$translate'];
|
||||
|
||||
ngModule.component('vnRouteBasicData', {
|
||||
template: require('./index.html'),
|
||||
|
|
|
@ -2,4 +2,4 @@ Date finished: Fecha fin
|
|||
Date started: Fecha inicio
|
||||
Km start: Km de inicio
|
||||
Km end: Km de fin
|
||||
Description: Descripción
|
||||
Description: Descripción
|
||||
|
|
Loading…
Reference in New Issue