From 05d865968509d6794da744d8f7860529590dfd50 Mon Sep 17 00:00:00 2001 From: agent Date: Tue, 27 Oct 2026 09:25:01 +0000 Subject: [PATCH] Dashboard: coming up and needs attention first; year total on the chart New order: Coming up (grouped by day) and Needs attention side by side (stacked on a phone, with an all-clear message when empty), then the income/hours tiles (two per row on a phone), then the income chart with the year's total in its header and the month table folded under "Show as table", then customers/regulars, what sells and popular lengths. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01HA82gV9YDZk1XhjJ5LtyAt --- app-admin/src/routes/+page.svelte | 239 +++++++++++++++++------------- 1 file changed, 136 insertions(+), 103 deletions(-) diff --git a/app-admin/src/routes/+page.svelte b/app-admin/src/routes/+page.svelte index e88543c..4719824 100644 --- a/app-admin/src/routes/+page.svelte +++ b/app-admin/src/routes/+page.svelte @@ -1,6 +1,6 @@ Dashboard | CMS {#snippet tile(label: string, value: string, note: string)} -
+

{label}

-

{value}

+

{value}

{note}

{/snippet} @@ -60,90 +70,126 @@

How the studio is doing. Income is paid orders, in the month they were paid; hours are booked appointment time, with group sessions counted once.

