{#if data.title}

{data.title}

{/if} {#if !visibleItems.length}

Nothing is available to book right now — please check back soon.

{/if}
{#each visibleItems as item (item.id)} {@const ui = cardStates[item.id]} {@const itemSlotsByDay = slotsByDay.get(item.id)} {@const isService = item.type === 'item_with_time'} {@const soldOut = !isService && item.stock === 0} {@const itemInBasket = !isService && basket.lines.some((l) => l.item === item.id)}
{#if item.imageUrl} {item.name} {:else} {/if}

{item.name}

{#if item.description}

{item.description}

{/if}
{priceFormatter.format(item.price)} {#if isService && item.duration != null} {item.duration} min {:else if !isService && item.stock != null && item.stock > 0 && item.stock <= 5} Only {item.stock} left {:else if soldOut} Sold out {/if}
{#if ui?.errorMsg} {/if}
{#if isService} {:else} {#if itemInBasket} ✓ In basket {/if} {/if}
{#if isService && ui?.pickerOpen && itemSlotsByDay}

Select a date

{#each months as month (month.label)}

{month.label}

{#each weekdayLetters as letter, i (i)} {letter} {/each} {#each month.days as day (day.dateKey)} {@const selectable = day.inMonth && itemSlotsByDay.has(day.dateKey)} {@const selected = selectable && ui.selectedDayKey === day.dateKey} {/each}
{/each}
{#if ui.selectedDayKey} {@const daySlots = itemSlotsByDay.get(ui.selectedDayKey) ?? []}

Available times

{#each daySlots as slot (slot.id)} {@const slotInBasket = basket.lines.some((l) => l.slot === slot.id)} {/each}
{:else}

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

{/if} {#if ui.justAdded}

Added ✓ — view basket

{/if}
{/if}
{/each}