diff --git a/app/cadastro/page.tsx b/app/cadastro/page.tsx index 34a0c94..7b6fb88 100644 --- a/app/cadastro/page.tsx +++ b/app/cadastro/page.tsx @@ -10,7 +10,7 @@ export default function HomePage() {

Central de Operações

- MidConnecta + MedConnect

diff --git a/app/page.tsx b/app/page.tsx index bd23264..75cbf28 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -10,12 +10,12 @@ export default function InicialPage() { {}

Horário: 08h00 - 21h00 - Email: contato@midconnecta.com + Email: contato@medconnect.com
{}
-

MidConnecta

+

MedConnect

); diff --git a/app/secretary/pacientes/page.tsx b/app/secretary/pacientes/page.tsx index 4df1802..1872f1b 100644 --- a/app/secretary/pacientes/page.tsx +++ b/app/secretary/pacientes/page.tsx @@ -8,7 +8,7 @@ import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@ import { Plus, Edit, Trash2, Eye, Calendar, Filter } from "lucide-react"; import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle } from "@/components/ui/alert-dialog"; import SecretaryLayout from "@/components/secretary-layout"; -import { patientsService } from "@/services/patientsApi.mjs" +import { patientsService } from "@/services/patientsApi.mjs"; export default function PacientesPage() { const [searchTerm, setSearchTerm] = useState(""); @@ -30,12 +30,12 @@ export default function PacientesPage() { setPatientDetails(null); try { const res = await patientsService.getById(patientId); - setPatientDetails(res[0]); + setPatientDetails(res[0]); } catch (e: any) { setPatientDetails({ error: e?.message || "Erro ao buscar detalhes" }); } }; - + const fetchPacientes = useCallback( async (pageToFetch: number) => { if (isFetching || !hasNext) return; @@ -44,26 +44,26 @@ export default function PacientesPage() { try { const res = await patientsService.list(); const mapped = res.map((p: any) => ({ - id: String(p.id ?? ""), - nome: p.full_name ?? "", - telefone: p.phone_mobile ?? p.phone1 ?? "", - cidade: p.city ?? "", - estado: p.state ?? "", - ultimoAtendimento: p.last_visit_at ?? "", - proximoAtendimento: p.next_appointment_at ?? "", - vip: Boolean(p.vip ?? false), - convenio: p.convenio ?? "", // se não existir, fica vazio - status: p.status ?? undefined, - })); + id: String(p.id ?? ""), + nome: p.full_name ?? "", + telefone: p.phone_mobile ?? p.phone1 ?? "", + cidade: p.city ?? "", + estado: p.state ?? "", + ultimoAtendimento: p.last_visit_at ?? "", + proximoAtendimento: p.next_appointment_at ?? "", + vip: Boolean(p.vip ?? false), + convenio: p.convenio ?? "", // se não existir, fica vazio + status: p.status ?? undefined, + })); setPatients((prev) => { const all = [...prev, ...mapped]; - const unique = Array.from(new Map(all.map(p => [p.id, p])).values()); + const unique = Array.from(new Map(all.map((p) => [p.id, p])).values()); return unique; }); - if (mapped.length === 0) setHasNext(false); // parar carregamento - else setPage(prev => prev + 1); + if (!mapped.id) setHasNext(false); // parar carregamento + else setPage((prev) => prev + 1); } catch (e: any) { setError(e?.message || "Erro ao buscar pacientes"); } finally { @@ -93,16 +93,14 @@ export default function PacientesPage() { const handleDeletePatient = async (patientId: string) => { // Remove from current list (client-side deletion) - try{ + try { const res = await patientsService.delete(patientId); - - if(res){ - alert(`${res.error} ${res.message}`) - } - - setPatients((prev) => prev.filter((p) => String(p.id) !== String(patientId))); - + if (res) { + alert(`${res.error} ${res.message}`); + } + + setPatients((prev) => prev.filter((p) => String(p.id) !== String(patientId))); } catch (e: any) { setError(e?.message || "Erro ao deletar paciente"); } @@ -127,62 +125,62 @@ export default function PacientesPage() {
-
-

Pacientes

-

Gerencie as informações de seus pacientes

-
-
- - - -
-
+
+

Pacientes

+

Gerencie as informações de seus pacientes

+
+
+ + + +
+
-
- {/* Convênio */} -
- Convênio - -
- -
- VIP - -
-
- Aniversariantes - +
+ {/* Convênio */} +
+ Convênio + +
+ +
+ VIP + +
+
+ Aniversariantes +
@@ -213,28 +211,27 @@ export default function PacientesPage() {
- - +
-
+
{error ? (
{`Erro ao carregar pacientes: ${error}`}
) : ( - +
- - - - - - - + + + + + + + @@ -325,24 +322,62 @@ export default function PacientesPage() {
{patientDetails.error}
) : (
-

Nome: {patientDetails.full_name}

-

CPF: {patientDetails.cpf}

-

Email: {patientDetails.email}

-

Telefone: {patientDetails.phone_mobile ?? patientDetails.phone1 ?? patientDetails.phone2 ?? "-"}

-

Nome social: {patientDetails.social_name ?? "-"}

-

Sexo: {patientDetails.sex ?? "-"}

-

Tipo sanguíneo: {patientDetails.blood_type ?? "-"}

-

Peso: {patientDetails.weight_kg ?? "-"}{patientDetails.weight_kg ? "kg": ""}

-

Altura: {patientDetails.height_m ?? "-"}{patientDetails.height_m ? "m": ""}

-

IMC: {patientDetails.bmi ?? "-"}

-

Endereço: {patientDetails.street ?? "-"}

-

Bairro: {patientDetails.neighborhood ?? "-"}

-

Cidade: {patientDetails.city ?? "-"}

-

Estado: {patientDetails.state ?? "-"}

-

CEP: {patientDetails.cep ?? "-"}

-

Criado em: {patientDetails.created_at ?? "-"}

-

Atualizado em: {patientDetails.updated_at ?? "-"}

-

Id: {patientDetails.id ?? "-"}

+

+ Nome: {patientDetails.full_name} +

+

+ CPF: {patientDetails.cpf} +

+

+ Email: {patientDetails.email} +

+

+ Telefone: {patientDetails.phone_mobile ?? patientDetails.phone1 ?? patientDetails.phone2 ?? "-"} +

+

+ Nome social: {patientDetails.social_name ?? "-"} +

+

+ Sexo: {patientDetails.sex ?? "-"} +

+

+ Tipo sanguíneo: {patientDetails.blood_type ?? "-"} +

+

+ Peso: {patientDetails.weight_kg ?? "-"} + {patientDetails.weight_kg ? "kg" : ""} +

+

+ Altura: {patientDetails.height_m ?? "-"} + {patientDetails.height_m ? "m" : ""} +

+

+ IMC: {patientDetails.bmi ?? "-"} +

+

+ Endereço: {patientDetails.street ?? "-"} +

+

+ Bairro: {patientDetails.neighborhood ?? "-"} +

+

+ Cidade: {patientDetails.city ?? "-"} +

+

+ Estado: {patientDetails.state ?? "-"} +

+

+ CEP: {patientDetails.cep ?? "-"} +

+

+ Criado em: {patientDetails.created_at ?? "-"} +

+

+ Atualizado em: {patientDetails.updated_at ?? "-"} +

+

+ Id: {patientDetails.id ?? "-"} +

)} diff --git a/components/doctor-layout.tsx b/components/doctor-layout.tsx index 5d929db..b8b2fc0 100644 --- a/components/doctor-layout.tsx +++ b/components/doctor-layout.tsx @@ -158,7 +158,7 @@ useEffect(() => {
- Hospital System + MedConnect )}
NomeTelefoneCidadeEstadoÚltimo atendimentoPróximo atendimentoAçõesNomeTelefoneCidadeEstadoÚltimo atendimentoPróximo atendimentoAções