From c1548c503f4371681ab117aafdddffd391580a34 Mon Sep 17 00:00:00 2001 From: Stephen Adamson Date: Sun, 9 Nov 2025 01:49:28 +0000 Subject: [PATCH] My account --- frontend/src/routes/account/+page.svelte | 992 +++++++++++++++++++++++ frontend/tailwind.config.js | 27 + 2 files changed, 1019 insertions(+) create mode 100644 frontend/src/routes/account/+page.svelte create mode 100644 frontend/tailwind.config.js diff --git a/frontend/src/routes/account/+page.svelte b/frontend/src/routes/account/+page.svelte new file mode 100644 index 0000000..2a657a3 --- /dev/null +++ b/frontend/src/routes/account/+page.svelte @@ -0,0 +1,992 @@ + + + + + + +{#if pageState === 'loading'} +
+
+ + +
+ + + {#each Array(5) as _, i (i)} + + {/each} + + +
+{:else if pageState === 'authorized'} +
+ +
+

My Account

+

Manage your profile, bookings, and settings

+
+ + +
+
+ + + + +
+
+ + +
+ {#if activeTab === 'general'} + + + + Profile Information + Your personal details and account information + + + {#if loadingUser} + {#each Array(6) as _, i (i)} + + {/each} + {:else if userData} +
+
+ +
+ {userData.firstName} +
+
+
+ +
+ {userData.lastName} +
+
+
+ +
+ {userData.email} +
+
+
+ +
+ {userData.phone || '—'} +
+
+
+ + + +
+
+ {#if userData && userData.loyaltyStamps && userData.loyaltyStamps < 10} +
+ Loyalty Stamps until next reward: +
+
+ {userData.loyaltyStamps} +
+ {:else} +
+
+ Congratulations! You've earned 10% off your next appointment! +
+
+ {/if} +
+
+ {/if} +
+
+ {:else if activeTab === 'history'} + + + + Booking History + Your past and upcoming appointments + + + {#if loadingBookings} + {#each Array(3) as _, i (i)} + + {/each} + {:else if bookings.length === 0} +
No bookings found
+ {:else} + {#each bookings as booking (booking.id)} +
+
+
+
{formatDateTime(booking.start_time)}
+
+ {booking.duration_minutes} minutes +
+
+ + {booking.status} + +
+ + + {#if booking.services && booking.services.length > 0} +
+
Services:
+ {#each booking.services as service (service.service_name)} +
+ {service.service_name} + £{service.price.toFixed(2)} +
+ {/each} +
+ {/if} + + + + +
+
+ Total: + £{booking.total_amount.toFixed(2)} +
+
+ Paid: + £{booking.amount_paid.toFixed(2)} +
+ {#if booking.amount_due > 0} +
+ Due: + £{booking.amount_due.toFixed(2)} +
+ {/if} +
+ + + {#if booking.payments && booking.payments.length > 0} +
+
Payments:
+ {#each booking.payments as payment (payment.id)} +
+ {payment.payment_method.replace('_', ' ')} ({payment.payment_type}) + £{payment.amount.toFixed(2)} +
+ {/each} +
+ {/if} +
+ {/each} + {/if} +
+
+ {:else if activeTab === 'referral'} + + + + Referral Program + Share your code and earn rewards + + + {#if loadingUser} + + {:else if userData?.referralCode} +
+
Your Referral Code
+
+ {#if userData.referralCode} + {userData.referralCode.match(/.{1,4}/g)?.join('-')} + {/if} +
+ +
+ +
+
+
+ {userData.referral_code_uses || 0} +
+
Times Used
+
+
+
+ £{(userData.referral_code_uses || 0) * 5} +
+
Total Saved
+
+
+ + + +
+

How it works:

+
    +
  • • Share your referral code with friends
  • +
  • • They get 10% off their first booking
  • +
  • • You get 10% off your next booking after their first
  • +
  • • You earn 1 loyalty stamp for each use to keep the savings going
  • +
+
+
+
+ {:else} +
No referral code available
+ {/if} +
+
+ {:else if activeTab === 'admin'} + + + + Account Settings + Manage your security and account preferences + + + +
+

Password

+

+ Update your password to keep your account secure +

+ +
+ + + + +
+

Danger Zone

+

+ Once you delete your account, there is no going back. Please be certain. +

+ +
+
+
+ {/if} +
+ + +
+ + + + + + + + + + + + +
+ + + + + +
+
+
+ + + {#if showPasswordModal} +
+ + + Change Password + Enter your current and new password + + +
+ + +
+
+ + +
+
+ + +
+
+ + + + +
+
+ {/if} + + + + + + Delete Account? + + This action cannot be undone. This will permanently delete your account and remove all + your data from our servers. + + +
+ + +
+ + { + deleteConfirmText = ''; + }} + > + Cancel + + + +
+
+{/if} + + diff --git a/frontend/tailwind.config.js b/frontend/tailwind.config.js new file mode 100644 index 0000000..eb4b2d1 --- /dev/null +++ b/frontend/tailwind.config.js @@ -0,0 +1,27 @@ +// tailwind.config.js (or .ts) +import { fontFamily } from 'tailwindcss/defaultTheme'; + +/** @type {import('tailwindcss').Config} */ +export default { + content: [ + './src/**/*.{html,js,svelte,ts}' + // Add other relevant paths if necessary + ], + theme: { + extend: { + fontFamily: { + sans: ['Inter', ...fontFamily.sans] + } + } + }, + plugins: [ + // Add any existing plugins required by shadcn-svelte + ], + safelist: [ + // Safelist fuchsia colors you intend to use + { pattern: /bg-(fuchsia)-(50|100|200|300|400|500|600|700|800|900)/ }, + { pattern: /text-(fuchsia)-(50|100|200|300|400|500|600|700|800|900)/ }, + { pattern: /border-(fuchsia)-(50|100|200|300|400|500|600|700|800|900)/ } + // Add other fuchsia utilities if needed (e.g., ring, placeholder) + ] +};