Concerto das linkagens
This commit is contained in:
parent
086bf2b700
commit
0bf19ab6f2
@ -1,37 +1,11 @@
|
|||||||
import React, { useState, useEffect } from 'react';
|
import React, { useState } from 'react';
|
||||||
import { FaUser, FaUserPlus, FaCalendarAlt, FaCalendarCheck } from 'react-icons/fa';
|
import { FaUser, FaUserPlus, FaCalendarAlt, FaCalendarCheck } from 'react-icons/fa';
|
||||||
import './style/Inicio.css';
|
import './style/Inicio.css';
|
||||||
|
import { useNavigate } from 'react-router-dom';
|
||||||
function Inicio({ setCurrentPage }) {
|
function Inicio() {
|
||||||
const [pacientes, setPacientes] = useState([]);
|
const [pacientes, setPacientes] = useState([]);
|
||||||
const [agendamentos, setAgendamentos] = useState([]);
|
const [agendamentos, setAgendamentos] = useState([]);
|
||||||
|
const navigate = useNavigate();
|
||||||
useEffect(() => {
|
|
||||||
const fetchPacientes = async () => {
|
|
||||||
try {
|
|
||||||
const res = await fetch("https://mock.apidog.com/m1/1053378-0-default/pacientes");
|
|
||||||
const data = await res.json();
|
|
||||||
console.log(data)
|
|
||||||
//setPacientes(data.data);
|
|
||||||
} catch (error) {
|
|
||||||
console.error("Erro ao buscar pacientes:", error);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const fetchAgendamentos = async () => {
|
|
||||||
return; // <===serve para que nao cause erro
|
|
||||||
// try {
|
|
||||||
// const res = await fetch();
|
|
||||||
// const data = await res.json();
|
|
||||||
// setAgendamentos(data.data);
|
|
||||||
// } catch (error) {
|
|
||||||
// console.error("Erro ao buscar agendamentos:", error);
|
|
||||||
// }
|
|
||||||
};
|
|
||||||
|
|
||||||
fetchPacientes();
|
|
||||||
fetchAgendamentos();
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
const totalPacientes = pacientes.length;
|
const totalPacientes = pacientes.length;
|
||||||
const novosEsseMes = pacientes.filter(p => p.createdAt && new Date(p.createdAt).getMonth() === new Date().getMonth()).length;
|
const novosEsseMes = pacientes.filter(p => p.createdAt && new Date(p.createdAt).getMonth() === new Date().getMonth()).length;
|
||||||
@ -87,21 +61,21 @@ function Inicio({ setCurrentPage }) {
|
|||||||
<div className="quick-actions">
|
<div className="quick-actions">
|
||||||
<h2>Ações Rápidas</h2>
|
<h2>Ações Rápidas</h2>
|
||||||
<div className="actions-grid">
|
<div className="actions-grid">
|
||||||
<div className="action-button" onClick={() => setCurrentPage('form-layout')}>
|
<div className="action-button" onClick={() => navigate('/form-layout')}>
|
||||||
<FaUserPlus className="action-icon" />
|
<FaUserPlus className="action-icon" />
|
||||||
<div className="action-info">
|
<div className="action-info">
|
||||||
<span className="action-title">Novo Paciente</span>
|
<span className="action-title">Novo Pacient</span>
|
||||||
<span className="action-desc">Cadastrar um novo paciente</span>
|
<span className="action-desc">Cadastrar um novo paciente</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="action-button" onClick={() => setCurrentPage('table')}>
|
<div className="action-button" onClick={() => navigate('/table')}>
|
||||||
<FaUser className="action-icon" />
|
<FaUser className="action-icon" />
|
||||||
<div className="action-info">
|
<div className="action-info">
|
||||||
<span className="action-title">Lista de Pacientes</span>
|
<span className="action-title">Lista de Pacientes</span>
|
||||||
<span className="action-desc">Ver todos os pacientes</span>
|
<span className="action-desc">Ver todos os pacientes</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="action-button" onClick={() => setCurrentPage('agendamento')}>
|
<div className="action-button" onClick={() => navigate('agendamento')}>
|
||||||
<FaCalendarCheck className="action-icon" />
|
<FaCalendarCheck className="action-icon" />
|
||||||
<div className="action-info">
|
<div className="action-info">
|
||||||
<span className="action-title">Agendamentos</span>
|
<span className="action-title">Agendamentos</span>
|
||||||
@ -126,7 +100,7 @@ function Inicio({ setCurrentPage }) {
|
|||||||
<div className="no-appointments-content">
|
<div className="no-appointments-content">
|
||||||
<FaCalendarCheck className="no-appointments-icon" />
|
<FaCalendarCheck className="no-appointments-icon" />
|
||||||
<p>Nenhum agendamento para hoje</p>
|
<p>Nenhum agendamento para hoje</p>
|
||||||
<button className="manage-button" onClick={() => setCurrentPage('agendamento')}>
|
<button className="manage-button" onClick={() => navigate('/medico/agendamento')}>
|
||||||
Gerenciar Agendamentos
|
Gerenciar Agendamentos
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -281,20 +281,19 @@ function PatientForm({ onSave, onCancel, formData, setFormData }) {
|
|||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div className="col-md-12 mb-3 mt-3">
|
||||||
|
<div className="form-check">
|
||||||
|
<input className="form-check-input" type="checkbox" name="vip" checked={formData.vip} onChange={handleChange} id="vip" style={{ transform: 'scale(1.2)' }} />
|
||||||
|
<label className="form-check-label ms-2" htmlFor="vip" style={{ fontSize: '1.1rem' }}>
|
||||||
|
Paciente VIP
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
{/* CAMPOS MOVIDOS */}
|
|
||||||
<div className="col-md-12 mb-3 mt-3">
|
<div className="col-md-12 mb-3 mt-3">
|
||||||
<label style={{ fontSize: '1.1rem' }}>Observações:</label>
|
<label style={{ fontSize: '1.1rem' }}>Observações:</label>
|
||||||
<textarea className="form-control" name="notes" value={formData.notes} onChange={handleChange} style={{ fontSize: '1.1rem' }} placeholder='alergias, doenças crônicas, informações sobre porteses ou marca-passo, etc'></textarea>
|
<textarea className="form-control" name="notes" value={formData.notes} onChange={handleChange} style={{ fontSize: '1.1rem' }} placeholder='alergias, doenças crônicas, informações sobre porteses ou marca-passo, etc'></textarea>
|
||||||
</div>
|
</div>
|
||||||
<div className="col-md-12 mb-3">
|
|
||||||
<label style={{ fontSize: '1.1rem' }}>Anexos do Paciente:</label>
|
|
||||||
<div>
|
|
||||||
<label htmlFor="anexos-input" className="btn btn-secondary" style={{ fontSize: '1.1rem' }}>Escolher arquivo</label>
|
|
||||||
<input type="file" className="form-control d-none" name="anexos" id="anexos-input" onChange={handleChange} />
|
|
||||||
<span className="ms-2" style={{ fontSize: '1.1rem' }}>{formData.anexos ? formData.anexos.name : 'Nenhum arquivo escolhido'}</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -332,64 +331,8 @@ function PatientForm({ onSave, onCancel, formData, setFormData }) {
|
|||||||
<label style={{ fontSize: '1.1rem' }}>Altura (m):</label>
|
<label style={{ fontSize: '1.1rem' }}>Altura (m):</label>
|
||||||
<input type="text" step="0.01" className="form-control" name="height_m" value={formData.height_m} onChange={handleChange} style={{ fontSize: '1.1rem' }} />
|
<input type="text" step="0.01" className="form-control" name="height_m" value={formData.height_m} onChange={handleChange} style={{ fontSize: '1.1rem' }} />
|
||||||
</div>
|
</div>
|
||||||
<div className="col-md-2 mb-3">
|
|
||||||
<label style={{ fontSize: '1.1rem' }}>IMC (kg/m²):</label>
|
|
||||||
<input type="text" className="form-control" name="bmi" value={formData.bmi} readOnly disabled style={{ fontSize: '1.1rem' }} />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* INFORMAÇÕES DE CONVÊNIO */}
|
|
||||||
<div className="mb-5 p-4 border rounded shadow-sm">
|
|
||||||
<h4 className="mb-4 cursor-pointer d-flex justify-content-between align-items-center" onClick={() => handleToggleCollapse('infoConvenio')} style={{ fontSize: '1.8rem' }}>
|
|
||||||
Informações de convênio
|
|
||||||
<span className="fs-5">
|
|
||||||
{collapsedSections.infoConvenio ? '▲' : '▼'}
|
|
||||||
</span>
|
|
||||||
</h4>
|
|
||||||
<div className={`collapse${collapsedSections.infoConvenio ? ' show' : ''}`}>
|
|
||||||
<div className="row mt-3">
|
|
||||||
<div className="col-md-6 mb-3">
|
|
||||||
<label style={{ fontSize: '1.1rem' }}>Convênio:</label>
|
|
||||||
<select className="form-control" name="convenio" value={formData.convenio} onChange={handleChange} style={{ fontSize: '1.1rem' }}>
|
|
||||||
<option value="">Selecione</option>
|
|
||||||
<option value="Amil">Amil</option>
|
|
||||||
<option value="Bradesco Saúde">Bradesco Saúde</option>
|
|
||||||
<option value="SulAmérica">SulAmérica</option>
|
|
||||||
<option value="Unimed">Unimed</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div className="col-md-6 mb-3">
|
|
||||||
<label style={{ fontSize: '1.1rem' }}>Plano:</label>
|
|
||||||
<input type="text" className="form-control" name="plano" value={formData.plano} onChange={handleChange} style={{ fontSize: '1.1rem' }} />
|
|
||||||
</div>
|
|
||||||
<div className="col-md-6 mb-3">
|
|
||||||
<label style={{ fontSize: '1.1rem' }}>Nº de matrícula:</label>
|
|
||||||
<input type="text" className="form-control" name="numeroMatricula" value={formData.numeroMatricula} onChange={handleChange} style={{ fontSize: '1.1rem' }} />
|
|
||||||
</div>
|
|
||||||
<div className="col-md-4 mb-3">
|
|
||||||
<label style={{ fontSize: '1.1rem' }}>Validade da Carteira:</label>
|
|
||||||
<input type="date" className="form-control" name="validadeCarteira" value={formData.validadeCarteira} onChange={handleChange} disabled={formData.validadeIndeterminada} style={{ fontSize: '1.1rem' }} />
|
|
||||||
</div>
|
|
||||||
<div className="col-md-2 d-flex align-items-end mb-3">
|
|
||||||
<div className="form-check">
|
|
||||||
<input className="form-check-input" type="checkbox" name="validadeIndeterminada" checked={formData.validadeIndeterminada} onChange={handleChange} id="validadeIndeterminada" style={{ transform: 'scale(1.2)' }} />
|
|
||||||
<label className="form-check-label ms-2" htmlFor="validadeIndeterminada" style={{ fontSize: '1.1rem' }}>
|
|
||||||
Validade indeterminada
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{/* PACIENTE VIP */}
|
|
||||||
<div className="col-md-12 mb-3 mt-3">
|
|
||||||
<div className="form-check">
|
|
||||||
<input className="form-check-input" type="checkbox" name="vip" checked={formData.vip} onChange={handleChange} id="vip" style={{ transform: 'scale(1.2)' }} />
|
|
||||||
<label className="form-check-label ms-2" htmlFor="vip" style={{ fontSize: '1.1rem' }}>
|
|
||||||
Paciente VIP
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -3,12 +3,6 @@
|
|||||||
"name": "Menu",
|
"name": "Menu",
|
||||||
"isTitle": true
|
"isTitle": true
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
|
||||||
"name":"Início",
|
|
||||||
"url": "/admin/",
|
|
||||||
"icon": "house"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "Lista de Pacientes",
|
"name": "Lista de Pacientes",
|
||||||
"icon": "clipboard-heart-fill",
|
"icon": "clipboard-heart-fill",
|
||||||
@ -20,11 +14,6 @@
|
|||||||
"icon": "hospital-fill",
|
"icon": "hospital-fill",
|
||||||
"url": "/admin/medicos"
|
"url": "/admin/medicos"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "Agendar consulta",
|
|
||||||
"icon": "calendar-plus-fill",
|
|
||||||
"url": "/admin/agendamento"
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
{
|
||||||
"name": "Gestão de Usuários",
|
"name": "Gestão de Usuários",
|
||||||
|
|||||||
@ -3,25 +3,6 @@
|
|||||||
"name": "Menu-Financeiro",
|
"name": "Menu-Financeiro",
|
||||||
"isTitle": true
|
"isTitle": true
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
|
||||||
"name":"Início",
|
|
||||||
"url": "/financeiro/inicio",
|
|
||||||
"icon": "house"
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
"name": "Lista de Pacientes",
|
|
||||||
"icon": "clipboard-heart-fill",
|
|
||||||
"url": "/financeiro/pacientes"
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
"name": "Lista de Médico",
|
|
||||||
"icon": "hospital-fill",
|
|
||||||
"url": "/financeiro/medicos"
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
{
|
||||||
"name": "Controle Financeiro",
|
"name": "Controle Financeiro",
|
||||||
"icon": "cash-coin",
|
"icon": "cash-coin",
|
||||||
|
|||||||
@ -4,12 +4,6 @@
|
|||||||
"isTitle": true
|
"isTitle": true
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
|
||||||
"name":"Início",
|
|
||||||
"url": "/medico/",
|
|
||||||
"icon": "house"
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
{
|
||||||
"name": "Prontuário",
|
"name": "Prontuário",
|
||||||
"icon": "calendar-plus-fill",
|
"icon": "calendar-plus-fill",
|
||||||
|
|||||||
@ -1,22 +1,26 @@
|
|||||||
import React, { useEffect, useState } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
import avatarPlaceholder from '../assets/images/avatar_placeholder.png';
|
import avatarPlaceholder from '../assets/images/avatar_placeholder.png';
|
||||||
import { useParams } from "react-router-dom";
|
import { useParams, useNavigate, useLocation, Navigate } from "react-router-dom";
|
||||||
import API_KEY from "../components/utils/apiKeys";
|
import API_KEY from "../components/utils/apiKeys";
|
||||||
import {GetByID} from "../components/utils/Functions-Endpoints/Patient"
|
import {GetByID} from "../components/utils/Functions-Endpoints/Patient"
|
||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
import { useAuth } from "../components/utils/AuthProvider";
|
import { useAuth } from "../components/utils/AuthProvider";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const Details = () => {
|
const Details = () => {
|
||||||
const parametros = useParams();
|
const parametros = useParams();
|
||||||
const {getAuthorizationHeader, isAuthenticated} = useAuth();
|
const {getAuthorizationHeader, isAuthenticated} = useAuth();
|
||||||
const [paciente, setPaciente] = useState({});
|
const [paciente, setPaciente] = useState({});
|
||||||
const [anexos, setAnexos] = useState([]);
|
const [anexos, setAnexos] = useState([]);
|
||||||
const [selectedFile, setSelectedFile] = useState(null);
|
const [selectedFile, setSelectedFile] = useState(null);
|
||||||
|
const location = useLocation();
|
||||||
|
const navigate = useNavigate();
|
||||||
const patientID = parametros.id
|
const patientID = parametros.id
|
||||||
|
|
||||||
|
const Voltar = () => {
|
||||||
|
const prefixo = location.pathname.split("/")[1];
|
||||||
|
navigate(`/${prefixo}/pacientes`);
|
||||||
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!patientID) return;
|
if (!patientID) return;
|
||||||
@ -30,36 +34,8 @@ const Details = () => {
|
|||||||
})
|
})
|
||||||
.catch((err) => console.error("Erro ao buscar paciente:", err));
|
.catch((err) => console.error("Erro ao buscar paciente:", err));
|
||||||
|
|
||||||
/*fetch(`https://mock.apidog.com/m1/1053378-0-default/pacientes/${patientID}/anexos`)
|
|
||||||
.then(res => res.json())
|
|
||||||
.then(data => setAnexos(data.data || []))
|
|
||||||
.catch(err => console.error("Erro ao buscar anexos:", err));
|
|
||||||
*/
|
|
||||||
}, [patientID]);
|
}, [patientID]);
|
||||||
|
|
||||||
const handleUpload = async () => {
|
|
||||||
if (!selectedFile) return;
|
|
||||||
|
|
||||||
const formData = new FormData();
|
|
||||||
formData.append('file', selectedFile);
|
|
||||||
|
|
||||||
try {
|
|
||||||
const response = await fetch(`https://mock.apidog.com/m1/1053378-0-default/pacientes/${patientID}/anexos`, {
|
|
||||||
method: 'POST',
|
|
||||||
body: formData,
|
|
||||||
});
|
|
||||||
|
|
||||||
if (response.ok) {
|
|
||||||
const newAnexo = await response.json();
|
|
||||||
setAnexos(prev => [...prev, newAnexo]);
|
|
||||||
setSelectedFile(null);
|
|
||||||
} else {
|
|
||||||
console.error('Erro ao enviar anexo');
|
|
||||||
}
|
|
||||||
} catch (err) {
|
|
||||||
console.error('Erro ao enviar anexo:', err);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleDelete = async (anexoId) => {
|
const handleDelete = async (anexoId) => {
|
||||||
try {
|
try {
|
||||||
@ -89,11 +65,10 @@ const Details = () => {
|
|||||||
<h3 className="mb-3 text-center">MediConnect</h3>
|
<h3 className="mb-3 text-center">MediConnect</h3>
|
||||||
<hr />
|
<hr />
|
||||||
<div className="d-flex justify-content-between align-items-center mb-3">
|
<div className="d-flex justify-content-between align-items-center mb-3">
|
||||||
<Link to={'pacientes'}>
|
<button className="btn btn-success me-2" onClick={() => Voltar()}>
|
||||||
<button className="btn btn-success me-2" >
|
|
||||||
<i className="bi bi-chevron-left"></i> Voltar
|
<i className="bi bi-chevron-left"></i> Voltar
|
||||||
</button>
|
</button>
|
||||||
</Link>
|
|
||||||
|
|
||||||
<div className="d-flex mb-3">
|
<div className="d-flex mb-3">
|
||||||
<div className="avatar avatar-xl">
|
<div className="avatar avatar-xl">
|
||||||
@ -197,10 +172,7 @@ const Details = () => {
|
|||||||
<label className="font-extrabold">Estado civil:</label>
|
<label className="font-extrabold">Estado civil:</label>
|
||||||
<p>{paciente.marital_status || "-"}</p>
|
<p>{paciente.marital_status || "-"}</p>
|
||||||
</div>
|
</div>
|
||||||
<div className="col-md-6 mb-3">
|
|
||||||
<label className="font-extrabold">Nome do esposo(a):</label>
|
|
||||||
<p>{paciente.nome_conjuge || "-"}</p>
|
|
||||||
</div>
|
|
||||||
<div className="col-md-6 mb-3">
|
<div className="col-md-6 mb-3">
|
||||||
<label className="font-extrabold">Identificador de outro sistema:</label>
|
<label className="font-extrabold">Identificador de outro sistema:</label>
|
||||||
<p>{paciente.legacy_code || "-"}</p>
|
<p>{paciente.legacy_code || "-"}</p>
|
||||||
@ -210,28 +182,18 @@ const Details = () => {
|
|||||||
<input className="form-check-input" type="checkbox" checked={paciente.rn_in_insurance} disabled/>
|
<input className="form-check-input" type="checkbox" checked={paciente.rn_in_insurance} disabled/>
|
||||||
<label className="font-extrabold">RN na Guia do convênio:</label>
|
<label className="font-extrabold">RN na Guia do convênio:</label>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="col-md-2 d-flex align-items-end mb-3">
|
||||||
|
<div className="form-check">
|
||||||
|
<input className="form-check-input" type="checkbox" checked={paciente.vip} disabled/>
|
||||||
|
<label className="font-extrabold">Paciente VIP: </label>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="col-md-6 mb-3">
|
<div className="col-md-6 mb-3">
|
||||||
<label className="font-extrabold">Observações:</label>
|
<label className="font-extrabold">Observações:</label>
|
||||||
<p>{paciente.notes || "-"}</p>
|
<p>{paciente.notes || "-"}</p>
|
||||||
</div>
|
</div>
|
||||||
<div className="col-md-6 mb-3">
|
|
||||||
<label className="font-extrabold">Anexos do Paciente:</label>
|
|
||||||
{anexos.length > 0 ?(
|
|
||||||
<ul>
|
|
||||||
{anexos.map((anexo) => (
|
|
||||||
<li key={anexo.id} className="d-flex aling-items-center">
|
|
||||||
<a href={anexo.url} target="-blank" rel="noopener noreferrer">
|
|
||||||
{anexo.nome}
|
|
||||||
</a>
|
|
||||||
<button className="btn btn-danger btn-sm" onclick={() => handleDelete(anexo.id)} >Remover</button>
|
|
||||||
</li>
|
|
||||||
))}
|
|
||||||
</ul>
|
|
||||||
) : (
|
|
||||||
<p>-</p>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -260,42 +222,6 @@ const Details = () => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* ------------------ INFORMAÇÕES DE CONVÊNIO ------------------ */}
|
|
||||||
<div className="card p-3 shadow-sm">
|
|
||||||
<h5>Informações de Convênio</h5>
|
|
||||||
<hr />
|
|
||||||
<div className="row">
|
|
||||||
<div className="col-md-6 mb-3">
|
|
||||||
<label className="font-extrabold">Convênio:</label>
|
|
||||||
<p>{paciente.convenio || "-"}</p>
|
|
||||||
</div>
|
|
||||||
<div className="col-md-6 mb-3">
|
|
||||||
<label className="font-extrabold">Plano:</label>
|
|
||||||
<p>{paciente.plano || "-"}</p>
|
|
||||||
</div>
|
|
||||||
<div className="col-md-6 mb-3">
|
|
||||||
<label className="font-extrabold">Nº de matrícula:</label>
|
|
||||||
<p>{paciente.numeroMatricula || "-"}</p>
|
|
||||||
</div>
|
|
||||||
<div className="col-md-3 mb-3">
|
|
||||||
<label className="font-extrabold">Validade da Carteira:</label>
|
|
||||||
<p>{paciente.validadeCarteira || "-"}</p>
|
|
||||||
</div>
|
|
||||||
<div className="col-md-2 d-flex align-items-end mb-3">
|
|
||||||
<div className="form-check">
|
|
||||||
<input className="form-check-input" type="checkbox" checked={paciente.validadeIndeterminada} disabled/>
|
|
||||||
<label className="font-extrabold">Validade indeterminada:</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div className="col-md-2 d-flex align-items-end mb-3">
|
|
||||||
<div className="form-check">
|
|
||||||
<input className="form-check-input" type="checkbox" checked={paciente.vip} disabled/>
|
|
||||||
<label className="font-extrabold">Paciente VIP: </label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* ------------------ ENDEREÇO ------------------ */}
|
{/* ------------------ ENDEREÇO ------------------ */}
|
||||||
<div className="card p-3 shadow-sm">
|
<div className="card p-3 shadow-sm">
|
||||||
<h5>Endereço</h5>
|
<h5>Endereço</h5>
|
||||||
|
|||||||
@ -1,13 +1,20 @@
|
|||||||
import React, { useEffect, useState } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
import avatarPlaceholder from '../assets/images/avatar_placeholder.png';
|
import avatarPlaceholder from '../assets/images/avatar_placeholder.png';
|
||||||
import { useParams,Link } from "react-router-dom";
|
import { useParams,Link, useNavigate, useLocation } from "react-router-dom";
|
||||||
import { GetDoctorByID } from "../components/utils/Functions-Endpoints/Doctor";
|
import { GetDoctorByID } from "../components/utils/Functions-Endpoints/Doctor";
|
||||||
import { useAuth } from "../components/utils/AuthProvider";
|
import { useAuth } from "../components/utils/AuthProvider";
|
||||||
|
|
||||||
const Details = ({setCurrentPage }) => {
|
const Details = () => {
|
||||||
const {getAuthorizationHeader, isAuthenticated} = useAuth();
|
const {getAuthorizationHeader} = useAuth();
|
||||||
const [doctor, setDoctor] = useState({});
|
const [doctor, setDoctor] = useState({});
|
||||||
const Parametros = useParams()
|
const Parametros = useParams()
|
||||||
|
const navigate = useNavigate();
|
||||||
|
const location = useLocation();
|
||||||
|
|
||||||
|
const Voltar = () => {
|
||||||
|
const prefixo = location.pathname.split("/")[1];
|
||||||
|
navigate(`/${prefixo}/medicos`);
|
||||||
|
}
|
||||||
|
|
||||||
const doctorID = Parametros.id
|
const doctorID = Parametros.id
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -34,11 +41,10 @@ const Details = ({setCurrentPage }) => {
|
|||||||
<h3 className="mb-3 text-center">MediConnect</h3>
|
<h3 className="mb-3 text-center">MediConnect</h3>
|
||||||
<hr />
|
<hr />
|
||||||
<div className="d-flex justify-content-between align-items-center mb-3">
|
<div className="d-flex justify-content-between align-items-center mb-3">
|
||||||
<Link to={'/medicos'}>
|
<button className="btn btn-success me-2" onClick={() => Voltar()}>
|
||||||
<button className="btn btn-success me-2" >
|
|
||||||
<i className="bi bi-chevron-left"></i> Voltar
|
<i className="bi bi-chevron-left"></i> Voltar
|
||||||
</button>
|
</button>
|
||||||
</Link>
|
|
||||||
<div className="d-flex mb-3">
|
<div className="d-flex mb-3">
|
||||||
<div className="avatar avatar-xl">
|
<div className="avatar avatar-xl">
|
||||||
<img src={avatarPlaceholder} alt="" />
|
<img src={avatarPlaceholder} alt="" />
|
||||||
@ -48,7 +54,7 @@ const Details = ({setCurrentPage }) => {
|
|||||||
<p>{doctor.cpf || "CPF"}</p>
|
<p>{doctor.cpf || "CPF"}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<Link to={`/medicos/${doctor.id}/edit`}>
|
<Link to={`edit`}>
|
||||||
<button className="btn btn-light" onClick={() => {console.log(doctor.id)}} >
|
<button className="btn btn-light" onClick={() => {console.log(doctor.id)}} >
|
||||||
<i className="bi bi-pencil-square"></i> Editar
|
<i className="bi bi-pencil-square"></i> Editar
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@ -50,11 +50,6 @@ const authHeader = getAuthorizationHeader()
|
|||||||
try {
|
try {
|
||||||
const response = await fetch(`https://yuanqfswhberkoevtmfr.supabase.co/rest/v1/doctors?id=eq.${DoctorID}`,requestOptions);
|
const response = await fetch(`https://yuanqfswhberkoevtmfr.supabase.co/rest/v1/doctors?id=eq.${DoctorID}`,requestOptions);
|
||||||
|
|
||||||
// se o backend retorna JSON
|
|
||||||
const result = await response.json();
|
|
||||||
console.log("ATUALIZADO COM SUCESSO", result);
|
|
||||||
|
|
||||||
return result;
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Erro ao atualizar paciente:", error);
|
console.error("Erro ao atualizar paciente:", error);
|
||||||
throw error;
|
throw error;
|
||||||
|
|||||||
@ -53,11 +53,11 @@ const HandlePutPatient = async () => {
|
|||||||
try {
|
try {
|
||||||
const response = await fetch(`https://yuanqfswhberkoevtmfr.supabase.co/rest/v1/patients?id=eq.${PatientID}`,requestOptions);
|
const response = await fetch(`https://yuanqfswhberkoevtmfr.supabase.co/rest/v1/patients?id=eq.${PatientID}`,requestOptions);
|
||||||
|
|
||||||
// se o backend retorna JSON
|
|
||||||
console.log("Resposta do servidor:", response.ok);
|
|
||||||
if(response.ok === false){
|
if(response.ok === false){
|
||||||
const errorText = await response.text();
|
|
||||||
console.error("Erro ao atualizar paciente:", errorText);
|
console.error("Erro ao atualizar paciente:");
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
|
||||||
|
|||||||
@ -37,8 +37,6 @@ function PatientCadastroManager( {} ) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// 23505 - cpf duplicadoo
|
|
||||||
// 23514 - cpf invalido
|
|
||||||
try {
|
try {
|
||||||
const response = await fetch("https://yuanqfswhberkoevtmfr.supabase.co/rest/v1/patients", requestOptions);
|
const response = await fetch("https://yuanqfswhberkoevtmfr.supabase.co/rest/v1/patients", requestOptions);
|
||||||
console.log(response.ok, 'aqui')
|
console.log(response.ok, 'aqui')
|
||||||
@ -55,7 +53,7 @@ function PatientCadastroManager( {} ) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
console.log("ATUALIZADO COM SUCESSO");
|
console.log("Salvo com sucesso");
|
||||||
navigate('/pacientes')
|
navigate('/pacientes')
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@ -22,7 +22,7 @@ function Perfiladm() {
|
|||||||
<Sidebar menuItems={admItems} />
|
<Sidebar menuItems={admItems} />
|
||||||
<div id="main">
|
<div id="main">
|
||||||
<Routes>
|
<Routes>
|
||||||
<Route path="/" element={<Inicio />} />
|
<Route path="/" element={<UserDashboard />} />
|
||||||
<Route path="/pacientes/cadastro" element={<PatientCadastroManager />} />
|
<Route path="/pacientes/cadastro" element={<PatientCadastroManager />} />
|
||||||
<Route path="/medicos/cadastro" element={<DoctorCadastroManager />} />
|
<Route path="/medicos/cadastro" element={<DoctorCadastroManager />} />
|
||||||
<Route path="/pacientes" element={<TablePaciente />} />
|
<Route path="/pacientes" element={<TablePaciente />} />
|
||||||
@ -33,7 +33,7 @@ function Perfiladm() {
|
|||||||
<Route path="/medicos/:id/edit" element={<DoctorEditPage />} />
|
<Route path="/medicos/:id/edit" element={<DoctorEditPage />} />
|
||||||
<Route path="/agendamento" element={<Agendamento />} />
|
<Route path="/agendamento" element={<Agendamento />} />
|
||||||
<Route path="/laudo" element={<LaudoManager />} />
|
<Route path="/laudo" element={<LaudoManager />} />
|
||||||
<Route path="/laudo" element={<LaudoManager />} />
|
|
||||||
<Route path="/gestao" element={<UserDashboard />} />
|
<Route path="/gestao" element={<UserDashboard />} />
|
||||||
<Route path="/painel" element={<PainelAdministrativo />} />
|
<Route path="/painel" element={<PainelAdministrativo />} />
|
||||||
<Route path="*" element={<h2>Página não encontrada</h2>} />
|
<Route path="*" element={<h2>Página não encontrada</h2>} />
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
import { BrowserRouter as Router, Routes, Route } from "react-router-dom";
|
import { Routes, Route } from "react-router-dom";
|
||||||
import Sidebar from "../../components/Sidebar";
|
import Sidebar from "../../components/Sidebar";
|
||||||
|
|
||||||
import Inicio from "../../pages/Inicio";
|
|
||||||
import LaudoManager from "../../pages/LaudoManager";
|
import LaudoManager from "../../pages/LaudoManager";
|
||||||
import Prontuario from "../../PagesMedico/prontuario";
|
import Prontuario from "../../PagesMedico/prontuario";
|
||||||
import Relatorio from "../../PagesMedico/relatorio";
|
import Relatorio from "../../PagesMedico/relatorio";
|
||||||
@ -17,7 +16,7 @@ function PerfilMedico() {
|
|||||||
<Sidebar menuItems={DoctorItems} />
|
<Sidebar menuItems={DoctorItems} />
|
||||||
<div id="main">
|
<div id="main">
|
||||||
<Routes>
|
<Routes>
|
||||||
<Route path="/" element={<Inicio />} />
|
<Route path="/" element={<LaudoManager />} />
|
||||||
<Route path="/laudo" element={<LaudoManager />} />
|
<Route path="/laudo" element={<LaudoManager />} />
|
||||||
<Route path="/prontuario" element={<Prontuario />} />
|
<Route path="/prontuario" element={<Prontuario />} />
|
||||||
<Route path="/relatorios" element={<Relatorio />} />
|
<Route path="/relatorios" element={<Relatorio />} />
|
||||||
|
|||||||
@ -2,11 +2,8 @@ import { Routes, Route } from "react-router-dom";
|
|||||||
import Sidebar from "../../components/Sidebar";
|
import Sidebar from "../../components/Sidebar";
|
||||||
import FinanceiroItems from "../../data/sidebar-items-financeiro.json";
|
import FinanceiroItems from "../../data/sidebar-items-financeiro.json";
|
||||||
import Inicio from "../../pages/Inicio";
|
import Inicio from "../../pages/Inicio";
|
||||||
import TablePaciente from "../../pages/TablePaciente";
|
|
||||||
import FinanceiroDashboard from "../../pages/FinanceiroDashboard";
|
import FinanceiroDashboard from "../../pages/FinanceiroDashboard";
|
||||||
import DoctorTable from "../../pages/DoctorTable";
|
|
||||||
import Details from "../../pages/Details";
|
|
||||||
import DoctorDetails from "../../pages/DoctorDetails";
|
|
||||||
|
|
||||||
function PerfilFinanceiro({ onLogout }) {
|
function PerfilFinanceiro({ onLogout }) {
|
||||||
return (
|
return (
|
||||||
@ -15,12 +12,9 @@ function PerfilFinanceiro({ onLogout }) {
|
|||||||
<div id="main">
|
<div id="main">
|
||||||
<Routes>
|
<Routes>
|
||||||
<Route path="/" element={<FinanceiroDashboard/>}/>
|
<Route path="/" element={<FinanceiroDashboard/>}/>
|
||||||
<Route path="inicio" element={<Inicio />} />
|
|
||||||
<Route path="controlefinanceiro" element={<FinanceiroDashboard/>}/>
|
<Route path="controlefinanceiro" element={<FinanceiroDashboard/>}/>
|
||||||
<Route path="pacientes" element={<TablePaciente />} />
|
|
||||||
<Route path="medicos" element={<DoctorTable />} />
|
|
||||||
<Route path="pacientes/:id" element={<Details />} />
|
|
||||||
<Route path="medicos/:id" element={<DoctorDetails />} />
|
|
||||||
<Route path="*" element={<h2>Página não encontrada</h2>} />
|
<Route path="*" element={<h2>Página não encontrada</h2>} />
|
||||||
</Routes>
|
</Routes>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user