diff --git a/src/App.js b/src/App.js index 98be1df..9998667 100644 --- a/src/App.js +++ b/src/App.js @@ -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 setIsSecretaria(false)} />; - // } // Se não estiver na visualização interna, retorna a LandingPage. if (!isInternalView) { diff --git a/src/pages/Details.jsx b/src/pages/Details.jsx index 1f6b317..ef12a20 100644 --- a/src/pages/Details.jsx +++ b/src/pages/Details.jsx @@ -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); diff --git a/src/pages/DoctorDetails.jsx b/src/pages/DoctorDetails.jsx index c8b7726..1f14aaa 100644 --- a/src/pages/DoctorDetails.jsx +++ b/src/pages/DoctorDetails.jsx @@ -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 }) => {

MediConnect


-
@@ -33,7 +35,7 @@ const Details = ({ patientID, setCurrentPage }) => {

{paciente.cpf || "CPF"}

- diff --git a/src/pages/DoctorTable.jsx b/src/pages/DoctorTable.jsx index 549c37e..1b07871 100644 --- a/src/pages/DoctorTable.jsx +++ b/src/pages/DoctorTable.jsx @@ -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 }) {

Médicos Cadastrados

@@ -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); }} > diff --git a/src/pages/EditPage.jsx b/src/pages/EditPage.jsx index 1b94620..7360f17 100644 --- a/src/pages/EditPage.jsx +++ b/src/pages/EditPage.jsx @@ -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 () => { {setCurrentPage('table')}} - setCurrentPage={setCurrentPage} + onCancel={() => {navigate('/secretaria/pacientes')}} formData={PatientToPUT} setFormData={setPatientPUT} /> diff --git a/src/pages/ForgotPassword.jsx b/src/pages/ForgotPassword.jsx index aef0050..787b474 100644 --- a/src/pages/ForgotPassword.jsx +++ b/src/pages/ForgotPassword.jsx @@ -1,56 +1,82 @@ -import React from 'react'; +import React, { useState } from 'react'; import { Link } from "react-router-dom"; function ForgotPassword() { -return ( - <> -
-
-
-
-
-
- -

MediConnect

- -
-

Esqueci minha senha

-

- Informe seu e-mail e enviaremos um link para redefinir sua senha. -

-
-
- -
- -
+ 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 ( + <> +
+
+
+
+
+
+ +

MediConnect

+
- - -
-

- Lembrou da sua senha? - - Entrar - - . +

Esqueci minha senha

+

+ Informe seu e-mail e enviaremos um link para redefinir sua senha.

+ {alert && ( +
+ {alert} +
+ )} +
+
+ +
+ +
+
+ + +
+

+ Lembrou da sua senha? + + Entrar + + . +

+
+
+
+
-
-
-
-
- - ); + + ); } export default ForgotPassword; \ No newline at end of file diff --git a/src/pages/Inicio.jsx b/src/pages/Inicio.jsx index dc47fae..e5988c2 100644 --- a/src/pages/Inicio.jsx +++ b/src/pages/Inicio.jsx @@ -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 }) {

Ações Rápidas

-
setCurrentPage('form-layout')}> +
navigate('/secretaria/pacientes/cadastro')}>
Novo Paciente Cadastrar um novo paciente
-
setCurrentPage('table')}> +
navigate('/secretaria/pacientes')}>
Lista de Pacientes Ver todos os pacientes
-
setCurrentPage('agendamento')}> +
navigate('/secretaria/agendamento')}>
Agendamentos @@ -126,7 +128,7 @@ function Inicio({ setCurrentPage }) {

Nenhum agendamento para hoje

-
diff --git a/src/pages/Login.jsx b/src/pages/Login.jsx index 9d31b70..86c5ffe 100644 --- a/src/pages/Login.jsx +++ b/src/pages/Login.jsx @@ -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 ( <>
@@ -24,12 +40,21 @@ function Login() {

Entre com os dados que você inseriu durante o registro.

-
+ {alert && ( +
+ {alert} +
+ )} +
@@ -37,13 +62,26 @@ function Login() {
+
{setCurrentPage('table')}} + onCancel={() => {navigate('/secretaria/pacientes')}} formData={formData} setFormData={setFormData} /> diff --git a/src/pages/Register.jsx b/src/pages/Register.jsx index 004cb99..b1a6c0f 100644 --- a/src/pages/Register.jsx +++ b/src/pages/Register.jsx @@ -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 ( - <> -
-
-
-
-
-
- -

MediConnect

- -
-

Cadastre-se

-

- Insira seus dados para se registrar em nosso site. -

- -
- -
- -
+ + return ( + <> +
+
+
+
+
+
+ +

MediConnect

+
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
- - -
-

- Já tem uma conta? - - Entrar - - . +

Cadastre-se

+

+ Insira seus dados para se registrar em nosso site.

+ {alert && ( +
+ {alert} +
+ )} +
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+ + +
+

+ Já tem uma conta? + + Entrar + + . +

+
+
+
+
-
-
-
-
- - ); + + ); } export default Register; \ No newline at end of file diff --git a/src/pages/TablePaciente.jsx b/src/pages/TablePaciente.jsx index ace6686..99352f6 100644 --- a/src/pages/TablePaciente.jsx +++ b/src/pages/TablePaciente.jsx @@ -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 }) {

Pacientes Cadastrados

- + @@ -245,13 +245,12 @@ function TablePaciente({ setCurrentPage, setPatientID }) { color: "#004085", }} onClick={() => { - setCurrentPage("details-page-paciente"); + navigate(`/secretaria/pacientes/${paciente.id}`); setPatientID(paciente.id); }} > Ver Detalhes -