theming, date, time localisation, additional features, seeding initial cleanup

This commit is contained in:
mikicvi
2025-09-26 21:12:59 +01:00
parent b89d91ade2
commit 22c462c61c
43 changed files with 2647 additions and 550 deletions
@@ -24,6 +24,8 @@ interface SettingsData {
booking_end_time: string;
allow_weekend_bookings: string;
max_bookings_per_user_per_hour_per_day: string;
allow_booking_modifications: string;
booking_modification_hours_before: string;
}
export function AdminSettingsManagement() {
@@ -35,6 +37,8 @@ export function AdminSettingsManagement() {
booking_end_time: '22:00',
allow_weekend_bookings: 'true',
max_bookings_per_user_per_hour_per_day: '1',
allow_booking_modifications: 'true',
booking_modification_hours_before: '2',
});
const [loading, setLoading] = useState(true);
const [saving, setSaving] = useState(false);
@@ -57,6 +61,8 @@ export function AdminSettingsManagement() {
booking_end_time: '22:00',
allow_weekend_bookings: 'true',
max_bookings_per_user_per_hour_per_day: '1',
allow_booking_modifications: 'true',
booking_modification_hours_before: '2',
};
// Map the settings array to our object
@@ -266,6 +272,43 @@ export function AdminSettingsManagement() {
<p className='text-sm text-gray-500'>Maximum bookings per user per hour on the same day</p>
</div>
{/* Booking Modification Settings */}
<div className='space-y-2'>
<div className='flex items-center space-x-2'>
<Switch
id='allow_booking_modifications'
checked={settings.allow_booking_modifications === 'true'}
onCheckedChange={(checked: boolean) =>
updateSetting('allow_booking_modifications', checked.toString())
}
/>
<Label htmlFor='allow_booking_modifications'>Allow Booking Modifications</Label>
</div>
<p className='text-sm text-gray-500'>Whether users can edit or cancel their bookings</p>
</div>
{/* Modification Time Restriction */}
<div className='space-y-2'>
<Label htmlFor='booking_modification_hours_before'>
Modification Time Limit (hours before session)
</Label>
<Input
id='booking_modification_hours_before'
type='number'
min='0.5'
max='48'
step='0.5'
value={settings.booking_modification_hours_before}
onChange={(e) => updateSetting('booking_modification_hours_before', e.target.value)}
disabled={settings.allow_booking_modifications !== 'true'}
/>
<p className='text-sm text-gray-500'>
{settings.allow_booking_modifications === 'true'
? 'How many hours before a session users can still modify bookings'
: 'Enable booking modifications to configure this setting'}
</p>
</div>
{/* Weekend Bookings */}
<div className='space-y-2'>
<div className='flex items-center space-x-2'>
@@ -307,6 +350,12 @@ export function AdminSettingsManagement() {
<strong>Booking Limit:</strong> {settings.max_bookings_per_user_per_hour_per_day} per
hour
</p>
<p>
<strong>Booking Modifications:</strong>{' '}
{settings.allow_booking_modifications === 'true' ? 'Enabled' : 'Disabled'}
{settings.allow_booking_modifications === 'true' &&
` (${settings.booking_modification_hours_before}h before)`}
</p>
</div>
</div>
</div>