41 lines
1.6 KiB
JavaScript
41 lines
1.6 KiB
JavaScript
module.exports = Self => {
|
|
require('../methods/route/filter')(Self);
|
|
require('../methods/route/summary')(Self);
|
|
require('../methods/route/getTickets')(Self);
|
|
require('../methods/route/guessPriority')(Self);
|
|
require('../methods/route/updateVolume')(Self);
|
|
require('../methods/route/getDeliveryPoint')(Self);
|
|
require('../methods/route/insertTicket')(Self);
|
|
require('../methods/route/clone')(Self);
|
|
require('../methods/route/getSuggestedTickets')(Self);
|
|
require('../methods/route/unlink')(Self);
|
|
require('../methods/route/updateWorkCenter')(Self);
|
|
require('../methods/route/driverRoutePdf')(Self);
|
|
require('../methods/route/driverRouteEmail')(Self);
|
|
require('../methods/route/sendSms')(Self);
|
|
require('../methods/route/downloadZip')(Self);
|
|
require('../methods/route/cmr')(Self);
|
|
require('../methods/route/getExternalCmrs')(Self);
|
|
require('../methods/route/downloadCmrsZip')(Self);
|
|
require('../methods/route/cmrEmail')(Self);
|
|
require('../methods/route/getExpeditionSummary')(Self);
|
|
require('../methods/route/getByWorker')(Self);
|
|
|
|
Self.validate('kmStart', validateDistance, {
|
|
message: 'Distance must be lesser than 4000'
|
|
});
|
|
|
|
Self.validate('kmEnd', validateDistance, {
|
|
message: 'Distance must be lesser than 4000'
|
|
});
|
|
|
|
function validateDistance(err) {
|
|
if (this.kmEnd) {
|
|
const routeTotalKm = this.kmEnd - this.kmStart;
|
|
const routeMaxKm = 4000;
|
|
if (routeTotalKm > routeMaxKm || this.kmStart > this.kmEnd)
|
|
err();
|
|
}
|
|
}
|
|
};
|