+ {/* Header */}
+
+
+
+ Pacientes
+
+
+ Gerencie as informações de seus pacientes
+
+
+
- {/* Bloco de Filtros (Responsividade APLICADA) */}
- {/* Adicionado flex-wrap para permitir que os itens quebrem para a linha de baixo */}
+ {/* Filtros */}
- {/* Busca - Ocupa 100% no mobile, depois cresce */}
+ {/* Busca */}
setSearchTerm(e.target.value)}
- // w-full no mobile, depois flex-grow para ocupar o espaço disponível
className="w-full sm:flex-grow sm:max-w-[300px] p-2 border rounded-md text-sm"
/>
- {/* Convênio - Ocupa a largura total em telas pequenas, depois se ajusta */}
-
-
- Convênio
-
-
-
+ {/* Convênio */}
+
+
+ Convênio
+
+
+
- {/* VIP - Ocupa a largura total em telas pequenas, depois se ajusta */}
+ {/* VIP */}
VIP
-
+
+ {/* Seletor de Itens por Página (Inicia com 10) */}
+
+
+
- {/* --- SEÇÃO DE TABELA (VISÍVEL EM TELAS MAIORES OU IGUAIS A MD) --- */}
- {/* Garantir que a tabela se esconda em telas menores e apareça em MD+ */}
-
-
- {" "}
- {/* Permite rolagem horizontal se a tabela for muito larga */}
- {error ? (
-
{`Erro ao carregar pacientes: ${error}`}
- ) : loading ? (
-
- {" "}
- Carregando pacientes...
-
- ) : (
-
- {" "}
- {/* min-w para evitar que a tabela se contraia demais */}
-
-
- |
- Nome
- |
- {/* Ajustes de visibilidade de colunas para diferentes breakpoints */}
-
- Telefone
- |
-
- Cidade / Estado
- |
-
- Convênio
- |
-
- Último atendimento
- |
-
- Próximo atendimento
- |
-
- Ações
- |
-
-
-
- {currentPatients.length === 0 ? (
-
- |
- {allPatients.length === 0
- ? "Nenhum paciente cadastrado"
- : "Nenhum paciente encontrado com os filtros aplicados"}
- |
-
- ) : (
- currentPatients.map((patient) => (
-
-
-
-
-
- {patient.nome?.charAt(0) || "?"}
-
+ {/* Tabela */}
+
+
+ {error ? (
+ {`Erro ao carregar pacientes: ${error}`}
+ ) : loading ? (
+
+ {" "}
+ Carregando pacientes...
-
- {patient.nome}
- {patient.vip && (
-
- VIP
-
- )}
-
-
- |
-
- {patient.telefone}
- |
- {`${patient.cidade} / ${patient.estado}`} |
-
- {patient.convenio}
- |
-
- {patient.ultimoAtendimento}
- |
-
- {patient.proximoAtendimento}
- |
-
-
-
-
-
-
-
-
-
-
- openDetailsDialog(String(patient.id))
- }
- >
-
- Ver detalhes
-
-
-
-
- Editar
-
-
-
-
-
- Marcar consulta
-
-
- openDeleteDialog(String(patient.id))
- }
- >
-
- Excluir
-
-
-
- |
-
- ))
- )}
-
-
- )}
-
-
-
- {/* Paginação */}
- {totalPages > 1 && !loading && (
-
-
- {" "}
- {/* Adicionado flex-wrap e justify-center para botões da paginação */}
-
- {Array.from({ length: totalPages }, (_, index) => index + 1)
- .slice(Math.max(0, page - 3), Math.min(totalPages, page + 2))
- .map((pageNumber) => (
-
- ))}
-
-
-
- )}
-
- {/* AlertDialogs (Permanecem os mesmos) */}
-
-
-
- Confirmar exclusão
-
- Tem certeza que deseja excluir este paciente? Esta ação não pode
- ser desfeita.
-
-
-
- Cancelar
-
- patientToDelete && handleDeletePatient(patientToDelete)
- }
- className="bg-red-600 hover:bg-red-700"
- >
- Excluir
-
-
-
-
-
-
-
-
- Detalhes do Paciente
-
- {patientDetails === null ? (
-
-
- Carregando...
-
- ) : patientDetails?.error ? (
- {patientDetails.error}
- ) : (
-
-
-
-
Nome Completo
-
{patientDetails.full_name}
-
-
-
Email
-
{patientDetails.email}
-
-
-
Telefone
-
{patientDetails.phone_mobile}
-
-
-
Data de Nascimento
-
{patientDetails.birth_date}
-
-
-
CPF
-
{patientDetails.cpf}
-
-
-
Tipo Sanguíneo
-
{patientDetails.blood_type}
-
-
-
Peso (kg)
-
{patientDetails.weight_kg}
-
-
-
Altura (m)
-
{patientDetails.height_m}
-
+ ) : (
+
+
+
+ | Nome |
+ Telefone |
+ Cidade / Estado |
+ Convênio |
+ Último atendimento |
+ Próximo atendimento |
+ Ações |
+
+
+
+ {currentPatients.length === 0 ? (
+
+ |
+ {allPatients.length === 0
+ ? "Nenhum paciente cadastrado"
+ : "Nenhum paciente encontrado com os filtros aplicados"}
+ |
+
+ ) : (
+ currentPatients.map((patient) => (
+
+
+
+
+
+ {patient.nome?.charAt(0) || "?"}
+
+
+
+ {patient.nome}
+ {patient.vip && (
+
+ VIP
+
+ )}
+
+
+ |
+ {patient.telefone} |
+ {`${patient.cidade} / ${patient.estado}`} |
+ {patient.convenio} |
+ {patient.ultimoAtendimento} |
+ {patient.proximoAtendimento} |
+
+
+
+
+
+
+
+
+ openDetailsDialog(String(patient.id))}>
+
+ Ver detalhes
+
+
+
+
+ Editar
+
+
+
+
+ Marcar consulta
+
+ openDeleteDialog(String(patient.id))}>
+
+ Excluir
+
+
+
+ |
+
+ ))
+ )}
+
+
+ )}
-
-
Endereço
-
-
-
Rua
-
{`${patientDetails.street}, ${patientDetails.number}`}
+
+
+ {/* Paginação */}
+ {totalPages > 1 && !loading && (
+
+
+
+ {Array.from({ length: totalPages }, (_, index) => index + 1)
+ .slice(Math.max(0, page - 3), Math.min(totalPages, page + 2))
+ .map((pageNumber) => (
+
+ ))}
+
-
-
Complemento
-
{patientDetails.complement}
-
-
-
Bairro
-
{patientDetails.neighborhood}
-
-
-
Cidade
-
{patientDetails.cidade}
-
-
-
Estado
-
{patientDetails.estado}
-
-
-
CEP
-
{patientDetails.cep}
-
-
-
)}
-
-
-
- Fechar
-
-
-
-
-
- );
-}
+
+ {/* Dialog de Exclusão */}
+
+
+
+ Confirmar exclusão
+
+ Tem certeza que deseja excluir este paciente? Esta ação não pode ser desfeita.
+
+
+
+ Cancelar
+ patientToDelete && handleDeletePatient(patientToDelete)}
+ className="bg-red-600 hover:bg-red-700"
+ >
+ Excluir
+
+
+
+
+
+ {/* Dialog de Detalhes */}
+
+
+
+ Detalhes do Paciente
+
+ {patientDetails === null ? (
+
+
+ Carregando...
+
+ ) : patientDetails?.error ? (
+ {patientDetails.error}
+ ) : (
+
+
+
+
Nome Completo
+
{patientDetails.full_name}
+
+
+
Email
+
{patientDetails.email}
+
+
+
Telefone
+
{patientDetails.phone_mobile}
+
+
+
Data de Nascimento
+
{patientDetails.birth_date}
+
+
+
CPF
+
{patientDetails.cpf}
+
+
+
Tipo Sanguíneo
+
{patientDetails.blood_type}
+
+
+
Peso (kg)
+
{patientDetails.weight_kg}
+
+
+
Altura (m)
+
{patientDetails.height_m}
+
+
+
+
Endereço
+
+
+
Rua
+
{`${patientDetails.street}, ${patientDetails.number}`}
+
+
+
Complemento
+
{patientDetails.complement}
+
+
+
Bairro
+
{patientDetails.neighborhood}
+
+
+
Cidade
+
{patientDetails.cidade}
+
+
+
Estado
+
{patientDetails.estado}
+
+
+
CEP
+
{patientDetails.cep}
+
+
+
+
+ )}
+
+
+
+ Fechar
+
+
+
+
+