<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Resource Loader</title>
<style>
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
background: #f4f5f7;
color: #1a1a2e;
font-size: 14px;
}
header {
background: #1a1a2e;
color: white;
padding: 16px 32px;
display: flex;
align-items: baseline;
gap: 12px;
}
header h1 { font-size: 20px; font-weight: 700; }
header p { font-size: 13px; opacity: 0.5; }
.page { max-width: 900px; margin: 32px auto; padding: 0 24px; }
.step {
background: white;
border-radius: 10px;
box-shadow: 0 1px 4px rgba(0,0,0,0.08);
margin-bottom: 20px;
overflow: hidden;
}
.step-header {
display: flex;
align-items: center;
gap: 14px;
padding: 16px 20px;
border-bottom: 1px solid #eee;
background: #fafafa;
}
.step-num {
width: 28px; height: 28px;
background: #1a1a2e;
color: white;
border-radius: 50%;
display: flex; align-items: center; justify-content: center;
font-size: 13px; font-weight: 700;
flex-shrink: 0;
}
.step-header h2 { font-size: 15px; font-weight: 600; }
.step-header p { font-size: 12px; color: #888; margin-top: 1px; }
.step-body { padding: 20px; }
.row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 11px; font-weight: 600; color: #666; text-transform: uppercase; letter-spacing: .5px; }
input, select {
border: 1.5px solid #ddd;
border-radius: 6px;
padding: 8px 10px;
font-size: 13px;
font-family: inherit;
outline: none;
background: white;
transition: border-color .15s;
}
input:focus, select:focus { border-color: #1a1a2e; }
.btn {
padding: 9px 18px;
border: none;
border-radius: 6px;
font-size: 13px;
font-weight: 600;
cursor: pointer;
font-family: inherit;
transition: opacity .15s;
white-space: nowrap;
}
.btn:hover { opacity: .85; }
.btn-dark { background: #1a1a2e; color: white; }
.btn-blue { background: #2563eb; color: white; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.chip {
display: flex; align-items: center; gap: 8px;
background: #f0f4ff;
border: 1.5px solid #c7d7fc;
border-radius: 20px;
padding: 5px 12px;
font-size: 12px;
}
.chip strong { font-weight: 600; }
.chip span { color: #666; }
.chip-remove {
background: none; border: none; cursor: pointer;
color: #aaa; font-size: 14px; line-height: 1;
padding: 0 0 0 4px;
}
.chip-remove:hover { color: #e00; }
table { width: 100%; border-collapse: collapse; }
th {
text-align: left;
font-size: 11px;
font-weight: 600;
color: #888;
text-transform: uppercase;
letter-spacing: .5px;
padding: 8px 10px;
border-bottom: 2px solid #eee;
}
td { padding: 12px 10px; border-bottom: 1px solid #f0f0f0; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafafa; }
.bar-wrap { display: flex; align-items: center; gap: 10px; min-width: 180px; }
.bar-bg {
flex: 1; height: 8px;
background: #eee;
border-radius: 4px;
overflow: hidden;
}
.bar-fill {
height: 100%;
border-radius: 4px;
transition: width .4s ease;
}
.badge {
display: inline-block;
padding: 3px 10px;
border-radius: 20px;
font-size: 11px;
font-weight: 600;
}
.green { background: #dcfce7; color: #166534; }
.yellow { background: #fef9c3; color: #854d0e; }
.red { background: #fee2e2; color: #991b1b; }
.pct { font-size: 12px; font-weight: 700; min-width: 36px; text-align: right; }
.del-btn {
background: none; border: 1px solid #eee;
border-radius: 4px; cursor: pointer;
color: #bbb; padding: 3px 7px; font-size: 12px;
}
.del-btn:hover { color: #e00; border-color: #fca5a5; }
.empty { color: #bbb; text-align: center; padding: 24px; font-size: 13px; }
.totals {
display: flex; gap: 16px;
background: white;
border-radius: 10px;
box-shadow: 0 1px 4px rgba(0,0,0,0.08);
padding: 20px 24px;
margin-bottom: 20px;
}
.total-item { text-align: center; flex: 1; }
.total-item .num { font-size: 28px; font-weight: 700; line-height: 1; }
.total-item .lbl { font-size: 11px; color: #888; margin-top: 4px; text-transform: uppercase; letter-spacing: .5px; }
</style>
</head>
<body>
<header>
<h1>Resource Loader</h1>
<p>See who is available and who is overloaded</p>
</header>
<div class="page">
<div class="totals">
<div class="total-item">
<div class="num" id="tPeople" style="color:#1a1a2e">0</div>
<div class="lbl">People</div>
</div>
<div class="total-item">
<div class="num" id="tCap" style="color:#2563eb">0h</div>
<div class="lbl">Total Capacity</div>
</div>
<div class="total-item">
<div class="num" id="tAlloc" style="color:#f59e0b">0h</div>
<div class="lbl">Assigned</div>
</div>
<div class="total-item">
<div class="num" id="tFree" style="color:#16a34a">0h</div>
<div class="lbl">Still Free</div>
</div>
<div class="total-item">
<div class="num" id="tOver" style="color:#dc2626">0</div>
<div class="lbl">Overloaded</div>
</div>
</div>
<div class="step">
<div class="step-header">
<div class="step-num">1</div>
<div>
<h2>Add your team</h2>
<p>Enter each person and how many hours per week they have available</p>
</div>
</div>
<div class="step-body">
<div class="row">
<div class="field">
<label>Name</label>
<input id="pName" type="text" placeholder="e.g. Alice Chen" style="width:180px" />
</div>
<div class="field">
<label>Role</label>
<input id="pRole" type="text" placeholder="e.g. Designer" style="width:140px" />
</div>
<div class="field">
<label>Hours / week</label>
<input id="pCap" type="number" value="40" min="1" max="80" style="width:100px" />
</div>
<button class="btn btn-dark" onclick="addPerson()">+ Add Person</button>
</div>
<div class="chips" id="chips"><span style="color:#bbb;font-size:12px">No one added yet</span></div>
</div>
</div>
<div class="step">
<div class="step-header">
<div class="step-num">2</div>
<div>
<h2>Assign tasks</h2>
<p>Add tasks to each person — the app calculates who is overloaded automatically</p>
</div>
</div>
<div class="step-body">
<div class="row">
<div class="field">
<label>Person</label>
<select id="tPerson" style="width:160px"><option value="">Select person</option></select>
</div>
<div class="field">
<label>Task name</label>
<input id="tTask" type="text" placeholder="e.g. Build login page" style="width:220px" />
</div>
<div class="field">
<label>Hours</label>
<input id="tHours" type="number" value="8" min="1" style="width:80px" />
</div>
<button class="btn btn-blue" onclick="addTask()">Assign Task</button>
</div>
</div>
</div>
<div class="step">
<div class="step-header">
<div class="step-num">3</div>
<div>
<h2>Team workload at a glance</h2>
<p>Green = fine · Yellow = getting full · Red = overloaded</p>
</div>
</div>
<div class="step-body" style="padding:0">
<table>
<thead>
<tr>
<th>Person</th>
<th>Role</th>
<th>Tasks assigned</th>
<th style="min-width:220px">Load</th>
<th>Status</th>
<th></th>
</tr>
</thead>
<tbody id="teamBody">
<tr><td colspan="6" class="empty">Add people in Step 1 to get started</td></tr>
</tbody>
</table>
</div>
</div>
</div>
<script>
var people = [], tasks = [], uid = 1;
function addPerson() {
var name = document.getElementById('pName').value.trim();
var role = document.getElementById('pRole').value.trim() || 'Team Member';
var cap = parseInt(document.getElementById('pCap').value) || 40;
if (!name) { alert('Please enter a name.'); return; }
people.push({ id: uid++, name: name, role: role, cap: cap });
document.getElementById('pName').value = '';
document.getElementById('pRole').value = '';
render();
}
function removePerson(id) {
people = people.filter(function(p){ return p.id !== id; });
tasks = tasks.filter(function(t){ return t.personId !== id; });
render();
}
function addTask() {
var pid = parseInt(document.getElementById('tPerson').value);
var name = document.getElementById('tTask').value.trim();
var hours = parseInt(document.getElementById('tHours').value) || 0;
if (!pid) { alert('Pick a person first.'); return; }
if (!name) { alert('Enter a task name.'); return; }
if (!hours) { alert('Enter hours greater than 0.'); return; }
tasks.push({ id: uid++, personId: pid, name: name, hours: hours });
document.getElementById('tTask').value = '';
document.getElementById('tHours').value = 8;
render();
}
function removeTask(id) {
tasks = tasks.filter(function(t){ return t.id !== id; });
render();
}
function getLoad(pid) {
return tasks.filter(function(t){ return t.personId === pid; })
.reduce(function(s,t){ return s + t.hours; }, 0);
}
function statusBadge(pct) {
if (pct > 100) return '<span class="badge red">Overloaded</span>';
if (pct > 80) return '<span class="badge yellow">Getting Full</span>';
return '<span class="badge green">Available</span>';
}
function barColor(pct) {
if (pct > 100) return '#ef4444';
if (pct > 80) return '#f59e0b';
return '#22c55e';
}
function render() {
var chips = document.getElementById('chips');
if (!people.length) {
chips.innerHTML = '<span style="color:#bbb;font-size:12px">No one added yet</span>';
} else {
chips.innerHTML = people.map(function(p) {
return '<div class="chip"><strong>' + p.name + '</strong><span>' + p.role + ' · ' + p.cap + 'h/wk</span><button class="chip-remove" onclick="removePerson(' + p.id + ')">x</button></div>';
}).join('');
}
var sel = document.getElementById('tPerson');
var prev = sel.value;
sel.innerHTML = '<option value="">Select person</option>' +
people.map(function(p){ return '<option value="' + p.id + '">' + p.name + '</option>'; }).join('');
if (prev) sel.value = prev;
var body = document.getElementById('teamBody');
if (!people.length) {
body.innerHTML = '<tr><td colspan="6" class="empty">Add people in Step 1 to get started</td></tr>';
} else {
body.innerHTML = people.map(function(p) {
var load = getLoad(p.id);
var pct = Math.round((load / p.cap) * 100);
var fill = Math.min(pct, 100);
var myTasks = tasks.filter(function(t){ return t.personId === p.id; });
var taskHtml = myTasks.length
? myTasks.map(function(t){
return '<span style="display:inline-flex;align-items:center;gap:4px;background:#f4f5f7;border-radius:4px;padding:2px 7px;margin:2px;font-size:12px">' +
t.name + ' <span style="color:#888">' + t.hours + 'h</span>' +
'<button class="chip-remove" onclick="removeTask(' + t.id + ')">x</button></span>';
}).join('')
: '<span style="color:#bbb">No tasks yet</span>';
return '<tr>' +
'<td><strong>' + p.name + '</strong></td>' +
'<td style="color:#666">' + p.role + '</td>' +
'<td>' + taskHtml + '</td>' +
'<td>' +
'<div class="bar-wrap">' +
'<div class="bar-bg"><div class="bar-fill" style="width:' + fill + '%;background:' + barColor(pct) + '"></div></div>' +
'<span class="pct" style="color:' + barColor(pct) + '">' + pct + '%</span>' +
'</div>' +
'<div style="font-size:11px;color:#aaa;margin-top:3px">' + load + 'h of ' + p.cap + 'h used</div>' +
'</td>' +
'<td>' + statusBadge(pct) + '</td>' +
'<td><button class="del-btn" onclick="removePerson(' + p.id + ')">x</button></td>' +
'</tr>';
}).join('');
}
var totalCap = people.reduce(function(s,p){ return s + p.cap; }, 0);
var totalAlloc = people.reduce(function(s,p){ return s + getLoad(p.id); }, 0);
var overloaded = people.filter(function(p){ return getLoad(p.id) > p.cap; }).length;
document.getElementById('tPeople').textContent = people.length;
document.getElementById('tCap').textContent = totalCap + 'h';
document.getElementById('tAlloc').textContent = totalAlloc + 'h';
document.getElementById('tFree').textContent = Math.max(totalCap - totalAlloc, 0) + 'h';
document.getElementById('tOver').textContent = overloaded;
}
people = [
{ id: uid++, name: 'Alice Chen', role: 'Frontend Dev', cap: 40 },
{ id: uid++, name: 'Marco Rossi', role: 'Backend Dev', cap: 40 },
{ id: uid++, name: 'Sara Okafor', role: 'UX Designer', cap: 32 },
];
tasks = [
{ id: uid++, personId: people[0].id, name: 'Dashboard redesign', hours: 20 },
{ id: uid++, personId: people[0].id, name: 'Bug fixes', hours: 16 },
{ id: uid++, personId: people[1].id, name: 'API refactor', hours: 30 },
{ id: uid++, personId: people[2].id, name: 'User research', hours: 12 },
];
render();
</script>
</body>
</html>