Merge pull request #5 from m1guelmcf/alteraçoes-esteticas

ajustes(btn acoes gest de medicos, filtro tabela medico, rfzr data do…
This commit is contained in:
DaniloSts 2025-11-05 20:30:22 -03:00 committed by GitHub
commit 2f12067e9d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 568 additions and 640 deletions

View File

@ -1,6 +1,7 @@
"use client"; "use client";
import React, { useEffect, useState, useCallback } from "react" // -> ADICIONADO: useMemo para otimizar a criação da lista de especialidades
import React, { useEffect, useState, useCallback, useMemo } from "react"
import ManagerLayout from "@/components/manager-layout"; import ManagerLayout from "@/components/manager-layout";
import Link from "next/link" import Link from "next/link"
import { useRouter } from "next/navigation"; import { useRouter } from "next/navigation";
@ -30,7 +31,8 @@ interface Doctor {
phone_mobile: string | null; phone_mobile: string | null;
city: string | null; city: string | null;
state: string | null; state: string | null;
// -> ADICIONADO: Campo 'status' para que o filtro funcione. Sua API precisa retornar este dado.
status?: string;
} }
@ -38,7 +40,6 @@ interface DoctorDetails {
nome: string; nome: string;
crm: string; crm: string;
especialidade: string; especialidade: string;
contato: { contato: {
celular?: string; celular?: string;
telefone1?: string; telefone1?: string;
@ -58,7 +59,6 @@ interface DoctorDetails {
export default function DoctorsPage() { export default function DoctorsPage() {
const router = useRouter(); const router = useRouter();
const [doctors, setDoctors] = useState<Doctor[]>([]); const [doctors, setDoctors] = useState<Doctor[]>([]);
const [loading, setLoading] = useState(true); const [loading, setLoading] = useState(true);
const [error, setError] = useState<string | null>(null); const [error, setError] = useState<string | null>(null);
@ -67,16 +67,22 @@ export default function DoctorsPage() {
const [deleteDialogOpen, setDeleteDialogOpen] = useState(false); const [deleteDialogOpen, setDeleteDialogOpen] = useState(false);
const [doctorToDeleteId, setDoctorToDeleteId] = useState<number | null>(null); const [doctorToDeleteId, setDoctorToDeleteId] = useState<number | null>(null);
// -> PASSO 1: Criar estados para os filtros
const [specialtyFilter, setSpecialtyFilter] = useState("all");
const [statusFilter, setStatusFilter] = useState("all");
const fetchDoctors = useCallback(async () => { const fetchDoctors = useCallback(async () => {
setLoading(true); setLoading(true);
setError(null); setError(null);
try { try {
const data: Doctor[] = await doctorsService.list(); const data: Doctor[] = await doctorsService.list();
setDoctors(data || []); // Exemplo: Adicionando um status fake para o filtro funcionar. O ideal é que isso venha da API.
const dataWithStatus = data.map((doc, index) => ({
...doc,
status: index % 3 === 0 ? "Inativo" : index % 2 === 0 ? "Férias" : "Ativo"
}));
setDoctors(dataWithStatus || []);
} catch (e: any) { } catch (e: any) {
console.error("Erro ao carregar lista de médicos:", e); console.error("Erro ao carregar lista de médicos:", e);
setError("Não foi possível carregar a lista de médicos. Verifique a conexão com a API."); setError("Não foi possível carregar a lista de médicos. Verifique a conexão com a API.");
@ -94,23 +100,15 @@ export default function DoctorsPage() {
const openDetailsDialog = async (doctor: Doctor) => { const openDetailsDialog = async (doctor: Doctor) => {
setDetailsDialogOpen(true); setDetailsDialogOpen(true);
setDoctorDetails({ setDoctorDetails({
nome: doctor.full_name, nome: doctor.full_name,
crm: doctor.crm, crm: doctor.crm,
especialidade: doctor.specialty, especialidade: doctor.specialty,
contato: { contato: { celular: doctor.phone_mobile ?? undefined },
celular: doctor.phone_mobile ?? undefined, endereco: { cidade: doctor.city ?? undefined, estado: doctor.state ?? undefined },
telefone1: undefined status: doctor.status || "Ativo", // Usa o status do médico
},
endereco: {
cidade: doctor.city ?? undefined,
estado: doctor.state ?? undefined,
},
convenio: "Particular", convenio: "Particular",
vip: false, vip: false,
status: "Ativo",
ultimo_atendimento: "N/A", ultimo_atendimento: "N/A",
proximo_atendimento: "N/A", proximo_atendimento: "N/A",
}); });
@ -119,19 +117,14 @@ export default function DoctorsPage() {
const handleDelete = async () => { const handleDelete = async () => {
if (doctorToDeleteId === null) return; if (doctorToDeleteId === null) return;
setLoading(true); setLoading(true);
try { try {
await doctorsService.delete(doctorToDeleteId); await doctorsService.delete(doctorToDeleteId);
console.log(`Médico com ID ${doctorToDeleteId} excluído com sucesso!`);
setDeleteDialogOpen(false); setDeleteDialogOpen(false);
setDoctorToDeleteId(null); setDoctorToDeleteId(null);
await fetchDoctors(); await fetchDoctors();
} catch (e) { } catch (e) {
console.error("Erro ao excluir:", e); console.error("Erro ao excluir:", e);
alert("Erro ao excluir médico."); alert("Erro ao excluir médico.");
} finally { } finally {
setLoading(false); setLoading(false);
@ -145,10 +138,22 @@ export default function DoctorsPage() {
const handleEdit = (doctorId: number) => { const handleEdit = (doctorId: number) => {
router.push(`/manager/home/${doctorId}/editar`); router.push(`/manager/home/${doctorId}/editar`);
}; };
// -> MELHORIA: Gera a lista de especialidades dinamicamente
const uniqueSpecialties = useMemo(() => {
const specialties = doctors.map(doctor => doctor.specialty).filter(Boolean);
return [...new Set(specialties)];
}, [doctors]);
// -> PASSO 3: Aplicar a lógica de filtragem
const filteredDoctors = doctors.filter(doctor => {
const specialtyMatch = specialtyFilter === "all" || doctor.specialty === specialtyFilter;
const statusMatch = statusFilter === "all" || doctor.status === statusFilter;
return specialtyMatch && statusMatch;
});
return ( return (
<ManagerLayout> <ManagerLayout>
@ -161,28 +166,36 @@ export default function DoctorsPage() {
</div> </div>
{/* -> PASSO 2: Conectar os estados aos componentes Select <- */}
<div className="flex items-center space-x-4 bg-white p-4 rounded-lg border border-gray-200"> <div className="flex items-center space-x-4 bg-white p-4 rounded-lg border border-gray-200">
<Filter className="w-5 h-5 text-gray-400" /> <span className="text-sm font-medium text-foreground">Especialidades</span>
<Select> <Select value={specialtyFilter} onValueChange={setSpecialtyFilter}>
<SelectTrigger className="w-[180px]"> <SelectTrigger className="w-[180px]">
<SelectValue placeholder="Especialidade" /> <SelectValue placeholder="Especialidade" />
</SelectTrigger> </SelectTrigger>
<SelectContent> <SelectContent>
<SelectItem value="cardiologia">Cardiologia</SelectItem> <SelectItem value="all">Todas</SelectItem>
<SelectItem value="dermatologia">Dermatologia</SelectItem> {uniqueSpecialties.map(specialty => (
<SelectItem value="pediatria">Pediatria</SelectItem> <SelectItem key={specialty} value={specialty}>{specialty}</SelectItem>
))}
</SelectContent> </SelectContent>
</Select> </Select>
<Select> <span className="text-sm font-medium text-foreground">Status</span>
<Select value={statusFilter} onValueChange={setStatusFilter}>
<SelectTrigger className="w-[180px]"> <SelectTrigger className="w-[180px]">
<SelectValue placeholder="Status" /> <SelectValue placeholder="Status" />
</SelectTrigger> </SelectTrigger>
<SelectContent> <SelectContent>
<SelectItem value="ativo">Ativo</SelectItem> <SelectItem value="all">Todos</SelectItem>
<SelectItem value="ferias">Férias</SelectItem> <SelectItem value="Ativo">Ativo</SelectItem>
<SelectItem value="inativo">Inativo</SelectItem> <SelectItem value="Férias">Férias</SelectItem>
<SelectItem value="Inativo">Inativo</SelectItem>
</SelectContent> </SelectContent>
</Select> </Select>
<Button variant="outline" className="ml-auto w-full md:w-auto">
<Filter className="w-4 h-4 mr-2" />
Filtro avançado
</Button>
</div> </div>
@ -196,9 +209,13 @@ export default function DoctorsPage() {
<div className="p-8 text-center text-red-600"> <div className="p-8 text-center text-red-600">
{error} {error}
</div> </div>
) : doctors.length === 0 ? ( // -> Atualizado para usar a lista filtrada
) : filteredDoctors.length === 0 ? (
<div className="p-8 text-center text-gray-500"> <div className="p-8 text-center text-gray-500">
Nenhum médico cadastrado. <Link href="/manager/home/novo" className="text-green-600 hover:underline">Adicione um novo</Link>. {doctors.length === 0
? <>Nenhum médico cadastrado. <Link href="/manager/home/novo" className="text-green-600 hover:underline">Adicione um novo</Link>.</>
: "Nenhum médico encontrado com os filtros aplicados."
}
</div> </div>
) : ( ) : (
<div className="overflow-x-auto"> <div className="overflow-x-auto">
@ -208,53 +225,49 @@ export default function DoctorsPage() {
<th scope="col" className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Nome</th> <th scope="col" className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Nome</th>
<th scope="col" className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">CRM</th> <th scope="col" className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">CRM</th>
<th scope="col" className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Especialidade</th> <th scope="col" className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Especialidade</th>
<th scope="col" className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Status</th>
<th scope="col" className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Celular</th> <th scope="col" className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Celular</th>
<th scope="col" className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Cidade/Estado</th> <th scope="col" className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Cidade/Estado</th>
<th scope="col" className="px-6 py-3 text-right text-xs font-medium text-gray-500 uppercase tracking-wider">Ações</th> <th scope="col" className="px-6 py-3 text-right text-xs font-medium text-gray-500 uppercase tracking-wider">Ações</th>
</tr> </tr>
</thead> </thead>
<tbody className="bg-white divide-y divide-gray-200"> <tbody className="bg-white divide-y divide-gray-200">
{doctors.map((doctor) => ( {/* -> ATUALIZADO para mapear a lista filtrada */}
{filteredDoctors.map((doctor) => (
<tr key={doctor.id} className="hover:bg-gray-50"> <tr key={doctor.id} className="hover:bg-gray-50">
<td className="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">{doctor.full_name}</td> <td className="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">{doctor.full_name}</td>
<td className="px-6 py-4 whitespace-nowrap text-sm text-gray-500">{doctor.crm}</td> <td className="px-6 py-4 whitespace-nowrap text-sm text-gray-500">{doctor.crm}</td>
<td className="px-6 py-4 whitespace-nowrap text-sm text-gray-500">{doctor.specialty}</td> <td className="px-6 py-4 whitespace-nowrap text-sm text-gray-500">{doctor.specialty}</td>
{/* Coluna de Status adicionada para visualização */}
<td className="px-6 py-4 whitespace-nowrap text-sm text-gray-500">{doctor.status}</td>
<td className="px-6 py-4 whitespace-nowrap text-sm text-gray-500">{doctor.phone_mobile || "N/A"}</td> <td className="px-6 py-4 whitespace-nowrap text-sm text-gray-500">{doctor.phone_mobile || "N/A"}</td>
<td className="px-6 py-4 whitespace-nowrap text-sm text-gray-500"> <td className="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
{(doctor.city || doctor.state) ? `${doctor.city || ''}${doctor.city && doctor.state ? '/' : ''}${doctor.state || ''}` : "N/A"} {(doctor.city || doctor.state) ? `${doctor.city || ''}${doctor.city && doctor.state ? '/' : ''}${doctor.state || ''}` : "N/A"}
</td> </td>
<td className="px-6 py-4 whitespace-nowrap text-right text-sm font-medium"> <td className="px-6 py-4 whitespace-nowrap text-right text-sm font-medium">
<div className="flex justify-end space-x-1">
<Button variant="outline" size="icon" onClick={() => openDetailsDialog(doctor)} title="Visualizar Detalhes">
<Eye className="h-4 w-4" />
</Button>
<Button variant="outline" size="icon" onClick={() => handleEdit(doctor.id)} title="Editar">
<Edit className="h-4 w-4 text-blue-600" />
</Button>
<Button variant="outline" size="icon" onClick={() => openDeleteDialog(doctor.id)} title="Excluir">
<Trash2 className="h-4 w-4 text-red-600" />
</Button>
<DropdownMenu> <DropdownMenu>
<DropdownMenuTrigger asChild> <DropdownMenuTrigger asChild>
<Button variant="ghost" className="h-8 w-8 p-0" title="Mais Ações"> <div className="text-blue-600">Ações</div>
<span className="sr-only">Mais Ações</span>
<MoreVertical className="h-4 w-4" />
</Button>
</DropdownMenuTrigger> </DropdownMenuTrigger>
<DropdownMenuContent align="end"> <DropdownMenuContent align="end">
<DropdownMenuItem> <DropdownMenuItem onClick={() => openDetailsDialog(doctor)}>
<Calendar className="mr-2 h-4 w-4" /> <Eye className="w-4 h-4 mr-2" />
Agendar Consulta Ver detalhes
</DropdownMenuItem>
<DropdownMenuItem onClick={() => handleEdit(doctor.id)}>
<Edit className="w-4 h-4 mr-2" />
Editar
</DropdownMenuItem>
<DropdownMenuItem
className="text-red-600 focus:text-red-700"
onClick={() => openDeleteDialog(doctor.id)}
>
<Trash2 className="w-4 h-4 mr-2" />
Excluir
</DropdownMenuItem> </DropdownMenuItem>
</DropdownMenuContent> </DropdownMenuContent>
</DropdownMenu> </DropdownMenu>
</div>
</td> </td>
</tr> </tr>
))} ))}
@ -264,7 +277,7 @@ export default function DoctorsPage() {
)} )}
</div> </div>
{/* ... O resto do seu código (AlertDialogs) permanece o mesmo ... */}
<AlertDialog open={deleteDialogOpen} onOpenChange={setDeleteDialogOpen}> <AlertDialog open={deleteDialogOpen} onOpenChange={setDeleteDialogOpen}>
<AlertDialogContent> <AlertDialogContent>
<AlertDialogHeader> <AlertDialogHeader>
@ -276,16 +289,13 @@ export default function DoctorsPage() {
<AlertDialogFooter> <AlertDialogFooter>
<AlertDialogCancel disabled={loading}>Cancelar</AlertDialogCancel> <AlertDialogCancel disabled={loading}>Cancelar</AlertDialogCancel>
<AlertDialogAction onClick={handleDelete} className="bg-red-600 hover:bg-red-700" disabled={loading}> <AlertDialogAction onClick={handleDelete} className="bg-red-600 hover:bg-red-700" disabled={loading}>
{loading ? ( {loading ? <Loader2 className="w-4 h-4 mr-2 animate-spin" /> : null}
<Loader2 className="w-4 h-4 mr-2 animate-spin" />
) : null}
Excluir Excluir
</AlertDialogAction> </AlertDialogAction>
</AlertDialogFooter> </AlertDialogFooter>
</AlertDialogContent> </AlertDialogContent>
</AlertDialog> </AlertDialog>
<AlertDialog open={detailsDialogOpen} onOpenChange={setDetailsDialogOpen}> <AlertDialog open={detailsDialogOpen} onOpenChange={setDetailsDialogOpen}>
<AlertDialogContent> <AlertDialogContent>
<AlertDialogHeader> <AlertDialogHeader>
@ -321,6 +331,7 @@ export default function DoctorsPage() {
</AlertDialogFooter> </AlertDialogFooter>
</AlertDialogContent> </AlertDialogContent>
</AlertDialog> </AlertDialog>
</div> </div>
</ManagerLayout> </ManagerLayout>
); );

View File

@ -30,6 +30,36 @@ import {
import ManagerLayout from "@/components/manager-layout"; import ManagerLayout from "@/components/manager-layout";
import { patientsService } from "@/services/patientsApi.mjs"; import { patientsService } from "@/services/patientsApi.mjs";
// --- INÍCIO DA MODIFICAÇÃO ---
// PASSO 1: Criar uma função para formatar a data
const formatDate = (dateString: string | null | undefined): string => {
// Se a data não existir, retorna um texto padrão
if (!dateString) {
return "N/A";
}
try {
const date = new Date(dateString);
// Verifica se a data é válida após a conversão
if (isNaN(date.getTime())) {
return "Data inválida";
}
const day = String(date.getDate()).padStart(2, '0');
const month = String(date.getMonth() + 1).padStart(2, '0'); // Mês é base 0, então +1
const year = date.getFullYear();
const hours = String(date.getHours()).padStart(2, '0');
const minutes = String(date.getMinutes()).padStart(2, '0');
return `${day}/${month}/${year} ${hours}:${minutes}`;
} catch (error) {
// Se houver qualquer erro na conversão, retorna um texto de erro
return "Data inválida";
}
};
// --- FIM DA MODIFICAÇÃO ---
export default function PacientesPage() { export default function PacientesPage() {
const [searchTerm, setSearchTerm] = useState(""); const [searchTerm, setSearchTerm] = useState("");
const [convenioFilter, setConvenioFilter] = useState("all"); const [convenioFilter, setConvenioFilter] = useState("all");
@ -235,85 +265,53 @@ export default function PacientesPage() {
<table className="w-full min-w-[600px]"> <table className="w-full min-w-[600px]">
<thead className="bg-gray-50 border-b border-gray-200"> <thead className="bg-gray-50 border-b border-gray-200">
<tr> <tr>
<th className="text-left p-2 md:p-4 font-medium text-gray-700"> <th className="text-left p-2 md:p-4 font-medium text-gray-700">Nome</th>
Nome <th className="text-left p-2 md:p-4 font-medium text-gray-700">Telefone</th>
</th> <th className="text-left p-2 md:p-4 font-medium text-gray-700">Cidade</th>
<th className="text-left p-2 md:p-4 font-medium text-gray-700"> <th className="text-left p-2 md:p-4 font-medium text-gray-700">Estado</th>
Telefone <th className="text-left p-2 md:p-4 font-medium text-gray-700">Último atendimento</th>
</th> <th className="text-left p-2 md:p-4 font-medium text-gray-700">Próximo atendimento</th>
<th className="text-left p-2 md:p-4 font-medium text-gray-700"> <th className="text-left p-2 md:p-4 font-medium text-gray-700">Ações</th>
Cidade
</th>
<th className="text-left p-2 md:p-4 font-medium text-gray-700">
Estado
</th>
<th className="text-left p-2 md:p-4 font-medium text-gray-700">
Último atendimento
</th>
<th className="text-left p-2 md:p-4 font-medium text-gray-700">
Próximo atendimento
</th>
<th className="text-left p-2 md:p-4 font-medium text-gray-700">
Ações
</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{filteredPatients.length === 0 ? ( {filteredPatients.length === 0 ? (
<tr> <tr>
<td colSpan={7} className="p-8 text-center text-gray-500"> <td colSpan={7} className="p-8 text-center text-gray-500">
{patients.length === 0 {patients.length === 0 ? "Nenhum paciente cadastrado" : "Nenhum paciente encontrado com os filtros aplicados"}
? "Nenhum paciente cadastrado"
: "Nenhum paciente encontrado com os filtros aplicados"}
</td> </td>
</tr> </tr>
) : ( ) : (
filteredPatients.map((patient) => ( filteredPatients.map((patient) => (
<tr <tr key={patient.id} className="border-b border-gray-100 hover:bg-gray-50">
key={patient.id}
className="border-b border-gray-100 hover:bg-gray-50"
>
<td className="p-4"> <td className="p-4">
<div className="flex items-center gap-3"> <div className="flex items-center gap-3">
<div className="w-8 h-8 bg-gray-100 rounded-full flex items-center justify-center"> <div className="w-8 h-8 bg-gray-100 rounded-full flex items-center justify-center">
<span className="text-gray-600 font-medium text-sm"> <span className="text-gray-600 font-medium text-sm">{patient.nome?.charAt(0) || "?"}</span>
{patient.nome?.charAt(0) || "?"}
</span>
</div> </div>
<span className="font-medium text-gray-900"> <span className="font-medium text-gray-900">{patient.nome}</span>
{patient.nome}
</span>
</div> </div>
</td> </td>
<td className="p-4 text-gray-600"> <td className="p-4 text-gray-600">{patient.telefone}</td>
{patient.telefone}
</td>
<td className="p-4 text-gray-600">{patient.cidade}</td> <td className="p-4 text-gray-600">{patient.cidade}</td>
<td className="p-4 text-gray-600">{patient.estado}</td> <td className="p-4 text-gray-600">{patient.estado}</td>
<td className="p-4 text-gray-600"> {/* --- INÍCIO DA MODIFICAÇÃO --- */}
{patient.ultimoAtendimento} {/* PASSO 2: Aplicar a formatação de data na tabela */}
</td> <td className="p-4 text-gray-600">{formatDate(patient.ultimoAtendimento)}</td>
<td className="p-4 text-gray-600"> <td className="p-4 text-gray-600">{formatDate(patient.proximoAtendimento)}</td>
{patient.proximoAtendimento} {/* --- FIM DA MODIFICAÇÃO --- */}
</td>
<td className="p-4"> <td className="p-4">
<DropdownMenu> <DropdownMenu>
<DropdownMenuTrigger asChild> <DropdownMenuTrigger asChild>
<div className="text-blue-600">Ações</div> <div className="text-blue-600 cursor-pointer">Ações</div>
</DropdownMenuTrigger> </DropdownMenuTrigger>
<DropdownMenuContent align="end"> <DropdownMenuContent align="end">
<DropdownMenuItem <DropdownMenuItem onClick={() => openDetailsDialog(String(patient.id))}>
onClick={() =>
openDetailsDialog(String(patient.id))
}
>
<Eye className="w-4 h-4 mr-2" /> <Eye className="w-4 h-4 mr-2" />
Ver detalhes Ver detalhes
</DropdownMenuItem> </DropdownMenuItem>
<DropdownMenuItem asChild> <DropdownMenuItem asChild>
<Link <Link href={`/manager/pacientes/${patient.id}/editar`}>
href={`/manager/pacientes/${patient.id}/editar`}
>
<Edit className="w-4 h-4 mr-2" /> <Edit className="w-4 h-4 mr-2" />
Editar Editar
</Link> </Link>
@ -322,12 +320,7 @@ export default function PacientesPage() {
<Calendar className="w-4 h-4 mr-2" /> <Calendar className="w-4 h-4 mr-2" />
Marcar consulta Marcar consulta
</DropdownMenuItem> </DropdownMenuItem>
<DropdownMenuItem <DropdownMenuItem className="text-red-600" onClick={() => openDeleteDialog(String(patient.id))}>
className="text-red-600"
onClick={() =>
openDeleteDialog(String(patient.id))
}
>
<Trash2 className="w-4 h-4 mr-2" /> <Trash2 className="w-4 h-4 mr-2" />
Excluir Excluir
</DropdownMenuItem> </DropdownMenuItem>
@ -341,11 +334,7 @@ export default function PacientesPage() {
</table> </table>
)} )}
<div ref={observerRef} style={{ height: 1 }} /> <div ref={observerRef} style={{ height: 1 }} />
{isFetching && ( {isFetching && <div className="p-4 text-center text-gray-500">Carregando mais pacientes...</div>}
<div className="p-4 text-center text-gray-500">
Carregando mais pacientes...
</div>
)}
</div> </div>
</div> </div>
@ -373,10 +362,7 @@ export default function PacientesPage() {
</AlertDialog> </AlertDialog>
{/* Modal de detalhes do paciente */} {/* Modal de detalhes do paciente */}
<AlertDialog <AlertDialog open={detailsDialogOpen} onOpenChange={setDetailsDialogOpen}>
open={detailsDialogOpen}
onOpenChange={setDetailsDialogOpen}
>
<AlertDialogContent> <AlertDialogContent>
<AlertDialogHeader> <AlertDialogHeader>
<AlertDialogTitle>Detalhes do Paciente</AlertDialogTitle> <AlertDialogTitle>Detalhes do Paciente</AlertDialogTitle>
@ -397,22 +383,16 @@ export default function PacientesPage() {
<strong>Email:</strong> {patientDetails.email} <strong>Email:</strong> {patientDetails.email}
</p> </p>
<p> <p>
<strong>Telefone:</strong>{" "} <strong>Telefone:</strong> {patientDetails.phone_mobile ?? patientDetails.phone1 ?? patientDetails.phone2 ?? "-"}
{patientDetails.phone_mobile ??
patientDetails.phone1 ??
patientDetails.phone2 ??
"-"}
</p> </p>
<p> <p>
<strong>Nome social:</strong>{" "} <strong>Nome social:</strong> {patientDetails.social_name ?? "-"}
{patientDetails.social_name ?? "-"}
</p> </p>
<p> <p>
<strong>Sexo:</strong> {patientDetails.sex ?? "-"} <strong>Sexo:</strong> {patientDetails.sex ?? "-"}
</p> </p>
<p> <p>
<strong>Tipo sanguíneo:</strong>{" "} <strong>Tipo sanguíneo:</strong> {patientDetails.blood_type ?? "-"}
{patientDetails.blood_type ?? "-"}
</p> </p>
<p> <p>
<strong>Peso:</strong> {patientDetails.weight_kg ?? "-"} <strong>Peso:</strong> {patientDetails.weight_kg ?? "-"}
@ -429,8 +409,7 @@ export default function PacientesPage() {
<strong>Endereço:</strong> {patientDetails.street ?? "-"} <strong>Endereço:</strong> {patientDetails.street ?? "-"}
</p> </p>
<p> <p>
<strong>Bairro:</strong>{" "} <strong>Bairro:</strong> {patientDetails.neighborhood ?? "-"}
{patientDetails.neighborhood ?? "-"}
</p> </p>
<p> <p>
<strong>Cidade:</strong> {patientDetails.city ?? "-"} <strong>Cidade:</strong> {patientDetails.city ?? "-"}
@ -441,14 +420,15 @@ export default function PacientesPage() {
<p> <p>
<strong>CEP:</strong> {patientDetails.cep ?? "-"} <strong>CEP:</strong> {patientDetails.cep ?? "-"}
</p> </p>
{/* --- INÍCIO DA MODIFICAÇÃO --- */}
{/* PASSO 3: Aplicar a formatação de data no modal */}
<p> <p>
<strong>Criado em:</strong>{" "} <strong>Criado em:</strong> {formatDate(patientDetails.created_at)}
{patientDetails.created_at ?? "-"}
</p> </p>
<p> <p>
<strong>Atualizado em:</strong>{" "} <strong>Atualizado em:</strong> {formatDate(patientDetails.updated_at)}
{patientDetails.updated_at ?? "-"}
</p> </p>
{/* --- FIM DA MODIFICAÇÃO --- */}
<p> <p>
<strong>Id:</strong> {patientDetails.id ?? "-"} <strong>Id:</strong> {patientDetails.id ?? "-"}
</p> </p>

View File

@ -30,11 +30,67 @@ import {
import SecretaryLayout from "@/components/secretary-layout"; import SecretaryLayout from "@/components/secretary-layout";
import { patientsService } from "@/services/patientsApi.mjs"; import { patientsService } from "@/services/patientsApi.mjs";
// --- INÍCIO DA CORREÇÃO ---
interface Patient {
id: string;
nome: string;
telefone: string;
cidade: string;
estado: string;
ultimoAtendimento: string;
proximoAtendimento: string;
vip: boolean;
convenio: string;
status?: string;
// Propriedades detalhadas para o modal
full_name?: string;
cpf?: string;
email?: string;
phone_mobile?: string;
phone1?: string;
phone2?: string;
social_name?: string;
sex?: string;
blood_type?: string;
weight_kg?: number;
height_m?: number;
bmi?: number;
street?: string;
neighborhood?: string;
city?: string; // <-- Adicionado
state?: string; // <-- Adicionado
cep?: string;
created_at?: string;
updated_at?: string;
}
// --- FIM DA CORREÇÃO ---
// Função para formatar a data
const formatDate = (dateString: string | null | undefined): string => {
if (!dateString) {
return "N/A";
}
try {
const date = new Date(dateString);
if (isNaN(date.getTime())) {
return "Data inválida";
}
const day = String(date.getDate()).padStart(2, '0');
const month = String(date.getMonth() + 1).padStart(2, '0');
const year = date.getFullYear();
const hours = String(date.getHours()).padStart(2, '0');
const minutes = String(date.getMinutes()).padStart(2, '0');
return `${day}/${month}/${year} ${hours}:${minutes}`;
} catch (error) {
return "Data inválida";
}
};
export default function PacientesPage() { export default function PacientesPage() {
const [searchTerm, setSearchTerm] = useState(""); const [searchTerm, setSearchTerm] = useState("");
const [convenioFilter, setConvenioFilter] = useState("all"); const [convenioFilter, setConvenioFilter] = useState("all");
const [vipFilter, setVipFilter] = useState("all"); const [vipFilter, setVipFilter] = useState("all");
const [patients, setPatients] = useState<any[]>([]); const [patients, setPatients] = useState<Patient[]>([]);
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const [error, setError] = useState<string | null>(null); const [error, setError] = useState<string | null>(null);
const [page, setPage] = useState(1); const [page, setPage] = useState(1);
@ -44,7 +100,8 @@ export default function PacientesPage() {
const [deleteDialogOpen, setDeleteDialogOpen] = useState(false); const [deleteDialogOpen, setDeleteDialogOpen] = useState(false);
const [patientToDelete, setPatientToDelete] = useState<string | null>(null); const [patientToDelete, setPatientToDelete] = useState<string | null>(null);
const [detailsDialogOpen, setDetailsDialogOpen] = useState(false); const [detailsDialogOpen, setDetailsDialogOpen] = useState(false);
const [patientDetails, setPatientDetails] = useState<any | null>(null); const [patientDetails, setPatientDetails] = useState<Patient | { error: string } | null>(null);
const openDetailsDialog = async (patientId: string) => { const openDetailsDialog = async (patientId: string) => {
setDetailsDialogOpen(true); setDetailsDialogOpen(true);
setPatientDetails(null); setPatientDetails(null);
@ -63,7 +120,7 @@ export default function PacientesPage() {
setError(null); setError(null);
try { try {
const res = await patientsService.list(); const res = await patientsService.list();
const mapped = res.map((p: any) => ({ const mapped: Patient[] = res.map((p: any) => ({
id: String(p.id ?? ""), id: String(p.id ?? ""),
nome: p.full_name ?? "", nome: p.full_name ?? "",
telefone: p.phone_mobile ?? p.phone1 ?? "", telefone: p.phone_mobile ?? p.phone1 ?? "",
@ -72,20 +129,22 @@ export default function PacientesPage() {
ultimoAtendimento: p.last_visit_at ?? "", ultimoAtendimento: p.last_visit_at ?? "",
proximoAtendimento: p.next_appointment_at ?? "", proximoAtendimento: p.next_appointment_at ?? "",
vip: Boolean(p.vip ?? false), vip: Boolean(p.vip ?? false),
convenio: p.convenio ?? "", // se não existir, fica vazio convenio: p.convenio ?? "",
status: p.status ?? undefined, status: p.status ?? undefined,
})); }));
setPatients((prev) => { setPatients((prev) => {
const all = [...prev, ...mapped]; const all = [...prev, ...mapped];
const unique = Array.from( const unique = Array.from(new Map(all.map((p) => [p.id, p])).values());
new Map(all.map((p) => [p.id, p])).values()
);
return unique; return unique;
}); });
if (!mapped.id) setHasNext(false); // parar carregamento if (mapped.length === 0) {
else setPage((prev) => prev + 1); setHasNext(false);
} else {
setPage((prev) => prev + 1);
}
} catch (e: any) { } catch (e: any) {
setError(e?.message || "Erro ao buscar pacientes"); setError(e?.message || "Erro ao buscar pacientes");
} finally { } finally {
@ -96,7 +155,7 @@ export default function PacientesPage() {
); );
useEffect(() => { useEffect(() => {
fetchPacientes(page); fetchPacientes(1);
// eslint-disable-next-line react-hooks/exhaustive-deps // eslint-disable-next-line react-hooks/exhaustive-deps
}, []); }, []);
@ -109,24 +168,19 @@ export default function PacientesPage() {
}); });
observer.observe(observerRef.current); observer.observe(observerRef.current);
return () => { return () => {
if (observerRef.current) observer.unobserve(observerRef.current); if (observerRef.current) {
observer.unobserve(observerRef.current);
}
}; };
}, [fetchPacientes, page, hasNext, isFetching]); }, [fetchPacientes, page, hasNext, isFetching]);
const handleDeletePatient = async (patientId: string) => { const handleDeletePatient = async (patientId: string) => {
// Remove from current list (client-side deletion)
try { try {
const res = await patientsService.delete(patientId); await patientsService.delete(patientId);
setPatients((prev) => prev.filter((p) => p.id !== patientId));
if (res) {
alert(`${res.error} ${res.message}`);
}
setPatients((prev) =>
prev.filter((p) => String(p.id) !== String(patientId))
);
} catch (e: any) { } catch (e: any) {
setError(e?.message || "Erro ao deletar paciente"); setError(e?.message || "Erro ao deletar paciente");
alert("Erro ao deletar paciente.");
} }
setDeleteDialogOpen(false); setDeleteDialogOpen(false);
setPatientToDelete(null); setPatientToDelete(null);
@ -156,12 +210,8 @@ export default function PacientesPage() {
<div className="space-y-6"> <div className="space-y-6">
<div className="flex flex-col md:flex-row md:items-center md:justify-between gap-4"> <div className="flex flex-col md:flex-row md:items-center md:justify-between gap-4">
<div> <div>
<h1 className="text-xl md:text-2xl font-bold text-foreground"> <h1 className="text-xl md:text-2xl font-bold text-foreground">Pacientes</h1>
Pacientes <p className="text-muted-foreground text-sm md:text-base">Gerencie as informações de seus pacientes</p>
</h1>
<p className="text-muted-foreground text-sm md:text-base">
Gerencie as informações de seus pacientes
</p>
</div> </div>
<div className="flex gap-2"> <div className="flex gap-2">
<Link href="/secretary/pacientes/novo"> <Link href="/secretary/pacientes/novo">
@ -174,11 +224,8 @@ export default function PacientesPage() {
</div> </div>
<div className="flex flex-col md:flex-row flex-wrap gap-4 bg-card p-4 rounded-lg border border-border"> <div className="flex flex-col md:flex-row flex-wrap gap-4 bg-card p-4 rounded-lg border border-border">
{/* Convênio */}
<div className="flex items-center gap-2 w-full md:w-auto"> <div className="flex items-center gap-2 w-full md:w-auto">
<span className="text-sm font-medium text-foreground"> <span className="text-sm font-medium text-foreground">Convênio</span>
Convênio
</span>
<Select value={convenioFilter} onValueChange={setConvenioFilter}> <Select value={convenioFilter} onValueChange={setConvenioFilter}>
<SelectTrigger className="w-full md:w-40"> <SelectTrigger className="w-full md:w-40">
<SelectValue placeholder="Selecione o Convênio" /> <SelectValue placeholder="Selecione o Convênio" />
@ -191,7 +238,6 @@ export default function PacientesPage() {
</SelectContent> </SelectContent>
</Select> </Select>
</div> </div>
<div className="flex items-center gap-2 w-full md:w-auto"> <div className="flex items-center gap-2 w-full md:w-auto">
<span className="text-sm font-medium text-foreground">VIP</span> <span className="text-sm font-medium text-foreground">VIP</span>
<Select value={vipFilter} onValueChange={setVipFilter}> <Select value={vipFilter} onValueChange={setVipFilter}>
@ -206,9 +252,7 @@ export default function PacientesPage() {
</Select> </Select>
</div> </div>
<div className="flex items-center gap-2 w-full md:w-auto"> <div className="flex items-center gap-2 w-full md:w-auto">
<span className="text-sm font-medium text-foreground"> <span className="text-sm font-medium text-foreground">Aniversariantes</span>
Aniversariantes
</span>
<Select> <Select>
<SelectTrigger className="w-full md:w-32"> <SelectTrigger className="w-full md:w-32">
<SelectValue placeholder="Selecione" /> <SelectValue placeholder="Selecione" />
@ -220,7 +264,6 @@ export default function PacientesPage() {
</SelectContent> </SelectContent>
</Select> </Select>
</div> </div>
<Button variant="outline" className="ml-auto w-full md:w-auto"> <Button variant="outline" className="ml-auto w-full md:w-auto">
<Filter className="w-4 h-4 mr-2" /> <Filter className="w-4 h-4 mr-2" />
Filtro avançado Filtro avançado
@ -229,91 +272,54 @@ export default function PacientesPage() {
<div className="bg-white rounded-lg border border-gray-200"> <div className="bg-white rounded-lg border border-gray-200">
<div className="overflow-x-auto"> <div className="overflow-x-auto">
{error ? ( {error && <div className="p-6 text-red-600">{`Erro ao carregar pacientes: ${error}`}</div>}
<div className="p-6 text-red-600">{`Erro ao carregar pacientes: ${error}`}</div>
) : (
<table className="w-full min-w-[600px]"> <table className="w-full min-w-[600px]">
<thead className="bg-gray-50 border-b border-gray-200"> <thead className="bg-gray-50 border-b border-gray-200">
<tr> <tr>
<th className="text-left p-2 md:p-4 font-medium text-gray-700"> <th className="text-left p-2 md:p-4 font-medium text-gray-700">Nome</th>
Nome <th className="text-left p-2 md:p-4 font-medium text-gray-700">Telefone</th>
</th> <th className="text-left p-2 md:p-4 font-medium text-gray-700">Cidade</th>
<th className="text-left p-2 md:p-4 font-medium text-gray-700"> <th className="text-left p-2 md:p-4 font-medium text-gray-700">Estado</th>
Telefone <th className="text-left p-2 md:p-4 font-medium text-gray-700">Último atendimento</th>
</th> <th className="text-left p-2 md:p-4 font-medium text-gray-700">Próximo atendimento</th>
<th className="text-left p-2 md:p-4 font-medium text-gray-700"> <th className="text-left p-2 md:p-4 font-medium text-gray-700">Ações</th>
Cidade
</th>
<th className="text-left p-2 md:p-4 font-medium text-gray-700">
Estado
</th>
<th className="text-left p-2 md:p-4 font-medium text-gray-700">
Último atendimento
</th>
<th className="text-left p-2 md:p-4 font-medium text-gray-700">
Próximo atendimento
</th>
<th className="text-left p-2 md:p-4 font-medium text-gray-700">
Ações
</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{filteredPatients.length === 0 ? ( {filteredPatients.length === 0 && !isFetching ? (
<tr> <tr>
<td colSpan={7} className="p-8 text-center text-gray-500"> <td colSpan={7} className="p-8 text-center text-gray-500">
{patients.length === 0 {patients.length === 0 ? "Nenhum paciente cadastrado" : "Nenhum paciente encontrado com os filtros aplicados"}
? "Nenhum paciente cadastrado"
: "Nenhum paciente encontrado com os filtros aplicados"}
</td> </td>
</tr> </tr>
) : ( ) : (
filteredPatients.map((patient) => ( filteredPatients.map((patient) => (
<tr <tr key={patient.id} className="border-b border-gray-100 hover:bg-gray-50">
key={patient.id}
className="border-b border-gray-100 hover:bg-gray-50"
>
<td className="p-4"> <td className="p-4">
<div className="flex items-center gap-3"> <div className="flex items-center gap-3">
<div className="w-8 h-8 bg-gray-100 rounded-full flex items-center justify-center"> <div className="w-8 h-8 bg-gray-100 rounded-full flex items-center justify-center">
<span className="text-gray-600 font-medium text-sm"> <span className="text-gray-600 font-medium text-sm">{patient.nome?.charAt(0) || "?"}</span>
{patient.nome?.charAt(0) || "?"}
</span>
</div> </div>
<span className="font-medium text-gray-900"> <span className="font-medium text-gray-900">{patient.nome}</span>
{patient.nome}
</span>
</div> </div>
</td> </td>
<td className="p-4 text-gray-600"> <td className="p-4 text-gray-600">{patient.telefone}</td>
{patient.telefone}
</td>
<td className="p-4 text-gray-600">{patient.cidade}</td> <td className="p-4 text-gray-600">{patient.cidade}</td>
<td className="p-4 text-gray-600">{patient.estado}</td> <td className="p-4 text-gray-600">{patient.estado}</td>
<td className="p-4 text-gray-600"> <td className="p-4 text-gray-600">{formatDate(patient.ultimoAtendimento)}</td>
{patient.ultimoAtendimento} <td className="p-4 text-gray-600">{formatDate(patient.proximoAtendimento)}</td>
</td>
<td className="p-4 text-gray-600">
{patient.proximoAtendimento}
</td>
<td className="p-4"> <td className="p-4">
<DropdownMenu> <DropdownMenu>
<DropdownMenuTrigger asChild> <DropdownMenuTrigger asChild>
<div className="text-blue-600">Ações</div> <Button variant="ghost" className="text-blue-600 hover:bg-blue-50 hover:text-blue-700 h-8 px-2">Ações</Button>
</DropdownMenuTrigger> </DropdownMenuTrigger>
<DropdownMenuContent align="end"> <DropdownMenuContent align="end">
<DropdownMenuItem <DropdownMenuItem onClick={() => openDetailsDialog(patient.id)}>
onClick={() =>
openDetailsDialog(String(patient.id))
}
>
<Eye className="w-4 h-4 mr-2" /> <Eye className="w-4 h-4 mr-2" />
Ver detalhes Ver detalhes
</DropdownMenuItem> </DropdownMenuItem>
<DropdownMenuItem asChild> <DropdownMenuItem asChild>
<Link <Link href={`/secretary/pacientes/${patient.id}/editar`}>
href={`/secretary/pacientes/${patient.id}/editar`}
>
<Edit className="w-4 h-4 mr-2" /> <Edit className="w-4 h-4 mr-2" />
Editar Editar
</Link> </Link>
@ -322,12 +328,7 @@ export default function PacientesPage() {
<Calendar className="w-4 h-4 mr-2" /> <Calendar className="w-4 h-4 mr-2" />
Marcar consulta Marcar consulta
</DropdownMenuItem> </DropdownMenuItem>
<DropdownMenuItem <DropdownMenuItem className="text-red-600 focus:text-red-600" onClick={() => openDeleteDialog(patient.id)}>
className="text-red-600"
onClick={() =>
openDeleteDialog(String(patient.id))
}
>
<Trash2 className="w-4 h-4 mr-2" /> <Trash2 className="w-4 h-4 mr-2" />
Excluir Excluir
</DropdownMenuItem> </DropdownMenuItem>
@ -339,13 +340,8 @@ export default function PacientesPage() {
)} )}
</tbody> </tbody>
</table> </table>
)}
<div ref={observerRef} style={{ height: 1 }} /> <div ref={observerRef} style={{ height: 1 }} />
{isFetching && ( {isFetching && <div className="p-4 text-center text-gray-500">Carregando mais pacientes...</div>}
<div className="p-4 text-center text-gray-500">
Carregando mais pacientes...
</div>
)}
</div> </div>
</div> </div>
@ -353,108 +349,49 @@ export default function PacientesPage() {
<AlertDialogContent> <AlertDialogContent>
<AlertDialogHeader> <AlertDialogHeader>
<AlertDialogTitle>Confirmar exclusão</AlertDialogTitle> <AlertDialogTitle>Confirmar exclusão</AlertDialogTitle>
<AlertDialogDescription> <AlertDialogDescription>Tem certeza que deseja excluir este paciente? Esta ação não pode ser desfeita.</AlertDialogDescription>
Tem certeza que deseja excluir este paciente? Esta ação não pode
ser desfeita.
</AlertDialogDescription>
</AlertDialogHeader> </AlertDialogHeader>
<AlertDialogFooter> <AlertDialogFooter>
<AlertDialogCancel>Cancelar</AlertDialogCancel> <AlertDialogCancel>Cancelar</AlertDialogCancel>
<AlertDialogAction <AlertDialogAction onClick={() => patientToDelete && handleDeletePatient(patientToDelete)} className="bg-red-600 hover:bg-red-700">
onClick={() =>
patientToDelete && handleDeletePatient(patientToDelete)
}
className="bg-red-600 hover:bg-red-700"
>
Excluir Excluir
</AlertDialogAction> </AlertDialogAction>
</AlertDialogFooter> </AlertDialogFooter>
</AlertDialogContent> </AlertDialogContent>
</AlertDialog> </AlertDialog>
{/* Modal de detalhes do paciente */} <AlertDialog open={detailsDialogOpen} onOpenChange={setDetailsDialogOpen}>
<AlertDialog
open={detailsDialogOpen}
onOpenChange={setDetailsDialogOpen}
>
<AlertDialogContent> <AlertDialogContent>
<AlertDialogHeader> <AlertDialogHeader>
<AlertDialogTitle>Detalhes do Paciente</AlertDialogTitle> <AlertDialogTitle>Detalhes do Paciente</AlertDialogTitle>
<AlertDialogDescription>
{patientDetails === null ? ( {patientDetails === null ? (
<div className="text-gray-500">Carregando...</div> <div className="text-gray-500 text-center py-4">Carregando...</div>
) : patientDetails?.error ? ( ) : 'error' in patientDetails ? (
<div className="text-red-600">{patientDetails.error}</div> <div className="text-red-600 text-center py-4">{patientDetails.error}</div>
) : ( ) : (
<div className="space-y-2 text-left"> <AlertDialogDescription asChild>
<p> <div className="space-y-2 text-left max-h-[60vh] overflow-y-auto pr-2">
<strong>Nome:</strong> {patientDetails.full_name} <p><strong>Nome:</strong> {patientDetails.full_name}</p>
</p> <p><strong>CPF:</strong> {patientDetails.cpf || "-"}</p>
<p> <p><strong>Email:</strong> {patientDetails.email || "-"}</p>
<strong>CPF:</strong> {patientDetails.cpf} <p><strong>Telefone:</strong> {patientDetails.phone_mobile ?? patientDetails.phone1 ?? patientDetails.phone2 ?? "-"}</p>
</p> <p><strong>Nome social:</strong> {patientDetails.social_name ?? "-"}</p>
<p> <p><strong>Sexo:</strong> {patientDetails.sex ?? "-"}</p>
<strong>Email:</strong> {patientDetails.email} <p><strong>Tipo sanguíneo:</strong> {patientDetails.blood_type ?? "-"}</p>
</p> <p><strong>Peso:</strong> {patientDetails.weight_kg ? `${patientDetails.weight_kg}kg` : "-"}</p>
<p> <p><strong>Altura:</strong> {patientDetails.height_m ? `${patientDetails.height_m}m` : "-"}</p>
<strong>Telefone:</strong>{" "} <p><strong>IMC:</strong> {patientDetails.bmi ?? "-"}</p>
{patientDetails.phone_mobile ?? <p><strong>Endereço:</strong> {patientDetails.street ?? "-"}</p>
patientDetails.phone1 ?? <p><strong>Bairro:</strong> {patientDetails.neighborhood ?? "-"}</p>
patientDetails.phone2 ?? <p><strong>Cidade:</strong> {patientDetails.city ?? "-"}</p>
"-"} <p><strong>Estado:</strong> {patientDetails.state ?? "-"}</p>
</p> <p><strong>CEP:</strong> {patientDetails.cep ?? "-"}</p>
<p> <p><strong>Criado em:</strong> {formatDate(patientDetails.created_at)}</p>
<strong>Nome social:</strong>{" "} <p><strong>Atualizado em:</strong> {formatDate(patientDetails.updated_at)}</p>
{patientDetails.social_name ?? "-"} <p><strong>Id:</strong> {patientDetails.id ?? "-"}</p>
</p>
<p>
<strong>Sexo:</strong> {patientDetails.sex ?? "-"}
</p>
<p>
<strong>Tipo sanguíneo:</strong>{" "}
{patientDetails.blood_type ?? "-"}
</p>
<p>
<strong>Peso:</strong> {patientDetails.weight_kg ?? "-"}
{patientDetails.weight_kg ? "kg" : ""}
</p>
<p>
<strong>Altura:</strong> {patientDetails.height_m ?? "-"}
{patientDetails.height_m ? "m" : ""}
</p>
<p>
<strong>IMC:</strong> {patientDetails.bmi ?? "-"}
</p>
<p>
<strong>Endereço:</strong> {patientDetails.street ?? "-"}
</p>
<p>
<strong>Bairro:</strong>{" "}
{patientDetails.neighborhood ?? "-"}
</p>
<p>
<strong>Cidade:</strong> {patientDetails.city ?? "-"}
</p>
<p>
<strong>Estado:</strong> {patientDetails.state ?? "-"}
</p>
<p>
<strong>CEP:</strong> {patientDetails.cep ?? "-"}
</p>
<p>
<strong>Criado em:</strong>{" "}
{patientDetails.created_at ?? "-"}
</p>
<p>
<strong>Atualizado em:</strong>{" "}
{patientDetails.updated_at ?? "-"}
</p>
<p>
<strong>Id:</strong> {patientDetails.id ?? "-"}
</p>
</div> </div>
)}
</AlertDialogDescription> </AlertDialogDescription>
)}
</AlertDialogHeader> </AlertDialogHeader>
<AlertDialogFooter> <AlertDialogFooter>
<AlertDialogCancel>Fechar</AlertDialogCancel> <AlertDialogCancel>Fechar</AlertDialogCancel>