yah, I eventually figured that one out. Have made a similar adjustment in my copy.
Got it Have made similar adjustments in my copy.
Yeah, I picked up on that. Problem is I have over 30 distinct codes to deal with, and now an additional requirement where my customer has decided that for some codes he wants the actual code displayed in place of the day number. Ugh!
Yup, I’ve already built out the CSS I’ll need for all codes.
I reckon it will, and I’ve already made a start on the code. As I’ll be generating the {ListDays} array programatically, I’ll just insert the appropriate number of blank divs as I do that. The initial thought of generating this programatically was a bit daunting, but now that I’ve made a start, I can see that it’ll actually be pretty straightforward. For example, I started by defining a couple of mapping tables…
function get_class_names() {
var class_names = {
day: 'calendar__number--day',
night: 'calendar__number--night',
first: 'calendar__number--first',
second: 'calendar__number--second',
third: 'calendar__number--third',
twoa: 'calendar__number--twoa',
twob: 'calendar__number--twob',
ns: 'calendar__number--ns',
off: 'calendar__number--off',
training: 'calendar__number--training',
standby: 'calendar__number--standby',
leave: 'calendar__number--leave',
missing: 'calendar__number--missing'
}
return class_names;
}
function get_class_map() {
var class_map = {
'1ST': { class: 'day', display: 'day' },
'2A': { class: 'twoa', display: 'day' },
'2ND': { class: 'second', display: 'day' },
'ATI D': { class: 'day', display: 'code' },
'D': { class: 'day', display: 'day' },
'ITE': { class: 'day', display: 'code' },
'OJT': { class: 'training', display: 'code' },
'OJT D': { class: 'training', display: 'code' },
'SRT': { class: 'training', display: 'code' },
'2B': { class: 'twob', display: 'day' },
'3RD': { class: 'third', display: 'day' },
'ATI N': { class: 'night', display: 'code' },
'N': { class: 'night', display: 'day' },
'OJT N': { class: 'night', display: 'code' },
'ABS': { class: 'missing', display: 'code' },
'AL': { class: 'leave', display: 'code' },
'CO': { class: 'training', display: 'code' },
'MC': { class: 'leave', display: 'code' },
'MIA': { class: 'missing', display: 'code' },
'NS': { class: 'ns', display: 'day' },
'OFF': { class: 'off', display: 'day' },
'RS': { class: 'missing', display: 'code' },
'SB': { class: 'standby', display: 'day' },
'SUS': { class: 'missing', display: 'code' },
'UL': { class: 'leave', display: 'code' },
'DAFM': { class: 'day', display: 'code' },
'NAFM': { class: 'night', display: 'code' },
'DPM': { class: 'day', display: 'code' },
'NPM': { class: 'night', display: 'code' },
'DFM': { class: 'day', display: 'code' },
'NFM': { class: 'night', display: 'code' },
}
return class_map;
}
With those, all I need to do is iterate through the roster, and create an array of arrays, plugging in the appropriate values as I go
Here is a snapshot of what the source data looks like (this lives in a separate Google Worksheet, and is managed on a day to day basis by the customer):
And here is what my current export looks like when it arrives in my app Google Sheet:
But, assuming that my idea works out (I should know in a few hours), then that will change and all those day of month columns will be gone.
I’ll report back a bit later tonight