import React, { useState } from 'react'; import { Institution, Address } from '../types'; import { Input, Select } from './Input'; import { Button } from './Button'; import { Building2, X, Check } from 'lucide-react'; interface InstitutionFormProps { onCancel: () => void; onSubmit: (data: Partial) => void; initialData?: Institution; userId: string; } const INSTITUTION_TYPES = [ 'Universidade Pública', 'Universidade Privada', 'Faculdade', 'Instituto Federal', 'Centro Universitário', 'Campus Universitário' ]; export const InstitutionForm: React.FC = ({ onCancel, onSubmit, initialData, userId }) => { const [formData, setFormData] = useState>(initialData || { name: '', type: '', cnpj: '', phone: '', email: '', description: '', ownerId: userId, address: { street: '', number: '', city: '', state: '', zip: '' } }); const [showToast, setShowToast] = useState(false); const [stateError, setStateError] = useState(''); const handleSubmit = (e: React.FormEvent) => { e.preventDefault(); setShowToast(true); setTimeout(() => { onSubmit(formData); }, 1000); }; const handleChange = (field: keyof Institution, value: any) => { setFormData(prev => ({ ...prev, [field]: value })); }; const handleAddressChange = (field: keyof Address, value: string) => { setFormData(prev => ({ ...prev, address: { ...prev.address!, [field]: value } })); }; return (
{/* Success Toast */} {showToast && (

Sucesso!

Universidade cadastrada com sucesso.

)} {/* Form Header */}

{initialData ? 'Editar Universidade' : 'Cadastrar Universidade'}

Registre a universidade onde os eventos fotográficos serão realizados

{/* Informações Básicas */}

Informações Básicas

handleChange('name', e.target.value)} required />
handleChange('cnpj', e.target.value)} mask="cnpj" />
handleChange('phone', e.target.value)} mask="phone" required /> handleChange('email', e.target.value)} required />