05/24 Fix bugs

This commit is contained in:
2026-05-24 22:36:36 -04:00
parent 19bad27866
commit 9e1493eea7
5 changed files with 122 additions and 9 deletions
+24
View File
@@ -220,5 +220,29 @@ function buildShiftForm(s) {
<textarea class="form-control" name="note" rows="2">${esc(s.note)}</textarea></div>`;
}
function esc(s) { return (s||'').replace(/&/g,'&amp;').replace(/"/g,'&quot;').replace(/</g,'&lt;'); }
// Highlight today's column in the calendar
(function() {
var jsDay = new Date().getDay(); // 0=Sun … 6=Sat
var mysqlDay = String(jsDay === 0 ? 1 : jsDay + 1); // MySQL DAYOFWEEK: 1=Sun, 2=Mon…
var colIdx = DAY_MAP.findIndex(function(d) { return d[1] === mysqlDay; });
if (colIdx === -1) return;
var calTable = document.querySelector('#tab-calendar table');
if (!calTable) return;
calTable.querySelectorAll('tr').forEach(function(tr) {
var cells = tr.querySelectorAll('th, td');
var cell = cells[colIdx + 1]; // +1 for the leading Shift name column
if (cell) cell.classList.add('cal-today');
});
})();
</script>
<style>
.cal-today { background: #eff6ff !important; }
.cal-today th, thead .cal-today {
background: #dbeafe !important;
font-weight: 700;
color: #1d4ed8;
}
</style>
{% endblock %}