Shop: duration slider on services, times fetched per service and length
Service cards step through their lengths with a slider and the price follows. The time picker loads bookable times for the chosen length and the months on screen from GET /api/slots (a proxy to the shop hook in each app), and reloads when the basket's bookings change. Checkout, emails and the basket show each booking's own length. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Hy2vMnHJYP7QGsiH21zHxW
This commit is contained in:
parent
23df2ceced
commit
eac99b2abe
18 changed files with 479 additions and 210 deletions
|
|
@ -148,14 +148,12 @@ function orderEmailContext(data: OrderEmailData, settings: EmailSettings) {
|
|||
const lineRecords = [...data.lines].sort((a, b) => String(a.start || '').localeCompare(String(b.start || '')));
|
||||
|
||||
const lines: EmailLine[] = lineRecords.map((line) => {
|
||||
// A booking ends after its own length (order lines from before
|
||||
// lengths were stored fall back to their slot's end).
|
||||
const start = line.start ? new Date(line.start).toISOString() : null;
|
||||
const minutes = Number(line.minutes) || 0;
|
||||
const slotEnd = line.expand?.slot?.end;
|
||||
const duration = Number(line.expand?.item?.duration) || 0;
|
||||
const end = slotEnd
|
||||
? new Date(slotEnd).toISOString()
|
||||
: start && duration
|
||||
? new Date(new Date(start).getTime() + duration * 60_000).toISOString()
|
||||
: null;
|
||||
const end = start && minutes ? new Date(new Date(start).getTime() + minutes * 60_000).toISOString() : slotEnd ? new Date(slotEnd).toISOString() : null;
|
||||
return {
|
||||
name: String(line.name || 'Item'),
|
||||
price: Number(line.price) || 0,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue