I have spent quite a bit of time searching and not finding anything that solves my problem. So be nice if this is something already answered.
My implementation has each user role seeing a different set of events on the schedule. Some events will never be visible to some roles, but rooms are available to all roles. When a user creates/edits/drags & drop an event I have a callback to check the status of rooms (a true/false and a list of consumed times). On the popup I can call back on select change and disable that room, but on the drag and drop I am running into issues.
Below is my idea of what I need to happen.
- Cancel the dataProcessor call. Re enable after callback completes.
- Call my custom route
- If no conflict, enable dataProcessor and allow event to be saved.
- If conflict, notify user (if drag and drop move back to previous location) or refresh to pre drag state.
Here is my code on the event collision.
scheduler.attachEvent("onEventCollision", function (ev, evs) {
dp.setUpdateMode("off");
if(!$scope.checkConflict){
$scope.checkConflict = true;
$http({
url: '/event/is-room-available',
method: 'POST',
data: {
location_id: ev.location_id,
room_id: ev.room_id,
start_date: moment(ev.start_date).format("YYYY-MM-DD HH:mm"),
end_date: moment(ev.end_date).format("YYYY-MM-DD HH:mm")
},
headers: {
'Content-Type': 'application/json'
}
}).success(function (data, status, headers, config) {
if(!data.d.iavl){
return true;
}
else{
return false;
}
}).error(function (data, status, headers, config) {
return false;
});
}
});
Thanks in advance.