Avoid creating an appoiment inside a slot that is busy for another one when resource allowmultiple is true

I woud like to create an appoiment based in a cell and resource availabily. For example. If I open the Appoiment Window editor and click for searching resource sugestion It could only show those resources availables on the time interval I chose, So resources that have already an appoiment in this time interval don't apear in suggestion list. Is it possible? I am working with the Javascript  EJ1. How can I do to that?

3 Replies

BS Balasubramanian Sattanathan Syncfusion Team April 27, 2020 11:02 AM UTC

Hi Alba, 

Greetings from Syncfusion Support. 

We have validated your reported “Avoid creating an appoiment inside a slot that is busy for another one when resource allowmultiple is true” problem at our side and prepared a sample based on that using beforeAppointmentCreate like below code snippet. In the below sample, we have restricted the appointment creation for the slots if those have appointments already. 

function OnBeforeAppointmentCreate(args) { // this function will be called while saving an app 
                var schObj = $("#Schedule1").ejSchedule('instance'); 
                if (ej.isNullOrUndefined(args.appointment[0])) 
                                obj = args.appointment; 
                else 
                                obj = args.appointment[0]; 
                var predicate = ej.Predicate(schObj._appointmentSettings["startTime"], ej.FilterOperators.lessThanOrEqual, new Date(obj.StartTime)).and(schObj._appointmentSettings["endTime"], ej.FilterOperators.greaterThanOrEqual, new Date(new Date(obj.EndTime))); 
                // if newly rendered appointment range has an another appointment it will be retrieved here 
                var newAppList = new ej.DataManager(schObj._processed).executeLocal(new ej.Query().where(predicate)); 
                if (newAppList.length > 0) // 0 indicates no more 1 app should render in same range 
                                args.cancel = true; 

  
Kindly try the above sample and let us know if you need further assistance. 

Regards, 
Balasubramanian S 



AL Alba April 28, 2020 10:11 PM UTC

Hi, 

Thanks for your answer. It partially works on my application, It only does that when I want to set an appoiment for one of the resources, but when I choose more than one resources It does not work as I expected because the appoiment is created for the other even if they are busy  on the same time interval. I am using the horizontal way. I would like to see in the suggestion list when I open the Appoiment Window only the people that have the same time available, those who are busy on the same time interval I chose can not appear in the resource list of suggestions. 


BS Balasubramanian Sattanathan Syncfusion Team April 29, 2020 01:56 PM UTC

Hi Alba, 
  
Thanks for the update. 
  
We let you know that your query will be addressed in the following ticket #274629. Kindly follow the incident for further assistance.  
   
Regards, 
Balasubramanian S 


Loader.
Up arrow icon