05/24 Fix bugs
This commit is contained in:
@@ -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,'&').replace(/"/g,'"').replace(/</g,'<'); }
|
||||
|
||||
// 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 %}
|
||||
|
||||
Reference in New Issue
Block a user