Our pure JavaScript Scheduler component


Post by peter@helio.com.au »

Hello team,
We have a business scenario where we want to restrict to create an event in past dates. We also want to restrict our users to make changes in the events which were created in past.
To implement this we have gone through the property booking demo example and tried implementing the same in our scheduler. The functionality is not working as it is working in the given example. Also in the example i can still drag an event (Mr Woods) which was partially in shaded area to non shaded area which should not happen our use case.
Please help us to implement this scenario.
https://bryntum.com/products/scheduler/examples/booking/


Post by mats »

The functionality is not working as it is working in the given example

Can you please share us the code where we can see what you implemented?

We have a FR open for this request: https://github.com/bryntum/support/issues/4738


Post by peter@helio.com.au »

Hi Mats,
As per the given example , I have set timeRange : true in features

 features : {
            stripe : true,
             timeRanges : {
                  showCurrentTimeLine : {
                        name : 'Now'
                    }
                },
                resourceTimeRanges : true,
               ...
               }

And than i have added values in timeRangeStore and resourceTimeRangeStore inside a function call.

                                     var DH = bryntum.scheduler.DateHelper,
           			       date = DH.clearTime(new Date());
                                                             let me = this;
                                                                let msObj2=[{
                                                                id: 'time_range_'+1,
                                                                startDate:"2022-01-01",
                                                                endDate: date,
                                                        		cls       : "shaded",
                                                            }];
                                                             let resourceTimeRange = [];
                                                             let allResources = this.master.resourceStore.records;
                                                             allResources.forEach(function(resource,index){
                                                                let resourceRecord =  {
                                                                     	"id"             : 'resource_time_range_'+index,
                                                                         "resourceId"     : resource['id'],
                                                                          "startDate"      : "2022-01-01",
                                                                           "endDate"       :  date,
                                                                         "recurrenceRule" : "FREQ=DAILY",
                                                                 }
                                                                resourceTimeRange.push(resourceRecord);
                                                                 if(resource['children'] != undefined){
                                                                     resource['children'].forEach(function(cresource,cindex){
                                                                         let resourceRecord =  {
                                                                             "id"             : 'resource_time_range_children'+cindex,
                                                                             "resourceId"     : cresource['id'],
                                                                             "startDate"      : "2022-01-01",
                                                                             "endDate"       :  date,
                                                                             "recurrenceRule" : "FREQ=DAILY",
                                                                         }
                                                                         resourceTimeRange.push(resourceRecord);
                                                                    })
                                                                 }
                                                             })
                                                           me.scheduler.resourceTimeRangeStore.data = resourceTimeRange;
                                                           me.scheduler.timeRangeStore.data = msObj2;
                                                           }

As a result of doing this, i got shaded region till today's date in scheduler but still i was able to create event in that shaded area.


Post by peter@helio.com.au »

Image

Attachments
Screenshot 2023-02-03 124213.png
Screenshot 2023-02-03 124213.png (60.75 KiB) Viewed 112 times

Post by mats »


Post Reply