forked from RiseUP/riseup-squad23
Melhorias no agendamento
This commit is contained in:
parent
38ebb5f7f3
commit
b0306125ae
@ -15,14 +15,14 @@ const ConsultaEditPage = ({dadosConsulta}) => {
|
|||||||
|
|
||||||
const [idUsuario, setIDusuario] = useState("6e7f8829-0574-42df-9290-8dbb70f75ada")
|
const [idUsuario, setIDusuario] = useState("6e7f8829-0574-42df-9290-8dbb70f75ada")
|
||||||
|
|
||||||
const [DictInfo, setDictInfo] = useState({})
|
const [DictInfo, setDict] = useState({})
|
||||||
|
|
||||||
const [Medico, setMedico] = useState({})
|
const [Medico, setMedico] = useState({})
|
||||||
|
|
||||||
const [Paciente, setPaciente] = useState([])
|
const [Paciente, setPaciente] = useState([])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setDictInfo({...dadosConsulta})
|
setDict({...dadosConsulta})
|
||||||
|
|
||||||
const fetchMedicoePaciente = async () => {
|
const fetchMedicoePaciente = async () => {
|
||||||
console.log(dadosConsulta.doctor_id)
|
console.log(dadosConsulta.doctor_id)
|
||||||
@ -52,7 +52,7 @@ const ConsultaEditPage = ({dadosConsulta}) => {
|
|||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setDictInfo({...DictInfo, medico_nome:Medico?.full_name, dataAtendimento:dadosConsulta.scheduled_at?.split("T")[0]})
|
setDict({...DictInfo, medico_nome:Medico?.full_name, dataAtendimento:dadosConsulta.scheduled_at?.split("T")[0]})
|
||||||
}, [Medico])
|
}, [Medico])
|
||||||
|
|
||||||
|
|
||||||
@ -104,7 +104,7 @@ const ConsultaEditPage = ({dadosConsulta}) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<FormConsultaPaciente agendamento={DictInfo} setAgendamento={setDictInfo} onSave={handleSave}/>
|
<FormConsultaPaciente agendamento={DictInfo} setAgendamento={setDict} onSave={handleSave}/>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,8 +7,6 @@ import "./style/card-consulta.css"
|
|||||||
const CardConsulta = ( {DadosConsulta, TabelaAgendamento, setShowDeleteModal, setDictInfo, setSelectedId} ) => {
|
const CardConsulta = ( {DadosConsulta, TabelaAgendamento, setShowDeleteModal, setDictInfo, setSelectedId} ) => {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
console.log(DadosConsulta, "AQUIIII")
|
|
||||||
|
|
||||||
const {getAuthorizationHeader} = useAuth()
|
const {getAuthorizationHeader} = useAuth()
|
||||||
const authHeader = getAuthorizationHeader()
|
const authHeader = getAuthorizationHeader()
|
||||||
const [Paciente, setPaciente] = useState()
|
const [Paciente, setPaciente] = useState()
|
||||||
|
|||||||
@ -75,7 +75,8 @@ const TabelaAgendamentoSemana = ({ agendamentos, ListarDiasdoMes, setShowDeleteM
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setSemanasOrganizadas(OrganizarAgendamentosSemanais);
|
setSemanasOrganizadas(OrganizarAgendamentosSemanais);
|
||||||
// NOTA: Ao carregar, o Indice é 0, que é a primeira semana.
|
|
||||||
|
//console.log(semanasOrganizadas, `aqui`)
|
||||||
}, [OrganizarAgendamentosSemanais])
|
}, [OrganizarAgendamentosSemanais])
|
||||||
|
|
||||||
// --- NOVAS FUNÇÕES DE NAVEGAÇÃO ---
|
// --- NOVAS FUNÇÕES DE NAVEGAÇÃO ---
|
||||||
@ -156,10 +157,22 @@ const TabelaAgendamentoSemana = ({ agendamentos, ListarDiasdoMes, setShowDeleteM
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{indicesDeLinha.map((indiceLinha) => (
|
{indicesDeLinha.map((indiceLinha) => {
|
||||||
|
|
||||||
|
let schedulet_at = semanaParaRenderizar.segunda[indiceLinha].scheduled_at.split("T")
|
||||||
|
|
||||||
|
let horario = schedulet_at[1].split(":")
|
||||||
|
|
||||||
|
console.log(horario)
|
||||||
|
|
||||||
|
return(
|
||||||
<tr key={indiceLinha}>
|
<tr key={indiceLinha}>
|
||||||
{/* Célula para Horário (Pode ser ajustado para mostrar o horário real) */}
|
{/* Célula para Horário (Pode ser ajustado para mostrar o horário real) */}
|
||||||
<td></td>
|
<td>
|
||||||
|
|
||||||
|
<p className='horario-texto'> {`${horario[0]}:${horario[1]}`} </p>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
|
||||||
{/* Mapeamento de COLUNAS (dias) */}
|
{/* Mapeamento de COLUNAS (dias) */}
|
||||||
<td>
|
<td>
|
||||||
@ -193,7 +206,7 @@ const TabelaAgendamentoSemana = ({ agendamentos, ListarDiasdoMes, setShowDeleteM
|
|||||||
}
|
}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
))}
|
)})}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -1,15 +1,6 @@
|
|||||||
<<<<<<< HEAD
|
|
||||||
import API_KEY from "../apiKeys";
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const GetDoctorByID = async (ID,authHeader) => {
|
|
||||||
|
|
||||||
=======
|
|
||||||
import API_KEY from '../apiKeys';
|
import API_KEY from '../apiKeys';
|
||||||
|
|
||||||
const GetDoctorByID = async (ID, authHeader) => {
|
const GetDoctorByID = async (ID, authHeader) => {
|
||||||
>>>>>>> perfillogin
|
|
||||||
var myHeaders = new Headers();
|
var myHeaders = new Headers();
|
||||||
myHeaders.append('apikey', API_KEY);
|
myHeaders.append('apikey', API_KEY);
|
||||||
if (authHeader) myHeaders.append('Authorization', authHeader);
|
if (authHeader) myHeaders.append('Authorization', authHeader);
|
||||||
@ -20,19 +11,7 @@ const GetDoctorByID = async (ID, authHeader) => {
|
|||||||
return DictMedico;
|
return DictMedico;
|
||||||
};
|
};
|
||||||
|
|
||||||
const GetAllDoctors = async (authHeader) => {
|
|
||||||
var myHeaders = new Headers();
|
|
||||||
myHeaders.append('apikey', API_KEY);
|
|
||||||
if (authHeader) myHeaders.append('Authorization', authHeader);
|
|
||||||
|
|
||||||
const requestOptions = { method: 'GET', headers: myHeaders, redirect: 'follow' };
|
|
||||||
const res = await fetch('https://yuanqfswhberkoevtmfr.supabase.co/rest/v1/doctors?select=id,full_name,crm&limit=500', requestOptions);
|
|
||||||
const DictMedicos = await res.json();
|
|
||||||
return DictMedicos;
|
|
||||||
};
|
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
}
|
|
||||||
|
|
||||||
const GetAllDoctors = async (authHeader) => {
|
const GetAllDoctors = async (authHeader) => {
|
||||||
var myHeaders = new Headers();
|
var myHeaders = new Headers();
|
||||||
@ -67,6 +46,3 @@ const GetDoctorByName = async (nome, authHeader) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export {GetDoctorByID, GetDoctorByName, GetAllDoctors}
|
export {GetDoctorByID, GetDoctorByName, GetAllDoctors}
|
||||||
=======
|
|
||||||
export { GetDoctorByID, GetAllDoctors };
|
|
||||||
>>>>>>> perfillogin
|
|
||||||
|
|||||||
@ -155,22 +155,28 @@ const Agendamento = ({setDictInfo}) => {
|
|||||||
}, [FiltredTodosMedicos]);
|
}, [FiltredTodosMedicos]);
|
||||||
|
|
||||||
const deleteConsulta = (selectedPatientId) => {
|
const deleteConsulta = (selectedPatientId) => {
|
||||||
console.log("tentando apagar")
|
var myHeaders = new Headers();
|
||||||
var myHeaders = new Headers();
|
myHeaders.append("Content-Type", "application/json");
|
||||||
myHeaders.append("Authorization", authHeader);
|
myHeaders.append('apikey', API_KEY)
|
||||||
myHeaders.append("apikey", API_KEY)
|
myHeaders.append("authorization", authHeader)
|
||||||
|
|
||||||
|
|
||||||
|
var raw = JSON.stringify({ "status":"cancelled"
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
var requestOptions = {
|
||||||
|
method: 'PATCH',
|
||||||
|
headers: myHeaders,
|
||||||
|
body: raw,
|
||||||
|
redirect: 'follow'
|
||||||
|
};
|
||||||
|
|
||||||
|
fetch(`https://yuanqfswhberkoevtmfr.supabase.co/rest/v1/appointments?id=eq.${selectedPatientId}`, requestOptions)
|
||||||
|
.then(response => {if(response.status !== 200)(console.log(response))})
|
||||||
|
.then(result => console.log(result))
|
||||||
|
.catch(error => console.log('error', error));
|
||||||
|
|
||||||
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));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const filtrarAgendamentosPorMedico = (dictAgendamentos, idMedicoFiltrado) => {
|
const filtrarAgendamentosPorMedico = (dictAgendamentos, idMedicoFiltrado) => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user