Add time-based day progress bar to dashboards
Replaces block-count progress with a wall-clock progress bar driven by configurable day start/end hours on each schedule template. - ScheduleTemplate: add day_start_time / day_end_time (TIME, nullable) - Startup migration: idempotent ALTER TABLE for existing DBs - Dashboard snapshot: includes day_start_time / day_end_time from template - Admin → Schedules: time pickers in block editor to set day hours - Dashboard view: time-based progress bar with start/current/end labels - TV view: full-width day progress strip between header and main content Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
This commit is contained in:
1 parent
462205cdc1
commit
3e7ff2a50b
10 files changed
+212
-37
No files matched your search
@@ -135,6 +135,24 @@
|
||||
|
||||
<!-- Block editor -->
|
||||
<div v-if="editingTemplate === template.id" class="block-editor">
|
||||
<!-- Day hours -->
|
||||
<div class="day-hours-row">
|
||||
<span class="day-hours-label">School day hours</span>
|
||||
<input
|
||||
type="time"
|
||||
:value="template.day_start_time ? template.day_start_time.slice(0,5) : ''"
|
||||
@change="e => saveDayHours(template, 'start', e.target.value)"
|
||||
placeholder="Start"
|
||||
/>
|
||||
<span class="day-hours-sep">to</span>
|
||||
<input
|
||||
type="time"
|
||||
:value="template.day_end_time ? template.day_end_time.slice(0,5) : ''"
|
||||
@change="e => saveDayHours(template, 'end', e.target.value)"
|
||||
placeholder="End"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="block-list">
|
||||
<div v-for="block in template.blocks" :key="block.id" class="block-row">
|
||||
<span class="block-time">{{ block.time_start }} – {{ block.time_end }}</span>
|
||||
@@ -300,6 +318,14 @@ async function deleteBlock(templateId, blockId) {
|
||||
await loadTemplates()
|
||||
}
|
||||
|
||||
async function saveDayHours(template, which, value) {
|
||||
const payload = which === 'start'
|
||||
? { day_start_time: value || null }
|
||||
: { day_end_time: value || null }
|
||||
await api.patch(`/api/schedules/${template.id}`, payload)
|
||||
await loadTemplates()
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
await childrenStore.fetchChildren()
|
||||
await Promise.all([loadSubjects(), loadTemplates()])
|
||||
@@ -391,6 +417,26 @@ h2 { font-size: 1.1rem; color: #94a3b8; text-transform: uppercase; letter-spacin
|
||||
.template-actions { display: flex; gap: 0.5rem; flex-shrink: 0; }
|
||||
|
||||
.block-editor { margin-top: 1.25rem; border-top: 1px solid #334155; padding-top: 1.25rem; }
|
||||
|
||||
.day-hours-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.6rem;
|
||||
margin-bottom: 1rem;
|
||||
background: #0f172a;
|
||||
padding: 0.6rem 0.85rem;
|
||||
border-radius: 0.5rem;
|
||||
}
|
||||
.day-hours-label { font-size: 0.8rem; color: #64748b; flex: 1; }
|
||||
.day-hours-sep { font-size: 0.8rem; color: #475569; }
|
||||
.day-hours-row input[type="time"] {
|
||||
padding: 0.35rem 0.5rem;
|
||||
background: #1e293b;
|
||||
border: 1px solid #334155;
|
||||
border-radius: 0.4rem;
|
||||
color: #f1f5f9;
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
.block-list { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 1rem; }
|
||||
.block-row { display: flex; align-items: center; gap: 0.75rem; padding: 0.5rem; background: #0f172a; border-radius: 0.5rem; }
|
||||
.block-time { font-size: 0.8rem; color: #64748b; font-variant-numeric: tabular-nums; }
|
||||
|
||||
Reference in new issue
Block a user