feature/consultations #17

Merged
Jonasbomfim merged 5 commits from feature/consultations into develop 2025-09-25 13:07:02 +00:00
7 changed files with 638 additions and 367 deletions

View File

@ -0,0 +1,368 @@
"use client";
import Link from "next/link";
import { useState } from "react";
import {
MoreHorizontal,
PlusCircle,
Search,
Eye,
Edit,
Trash2,
ArrowLeft,
} from "lucide-react";
import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";
import {
Card,
CardContent,
CardDescription,
CardHeader,
CardTitle,
} from "@/components/ui/card";
import {
Dialog,
DialogContent,
DialogDescription,
DialogHeader,
DialogTitle,
DialogFooter,
} from "@/components/ui/dialog";
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu";
import {
Table,
TableBody,
TableCell,
TableHead,
TableHeader,
TableRow,
} from "@/components/ui/table";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
import {
Select,
SelectContent,
SelectItem,
SelectTrigger,
SelectValue,
} from "@/components/ui/select";
import { mockAppointments, mockProfessionals } from "@/lib/mocks/appointment-mocks";
import { CalendarRegistrationForm } from "@/components/forms/calendar-registration-form";
// --- Helper Functions ---
const formatDate = (date: string | Date) => {
if (!date) return "";
return new Date(date).toLocaleDateString("pt-BR", {
day: "2-digit",
month: "2-digit",
year: "numeric",
hour: "2-digit",
minute: "2-digit",
});
};
const capitalize = (s: string) => {
if (typeof s !== 'string' || s.length === 0) return '';
return s.charAt(0).toUpperCase() + s.slice(1);
};
// --- Main Page Component ---
export default function ConsultasPage() {
const [appointments, setAppointments] = useState(mockAppointments);
const [showForm, setShowForm] = useState(false);
const [editingAppointment, setEditingAppointment] = useState<any | null>(null);
const [viewingAppointment, setViewingAppointment] = useState<any | null>(null);
// Converte o objeto da consulta para o formato esperado pelo formulário
const mapAppointmentToFormData = (appointment: any) => {
const professional = mockProfessionals.find(p => p.id === appointment.professional);
const appointmentDate = new Date(appointment.time);
return {
id: appointment.id,
patientName: appointment.patient,
professionalName: professional ? professional.name : '',
appointmentDate: appointmentDate.toISOString().split('T')[0], // Formato YYYY-MM-DD
startTime: appointmentDate.toTimeString().split(' ')[0].substring(0, 5), // Formato HH:MM
endTime: new Date(appointmentDate.getTime() + appointment.duration * 60000).toTimeString().split(' ')[0].substring(0, 5),
status: appointment.status,
appointmentType: appointment.type,
notes: appointment.notes,
// Adicione outros campos do paciente aqui se necessário (cpf, rg, etc.)
// Eles não existem no mock de agendamento, então virão vazios
cpf: '',
rg: '',
birthDate: '',
phoneCode: '+55',
phoneNumber: '',
email: '',
unit: 'nei',
};
};
const handleDelete = (appointmentId: string) => {
if (window.confirm("Tem certeza que deseja excluir esta consulta?")) {
setAppointments((prev) => prev.filter((a) => a.id !== appointmentId));
}
};
const handleEdit = (appointment: any) => {
const formData = mapAppointmentToFormData(appointment);
setEditingAppointment(formData);
setShowForm(true);
};
const handleView = (appointment: any) => {
setViewingAppointment(appointment);
};
const handleCancel = () => {
setEditingAppointment(null);
setShowForm(false);
};
const handleSave = (formData: any) => {
// Como o formulário edita campos que não estão na tabela,
// precisamos mapear de volta para o formato original do agendamento.
// Para a simulação, vamos atualizar apenas os campos que existem no mock.
const updatedAppointment = {
id: formData.id,
patient: formData.patientName,
time: new Date(`${formData.appointmentDate}T${formData.startTime}`).toISOString(),
duration: 30, // Duração não está no form, então mantemos um valor fixo
type: formData.appointmentType as any,
status: formData.status as any,
professional: appointments.find(a => a.id === formData.id)?.professional || '', // Mantém o ID do profissional
notes: formData.notes,
};
setAppointments(prev =>
prev.map(a => a.id === updatedAppointment.id ? updatedAppointment : a)
);
handleCancel(); // Fecha o formulário
};
if (showForm && editingAppointment) {
return (
<div className="space-y-6 p-6">
<div className="flex items-center gap-4">
<Button type="button" variant="ghost" size="icon" onClick={handleCancel}>
<ArrowLeft className="h-4 w-4" />
</Button>
<h1 className="text-lg font-semibold md:text-2xl">Editar Consulta</h1>
</div>
<CalendarRegistrationForm
initialData={editingAppointment}
onSave={handleSave}
onCancel={handleCancel}
/>
</div>
)
}
return (
<div className="space-y-6 p-6">
<div className="flex items-center justify-between gap-4 flex-wrap">
<div>
<h1 className="text-2xl font-bold">Gerenciamento de Consultas</h1>
<p className="text-muted-foreground">Visualize, filtre e gerencie todas as consultas da clínica.</p>
</div>
<div className="flex items-center gap-2">
<Link href="/agenda">
<Button size="sm" className="h-8 gap-1">
<PlusCircle className="h-3.5 w-3.5" />
<span className="sr-only sm:not-sr-only sm:whitespace-nowrap">
Agendar Nova Consulta
</span>
</Button>
</Link>
</div>
</div>
<Card>
<CardHeader>
<CardTitle>Consultas Agendadas</CardTitle>
<CardDescription>
Visualize, filtre e gerencie todas as consultas da clínica.
</CardDescription>
<div className="pt-4 flex flex-wrap items-center gap-4">
<div className="relative flex-1 min-w-[250px]">
<Search className="absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground" />
<Input
type="search"
placeholder="Buscar por..."
className="pl-8 w-full"
/>
</div>
<Select>
<SelectTrigger className="w-[180px]">
<SelectValue placeholder="Filtrar por status" />
</SelectTrigger>
<SelectContent>
<SelectItem value="all">Todos</SelectItem>
<SelectItem value="confirmed">Confirmada</SelectItem>
<SelectItem value="pending">Pendente</SelectItem>
<SelectItem value="cancelled">Cancelada</SelectItem>
</SelectContent>
</Select>
<Input type="date" className="w-[180px]" />
</div>
</CardHeader>
<CardContent>
<Table>
<TableHeader>
<TableRow>
<TableHead>Paciente</TableHead>
<TableHead>Médico</TableHead>
<TableHead>Status</TableHead>
<TableHead>Data e Hora</TableHead>
<TableHead>Ações</TableHead>
</TableRow>
</TableHeader>
<TableBody>
{appointments.map((appointment) => {
const professional = mockProfessionals.find(
(p) => p.id === appointment.professional
);
return (
<TableRow key={appointment.id}>
<TableCell className="font-medium">
{appointment.patient}
</TableCell>
<TableCell>
{professional ? professional.name : "Não encontrado"}
</TableCell>
<TableCell>
<Badge
variant={
appointment.status === "confirmed"
? "default"
: appointment.status === "pending"
? "secondary"
: "destructive"
}
className={
appointment.status === "confirmed" ? "bg-green-600" : ""
}
>
{capitalize(appointment.status)}
</Badge>
</TableCell>
<TableCell>{formatDate(appointment.time)}</TableCell>
<TableCell>
<DropdownMenu>
<DropdownMenuTrigger asChild>
<button className="h-8 w-8 p-0 flex items-center justify-center rounded-md hover:bg-accent">
<span className="sr-only">Abrir menu</span>
<MoreHorizontal className="h-4 w-4" />
</button>
</DropdownMenuTrigger>
<DropdownMenuContent align="end">
<DropdownMenuItem
onClick={() => handleView(appointment)}
>
<Eye className="mr-2 h-4 w-4" />
Ver
</DropdownMenuItem>
<DropdownMenuItem onClick={() => handleEdit(appointment)}>
<Edit className="mr-2 h-4 w-4" />
Editar
</DropdownMenuItem>
<DropdownMenuItem
onClick={() => handleDelete(appointment.id)}
className="text-destructive"
>
<Trash2 className="mr-2 h-4 w-4" />
Excluir
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
</TableCell>
</TableRow>
);
})}
</TableBody>
</Table>
</CardContent>
</Card>
{viewingAppointment && (
<Dialog open={!!viewingAppointment} onOpenChange={() => setViewingAppointment(null)}>
<DialogContent>
<DialogHeader>
<DialogTitle>Detalhes da Consulta</DialogTitle>
<DialogDescription>
Informações detalhadas da consulta de {viewingAppointment?.patient}.
</DialogDescription>
</DialogHeader>
<div className="grid gap-4 py-4">
<div className="grid grid-cols-4 items-center gap-4">
<Label htmlFor="name" className="text-right">
Paciente
</Label>
<span className="col-span-3">{viewingAppointment?.patient}</span>
</div>
<div className="grid grid-cols-4 items-center gap-4">
<Label className="text-right">
Médico
</Label>
<span className="col-span-3">
{mockProfessionals.find(p => p.id === viewingAppointment?.professional)?.name || "Não encontrado"}
</span>
</div>
<div className="grid grid-cols-4 items-center gap-4">
<Label className="text-right">
Data e Hora
</Label>
<span className="col-span-3">{viewingAppointment?.time ? formatDate(viewingAppointment.time) : ''}</span>
</div>
<div className="grid grid-cols-4 items-center gap-4">
<Label className="text-right">
Status
</Label>
<span className="col-span-3">
<Badge
variant={
viewingAppointment?.status === "confirmed"
? "default"
: viewingAppointment?.status === "pending"
? "secondary"
: "destructive"
}
className={
viewingAppointment?.status === "confirmed" ? "bg-green-600" : ""
}
>
{capitalize(viewingAppointment?.status || '')}
</Badge>
</span>
</div>
<div className="grid grid-cols-4 items-center gap-4">
<Label className="text-right">
Tipo
</Label>
<span className="col-span-3">{capitalize(viewingAppointment?.type || '')}</span>
</div>
<div className="grid grid-cols-4 items-center gap-4">
<Label className="text-right">
Observações
</Label>
<span className="col-span-3">{viewingAppointment?.notes || "Nenhuma"}</span>
</div>
</div>
<DialogFooter>
<Button onClick={() => setViewingAppointment(null)}>Fechar</Button>
</DialogFooter>
</DialogContent>
</Dialog>
)}
</div>
);
}

