refactor: move discounts into admin panel as component, rebuild modal with proper field handling
- DiscountsManagement component integrated into admin/+page.svelte - Removed standalone /admin/discounts route - Modal rebuilt with toggle buttons for campaign type, conditional field groups - Milestone unit auto-restricted based on milestone type (bookings-only for count types, months/years for anniversary) - Mobile-first: card layout on mobile, table on desktop (md: breakpoint) - Native select elements instead of broken bits-ui Select components
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
import HolidayHours from '$lib/components/admin/HolidayHours.svelte';
|
||||
import WeeklySchedule from '$lib/components/admin/WeeklySchedule.svelte';
|
||||
import ServicesManagement from '$lib/components/admin/ServicesManagement.svelte';
|
||||
import DiscountsManagement from '$lib/components/admin/DiscountsManagement.svelte';
|
||||
import UserModal from '$lib/components/admin/UserModal.svelte';
|
||||
import BookingModal from '$lib/components/admin/BookingModal.svelte';
|
||||
|
||||
@@ -209,6 +210,48 @@
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Discounts Management Card Skeleton -->
|
||||
<div class="rounded-lg border p-6">
|
||||
<div class="mb-4 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between">
|
||||
<div class="space-y-2">
|
||||
<Skeleton class="h-6 w-40" />
|
||||
<Skeleton class="h-4 w-64" />
|
||||
</div>
|
||||
<Skeleton class="h-10 w-32" />
|
||||
</div>
|
||||
<div class="mt-4 hidden w-full overflow-x-auto md:block">
|
||||
<table class="w-full table-auto border-collapse text-sm">
|
||||
<thead>
|
||||
<tr class="border-b text-left text-xs text-gray-500">
|
||||
<th class="py-3"><Skeleton class="h-4 w-24" /></th>
|
||||
<th class="py-3"><Skeleton class="h-4 w-20" /></th>
|
||||
<th class="py-3"><Skeleton class="h-4 w-16" /></th>
|
||||
<th class="py-3"><Skeleton class="h-4 w-16" /></th>
|
||||
<th class="py-3"><Skeleton class="h-4 w-16" /></th>
|
||||
<th class="py-3"><Skeleton class="h-4 w-40" /></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{#each Array(2) as _, i (i)}
|
||||
<tr class="border-b">
|
||||
<td class="py-3"><Skeleton class="h-4 w-32" /></td>
|
||||
<td class="py-3"><Skeleton class="h-4 w-24" /></td>
|
||||
<td class="py-3"><Skeleton class="h-4 w-12" /></td>
|
||||
<td class="py-3"><Skeleton class="h-4 w-16" /></td>
|
||||
<td class="py-3"><Skeleton class="h-4 w-12" /></td>
|
||||
<td class="py-3">
|
||||
<div class="flex justify-end gap-2">
|
||||
<Skeleton class="h-8 w-16" />
|
||||
<Skeleton class="h-8 w-16" />
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/each}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{:else if pageState === 'authorized'}
|
||||
<div class="mx-auto max-w-6xl space-y-6 p-6">
|
||||
@@ -227,6 +270,7 @@
|
||||
<HolidayHours />
|
||||
<WeeklySchedule />
|
||||
<ServicesManagement />
|
||||
<DiscountsManagement />
|
||||
</div>
|
||||
|
||||
<!-- Modals -->
|
||||
|
||||
Reference in New Issue
Block a user