Compare commits
No commits in common. "8f7fef3b8d35affb8fd8aec2f210352d7df62e5c" and "d2b18cd4dc3c24702c08691fe5abfda4bd32aec6" have entirely different histories.
8f7fef3b8d
...
d2b18cd4dc
@ -4,7 +4,7 @@ import { useAuth } from '../utils/AuthProvider';
|
|||||||
import { useNavigate } from 'react-router-dom';
|
import { useNavigate } from 'react-router-dom';
|
||||||
import { useMemo } from 'react';
|
import { useMemo } from 'react';
|
||||||
|
|
||||||
const CardConsulta = ( {DadosConsulta, TabelaAgendamento, setShowDeleteModal, setDictInfo, setSelectedId} ) => {
|
const CardConsulta = ( {DadosConsulta, TabelaAgendamento, setShowDeleteModal} ) => {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
const {getAuthorizationHeader} = useAuth()
|
const {getAuthorizationHeader} = useAuth()
|
||||||
@ -45,7 +45,6 @@ const CardConsulta = ( {DadosConsulta, TabelaAgendamento, setShowDeleteModal, se
|
|||||||
|
|
||||||
let nameArrayMedico = Medico?.full_name.split(' ')
|
let nameArrayMedico = Medico?.full_name.split(' ')
|
||||||
|
|
||||||
console.log(DadosConsulta.status)
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={`container-cardconsulta-${TabelaAgendamento}`}>
|
<div className={`container-cardconsulta-${TabelaAgendamento}`}>
|
||||||
@ -68,14 +67,9 @@ const CardConsulta = ( {DadosConsulta, TabelaAgendamento, setShowDeleteModal, se
|
|||||||
<div className='container-botons'>
|
<div className='container-botons'>
|
||||||
<button className="btn btn-sm btn-edit-custom"
|
<button className="btn btn-sm btn-edit-custom"
|
||||||
|
|
||||||
onClick={() => {navigate(`2/edit`)
|
onClick={() => {navigate(`${DadosConsulta.id}/edit`)}}
|
||||||
setDictInfo({agendamento:DadosConsulta, Infos:{paciente_cpf:Paciente.cpf, paciente_nome:Paciente.full_name}})
|
|
||||||
|
|
||||||
|
|
||||||
}}
|
|
||||||
|
|
||||||
>
|
>
|
||||||
<i className="bi bi-pencil me-1"></i>
|
<i className="bi bi-pencil me-1"></i> Editar
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
|
|
||||||
@ -84,11 +78,11 @@ const CardConsulta = ( {DadosConsulta, TabelaAgendamento, setShowDeleteModal, se
|
|||||||
className="btn btn-sm btn-delete-custom"
|
className="btn btn-sm btn-delete-custom"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
console.log(DadosConsulta.id)
|
console.log(DadosConsulta.id)
|
||||||
setSelectedId(DadosConsulta.id);
|
//setSelectedPatientId(DadosConsulta.id);
|
||||||
setShowDeleteModal(true);
|
setShowDeleteModal(true);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<i className="bi bi-trash me-1"></i>
|
<i className="bi bi-trash me-1"></i> Excluir
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@ -2,33 +2,32 @@ import InputMask from "react-input-mask";
|
|||||||
import "./style/formagendamentos.css";
|
import "./style/formagendamentos.css";
|
||||||
import { useState, useEffect } from "react";
|
import { useState, useEffect } from "react";
|
||||||
import { GetPatientByCPF } from "../utils/Functions-Endpoints/Patient";
|
import { GetPatientByCPF } from "../utils/Functions-Endpoints/Patient";
|
||||||
import { GetDoctorByName, GetAllDoctors } from "../utils/Functions-Endpoints/Doctor";
|
import { GetDoctorByName } from "../utils/Functions-Endpoints/Doctor";
|
||||||
import { useAuth } from "../utils/AuthProvider";
|
import { useAuth } from "../utils/AuthProvider";
|
||||||
import API_KEY from "../utils/apiKeys";
|
|
||||||
|
|
||||||
const FormNovaConsulta = ({ onCancel, onSave, setAgendamento, agendamento }) => {
|
const FormNovaConsulta = ({ onCancel, onSave, setAgendamento, agendamento }) => {
|
||||||
const {getAuthorizationHeader} = useAuth()
|
const {getAuthorizationHeader} = useAuth()
|
||||||
|
|
||||||
console.log(agendamento, 'aqui2')
|
|
||||||
|
|
||||||
const [selectedFile, setSelectedFile] = useState(null);
|
const [selectedFile, setSelectedFile] = useState(null);
|
||||||
const [anexos, setAnexos] = useState([]);
|
const [anexos, setAnexos] = useState([]);
|
||||||
const [loadingAnexos, setLoadingAnexos] = useState(false);
|
const [loadingAnexos, setLoadingAnexos] = useState(false);
|
||||||
|
|
||||||
|
|
||||||
const [acessibilidade, setAcessibilidade] = useState({cadeirante:false,idoso:false,gravida:false,bebe:false, autista:false })
|
const [acessibilidade, setAcessibilidade] = useState({cadeirante:false,idoso:false,gravida:false,bebe:false, autista:false })
|
||||||
|
|
||||||
|
|
||||||
const [todosProfissionais, setTodosProfissionais] = useState([])
|
|
||||||
const [profissionaisFiltrados, setProfissionaisFiltrados] = useState([]);
|
|
||||||
const [isDropdownOpen, setIsDropdownOpen] = useState(false);
|
|
||||||
|
|
||||||
|
|
||||||
const [horarioInicio, setHorarioInicio] = useState('');
|
|
||||||
const [horarioTermino, setHorarioTermino] = useState('');
|
|
||||||
|
|
||||||
const [horariosDisponiveis, sethorariosDisponiveis] = useState([])
|
|
||||||
|
|
||||||
let authHeader = getAuthorizationHeader()
|
let authHeader = getAuthorizationHeader()
|
||||||
|
|
||||||
|
|
||||||
|
const handleclickAcessibilidade = (id) => {
|
||||||
|
let resultado = acessibilidade[id]
|
||||||
|
|
||||||
|
if(resultado === false){ setAcessibilidade({...acessibilidade, [id]:true}); console.log('mudou')}
|
||||||
|
|
||||||
|
else if(resultado === true){ setAcessibilidade({...acessibilidade, [id]:false})}
|
||||||
|
console.log(id)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const FormatCPF = (valor) => {
|
const FormatCPF = (valor) => {
|
||||||
const digits = String(valor).replace(/\D/g, '').slice(0, 11);
|
const digits = String(valor).replace(/\D/g, '').slice(0, 11);
|
||||||
return digits
|
return digits
|
||||||
@ -40,29 +39,15 @@ const [isDropdownOpen, setIsDropdownOpen] = useState(false);
|
|||||||
|
|
||||||
|
|
||||||
const handleChange = (e) => {
|
const handleChange = (e) => {
|
||||||
const {value, name} = e.target;
|
|
||||||
console.log(value, name, agendamento)
|
|
||||||
|
|
||||||
|
const {value, name} = e.target;
|
||||||
if(name === 'email'){
|
if(name === 'email'){
|
||||||
setAgendamento({...agendamento, contato:{
|
setAgendamento({...agendamento, contato:{
|
||||||
...agendamento.contato,
|
...agendamento.contato,
|
||||||
email:value
|
email:value
|
||||||
}})}
|
}})
|
||||||
else if(name === 'status'){
|
|
||||||
if(agendamento.status==='requested'){
|
|
||||||
setAgendamento((prev) => ({
|
|
||||||
...prev,
|
|
||||||
status:'confirmed',
|
|
||||||
}));
|
|
||||||
}else if(agendamento.status === 'confirmed'){
|
|
||||||
console.log(value)
|
|
||||||
setAgendamento((prev) => ({
|
|
||||||
...prev,
|
|
||||||
status:'requested',
|
|
||||||
}));
|
|
||||||
}}
|
|
||||||
|
|
||||||
else if(name === 'paciente_cpf'){
|
}else if(name === 'cpf'){
|
||||||
|
|
||||||
let cpfFormatted = FormatCPF(value)
|
let cpfFormatted = FormatCPF(value)
|
||||||
const fetchPatient = async () => {
|
const fetchPatient = async () => {
|
||||||
@ -70,7 +55,7 @@ const [isDropdownOpen, setIsDropdownOpen] = useState(false);
|
|||||||
if (patientData) {
|
if (patientData) {
|
||||||
setAgendamento((prev) => ({
|
setAgendamento((prev) => ({
|
||||||
...prev,
|
...prev,
|
||||||
pacinte_nome: patientData.full_name,
|
nome: patientData.full_name,
|
||||||
patient_id: patientData.id
|
patient_id: patientData.id
|
||||||
}));
|
}));
|
||||||
}}
|
}}
|
||||||
@ -78,97 +63,28 @@ const [isDropdownOpen, setIsDropdownOpen] = useState(false);
|
|||||||
fetchPatient()
|
fetchPatient()
|
||||||
}else if(name==='convenio'){
|
}else if(name==='convenio'){
|
||||||
setAgendamento({...agendamento,insurance_provider:value})
|
setAgendamento({...agendamento,insurance_provider:value})
|
||||||
|
}else if(name ==='profissional'){
|
||||||
|
|
||||||
|
|
||||||
|
const fetchDoctor = async () => {
|
||||||
|
let DoctorData = await GetDoctorByName(value, authHeader)
|
||||||
|
if(DoctorData){
|
||||||
|
setAgendamento((prev) => ({
|
||||||
|
...prev,
|
||||||
|
doctor_id:DoctorData.id
|
||||||
|
}))
|
||||||
|
}}
|
||||||
|
fetchDoctor()
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
setAgendamento({...agendamento,[name]:value})
|
setAgendamento({...agendamento,[name]:value})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const handleSubmit = (e) => {
|
||||||
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
const ChamarMedicos = async () => {
|
|
||||||
const Medicos = await GetAllDoctors(authHeader)
|
|
||||||
setTodosProfissionais(Medicos)
|
|
||||||
}
|
|
||||||
ChamarMedicos();
|
|
||||||
|
|
||||||
var myHeaders = new Headers();
|
|
||||||
myHeaders.append("Content-Type", "application/json");
|
|
||||||
myHeaders.append("apikey", API_KEY)
|
|
||||||
myHeaders.append("Authorization", `Bearer ${authHeader.split(' ')[1]}`);
|
|
||||||
|
|
||||||
var raw = JSON.stringify({
|
|
||||||
"doctor_id": agendamento.doctor_id,
|
|
||||||
"start_date": agendamento.dataAtendimento,
|
|
||||||
"end_date": `${agendamento.dataAtendimento}T23:59:59.999Z`,
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
var requestOptions = {
|
|
||||||
method: 'POST',
|
|
||||||
headers: myHeaders,
|
|
||||||
body: raw,
|
|
||||||
redirect: 'follow'
|
|
||||||
};
|
|
||||||
|
|
||||||
fetch("https://yuanqfswhberkoevtmfr.supabase.co/functions/v1/get-available-slots", requestOptions)
|
|
||||||
.then(response => response.json())
|
|
||||||
.then(result => {console.log(result); sethorariosDisponiveis(result)})
|
|
||||||
.catch(error => console.log('error', error));
|
|
||||||
|
|
||||||
}, [agendamento.dataAtendimento, agendamento.doctor_id])
|
|
||||||
|
|
||||||
|
|
||||||
// FUNÇÃO DE BUSCA E FILTRAGEM
|
|
||||||
const handleSearchProfissional = (e) => {
|
|
||||||
const term = e.target.value;
|
|
||||||
handleChange(e);
|
|
||||||
// 2. Lógica de filtragem:
|
|
||||||
if (term.trim() === '') {
|
|
||||||
setProfissionaisFiltrados([]);
|
|
||||||
setIsDropdownOpen(false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Adapte o nome da propriedade (ex: 'nome', 'full_name')
|
|
||||||
const filtered = todosProfissionais.filter(p =>
|
|
||||||
p.full_name.toLowerCase().includes(term.toLowerCase())
|
|
||||||
);
|
|
||||||
|
|
||||||
setProfissionaisFiltrados(filtered);
|
|
||||||
setIsDropdownOpen(filtered.length > 0); // Abre se houver resultados
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// FUNÇÃO PARA SELECIONAR UM ITEM DO DROPDOWN
|
|
||||||
const handleSelectProfissional = async (profissional) => {
|
|
||||||
setAgendamento(prev => ({
|
|
||||||
...prev,
|
|
||||||
doctor_id: profissional.id,
|
|
||||||
medico_nome: profissional.full_name
|
|
||||||
}));
|
|
||||||
// 2. Fecha o dropdown
|
|
||||||
setProfissionaisFiltrados([]);
|
|
||||||
setIsDropdownOpen(false);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
const formatarHora = (datetimeString) => {
|
|
||||||
return datetimeString.substring(11, 16);
|
|
||||||
};
|
|
||||||
|
|
||||||
const opcoesDeHorario = horariosDisponiveis?.slots?.map(item => ({
|
|
||||||
|
|
||||||
value: formatarHora(item.datetime),
|
|
||||||
label: formatarHora(item.datetime),
|
|
||||||
disabled: !item.available
|
|
||||||
}));
|
|
||||||
|
|
||||||
const handleSubmit = (e) => {
|
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
alert("Agendamento salvo!");
|
alert("Agendamento salvo!");
|
||||||
onSave({...agendamento, horarioInicio:horarioInicio})
|
onSave(agendamento)
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -179,21 +95,26 @@ const handleSubmit = (e) => {
|
|||||||
<h2 className="section-title">Informações do paciente</h2>
|
<h2 className="section-title">Informações do paciente</h2>
|
||||||
|
|
||||||
<div className="campos-informacoes-paciente" id="informacoes-paciente-linha-um">
|
<div className="campos-informacoes-paciente" id="informacoes-paciente-linha-um">
|
||||||
|
<div className="campo-de-input">
|
||||||
|
<label>Nome *</label>
|
||||||
|
<input type="text" name="nome" value={agendamento.nome} placeholder="Insira o nome do paciente" required onChange={handleChange} />
|
||||||
|
</div>
|
||||||
|
|
||||||
<div className="campo-de-input">
|
<div className="campo-de-input">
|
||||||
<label>CPF do paciente</label>
|
<label>CPF do paciente</label>
|
||||||
<input type="text" name="paciente_cpf" placeholder="000.000.000-00" onChange={handleChange} value={agendamento.paciente_cpf}/>
|
|
||||||
|
<input type="text" name="cpf" placeholder="000.000.000-00" onChange={handleChange} value={agendamento.cpf}/>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="campo-de-input">
|
|
||||||
<label>Nome *</label>
|
|
||||||
<input type="text" name="paciente_nome" value={agendamento.paciente_nome} placeholder="Insira o nome do paciente" required onChange={handleChange} />
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div className="campos-informacoes-paciente" id="informacoes-paciente-linha-tres">
|
<div className="campos-informacoes-paciente" id="informacoes-paciente-linha-tres">
|
||||||
|
|
||||||
<div >
|
<div className="campo-de-input">
|
||||||
<label>Convênio</label>
|
<label>Convênio</label>
|
||||||
<select name="convenio" onChange={handleChange}>
|
<select name="convenio" onChange={handleChange}>
|
||||||
<option value="publico">Público</option>
|
<option value="publico">Público</option>
|
||||||
@ -205,54 +126,72 @@ const handleSubmit = (e) => {
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<h3 className="section-subtitle">Informações adicionais</h3>
|
||||||
|
|
||||||
|
<label htmlFor="anexo-input" className="btn btn-secondary">Adicionar Anexo</label>
|
||||||
|
<input
|
||||||
|
type="file"
|
||||||
|
id="anexo-input"
|
||||||
|
className="d-none"
|
||||||
|
onChange={(e) => setSelectedFile(e.target.files[0])}
|
||||||
|
/>
|
||||||
|
{selectedFile && (
|
||||||
|
<button type="button" className="btn btn-primary ms-2" >
|
||||||
|
Enviar
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
|
<div className="anexos-list">
|
||||||
|
{loadingAnexos ? (
|
||||||
|
<p>Carregando anexos...</p>
|
||||||
|
) : (
|
||||||
|
anexos.map((anexo, index) => (
|
||||||
|
<div key={index} className="anexo-item">
|
||||||
|
<span>{anexo.nome || anexo.fileName}</span>
|
||||||
|
</div>
|
||||||
|
))
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
<h2 className="section-title">Informações do atendimento</h2>
|
<h2 className="section-title">Informações do atendimento</h2>
|
||||||
|
|
||||||
|
|
||||||
<div className="campo-informacoes-atendimento">
|
<div className="icons-container">
|
||||||
|
|
||||||
<div className="campo-de-input-container"> {/* NOVO CONTAINER PAI */}
|
<div className={`icons-div ${ acessibilidade.cadeirante === true ? 'acessibilidade-ativado' : ''} `} id='cadeirante' onClick={(e) => handleclickAcessibilidade(e.currentTarget.id)}>
|
||||||
<div className="campo-de-input">
|
|
||||||
<label>Nome do profissional *</label>
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
name="medico_nome" // Use o nome correto da propriedade no estado `agendamento`
|
|
||||||
onChange={handleSearchProfissional}
|
|
||||||
value={agendamento.medico_nome}
|
|
||||||
autoComplete="off" // Ajuda a evitar o autocomplete nativo do navegador
|
|
||||||
required
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* DROPDOWN - RENDERIZAÇÃO CONDICIONAL */}
|
<span className="material-symbols-outlined icon">accessible</span>
|
||||||
{isDropdownOpen && profissionaisFiltrados.length > 0 && (
|
</div>
|
||||||
<div className='dropdown-profissionais'>
|
|
||||||
{profissionaisFiltrados.map((profissional) => (
|
<div className={`icons-div ${acessibilidade.idoso === true ? 'acessibilidade-ativado' : ''}`} id="idoso" onClick={(e) => handleclickAcessibilidade(e.currentTarget.id)}>
|
||||||
<div
|
<span className="material-symbols-outlined icon">elderly</span>
|
||||||
key={profissional.id} // Use o ID do profissional
|
</div>
|
||||||
className='dropdown-item'
|
|
||||||
onClick={() => handleSelectProfissional(profissional)}
|
<div className={`icons-div ${acessibilidade.gravida === true ? 'acessibilidade-ativado' : ''}`} id="gravida" onClick={(e) => handleclickAcessibilidade(e.currentTarget.id)}>
|
||||||
>
|
<span className="material-symbols-outlined icon">pregnant_woman</span>
|
||||||
{profissional.full_name}
|
</div>
|
||||||
</div>
|
|
||||||
))}
|
<div className={`icons-div ${acessibilidade.bebe === true ? 'acessibilidade-ativado' : ''}`} id="bebe" onClick={(e) => handleclickAcessibilidade(e.currentTarget.id)}>
|
||||||
</div>
|
<svg xmlns="http://www.w3.org/2000/svg" width="34" height="34" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-baby-icon lucide-baby"><path d="M10 16c.5.3 1.2.5 2 .5s1.5-.2 2-.5"/><path d="M15 12h.01"/><path d="M19.38 6.813A9 9 0 0 1 20.8 10.2a2 2 0 0 1 0 3.6 9 9 0 0 1-17.6 0 2 2 0 0 1 0-3.6A9 9 0 0 1 12 3c2 0 3.5 1.1 3.5 2.5s-.9 2.5-2 2.5c-.8 0-1.5-.4-1.5-1"/><path d="M9 12h.01"/></svg>
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div className={`icons-div ${acessibilidade.autista === true ? 'acessibilidade-ativado' : ''}`} id="autista" onClick={(e) => handleclickAcessibilidade(e.currentTarget.id)}>
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.75" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-puzzle-icon lucide-puzzle"><path d="M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z"/></svg>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div className="tipo_atendimento">
|
|
||||||
<label>Tipo de atendimento *</label>
|
|
||||||
<select onChange={handleChange} name="tipo_atendimento" >
|
|
||||||
<option value="presencial" selected>Presencial</option>
|
|
||||||
<option value="teleconsulta">Teleconsulta</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="form-check ">
|
<div className="campo-informacoes-atendimento">
|
||||||
<input className="form-check-input checkbox-cstom" type="checkbox" name="status" onChange={handleChange} />
|
|
||||||
<label className="form-check-label checkbox-label" htmlFor="vip">
|
<div className="campo-de-input">
|
||||||
Fila de espera
|
<label>Nome do profissional *</label>
|
||||||
</label>
|
<input type="text" name="profissional" onChange={handleChange} value={agendamento.nome_medico}required />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div className="campo-de-input">
|
||||||
|
<label>Tipo de atendimento *</label>
|
||||||
|
<input type="text" name="tipoAtendimento" required />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<section id="informacoes-atendimento-segunda-linha">
|
<section id="informacoes-atendimento-segunda-linha">
|
||||||
@ -272,68 +211,30 @@ const handleSubmit = (e) => {
|
|||||||
|
|
||||||
<div className="campo-de-input">
|
<div className="campo-de-input">
|
||||||
<label>Data *</label>
|
<label>Data *</label>
|
||||||
<input type="date" name="dataAtendimento" onChange={handleChange} required />
|
<input type="date" name="dataAtendimento" required />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div className="campo-informacoes-atendimento">
|
||||||
|
<div className="campo-de-input">
|
||||||
|
<label>Início *</label>
|
||||||
|
<input type="time" name="inicio" required />
|
||||||
|
</div>
|
||||||
|
|
||||||
<div className="row">
|
<div className="campo-de-input">
|
||||||
<div className="campo-de-input">
|
<label>Término *</label>
|
||||||
<label htmlFor="inicio">Início *</label>
|
<input type="time" name="termino" required />
|
||||||
<select
|
</div>
|
||||||
id="inicio"
|
|
||||||
name="inicio"
|
|
||||||
required
|
|
||||||
value={horarioInicio}
|
|
||||||
onChange={(e) => setHorarioInicio(e.target.value)}
|
|
||||||
>
|
|
||||||
<option value="" disabled>Selecione a hora de início</option>
|
|
||||||
{opcoesDeHorario?.map((opcao, index) => (
|
|
||||||
<option
|
|
||||||
key={index}
|
|
||||||
value={opcao.value}
|
|
||||||
disabled={opcao.disabled}
|
|
||||||
>
|
|
||||||
{opcao.label}
|
|
||||||
{opcao.disabled && " (Indisponível)"}
|
|
||||||
</option>
|
|
||||||
))}
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{/* Dropdown de Término */}
|
|
||||||
<div className="campo-de-input">
|
|
||||||
<label htmlFor="termino">Término *</label>
|
|
||||||
<select
|
|
||||||
id="termino"
|
|
||||||
name="termino"
|
|
||||||
required
|
|
||||||
value={horarioTermino}
|
|
||||||
onChange={(e) => setHorarioTermino(e.target.value)}
|
|
||||||
>
|
|
||||||
<option value="" disabled>Selecione a hora de término</option>
|
|
||||||
{opcoesDeHorario?.map((opcao, index) => (
|
|
||||||
<option
|
|
||||||
key={index}
|
|
||||||
value={opcao.value}
|
|
||||||
disabled={opcao.disabled}
|
|
||||||
>
|
|
||||||
{opcao.label}
|
|
||||||
{opcao.disabled && " (Indisponível)"}
|
|
||||||
</option>
|
|
||||||
))}
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div className="campo-de-input">
|
||||||
|
<label>Profissional solicitante</label>
|
||||||
|
<select name="solicitante">
|
||||||
|
<option value="" disabled invisible selected>Selecione o solicitante</option>
|
||||||
|
<option value="secretaria">Secretária</option>
|
||||||
|
<option value="medico">Médico</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section className="informacoes-atendimento-segunda-linha-direita">
|
<section className="informacoes-atendimento-segunda-linha-direita">
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import React, { useState, useEffect } from 'react';
|
|||||||
import CardConsulta from './CardConsulta';
|
import CardConsulta from './CardConsulta';
|
||||||
import "./style/styleTabelas/tabeladia.css";
|
import "./style/styleTabelas/tabeladia.css";
|
||||||
|
|
||||||
const TabelaAgendamentoDia = ({ handleClickAgendamento, agendamentos, setShowDeleteModal, setDictInfo, setSelectedId }) => {
|
const TabelaAgendamentoDia = ({ handleClickAgendamento, agendamentos, setShowDeleteModal }) => {
|
||||||
const [indiceAcesso, setIndiceAcesso] = useState(0)
|
const [indiceAcesso, setIndiceAcesso] = useState(0)
|
||||||
const [Dia, setDia] = useState()
|
const [Dia, setDia] = useState()
|
||||||
const agendamentosDoDia = agendamentos?.semana1?.segunda || [];
|
const agendamentosDoDia = agendamentos?.semana1?.segunda || [];
|
||||||
@ -24,9 +24,7 @@ const TabelaAgendamentoDia = ({ handleClickAgendamento, agendamentos, setShowDel
|
|||||||
<div>
|
<div>
|
||||||
<div id='tabela-seletor-container'>
|
<div id='tabela-seletor-container'>
|
||||||
<button onClick={() => {if(indiceAcesso === 0)return; else(setIndiceAcesso(indiceAcesso - 1))}}> <i className="bi bi-chevron-compact-left"></i></button>
|
<button onClick={() => {if(indiceAcesso === 0)return; else(setIndiceAcesso(indiceAcesso - 1))}}> <i className="bi bi-chevron-compact-left"></i></button>
|
||||||
|
<p>{Dia}</p>
|
||||||
|
|
||||||
<p>{Dia ? `${Dia?.split('-')[2]}/${Dia?.split('-')[1]}/${Dia?.split('-')[0]}`: ''}</p>
|
|
||||||
<button onClick={() => {if(ListaDiasComAgendamentos.length - 1 === indiceAcesso)return; else(setIndiceAcesso(indiceAcesso + 1))}}> <i className="bi bi-chevron-compact-right"></i></button>
|
<button onClick={() => {if(ListaDiasComAgendamentos.length - 1 === indiceAcesso)return; else(setIndiceAcesso(indiceAcesso + 1))}}> <i className="bi bi-chevron-compact-right"></i></button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -39,21 +37,16 @@ const TabelaAgendamentoDia = ({ handleClickAgendamento, agendamentos, setShowDel
|
|||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
<tbody>
|
<tbody>
|
||||||
{agendamentos[Dia]?.map((agendamento, index) => {
|
{agendamentos[Dia]?.map((agendamento, index) => (
|
||||||
|
|
||||||
let Data =agendamento.scheduled_at.split("T")
|
|
||||||
let horario = Data[1].split(':')
|
|
||||||
return(
|
|
||||||
<tr key={index}>
|
<tr key={index}>
|
||||||
|
<td><p>{agendamento.horario}</p></td>
|
||||||
<td><p>{`${horario[0]}:${horario[1]}`}</p></td>
|
|
||||||
<td className='mostrar-horario'>
|
<td className='mostrar-horario'>
|
||||||
<div onClick={() => handleClickAgendamento(agendamento)}>
|
<div onClick={() => handleClickAgendamento(agendamento)}>
|
||||||
<CardConsulta DadosConsulta={agendamento} TabelaAgendamento={'dia'} setShowDeleteModal={setShowDeleteModal} setDictInfo={setDictInfo} setSelectedId={setSelectedId}/>
|
<CardConsulta DadosConsulta={agendamento} TabelaAgendamento={'dia'} setShowDeleteModal={setShowDeleteModal} />
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
)})}
|
))}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -6,7 +6,7 @@ import "./style/styleTabelas/tabelames.css";
|
|||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import { useMemo } from 'react';
|
import { useMemo } from 'react';
|
||||||
|
|
||||||
const TabelaAgendamentoMes = ({ ListarDiasdoMes, agendamentos, setShowDeleteModal, setSelectedId ,setDictInfo }) => {
|
const TabelaAgendamentoMes = ({ ListarDiasdoMes, agendamentos }) => {
|
||||||
|
|
||||||
const dataHoje = dayjs();
|
const dataHoje = dayjs();
|
||||||
const AnoAtual = dataHoje.year();
|
const AnoAtual = dataHoje.year();
|
||||||
@ -88,6 +88,8 @@ const TabelaAgendamentoMes = ({ ListarDiasdoMes, agendamentos, setShowDeleteModa
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
console.log(OrganizarAgendamentosMensais)
|
console.log(OrganizarAgendamentosMensais)
|
||||||
|
|
||||||
|
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -181,13 +183,13 @@ const TabelaAgendamentoMes = ({ ListarDiasdoMes, agendamentos, setShowDeleteModa
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<table className='tabelamensal'>
|
<table className='tabelamensal'>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th className='cabecalho-tabela'>Segunda</th>
|
<td className='cabecalho-tabela'>Seg</td>
|
||||||
<th>Terça</th>
|
<th>Ter</th>
|
||||||
<th>Quarta</th>
|
<th>Qua</th>
|
||||||
<th>Quinta</th>
|
<th>Qui</th>
|
||||||
<th>Sexta</th>
|
<th>Sex</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@ -202,9 +204,9 @@ const TabelaAgendamentoMes = ({ ListarDiasdoMes, agendamentos, setShowDeleteModa
|
|||||||
{
|
{
|
||||||
semana && typeof semana === "object" && Object.keys(semana).map((dia) => (
|
semana && typeof semana === "object" && Object.keys(semana).map((dia) => (
|
||||||
<td key={dia} >
|
<td key={dia} >
|
||||||
<CardConsulta DadosConsulta={((semana[dia]|| [])[0]) || {status:'vazio'}} setShowDeleteModal={setShowDeleteModal} setSelectedId={setSelectedId} setDictInfo={setDictInfo}/>
|
<CardConsulta DadosConsulta={((semana[dia]|| [])[0]) || {status:'vazio'}}/>
|
||||||
<CardConsulta DadosConsulta={((semana[dia]|| [])[1]) || {status:'vazio'}} setShowDeleteModal={setShowDeleteModal} setSelectedId={setSelectedId} setDictInfo={setDictInfo}/>
|
<CardConsulta DadosConsulta={((semana[dia]|| [])[1]) || {status:'vazio'}}/>
|
||||||
<CardConsulta DadosConsulta={((semana[dia]|| [])[2]) || {status:'vazio'}} setShowDeleteModal={setShowDeleteModal} setSelectedId={setSelectedId} setDictInfo={setDictInfo}/>
|
<CardConsulta DadosConsulta={((semana[dia]|| [])[2]) || {status:'vazio'}}/>
|
||||||
{semana[dia].length > 3 ? (
|
{semana[dia].length > 3 ? (
|
||||||
<div>
|
<div>
|
||||||
<p>{` +${semana[dia].length - 2}`}</p>
|
<p>{` +${semana[dia].length - 2}`}</p>
|
||||||
|
|||||||
@ -6,7 +6,7 @@ import { useEffect, useState, useMemo } from 'react';
|
|||||||
import weekOfYear from 'dayjs/plugin/weekOfYear'
|
import weekOfYear from 'dayjs/plugin/weekOfYear'
|
||||||
dayjs.extend(weekOfYear)
|
dayjs.extend(weekOfYear)
|
||||||
|
|
||||||
const TabelaAgendamentoSemana = ({ agendamentos, ListarDiasdoMes, setShowDeleteModal ,setSelectedId ,setDictInfo}) => {
|
const TabelaAgendamentoSemana = ({ agendamentos, ListarDiasdoMes }) => {
|
||||||
|
|
||||||
// Armazena o objeto COMPLETO das semanas organizadas
|
// Armazena o objeto COMPLETO das semanas organizadas
|
||||||
const [semanasOrganizadas, setSemanasOrganizadas] = useState({});
|
const [semanasOrganizadas, setSemanasOrganizadas] = useState({});
|
||||||
@ -164,31 +164,31 @@ const TabelaAgendamentoSemana = ({ agendamentos, ListarDiasdoMes, setShowDeleteM
|
|||||||
{/* Mapeamento de COLUNAS (dias) */}
|
{/* Mapeamento de COLUNAS (dias) */}
|
||||||
<td>
|
<td>
|
||||||
{semanaParaRenderizar.segunda[indiceLinha]
|
{semanaParaRenderizar.segunda[indiceLinha]
|
||||||
? <CardConsulta DadosConsulta={semanaParaRenderizar.segunda[indiceLinha]} setShowDeleteModal={setShowDeleteModal} setSelectedId={setSelectedId} setDictInfo={setDictInfo} />
|
? <CardConsulta DadosConsulta={semanaParaRenderizar.segunda[indiceLinha]} />
|
||||||
: null
|
: null
|
||||||
}
|
}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{semanaParaRenderizar.terça[indiceLinha]
|
{semanaParaRenderizar.terça[indiceLinha]
|
||||||
? <CardConsulta DadosConsulta={semanaParaRenderizar.terça[indiceLinha]} setShowDeleteModal={setShowDeleteModal} setSelectedId={setSelectedId} setDictInfo={setDictInfo}/>
|
? <CardConsulta DadosConsulta={semanaParaRenderizar.terça[indiceLinha]} />
|
||||||
: null
|
: null
|
||||||
}
|
}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{semanaParaRenderizar.quarta[indiceLinha]
|
{semanaParaRenderizar.quarta[indiceLinha]
|
||||||
? <CardConsulta DadosConsulta={semanaParaRenderizar.quarta[indiceLinha]} setShowDeleteModal={setShowDeleteModal} setSelectedId={setSelectedId} setDictInfo={setDictInfo}/>
|
? <CardConsulta DadosConsulta={semanaParaRenderizar.quarta[indiceLinha]} />
|
||||||
: null
|
: null
|
||||||
}
|
}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{semanaParaRenderizar.quinta[indiceLinha]
|
{semanaParaRenderizar.quinta[indiceLinha]
|
||||||
? <CardConsulta DadosConsulta={semanaParaRenderizar.quinta[indiceLinha]} setShowDeleteModal={setShowDeleteModal} setSelectedId={setSelectedId} setDictInfo={setDictInfo} />
|
? <CardConsulta DadosConsulta={semanaParaRenderizar.quinta[indiceLinha]} />
|
||||||
: null
|
: null
|
||||||
}
|
}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{semanaParaRenderizar.sexta[indiceLinha]
|
{semanaParaRenderizar.sexta[indiceLinha]
|
||||||
? <CardConsulta DadosConsulta={semanaParaRenderizar.sexta[indiceLinha]} setShowDeleteModal={setShowDeleteModal} setSelectedId={setSelectedId} setDictInfo={setDictInfo} />
|
? <CardConsulta DadosConsulta={semanaParaRenderizar.sexta[indiceLinha]} />
|
||||||
: null
|
: null
|
||||||
}
|
}
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
@ -304,89 +304,3 @@ html[data-bs-theme="dark"] .icon,
|
|||||||
html[data-bs-theme="dark"] svg {
|
html[data-bs-theme="dark"] svg {
|
||||||
color: #e0e0e0 !important;
|
color: #e0e0e0 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* CONTAINER PAI - ESSENCIAL PARA POSICIONAMENTO */
|
|
||||||
.campo-de-input-container {
|
|
||||||
position: relative; /* Define o contexto para o dropdown */
|
|
||||||
/* ... outros estilos de layout (display, margin, etc.) ... */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ESTILO DA LISTA DROPDOWN */
|
|
||||||
.dropdown-profissionais {
|
|
||||||
position: absolute; /* Flutua em relação ao pai (.campo-de-input-container) */
|
|
||||||
top: 100%; /* Começa logo abaixo do input */
|
|
||||||
left: 0;
|
|
||||||
width: 100%; /* Ocupa toda a largura do container pai */
|
|
||||||
|
|
||||||
/* Estilos visuais */
|
|
||||||
background-color: white;
|
|
||||||
border: 1px solid #ccc;
|
|
||||||
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
|
||||||
z-index: 100; /* Alto z-index para garantir que fique acima de outros elementos */
|
|
||||||
max-height: 200px;
|
|
||||||
overflow-y: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ESTILO DE CADA ITEM DO DROPDOWN */
|
|
||||||
.dropdown-item {
|
|
||||||
padding: 10px;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.dropdown-item:hover {
|
|
||||||
background-color: #f0f0f0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tipo_atendimento{
|
|
||||||
margin-left: 3rem;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* 1. Estilização Básica e Tamanho (Estado Padrão - Antes de Clicar) */
|
|
||||||
.checkbox-customs {
|
|
||||||
/* Remove a aparência padrão do navegador/Bootstrap */
|
|
||||||
-webkit-appearance: none;
|
|
||||||
-moz-appearance: none;
|
|
||||||
appearance: none;
|
|
||||||
|
|
||||||
/* Define o tamanho desejado */
|
|
||||||
width: 1.2rem; /* Ajuste conforme o seu gosto (ex: 1.2rem = 19.2px) */
|
|
||||||
height: 1.2rem;
|
|
||||||
|
|
||||||
/* Define o visual "branco com borda preta" */
|
|
||||||
background-color: #fff; /* Fundo branco */
|
|
||||||
border: 1px solid #000; /* Borda preta de 1px */
|
|
||||||
border-radius: 0.25rem; /* Borda levemente arredondada (opcional, imita Bootstrap) */
|
|
||||||
|
|
||||||
/* Centraliza o 'check' (quando aparecer) */
|
|
||||||
display: inline-block;
|
|
||||||
vertical-align: middle;
|
|
||||||
cursor: pointer; /* Indica que é clicável */
|
|
||||||
|
|
||||||
/* Adiciona a transição suave */
|
|
||||||
transition: all 0.5s ease; /* Transição em 0.5 segundos para todas as propriedades */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 2. Estilização no Estado Clicado (:checked) */
|
|
||||||
.checkbox-customs:checked {
|
|
||||||
/* Quando clicado, mantém o fundo branco (se quiser mudar, altere aqui) */
|
|
||||||
background-color: #fff;
|
|
||||||
|
|
||||||
/* Se você quiser que a borda mude de cor ao clicar, altere aqui. */
|
|
||||||
/* border-color: #007bff; */ /* Exemplo: borda azul */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 3. Ocultar o 'Check' Padrão e Criar um Check Customizado */
|
|
||||||
/* O Bootstrap/Navegador insere um ícone de 'check'. Vamos controlá-lo com background-image. */
|
|
||||||
.checkbox-customs:checked {
|
|
||||||
/* Este código do Bootstrap usa um SVG para o ícone de 'check' */
|
|
||||||
/* Aqui, estamos forçando o ícone de 'check' a ser preto para combinar com a borda preta. */
|
|
||||||
background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23000' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='M6 10l3 3l6-6'/%3e%3c/svg%3e");
|
|
||||||
|
|
||||||
/* Garante que o ícone fique centralizado e preencha o espaço */
|
|
||||||
background-size: 100% 100%;
|
|
||||||
background-position: center;
|
|
||||||
background-repeat: no-repeat;
|
|
||||||
}
|
|
||||||
@ -18,7 +18,7 @@
|
|||||||
/* Cabeçalho */
|
/* Cabeçalho */
|
||||||
.tabelamensal thead th {
|
.tabelamensal thead th {
|
||||||
background-color: #0078d7;
|
background-color: #0078d7;
|
||||||
color: white;
|
color: #0078d7;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
border-bottom: 2px solid #0078d7; /* borda inferior mais forte no cabeçalho */
|
border-bottom: 2px solid #0078d7; /* borda inferior mais forte no cabeçalho */
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,8 +6,8 @@ import TabelaAgendamentoDia from '../components/AgendarConsulta/TabelaAgendament
|
|||||||
import TabelaAgendamentoSemana from '../components/AgendarConsulta/TabelaAgendamentoSemana';
|
import TabelaAgendamentoSemana from '../components/AgendarConsulta/TabelaAgendamentoSemana';
|
||||||
import TabelaAgendamentoMes from '../components/AgendarConsulta/TabelaAgendamentoMes';
|
import TabelaAgendamentoMes from '../components/AgendarConsulta/TabelaAgendamentoMes';
|
||||||
import FormNovaConsulta from '../components/AgendarConsulta/FormNovaConsulta';
|
import FormNovaConsulta from '../components/AgendarConsulta/FormNovaConsulta';
|
||||||
import { GetPatientByID } from '../components/utils/Functions-Endpoints/Patient.js';
|
|
||||||
import { GetAllDoctors, GetDoctorByID } from '../components/utils/Functions-Endpoints/Doctor.js';
|
import { GetAllDoctors } from '../components/utils/Functions-Endpoints/Doctor.js';
|
||||||
|
|
||||||
import { useAuth } from '../components/utils/AuthProvider.js';
|
import { useAuth } from '../components/utils/AuthProvider.js';
|
||||||
// ✨ NOVO: Caminho de importação corrigido com base na sua estrutura de pastas
|
// ✨ NOVO: Caminho de importação corrigido com base na sua estrutura de pastas
|
||||||
@ -21,11 +21,9 @@ import { Search } from 'lucide-react';
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
const Agendamento = ({setDictInfo}) => {
|
const Agendamento = () => {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
const [selectedID, setSelectedId] = useState('0')
|
|
||||||
const [filaEsperaData, setfilaEsperaData] = useState([])
|
|
||||||
const [FiladeEspera, setFiladeEspera] = useState(false);
|
const [FiladeEspera, setFiladeEspera] = useState(false);
|
||||||
const [tabela, setTabela] = useState('diario');
|
const [tabela, setTabela] = useState('diario');
|
||||||
const [PageNovaConsulta, setPageConsulta] = useState(false);
|
const [PageNovaConsulta, setPageConsulta] = useState(false);
|
||||||
@ -44,78 +42,28 @@ const Agendamento = ({setDictInfo}) => {
|
|||||||
|
|
||||||
let authHeader = getAuthorizationHeader()
|
let authHeader = getAuthorizationHeader()
|
||||||
|
|
||||||
const FiltrarAgendamentos = async (listaTodosAgendamentos) => {
|
const FiltrarAgendamentos = (listaTodosAgendamentos) => {
|
||||||
const ConfigurarFiladeEspera = async (patient_id, doctor_id, agendamento) => {
|
let DictAgendamentosOrganizados = {};
|
||||||
// Assumindo que GetDoctorByID e GetPatientByID estão definidos no seu escopo
|
|
||||||
let medico = await GetDoctorByID(doctor_id, authHeader);
|
|
||||||
let paciente = await GetPatientByID(patient_id, authHeader);
|
|
||||||
|
|
||||||
let dicionario = {
|
for (let i = 0; i < listaTodosAgendamentos.length; i++) {
|
||||||
agendamento: agendamento,
|
const agendamento = listaTodosAgendamentos[i];
|
||||||
Infos: {
|
const DiaAgendamento = agendamento.scheduled_at.split("T")[0];
|
||||||
nome_nedico: medico.full_name,
|
|
||||||
doctor_id: medico.id,
|
|
||||||
patient_id: paciente[0].id,
|
|
||||||
paciente_nome: paciente[0].full_name,
|
|
||||||
paciente_cpf: paciente[0].cpf
|
|
||||||
}
|
|
||||||
};
|
|
||||||
return dicionario;
|
|
||||||
};
|
|
||||||
|
|
||||||
let DictAgendamentosOrganizados = {};
|
//console.log(DictAgendamentosOrganizados)
|
||||||
let ListaFilaDeEspera = [];
|
|
||||||
|
|
||||||
// 1. Agrupamento (igual ao seu código original)
|
if (DiaAgendamento in DictAgendamentosOrganizados) {
|
||||||
for (const agendamento of listaTodosAgendamentos) {
|
// já existe a data → adiciona na lista
|
||||||
if (agendamento.status === 'requested') {
|
DictAgendamentosOrganizados[DiaAgendamento].push(agendamento);
|
||||||
// Recomenda-se usar Promise.all para melhorar a performance
|
} else {
|
||||||
// mas, para manter a estrutura, mantemos o await no loop.
|
// não existe → cria nova key com uma lista
|
||||||
let v = await ConfigurarFiladeEspera(agendamento.patient_id, agendamento.doctor_id, agendamento);
|
DictAgendamentosOrganizados[DiaAgendamento] = [agendamento];
|
||||||
ListaFilaDeEspera.push(v);
|
|
||||||
} else {
|
|
||||||
const DiaAgendamento = agendamento.scheduled_at.split("T")[0];
|
|
||||||
|
|
||||||
if (DiaAgendamento in DictAgendamentosOrganizados) {
|
|
||||||
DictAgendamentosOrganizados[DiaAgendamento].push(agendamento);
|
|
||||||
} else {
|
|
||||||
DictAgendamentosOrganizados[DiaAgendamento] = [agendamento];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
|
||||||
// 2. Ordenação Interna: Ordenar os agendamentos por HORÁRIO (do menor para o maior)
|
|
||||||
for (const DiaAgendamento in DictAgendamentosOrganizados) {
|
|
||||||
DictAgendamentosOrganizados[DiaAgendamento].sort((a, b) => {
|
|
||||||
// Compara as strings de data/hora (ISO 8601) diretamente,
|
|
||||||
// que funcionam para ordenação cronológica.
|
|
||||||
if (a.scheduled_at < b.scheduled_at) return -1;
|
|
||||||
if (a.scheduled_at > b.scheduled_at) return 1;
|
|
||||||
return 0;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
setAgendamentosOrganizados(DictAgendamentosOrganizados);
|
||||||
// 3. Ordenação Externa: Ordenar os DIAS (as chaves do objeto)
|
|
||||||
// Para garantir que as chaves fiquem na sequência cronológica correta.
|
|
||||||
|
|
||||||
// Pega as chaves (datas)
|
}
|
||||||
const chavesOrdenadas = Object.keys(DictAgendamentosOrganizados).sort((a, b) => {
|
|
||||||
// Compara as chaves de data (strings 'YYYY-MM-DD')
|
|
||||||
if (a < b) return -1;
|
|
||||||
if (a > b) return 1;
|
|
||||||
return 0;
|
|
||||||
});
|
|
||||||
|
|
||||||
// Cria um novo objeto no formato desejado, garantindo a ordem das chaves
|
|
||||||
let DictAgendamentosFinal = {};
|
|
||||||
for (const data of chavesOrdenadas) {
|
|
||||||
DictAgendamentosFinal[data] = DictAgendamentosOrganizados[data];
|
|
||||||
}
|
|
||||||
setAgendamentosOrganizados(DictAgendamentosFinal); // Use o objeto final ordenado
|
|
||||||
setfilaEsperaData(ListaFilaDeEspera);
|
|
||||||
};
|
|
||||||
|
|
||||||
// Requisição inicial para mostrar os agendamentos do banco de dados
|
// Requisição inicial para mostrar os agendamentos do banco de dados
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -138,6 +86,7 @@ const Agendamento = ({setDictInfo}) => {
|
|||||||
let lista = []
|
let lista = []
|
||||||
const TodosOsMedicos = await GetAllDoctors(authHeader)
|
const TodosOsMedicos = await GetAllDoctors(authHeader)
|
||||||
|
|
||||||
|
//console.log(TodosOsMedicos, "tentativa")
|
||||||
for(let d = 0; TodosOsMedicos.length > d; d++){
|
for(let d = 0; TodosOsMedicos.length > d; d++){
|
||||||
lista.push({nomeMedico: TodosOsMedicos[d].full_name, idMedico: TodosOsMedicos[d].id })}
|
lista.push({nomeMedico: TodosOsMedicos[d].full_name, idMedico: TodosOsMedicos[d].id })}
|
||||||
setListaDeMedicos(lista)
|
setListaDeMedicos(lista)
|
||||||
@ -147,42 +96,44 @@ const Agendamento = ({setDictInfo}) => {
|
|||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
console.log("mudou FiltredTodosMedicos:", FiltredTodosMedicos);
|
|
||||||
if (FiltredTodosMedicos.length === 1) {
|
console.log("mudou FiltredTodosMedicos:", FiltredTodosMedicos);
|
||||||
|
|
||||||
|
if (FiltredTodosMedicos.length === 1) {
|
||||||
|
|
||||||
const unicoMedico = FiltredTodosMedicos[0];
|
const unicoMedico = FiltredTodosMedicos[0];
|
||||||
console.log(unicoMedico)
|
console.log(unicoMedico)
|
||||||
|
|
||||||
const idMedicoFiltrado = unicoMedico.idMedico;
|
const idMedicoFiltrado = unicoMedico.idMedico;
|
||||||
|
|
||||||
console.log(`Médico único encontrado: ${unicoMedico.nomeMedico}. ID: ${idMedicoFiltrado}`);
|
console.log(`Médico único encontrado: ${unicoMedico.nomeMedico}. ID: ${idMedicoFiltrado}`);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const agendamentosDoMedico = filtrarAgendamentosPorMedico(
|
const agendamentosDoMedico = filtrarAgendamentosPorMedico(
|
||||||
DictAgendamentosOrganizados,
|
DictAgendamentosOrganizados,
|
||||||
idMedicoFiltrado
|
idMedicoFiltrado
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// =========================================================================
|
||||||
|
|
||||||
console.log(`Total de agendamentos filtrados para este médico: ${agendamentosDoMedico.length}`);
|
console.log(`Total de agendamentos filtrados para este médico: ${agendamentosDoMedico.length}`);
|
||||||
console.log("Lista completa de Agendamentos do Médico:", agendamentosDoMedico);
|
console.log("Lista completa de Agendamentos do Médico:", agendamentosDoMedico);
|
||||||
FiltrarAgendamentos(agendamentosDoMedico)
|
FiltrarAgendamentos(agendamentosDoMedico)
|
||||||
|
|
||||||
|
|
||||||
|
// AQUI VOCÊ PODE APLICAR SUA LÓGICA FINAL:
|
||||||
|
// Ex: setar um novo estado com os agendamentos filtrados, se for necessário:
|
||||||
|
// setAgendamentosFiltrados(agendamentosDoMedico);
|
||||||
|
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// Opcional: Limpar a lista filtrada se a busca não for mais única
|
||||||
|
// setAgendamentosFiltrados([]);
|
||||||
}
|
}
|
||||||
|
|
||||||
}, [FiltredTodosMedicos]);
|
}, [FiltredTodosMedicos]);
|
||||||
|
|
||||||
const deleteConsulta = (selectedPatientId) => {
|
|
||||||
console.log("tentando apagar")
|
|
||||||
var myHeaders = new Headers();
|
|
||||||
myHeaders.append("Authorization", authHeader);
|
|
||||||
myHeaders.append("apikey", API_KEY)
|
|
||||||
|
|
||||||
var requestOptions = {
|
|
||||||
method: 'DELETE',
|
|
||||||
redirect: 'follow',
|
|
||||||
headers: myHeaders
|
|
||||||
};
|
|
||||||
|
|
||||||
fetch(`https://yuanqfswhberkoevtmfr.supabase.co/rest/v1/appointments?id=eq.${selectedPatientId}`, requestOptions)
|
|
||||||
.then(response => response.json())
|
|
||||||
.then(result => console.log(result))
|
|
||||||
.catch(error => console.log('error', error));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -209,6 +160,27 @@ const filtrarAgendamentosPorMedico = (dictAgendamentos, idMedicoFiltrado) => {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Dados da fila de espera (sem alteração)
|
||||||
|
const filaEsperaData = [
|
||||||
|
{ nome: 'Ricardo Pereira', email: 'ricardo.pereira@gmail.com', cpf: '444.777.666-55', telefone: '(79) 99123-4567', entrada: '25/09/2025 às 08:00' },
|
||||||
|
{ nome: 'Ana Costa', email: 'ana.costa@gmail.com', cpf: '321.654.987-00', telefone: '(79) 97777-3333', entrada: '25/09/2025 às 08:30' },
|
||||||
|
{ nome: 'Lucas Martins', email: 'lucas.martins@gmail.com', cpf: '777.666.555-33', telefone: '(79) 99654-3210', entrada: '25/09/2025 às 09:00' },
|
||||||
|
{ nome: 'João Souza', email: 'joao.souza@gmail.com', cpf: '987.654.321-00', telefone: '(79) 98888-2222', entrada: '25/09/2025 às 14:00' },
|
||||||
|
{ nome: 'Maria Silva', email: 'maria.silva@gmail.com', cpf: '123.456.789-00', telefone: '(79) 99999-1111', entrada: '25/09/2025 às 14:30' },
|
||||||
|
{ nome: 'Fernanda Lima', email: 'fernanda.lima@gmail.com', cpf: '888.999.000-22', telefone: '(79) 98877-6655', entrada: '26/09/2025 às 09:30' },
|
||||||
|
{ nome: 'Carlos Andrade', email: 'carlos.andrade@gmail.com', cpf: '222.555.888-11', telefone: '(79) 99876-5432', entrada: '26/09/2025 às 10:00' },
|
||||||
|
{ nome: 'Juliana Oliveira', email: 'juliana.o@gmail.com', cpf: '111.222.333-44', telefone: '(79) 98765-1234', entrada: '26/09/2025 às 11:30' },
|
||||||
|
];
|
||||||
|
|
||||||
|
// Filtro da fila de espera (sem alteração)
|
||||||
|
const filteredFila = filaEsperaData.filter(item =>
|
||||||
|
item.nome.toLowerCase().includes(searchTerm.toLowerCase()) ||
|
||||||
|
item.email.toLowerCase().includes(searchTerm.toLowerCase()) ||
|
||||||
|
item.cpf.includes(searchTerm) ||
|
||||||
|
item.telefone.includes(searchTerm)
|
||||||
|
);
|
||||||
|
|
||||||
// Lógica para filtrar os dados da AGENDA (AgendamentosMes)
|
// Lógica para filtrar os dados da AGENDA (AgendamentosMes)
|
||||||
const filteredAgendamentos = useMemo(() => {
|
const filteredAgendamentos = useMemo(() => {
|
||||||
if (!searchTerm.trim()) {
|
if (!searchTerm.trim()) {
|
||||||
@ -281,10 +253,6 @@ const handleSearchMedicos = (term) => {
|
|||||||
Mudar Disponibilidade
|
Mudar Disponibilidade
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<button onClick={() => setPageConsulta(true)}>
|
|
||||||
Adcionar consulta
|
|
||||||
</button>
|
|
||||||
|
|
||||||
{!PageNovaConsulta ? (
|
{!PageNovaConsulta ? (
|
||||||
<div className='atendimento-eprocura'>
|
<div className='atendimento-eprocura'>
|
||||||
|
|
||||||
@ -383,9 +351,9 @@ const handleSearchMedicos = (term) => {
|
|||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
{tabela === "diario" && <TabelaAgendamentoDia handleClickAgendamento={handleClickAgendamento} agendamentos={DictAgendamentosOrganizados} setShowDeleteModal={setShowDeleteModal} setSelectedId={setSelectedId} setDictInfo={setDictInfo} />}
|
{tabela === "diario" && <TabelaAgendamentoDia handleClickAgendamento={handleClickAgendamento} agendamentos={DictAgendamentosOrganizados} setShowDeleteModal={setShowDeleteModal} />}
|
||||||
{tabela === 'semanal' && <TabelaAgendamentoSemana agendamentos={DictAgendamentosOrganizados} ListarDiasdoMes={ListarDiasdoMes} setShowDeleteModal={setShowDeleteModal} setSelectedId={setSelectedId} setDictInfo={setDictInfo}/>}
|
{tabela === 'semanal' && <TabelaAgendamentoSemana agendamentos={DictAgendamentosOrganizados} ListarDiasdoMes={ListarDiasdoMes}/>}
|
||||||
{tabela === 'mensal' && <TabelaAgendamentoMes ListarDiasdoMes={ListarDiasdoMes} aplicarCores={true} agendamentos={DictAgendamentosOrganizados} setShowDeleteModal={setShowDeleteModal} setSelectedId={setSelectedId} setDictInfo={setDictInfo} />}
|
{tabela === 'mensal' && <TabelaAgendamentoMes ListarDiasdoMes={ListarDiasdoMes} aplicarCores={true} agendamentos={DictAgendamentosOrganizados} />}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
@ -406,43 +374,20 @@ const handleSearchMedicos = (term) => {
|
|||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Nome</th>
|
<th>Nome</th>
|
||||||
<th>Telefone</th>
|
<th>Email</th>
|
||||||
|
<th>CPF</th>
|
||||||
<th>Telefone</th>
|
<th>Telefone</th>
|
||||||
<th>Entrou na fila de espera</th>
|
<th>Entrou na fila de espera</th>
|
||||||
<th>Ações</th>
|
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{filaEsperaData.map((item, index) => (
|
{filteredFila.map((item, index) => (
|
||||||
<tr key={index}>
|
<tr key={index}>
|
||||||
<td> <p>{item.Infos?.paciente_nome} </p> </td>
|
<td>{item.nome}</td>
|
||||||
<td><p>{} </p></td>
|
<td>{item.email}</td>
|
||||||
<td>{}</td>
|
<td>{item.cpf}</td>
|
||||||
<td>{}</td>
|
<td>{item.telefone}</td>
|
||||||
<td> <div className="d-flex gap-2">
|
<td>{item.entrada}</td>
|
||||||
|
|
||||||
<button className="btn btn-sm btn-edit"
|
|
||||||
onClick={() => {
|
|
||||||
console.log(item, 'item')
|
|
||||||
navigate(`${2}/edit`)
|
|
||||||
setDictInfo(item)
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<i className="bi bi-pencil me-1"></i> Editar
|
|
||||||
</button>
|
|
||||||
|
|
||||||
|
|
||||||
<button
|
|
||||||
className="btn btn-sm btn-delete"
|
|
||||||
onClick={() => {
|
|
||||||
setSelectedId(item.agendamento.id)
|
|
||||||
setShowDeleteModal(true);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<i className="bi bi-trash me-1"></i> Excluir
|
|
||||||
</button>
|
|
||||||
</div></td>
|
|
||||||
</tr>
|
</tr>
|
||||||
))}
|
))}
|
||||||
</tbody>
|
</tbody>
|
||||||
@ -484,7 +429,7 @@ const handleSearchMedicos = (term) => {
|
|||||||
|
|
||||||
<div className="modal-body">
|
<div className="modal-body">
|
||||||
<p className="mb-0 fs-5">
|
<p className="mb-0 fs-5">
|
||||||
Tem certeza que deseja excluir este agendamento?
|
Tem certeza que deseja excluir este paciente?
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -502,8 +447,7 @@ const handleSearchMedicos = (term) => {
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className="btn btn-danger"
|
className="btn btn-danger"
|
||||||
onClick={() => {deleteConsulta(selectedID);setShowDeleteModal(false)}}
|
//onClick={() => deletePatient(selectedPatientId)}
|
||||||
|
|
||||||
>
|
>
|
||||||
<i className="bi bi-trash me-1"></i> Excluir
|
<i className="bi bi-trash me-1"></i> Excluir
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@ -2,33 +2,17 @@ import React from 'react'
|
|||||||
import FormNovaConsulta from '../components/AgendarConsulta/FormNovaConsulta'
|
import FormNovaConsulta from '../components/AgendarConsulta/FormNovaConsulta'
|
||||||
import API_KEY from '../components/utils/apiKeys'
|
import API_KEY from '../components/utils/apiKeys'
|
||||||
import { useAuth } from '../components/utils/AuthProvider'
|
import { useAuth } from '../components/utils/AuthProvider'
|
||||||
import { useEffect,useState } from 'react'
|
import { useState } from 'react'
|
||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
import { UserInfos } from '../components/utils/Functions-Endpoints/General'
|
|
||||||
const AgendamentoCadastroManager = () => {
|
const AgendamentoCadastroManager = () => {
|
||||||
|
|
||||||
const {getAuthorizationHeader} = useAuth()
|
const {getAuthorizationHeader} = useAuth()
|
||||||
const [agendamento, setAgendamento] = useState({status:'confirmed'})
|
const [agendamento, setAgendamento] = useState({})
|
||||||
const [idUsuario, setIDusuario] = useState('0')
|
|
||||||
|
|
||||||
let authHeader = getAuthorizationHeader()
|
let authHeader = getAuthorizationHeader()
|
||||||
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
|
|
||||||
const ColherInfoUsuario =async () => {
|
|
||||||
const result = await UserInfos(authHeader)
|
|
||||||
|
|
||||||
setIDusuario(result?.profile?.id)
|
|
||||||
|
|
||||||
}
|
|
||||||
ColherInfoUsuario()
|
|
||||||
|
|
||||||
|
|
||||||
}, [])
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const handleSave = (Dict) => {
|
const handleSave = (Dict) => {
|
||||||
let DataAtual = dayjs()
|
let DataAtual = dayjs()
|
||||||
var myHeaders = new Headers();
|
var myHeaders = new Headers();
|
||||||
@ -39,14 +23,13 @@ const AgendamentoCadastroManager = () => {
|
|||||||
var raw = JSON.stringify({
|
var raw = JSON.stringify({
|
||||||
"patient_id": Dict.patient_id,
|
"patient_id": Dict.patient_id,
|
||||||
"doctor_id": Dict.doctor_id,
|
"doctor_id": Dict.doctor_id,
|
||||||
"scheduled_at": `${Dict.dataAtendimento}T${Dict.horarioInicio}:00.000Z`,
|
"scheduled_at": DataAtual,
|
||||||
"duration_minutes": 30,
|
"duration_minutes": 30,
|
||||||
"appointment_type": Dict.tipo_consulta,
|
"appointment_type": "presencial",
|
||||||
|
"chief_complaint": "Dor de cabeça há 3 ",
|
||||||
"patient_notes": "Prefiro horário pela manhã",
|
"patient_notes": "Prefiro horário pela manhã",
|
||||||
"insurance_provider": Dict.convenio,
|
"insurance_provider": "Unimed",
|
||||||
"status": Dict.status,
|
"created_by": "87f2662c-9da7-45c0-9e05-521d9d92d105"
|
||||||
"created_by": idUsuario
|
|
||||||
});
|
});
|
||||||
|
|
||||||
var requestOptions = {
|
var requestOptions = {
|
||||||
|
|||||||
@ -1,41 +1,22 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import FormNovaConsulta from '../components/AgendarConsulta/FormNovaConsulta'
|
import FormNovaConsulta from '../components/AgendarConsulta/FormNovaConsulta'
|
||||||
import { useState, useEffect } from 'react'
|
import { useState } from 'react'
|
||||||
import { useParams } from 'react-router-dom'
|
import { useParams } from 'react-router-dom'
|
||||||
import API_KEY from '../components/utils/apiKeys'
|
import API_KEY from '../components/utils/apiKeys'
|
||||||
import { useAuth } from '../components/utils/AuthProvider'
|
import { useAuth } from '../components/utils/AuthProvider'
|
||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
import { UserInfos } from '../components/utils/Functions-Endpoints/General'
|
|
||||||
|
|
||||||
const AgendamentoEditPage = ({setDictInfo, DictInfo}) => {
|
|
||||||
|
|
||||||
const [idUsuario, setIDusuario] = useState('0')
|
const AgendamentoEditPage = () => {
|
||||||
//let DataAtual = dayjs()
|
|
||||||
|
let DataAtual = dayjs()
|
||||||
const {getAuthorizationHeader} = useAuth()
|
const {getAuthorizationHeader} = useAuth()
|
||||||
const params = useParams()
|
const params = useParams()
|
||||||
const [PatientToPatch, setPatientToPatch] = useState({})
|
const [PatientToPatch, setPatientToPatch] = useState({})
|
||||||
|
|
||||||
let id = params.id
|
let id = params.id
|
||||||
|
|
||||||
//console.log(DictInfo, 'aqui')
|
console.log(id)
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
setDictInfo({...DictInfo?.Infos,...DictInfo?.agendamento})
|
|
||||||
|
|
||||||
|
|
||||||
const ColherInfoUsuario =async () => {
|
|
||||||
const result = await UserInfos(authHeader)
|
|
||||||
|
|
||||||
setIDusuario(result?.profile?.id)
|
|
||||||
|
|
||||||
}
|
|
||||||
ColherInfoUsuario()
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}, [])
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
let authHeader = getAuthorizationHeader()
|
let authHeader = getAuthorizationHeader()
|
||||||
|
|
||||||
@ -49,21 +30,13 @@ const AgendamentoEditPage = ({setDictInfo, DictInfo}) => {
|
|||||||
|
|
||||||
var raw = JSON.stringify({"patient_id": DictParaPatch.patient_id,
|
var raw = JSON.stringify({"patient_id": DictParaPatch.patient_id,
|
||||||
"doctor_id": DictParaPatch.doctor_id,
|
"doctor_id": DictParaPatch.doctor_id,
|
||||||
|
"scheduled_at": DataAtual,
|
||||||
"duration_minutes": 30,
|
"duration_minutes": 30,
|
||||||
|
"appointment_type": "presencial",
|
||||||
"chief_complaint": "Dor de cabeça há 3 ",
|
"chief_complaint": "Dor de cabeça há 3 ",
|
||||||
|
|
||||||
"created_by": idUsuario,
|
|
||||||
|
|
||||||
"scheduled_at": `${DictParaPatch.dataAtendimento}T${DictParaPatch.horarioInicio}:00.000Z`,
|
|
||||||
|
|
||||||
"appointment_type": DictParaPatch.tipo_consulta,
|
|
||||||
|
|
||||||
"patient_notes": "Prefiro horário pela manhã",
|
"patient_notes": "Prefiro horário pela manhã",
|
||||||
"insurance_provider": DictParaPatch.convenio,
|
"insurance_provider": "Unimed",
|
||||||
"status": DictParaPatch.status,
|
"created_by": "87f2662c-9da7-45c0-9e05-521d9d92d105"
|
||||||
"created_by": idUsuario
|
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
@ -78,7 +51,7 @@ const AgendamentoEditPage = ({setDictInfo, DictInfo}) => {
|
|||||||
redirect: 'follow'
|
redirect: 'follow'
|
||||||
};
|
};
|
||||||
|
|
||||||
fetch(`https://yuanqfswhberkoevtmfr.supabase.co/rest/v1/appointments?id=eq.${DictInfo.id}`, requestOptions)
|
fetch(`https://yuanqfswhberkoevtmfr.supabase.co/rest/v1/appointments?id=eq.${id}`, requestOptions)
|
||||||
.then(response => response.text())
|
.then(response => response.text())
|
||||||
.then(result => console.log(result))
|
.then(result => console.log(result))
|
||||||
.catch(error => console.log('error', error));
|
.catch(error => console.log('error', error));
|
||||||
@ -87,7 +60,7 @@ const AgendamentoEditPage = ({setDictInfo, DictInfo}) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<FormNovaConsulta onSave={handleSave} agendamento={DictInfo} setAgendamento={setDictInfo}/>
|
<FormNovaConsulta onSave={handleSave} agendamento={PatientToPatch} setAgendamento={setPatientToPatch}/>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -104,7 +104,7 @@ function TableDoctor() {
|
|||||||
|
|
||||||
fetch("https://yuanqfswhberkoevtmfr.supabase.co/rest/v1/doctors", requestOptions)
|
fetch("https://yuanqfswhberkoevtmfr.supabase.co/rest/v1/doctors", requestOptions)
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(result => {setMedicos(result); console.log(result)})
|
.then(result => setMedicos(result))
|
||||||
.catch(error => console.log('error', error));
|
.catch(error => console.log('error', error));
|
||||||
}, [isAuthenticated, getAuthorizationHeader]);
|
}, [isAuthenticated, getAuthorizationHeader]);
|
||||||
|
|
||||||
|
|||||||
@ -91,7 +91,7 @@
|
|||||||
background-color: #2c5e37;
|
background-color: #2c5e37;
|
||||||
}
|
}
|
||||||
|
|
||||||
.legenda-item-confirmed{
|
.legenda-item-confirmado{
|
||||||
background-color: #1e90ff;
|
background-color: #1e90ff;
|
||||||
}
|
}
|
||||||
.legenda-item-cancelado{
|
.legenda-item-cancelado{
|
||||||
@ -102,7 +102,7 @@
|
|||||||
background-color: #f0ad4e;
|
background-color: #f0ad4e;
|
||||||
}
|
}
|
||||||
|
|
||||||
#status-card-consulta-completed, .legenda-item-realizado {
|
#status-card-consulta-realizado, .legenda-item-realizado {
|
||||||
background-color: #b7ffbd;
|
background-color: #b7ffbd;
|
||||||
border:3px solid #91d392;
|
border:3px solid #91d392;
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
@ -110,7 +110,7 @@
|
|||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#status-card-consulta-cancelled, .legenda-item-cancelado {
|
#status-card-consulta-cancelado, .legenda-item-cancelado {
|
||||||
background-color: #ffb7cc;
|
background-color: #ffb7cc;
|
||||||
border:3px solid #ff6c84;
|
border:3px solid #ff6c84;
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
@ -118,7 +118,7 @@
|
|||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#status-card-consulta-confirmed, .legenda-item-confirmed {
|
#status-card-consulta-confirmado, .legenda-item-confirmed {
|
||||||
background-color: #eef8fb;
|
background-color: #eef8fb;
|
||||||
border:3px solid #d8dfe7;
|
border:3px solid #d8dfe7;
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
@ -358,18 +358,26 @@ html[data-bs-theme="dark"] {
|
|||||||
#tabela-seletor-container i {
|
#tabela-seletor-container i {
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
|
/* 1. Contêiner de Limitação de Largura e Posicionamento */
|
||||||
|
/* Este é o elemento mais importante. Ele deve envolver o input e o dropdown. */
|
||||||
.input-e-dropdown-wrapper {
|
.input-e-dropdown-wrapper {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
||||||
|
/* IMPORTANTE: Defina aqui a largura EXATA que você deseja para o input
|
||||||
|
e para o dropdown. Na sua imagem, o input parece ter cerca de 300px ou mais.
|
||||||
|
*/
|
||||||
|
width: 350px; /* Ajuste este valor conforme a largura desejada do seu input */
|
||||||
|
|
||||||
width: 350px;
|
/* Se o input original estava alinhado à direita (como na imagem),
|
||||||
margin-left: auto;
|
você pode precisar de um float ou margin para posicionar este wrapper.
|
||||||
|
*/
|
||||||
|
margin-left: auto; /* Exemplo para alinhar o wrapper à direita se for o caso */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 2. Estilização da Área de Busca (Input) */
|
||||||
|
/* Garante que o input utilize toda a largura do wrapper */
|
||||||
.busca-atendimento {
|
.busca-atendimento {
|
||||||
|
/* ... seus estilos de layout (flex, margin, etc.) para o busca-atendimento, se houver ... */
|
||||||
}
|
}
|
||||||
|
|
||||||
.busca-atendimento > div {
|
.busca-atendimento > div {
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
//import { BrowserRouter as Router, Routes, Route } from "react-router-dom";
|
//import { BrowserRouter as Router, Routes, Route } from "react-router-dom";
|
||||||
import { Routes, Route } from "react-router-dom";
|
import { Routes, Route } from "react-router-dom";
|
||||||
import { useState } from "react";
|
|
||||||
import Sidebar from "../../components/Sidebar";
|
import Sidebar from "../../components/Sidebar";
|
||||||
import FinanceiroDashboard from "../../pages/FinanceiroDashboard";
|
import FinanceiroDashboard from "../../pages/FinanceiroDashboard";
|
||||||
import SecretariaItems from "../../data/sidebar-items-secretaria.json";
|
import SecretariaItems from "../../data/sidebar-items-secretaria.json";
|
||||||
@ -19,7 +19,6 @@ import ExcecoesDisponibilidade from "../../pages/ExcecoesDisponibilidade";
|
|||||||
import AgendamentoEditPage from "../../pages/AgendamentoEditPage";
|
import AgendamentoEditPage from "../../pages/AgendamentoEditPage";
|
||||||
|
|
||||||
function PerfilSecretaria({ onLogout }) {
|
function PerfilSecretaria({ onLogout }) {
|
||||||
const [DictInfo, setDictInfo] = useState({})
|
|
||||||
return (
|
return (
|
||||||
// <Router>
|
// <Router>
|
||||||
<div id="app" className="active">
|
<div id="app" className="active">
|
||||||
@ -35,8 +34,8 @@ function PerfilSecretaria({ onLogout }) {
|
|||||||
<Route path="pacientes/:id/edit" element={<EditPage />} />
|
<Route path="pacientes/:id/edit" element={<EditPage />} />
|
||||||
<Route path="medicos/:id" element={<DoctorDetails />} />
|
<Route path="medicos/:id" element={<DoctorDetails />} />
|
||||||
<Route path="medicos/:id/edit" element={<DoctorEditPage />} />
|
<Route path="medicos/:id/edit" element={<DoctorEditPage />} />
|
||||||
<Route path="agendamento" element={<Agendamento setDictInfo={setDictInfo}/>} />
|
<Route path="agendamento" element={<Agendamento />} />
|
||||||
<Route path="agendamento/:id/edit" element={<AgendamentoEditPage setDictInfo={setDictInfo} DictInfo={DictInfo}/>} />
|
<Route path="agendamento/:id/edit" element={<AgendamentoEditPage/>} />
|
||||||
<Route path="laudo" element={<LaudoManager />} />
|
<Route path="laudo" element={<LaudoManager />} />
|
||||||
<Route path="*" element={<h2>Página não encontrada</h2>} />
|
<Route path="*" element={<h2>Página não encontrada</h2>} />
|
||||||
<Route path="excecoes-disponibilidade" element={<ExcecoesDisponibilidade />} />
|
<Route path="excecoes-disponibilidade" element={<ExcecoesDisponibilidade />} />
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user