Custom conflict (i.e. room)

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.

  1. Cancel the dataProcessor call. Re enable after callback completes.
  2. Call my custom route
  3. If no conflict, enable dataProcessor and allow event to be saved.
  4. 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.

Hello,

.success(function (data, status, headers, config) { if(!data.d.iavl){ return true; } else{ return false; } }you can’t return a result of the ajax callback from the event handler. The async ajax handler will hit after the onEventCollision handler is finished and has returned value.

You can return false from the event to block the change, but preserve values, and if you have a confirmation from the server you can reapply changes through API.