feat: add price field to CourtBooking model and related schemas
- Added `price` field to `CourtBookingScalarFieldEnum` in `prismaNamespace.ts` and `prismaNamespaceBrowser.ts`. - Updated `CourtBooking` model to include average and sum aggregations for `price`. - Enhanced input types and aggregate input types to support `price`. - Modified `public-booking.service.ts` to calculate and return price information for bookings. - Updated frontend components to display price information in booking confirmation and selection pages. - Introduced `priceRangeSchema` in API contract to validate price ranges.
This commit is contained in:
@@ -89,6 +89,15 @@ export function PublicBookingConfirmationPage({
|
||||
<p className="mt-1 text-base font-medium sm:text-lg">
|
||||
{confirmationQuery.data.courtName} · {confirmationQuery.data.sport.name}
|
||||
</p>
|
||||
|
||||
{confirmationQuery.data.price > 0 && (
|
||||
<>
|
||||
<p className="mt-4 text-sm text-muted-foreground">Precio</p>
|
||||
<p className="mt-1 text-base font-medium sm:text-lg">
|
||||
${confirmationQuery.data.price.toLocaleString('es-AR')}
|
||||
</p>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="grid gap-3 sm:grid-cols-2">
|
||||
|
||||
@@ -122,6 +122,7 @@ type SelectedSlot = {
|
||||
sportName: string;
|
||||
startTime: string;
|
||||
endTime: string;
|
||||
price?: { min: number; max: number };
|
||||
};
|
||||
|
||||
function addDays(baseDate: Date, amount: number) {
|
||||
@@ -210,6 +211,7 @@ export function PublicBookingPage({ complexSlug }: PublicBookingPageProps) {
|
||||
const availabilityQuery = useQuery({
|
||||
queryKey: ['public-booking-availability', complexSlug, selectedDate, selectedSportId],
|
||||
enabled: Boolean(selectedDate),
|
||||
placeholderData: (previousData) => previousData,
|
||||
queryFn: () =>
|
||||
apiClient.publicBookings.getAvailability(complexSlug, {
|
||||
date: selectedDate,
|
||||
@@ -730,6 +732,18 @@ export function PublicBookingPage({ complexSlug }: PublicBookingPageProps) {
|
||||
{selectedSlot?.courtName ?? 'Seleccioná una cancha disponible'}
|
||||
</p>
|
||||
</div>
|
||||
{selectedSlot?.price && selectedSlot.price.min > 0 && (
|
||||
<div className="rounded-2xl border border-border/70 bg-background p-4">
|
||||
<p className="text-xs uppercase tracking-[0.24em] text-muted-foreground">
|
||||
Precio
|
||||
</p>
|
||||
<p className="mt-1 text-sm font-medium text-foreground">
|
||||
${selectedSlot.price.min.toLocaleString('es-AR')}
|
||||
{selectedSlot.price.min !== selectedSlot.price.max &&
|
||||
` - $${selectedSlot.price.max.toLocaleString('es-AR')}`}
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{selectedSlot ? (
|
||||
|
||||
Reference in New Issue
Block a user