Generating & displaying a monthly shift roster

Thank you! I think that was my attempt at a staff scheduler a while back, which ended up becoming a calendar with half a$$ed multi day capabilities. Now that it’s resurfaced, I might have to throw some new ideas at it. I’d like to merge it somehow with the month layout.

3 Likes

Lovely stuff and :joy: @ a$$ed. I’m so exited I don’t know where to start with this. I’ve few concepts I can bring to life now.

I’m going to merge it with the 31 day calendar. I know that I can do but weekday one I could too. Let me get the 31 out of the way. I’ll show you the result soon. Then I’m gonna work on the weekday layout. It’s the CSS. I have to avoid it. I was so glued to Roberts css at one point I’d forgotten about the template store rules. Then reality knocked. But just for the fun of it I’m going to try.

2 Likes

I’m really pleased with the way this has turned out. I still have a bit of work to make it look a bit more presentable, but I think it’s a really solid solution that should be relatively low maintenance.

Kudos again to Jeff. As we say back home in Oz, the guy is a fair dinkum legend!

3 Likes

:+1::+1::+1::+1::+1:

1 Like

Well, I can definitely say that’s the first time I’ve been called that. :slight_smile: :smile:

2 Likes

@Jeff_Hager - I think you’ll like this…

Was going backwards and forwards with the customer today - kept changing their minds about shift code colours. This started doing my head in, so eventually I did this:

  • Gave the customer a sheet that looks like this:

  • And told him to go to town on it :grin:
  • While he was busy doing that, I wrote this little code snippet…
function build_css_classes() {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var sheet = ss.getSheetByName('Shift Code Map');
  var range = ss.getRangeByName('ShiftCodes');
  var classes = [];
  var row = 1;
  var last_row = range.getLastRow();
  while (row < last_row) {
    var text_color = range.getCell(row,4).getFontColor();
    var bg_color = range.getCell(row,4).getBackground();
    var class_name = range.getCell(row,5).getValue();
    var this_class = '.' + class_name + ' { ' +
      'border-radius:25px; ' +
      'background-color: ' + bg_color + '; ' +
      'color: ' + text_color + ' !important; ' +

      'font-weight: 700; ' +
      'cursor: pointer; }';
    classes.push([this_class]);
    row++;
  }
  sheet.getRange(2,6,sheet.getLastRow()-1,1).setValues(classes);
}

… you can probably see where this is going :wink:

Here’s a couple of screen grabs of the current iteration:

6 Likes

Yeah, there you go! Makes your life easier.

3 Likes

Wow! Brilliant!

Y’all are too smart for me :slight_smile:

This is next level stuff. Nicely done you two.

4 Likes

@Jeff_Hager & @Darren_Murphy Here check this out pls

I have merged it with the calendar but not weekdays.

Each worker has their own view of the calendar and availability

2 Likes

Hmmm that gave me an idea :bulb: to combine your version with mine. I was brainstorming ways to make the days clickable, but I think with a little more CSS, we could hack the list version you made to be 7 wide. (I think I remember someone doing that a while back). I got some playing to do.

2 Likes

Yes! pls Jeff…you can pull it off , I know!

I think the weekdays is going to be hard for me…because of the CSS. I need an inline list.

1 Like

@Jeff_Hager You have done an all events relation…this is great! Can give admin a birds eye view of everything

Thank you!
Great stuff!

1 Like

@Jeff_Hager I have managed to make your calendar clickable without creating any relations and reset the days too in one single swoop. I’ll show you the demo soon. One thing I was thinking of adding but cant get the weekdays or m-days to recognise are the days …I have tried this with weeksdays, weekday-position…and ofcourse sun as 1, mon as 2…but not working for some reason. What am I doing wrong, pls?

@Wiz.Wazeer you mean this?

Huh, so sunday now is 0? lol…I am going to back to scool (no h)! @Darren_Murphy you are using a script? Can we not do it in the editor (well so far I have not had any luck-lol)…

yeah, my whole roster (including all the CSS classes) is script-generated. Definitely possible to figure out the correct starting position using GDE date math, but not simple. I won’t try and offer a solution, as I’ll just embarrass myself :rofl: Best to wait for Jeff…

By the way, this roster part of my app has been chugging away now for almost 3 months, and it’s turned out to be a great solution. Monthly shift rosters are automagically updated for 400+ workers on a daily basis, and I never have to touch it.
It. Just. works.

3 Likes

Really? Don’t tempt please…you know I will go for it. After talking to you the other day, I searched for a formula (couldnt do it in glide) and found a really good one that gets me all the ranges between two dates regardless of when the dates occur…really cool solution…and now I am able to show all dates not just arrival/departure dates on @Jeff_Hager calendar. But you are tempting to me go for the script now…while we are at this…have you had to recently refresh your app or reload the editor to see your script data…I don’t know why but I am even experiencing significant lags in the editor processing data. Something’s not right but Glide is asking for too much from us to fix their problems. Video etc. So I will wait for the glitch to self-fix lol!

1 Like

What an amazing workaround !