Approve database migration

This commit is contained in:
gpt-engineer-app[bot]
2025-10-10 19:01:15 +00:00
parent 25536fd202
commit 1fc9a1104f
11 changed files with 243 additions and 57 deletions

View File

@@ -12,6 +12,7 @@ import { Label } from '@/components/ui/label';
import { EntityMultiImageUploader, ImageAssignments } from '@/components/upload/EntityMultiImageUploader';
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select';
import { DatePicker } from '@/components/ui/date-picker';
import { FlexibleDateInput, type DatePrecision } from '@/components/ui/flexible-date-input';
import { SlugField } from '@/components/ui/slug-field';
import { toast } from '@/hooks/use-toast';
import { MapPin, Save, X, Plus } from 'lucide-react';
@@ -29,7 +30,9 @@ const parkSchema = z.object({
park_type: z.string().min(1, 'Park type is required'),
status: z.string().min(1, 'Status is required'),
opening_date: z.string().optional(),
opening_date_precision: z.enum(['day', 'month', 'year']).optional(),
closing_date: z.string().optional(),
closing_date_precision: z.enum(['day', 'month', 'year']).optional(),
location: z.object({
name: z.string(),
city: z.string().optional(),
@@ -279,27 +282,31 @@ export function ParkForm({ onSubmit, onCancel, initialData, isEditing = false }:
{/* Dates */}
<div className="grid grid-cols-1 md:grid-cols-2 gap-6">
<div className="space-y-2">
<Label>Opening Date</Label>
<DatePicker
date={watch('opening_date') ? new Date(watch('opening_date')) : undefined}
onSelect={(date) => setValue('opening_date', date ? date.toISOString().split('T')[0] : undefined)}
placeholder="Select opening date"
disableFuture={true}
fromYear={1800}
/>
</div>
<FlexibleDateInput
value={watch('opening_date') ? new Date(watch('opening_date')) : undefined}
precision={(watch('opening_date_precision') as DatePrecision) || 'day'}
onChange={(date, precision) => {
setValue('opening_date', date ? date.toISOString().split('T')[0] : undefined);
setValue('opening_date_precision', precision);
}}
label="Opening Date"
placeholder="Select opening date"
disableFuture={true}
fromYear={1800}
/>
<div className="space-y-2">
<Label>Closing Date (if applicable)</Label>
<DatePicker
date={watch('closing_date') ? new Date(watch('closing_date')) : undefined}
onSelect={(date) => setValue('closing_date', date ? date.toISOString().split('T')[0] : undefined)}
placeholder="Select closing date"
disablePast={false}
fromYear={1800}
/>
</div>
<FlexibleDateInput
value={watch('closing_date') ? new Date(watch('closing_date')) : undefined}
precision={(watch('closing_date_precision') as DatePrecision) || 'day'}
onChange={(date, precision) => {
setValue('closing_date', date ? date.toISOString().split('T')[0] : undefined);
setValue('closing_date_precision', precision);
}}
label="Closing Date (if applicable)"
placeholder="Select closing date"
disablePast={false}
fromYear={1800}
/>
</div>
{/* Location */}