Detect Room with slot not available

Hi, I implemented the isSlotAvailable method and it works excellent, but I would like to know if it is possible to know in the following example which room or rooms have the events that are making the isSlotAvailable to false. 

For example, I would like to create an event at 4 pm but Room 1 and Room 4 has already an event at that time. So isSlotAvailable will be false but I would like to know which rooms have no available that slot. In this example will be Room and Ro

Is this possible? 

https://stackblitz.com/edit/react-qjt1rn

Thanks!

Brandon


1 Reply 1 reply marked as answer

HB Hareesh Balasubramanian Syncfusion Team January 14, 2022 06:10 AM UTC

Hi Brandon,


Greetings from Syncfusion Support..!


We have modified your shared sample based on your shared query “Need to provide which rooms are not available for booking on the selected slots” using the isSlotAvaliable public method of the Scheduler, which can be viewed from the following link.

https://stackblitz.com/edit/react-qjt1rn-nt22an


  onPopupOpen(args) {

    let data = args.data;

    if (

      args.type === 'QuickInfo' ||

      args.type === 'Editor' ||

      args.type === 'RecurrenceAlert' ||

      args.type === 'DeleteAlert'

    ) {

      let target =

        args.type === 'RecurrenceAlert' || args.type === 'DeleteAlert'

          ? args.element[0]

          : args.target;

      if (

        !isNullOrUndefined(target) &&

        target.classList.contains('e-work-cells')

      ) {

        if (

          target.classList.contains('e-read-only-cells') ||

          !this.scheduleObj.isSlotAvailable(data)

        ) {

          args.cancel = true;

          var res = this.ownerData;

          var rooms = '';

          for (var i = 0; i < res.length; i++) {

            data.RoomId = res[i].id;

            if (!this.scheduleObj.isSlotAvailable(data)) {

              rooms = rooms + ' ' + res[i].text;

            }

          }

          alert(rooms + ' were already booked in this selected time slots');

        }

      } else if (

        !isNullOrUndefined(target) &&

        target.classList.contains('e-appointment') &&

        this.isReadOnly(data.EndTime)

      ) {

        args.cancel = true;

      }

    }

  }


Kindly try the above sample and get back to us if you need any further assistance.


Regards,

Hareesh


Marked as answer
Loader.
Up arrow icon