-
- {@render tile(`Income in ${thisMonthName}`, money(dashboard.thisMonth.income), `${incomeChange >= 0 ? '+' : '−'}${money(Math.abs(incomeChange))} on ${monthLabel(dashboard.lastMonth.month, { month: 'long' })}`)} - {@render tile( - `Income in ${dashboard.thisMonth.month.slice(0, 4)}`, - money(dashboard.incomeThisYear), - `${dashboard.thisMonth.orders} ${dashboard.thisMonth.orders === 1 ? 'order' : 'orders'} this month${dashboard.thisMonth.orders ? `, ${money(dashboard.thisMonth.income / dashboard.thisMonth.orders)} on average` : ''}` - )} - {@render tile(`Hours worked in ${thisMonthName}`, hours(dashboard.minutesDoneThisMonth), `${hours(dashboard.minutesAheadThisMonth)} still booked this month`)} - {@render tile( - 'Opened time booked', - utilisationPercent === null ? '—' : `${utilisationPercent} %`, - dashboard.utilisation ? `${hours(dashboard.utilisation.booked)} of ${hours(dashboard.utilisation.open)} opened in Slots this month` : 'No slots opened this month' - )} - {@render tile(`Next ${dashboard.upcomingDays} days`, `${dashboard.upcoming.length} ${dashboard.upcoming.length === 1 ? 'booking' : 'bookings'}`, `${hours(dashboard.upcomingMinutes)} of appointments`)} - {@render tile(`Customers in ${thisMonthName}`, String(customersThisMonth), `${dashboard.newCustomers} new, ${dashboard.returningCustomers} returning`)} - {@render tile('Vouchers & codes owed', money(dashboard.valueOutstanding), `${dashboard.codesOutstanding} ${dashboard.codesOutstanding === 1 ? 'code' : 'codes'} with sessions still to book`)} - {@render tile('Needs attention', String(dashboard.attention.length), dashboard.attention.length ? 'See the list below' : 'Nothing right now')} -
- -{#if dashboard.attention.length} -
-

Needs attention

-
    - {#each dashboard.attention as item, i (i)} -
  • - {#if item.kind === 'email'} - ⚠ Email failed - Booking email for {item.customer}{#if item.created} · ordered {formatDateTime(item.created, data.timezone)}{/if} - Resend in Orders - {:else if item.kind === 'session'} - ◔ Nearly full - {item.name || 'Group session'} · {formatDateTime(item.start, data.timezone)} · {item.taken} of {item.capacity} places taken - Slots - {:else} - ⏱ Expires soon - {item.code} ({item.name}) · {item.left} {item.left === 1 ? 'session' : 'sessions'} left · expires {formatDateTime(item.expiresAt, data.timezone)} - Vouchers & codes - {/if} -
  • - {/each} -
-

Sessions and codes in the next {dashboard.attentionDays} days.

-
-{/if} - -
-
-

Income per month

- -
- -
-

Coming up

- {#if dashboard.upcoming.length} -
    - {#each dashboard.upcoming as booking, i (i)} -
  • - {dayLabel(booking.start)} - {timeLabel(booking.start)} · {formatDuration(booking.minutes)} - - {booking.name}{#if booking.quantity > 1} × {booking.quantity}{/if} - {#if booking.customer}{booking.customer}{/if} - -
  • + +
    +
    +
    +

    Coming up

    +

    + Next {dashboard.upcomingDays} days: {dashboard.upcoming.length} {dashboard.upcoming.length === 1 ? 'booking' : 'bookings'}, {hours(dashboard.upcomingMinutes)} +

    +
    + {#if upcomingDays.length} +
    + {#each upcomingDays as day (day.key)} +
    +

    {day.key === todayKey ? 'Today' : day.label}

    +
      + {#each day.bookings as booking, i (i)} +
    • + {timeLabel(booking.start)} + + {booking.name}{#if booking.quantity > 1} × {booking.quantity}{/if} + {formatDuration(booking.minutes)}{#if booking.customer} · {booking.customer}{/if} + +
    • + {/each} +
    +
    {/each} -
+
{:else}

Nothing booked in the next {dashboard.upcomingDays} days.

{/if} All orders + +
+
+

Needs attention

+

Sessions and codes: next {dashboard.attentionDays} days

+
+ {#if dashboard.attention.length} +
    + {#each dashboard.attention as item, i (i)} +
  • + {#if item.kind === 'email'} + ⚠ Email failed + Booking email for {item.customer}{#if item.created} · ordered {formatDateTime(item.created, data.timezone)}{/if} + Resend in Orders + {:else if item.kind === 'session'} + ◔ Nearly full + {item.name || 'Group session'} · {formatDateTime(item.start, data.timezone)} · {item.taken} of {item.capacity} places taken + Slots + {:else} + ⏱ Expires soon + {item.code} ({item.name}) · {item.left} {item.left === 1 ? 'session' : 'sessions'} left · expires {formatDateTime(item.expiresAt, data.timezone)} + Vouchers & codes + {/if} +
  • + {/each} +
+ {:else} +

✓ All clear: no failed emails, nearly full sessions or codes about to expire.

+ {/if} +
-
-
-

What sells

- {@render salesTable(dashboard.sales, (row) => row.name, 'Nothing sold yet.')} -
-
-

Popular lengths

- {@render salesTable(dashboard.lengths, (row) => `${row.name} · ${formatDuration(row.minutes)}`, 'No bookings yet.')} -
-
-

Regulars

+
+ {@render tile(`Income in ${thisMonthName}`, money(dashboard.thisMonth.income), `${incomeChange >= 0 ? '+' : '−'}${money(Math.abs(incomeChange))} on ${monthLabel(dashboard.lastMonth.month, { month: 'long' })}`)} + {@render tile(`Hours worked in ${thisMonthName}`, hours(dashboard.minutesDoneThisMonth), `${hours(dashboard.minutesAheadThisMonth)} still booked`)} + {@render tile( + 'Opened time booked', + utilisationPercent === null ? '—' : `${utilisationPercent} %`, + dashboard.utilisation ? `${hours(dashboard.utilisation.booked)} of ${hours(dashboard.utilisation.open)} in Slots this month` : 'No slots opened this month' + )} + {@render tile('Codes owed', money(dashboard.valueOutstanding), `${dashboard.codesOutstanding} ${dashboard.codesOutstanding === 1 ? 'code' : 'codes'} with sessions to book`)} +
+ +
+
+
+

Income

+

Per month, last {dashboard.months.length} months

+
+
+

Income in {dashboard.thisMonth.month.slice(0, 4)}

+

{money(dashboard.incomeThisYear)}

+

+ {dashboard.thisMonth.orders} {dashboard.thisMonth.orders === 1 ? 'order' : 'orders'} this month{#if dashboard.thisMonth.orders}, {money(dashboard.thisMonth.income / dashboard.thisMonth.orders)} on average{/if} +

+
+
+ +
+ Show as table +
+ + + + + + {#each [...dashboard.months].reverse() as row (row.month)} + + + + + + + {/each} + +
MonthOrdersIncomeHours
{monthLabel(row.month, { month: 'short', year: 'numeric' })}{row.orders}{money(row.income)}{hours(row.minutes)}
+
+
+
+ +
+
+

Customers

+

+ {dashboard.newCustomers + dashboard.returningCustomers} in {thisMonthName}: {dashboard.newCustomers} new, {dashboard.returningCustomers} returning +

+

Regulars

{#if dashboard.regulars.length} @@ -157,26 +203,13 @@

Nobody has ordered more than once yet.

{/if} +
+

What sells

+ {@render salesTable(dashboard.sales, (row) => row.name, 'Nothing sold yet.')} +
+
+

Popular lengths

+ {@render salesTable(dashboard.lengths, (row) => `${row.name} · ${formatDuration(row.minutes)}`, 'No bookings yet.')} +
-

What sells, popular lengths and regulars cover the last {dashboard.months.length} months.

- -
-

Month by month

-
-
OrdersSpent
- - - - - {#each [...dashboard.months].reverse() as row (row.month)} - - - - - - - {/each} - -
MonthOrdersIncomeHours
{monthLabel(row.month)}{row.orders}{money(row.income)}{hours(row.minutes)}
-
-
+

Regulars, what sells and popular lengths cover the last {dashboard.months.length} months.