Browse Source

feat: dashboard mostrando tabela com pacientes

master
Henrique-Sousa 2 weeks ago
parent
commit
4a6afec4c1
2 changed files with 62 additions and 14 deletions
  1. +61
    -13
      ui/src/containers/DashboardContainer/index.jsx
  2. +1
    -1
      ui/src/index.jsx

+ 61
- 13
ui/src/containers/DashboardContainer/index.jsx View File

@ -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 (
<div className="my-dashboard">
<div ref={refButton} className="my-dashboard__button">
<MyButton text={`ReactJS ⚡ Ant.Design 👉 Click me! ${counter}`} onClick={onClick} />
</div>
<div>
<Table dataSource={pacientes} columns={columns} />
</div>
);
}


+ 1
- 1
ui/src/index.jsx View File

@ -27,7 +27,7 @@ if (dashboardContainer) {
colorLink: '#5b5ce1',
borderRadius: 5,
},
algorithm: theme.darkAlgorithm
//algorithm: theme.darkAlgorithm
}}
locale={
{


Loading…
Cancel
Save