diff --git a/packages/shared/src/blocks/ShopBlock.svelte b/packages/shared/src/blocks/ShopBlock.svelte index a2128d4..e6f6740 100644 --- a/packages/shared/src/blocks/ShopBlock.svelte +++ b/packages/shared/src/blocks/ShopBlock.svelte @@ -1,8 +1,9 @@ @@ -178,7 +234,7 @@ {/if}
- {priceFormatter.format(item.price)} + {formatPrice(item.price)} {#if isService && item.duration != null} {item.duration} min {:else if !isService && item.stock != null && item.stock > 0 && item.stock <= 5} @@ -245,8 +301,53 @@
{#if isService && ui?.pickerOpen && itemSlotsByDay} + {@const availableKeys = [...itemSlotsByDay.keys()].sort()} + {@const months = pickerMonths(ui.monthOffset)} + {@const shownFrom = months[0].days.find((d) => d.inMonth)!.dateKey} + {@const shownTo = months[months.length - 1].days.findLast((d) => d.inMonth)!.dateKey} + {@const anyShown = availableKeys.some((key) => key >= shownFrom && key <= shownTo)} + {@const lastOffset = monthOffsetOf(availableKeys[availableKeys.length - 1]) - (MONTHS_SHOWN - 1)}
-

Select a date

+
+ +

Select a date

+ +
+ + {#if !anyShown && availableKeys.length} + +
+ + {availableKeys[0] > shownTo ? 'The first available date is' : 'The next available date is'} + {formatDateKey(availableKeys.find((key) => key > shownTo) ?? availableKeys[0], { weekday: 'long', day: 'numeric', month: 'long', year: 'numeric' })}. + + +
+ {/if} +
{#each months as month (month.label)}
@@ -282,34 +383,64 @@ {#if ui.selectedDayKey} {@const daySlots = itemSlotsByDay.get(ui.selectedDayKey) ?? []} -

Available times

+

+ Available times · {formatDateKey(ui.selectedDayKey, { weekday: 'long', day: 'numeric', month: 'long', year: 'numeric' })} +

{#each daySlots as slot (slot.id)} - {@const seatsInBasket = basket.lines.find((l) => l.slot === slot.id)?.quantity ?? 0} - {@const slotInBasket = seatsInBasket > 0} + {@const line = basket.lines.find((l) => l.slot === slot.id)} {@const isGroup = slot.capacity > 1} - + {@const label = `${formatTime(slot.start)}${item.duration != null ? ` · ${item.duration} min` : ''}`} + {#if isGroup && line} + +
+ {label} · {placesLeft(slot.free)} + + + + {#if ui.pendingSlotId === slot.id}{:else}{line.quantity}{/if} + {line.quantity === 1 ? 'place' : 'places'} in your basket + + + +
+ {:else} + + {/if} {/each}
- {:else} + {:else if anyShown}

Days with availability are highlighted{item.duration != null ? ` · ${item.duration} min per session` : ''}.