Files
web-nuxt/app/components/use-cases/StaffingPanel.vue
T
Noel Sabia 8d687ad05b
ci / check (push) Successful in 1m17s
ci / check (pull_request) Successful in 1m13s
feat: add operational use cases console
2026-11-14 21:39:15 +01:00

429 lines
25 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<script setup lang="ts">
import { berlinParts, parseHour } from '#shared/staffing'
import type { ContextResponse, Sensor, StaffingHour, StaffingResponse } from '#shared/types'
import { sensorForPlan, staffingSnapshot } from '#shared/use-cases'
import DecisionMetric from '~/components/use-cases/DecisionMetric.vue'
import MiniBar from '~/components/use-cases/MiniBar.vue'
import { formatEuro, formatNumber, formatPercent, formatShortDate, formatWeekday } from '~/utils/format'
import { planDays } from '~/utils/plan'
const props = defineProps<{
plan: StaffingResponse | null
sensors: Sensor[] | null
context: ContextResponse | null
sensorId: string
pending: boolean
error: string
}>()
const emit = defineEmits<{
'update:sensor-id': [value: string]
refresh: []
}>()
const assumptionsOpen = ref(false)
const exportNote = ref('')
const snapshot = computed(() => staffingSnapshot(props.plan))
const days = computed(() => planDays(props.plan))
const peakDate = computed(() => snapshot.value.peakShift?.date ?? '')
const peakDay = computed(() => days.value.find((day) => day.date === peakDate.value) ?? null)
const peakShift = computed(() => snapshot.value.peakShift)
const peakShiftLabel = computed(() =>
peakShift.value ? `${formatWeekday(peakShift.value.date)} · ${formatShortDate(peakShift.value.date)}` : '',
)
const selectedSensor = computed(() => props.sensors?.find((sensor) => sensor.id === props.sensorId) ?? null)
const planSensor = computed(() => sensorForPlan(props.sensors, props.plan))
const weather = computed(() => props.context?.weather.now ?? null)
const telemetryRows = computed(() => {
const sensor = selectedSensor.value
const now = weather.value
const plan = props.plan
return [
{
title: 'Pedestrian flux density',
detail: sensor
? `${sensor.name} · mean ${sensor.mean} · p95 ${sensor.p95} est. devices/h`
: 'Selected sensor data unavailable.',
badge: sensor?.battery != null ? `${sensor.battery}% battery` : 'no battery data',
icon: 'material-symbols:sensors',
iconClass: 'text-[#00C3CD]',
badgeClass: 'border-[#00C3CD]/30 bg-[#00C3CD]/15 text-[#00C3CD]',
},
{
title: 'Context weather now',
detail: now ? `${now.temp_c} °C · ${now.precip_mm} mm · ${now.cloud_pct}% cloud` : 'Weather now unavailable.',
badge: now ? 'Now' : '—',
icon: 'material-symbols:cloud',
iconClass: 'text-[#94A3B8]',
badgeClass: 'border-[#1e3a52] bg-white/10 text-[#94A3B8]',
},
{
title: 'Plan provenance',
detail: plan
? `data ${plan.data_version || '—'} · model ${plan.model_version || '—'} · context ${plan.context_version || '—'}`
: 'Waiting for a plan response.',
badge: plan ? (plan.cached ? 'Cached' : 'Not cached') : '—',
icon: 'material-symbols:database',
iconClass: 'text-[#94A3B8]',
badgeClass: 'border-[#1e3a52] bg-white/10 text-[#94A3B8]',
},
]
})
const hourColumns = computed(() => {
const open = parseHour(props.plan?.assumptions.store_hours.open ?? '10:00')
const close = parseHour(props.plan?.assumptions.store_hours.close ?? '20:00')
return Array.from({ length: Math.max(0, close - open) }, (_, index) => open + index)
})
const hourRange = computed(() => {
const first = hourColumns.value[0]
const last = hourColumns.value.at(-1)
return first === undefined || last === undefined ? '—' : `${first}:00–${last + 1}:00`
})
const matrixRows = computed(() =>
days.value.map((day) => {
const byHour = new Map(day.hours.map((hour) => [berlinParts(hour.t).hour, hour] as const))
const peak = Math.max(0, ...day.hours.map((hour) => hour.required_staff))
return {
...day,
isPeak: day.date === peakDate.value,
cells: hourColumns.value.map((hour) => {
const entry = byHour.get(hour)
return {
hour,
required: entry?.required_staff ?? 0,
scheduled: entry?.scheduled_staff ?? 0,
intensity: entry && peak > 0 ? entry.required_staff / peak : 0,
}
}),
}
}),
)
const maxStaffHours = computed(() => Math.max(0, ...days.value.map((day) => day.staffHours)))
const assumptionRows = computed<Array<{ label: string; value: string; sub?: string }>>(() => {
const a = props.plan?.assumptions
if (!a) return []
return [
{ label: 'Visitors / staff-hour', value: String(a.visitors_per_staff_hour) },
{ label: 'Safety factor', value: `×${a.safety_factor}` },
{ label: 'Minimum staff', value: String(a.min_staff) },
{ label: 'Shift block', value: `${a.shift_length_h} h` },
{ label: 'Labour cost', value: `${formatEuro(a.labor_cost_eur_h)}/h` },
{ label: 'Store hours', value: `${a.store_hours.open}–${a.store_hours.close}`, sub: a.store_hours.tz },
]
})
function cellStyle(intensity: number) {
return { backgroundColor: `rgba(0, 195, 205, ${(0.07 + Math.max(0, Math.min(1, intensity)) * 0.33).toFixed(3)})` }
}
function cellLabel(
day: { weekdayLong: string; dayNumber: string; month: string },
cell: { hour: number; required: number; scheduled: number },
) {
const prefix = `${day.weekdayLong} ${day.dayNumber} ${day.month} at ${cell.hour}:00`
return cell.required ? `${prefix}: ${cell.scheduled} scheduled, ${cell.required} required.` : `${prefix}: no plan hour.`
}
function selectSensor(event: Event) {
const value = (event.target as HTMLSelectElement).value
if (value) emit('update:sensor-id', value)
}
function csvCell(value: unknown) {
const text = value == null ? '' : String(value)
return /[",\n]/.test(text) ? `"${text.replaceAll('"', '""')}"` : text
}
function exportCsv() {
if (!import.meta.client || !props.plan) return
try {
const plan = props.plan
const rows: Array<Array<string | number>> = [
['Sensing Engine staffing plan'],
['sensor', plan.sensor, 'scenario', plan.scenario, 'standard', plan.standard],
['cached', plan.cached ? 'true' : 'false', 'data_version', plan.data_version, 'model_version', plan.model_version],
[],
['shift blocks'],
['date', 'start', 'end', 'staff'],
...plan.shifts.map((shift) => [shift.date, shift.start, shift.end, shift.staff]),
[],
['hourly plan'],
['date', 'hour', 'footfall_est_devices', 'required_staff', 'scheduled_staff', 'coverage'],
...plan.hours.map((hour) => {
const parts = berlinParts(hour.t)
return [parts.date, `${String(parts.hour).padStart(2, '0')}:00`, hour.footfall, hour.required_staff, hour.scheduled_staff, hour.coverage]
}),
]
const csv = rows.map((row) => row.map(csvCell).join(',')).join('\n')
const blob = new Blob([`\uFEFF${csv}`], { type: 'text/csv;charset=utf-8' })
const url = URL.createObjectURL(blob)
const anchor = document.createElement('a')
anchor.href = url
anchor.download = `sensing-engine-staffing-${plan.sensor || 'plan'}-${plan.scenario}.csv`
anchor.click()
anchor.remove()
URL.revokeObjectURL(url)
exportNote.value = `Exported ${plan.shifts.length} shift blocks and ${plan.hours.length} hourly rows.`
} catch {
exportNote.value = 'The browser blocked the download; no file was created.'
}
}
</script>
<template>
<div class="grid grid-cols-1 items-start gap-6 lg:grid-cols-12">
<div v-if="error" class="flex flex-col gap-3 rounded-xl border border-[#00C3CD]/40 bg-[#132b40] p-4 sm:flex-row sm:items-center sm:justify-between lg:col-span-12" role="alert">
<div class="flex min-w-0 items-start gap-3">
<Icon name="material-symbols:info" class="mt-0.5 shrink-0 text-[20px] text-[#00C3CD]" />
<div class="flex min-w-0 flex-col gap-0.5">
<span class="font-semibold text-white">{{ plan ? 'Plan refresh failed' : 'Live plan unavailable' }}</span>
<span class="text-[12px] leading-relaxed text-[#94A3B8]">{{ error }} {{ plan ? 'The last known response stays visible.' : 'Nothing is estimated or filled in.' }}</span>
</div>
</div>
<button type="button" class="flex h-10 shrink-0 items-center justify-center gap-2 rounded-lg border border-[#00C3CD]/40 bg-[#00C3CD]/10 px-4 text-[12px] font-semibold text-[#00C3CD] transition-colors hover:bg-[#00C3CD]/20" @click="emit('refresh')">
<Icon name="material-symbols:refresh" class="text-[18px]" /> Retry
</button>
</div>
<div class="flex min-w-0 flex-col gap-6 lg:col-span-5">
<section class="relative flex flex-col gap-5 overflow-hidden rounded-xl border border-[#1e3a52] bg-[#0e2233] p-6 shadow-sm">
<div class="flex flex-col gap-1">
<span class="text-[11px] font-semibold uppercase tracking-widest text-[#00C3CD]">Optimization query</span>
<h2 class="text-lg font-bold leading-snug tracking-tight text-white md:text-xl">How many staff for the next peak?</h2>
</div>
<div class="flex flex-col gap-1.5">
<label for="staffing-sensor" class="text-[10px] font-semibold uppercase tracking-wider text-[#64748B]">Store sensor</label>
<div class="relative">
<select id="staffing-sensor" :value="sensorId" :disabled="!sensors?.length" class="h-10 w-full appearance-none rounded-lg border border-[#1e3a52] bg-[#081723] px-3 pr-9 text-[12px] font-medium text-white outline-none transition-colors focus:border-[#00C3CD]/60 disabled:cursor-not-allowed disabled:opacity-60 [&>option]:bg-[#0e2233] [&>option]:text-white" @change="selectSensor">
<option v-for="sensor in sensors ?? []" :key="sensor.id" :value="sensor.id">{{ sensor.name }}</option>
<option v-if="!sensors?.length" value="" disabled>Sensor list unavailable</option>
</select>
<Icon name="material-symbols:expand-more" class="pointer-events-none absolute right-3 top-1/2 -translate-y-1/2 text-[18px] text-[#94A3B8]" />
</div>
</div>
<div v-if="pending" class="flex items-center gap-2 rounded-lg border border-[#1e3a52] bg-[#132b40] px-3 py-2 text-[11px] text-[#94A3B8]" role="status">
<span class="h-1.5 w-1.5 animate-pulse rounded-full bg-[#00C3CD]" aria-hidden="true" />
Refreshing the plan for the selected sensor…
</div>
<div class="relative flex flex-col gap-3 rounded-xl border border-[#00C3CD]/30 bg-[#132b40] p-5 shadow-inner">
<div class="flex flex-wrap items-center justify-between gap-2">
<span class="text-[11px] font-bold uppercase tracking-wider text-[#00C3CD]">Peak shift</span>
<span class="rounded border border-[#00C3CD]/40 bg-[#00C3CD]/15 px-2 py-0.5 font-mono text-[10px] font-bold text-[#00C3CD]">BLOCK OUTPUT · {{ plan?.assumptions.shift_length_h ?? '—' }} H</span>
</div>
<template v-if="plan && peakShift">
<div class="flex flex-wrap items-end gap-x-2 gap-y-1">
<span class="text-3xl font-extrabold tracking-tight text-white">{{ peakShift.staff }}</span>
<span class="pb-1 text-sm font-semibold text-[#00C3CD]">staff on the peak shift</span>
</div>
<div class="flex flex-col">
<span class="text-base font-semibold text-white">{{ peakShiftLabel }}</span>
<span class="text-[12px] text-[#94A3B8]">{{ peakShift.start }}–{{ peakShift.end }} local</span>
</div>
<p class="text-[10px] leading-relaxed text-[#64748B]">Plan input: {{ planSensor?.name ?? plan.sensor }} · {{ plan.standard }} standard. Footfall is estimated devices, not people.</p>
</template>
<div v-else-if="!plan && pending" class="flex flex-col gap-2.5" aria-busy="true">
<div class="h-8 w-32 animate-pulse rounded bg-white/10" />
<div class="h-3 w-48 animate-pulse rounded bg-white/10" />
<div class="h-3 w-40 animate-pulse rounded bg-white/10" />
<p class="text-[10px] text-[#94A3B8]">Loading the live plan. No values are estimated.</p>
</div>
<p v-else class="text-sm leading-relaxed text-[#94A3B8]">{{ error ? 'No plan response is available, so no staff count or shift window is shown.' : 'The API returned no shift blocks for this plan. No staff count is estimated.' }}</p>
</div>
<div v-if="plan" class="grid grid-cols-2 gap-2.5">
<DecisionMetric label="Peak footfall" :value="formatNumber(snapshot.peakFootfall)" hint="est. devices/h" tone="accent" />
<DecisionMetric label="Staff hours" :value="formatNumber(snapshot.staffHours)" hint="scheduled" />
<DecisionMetric label="Saved vs flat" :value="formatEuro(snapshot.savedEur)" :hint="`${formatPercent(snapshot.savedPct, 1)} vs flat`" tone="accent" />
<DecisionMetric label="Coverage" :value="formatPercent(snapshot.coveragePct, 1)" hint="scheduled ≥ required" />
</div>
<p v-if="plan" class="text-[10px] leading-relaxed text-[#64748B]">
Coverage = scheduled ≥ required; the block heuristic keeps this at 100% for complete plans. It is not a
service-quality or forecast-accuracy score. Footfall is estimated devices, not people.
</p>
<div v-if="plan" class="flex flex-col gap-1.5">
<span class="text-[11px] font-bold uppercase tracking-wider text-[#94A3B8]">Fused rationale</span>
<ul v-if="plan.why.length" class="flex flex-col gap-1.5">
<li v-for="reason in plan.why.slice(0, 3)" :key="reason" class="flex gap-2 text-[12px] leading-relaxed text-[#94A3B8]">
<span class="mt-1.5 h-1 w-1 shrink-0 rounded-full bg-[#00C3CD]" aria-hidden="true" />
<span>{{ reason }}</span>
</li>
</ul>
<p v-else class="text-[12px] leading-relaxed text-[#94A3B8]">No API rationale lines were returned with this plan. The declared rule below still applies.</p>
<p class="text-[11px] leading-relaxed text-[#94A3B8]">
<strong class="text-white">Rule.</strong> {{ plan.assumptions.visitors_per_staff_hour }} visitors per staff-hour × {{ plan.assumptions.safety_factor }} safety factor, minimum {{ plan.assumptions.min_staff }} staff, {{ plan.assumptions.shift_length_h }} h shift blocks.
</p>
</div>
<div class="flex flex-col gap-2.5 pt-1">
<span class="text-[11px] font-bold uppercase tracking-wider text-[#94A3B8]">Sensor context · historical baseline</span>
<div v-for="row in telemetryRows" :key="row.title" class="flex items-center justify-between gap-3 rounded-lg border border-white/10 bg-[#132b40] p-3">
<div class="flex min-w-0 items-center gap-3">
<Icon :name="row.icon" class="shrink-0 text-[20px]" :class="row.iconClass" />
<div class="flex min-w-0 flex-col">
<span class="text-[13px] font-semibold text-white">{{ row.title }}</span>
<span class="break-words text-[11px] text-[#94A3B8]">{{ row.detail }}</span>
</div>
</div>
<span class="shrink-0 rounded border px-2 py-0.5 text-[11px] font-semibold" :class="row.badgeClass">
{{ row.badge }}
</span>
</div>
</div>
<div class="flex flex-col gap-2 pt-1">
<button type="button" class="flex h-10 items-center justify-center gap-2 rounded-lg bg-[#00C3CD] px-4 text-[13px] font-semibold text-[#081723] shadow-[0_0_16px_rgba(0,195,205,0.3)] transition-all hover:bg-[#00d8e4] disabled:cursor-not-allowed disabled:opacity-60" :disabled="!plan" @click="exportCsv">
<Icon name="material-symbols:download" class="text-[18px]" /> Export shift CSV
</button>
<div class="grid grid-cols-1 gap-2 sm:grid-cols-2">
<NuxtLink to="/plan" class="flex h-10 items-center justify-center gap-1.5 rounded-lg border border-[#1e3a52] bg-[#132b40] px-3 text-[13px] font-semibold text-[#94A3B8] transition-all hover:bg-[#18364e] hover:text-white">
<Icon name="material-symbols:open-in-new" class="text-[18px]" /> Open full plan
</NuxtLink>
<button type="button" class="flex h-10 items-center justify-center gap-1.5 rounded-lg border border-[#1e3a52] bg-[#132b40] px-3 text-[13px] font-semibold text-[#94A3B8] transition-all hover:bg-[#18364e] hover:text-white" :aria-expanded="assumptionsOpen" @click="assumptionsOpen = !assumptionsOpen">
<Icon name="material-symbols:query-stats" class="text-[18px]" /> Inspect assumptions
</button>
</div>
<p v-if="exportNote" class="text-[10px] text-[#94A3B8]" role="status">{{ exportNote }}</p>
<div v-if="assumptionsOpen && plan" class="flex flex-col gap-2 rounded-lg border border-[#1e3a52] bg-[#081723] p-3">
<div class="grid grid-cols-2 gap-x-3 gap-y-2 text-[11px]">
<div v-for="row in assumptionRows" :key="row.label" class="flex flex-col">
<span class="text-[#64748B]">{{ row.label }}</span>
<span class="break-words font-mono font-semibold text-white">{{ row.value }}</span>
<span v-if="row.sub" class="break-words text-[9px] text-[#64748B]">{{ row.sub }}</span>
</div>
</div>
<p class="text-[10px] leading-relaxed text-[#64748B]">Coverage = scheduled ≥ required; the block heuristic keeps this at 100% for complete plans. It is a property of the heuristic, not a service-quality claim. No POS, queue or payroll feed is used.</p>
</div>
<p v-else-if="assumptionsOpen" class="rounded-lg border border-[#1e3a52] bg-[#081723] p-3 text-[10px] text-[#94A3B8]">Assumptions are unavailable until a plan response arrives.</p>
</div>
</section>
</div>
<div class="flex min-w-0 flex-col gap-6 lg:col-span-7">
<section class="flex flex-col gap-4 rounded-xl border border-[#1e3a52] bg-[#0e2233] p-5 shadow-sm md:p-6">
<div class="flex flex-wrap items-center justify-between gap-2">
<div class="flex min-w-0 items-center gap-2">
<Icon name="material-symbols:table-chart" class="shrink-0 text-[20px] text-[#00C3CD]" />
<span class="text-base font-bold text-white">Workforce adequacy matrix</span>
</div>
<div class="flex flex-wrap items-center gap-2">
<span v-if="peakDay" class="text-[12px] text-[#94A3B8]">
Peak day {{ peakDay.weekdayLong }} {{ peakDay.dayNumber }} {{ peakDay.month }}
</span>
<span v-if="peakDay" class="h-1.5 w-1.5 rounded-full bg-[#00C3CD]" aria-hidden="true" />
<span class="font-mono text-[11px] text-[#00C3CD]">
{{ plan ? `${days.length} days · ${hourColumns.length} open hours` : 'No plan loaded' }}
</span>
</div>
</div>
<template v-if="matrixRows.length">
<div class="overflow-hidden rounded-lg border border-[#1e3a52] bg-[#081723] p-2">
<table class="w-full table-fixed border-separate border-spacing-0.5" :aria-label="`Workforce adequacy matrix: ${days.length} local days by ${hourColumns.length} store hours`">
<thead>
<tr>
<th scope="col" class="w-[2.35rem] pb-1 text-left text-[9px] font-semibold uppercase tracking-wider text-[#64748B]"><span class="sr-only">Day</span></th>
<th v-for="hour in hourColumns" :key="hour" scope="col" class="pb-1 text-center text-[9px] font-semibold text-[#64748B]">{{ String(hour).padStart(2, '0') }}</th>
</tr>
</thead>
<tbody>
<tr v-for="day in matrixRows" :key="day.date">
<th scope="row" class="pr-1 align-middle">
<span class="block truncate text-[10px] font-bold" :class="day.isPeak ? 'text-[#00C3CD]' : 'text-white'">{{ day.weekday }}</span>
<span class="block text-[9px] font-normal text-[#64748B]">{{ day.dayNumber }}</span>
</th>
<td v-for="cell in day.cells" :key="cell.hour" class="p-0 align-middle" :aria-label="cellLabel(day, cell)">
<div class="flex h-7 w-full items-center justify-center rounded-[3px] border border-white/10 sm:h-8" :class="cell.required ? 'text-white' : 'bg-[#0e2233] text-[#64748B]'" :style="cell.required ? cellStyle(cell.intensity) : undefined" aria-hidden="true">
<span class="font-mono text-[9px] font-semibold leading-none">{{ cell.required ? cell.scheduled : '–' }}</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<div class="flex flex-wrap items-center justify-between gap-2 text-[10px] text-[#64748B]">
<div class="flex flex-wrap items-center gap-3">
<span class="flex items-center gap-1.5"><span class="h-2.5 w-2.5 rounded-[2px] border border-white/10" :style="cellStyle(0.2)" aria-hidden="true" />Lower requirement</span>
<span class="flex items-center gap-1.5"><span class="h-2.5 w-2.5 rounded-[2px] border border-white/10" :style="cellStyle(1)" aria-hidden="true" />Day peak</span>
<span class="flex items-center gap-1.5"><span class="h-2.5 w-2.5 rounded-[2px] border border-white/10 bg-[#0e2233]" aria-hidden="true" />No hour</span>
</div>
<span>Number = scheduled staff · local hours {{ hourRange }}</span>
</div>
<p class="text-[10px] leading-relaxed text-[#64748B]">
Intensity = required staff ÷ that day's peak requirement. Coverage = scheduled ≥ required; the block
heuristic keeps this at 100% for complete plans. It is a scheduling property, not a quality score.
</p>
</template>
<div v-else class="rounded-lg border border-dashed border-[#1e3a52] bg-[#132b40] p-4 text-[11px] leading-relaxed text-[#94A3B8]" role="status">
{{ pending ? 'Loading the plan days for this sensor…' : 'No plan days are available. The matrix stays empty rather than being estimated.' }}
</div>
</section>
<section class="flex flex-col gap-4 rounded-xl border border-[#1e3a52] bg-[#0e2233] p-5 shadow-sm md:p-6">
<div class="flex flex-wrap items-center justify-between gap-2">
<div class="flex items-center gap-2">
<Icon name="material-symbols:calendar-month" class="text-[20px] text-[#00C3CD]" />
<span class="text-base font-bold text-white">Shift comparison</span>
</div>
<span class="rounded border border-[#1e3a52] bg-[#132b40] px-2.5 py-1 font-mono text-[11px] text-[#94A3B8]">
{{ plan ? `${days.length} days · ${formatNumber(snapshot.staffHours)} staff-hours` : 'No plan loaded' }}
</span>
</div>
<div v-if="days.length" class="flex flex-col gap-2">
<article v-for="day in days" :key="day.date" class="rounded-lg border p-3 transition-colors" :class="day.date === peakDate ? 'border-[#00C3CD]/40 bg-[#132b40]' : 'border-[#1e3a52] bg-[#132b40] hover:border-[#64748B]/60'">
<div class="flex flex-wrap items-center justify-between gap-x-3 gap-y-1">
<div class="flex flex-wrap items-center gap-2">
<span class="text-[13px] font-bold text-white">{{ day.weekdayLong }}</span>
<span class="text-[11px] text-[#64748B]">{{ day.dayNumber }} {{ day.month }}</span>
<span v-if="day.date === peakDate" class="rounded bg-[#00C3CD] px-2 py-0.5 text-[10px] font-bold tracking-wide text-[#081723]">PEAK DAY</span>
</div>
<div class="flex items-baseline gap-1.5">
<span class="font-mono text-base font-bold" :class="day.date === peakDate ? 'text-[#00C3CD]' : 'text-white'">{{ day.peakStaff }}</span>
<span class="text-[10px] text-[#64748B]">peak staff</span>
</div>
</div>
<div class="mt-2.5 grid grid-cols-1 gap-2.5 sm:grid-cols-[minmax(0,1fr)_auto] sm:items-center">
<div class="flex flex-col gap-1">
<div class="flex items-center justify-between text-[10px]">
<span class="text-[#94A3B8]">Staff-hours</span>
<span class="font-mono font-semibold text-white">{{ day.staffHours }}</span>
</div>
<MiniBar :value="maxStaffHours ? (day.staffHours / maxStaffHours) * 100 : 0" :tone="day.date === peakDate ? 'accent' : 'muted'" :label="`${day.weekdayLong}: ${day.staffHours} scheduled staff-hours`" />
</div>
<div class="flex items-center justify-between gap-4 text-[10px] sm:justify-end">
<span class="text-[#94A3B8]">Overstaffed</span>
<span class="font-mono font-semibold text-white">{{ day.overHours }} h</span>
</div>
</div>
<div class="mt-2 flex flex-wrap items-center gap-1.5">
<span v-for="shift in day.shifts" :key="`${shift.start}-${shift.end}`" class="rounded border border-[#1e3a52] bg-[#0e2233] px-2 py-0.5 font-mono text-[10px] text-[#94A3B8]" :aria-label="`${shift.staff} staff, ${shift.start} to ${shift.end}`">{{ shift.start }}–{{ shift.end }}</span>
<span v-if="!day.shifts.length" class="text-[10px] text-[#64748B]">No shift blocks</span>
</div>
</article>
</div>
<div v-else class="rounded-lg border border-dashed border-[#1e3a52] bg-[#132b40] p-4 text-[11px] leading-relaxed text-[#94A3B8]" role="status">
{{ pending ? 'Loading the shift plan…' : 'No shift rows are available. Nothing is estimated.' }}
</div>
</section>
</div>
</div>
</template>