Shifts
{#if canManage}
showAdd = !showAdd}>+ Add shift
{/if}
{#if error}
{error}
{/if} {#if showAdd && canManage}
Department *
Select department…
{#each $allDepts ?? [] as d}
{d.name}
{/each}
Shift name *
Day *
Capacity
(0 = unlimited)
Start time *
End time *
{adding ? 'Adding…' : 'Add shift'}
showAdd = false}>Cancel
{/if} {#if ($allShifts ?? []).length === 0}
No shifts yet
Add shifts to schedule your volunteers.
{:else} {#each grouped as { dept, days }}
{dept.name}
{#each days as { day, shifts }}
{formatDay(day)}
{#each shifts as s (s.id)}
{s.name}
{formatTime(s.start_time)} – {formatTime(s.end_time)}
{#if s.capacity} Capacity: {s.capacity} {:else} Unlimited {/if}
{#if canManage}
deleteShift(s)}>Delete
{/if}
{/each}
{/each}
{/each} {#if ungrouped.length > 0}
{ungrouped.length} shift(s) with unknown departments
{/if} {/if}