mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-22 02:11:14 -05:00
feat: Add OpenStreetMap integration to ParkForm
This commit is contained in:
@@ -18,6 +18,7 @@ import { Combobox } from '@/components/ui/combobox';
|
||||
import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from '@/components/ui/dialog';
|
||||
import { useOperators, usePropertyOwners } from '@/hooks/useAutocompleteData';
|
||||
import { useUserRole } from '@/hooks/useUserRole';
|
||||
import { LocationSearch } from './LocationSearch';
|
||||
|
||||
const parkSchema = z.object({
|
||||
name: z.string().min(1, 'Park name is required'),
|
||||
@@ -27,6 +28,7 @@ const parkSchema = z.object({
|
||||
status: z.string().min(1, 'Status is required'),
|
||||
opening_date: z.string().optional(),
|
||||
closing_date: z.string().optional(),
|
||||
location_id: z.string().uuid().optional(),
|
||||
website_url: z.string().url().optional().or(z.literal('')),
|
||||
phone: z.string().optional(),
|
||||
email: z.string().email().optional().or(z.literal('')),
|
||||
@@ -118,6 +120,7 @@ export function ParkForm({ onSubmit, onCancel, initialData, isEditing = false }:
|
||||
status: initialData?.status || 'Operating',
|
||||
opening_date: initialData?.opening_date || '',
|
||||
closing_date: initialData?.closing_date || '',
|
||||
location_id: (initialData as any)?.location_id || undefined,
|
||||
website_url: initialData?.website_url || '',
|
||||
phone: initialData?.phone || '',
|
||||
email: initialData?.email || '',
|
||||
@@ -281,6 +284,20 @@ export function ParkForm({ onSubmit, onCancel, initialData, isEditing = false }:
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Location */}
|
||||
<div className="space-y-2">
|
||||
<Label>Location</Label>
|
||||
<LocationSearch
|
||||
onLocationSelect={(location) => {
|
||||
setValue('location_id', location.id);
|
||||
}}
|
||||
initialLocationId={watch('location_id')}
|
||||
/>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
Search for the park's location using OpenStreetMap
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{/* Operator & Property Owner Selection */}
|
||||
<div className="space-y-4">
|
||||
<h3 className="text-lg font-semibold">Operator & Property Owner</h3>
|
||||
|
||||
Reference in New Issue
Block a user