36 lines
1.4 KiB
JavaScript
36 lines
1.4 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);
|
|
|
|
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();
|
|
};
|
|
};
|