diff --git a/susconecta/app/agenda/appointment-form.tsx b/susconecta/app/agenda/appointment-form.tsx deleted file mode 100644 index d0d96ff..0000000 --- a/susconecta/app/agenda/appointment-form.tsx +++ /dev/null @@ -1,22 +0,0 @@ -"use client" - -export default function AppointmentForm() { - return ( -
-
- - -
-
- - -
- -
- ) -} diff --git a/susconecta/components/agenda/FooterAgenda.tsx b/susconecta/components/agenda/FooterAgenda.tsx index 91f73f9..54aa9c4 100644 --- a/susconecta/components/agenda/FooterAgenda.tsx +++ b/susconecta/components/agenda/FooterAgenda.tsx @@ -18,15 +18,6 @@ export default function FooterAgenda() {
- - - - - -
diff --git a/susconecta/components/dashboard/header.tsx b/susconecta/components/dashboard/header.tsx index 9942a60..5e23a67 100644 --- a/susconecta/components/dashboard/header.tsx +++ b/susconecta/components/dashboard/header.tsx @@ -35,7 +35,7 @@ export function PagesHeader({ title = "", subtitle = "" }: { title?: string, sub

{title}

-

{subtitle}

+

{subtitle}

@@ -49,42 +49,42 @@ export function PagesHeader({ title = "", subtitle = "" }: { title?: string, sub
{/* Dropdown Content */} {dropdownOpen && ( -
-
+
+

{user?.userType === 'administrador' ? 'Administrador da Clínica' : 'Usuário do Sistema'}

{user?.email ? ( -

{user.email}

+

{user.email}

) : ( -

Email não disponível

+

Email não disponível

)} -

+

Tipo: {user?.userType === 'administrador' ? 'Administrador' : user?.userType || 'Não definido'}

- - -
+
diff --git a/susconecta/components/forms/appointment-form.tsx b/susconecta/components/forms/appointment-form.tsx deleted file mode 100644 index 7898151..0000000 --- a/susconecta/components/forms/appointment-form.tsx +++ /dev/null @@ -1 +0,0 @@ -export { default } from '@/app/agenda/appointment-form'; diff --git a/susconecta/components/forms/calendar-registration-form.tsx b/susconecta/components/forms/calendar-registration-form.tsx index c06185f..8091f3c 100644 --- a/susconecta/components/forms/calendar-registration-form.tsx +++ b/susconecta/components/forms/calendar-registration-form.tsx @@ -1,26 +1,74 @@ + "use client"; import { useState, useEffect } from "react"; +import dynamic from 'next/dynamic'; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; import { Textarea } from "@/components/ui/textarea"; -import { Calendar, Search, ChevronDown, Upload, FileDown, Tag } from "lucide-react"; +import { Calendar, Search, ChevronDown } from "lucide-react"; -export function CalendarRegistrationForm({ initialData, onSave, onCancel }: any) { - const [formData, setFormData] = useState(initialData || {}); +interface FormData { + patientName?: string; + cpf?: string; + rg?: string; + birthDate?: string; + phoneCode?: string; + phoneNumber?: string; + email?: string; + convenio?: string; + matricula?: string; + validade?: string; + documentos?: string; + professionalName?: string; + unit?: string; + appointmentDate?: string; + startTime?: string; + endTime?: string; + requestingProfessional?: string; + appointmentType?: string; + notes?: string; +} + +interface CalendarRegistrationFormProperties { + initialData?: FormData; + onSave: (data: FormData) => void; + onCancel: () => void; +} + +const formatValidityDate = (value: string) => { + const cleaned = value.replaceAll(/\D/g, ""); + if (cleaned.length > 4) { + return `${cleaned.slice(0, 2)}/${cleaned.slice(2, 4)}/${cleaned.slice(4, 8)}`; + } + if (cleaned.length > 2) { + return `${cleaned.slice(0, 2)}/${cleaned.slice(2, 4)}`; + } + return cleaned; +}; + +export function CalendarRegistrationForm({ initialData, onSave, onCancel }: CalendarRegistrationFormProperties) { + const [formData, setFormData] = useState(initialData || {}); + const [isAdditionalInfoOpen, setIsAdditionalInfoOpen] = useState(false); useEffect(() => { setFormData(initialData || {}); }, [initialData]); - const handleChange = (e: React.ChangeEvent) => { - const { name, value } = e.target; - setFormData((prev: any) => ({ ...prev, [name]: value })); + const handleChange = (event: React.ChangeEvent) => { + const { name, value } = event.target; + + if (name === 'validade') { + const formattedValue = formatValidityDate(value); + setFormData((previousState) => ({ ...previousState, [name]: formattedValue })); + } else { + setFormData((previousState) => ({ ...previousState, [name]: value })); + } }; - const handleSubmit = (e: React.FormEvent) => { - e.preventDefault(); + const handleSubmit = (event: React.FormEvent) => { + event.preventDefault(); onSave(formData); }; @@ -29,7 +77,7 @@ export function CalendarRegistrationForm({ initialData, onSave, onCancel }: any)

Informações do paciente

-
+
@@ -42,19 +90,19 @@ export function CalendarRegistrationForm({ initialData, onSave, onCancel }: any) />
-
+
-
+
-
+
-
+
-
+
+
+ +
+ + +
+
+
+
+
+ + +
+
+ + +
+
+
+
+
setIsAdditionalInfoOpen(!isAdditionalInfoOpen)} + > +

Informações adicionais

+ +
+ {isAdditionalInfoOpen && ( +
+ +