feat(loads::events): Adding load state events
This commit is contained in:
@@ -56,4 +56,62 @@ async function onProposalVehicleChanged( notification_type, content ){
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = { NOTIFICATION_TYPE, onProposalAccepted, onProposalDriverChanged, onProposalVehicleChanged };
|
||||
|
||||
async function onLoadLoading( notification_type, content ){
|
||||
const { load, carrier, product, vehicle, driver } = content;
|
||||
|
||||
switch ( notification_type ){
|
||||
case NOTIFICATION_TYPE.CLIENT:
|
||||
case NOTIFICATION_TYPE.BOTH:
|
||||
return await ClientEvents.onLoadLoading( load, carrier, product, vehicle, driver );
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
async function onLoadInTransit( notification_type, content ){
|
||||
const { load, carrier, product, vehicle, driver } = content;
|
||||
|
||||
switch ( notification_type ){
|
||||
case NOTIFICATION_TYPE.CLIENT:
|
||||
case NOTIFICATION_TYPE.BOTH:
|
||||
return await ClientEvents.onLoadInTransit( load, carrier, product, vehicle, driver );
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
async function onLoadDownload( notification_type, content ){
|
||||
const { load, carrier, product, vehicle, driver } = content;
|
||||
|
||||
switch ( notification_type ){
|
||||
case NOTIFICATION_TYPE.CLIENT:
|
||||
case NOTIFICATION_TYPE.BOTH:
|
||||
return await ClientEvents.onLoadDownload( load, carrier, onLoadOnDownload, vehicle, driver );
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
async function onLoadDelivered( notification_type, content ){
|
||||
const { load, carrier, product, vehicle, driver } = content;
|
||||
|
||||
switch ( notification_type ){
|
||||
case NOTIFICATION_TYPE.CLIENT:
|
||||
case NOTIFICATION_TYPE.BOTH:
|
||||
return await ClientEvents.onLoadDelivered( load, carrier, product, vehicle, driver );
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
NOTIFICATION_TYPE,
|
||||
onProposalAccepted,
|
||||
onProposalDriverChanged,
|
||||
onProposalVehicleChanged,
|
||||
onLoadLoading,
|
||||
onLoadInTransit,
|
||||
onLoadDownload,
|
||||
onLoadDelivered,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user