Admin: lengths and prices per service; windows and group sessions on /slots

Services get rows of length + price. /slots creates windows (date, hours,
services, start-times mode) and group sessions (service, length, start,
places); the day view shows free time and bookings. Generate/copy/clear
handle both kinds; windows may not overlap and can't shrink past a booking.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Hy2vMnHJYP7QGsiH21zHxW
This commit is contained in:
agent 2026-10-25 20:12:46 +00:00
parent eac99b2abe
commit 636b59c706
12 changed files with 667 additions and 329 deletions

View file

@ -1,5 +1,6 @@
import { error, fail, redirect } from '@sveltejs/kit';
import { emailTemplateMeta, isEmailTemplateKey } from '$lib/email';
import { parseDurations } from '$shared/items';
import { isEmailConfigured, loadEmailSettings, loadEmailTemplate, sendTestEmail } from '$lib/server/email';
import type { EmailBlock } from '$lib/types';
import type { Actions, PageServerLoad } from './$types';
@ -20,7 +21,10 @@ async function findSampleService(pb: App.Locals['pb']) {
return pb
.collection('items')
.getFirstListItem("type = 'item_with_time' && active = true", { sort: 'name' })
.then((item) => ({ name: String(item.name), price: Number(item.price) || 0, duration: Number(item.duration) || null }))
.then((item) => {
const duration = parseDurations(item.durations)[0];
return { name: String(item.name), price: duration?.price ?? (Number(item.price) || 0), duration: duration?.minutes ?? null };
})
.catch(() => undefined);
}