Atualizações 01-10-25

This commit is contained in:
Eduarda-SS 2025-10-01 16:14:34 -03:00
parent cf11b2aaf5
commit a0fababf69
11 changed files with 317 additions and 167 deletions

View File

@ -1,5 +1,3 @@
// src/App.js
//import PerfilSecretaria from "./perfis/perfil_secretaria/PerfilSecretaria";
import { BrowserRouter as Router, Routes, Route } from "react-router-dom";
import { useState } from "react";
@ -13,7 +11,6 @@ import LandingPage from './pages/LandingPage';
function App() {
// O estado controla qual view mostrar: false = Landing Page, true = Dashboard
const [isInternalView, setIsInternalView] = useState(false);
// const [isSecretaria, setIsSecretaria] = useState(false);
const handleEnterSystem = () => {
setIsInternalView(true);
@ -22,10 +19,6 @@ function App() {
const handleExitSystem = () => {
setIsInternalView(false);
};
// if (isSecretaria) {
// return <PerfilSecretaria onLogout={() => setIsSecretaria(false)} />;
// }
// Se não estiver na visualização interna, retorna a LandingPage.
if (!isInternalView) {

View File

@ -1,7 +1,7 @@
import React, { useEffect, useState } from "react";
import avatarPlaceholder from '../assets/images/avatar_placeholder.png';
const Details = ({ patientID, setCurrentPage }) => {
const Details = ({ patientID }) => {
const [paciente, setPaciente] = useState({});
const [anexos, setAnexos] = useState([]);
const [selectedFile, setSelectedFile] = useState(null);

View File

@ -1,7 +1,9 @@
import React, { useEffect, useState } from "react";
import avatarPlaceholder from '../assets/images/avatar_placeholder.png';
import { useNavigate } from "react-router-dom";
const Details = ({ patientID, setCurrentPage }) => {
const Details = ({ patientID }) => {
const navigate = useNavigate();
const [paciente, setPaciente] = useState({});
useEffect(() => {
@ -21,7 +23,7 @@ const Details = ({ patientID, setCurrentPage }) => {
<h3 className="mb-3 text-center">MediConnect</h3>
<hr />
<div className="d-flex justify-content-between align-items-center mb-3">
<button className="btn btn-success me-2" onClick={() => setCurrentPage("table")}>
<button className="btn btn-success me-2" onClick={() => navigate("/secretaria/pacientes")}>
<i className="bi bi-chevron-left"></i> Voltar
</button>
<div className="d-flex mb-3">
@ -33,7 +35,7 @@ const Details = ({ patientID, setCurrentPage }) => {
<p>{paciente.cpf || "CPF"}</p>
</div>
</div>
<button className="btn btn-light" onClick={() => setCurrentPage("edit-page-doctor")}>
<button className="btn btn-light" onClick={() => navigate(`/secretaria/medicos/${paciente.id}/edit`)}>
<i className="bi bi-pencil-square"></i> Editar
</button>
</div>

View File

@ -1,6 +1,8 @@
import React, { useState, useEffect } from "react";
import { useNavigate } from "react-router-dom";
function TableDoctor({ setCurrentPage, setPatientID }) {
function TableDoctor({ setPatientID }) {
const navigate = useNavigate();
const [medicos, setMedicos] = useState([]);
const [search, setSearch] = useState("");
const [filtroAniversariante, setFiltroAniversariante] = useState(false);
@ -70,7 +72,7 @@ function TableDoctor({ setCurrentPage, setPatientID }) {
<h4 className="card-title mb-0">Médicos Cadastrados</h4>
<button
className="btn btn-primary"
onClick={() => setCurrentPage("form-layout")}
onClick={() => navigate("/secretaria/medicos/cadastro")}
>
<i className="bi bi-plus-circle"></i> Adicionar Médico
</button>
@ -141,7 +143,7 @@ function TableDoctor({ setCurrentPage, setPatientID }) {
color: "#004085",
}}
onClick={() => {
setCurrentPage("details-page-paciente");
navigate(`/secretaria/medicos/${medico.id}`);
setPatientID(medico.id);
}}
>
@ -157,7 +159,7 @@ function TableDoctor({ setCurrentPage, setPatientID }) {
color: "#856404",
}}
onClick={() => {
setCurrentPage("edit-page-paciente");
navigate(`/secretaria/medicos/${medico.id}/edit`);
setPatientID(medico.id);
}}
>

View File

@ -1,11 +1,10 @@
import React from 'react'
import PatientForm from '../components/patients/PatientForm'
import {useEffect, useState} from 'react'
const EditPage = ( {id, setCurrentPage}) => {
import React from 'react';
import { useNavigate } from 'react-router-dom';
import PatientForm from '../components/patients/PatientForm';
import {useEffect, useState} from 'react';
function EditPage({id}) {
const navigate = useNavigate();
const [PatientToPUT, setPatientPUT] = useState({})
var requestOptions = {
@ -66,8 +65,7 @@ const HandlePutPatient = async () => {
<PatientForm
onSave={HandlePutPatient}
onCancel={() => {setCurrentPage('table')}}
setCurrentPage={setCurrentPage}
onCancel={() => {navigate('/secretaria/pacientes')}}
formData={PatientToPUT}
setFormData={setPatientPUT}
/>

View File

@ -1,56 +1,82 @@
import React from 'react';
import React, { useState } from 'react';
import { Link } from "react-router-dom";
function ForgotPassword() {
return (
<>
<div className="mt-3 card-position">
<div className="col-lg-5 col-12">
<div className="card shadow-sm d-flex justify-content-between align-items-center">
<div id="auth-left">
<div className="auth-logo">
<br />
<Link to="/">
<h1 className="mb-4 text-center">MediConnect</h1>
</Link>
</div>
<h3 className="auth-title">Esqueci minha senha</h3>
<p className="auth-subtitle mb-5">
Informe seu e-mail e enviaremos um link para redefinir sua senha.
</p>
<form action="index.html">
<div className="form-group position-relative has-icon-left mb-4">
<input
type="email"
className="form-control form-control-xl"
placeholder="E-mail"
/>
<div className="form-control-icon">
<i className="bi bi-envelope" />
</div>
const [email, setEmail] = useState("");
const [alert, setAlert] = useState("");
const handleChange = (e) => {
setEmail(e.target.value);
};
const handleSubmit = (e) => {
e.preventDefault();
if (email) {
// Simulate sending email
setAlert("E-mail de verificação enviado!");
// You can add your actual email logic here
} else {
setAlert("Preencha o campo de e-mail!");
}
};
return (
<>
<div className="mt-3 card-position">
<div className="col-lg-5 col-12">
<div className="card shadow-sm d-flex justify-content-between align-items-center">
<div id="auth-left">
<div className="auth-logo">
<br />
<Link to="/">
<h1 className="mb-4 text-center">MediConnect</h1>
</Link>
</div>
<button className="btn btn-primary btn-block btn-lg shadow-lg mt-5">
Enviar
</button>
</form>
<div className="text-center mt-5 text-lg fs-4">
<p className="text-gray-600">
Lembrou da sua senha?
<Link className="font-bold" to={'/login'}>
Entrar
</Link>
.
<h3 className="auth-title">Esqueci minha senha</h3>
<p className="auth-subtitle mb-5">
Informe seu e-mail e enviaremos um link para redefinir sua senha.
</p>
{alert && (
<div className="alert alert-info" role="alert">
{alert}
</div>
)}
<form onSubmit={handleSubmit}>
<div className="form-group position-relative has-icon-left mb-4">
<input
type="email"
className="form-control form-control-xl"
placeholder="E-mail"
value={email}
onChange={handleChange}
required
/>
<div className="form-control-icon">
<i className="bi bi-envelope" />
</div>
</div>
<button className="btn btn-primary btn-block btn-lg shadow-lg mt-5">
Enviar
</button>
</form>
<div className="text-center mt-5 text-lg fs-4">
<p className="text-gray-600">
Lembrou da sua senha?
<Link className="font-bold" to={'/login'}>
Entrar
</Link>
.
</p>
</div>
</div>
<div className="col-lg-7 d-none d-lg-block">
<div id="auth-right"></div>
</div>
</div>
<div className="col-lg-7 d-none d-lg-block">
<div id="auth-right"></div>
</div>
</div>
</div>
</div>
</>
);
</>
);
}
export default ForgotPassword;

View File

@ -1,8 +1,10 @@
import React, { useState, useEffect } from 'react';
import { useNavigate } from 'react-router-dom';
import { FaUser, FaUserPlus, FaCalendarAlt, FaCalendarCheck } from 'react-icons/fa';
import './style/Inicio.css';
function Inicio({ setCurrentPage }) {
function Inicio() {
const navigate = useNavigate();
const [pacientes, setPacientes] = useState([]);
const [agendamentos, setAgendamentos] = useState([]);
@ -87,21 +89,21 @@ function Inicio({ setCurrentPage }) {
<div className="quick-actions">
<h2>Ações Rápidas</h2>
<div className="actions-grid">
<div className="action-button" onClick={() => setCurrentPage('form-layout')}>
<div className="action-button" onClick={() => navigate('/secretaria/pacientes/cadastro')}>
<FaUserPlus className="action-icon" />
<div className="action-info">
<span className="action-title">Novo Paciente</span>
<span className="action-desc">Cadastrar um novo paciente</span>
</div>
</div>
<div className="action-button" onClick={() => setCurrentPage('table')}>
<div className="action-button" onClick={() => navigate('/secretaria/pacientes')}>
<FaUser className="action-icon" />
<div className="action-info">
<span className="action-title">Lista de Pacientes</span>
<span className="action-desc">Ver todos os pacientes</span>
</div>
</div>
<div className="action-button" onClick={() => setCurrentPage('agendamento')}>
<div className="action-button" onClick={() => navigate('/secretaria/agendamento')}>
<FaCalendarCheck className="action-icon" />
<div className="action-info">
<span className="action-title">Agendamentos</span>
@ -126,7 +128,7 @@ function Inicio({ setCurrentPage }) {
<div className="no-appointments-content">
<FaCalendarCheck className="no-appointments-icon" />
<p>Nenhum agendamento para hoje</p>
<button className="manage-button" onClick={() => setCurrentPage('agendamento')}>
<button className="manage-button" onClick={() => navigate('/secretaria/agendamento')}>
Gerenciar Agendamentos
</button>
</div>

View File

@ -1,13 +1,29 @@
import React from 'react';
import React, { useState } from 'react';
import { Link, useNavigate } from "react-router-dom";
function Login() {
const navigate = useNavigate();
const [form, setForm] = useState({
username: "",
password: ""
});
const [alert, setAlert] = useState("");
const [showPassword, setShowPassword] = useState(false);
const handleChange = (e) => {
setForm({ ...form, [e.target.name]: e.target.value });
};
const handleLogin = (e) => {
e.preventDefault();
// ...login logic...
navigate('/secretaria/inicio');
if (form.username && form.password) {
// ...login logic...
navigate('/secretaria/inicio');
} else {
setAlert("Preencha todos os campos!");
}
};
return (
<>
<div className="mt-3 card-position">
@ -24,12 +40,21 @@ function Login() {
<p className="auth-subtitle mb-5">
Entre com os dados que você inseriu durante o registro.
</p>
<form action="index.html">
{alert && (
<div className="alert alert-info" role="alert">
{alert}
</div>
)}
<form>
<div className="form-group position-relative has-icon-left mb-4">
<input
type="text"
name="username"
className="form-control form-control-xl"
placeholder="Username"
value={form.username}
onChange={handleChange}
required
/>
<div className="form-control-icon">
<i className="bi bi-person" />
@ -37,13 +62,26 @@ function Login() {
</div>
<div className="form-group position-relative has-icon-left mb-4">
<input
type="password"
type={showPassword ? "text" : "password"}
name="password"
className="form-control form-control-xl"
placeholder="Password"
value={form.password}
onChange={handleChange}
required
/>
<div className="form-control-icon">
<i className="bi bi-shield-lock" />
</div>
<button
type="button"
className="btn btn-sm"
style={{ position: "absolute", right: "10px", top: "10px", background: "none", border: "none" }}
onClick={() => setShowPassword(!showPassword)}
tabIndex={-1}
>
<i className={`bi ${showPassword ? "bi-eye-slash" : "bi-eye"}`}></i>
</button>
</div>
<div className="form-check form-check-lg d-flex align-items-end">
<input

View File

@ -1,10 +1,11 @@
import {useState} from 'react';
import React from 'react';
import { useNavigate } from 'react-router-dom';
import PatientForm from '../components/patients/PatientForm';
function PatientCadastroManager( {setCurrentPage} ) {
const [formData, setFormData] = useState({})
function PatientCadastroManager() {
const [formData, setFormData] = useState({});
const navigate = useNavigate();
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
@ -50,7 +51,7 @@ function PatientCadastroManager( {setCurrentPage} ) {
<PatientForm
onSave={handleSavePatient}
onCancel={() => {setCurrentPage('table')}}
onCancel={() => {navigate('/secretaria/pacientes')}}
formData={formData}
setFormData={setFormData}
/>

View File

@ -1,93 +1,182 @@
import React from 'react';
import React, { useState } from 'react';
import { Link, useNavigate } from "react-router-dom";
function Register() {
const navigate = useNavigate();
const [form, setForm] = useState({
email: "",
username: "",
userType: "",
password: "",
confirmPassword: ""
});
const [alert, setAlert] = useState("");
const [showPassword, setShowPassword] = useState(false);
const [showConfirmPassword, setShowConfirmPassword] = useState(false);
const handleChange = (e) => {
setForm({ ...form, [e.target.name]: e.target.value });
};
const handleLogin = (e) => {
e.preventDefault();
// ...login logic...
navigate('/secretaria/inicio');
if (
form.email &&
form.username &&
form.userType &&
form.password &&
form.confirmPassword
) {
if (form.password !== form.confirmPassword) {
setAlert("As senhas não coincidem!");
return;
}
// ...register logic...
navigate('/secretaria/inicio');
} else {
setAlert("Preencha todos os campos!");
}
};
return (
<>
<div className="mt-3 card-position">
<div className="col-lg-5 col-12">
<div className="card shadow-sm d-flex justify-content-between align-items-center">
<div id="auth-left">
<div className="auth-logo">
<br />
<Link to="/">
<h1 className="mb-4 text-center">MediConnect</h1>
</Link>
</div>
<h3 className="auth-title">Cadastre-se</h3>
<p className="auth-subtitle mb-5">
Insira seus dados para se registrar em nosso site.
</p>
<form action="index.html">
<div className="form-group position-relative has-icon-left mb-4">
<input
type="text"
className="form-control form-control-xl"
placeholder="E-mail"
/>
<div className="form-control-icon">
<i className="bi bi-envelope" />
</div>
return (
<>
<div className="mt-3 card-position">
<div className="col-lg-5 col-12">
<div className="card shadow-sm d-flex justify-content-between align-items-center">
<div id="auth-left">
<div className="auth-logo">
<br />
<Link to="/">
<h1 className="mb-4 text-center">MediConnect</h1>
</Link>
</div>
<div className="form-group position-relative has-icon-left mb-4">
<input
type="text"
className="form-control form-control-xl"
placeholder="Nome de usuário"
/>
<div className="form-control-icon">
<i className="bi bi-person" />
</div>
</div>
<div className="form-group position-relative has-icon-left mb-4">
<input
type="password"
className="form-control form-control-xl"
placeholder="Senha"
/>
<div className="form-control-icon">
<i className="bi bi-shield-lock" />
</div>
</div>
<div className="form-group position-relative has-icon-left mb-4">
<input
type="password"
className="form-control form-control-xl"
placeholder="Confirmar senha"
/>
<div className="form-control-icon">
<i className="bi bi-shield-lock" />
</div>
</div>
<button className="btn btn-primary btn-block btn-lg shadow-lg mt-5"
onClick={handleLogin}>
Cadastrar
</button>
</form>
<div className="text-center mt-5 text-lg fs-4">
<p className="text-gray-600">
tem uma conta?
<Link className="font-bold" to={'/login'}>
Entrar
</Link>
.
<h3 className="auth-title">Cadastre-se</h3>
<p className="auth-subtitle mb-5">
Insira seus dados para se registrar em nosso site.
</p>
{alert && (
<div className="alert alert-info" role="alert">
{alert}
</div>
)}
<form>
<div className="form-group position-relative has-icon-left mb-4">
<input
type="text"
name="email"
className="form-control form-control-xl"
placeholder="E-mail"
value={form.email}
onChange={handleChange}
required
/>
<div className="form-control-icon">
<i className="bi bi-envelope" />
</div>
</div>
<div className="form-group position-relative has-icon-left mb-4">
<input
type="text"
name="username"
className="form-control form-control-xl"
placeholder="Nome de usuário"
value={form.username}
onChange={handleChange}
required
/>
<div className="form-control-icon">
<i className="bi bi-person" />
</div>
</div>
<div className="form-group position-relative has-icon-left mb-4">
<select
name="userType"
className="form-control form-control-xl"
value={form.userType}
onChange={handleChange}
required
>
<option value="" disabled>
Selecione o tipo de usuário
</option>
<option value="paciente">Paciente</option>
<option value="secretaria">Secretaria</option>
<option value="medico">Médico</option>
<option value="admin">Admin</option>
</select>
<div className="form-control-icon">
<i className="bi bi-person" />
</div>
</div>
<div className="form-group position-relative has-icon-left mb-4">
<input
type={showPassword ? "text" : "password"}
name="password"
className="form-control form-control-xl"
placeholder="Senha"
value={form.password}
onChange={handleChange}
required
/>
<div className="form-control-icon">
<i className="bi bi-shield-lock" />
</div>
<button
type="button"
className="btn btn-sm"
style={{ position: "absolute", right: "10px", top: "10px", background: "none", border: "none" }}
onClick={() => setShowPassword(!showPassword)}
tabIndex={-1}
>
<i className={`bi ${showPassword ? "bi-eye-slash" : "bi-eye"}`}></i>
</button>
</div>
<div className="form-group position-relative has-icon-left mb-4">
<input
type={showConfirmPassword ? "text" : "password"}
name="confirmPassword"
className="form-control form-control-xl"
placeholder="Confirmar senha"
value={form.confirmPassword}
onChange={handleChange}
required
/>
<div className="form-control-icon">
<i className="bi bi-shield-lock" />
</div>
<button
type="button"
className="btn btn-sm"
style={{ position: "absolute", right: "10px", top: "10px", background: "none", border: "none" }}
onClick={() => setShowConfirmPassword(!showConfirmPassword)}
tabIndex={-1}
>
<i className={`bi ${showConfirmPassword ? "bi-eye-slash" : "bi-eye"}`}></i>
</button>
</div>
<button className="btn btn-primary btn-block btn-lg shadow-lg mt-5"
onClick={handleLogin}>
Cadastrar
</button>
</form>
<div className="text-center mt-5 text-lg fs-4">
<p className="text-gray-600">
tem uma conta?
<Link className="font-bold" to={'/login'}>
Entrar
</Link>
.
</p>
</div>
</div>
<div className="col-lg-7 d-none d-lg-block">
<div id="auth-right"></div>
</div>
</div>
<div className="col-lg-7 d-none d-lg-block">
<div id="auth-right"></div>
</div>
</div>
</div>
</div>
</>
);
</>
);
}
export default Register;

View File

@ -1,7 +1,8 @@
import React, { useState, useEffect } from "react";
import { Link } from "react-router-dom";
import { Link, useNavigate } from "react-router-dom";
function TablePaciente({ setCurrentPage, setPatientID }) {
function TablePaciente({ setPatientID }) {
const navigate = useNavigate();
const [pacientes, setPacientes] = useState([]);
const [search, setSearch] = useState("");
const [filtroConvenio, setFiltroConvenio] = useState("Todos");
@ -128,10 +129,9 @@ function TablePaciente({ setCurrentPage, setPatientID }) {
<div className="card">
<div className="card-header d-flex justify-content-between align-items-center">
<h4 className="card-title mb-0">Pacientes Cadastrados</h4>
<Link to={'/pacientes/cadastro'}>
<Link to={'/secretaria/pacientes/cadastro'}>
<button
className="btn btn-primary"
>
<i className="bi bi-plus-circle"></i> Adicionar Paciente
</button>
@ -245,13 +245,12 @@ function TablePaciente({ setCurrentPage, setPatientID }) {
color: "#004085",
}}
onClick={() => {
setCurrentPage("details-page-paciente");
navigate(`/secretaria/pacientes/${paciente.id}`);
setPatientID(paciente.id);
}}
>
<i className="bi bi-eye me-1"></i> Ver Detalhes
</button>
<button
className="btn btn-sm"
style={{
@ -259,7 +258,7 @@ function TablePaciente({ setCurrentPage, setPatientID }) {
color: "#856404",
}}
onClick={() => {
setCurrentPage("edit-page-paciente");
navigate(`/secretaria/pacientes/${paciente.id}/edit`);
setPatientID(paciente.id);
}}
>