fix: remove discount_eligible from booking creation, fix modal scrolling, lower default to 5%

- Remove all discount_eligible checks from CreateBookingHandler and AdminCreateBookingForUserHandler
- Discounts are only calculated at completion/payment time, not at booking time
- Remove discount_eligible from frontend Booking type and pending_redemption from BookingUser
- Remove TestDiscount_EligibilityFlag test (no longer relevant)
- Fix modal scrolling: add max-h-[90vh] overflow-y-auto to match ServicesManagement pattern
- Lower default discount from 10% to 5%
- Clarify max_redemptions label as 'campaign total' (per campaign, not per person)
This commit is contained in:
2026-05-08 18:08:59 +01:00
parent 5c4041ded9
commit 79a794de58
5 changed files with 10 additions and 112 deletions
@@ -69,7 +69,7 @@
name: '',
description: '',
campaign_type: 'time_based' as 'time_based' | 'milestone',
discount_percent: 10,
discount_percent: 5,
scope: 'all_bookings',
start_date: '',
end_date: '',
@@ -124,7 +124,7 @@
name: '',
description: '',
campaign_type: 'time_based',
discount_percent: 10,
discount_percent: 5,
scope: 'all_bookings',
start_date: '',
end_date: '',
@@ -439,7 +439,7 @@
<!-- Create/Edit Modal -->
<Modal.Root bind:open={showModal}>
<Modal.Content class="sm:max-w-lg">
<Modal.Content class="max-h-[90vh] max-w-sm overflow-y-auto md:max-w-lg">
<Modal.Header>
<Modal.Title>{editingCampaign ? 'Edit Campaign' : 'Create Campaign'}</Modal.Title>
<Modal.Description>Configure discount rules and campaign parameters</Modal.Description>
@@ -577,9 +577,9 @@
<!-- Max Redemptions -->
<div class="space-y-2">
<Label.Root for="dc-max">Max Redemptions</Label.Root>
<Label.Root for="dc-max">Max Redemptions (campaign total)</Label.Root>
<Input id="dc-max" type="number" min="0" bind:value={form.max_redemptions} class="w-32" />
<p class="text-xs text-gray-500">0 = unlimited</p>
<p class="text-xs text-gray-500">0 = unlimited across all users</p>
</div>
</div>
-10
View File
@@ -73,7 +73,6 @@ export interface BookingUser {
date_of_birth?: string;
account_role: string;
loyalty_stamps?: number;
pending_redemption?: boolean;
referral_code?: string;
referral_code_uses?: number;
created_at: string;
@@ -121,15 +120,6 @@ export interface Booking {
amount_paid: number;
amount_due: number;
duration_minutes: number;
discount_eligible?: boolean;
}
export interface BookingListResponse {
bookings: Booking[];
page: number;
per_page: number;
total: number;
total_pages: number;
}
export interface LoyaltyRedemption {