Premium support for our pure JavaScript UI components


Post by sudhanshu.jain »

  1. In Scheduler pro how can we make multiple working time shifts for resource??. How can we have different working hours for each date ?

Ex :
On Date 19 April 2021 resource A will be working from (8 am to - 10 am) then (3 pm -6 pm )
On Date 20 April 2021 resource A will be working from (9 am to - 11 am) then (4pm -7 pm )

Working hours Time - resource's cells should be white (please find attachment)
Not working hours time - resource's cells should be gray.

2 . How can we make resource working time and non-working time shifts weekly occurring ??

Ex :

 resourceA:  {
        "Mon": [{"startTime": "14:30:00.0", "endTime": " 16:30:00.0"},
          {"startTime": "18:30:00.0", "endTime": " 20:30:00.0"}],
        "Tuesday": [{"startTime": "07:30:00.0", "endTime": " 11:30:00.0"}],
        "Wed": [{"startTime": "10:30:00.0", "endTime": " 19:30:00.0"}],
        "Thu": [{"startTime": "13:30:00.0", "endTime": " 15:30:00.0"}],
        "Fri": [{"startTime": "11:30:00.0", "endTime": " 22:30:00.0"}],
        "Sat" : [{"startTime": "12:30:00.0", "endTime": " 23:30:00.0"}]
      }

resourceA - will work on Monday from (2.30 pm to 4.30 pm) and (6.30 pm to 8.30 pm)
resourceA - will work on Monday from (7.30 am to 11.30 am) ...like so on

like that, so above resourceA will have working time weekly occurring.

can you please let us know how can achieve the above one with a code example?

And please don't share your example links in the answer, we already visited that(mention below), that is not helping.
https://www.bryntum.com/examples/scheduler-pro/resource-non-working-time/
https://www.bryntum.com/examples/scheduler-pro/non-working-time/

Expecting good !!
Thanks

Attachments
Screen Shot 2021-04-18 at 10.24.42 PM.png
Screen Shot 2021-04-18 at 10.24.42 PM.png (400.73 KiB) Viewed 710 times

Post by sudhanshu.jain »

As we are using premium support, please provide a solution for it. It is some urgent client requirement.


Post by alex.l »

In Scheduler pro how can we make multiple working time shifts for resource??. How can we have different working hours for each date ?

You can specify as many periods as you want for every resource. See an example below, I added two ranges for the same resource. You can use recurrenceRule to repeat your rule or use a special rule for a special date.

How can we make resource working time and non-working time shifts weekly occurring ??

Shortly: "recurrenceRule" : "FREQ=WEEKLY"

Please check our docs: https://bryntum.com/docs/scheduler-pro/#Scheduler/feature/ResourceTimeRanges

Here is the code example:

import RecurringTimeSpan from '../../lib/Scheduler/model/mixin/RecurringTimeSpan.js';
import RecurringTimeSpansMixin from  '../../lib/Scheduler/data/mixin/RecurringTimeSpansMixin.js';
import ResourceTimeRangeModel from '../../lib/Scheduler/model/ResourceTimeRangeModel.js';
import ResourceTimeRangeStore from '../../lib/Scheduler/data/ResourceTimeRangeStore.js';

class MyResourceTimeRange extends RecurringTimeSpan(ResourceTimeRangeModel) {};

// Define a new store extending standard ResourceTimeRangeStore
// with RecurringTimeSpansMixin mixin to add recurrence support to the store.
// This store will contain time ranges.
class MyResourceTimeRangeStore extends RecurringTimeSpansMixin(ResourceTimeRangeStore) {
    static get defaultConfig() {
        return {
            // use our new MyResourceTimeRange model
            modelClass : MyResourceTimeRange
        };
    }
};

const resourceTimeRangeStore = new MyResourceTimeRangeStore({
    data : [{
        "id"             : 1,
        "resourceId"     : 8,
        "name"           : "Mondays",
        "startDate"      : "2020-03-23",
        "endDate"        : "2020-03-24",
        "timeRangeColor" : "red",
        "recurrenceRule" : "FREQ=WEEKLY"
    }, {
        "id"             : 2,
        "resourceId"     : 8,
        "name"           : "Tuesdays",
        "startDate"      : "2020-03-24",
        "endDate"        : "2020-03-25",
        "timeRangeColor" : "green",
        "recurrenceRule" : "FREQ=WEEKLY"
    }]
});

const scheduler = new SchedulerPro({
    // A Project holds the data and the calculation engine for Scheduler Pro. It also acts as a CrudManager, allowing
    // loading data into all stores at once
    project : {
        autoLoad  : true,
        transport : {
            load : {
                url : './data/data.json'
            }
        },
    },
    resourceTimeRangeStore : resourceTimeRangeStore,
    
features : { resourceTimeRanges : true }, [...]

All the best,
Alex

All the best,
Alex


Post by alex.l »

Hi sudhanshu.jain,

Looks like I suggested you a wrong way to handle this. There is no need to make own recurrence logic, because our calendars already able to do that.

https://bryntum.com/docs/scheduler-pro/#SchedulerPro/feature/ResourceNonWorkingTime is a feature that highlights non-working time periods for resources according to their https://bryntum.com/docs/scheduler-pro/#SchedulerPro/model/ResourceModel#field-calendar
To use that feature, at least one project calendar should exist and be assigned to a resource.

data.json example:

{
   "success"   : true,
   "calendars" : {
       "rows" : [
           {
               "id"                       : "day",
               "name"                     : "Day shift",
               "unspecifiedTimeIsWorking" : false,
               "intervals"                : [
                   {
                       "recurrentStartDate" : "at 8:00",
                       "recurrentEndDate"   : "at 17:00",
                       "isWorking"          : true
                   }
               ]
           }
    ],
    "resources" : {
       "rows" : [
           {
               "id"         : 1,
               "name"       : "George",
               "calendar"   : "day",
               "role"       : "Office",
               "eventColor" : "blue"
           },
           {
               "id"         : 2,
               "name"       : "Rob",
               "calendar"   : "day",
               "role"       : "Office",
               "eventColor" : "blue"
           }
        ]
   [...]
const scheduler = new SchedulerPro({
   // A Project holding the data and the calculation engine for Scheduler Pro. It also acts as a CrudManager, allowing
   // loading data into all stores at once
   project : {
       autoLoad  : true,
       transport : {
           load : {
               url : './data/data.json'
           }
       }
   },
   features : {
       resourceNonWorkingTime : true
   },
   [...]
 }):

Resource non-working time ranges can be recurring. You can find an example showing how to achieve this in the https://bryntum.com/examples/scheduler-pro/resource-non-working-time/ demo

We will update our docs with this information too, thank you for your question!
Please do not hesitate to ask here, if you'll have any problems with using it.

All the best,
Alex

All the best,
Alex


Post Reply