feat(loads::events): Adding date change events

This commit is contained in:
Josepablo C
2025-07-22 23:27:37 -06:00
parent f2d8eb43bd
commit df1dcaab71
8 changed files with 204 additions and 21 deletions

View File

@@ -56,7 +56,6 @@ async function onProposalVehicleChanged( notification_type, content ){
}
}
async function onLoadLoading( notification_type, content ){
const { load, carrier, product, vehicle, driver } = content;
@@ -105,6 +104,38 @@ async function onLoadDelivered( notification_type, content ){
}
}
async function onLoadLoadDateChanged( notification_type, content ){
const { warehouse, load, carrier, product, vehicle, driver } = content;
switch ( notification_type ){
case NOTIFICATION_TYPE.CLIENT:
return await ClientEvents.onLoadLoadDateChanged( load, carrier, product, vehicle, driver );
case NOTIFICATION_TYPE.WAREHOUSE:
return await WarehouseEvents.onLoadLoadDateChanged( warehouse, load, carrier, product, vehicle, driver );
case NOTIFICATION_TYPE.BOTH:
await WarehouseEvents.onLoadLoadDateChanged( warehouse, load, carrier, product, vehicle, driver );
await ClientEvents.onLoadLoadDateChanged( load, carrier, product, vehicle, driver );
default:
return;
}
}
async function onLoadDownloadDateChanged( notification_type, content ){
const { warehouse, load, carrier, product, vehicle, driver } = content;
switch ( notification_type ){
case NOTIFICATION_TYPE.CLIENT:
return await ClientEvents.onLoadDownloadDateChanged( load, carrier, product, vehicle, driver );
case NOTIFICATION_TYPE.WAREHOUSE:
return await WarehouseEvents.onLoadDownloadDateChanged( warehouse, load, carrier, product, vehicle, driver );
case NOTIFICATION_TYPE.BOTH:
await WarehouseEvents.onLoadDownloadDateChanged( warehouse, load, carrier, product, vehicle, driver );
await ClientEvents.onLoadDownloadDateChanged( load, carrier, product, vehicle, driver );
default:
return;
}
}
module.exports = {
NOTIFICATION_TYPE,
onProposalAccepted,
@@ -114,4 +145,6 @@ module.exports = {
onLoadInTransit,
onLoadDownload,
onLoadDelivered,
onLoadLoadDateChanged,
onLoadDownloadDateChanged
};