View File

@ -5,6 +5,8 @@ import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input"; import { Input } from "@/components/ui/input";
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table"; import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table";
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "@/components/ui/dropdown-menu"; import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "@/components/ui/dropdown-menu";
import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, DialogFooter } from "@/components/ui/dialog";
import { Label } from "@/components/ui/label";
import { MoreHorizontal, Plus, Search, Edit, Trash2, ArrowLeft, Eye } from "lucide-react"; import { MoreHorizontal, Plus, Search, Edit, Trash2, ArrowLeft, Eye } from "lucide-react";
import { Badge } from "@/components/ui/badge"; import { Badge } from "@/components/ui/badge";
import { DoctorRegistrationForm } from "@/components/forms/doctor-registration-form"; import { DoctorRegistrationForm } from "@/components/forms/doctor-registration-form";
@ -18,6 +20,7 @@ export default function DoutoresPage() {
const [search, setSearch] = useState(""); const [search, setSearch] = useState("");
const [showForm, setShowForm] = useState(false); const [showForm, setShowForm] = useState(false);
const [editingId, setEditingId] = useState<string | null>(null); const [editingId, setEditingId] = useState<string | null>(null);
const [viewingDoctor, setViewingDoctor] = useState<Medico | null>(null);
// Carrega da API // Carrega da API
async function load() { async function load() {
@ -55,6 +58,10 @@ export default function DoutoresPage() {
setShowForm(true); setShowForm(true);
} }
function handleView(doctor: Medico) {
setViewingDoctor(doctor);
}
// Excluir via API e recarregar // Excluir via API e recarregar
async function handleDelete(id: string) { async function handleDelete(id: string) {
if (!confirm("Excluir este médico?")) return; if (!confirm("Excluir este médico?")) return;
@ -70,7 +77,7 @@ export default function DoutoresPage() {
if (showForm) { if (showForm) {
return ( return (
<div className="space-y-6"> <div className="space-y-6 p-6">
<div className="flex items-center gap-4"> <div className="flex items-center gap-4">
<Button variant="ghost" size="icon" onClick={() => setShowForm(false)}> <Button variant="ghost" size="icon" onClick={() => setShowForm(false)}>
<ArrowLeft className="h-4 w-4" /> <ArrowLeft className="h-4 w-4" />
@ -90,7 +97,7 @@ export default function DoutoresPage() {
} }
return ( return (
<div className="space-y-6"> <div className="space-y-6 p-6">
<div className="flex items-center justify-between gap-4 flex-wrap"> <div className="flex items-center justify-between gap-4 flex-wrap">
<div> <div>
<h1 className="text-2xl font-bold">Médicos</h1> <h1 className="text-2xl font-bold">Médicos</h1>
@ -155,7 +162,7 @@ export default function DoutoresPage() {
</button> </button>
</DropdownMenuTrigger> </DropdownMenuTrigger>
<DropdownMenuContent align="end"> <DropdownMenuContent align="end">
<DropdownMenuItem onClick={() => alert(JSON.stringify(doctor, null, 2))}> <DropdownMenuItem onClick={() => handleView(doctor)}>
<Eye className="mr-2 h-4 w-4" /> <Eye className="mr-2 h-4 w-4" />
Ver Ver
</DropdownMenuItem> </DropdownMenuItem>
@ -182,6 +189,47 @@ export default function DoutoresPage() {
</TableBody> </TableBody>
</Table> </Table>
</div> </div>
{viewingDoctor && (
<Dialog open={!!viewingDoctor} onOpenChange={() => setViewingDoctor(null)}>
<DialogContent>
<DialogHeader>
<DialogTitle>Detalhes do Médico</DialogTitle>
<DialogDescription>
Informações detalhadas de {viewingDoctor?.nome}.
</DialogDescription>
</DialogHeader>
<div className="grid gap-4 py-4">
<div className="grid grid-cols-4 items-center gap-4">
<Label className="text-right">Nome</Label>
<span className="col-span-3 font-medium">{viewingDoctor?.nome}</span>
</div>
<div className="grid grid-cols-4 items-center gap-4">
<Label className="text-right">Especialidade</Label>
<span className="col-span-3">
<Badge variant="outline">{viewingDoctor?.especialidade}</Badge>
</span>
</div>
<div className="grid grid-cols-4 items-center gap-4">
<Label className="text-right">CRM</Label>
<span className="col-span-3">{viewingDoctor?.crm}</span>
</div>
<div className="grid grid-cols-4 items-center gap-4">
<Label className="text-right">Email</Label>
<span className="col-span-3">{viewingDoctor?.email}</span>
</div>
<div className="grid grid-cols-4 items-center gap-4">
<Label className="text-right">Telefone</Label>
<span className="col-span-3">{viewingDoctor?.telefone}</span>
</div>
</div>
<DialogFooter>
<Button onClick={() => setViewingDoctor(null)}>Fechar</Button>
</DialogFooter>
</DialogContent>
</Dialog>
)}
<div className="text-sm text-muted-foreground"> <div className="text-sm text-muted-foreground">
Mostrando {filtered.length} de {doctors.length} Mostrando {filtered.length} de {doctors.length}
</div> </div>

View File

@ -6,6 +6,8 @@ import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input"; import { Input } from "@/components/ui/input";
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table"; import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table";
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "@/components/ui/dropdown-menu"; import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "@/components/ui/dropdown-menu";
import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, DialogFooter } from "@/components/ui/dialog";
import { Label } from "@/components/ui/label";
import { MoreHorizontal, Plus, Search, Eye, Edit, Trash2, ArrowLeft } from "lucide-react"; import { MoreHorizontal, Plus, Search, Eye, Edit, Trash2, ArrowLeft } from "lucide-react";
import { Paciente, Endereco, listarPacientes, buscarPacientePorId, excluirPaciente } from "@/lib/api"; import { Paciente, Endereco, listarPacientes, buscarPacientePorId, excluirPaciente } from "@/lib/api";
@ -47,6 +49,7 @@ export default function PacientesPage() {
const [search, setSearch] = useState(""); const [search, setSearch] = useState("");
const [showForm, setShowForm] = useState(false); const [showForm, setShowForm] = useState(false);
const [editingId, setEditingId] = useState<string | null>(null); const [editingId, setEditingId] = useState<string | null>(null);
const [viewingPatient, setViewingPatient] = useState<Paciente | null>(null);
async function loadAll() { async function loadAll() {
try { try {
@ -88,6 +91,10 @@ export default function PacientesPage() {
setShowForm(true); setShowForm(true);
} }
function handleView(patient: Paciente) {
setViewingPatient(patient);
}
async function handleDelete(id: string) { async function handleDelete(id: string) {
if (!confirm("Excluir este paciente?")) return; if (!confirm("Excluir este paciente?")) return;
try { try {
@ -161,7 +168,6 @@ export default function PacientesPage() {
return ( return (
<div className="space-y-6 p-6"> <div className="space-y-6 p-6">
{}
<div className="flex items-center justify-between gap-4 flex-wrap"> <div className="flex items-center justify-between gap-4 flex-wrap">
<div> <div>
<h1 className="text-2xl font-bold">Pacientes</h1> <h1 className="text-2xl font-bold">Pacientes</h1>
@ -217,7 +223,7 @@ export default function PacientesPage() {
</button> </button>
</DropdownMenuTrigger> </DropdownMenuTrigger>
<DropdownMenuContent align="end"> <DropdownMenuContent align="end">
<DropdownMenuItem onClick={() => alert(JSON.stringify(p, null, 2))}> <DropdownMenuItem onClick={() => handleView(p)}>
<Eye className="mr-2 h-4 w-4" /> <Eye className="mr-2 h-4 w-4" />
Ver Ver
</DropdownMenuItem> </DropdownMenuItem>
@ -245,6 +251,46 @@ export default function PacientesPage() {
</Table> </Table>
</div> </div>
{viewingPatient && (
<Dialog open={!!viewingPatient} onOpenChange={() => setViewingPatient(null)}>
<DialogContent className="max-w-2xl">
<DialogHeader>
<DialogTitle>Detalhes do Paciente</DialogTitle>
<DialogDescription>
Informações detalhadas de {viewingPatient.nome}.
</DialogDescription>
</DialogHeader>
<div className="grid gap-4 py-4">
<div className="grid grid-cols-4 items-center gap-4">
<Label className="text-right">Nome</Label>
<span className="col-span-3 font-medium">{viewingPatient.nome}</span>
</div>
<div className="grid grid-cols-4 items-center gap-4">
<Label className="text-right">CPF</Label>
<span className="col-span-3">{viewingPatient.cpf}</span>
</div>
<div className="grid grid-cols-4 items-center gap-4">
<Label className="text-right">Telefone</Label>
<span className="col-span-3">{viewingPatient.telefone}</span>
</div>
<div className="grid grid-cols-4 items-center gap-4">
<Label className="text-right">Endereço</Label>
<span className="col-span-3">
{`${viewingPatient.endereco.logradouro}, ${viewingPatient.endereco.numero} - ${viewingPatient.endereco.bairro}, ${viewingPatient.endereco.cidade} - ${viewingPatient.endereco.estado}`}
</span>
</div>
<div className="grid grid-cols-4 items-center gap-4">
<Label className="text-right">Observações</Label>
<span className="col-span-3">{viewingPatient.observacoes || "Nenhuma"}</span>
</div>
</div>
<DialogFooter>
<Button onClick={() => setViewingPatient(null)}>Fechar</Button>
</DialogFooter>
</DialogContent>
</Dialog>
)}
<div className="text-sm text-muted-foreground">Mostrando {filtered.length} de {patients.length}</div> <div className="text-sm text-muted-foreground">Mostrando {filtered.length} de {patients.length}</div>
</div> </div>
); );

View File

@ -1,372 +1,34 @@
"use client"; "use client";
import { useState } from "react"; import { useRouter } from "next/navigation";
import Link from "next/link"; import { AppointmentForm } from "@/components/forms/appointment-form";
import { usePathname, useRouter } from "next/navigation";
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 { Switch } from "@/components/ui/switch";
import { Calendar } from "lucide-react";
import {
RotateCcw,
Accessibility,
Volume2,
Flame,
Settings,
Clipboard,
Search,
ChevronDown,
Upload,
FileDown,
Tag,
Save,
} from "lucide-react";
import HeaderAgenda from "@/components/agenda/HeaderAgenda"; import HeaderAgenda from "@/components/agenda/HeaderAgenda";
import FooterAgenda from "@/components/agenda/FooterAgenda"; import FooterAgenda from "@/components/agenda/FooterAgenda";
export default function NovoAgendamentoPage() { export default function NovoAgendamentoPage() {
const [bloqueio, setBloqueio] = useState(false); const router = useRouter();
const handleSave = (data: any) => {
console.log("Salvando novo agendamento...", data);
// Aqui viria a chamada da API para criar um novo agendamento
alert("Novo agendamento salvo (simulado)!");
router.push("/consultas"); // Volta para a lista após salvar
};
const handleCancel = () => {
router.back(); // Simplesmente volta para a página anterior
};
return ( return (
// ====== WRAPPER COM ESPAÇAMENTO GERAL ======
<div className="min-h-screen flex flex-col bg-white"> <div className="min-h-screen flex flex-col bg-white">
{/* HEADER fora do <main>, usando o MESMO container do footer */}
<HeaderAgenda /> <HeaderAgenda />
<main className="flex-1 mx-auto w-full max-w-7xl px-8 py-8">
{/* Conteúdo */} <AppointmentForm
<main className="flex-1 mx-auto w-full max-w-7xl px-8 py-8 space-y-8"> onSave={handleSave}
{/* ==== INFORMAÇÕES DO PACIENTE — layout idêntico ao print ==== */} onCancel={handleCancel}
<div className="border rounded-md p-6 space-y-4 bg-white"> initialData={{}} // Passa um objeto vazio para o modo de criação
<h2 className="font-medium">Informações do paciente</h2> />
{/* grade principal: 12 colunas para controlar as larguras */}
<div className="grid grid-cols-1 md:grid-cols-12 gap-4">
{/* ===== Linha 1 ===== */}
<div className="md:col-span-6">
<Label>Nome *</Label>
<div className="relative">
<Search className="pointer-events-none absolute left-2 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400" />
<Input
placeholder="Digite o nome do paciente"
className="h-10 pl-8"
/>
</div>
</div>
<div className="md:col-span-3">
<Label>CPF do paciente</Label>
<Input placeholder="Número do CPF" className="h-10" />
</div>
<div className="md:col-span-3">
<Label>RG</Label>
<Input placeholder="Número do RG" className="h-10" />
</div>
{/* ===== Linha 2 ===== */}
{/* 1ª coluna (span 6) com sub-grid: Data (5 col) + Telefone (7 col) */}
<div className="md:col-span-6">
<div className="grid grid-cols-12 gap-3">
<div className="col-span-5">
<Label>Data de nascimento *</Label>
<Input type="date" className="h-10" />
</div>
<div className="col-span-7">
<Label>Telefone</Label>
<div className="grid grid-cols-[86px_1fr] gap-2">
<select className="h-10 rounded-md border border-input bg-background px-2 text-[13px]">
<option value="+55">+55</option>
<option value="+351">+351</option>
<option value="+1">+1</option>
</select>
<Input placeholder="(99) 99999-9999" className="h-10" />
</div>
</div>
</div>
</div>
{/* 2ª coluna da linha 2: E-mail (span 6) */}
<div className="md:col-span-6">
<Label>E-mail</Label>
<Input
type="email"
placeholder="email@exemplo.com"
className="h-10"
/>
</div>
{/* ===== Linha 3 ===== */}
<div className="md:col-span-6">
<Label>Convênio</Label>
<div className="relative">
<select
defaultValue="particular"
className="h-10 w-full rounded-md border border-input bg-background pr-8 pl-3 text-[13px] appearance-none"
>
<option value="particular">Particular</option>
<option value="plano-a">Plano A</option>
<option value="plano-b">Plano B</option>
</select>
<ChevronDown className="pointer-events-none absolute right-2 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" />
</div>
</div>
<div className="md:col-span-6 grid grid-cols-2 gap-4">
<div>
<Label>Matrícula</Label>
<Input defaultValue="000000000" className="h-10" />
</div>
<div>
<Label>Validade</Label>
<Input placeholder="00/0000" className="h-10" />
</div>
</div>
</div>
{/* link Informações adicionais */}
<button
type="button"
className="text-sm text-blue-600 inline-flex items-center gap-1 hover:underline"
aria-label="Ver informações adicionais do paciente"
>
Informações adicionais
<ChevronDown className="h-4 w-4" aria-hidden="true" />
</button>
{/* barra Documentos e anexos */}
<div className="flex items-center justify-between border rounded-md px-3 py-2">
<span className="text-sm">Documentos e anexos</span>
<div className="flex gap-2">
<Button
size="icon"
variant="outline"
className="h-8 w-8"
aria-label="Enviar documento"
>
<Upload className="h-4 w-4" />
</Button>
<Button
size="icon"
variant="outline"
className="h-8 w-8"
aria-label="Baixar documento"
>
<FileDown className="h-4 w-4" />
</Button>
<Button
size="icon"
variant="outline"
className="h-8 w-8"
aria-label="Gerenciar etiquetas"
>
<Tag className="h-4 w-4" />
</Button>
</div>
</div>
</div>
{/* ==== INFORMAÇÕES DO ATENDIMENTO ==== */}
<div className="border rounded-md p-6 space-y-4 bg-white">
<h2 className="font-medium">Informações do atendimento</h2>
{/* GRID PRINCIPAL: 12 colunas */}
<div className="grid grid-cols-1 md:grid-cols-12 gap-6">
{/* COLUNA ESQUERDA (span 6) */}
<div className="md:col-span-6 space-y-3">
{/* Nome do profissional */}
<div>
<Label className="text-[13px]">
Nome do profissional <span className="text-red-600">*</span>
</Label>
<div className="relative">
<Search className="pointer-events-none absolute left-2 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground" />
<input
defaultValue="Robson Alves dos Anjos Neto"
className="h-10 w-full rounded-full border border-input pl-8 pr-12 text-[13px] focus:ring-2 focus:ring-blue-500 focus:border-blue-500"
/>
<span className="absolute right-2 top-1/2 -translate-y-1/2 inline-flex h-6 min-w-[28px] items-center justify-center rounded-full bg-muted px-2 text-xs font-medium">
RA
</span>
</div>
</div>
<div className="grid grid-cols-2 gap-3">
{/* Unidade */}
<div>
<Label className="text-[13px]">
Unidade <span className="text-red-600">*</span>
</Label>
<select
defaultValue="nei"
className="h-10 w-full rounded-md border border-input bg-background pr-8 pl-3 text-[13px] appearance-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500"
>
<option value="nei">
Núcleo de Especialidades Integradas
</option>
<option value="cc">Clínica Central</option>
</select>
</div>
{/* Data com ícone */}
<div>
<Label className="text-[13px]">
Data <span className="text-red-600">*</span>
</Label>
<div className="relative">
<Calendar className="pointer-events-none absolute left-2 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground" />
<input
type="date"
defaultValue="2025-07-29"
className="h-10 w-full rounded-md border border-input pl-8 pr-3 text-[13px] focus:ring-2 focus:ring-blue-500 focus:border-blue-500"
/>
</div>
</div>
</div>
{/* Início / Término / Profissional solicitante (na mesma linha) */}
<div className="grid grid-cols-12 gap-3 items-end">
{/* Início (maior) */}
<div className="col-span-12 md:col-span-3">
<Label className="text-[13px]">
Início <span className="text-red-600">*</span>
</Label>
<input
type="time"
defaultValue="21:03"
className="h-10 w-full rounded-md border border-input px-3 text-[13px] focus:ring-2 focus:ring-blue-500 focus:border-blue-500"
/>
</div>
{/* Término (maior) */}
<div className="col-span-12 md:col-span-3">
<Label className="text-[13px]">
Término <span className="text-red-600">*</span>
</Label>
<input
type="time"
defaultValue="21:03"
className="h-10 w-full rounded-md border border-input px-3 text-[13px] focus:ring-2 focus:ring-blue-500 focus:border-blue-500"
/>
</div>
{/* Profissional solicitante */}
<div className="col-span-12 md:col-span-6">
<Label className="text-[13px]">
Profissional solicitante
</Label>
<div className="relative">
{/* ícone de busca à esquerda */}
<svg
className="pointer-events-none absolute left-2 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="2"
>
<circle cx="11" cy="11" r="8" />
<line x1="21" y1="21" x2="16.65" y2="16.65" />
</svg>
<select
defaultValue=""
className="h-10 w-full rounded-md border border-input bg-background pl-8 pr-8 text-[13px] appearance-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500"
>
<option value="" disabled>
Selecione o solicitante
</option>
<option value="1">Dr. Carlos Silva</option>
<option value="2">Dra. Maria Santos</option>
</select>
<svg
className="pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="2"
>
<path d="M6 9l6 6 6-6" />
</svg>
</div>
</div>
</div>
</div>
{/* COLUNA DIREITA — altura/posição como a imagem 1 */}
<div className="md:col-span-6 relative -top-10">
{/* toolbar */}
<div className="mb-2 flex items-center justify-end gap-1">
<Button size="icon" variant="outline" className="h-8 w-8">
<Accessibility className="h-4 w-4" />
</Button>
<Button size="icon" variant="outline" className="h-8 w-8">
<Volume2 className="h-4 w-4" />
</Button>
<Button size="icon" variant="outline" className="h-8 w-8">
<Flame className="h-4 w-4" />
</Button>
<Button size="icon" variant="outline" className="h-8 w-8">
<Settings className="h-4 w-4" />
</Button>
<Button size="icon" variant="outline" className="h-8 w-8">
<Clipboard className="h-4 w-4" />
</Button>
</div>
{/* Tipo de atendimento + campo de busca */}
<div className="mb-2">
<div className="flex items-center justify-between">
<Label className="text-[13px]">
Tipo de atendimento <span className="text-red-600">*</span>
</Label>
<label className="flex items-center gap-1 text-xs text-muted-foreground">
<input
type="checkbox"
className="h-3.5 w-3.5 accent-current"
/>{" "}
Pagamento via Reembolso
</label>
</div>
<div className="relative mt-1">
<Search className="pointer-events-none absolute left-2 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" />
<Input
placeholder="Pesquisar"
className="h-10 w-full rounded-md border border-input pl-8 pr-8 text-[13px]"
/>
<ChevronDown className="pointer-events-none absolute right-2 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" />
</div>
</div>
{/* Observações + imprimir */}
<div className="mb-0.2 flex items-center justify-between">
<Label className="text-[13px]">Observações</Label>
<label className="flex items-center gap-2 text-xs text-muted-foreground">
<input
type="checkbox"
className="h-3.5 w-3.5 accent-current"
/>{" "}
Imprimir na Etiqueta / Pulseira
</label>
</div>
{/* Textarea mais baixo e compacto */}
<Textarea
rows={4}
placeholder=""
className="text-[13px] h-[110px] min-h-0 resize-none"
/>
</div>
</div>
</div>
</main> </main>
{/* ====== FOOTER FIXO ====== */}
<FooterAgenda /> <FooterAgenda />
</div> </div>
); );

View File

@ -32,9 +32,9 @@ import {
const navigation = [ const navigation = [
{ name: "Dashboard", href: "/dashboard", icon: Home }, { name: "Dashboard", href: "/dashboard", icon: Home },
{ name: "Calendario", href: "/calendar", icon: Calendar }, { name: "Calendario", href: "/calendar", icon: Calendar },
{ name: "Pacientes", href: "/dashboard/pacientes", icon: Users }, { name: "Pacientes", href: "/pacientes", icon: Users },
{ name: "Médicos", href: "/dashboard/doutores", icon: User }, { name: "Médicos", href: "/doutores", icon: User },
{ name: "Consultas", href: "/dashboard/consultas", icon: UserCheck }, { name: "Consultas", href: "/consultas", icon: UserCheck },
{ name: "Prontuários", href: "/dashboard/prontuarios", icon: FileText }, { name: "Prontuários", href: "/dashboard/prontuarios", icon: FileText },
{ name: "Relatórios", href: "/dashboard/relatorios", icon: BarChart3 }, { name: "Relatórios", href: "/dashboard/relatorios", icon: BarChart3 },
{ name: "Configurações", href: "/dashboard/configuracoes", icon: Settings }, { name: "Configurações", href: "/dashboard/configuracoes", icon: Settings },

View File

@ -0,0 +1,147 @@
"use client";
import { useState, useEffect } from "react";
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";
// Este é um formulário genérico para Criar e Editar um agendamento.
// Ele não tem Header ou Footer, apenas o conteúdo do formulário em si.
export function CalendarRegistrationForm({ initialData, onSave, onCancel }: any) {
const [formData, setFormData] = useState(initialData || {});
useEffect(() => {
// Se os dados iniciais mudarem (ex: usuário clica em outro item para editar),
// atualizamos o estado do formulário.
setFormData(initialData || {});
}, [initialData]);
const handleChange = (e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement>) => {
const { name, value } = e.target;
setFormData((prev: any) => ({ ...prev, [name]: value }));
};
const handleSubmit = (e: React.FormEvent) => {
e.preventDefault();
onSave(formData);
};
return (
<form onSubmit={handleSubmit} className="space-y-8">
{/* ==== INFORMAÇÕES DO PACIENTE ==== */}
<div className="border rounded-md p-6 space-y-4 bg-white">
<h2 className="font-medium">Informações do paciente</h2>
<div className="grid grid-cols-1 md:grid-cols-12 gap-4">
<div className="md:col-span-6">
<Label>Nome *</Label>
<div className="relative">
<Search className="pointer-events-none absolute left-2 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400" />
<Input
name="patientName" // Nome do campo para o estado
placeholder="Digite o nome do paciente"
className="h-10 pl-8"
value={formData.patientName || ''}
onChange={handleChange}
/>
</div>
</div>
<div className="md:col-span-3">
<Label>CPF do paciente</Label>
<Input name="cpf" placeholder="Número do CPF" className="h-10" value={formData.cpf || ''} onChange={handleChange} />
</div>
<div className="md:col-span-3">
<Label>RG</Label>
<Input name="rg" placeholder="Número do RG" className="h-10" value={formData.rg || ''} onChange={handleChange} />
</div>
<div className="md:col-span-6">
<div className="grid grid-cols-12 gap-3">
<div className="col-span-5">
<Label>Data de nascimento *</Label>
<Input name="birthDate" type="date" className="h-10" value={formData.birthDate || ''} onChange={handleChange} />
</div>
<div className="col-span-7">
<Label>Telefone</Label>
<div className="grid grid-cols-[86px_1fr] gap-2">
<select name="phoneCode" className="h-10 rounded-md border border-input bg-background px-2 text-[13px]" value={formData.phoneCode || '+55'} onChange={handleChange}>
<option value="+55">+55</option>
<option value="+351">+351</option>
<option value="+1">+1</option>
</select>
<Input name="phoneNumber" placeholder="(99) 99999-9999" className="h-10" value={formData.phoneNumber || ''} onChange={handleChange} />
</div>
</div>
</div>
</div>
<div className="md:col-span-6">
<Label>E-mail</Label>
<Input name="email" type="email" placeholder="email@exemplo.com" className="h-10" value={formData.email || ''} onChange={handleChange} />
</div>
</div>
</div>
{/* ==== INFORMAÇÕES DO ATENDIMENTO ==== */}
<div className="border rounded-md p-6 space-y-4 bg-white">
<h2 className="font-medium">Informações do atendimento</h2>
<div className="grid grid-cols-1 md:grid-cols-12 gap-6">
<div className="md:col-span-6 space-y-3">
<div>
<Label className="text-[13px]">Nome do profissional *</Label>
<div className="relative">
<Search className="pointer-events-none absolute left-2 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground" />
<Input name="professionalName" className="h-10 w-full rounded-full border border-input pl-8 pr-12 text-[13px]" value={formData.professionalName || ''} onChange={handleChange} />
</div>
</div>
<div className="grid grid-cols-2 gap-3">
<div>
<Label className="text-[13px]">Unidade *</Label>
<select name="unit" className="h-10 w-full rounded-md border border-input bg-background pr-8 pl-3 text-[13px] appearance-none" value={formData.unit || 'nei'} onChange={handleChange}>
<option value="nei">Núcleo de Especialidades Integradas</option>
<option value="cc">Clínica Central</option>
</select>
</div>
<div>
<Label className="text-[13px]">Data *</Label>
<div className="relative">
<Calendar className="pointer-events-none absolute left-2 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground" />
<Input name="appointmentDate" type="date" className="h-10 w-full rounded-md border border-input pl-8 pr-3 text-[13px]" value={formData.appointmentDate || ''} onChange={handleChange} />
</div>
</div>
</div>
<div className="grid grid-cols-12 gap-3 items-end">
<div className="col-span-12 md:col-span-3">
<Label className="text-[13px]">Início *</Label>
<Input name="startTime" type="time" className="h-10 w-full rounded-md border border-input px-3 text-[13px]" value={formData.startTime || ''} onChange={handleChange} />
</div>
<div className="col-span-12 md:col-span-3">
<Label className="text-[13px]">Término *</Label>
<Input name="endTime" type="time" className="h-10 w-full rounded-md border border-input px-3 text-[13px]" value={formData.endTime || ''} onChange={handleChange} />
</div>
</div>
</div>
<div className="md:col-span-6">
<div className="mb-2">
<Label className="text-[13px]">Tipo de atendimento *</Label>
<div className="relative mt-1">
<Search className="pointer-events-none absolute left-2 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" />
<Input name="appointmentType" placeholder="Pesquisar" className="h-10 w-full rounded-md border border-input pl-8 pr-8 text-[13px]" value={formData.appointmentType || ''} onChange={handleChange} />
</div>
</div>
<div>
<Label className="text-[13px]">Observações</Label>
<Textarea name="notes" rows={4} className="text-[13px] h-[110px] min-h-0 resize-none" value={formData.notes || ''} onChange={handleChange} />
</div>
</div>
</div>
</div>
{/* Botões de Ação */}
<div className="flex justify-end gap-2">
<Button type="button" variant="outline" onClick={onCancel}>Cancelar</Button>
<Button type="submit">Salvar</Button>
</div>
</form>
);
}