diff --git a/output/timetable.js b/output/timetable.js
index d959feb..eb5749b 100644
--- a/output/timetable.js
+++ b/output/timetable.js
@@ -530,6 +530,8 @@ function renderWorkerCheckboxes() {
// Store the current filter value (set of workerIds)
let workerFilterSet = new Set();
+// Store the current setting
+let showShiftNames = false;
// Call this after the DOM is ready and after timetable is rendered
renderWorkerCheckboxes();
@@ -548,7 +550,38 @@ $(document).on("change", "input[name='worker-filter-checkbox']", function() {
renderShiftTimetable();
});
-// Patch renderShiftTimetable to filter workers in both linear and grid views
+// Add a checkbox to show/hide shift names in the shift timetable section
+$("#shift-timetable-options").prepend(`
+
+
+
+`);
+// Add a button to remove all shift timetable colours (set to white)
+$("#shift-colour-controls").append(
+ ``
+);
+
+$("#remove-shift-colours").on("click", function () {
+ // Set all shift colours to white
+ oshifts.forEach(shift => {
+ shiftColors[shift] = "#ffffff";
+ // Update the colour picker if present
+ $(`.shift-colour-picker[data-shift='${shift}']`).val("#ffffff");
+ // Update the corresponding shift button color if selected
+ $(`#shift-timetable-options button[data-shift='${shift}']`).css("background", selectedShifts.has(shift) ? "#ffffff" : "");
+ });
+ renderShiftTimetable();
+});
+
+$("#show-shift-names-checkbox").on("change", function() {
+ showShiftNames = $(this).is(":checked");
+ renderShiftTimetable();
+});
+
+// Patch renderShiftTimetable to show shift names if enabled
function renderShiftTimetable() {
console.log("Render shift timetable");
console.log(workerFilterSet)
@@ -598,12 +631,15 @@ function renderShiftTimetable() {
let cell_shifts = $(td).attr("data-shift").split(",").map(s => s.trim());
let matchedShifts = Array.from(selectedShifts).filter(s => cell_shifts.includes(s));
let color = "#fff";
+ let shiftLabel = "";
if (matchedShifts.length === 1) {
color = shiftColors[matchedShifts[0]];
+ if (showShiftNames) shiftLabel = ` (${matchedShifts[0]})`;
} else if (matchedShifts.length > 1) {
color = `linear-gradient(90deg, ${shiftColors[matchedShifts[0]]} 0 50%, ${shiftColors[matchedShifts[1]]} 50% 100%)`;
+ if (showShiftNames) shiftLabel = ` (${matchedShifts.join(", ")})`;
}
- workerCells.push(`
${workerName}
`);
+ workerCells.push(`
${workerName}${shiftLabel}
`);
});
if (workerCells.length === 0) {
@@ -676,12 +712,15 @@ function renderShiftTimetable() {
let matchedShifts = Array.from(selectedShifts).filter(s => shifts.includes(s));
if (matchedShifts.length > 0) {
let color = "#fff";
+ let shiftLabel = "";
if (matchedShifts.length === 1) {
color = shiftColors[matchedShifts[0]];
+ if (showShiftNames) shiftLabel = ` (${matchedShifts[0]})`;
} else if (matchedShifts.length > 1) {
color = `linear-gradient(90deg, ${shiftColors[matchedShifts[0]]} 0 50%, ${shiftColors[matchedShifts[1]]} 50% 100%)`;
+ if (showShiftNames) shiftLabel = ` (${matchedShifts.join(", ")})`;
}
- cellContent += `