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

@@ -14,6 +14,7 @@ import { Combobox } from '@/components/ui/combobox';
import { useCompanyHeadquarters } from '@/hooks/useAutocompleteData';
import { useUserRole } from '@/hooks/useUserRole';
import { EntityMultiImageUploader, ImageAssignments } from '@/components/upload/EntityMultiImageUploader';
import { FlexibleDateInput, type DatePrecision } from '@/components/ui/flexible-date-input';
type ManufacturerFormData = z.infer<typeof entitySchemas.manufacturer>;
@@ -24,7 +25,9 @@ type ManufacturerFormInput = {
description?: string;
person_type: 'company' | 'individual' | 'firm' | 'organization';
website_url?: string;
founded_year?: string;
founded_year?: string; // Legacy support
founded_date?: string;
founded_date_precision?: string;
headquarters_location?: string;
images?: {
uploaded: Array<{
@@ -68,6 +71,8 @@ export function ManufacturerForm({ onSubmit, onCancel, initialData }: Manufactur
person_type: initialData?.person_type || 'company',
website_url: initialData?.website_url || '',
founded_year: initialData?.founded_year ? String(initialData.founded_year) : '',
founded_date: initialData?.founded_date || (initialData?.founded_year ? `${initialData.founded_year}-01-01` : ''),
founded_date_precision: initialData?.founded_date_precision || (initialData?.founded_year ? 'year' : 'day'),
headquarters_location: initialData?.headquarters_location || '',
images: initialData?.images || { uploaded: [] }
}
@@ -146,20 +151,18 @@ export function ManufacturerForm({ onSubmit, onCancel, initialData }: Manufactur
{/* Additional Details */}
<div className="grid grid-cols-1 md:grid-cols-2 gap-6">
<div className="space-y-2">
<Label htmlFor="founded_year">Founded Year</Label>
<Input
id="founded_year"
type="number"
min="1800"
max={new Date().getFullYear()}
{...register('founded_year')}
placeholder="e.g. 1972"
/>
{errors.founded_year && (
<p className="text-sm text-destructive">{errors.founded_year.message}</p>
)}
</div>
<FlexibleDateInput
value={watch('founded_date') ? new Date(watch('founded_date')) : undefined}
precision={(watch('founded_date_precision') as DatePrecision) || 'year'}
onChange={(date, precision) => {
setValue('founded_date', date ? date.toISOString().split('T')[0] : undefined);
setValue('founded_date_precision', precision);
}}
label="Founded Date"
placeholder="Select founded date"
disableFuture={true}
fromYear={1800}
/>
<div className="space-y-2">
<Label htmlFor="headquarters_location">Headquarters Location</Label>