mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-22 00:11:13 -05:00
Implement all phases sequentially
This commit is contained in:
@@ -101,13 +101,32 @@ const parkTypes = [
|
||||
|
||||
const statusOptions = [
|
||||
'Operating',
|
||||
'Seasonal',
|
||||
'Closed Temporarily',
|
||||
'Closed Permanently',
|
||||
'Under Construction',
|
||||
'Planned'
|
||||
'Planned',
|
||||
'Abandoned'
|
||||
];
|
||||
|
||||
// Status mappings
|
||||
const STATUS_DISPLAY_TO_DB: Record<string, string> = {
|
||||
'Operating': 'operating',
|
||||
'Closed Temporarily': 'closed_temporarily',
|
||||
'Closed Permanently': 'closed_permanently',
|
||||
'Under Construction': 'under_construction',
|
||||
'Planned': 'planned',
|
||||
'Abandoned': 'abandoned'
|
||||
};
|
||||
|
||||
const STATUS_DB_TO_DISPLAY: Record<string, string> = {
|
||||
'operating': 'Operating',
|
||||
'closed_temporarily': 'Closed Temporarily',
|
||||
'closed_permanently': 'Closed Permanently',
|
||||
'under_construction': 'Under Construction',
|
||||
'planned': 'Planned',
|
||||
'abandoned': 'Abandoned'
|
||||
};
|
||||
|
||||
export function ParkForm({ onSubmit, onCancel, initialData, isEditing = false }: ParkFormProps) {
|
||||
const { isModerator } = useUserRole();
|
||||
const [submitting, setSubmitting] = useState(false);
|
||||
@@ -146,7 +165,7 @@ export function ParkForm({ onSubmit, onCancel, initialData, isEditing = false }:
|
||||
slug: initialData?.slug || '',
|
||||
description: initialData?.description || '',
|
||||
park_type: initialData?.park_type || '',
|
||||
status: initialData?.status || 'Operating',
|
||||
status: initialData?.status || 'operating' as const, // Store DB value
|
||||
opening_date: initialData?.opening_date || '',
|
||||
closing_date: initialData?.closing_date || '',
|
||||
location_id: initialData?.location_id || undefined,
|
||||
@@ -275,16 +294,22 @@ export function ParkForm({ onSubmit, onCancel, initialData, isEditing = false }:
|
||||
|
||||
<div className="space-y-2">
|
||||
<Label>Status *</Label>
|
||||
<Select onValueChange={(value) => setValue('status', value)} defaultValue={initialData?.status || 'Operating'}>
|
||||
<Select
|
||||
onValueChange={(value) => setValue('status', value as any)}
|
||||
defaultValue={initialData?.status || 'operating'}
|
||||
>
|
||||
<SelectTrigger>
|
||||
<SelectValue placeholder="Select status" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
{statusOptions.map((status) => (
|
||||
<SelectItem key={status} value={status}>
|
||||
{status}
|
||||
</SelectItem>
|
||||
))}
|
||||
{statusOptions.map((displayStatus) => {
|
||||
const dbValue = STATUS_DISPLAY_TO_DB[displayStatus];
|
||||
return (
|
||||
<SelectItem key={dbValue} value={dbValue}>
|
||||
{displayStatus}
|
||||
</SelectItem>
|
||||
);
|
||||
})}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
{errors.status && (
|
||||
|
||||
Reference in New Issue
Block a user