salix/modules/route/back/models/route.js

39 lines
1.5 KiB
JavaScript
Raw Normal View History

2019-03-22 10:10:23 +00:00
module.exports = Self => {
2019-04-25 06:28:08 +00:00
require('../methods/route/filter')(Self);
2019-03-22 10:10:23 +00:00
require('../methods/route/summary')(Self);
2019-03-25 12:16:34 +00:00
require('../methods/route/getTickets')(Self);
2019-04-04 11:06:41 +00:00
require('../methods/route/guessPriority')(Self);
require('../methods/route/updateVolume')(Self);
require('../methods/route/getDeliveryPoint')(Self);
require('../methods/route/insertTicket')(Self);
2020-12-24 10:31:20 +00:00
require('../methods/route/clone')(Self);
require('../methods/route/getSuggestedTickets')(Self);
require('../methods/route/unlink')(Self);
require('../methods/route/updateWorkCenter')(Self);
2022-09-26 06:07:45 +00:00
require('../methods/route/driverRoutePdf')(Self);
require('../methods/route/driverRouteEmail')(Self);
2022-10-20 13:04:25 +00:00
require('../methods/route/sendSms')(Self);
require('../methods/route/downloadZip')(Self);
2023-08-02 05:35:40 +00:00
require('../methods/route/cmr')(Self);
2023-08-08 12:16:47 +00:00
require('../methods/route/getExternalCmrs')(Self);
2023-09-01 10:10:39 +00:00
require('../methods/route/downloadCmrsZip')(Self);
2024-01-23 13:13:40 +00:00
require('../methods/route/cmrEmail')(Self);
require('../methods/route/getExpeditionSummary')(Self);
2023-11-22 14:54:38 +00:00
require('../methods/route/getByWorker')(Self);
2020-02-18 11:51:29 +00:00
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;
2020-11-20 11:12:06 +00:00
if (routeTotalKm > routeMaxKm || this.kmStart > this.kmEnd)
2020-02-18 11:51:29 +00:00
err();
}
2019-03-22 10:10:23 +00:00
};