Add constraints for maximum days and unique shifts per week block in worker model
This commit is contained in:
+10
-2
@@ -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>");
|
||||
|
||||
Reference in New Issue
Block a user