From 4a6afec4c13d6a73060055cf490420be63a4ab2e Mon Sep 17 00:00:00 2001 From: Henrique-Sousa <29417378+Henrique-Sousa@users.noreply.github.com> Date: Tue, 31 Mar 2026 10:36:39 -0300 Subject: [PATCH] feat: dashboard mostrando tabela com pacientes --- .../containers/DashboardContainer/index.jsx | 74 +++++++++++++++---- ui/src/index.jsx | 2 +- 2 files changed, 62 insertions(+), 14 deletions(-) diff --git a/ui/src/containers/DashboardContainer/index.jsx b/ui/src/containers/DashboardContainer/index.jsx index 2ea2054..9dfb76f 100644 --- a/ui/src/containers/DashboardContainer/index.jsx +++ b/ui/src/containers/DashboardContainer/index.jsx @@ -1,27 +1,75 @@ -import { useState, useEffect, useRef } from "react"; +import React, { useState, useEffect, useImperativeHandle } from "react"; -import MyButton from "../../components/MyButton"; +import { Table } from 'antd'; + +import _service from '@netuno/service-client'; import "./index.less"; -function DashboardContainer() { - const [counter, setCounter] = useState(0); +const columns = [ + { + title: 'UID', + dataIndex: 'uid', + key: 'uid', + }, + { + title: 'Nome', + dataIndex: 'nome', + key: 'nome', + }, + { + title: 'CPF', + dataIndex: 'CPF', + key: 'CPF', + }, + { + title: 'RG', + dataIndex: 'RG', + key: 'RG', + }, + { + title: 'Data de Nascimento', + dataIndex: 'data de nascimento', + key: 'data de nascimento', + }, + { + title: 'Endereço', + dataIndex: 'endereço', + key: 'endereço', + }, + { + title: 'Telefone', + dataIndex: 'telefone', + key: 'telefone', + } +]; - const refButton = useRef(); +function DashboardContainer() { + const [pacientes, setPacientes] = useState([]); useEffect(() => { - $(refButton.current).fadeOut(250).fadeIn(250); - }, [counter]); + carregarPacientes(); + }, []); - const onClick = () => { - setCounter(counter + 1); + const carregarPacientes = () => { + setPacientes([]); + _service({ + url: "/services/pacientes", + success: (response) => { + setPacientes(response.json); + }, + fail: (e) => { + console.error("Serviço de pacientes falhou.", e); + message.error("Serviço de pacientes falhou.", e); + } + }); }; return ( -
-
- -
+
+ + + ); } diff --git a/ui/src/index.jsx b/ui/src/index.jsx index a9ff568..287a7ec 100644 --- a/ui/src/index.jsx +++ b/ui/src/index.jsx @@ -27,7 +27,7 @@ if (dashboardContainer) { colorLink: '#5b5ce1', borderRadius: 5, }, - algorithm: theme.darkAlgorithm + //algorithm: theme.darkAlgorithm }} locale={ {