'use client' import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card' import { Input } from '@/components/ui/input' import { Label } from '@/components/ui/label' import { Switch } from '@/components/ui/switch' import { Badge } from '@/components/ui/badge' import { Button } from '@/components/ui/button' import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select' import { Plus, Trash2 } from 'lucide-react' type IntakeConfigProps = { config: Record onChange: (config: Record) => void } const MIME_PRESETS = [ { label: 'PDF', value: 'application/pdf' }, { label: 'Word', value: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' }, { label: 'Excel', value: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' }, { label: 'PowerPoint', value: 'application/vnd.openxmlformats-officedocument.presentationml.presentation' }, { label: 'Images', value: 'image/*' }, { label: 'Video', value: 'video/*' }, ] const FIELD_TYPES = [ { value: 'text', label: 'Text' }, { value: 'textarea', label: 'Text Area' }, { value: 'select', label: 'Dropdown' }, { value: 'checkbox', label: 'Checkbox' }, { value: 'date', label: 'Date' }, ] export function IntakeConfig({ config, onChange }: IntakeConfigProps) { const update = (key: string, value: unknown) => { onChange({ ...config, [key]: value }) } const allowedMimeTypes = (config.allowedMimeTypes as string[]) ?? ['application/pdf'] const customFields = (config.customFields as Array<{ id: string; label: string; type: string; required: boolean; options?: string[] }>) ?? [] const toggleMime = (mime: string) => { const current = [...allowedMimeTypes] const idx = current.indexOf(mime) if (idx >= 0) { current.splice(idx, 1) } else { current.push(mime) } update('allowedMimeTypes', current) } const addCustomField = () => { update('customFields', [ ...customFields, { id: `field-${Date.now()}`, label: '', type: 'text', required: false }, ]) } const updateCustomField = (index: number, field: typeof customFields[0]) => { const updated = [...customFields] updated[index] = field update('customFields', updated) } const removeCustomField = (index: number) => { update('customFields', customFields.filter((_, i) => i !== index)) } return (
{/* Basic Settings */} Application Settings Configure how projects are submitted during intake

Let applicants save incomplete submissions

update('allowDrafts', v)} />

Days before incomplete drafts are automatically deleted

update('draftExpiryDays', parseInt(e.target.value, 10) || 30)} />

Allow applications without login

update('publicFormEnabled', v)} />

Notify admins when submissions arrive after deadline

update('lateSubmissionNotification', v)} />
{/* File Settings */} File Upload Settings Constraints for uploaded documents
update('maxFileSizeMB', parseInt(e.target.value, 10) || 50)} />
update('maxFilesPerSlot', parseInt(e.target.value, 10) || 1)} />
{MIME_PRESETS.map((preset) => ( toggleMime(preset.value)} > {preset.label} ))}
{/* Custom Fields */} Custom Application Fields Additional fields applicants must fill in {customFields.length === 0 && (

No custom fields configured.

)} {customFields.map((field, idx) => (
updateCustomField(idx, { ...field, label: e.target.value })} />
{field.type === 'select' && (
updateCustomField(idx, { ...field, options: e.target.value.split(',').map((o) => o.trim()).filter(Boolean), })} />
)}
updateCustomField(idx, { ...field, required: v })} />
))}
) }