feat(loads::events): Adding date change events
This commit is contained in:
@@ -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
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user