Schedule Board
{#if error}
{error}
{/if} {#if ($allShifts ?? []).length === 0}
No shifts yet
Create shifts in the Shifts page first.
{:else} {#each board as { dept, days }} {#if days.length > 0}
{dept.name}
{#each days as [day, rows]}
{day}
{#each rows as { shift, assigned, hasConflict }, i}
{#if editShiftID === shift.id}
Name
Day
Start
End
Capacity
{saving ? '…' : 'Save'}
Cancel
{:else}
{shift.name}
{fmt(shift.start_time)}–{fmt(shift.end_time)}
{#if shift.capacity > 0}
{assigned.length}/{shift.capacity}
{:else if assigned.length > 0}
{assigned.length}
{/if} {#if hasConflict}
⚠ conflict
{/if}
startEdit(shift)}>Edit
reorder(shift.id, -1, rows)}>↑
reorder(shift.id, 1, rows)}>↓
{#if assigned.length > 0}
{#each assigned as { vs, volunteer }}
{volunteer.name} {#if checkConflict(volunteer.id, shift.id, $allVolunteerShifts ?? [], $allShifts ?? [])}
⚠
{/if}
unassign(shift.id, volunteer.id)} title="Remove">×
{/each}
{/if} {#if assigningShiftID === shift.id}
— Select volunteer —
{#each $allVolunteers ?? [] as v}
{v.name}
{/each}
doAssign(shift.id)} disabled={!assignVolID || assigning}> {assigning ? '…' : 'Assign'}
doAssignForce(shift.id)} disabled={!assignVolID || assigning} title="Assign ignoring conflicts"> Force
{ assigningShiftID = null; assignVolID = 0 }}>Cancel
{:else}
startAssign(shift.id)}>+ Assign volunteer
{/if} {/if}
{/each} {/each}
{/if} {/each} {/if}