Diverse scenario engine: 15 weighted staffing situations replace crisis-every-refresh
Simulation now uses weighted random selection across 4 priority tiers: - Urgent (walkoff, quarantine, no-show), High (new client, cert expiry, expansion), Medium (recurring, seasonal, medical leave, cross-train), Low (future, exploratory) - Color-coded scenario banners on ALL contracts, not just urgent - Each scenario carries context (note) + recommended action Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
+27
-16
@@ -209,25 +209,36 @@ function addContractInsight(parent,c,isUrgent){
|
||||
var cd=document.createElement('div');cd.style.cssText='background:#0d1117;border-radius:8px;padding:12px;margin-bottom:8px';
|
||||
|
||||
// Urgent reason banner — explain WHY this is urgent
|
||||
if(isUrgent){
|
||||
var reasons=['Client called last night — needs workers by morning',
|
||||
'Short notice fill — original crew cancelled',
|
||||
'Production surge — client doubled their headcount',
|
||||
'Emergency coverage — 2 no-shows reported',
|
||||
'Rush order — client needs bodies on site ASAP',
|
||||
'Replacement needed — previous worker reassigned'];
|
||||
var reason=reasons[Math.floor(Math.random()*reasons.length)];
|
||||
// Scenario banner — shows for ALL contracts, not just urgent
|
||||
if(c.notes||c.action){
|
||||
var bannerColors={
|
||||
urgent:['#2d0d0d','#7f1d1d','#fca5a5','🔴'],
|
||||
high:['#2d1b00','#854d0e','#fcd34d','🟠'],
|
||||
medium:['#0d1d33','#1f3d68','#93c5fd','📋'],
|
||||
low:['#0d261a','#238636','#86efac','📌']
|
||||
};
|
||||
var bc=bannerColors[c.priority]||bannerColors.medium;
|
||||
var banner=document.createElement('div');
|
||||
banner.style.cssText='background:#2d0d0d;border:1px solid #7f1d1d;border-radius:6px;padding:10px 12px;margin-bottom:10px;display:flex;align-items:flex-start;gap:8px';
|
||||
var icon=document.createElement('span');icon.style.cssText='font-size:16px;flex-shrink:0';icon.textContent='🔴';
|
||||
banner.style.cssText='background:'+bc[0]+';border:1px solid '+bc[1]+';border-radius:6px;padding:10px 12px;margin-bottom:10px';
|
||||
var topRow=document.createElement('div');topRow.style.cssText='display:flex;align-items:flex-start;gap:8px';
|
||||
var icon=document.createElement('span');icon.style.cssText='font-size:14px;flex-shrink:0';icon.textContent=bc[3];
|
||||
var bannerText=document.createElement('div');
|
||||
var reasonLine=document.createElement('div');reasonLine.style.cssText='color:#fca5a5;font-size:12px;font-weight:600';reasonLine.textContent=reason;
|
||||
var actionLine=document.createElement('div');actionLine.style.cssText='color:#8b949e;font-size:11px;margin-top:2px';
|
||||
var reasonLine=document.createElement('div');reasonLine.style.cssText='color:'+bc[2]+';font-size:12px;font-weight:600';
|
||||
reasonLine.textContent=c.notes||'';
|
||||
bannerText.appendChild(reasonLine);
|
||||
if(c.action){
|
||||
var actionLine=document.createElement('div');actionLine.style.cssText='color:#8b949e;font-size:11px;margin-top:2px';
|
||||
actionLine.textContent=c.action;
|
||||
bannerText.appendChild(actionLine);
|
||||
}
|
||||
var unfilled=c.headcount-c.filled;
|
||||
if(unfilled>0)actionLine.textContent='Need '+unfilled+' more worker'+(unfilled>1?'s':'')+' — see suggested replacements below';
|
||||
else actionLine.textContent='All '+c.headcount+' positions matched — confirm workers and send shift details now';
|
||||
bannerText.appendChild(reasonLine);bannerText.appendChild(actionLine);
|
||||
banner.appendChild(icon);banner.appendChild(bannerText);cd.appendChild(banner);
|
||||
if(unfilled>0){
|
||||
var gapLine=document.createElement('div');gapLine.style.cssText='color:'+bc[2]+';font-size:11px;margin-top:4px;font-weight:500';
|
||||
gapLine.textContent='→ Need '+unfilled+' more worker'+(unfilled>1?'s':'')+' — see matches below';
|
||||
bannerText.appendChild(gapLine);
|
||||
}
|
||||
topRow.appendChild(icon);topRow.appendChild(bannerText);banner.appendChild(topRow);
|
||||
cd.appendChild(banner);
|
||||
}
|
||||
|
||||
var hdr=document.createElement('div');hdr.style.cssText='display:flex;justify-content:space-between;align-items:center;margin-bottom:8px';
|
||||
|
||||
Reference in New Issue
Block a user