Add constraints for maximum days and unique shifts per week block in worker model

This commit is contained in:
Ross
2026-05-19 21:23:09 +01:00
parent a071b1b027
commit dee80ed4fa
5 changed files with 192 additions and 4 deletions
+10 -2
View File
@@ -419,8 +419,15 @@ function renderWorkerList() {
if (!workers) return;
workers.forEach(w => {
const name = (w.name || '') + '';
const displayName = (w.display_name || '') + '';
const site = (w.site || '') + '';
if (filter && name.toLowerCase().indexOf(filter) === -1 && site.toLowerCase().indexOf(filter) === -1) return;
const searchName = (displayName || name).toLowerCase();
if (
filter
&& searchName.indexOf(filter) === -1
&& name.toLowerCase().indexOf(filter) === -1
&& site.toLowerCase().indexOf(filter) === -1
) return;
// if shiftFilter, ensure worker has target or assigned for that shift
// attempt to read per-worker targets and counts from DOM if not present in JSON
let targets = w.shift_target_number || {};
@@ -443,7 +450,8 @@ function renderWorkerList() {
if (!hasTarget && !hasAssigned) return;
}
const fte = w.fte || '';
const card = $(`<div class='worker-card' style='border:1px solid #ccc;padding:8px;margin-bottom:6px;'><strong>${name}</strong> <span style='color:#666'>${site}</span><div>FTE: ${fte}</div></div>`);
const labelName = displayName || name;
const card = $(`<div class='worker-card' style='border:1px solid #ccc;padding:8px;margin-bottom:6px;'><strong>${labelName}</strong> <span style='color:#666'>${site}</span><div>FTE: ${fte}</div></div>`);
// show shift targets summary
if (w.shift_target_number) {
const tbl = $("<table style='margin-top:6px; width:100%;'></table>");