Adições finais
This commit is contained in:
parent
46104c7b24
commit
0b47a96589
@ -6,18 +6,58 @@
|
||||
/* --- Posiciona a barra de busca corretamente --- */
|
||||
.busca-atendimento {
|
||||
display: flex;
|
||||
align-items: center; /* Alinha os itens verticalmente */
|
||||
margin-top: 20px; /* Espaço acima da barra de busca */
|
||||
padding: 0 10px; /* Adiciona um padding lateral para alinhar com o resto */
|
||||
align-items: center;
|
||||
margin-top: 20px;
|
||||
padding: 0 10px;
|
||||
gap: 15px;
|
||||
}
|
||||
|
||||
.busca-atendimento > div:first-child {
|
||||
width: 400px; /* Define um tamanho para a barra de pesquisa */
|
||||
width: 400px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.busca-atendimento {
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.busca-atendimento > div:first-child {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.btns-e-legenda-container {
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.legenda-tabela {
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 576px) {
|
||||
.busca-atendimento {
|
||||
padding: 0 5px;
|
||||
}
|
||||
|
||||
.btns-e-legenda-container {
|
||||
padding: 0 5px;
|
||||
}
|
||||
|
||||
.btn-selecionar-tabeladia,
|
||||
.btn-selecionar-tabelasemana,
|
||||
.btn-selecionar-tabelames {
|
||||
padding: 6px 8px;
|
||||
font-size: medium;
|
||||
}
|
||||
}
|
||||
|
||||
.busca-atendimento input {
|
||||
margin-left: 8px;
|
||||
border-radius: 8px;
|
||||
@ -126,13 +166,20 @@
|
||||
}
|
||||
|
||||
.container-btns-agenda-fila_esepera {
|
||||
margin-top: 30px;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
align-items: flex-end;
|
||||
gap: 20px;
|
||||
margin-left: 20px;
|
||||
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
margin-left: 0;
|
||||
padding: 0 20px 0;
|
||||
border-bottom: 1px solid #edf1f7;
|
||||
}
|
||||
|
||||
|
||||
.btn-fila-espera,
|
||||
.btn-agenda {
|
||||
background-color: transparent;
|
||||
@ -140,6 +187,7 @@
|
||||
border-bottom: 3px solid transparent;
|
||||
padding: 8px;
|
||||
border-radius: 10px 10px 0px 0px;
|
||||
color: #fff;
|
||||
font-weight: bold;
|
||||
cursor: pointer;
|
||||
}
|
||||
@ -229,3 +277,9 @@ html[data-bs-theme="dark"] .legenda-item-agendado {
|
||||
border: 3px solid #4d4d2e;
|
||||
color: #f7f7c4;
|
||||
}
|
||||
.calendar-legend {
|
||||
margin-top: 8px;
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
justify-content: center;
|
||||
}
|
||||
@ -223,6 +223,8 @@
|
||||
z-index: 2001;
|
||||
margin-top: 80px;
|
||||
margin-right: 20px;
|
||||
/* Adicionado para responsividade */
|
||||
max-width: 90vw;
|
||||
}
|
||||
|
||||
.suporte-card {
|
||||
@ -309,6 +311,8 @@
|
||||
z-index: 3001;
|
||||
margin-top: 80px;
|
||||
margin-right: 20px;
|
||||
/* Adicionado para responsividade */
|
||||
max-width: 90vw;
|
||||
}
|
||||
|
||||
.chat-online {
|
||||
@ -478,6 +482,7 @@
|
||||
|
||||
.suporte-card-container,
|
||||
.chat-container {
|
||||
margin-top: 60px;
|
||||
margin-right: 10px;
|
||||
margin-left: 10px;
|
||||
}
|
||||
@ -489,28 +494,101 @@
|
||||
}
|
||||
}
|
||||
|
||||
/* permite que cliques "passem" através do header (exceto para os elementos interativos) */
|
||||
.header-container {
|
||||
pointer-events: none; /* header não captura cliques */
|
||||
@media (max-width: 576px) {
|
||||
.header-container {
|
||||
padding: 8px 10px;
|
||||
}
|
||||
|
||||
.right-corner-elements {
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.profile-picture-container {
|
||||
width: 35px;
|
||||
height: 35px;
|
||||
}
|
||||
|
||||
.phone-icon-container {
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
.suporte-card-container,
|
||||
.chat-container {
|
||||
margin-top: 50px;
|
||||
margin-right: 5px;
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
.suporte-card {
|
||||
padding: 1rem;
|
||||
}
|
||||
|
||||
.chat-online {
|
||||
width: calc(100vw - 10px);
|
||||
height: 80vh; /* Limita a altura para telas pequenas */
|
||||
}
|
||||
|
||||
.chat-input {
|
||||
padding: 0.75rem;
|
||||
}
|
||||
|
||||
.chat-campo {
|
||||
padding: 0.5rem;
|
||||
}
|
||||
|
||||
.chat-enviar {
|
||||
padding: 0.5rem 1rem;
|
||||
}
|
||||
}
|
||||
|
||||
/* mas permite que os controles no canto (telefone e profile) continuem clicáveis */
|
||||
@media (max-width: 768px) {
|
||||
.header-container {
|
||||
padding: 10px 15px;
|
||||
}
|
||||
|
||||
.right-corner-elements {
|
||||
gap: 15px;
|
||||
}
|
||||
|
||||
.profile-picture-container {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
.suporte-card-container,
|
||||
.chat-container {
|
||||
margin-right: 10px;
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
.suporte-card,
|
||||
.chat-online {
|
||||
width: calc(100vw - 20px);
|
||||
max-width: none;
|
||||
}
|
||||
}
|
||||
|
||||
.header-container {
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
|
||||
.phone-icon-container,
|
||||
.profile-section {
|
||||
pointer-events: auto;
|
||||
}
|
||||
|
||||
/* Garantir pointer-events nos elementos do header e overlays criados por portal */
|
||||
|
||||
.header-container { pointer-events: auto; }
|
||||
.phone-icon-container, .profile-section { pointer-events: auto; }
|
||||
|
||||
/* Força que os overlays criados por portal fiquem por cima */
|
||||
|
||||
.logout-modal-overlay, .suporte-card-overlay, .chat-overlay {
|
||||
z-index: 110000 !important;
|
||||
pointer-events: auto !important;
|
||||
}
|
||||
|
||||
/* Pequeno ajuste visual dos botões do modal (pode se misturar com seu CSS atual) */
|
||||
|
||||
.logout-cancel-button {
|
||||
padding: 10px 18px;
|
||||
border-radius: 8px;
|
||||
|
||||
@ -1,4 +1,12 @@
|
||||
/* card-consulta.css */
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.container-cardconsulta {
|
||||
padding-right: 80px; /* Espaço para os botões */
|
||||
position: relative;
|
||||
}
|
||||
}
|
||||
|
||||
.actions-container {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
@ -86,3 +94,49 @@
|
||||
width: 24rem;
|
||||
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.actions-container {
|
||||
opacity: 1;
|
||||
visibility: visible;
|
||||
background: none;
|
||||
backdrop-filter: none;
|
||||
-webkit-backdrop-filter: none;
|
||||
border: none;
|
||||
box-shadow: none;
|
||||
margin-left: 0;
|
||||
padding: 0;
|
||||
justify-content: flex-end;
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
right: 10px;
|
||||
}
|
||||
|
||||
.container-cardconsulta:hover .actions-container {
|
||||
transform: none;
|
||||
}
|
||||
|
||||
.tabelamensal .container-cardconsulta {
|
||||
width: 100%;
|
||||
max-width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 576px) {
|
||||
.container-cardconsulta {
|
||||
padding-right: 10px; /* Remove o padding extra para telas muito pequenas */
|
||||
}
|
||||
|
||||
.actions-container {
|
||||
position: static;
|
||||
margin-top: 10px;
|
||||
justify-content: flex-start;
|
||||
}
|
||||
|
||||
.btn-edit-custom-style,
|
||||
.btn-delete-custom-style,
|
||||
.btn-confirm-style {
|
||||
padding: 6px 10px;
|
||||
font-size: 0.8rem;
|
||||
}
|
||||
}
|
||||
@ -1,3 +1,5 @@
|
||||
/* formagendamentos.css */
|
||||
|
||||
@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined');
|
||||
|
||||
.icons-container {
|
||||
@ -183,6 +185,67 @@ textarea{
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.campos-informacoes-paciente,
|
||||
.campo-informacoes-atendimento {
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
#informacoes-atendimento-segunda-linha {
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
#informacoes-atendimento-segunda-linha-esquerda select[name="unidade"],
|
||||
input[type="time"],
|
||||
select[name=solicitante],
|
||||
.campo-de-input {
|
||||
width: 100% !important;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.tipo_atendimento {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
.linha {
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.sessao-contador {
|
||||
width: 100px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 576px) {
|
||||
.form-container {
|
||||
padding: 15px;
|
||||
}
|
||||
|
||||
.form-title {
|
||||
font-size: 22px;
|
||||
}
|
||||
|
||||
.form-agendamento input,
|
||||
.form-agendamento select,
|
||||
.form-agendamento textarea {
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.form-actions {
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.btn-primary,
|
||||
.btn-cancel {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.campo-de-input {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
@ -690,3 +753,93 @@ input[name="paciente_cpf"]{
|
||||
max-height: 200px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
#informacoes-atendimento-segunda-linha .linha-horarios {
|
||||
display: flex;
|
||||
gap: 16px;
|
||||
align-items: flex-end; /* alinha pela base dos inputs */
|
||||
}
|
||||
|
||||
#informacoes-atendimento-segunda-linha .linha-horarios .campo-de-input {
|
||||
flex: 1;
|
||||
}
|
||||
.campo-de-input-container {
|
||||
display: flex;
|
||||
gap: 16px; /* nome e cpf na mesma linha */
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.campo-de-input {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.campo-de-input label {
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.campo-de-input input,
|
||||
.campo-de-input select,
|
||||
.campo-de-input textarea {
|
||||
width: 220px; /* ajuste pro layout que você quer */
|
||||
padding: 6px 10px;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 3px;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
/* placeholder visível e suave */
|
||||
.campo-de-input input::placeholder {
|
||||
color: #999;
|
||||
opacity: 1; /* garante no Firefox */
|
||||
}
|
||||
/* bloco da coluna esquerda (Data, Início, Término) */
|
||||
#informacoes-atendimento-segunda-linha-esquerda {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
/* linha com Início e Término */
|
||||
#informacoes-atendimento-segunda-linha-esquerda .linha {
|
||||
display: flex;
|
||||
gap: 16px;
|
||||
align-items: flex-end;
|
||||
}
|
||||
|
||||
/* mesma largura pros três campos */
|
||||
#informacoes-atendimento-segunda-linha-esquerda .campo-de-input input,
|
||||
#informacoes-atendimento-segunda-linha-esquerda .campo-de-input select {
|
||||
width: 230px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.informacoes-atendimento-segunda-linha-direita {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.informacoes-atendimento-segunda-linha-direita .campo-de-input textarea {
|
||||
width: 100%; /* ocupa toda a coluna da direita */
|
||||
min-height: 150px; /* aumenta a altura (muda pra 200, 250 se quiser maior) */
|
||||
resize: vertical;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
#informacoes-atendimento-segunda-linha {
|
||||
display: grid;
|
||||
grid-template-columns: auto 1.8fr; /* coluna da direita grande, mas não infinita */
|
||||
gap: 24px;
|
||||
}
|
||||
|
||||
/* garante que o container da direita não estoure */
|
||||
.informacoes-atendimento-segunda-linha-direita {
|
||||
max-width: 800px; /* ajusta se quiser menor/maior */
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.informacoes-atendimento-segunda-linha-direita .campo-de-input textarea {
|
||||
width: 100%;
|
||||
min-height: 150px;
|
||||
resize: vertical;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
@ -1,14 +1,72 @@
|
||||
/* PagesPaciente/style.css */
|
||||
|
||||
/* Estilo geral do card para agrupar e dar um formato */
|
||||
.card-consulta {
|
||||
background-color: #007bff; /* Um tom de azul padrão */
|
||||
display: flex; /* Para colocar horário e info lado a lado */
|
||||
border-radius: 10px; /* Cantos arredondados */
|
||||
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); /* Sombra suave */
|
||||
overflow: hidden; /* Garante que o fundo azul não 'vaze' */
|
||||
/* width: 280px; /* Largura de exemplo */
|
||||
background-color: #007bff;
|
||||
display: flex;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
||||
overflow: hidden;
|
||||
margin: 20px;
|
||||
font-family: Arial, sans-serif; /* Fonte legível */
|
||||
font-family: Arial, sans-serif;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.card-consulta {
|
||||
flex-direction: column;
|
||||
margin: 10px;
|
||||
}
|
||||
|
||||
.horario-container {
|
||||
border-right: none;
|
||||
border-bottom: 1px solid #0056b3;
|
||||
padding: 10px 15px;
|
||||
}
|
||||
|
||||
.horario {
|
||||
font-size: 1.8em;
|
||||
}
|
||||
|
||||
.info-container {
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
gap: 1rem;
|
||||
padding: 15px;
|
||||
}
|
||||
|
||||
.actions-container {
|
||||
opacity: 1;
|
||||
visibility: visible;
|
||||
background: none;
|
||||
backdrop-filter: none;
|
||||
-webkit-backdrop-filter: none;
|
||||
border: none;
|
||||
box-shadow: none;
|
||||
margin-left: 0;
|
||||
padding: 0;
|
||||
justify-content: flex-start;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.card-consulta:hover .actions-container {
|
||||
transform: none;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 576px) {
|
||||
.horario {
|
||||
font-size: 1.5em;
|
||||
}
|
||||
|
||||
.informacao {
|
||||
font-size: 1em;
|
||||
}
|
||||
|
||||
.btn-edit-custom-style,
|
||||
.btn-delete-custom-style {
|
||||
padding: 6px 10px;
|
||||
font-size: 0.8rem;
|
||||
}
|
||||
}
|
||||
|
||||
/* 1. Estilo para o Horário (Fundo Azul e Texto Branco/Grande) */
|
||||
|
||||
@ -1,3 +1,9 @@
|
||||
*,
|
||||
*::before,
|
||||
*::after {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
|
||||
|
||||
@ -7,7 +7,6 @@
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
|
||||
.dashboard-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
@ -35,143 +34,133 @@
|
||||
border: none;
|
||||
border-radius: 8px;
|
||||
font-size: 1rem;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
transition: background-color 0.3s, transform 0.25s ease, box-shadow 0.25s ease;
|
||||
transition: all 0.3s ease;
|
||||
box-shadow: 0 2px 8px rgba(30, 58, 138, 0.3);
|
||||
}
|
||||
|
||||
.new-user-btn:hover {
|
||||
background-color: #162d6b;
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0px 4px 12px rgba(30, 58, 138, 0.3);
|
||||
box-shadow: 0 4px 12px rgba(30, 58, 138, 0.4);
|
||||
}
|
||||
|
||||
|
||||
.filters-container {
|
||||
background: #fff;
|
||||
border-radius: 12px;
|
||||
padding: 1.5rem;
|
||||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
||||
padding: 1.2rem;
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
||||
margin-bottom: 2rem;
|
||||
transition: transform 0.2s ease, box-shadow 0.2s ease;
|
||||
}
|
||||
|
||||
.filters-container:hover {
|
||||
transform: translateY(-3px);
|
||||
box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
|
||||
}
|
||||
|
||||
.filters-title {
|
||||
font-size: 18px;
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
margin-bottom: 0.3rem;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.filters-subtitle {
|
||||
font-size: 0.9rem;
|
||||
font-size: 0.85rem;
|
||||
color: #666;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.filters-content {
|
||||
display: flex;
|
||||
gap: 1rem;
|
||||
gap: 0.8rem;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.filters-input {
|
||||
flex: 1;
|
||||
padding: 0.6rem 1rem;
|
||||
padding: 0.5rem 0.8rem;
|
||||
border: 1px solid #d1d5db;
|
||||
border-radius: 8px;
|
||||
font-size: 0.95rem;
|
||||
border-radius: 6px;
|
||||
font-size: 0.9rem;
|
||||
color: #333;
|
||||
transition: border-color 0.2s, box-shadow 0.2s;
|
||||
min-width: 200px;
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
|
||||
.filters-input:focus {
|
||||
border-color: #1e3a8a;
|
||||
box-shadow: 0px 0px 0px 3px rgba(30, 58, 138, 0.2);
|
||||
box-shadow: 0 0 0 2px rgba(30, 58, 138, 0.1);
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.filters-select {
|
||||
padding: 0.6rem 1rem;
|
||||
padding: 0.5rem 0.8rem;
|
||||
border: 1px solid #d1d5db;
|
||||
border-radius: 8px;
|
||||
font-size: 0.95rem;
|
||||
border-radius: 6px;
|
||||
font-size: 0.9rem;
|
||||
background: #fff;
|
||||
color: #333;
|
||||
cursor: pointer;
|
||||
transition: border-color 0.2s, box-shadow 0.2s;
|
||||
min-width: 140px;
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
|
||||
.filters-select:focus {
|
||||
border-color: #1e3a8a;
|
||||
box-shadow: 0px 0px 0px 3px rgba(30, 58, 138, 0.2);
|
||||
box-shadow: 0 0 0 2px rgba(30, 58, 138, 0.1);
|
||||
outline: none;
|
||||
}
|
||||
|
||||
|
||||
.cards-container {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
||||
gap: 1.5rem;
|
||||
gap: 1.2rem;
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
|
||||
.card {
|
||||
background-color: white;
|
||||
padding: 1.5rem;
|
||||
border-radius: 12px;
|
||||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
||||
padding: 1.2rem;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
|
||||
border: 1px solid transparent;
|
||||
transition: transform 0.25s ease, box-shadow 0.25s ease, border 0.25s ease, background 0.25s ease;
|
||||
transition: all 0.25s ease;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.highlight:hover {
|
||||
transform: translateY(-6px);
|
||||
box-shadow: 0 8px 20px rgba(30, 58, 138, 0.2);
|
||||
transform: translateY(-4px);
|
||||
box-shadow: 0 6px 16px rgba(30, 58, 138, 0.2);
|
||||
background: #f8faff;
|
||||
border: 1px solid #1e3a8a33;
|
||||
}
|
||||
|
||||
.card-label {
|
||||
font-size: 0.9rem;
|
||||
font-size: 0.85rem;
|
||||
color: #999;
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
.card-value {
|
||||
font-size: 1.8rem;
|
||||
font-size: 1.6rem;
|
||||
font-weight: bold;
|
||||
margin: 0;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.card-extra {
|
||||
font-size: 0.85rem;
|
||||
font-size: 0.8rem;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.card-extra.positive {
|
||||
color: #1e3a8a;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
|
||||
.user-table-container {
|
||||
background: #fff;
|
||||
border-radius: 12px;
|
||||
padding: 1.5rem;
|
||||
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
|
||||
padding: 1.2rem;
|
||||
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
|
||||
margin-top: 2rem;
|
||||
transition: transform 0.25s ease, box-shadow 0.25s ease;
|
||||
}
|
||||
|
||||
.user-table-container:hover {
|
||||
transform: translateY(-4px);
|
||||
box-shadow: 0 6px 14px rgba(0,0,0,0.15);
|
||||
}
|
||||
|
||||
.user-table-container h2 {
|
||||
@ -194,7 +183,7 @@
|
||||
|
||||
.user-table th,
|
||||
.user-table td {
|
||||
padding: 12px 15px;
|
||||
padding: 10px 12px;
|
||||
text-align: left;
|
||||
border-bottom: 1px solid #e0e0e0;
|
||||
}
|
||||
@ -203,10 +192,11 @@
|
||||
background-color: #f3f4f6;
|
||||
color: #333;
|
||||
font-weight: 600;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.user-table tr {
|
||||
transition: background-color 0.25s ease;
|
||||
transition: background-color 0.2s ease;
|
||||
}
|
||||
|
||||
.user-table tr:hover {
|
||||
@ -215,44 +205,115 @@
|
||||
|
||||
.profile-badge {
|
||||
background-color: #1e3a8a;
|
||||
color: #f7f7f7;
|
||||
padding: 3px 8px;
|
||||
border-radius: 8px;
|
||||
font-size: 0.85rem;
|
||||
color: white;
|
||||
padding: 4px 10px;
|
||||
border-radius: 6px;
|
||||
font-size: 0.8rem;
|
||||
font-weight: 500;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.status-badge {
|
||||
padding: 3px 8px;
|
||||
border-radius: 8px;
|
||||
font-size: 0.85rem;
|
||||
padding: 4px 10px;
|
||||
border-radius: 6px;
|
||||
font-size: 0.8rem;
|
||||
color: #fff;
|
||||
font-weight: 500;
|
||||
display: inline-block;
|
||||
text-transform: capitalize;
|
||||
}
|
||||
|
||||
.status-badge.ativo {
|
||||
background-color: #28a745;
|
||||
background-color: #1e3a8a;
|
||||
}
|
||||
|
||||
.status-badge.inativo {
|
||||
background-color: #dc3545;
|
||||
background-color: #6c757d;
|
||||
}
|
||||
|
||||
.actions {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
gap: 8px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.action-icon {
|
||||
.action-btn {
|
||||
border: none;
|
||||
padding: 6px 12px;
|
||||
font-size: 0.8rem;
|
||||
font-weight: 500;
|
||||
cursor: pointer;
|
||||
color: #555;
|
||||
transition: color 0.2s, transform 0.2s;
|
||||
transition: all 0.2s ease;
|
||||
border-radius: 4px;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.action-icon:hover {
|
||||
color: #1e3a8a;
|
||||
transform: scale(1.2);
|
||||
.action-btn.detalhes {
|
||||
background-color: #e6f2ff;
|
||||
color: #004085;
|
||||
border: 1px solid #b8d4ff;
|
||||
}
|
||||
|
||||
.action-btn.detalhes:hover {
|
||||
background-color: #cce4ff;
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
|
||||
.action-btn.editar {
|
||||
background-color: #fff3cd;
|
||||
color: #856405;
|
||||
border: 1px solid #ffeaa7;
|
||||
}
|
||||
|
||||
.action-btn.editar:hover {
|
||||
background-color: #ffeaa7;
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
|
||||
.action-btn.excluir {
|
||||
background-color: #f8d7da;
|
||||
color: #721c24;
|
||||
border: 1px solid #f1b0b7;
|
||||
}
|
||||
|
||||
.action-btn.excluir:hover {
|
||||
background-color: #f1b0b7;
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
|
||||
.save-btn {
|
||||
background-color: #1e3a8a;
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 8px 16px;
|
||||
border-radius: 6px;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.save-btn:hover {
|
||||
background-color: #162d6b;
|
||||
transform: translateY(-1px);
|
||||
box-shadow: 0 4px 8px rgba(30, 58, 138, 0.3);
|
||||
}
|
||||
|
||||
.edit-btn {
|
||||
background-color: #fff3cd;
|
||||
color: #856405;
|
||||
border: 1px solid #ffeaa7;
|
||||
padding: 8px 16px;
|
||||
border-radius: 6px;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.edit-btn:hover {
|
||||
background-color: #ffeaa7;
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
|
||||
html[data-bs-theme="dark"] .dashboard-container {
|
||||
@ -267,18 +328,17 @@ html[data-bs-theme="dark"] .dashboard-subtitle {
|
||||
}
|
||||
|
||||
html[data-bs-theme="dark"] .new-user-btn {
|
||||
background-color: #2563eb;
|
||||
color: #fff;
|
||||
background-color: #1e3a8a;
|
||||
}
|
||||
|
||||
html[data-bs-theme="dark"] .new-user-btn:hover {
|
||||
background-color: #1e40af;
|
||||
background-color: #162d6b;
|
||||
}
|
||||
|
||||
html[data-bs-theme="dark"] .filters-container,
|
||||
html[data-bs-theme="dark"] .user-table-container {
|
||||
background: #1a1a1a;
|
||||
box-shadow: 0 4px 6px rgba(0,0,0,0.4);
|
||||
box-shadow: 0 2px 8px rgba(0,0,0,0.4);
|
||||
}
|
||||
|
||||
html[data-bs-theme="dark"] .filters-title,
|
||||
@ -300,19 +360,19 @@ html[data-bs-theme="dark"] .filters-select {
|
||||
|
||||
html[data-bs-theme="dark"] .filters-input:focus,
|
||||
html[data-bs-theme="dark"] .filters-select:focus {
|
||||
border-color: #2563eb;
|
||||
box-shadow: 0px 0px 0px 3px rgba(37, 99, 235, 0.2);
|
||||
border-color: #1e3a8a;
|
||||
box-shadow: 0 0 0 2px rgba(30, 58, 138, 0.2);
|
||||
}
|
||||
|
||||
html[data-bs-theme="dark"] .cards-container .card {
|
||||
background-color: #181818;
|
||||
color: #e0e0e0;
|
||||
box-shadow: 0 4px 6px rgba(0,0,0,0.4);
|
||||
box-shadow: 0 2px 6px rgba(0,0,0,0.4);
|
||||
}
|
||||
|
||||
html[data-bs-theme="dark"] .highlight:hover {
|
||||
background: #232a3a;
|
||||
border: 1px solid #2563eb33;
|
||||
background: #1a1f2e;
|
||||
border: 1px solid #1e3a8a33;
|
||||
}
|
||||
|
||||
html[data-bs-theme="dark"] .card-label {
|
||||
@ -328,7 +388,7 @@ html[data-bs-theme="dark"] .card-extra {
|
||||
}
|
||||
|
||||
html[data-bs-theme="dark"] .card-extra.positive {
|
||||
color: #2563eb;
|
||||
color: #1e3a8a;
|
||||
}
|
||||
|
||||
html[data-bs-theme="dark"] .user-table th {
|
||||
@ -342,26 +402,39 @@ html[data-bs-theme="dark"] .user-table td {
|
||||
}
|
||||
|
||||
html[data-bs-theme="dark"] .user-table tr:hover {
|
||||
background-color: #232a3a;
|
||||
background-color: #1a1f2e;
|
||||
}
|
||||
|
||||
html[data-bs-theme="dark"] .profile-badge {
|
||||
background-color: #2563eb;
|
||||
color: #fff;
|
||||
background-color: #1e3a8a;
|
||||
}
|
||||
|
||||
html[data-bs-theme="dark"] .status-badge.ativo {
|
||||
background-color: #28a745;
|
||||
html[data-bs-theme="dark"] .action-btn.detalhes {
|
||||
background-color: #e6f2ff;
|
||||
color: #004085;
|
||||
border: 1px solid #b8d4ff;
|
||||
}
|
||||
|
||||
html[data-bs-theme="dark"] .status-badge.inativo {
|
||||
background-color: #dc3545;
|
||||
html[data-bs-theme="dark"] .action-btn.detalhes:hover {
|
||||
background-color: #cce4ff;
|
||||
}
|
||||
|
||||
html[data-bs-theme="dark"] .action-icon {
|
||||
color: #bdbdbd;
|
||||
html[data-bs-theme="dark"] .action-btn.editar {
|
||||
background-color: #fff3cd;
|
||||
color: #856405;
|
||||
border: 1px solid #ffeaa7;
|
||||
}
|
||||
|
||||
html[data-bs-theme="dark"] .action-icon:hover {
|
||||
color: #2563eb;
|
||||
html[data-bs-theme="dark"] .action-btn.editar:hover {
|
||||
background-color: #ffeaa7;
|
||||
}
|
||||
|
||||
html[data-bs-theme="dark"] .action-btn.excluir {
|
||||
background-color: #f8d7da;
|
||||
color: #721c24;
|
||||
border: 1px solid #f1b0b7;
|
||||
}
|
||||
|
||||
html[data-bs-theme="dark"] .action-btn.excluir:hover {
|
||||
background-color: #f1b0b7;
|
||||
}
|
||||
@ -57,7 +57,7 @@
|
||||
background-color: transparent;
|
||||
border: 0;
|
||||
border-bottom: 2px solid transparent;
|
||||
padding: 12px 24px;
|
||||
padding: 10px 12px;
|
||||
border-radius: 0;
|
||||
font-weight: 600;
|
||||
color: #718096;
|
||||
@ -108,7 +108,9 @@
|
||||
font-family: 'Inter', sans-serif;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.calendar-info-panel { flex: 0 0 300px; border-right: 1px solid #E2E8F0; padding-right: 24px; display: flex; flex-direction: column; }
|
||||
|
||||
.info-date-display { background-color: #EDF2F7; border-radius: 8px; padding: 12px; text-align: center; margin-bottom: 16px; }
|
||||
.info-date-display span { font-weight: 600; color: #718096; text-transform: uppercase; font-size: 0.9rem; }
|
||||
.info-date-display strong { display: block; font-size: 2.5rem; font-weight: 700; color: #2D3748; }
|
||||
@ -135,6 +137,7 @@
|
||||
.nav-buttons button { padding: 8px 12px; border-radius: 6px; border: 1px solid #CBD5E0; background-color: #fff; font-weight: 600; cursor: pointer; transition: all 0.2s; }
|
||||
.nav-buttons button:hover { background-color: #EDF2F7; }
|
||||
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
|
||||
|
||||
.day-header { font-weight: 600; color: #718096; text-align: center; padding: 8px 0; font-size: 0.875rem; }
|
||||
.day-cell { min-height: 110px; border-radius: 8px; border: 1px solid #E2E8F0; padding: 8px; transition: background-color 0.2s, border-color 0.2s; cursor: pointer; position: relative; }
|
||||
.day-cell span { font-weight: 600; color: #4A5568; }
|
||||
@ -181,7 +184,6 @@
|
||||
color: #C53030;
|
||||
}
|
||||
|
||||
|
||||
.appointment-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@ -224,80 +226,194 @@
|
||||
background-color: #C53030;
|
||||
}
|
||||
|
||||
.table-wrapper {
|
||||
width: 100%;
|
||||
overflow-x: auto;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
}
|
||||
|
||||
|
||||
table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
min-width: 600px;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.unidade-selecionarprofissional { flex-direction: column; align-items: stretch; gap: 12px; }
|
||||
.calendar-wrapper { flex-direction: column; padding: 16px; }
|
||||
.calendar-info-panel { flex: 0 0 auto; border-right: none; border-bottom: 1px solid #E2E8F0; padding-right: 0; padding-bottom: 16px; }
|
||||
.busca-atendimento {
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.container-btns-agenda-fila_esepera {
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
gap: 10px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.btns-gerenciamento-e-consulta {
|
||||
width: 100%;
|
||||
justify-content: space-between;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.btn-adicionar-consulta {
|
||||
padding: 8px 12px;
|
||||
font-size: 0.8rem;
|
||||
white-space: normal;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.unidade-selecionarprofissional {
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.calendar-wrapper {
|
||||
flex-direction: column;
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
.calendar-info-panel {
|
||||
border-right: none;
|
||||
border-bottom: 1px solid #E2E8F0;
|
||||
padding-right: 0;
|
||||
padding-bottom: 16px;
|
||||
}
|
||||
|
||||
.calendar-grid { grid-template-columns: repeat(4, 1fr); }
|
||||
.calendar-controls { flex-direction: column; align-items: flex-start; gap: 8px; }
|
||||
}
|
||||
|
||||
@media (max-width: 576px) {
|
||||
.calendar-grid { grid-template-columns: repeat(2, 1fr); }
|
||||
.calendar-grid { grid-template-columns: 1fr; }
|
||||
.date-indicator h2 { font-size: 1.25rem; }
|
||||
.legend-item { font-size: 0.75rem; padding: 4px 8px; }
|
||||
.appointment-item { flex-direction: column; align-items: stretch; gap: 8px; }
|
||||
.appointment-actions { width: 100%; }
|
||||
.btn-action { width: 100%; }
|
||||
}
|
||||
.btn-adicionar-consulta {
|
||||
background-color: #2a67e2;
|
||||
color: #fff;
|
||||
padding: 10px 24px;
|
||||
|
||||
@media (max-width: 425px) {
|
||||
.calendar-main {
|
||||
overflow-x: auto;
|
||||
}
|
||||
.calendar-grid {
|
||||
min-width: 400px;
|
||||
grid-template-columns: repeat(7, 1fr);
|
||||
}
|
||||
.day-cell {
|
||||
min-height: 80px;
|
||||
}
|
||||
|
||||
|
||||
.table-wrapper {
|
||||
overflow-x: auto;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
border: 1px solid #E2E8F0;
|
||||
border-radius: 8px;
|
||||
border: none;
|
||||
font-weight: 600;
|
||||
font-size: 1rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
cursor: pointer;
|
||||
transition: background 0.2s;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
table {
|
||||
min-width: 600px;
|
||||
font-size: 0.875rem;
|
||||
}
|
||||
|
||||
table th,
|
||||
table td {
|
||||
padding: 8px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.btn-adicionar-consulta:hover {
|
||||
background-color: #1d4ed8;
|
||||
}
|
||||
.btn-adicionar-consulta i {
|
||||
font-size: 1.2em;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.btn-adicionar-consulta i {
|
||||
font-size: 1.2em;
|
||||
vertical-align: middle;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.container-btns-agenda-fila_esepera {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
justify-content: space-between; /* abas à esquerda, botões à direita */
|
||||
align-items: center;
|
||||
margin: 15px 0 20px;
|
||||
}
|
||||
|
||||
.tabs-agenda-fila {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
gap: 16px; /* opcional: espaço entre os blocos */
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
/* garante que os botões fiquem em linha */
|
||||
.btns-gerenciamento-e-consulta {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
/* em telas muito pequenas, pode empilhar verticalmente */
|
||||
@media (max-width: 768px) {
|
||||
.container-btns-agenda-fila_esepera {
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
.btns-gerenciamento-e-consulta {
|
||||
justify-content: flex-start; /* ou center se preferir */
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
}
|
||||
/* barra de abas + botões */
|
||||
.container-btns-agenda-fila_esepera {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin: 0 0 8px;
|
||||
margin-bottom: 0; /* cola com a linha de baixo */
|
||||
}
|
||||
|
||||
|
||||
/* dá só um respiro pequeno entre as abas e o conteúdo,
|
||||
mas igual para Agenda e Fila de espera */
|
||||
.calendario-ou-filaespera {
|
||||
margin-top: 0;
|
||||
margin-top: 4px; /* aumenta um pouquinho, não 20px */
|
||||
padding-top: 0;
|
||||
}
|
||||
|
||||
|
||||
.calendar-wrapper {
|
||||
margin-top: 0;
|
||||
/* se o título "Fila de Espera" estiver mais distante,
|
||||
aproxima só o conteúdo dessa área também */
|
||||
.page-content.table-paciente-container {
|
||||
margin-top: 4px;
|
||||
}
|
||||
/* 1) container das abas + botões: encostado no topo */
|
||||
.container-btns-agenda-fila_esepera {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
/* 2) sempre cria um espaçamento logo DEPOIS das abas,
|
||||
antes de qualquer conteúdo (Agenda ou Fila) */
|
||||
.container-btns-agenda-fila_esepera + .calendario-ou-filaespera {
|
||||
margin-top: 8px; /* aumenta ou diminui aqui */
|
||||
padding-top: 0;
|
||||
}
|
||||
|
||||
/* 3) garante que o primeiro filho da section não roube/colapse margens */
|
||||
.calendario-ou-filaespera > *:first-child {
|
||||
margin-top: 0 !important;
|
||||
}
|
||||
/* mesmos blocos azuis e quadrados */
|
||||
.btn-consulta-paciente {
|
||||
display: inline-flex;
|
||||
align-items: center; /* alinha ícone + texto verticalmente */
|
||||
justify-content: center;
|
||||
gap: 6px; /* espaço entre ícone e texto */
|
||||
padding: 10px 22px; /* altura/largura parecidas com os azuis */
|
||||
border-radius: 6px; /* se os outros forem 6px, mantém igual */
|
||||
font-weight: 500;
|
||||
border: none;
|
||||
}
|
||||
|
||||
/* garante mesma cor dos blocos da secretaria */
|
||||
.btn-consulta-paciente.btn-primary {
|
||||
background-color: #1d4ed8; /* azul escuro do primeiro bloco */
|
||||
}
|
||||
|
||||
/* se quiser hover igual */
|
||||
.btn-consulta-paciente.btn-primary:hover {
|
||||
background-color: #1437a3;
|
||||
}
|
||||
.btn-consulta-paciente {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 6px;
|
||||
padding: 10px 22px;
|
||||
border-radius: 6px;
|
||||
font-weight: 500;
|
||||
border: none;
|
||||
}
|
||||
@ -190,6 +190,12 @@ html, body {
|
||||
}
|
||||
|
||||
/* ===== Fila de Espera ===== */
|
||||
|
||||
@media (max-width: 992px) {
|
||||
.fila-container {
|
||||
overflow-x: auto;
|
||||
}
|
||||
}
|
||||
.fila-container {
|
||||
width: 100%;
|
||||
max-width: none;
|
||||
@ -286,6 +292,13 @@ html, body {
|
||||
transition: border-color 0.2s;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.busca-fila-espera {
|
||||
width: 100%;
|
||||
position: static;
|
||||
}
|
||||
}
|
||||
|
||||
.busca-fila-espera:focus {
|
||||
border-color: #888;
|
||||
}
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
/* FinanceiroDashboard.css */
|
||||
|
||||
/* GERAL */
|
||||
.financeiro-wrap {
|
||||
display: flex;
|
||||
@ -21,6 +23,12 @@
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
@media (max-width: 1200px) {
|
||||
.summary-card {
|
||||
min-width: 180px;
|
||||
}
|
||||
}
|
||||
|
||||
.summary-card {
|
||||
flex: 1;
|
||||
min-width: 200px;
|
||||
@ -39,6 +47,7 @@
|
||||
margin: 0 0 8px 0;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
color: #fff;
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
@ -107,43 +116,87 @@
|
||||
}
|
||||
|
||||
/* Botões de ação */
|
||||
.action-group {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.action-btn {
|
||||
cursor: pointer;
|
||||
padding: 6px 12px;
|
||||
.btn-view {
|
||||
background-color: #E6F2FF !important;
|
||||
color: #004085 !important;
|
||||
border: 1px solid #B8D4F0 !important;
|
||||
padding: 0.375rem 0.75rem;
|
||||
font-size: 0.875rem;
|
||||
border-radius: 6px;
|
||||
border: 1px solid #d7e6fb;
|
||||
background: #fff;
|
||||
transition: all 0.2s ease;
|
||||
font-size: 13px;
|
||||
cursor: pointer;
|
||||
transition: all 0.15s ease-in-out;
|
||||
text-decoration: none;
|
||||
display: inline-block;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.action-btn:hover {
|
||||
background: #f6f9fc;
|
||||
border-color: #93c5fd;
|
||||
.btn-view:hover {
|
||||
background-color: #D1E7FF !important;
|
||||
border-color: #9EC5FE !important;
|
||||
}
|
||||
|
||||
.action-btn.delete {
|
||||
border-color: #fca5a5;
|
||||
color: #b91c1c;
|
||||
.btn-edit {
|
||||
background-color: #FFF3CD !important;
|
||||
color: #856404 !important;
|
||||
border: 1px solid #FFEAA7 !important;
|
||||
padding: 0.375rem 0.75rem;
|
||||
font-size: 0.875rem;
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
transition: all 0.15s ease-in-out;
|
||||
text-decoration: none;
|
||||
display: inline-block;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.action-btn.delete:hover {
|
||||
background: #fee2e2;
|
||||
border-color: #ef4444;
|
||||
.btn-edit:hover {
|
||||
background-color: #FFEEBA !important;
|
||||
border-color: #FFE087 !important;
|
||||
}
|
||||
|
||||
.btn-delete:hover {
|
||||
background-color: #F1B0B7 !important;
|
||||
border-color: #ED969E !important;
|
||||
}
|
||||
.btn-delete {
|
||||
background-color: #F8D7DA !important;
|
||||
color: #721C24 !important;
|
||||
border: 1px solid #F5C6CB !important;
|
||||
padding: 0.375rem 0.75rem;
|
||||
font-size: 0.875rem;
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
transition: all 0.15s ease-in-out;
|
||||
text-decoration: none;
|
||||
display: inline-block;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
html[data-bs-theme="dark"] .btn-view {
|
||||
background-color: #1e3a8a !important;
|
||||
color: #e0e0e0 !important;
|
||||
border-color: #374151 !important;
|
||||
}
|
||||
|
||||
html[data-bs-theme="dark"] .btn-edit {
|
||||
background-color: #78350f !important;
|
||||
color: #fef3c7 !important;
|
||||
border-color: #374151 !important;
|
||||
}
|
||||
|
||||
html[data-bs-theme="dark"] .btn-delete {
|
||||
background-color: #7f1d1d !important;
|
||||
color: #fee2e2 !important;
|
||||
border-color: #374151 !important;
|
||||
}
|
||||
|
||||
/* Badges de status */
|
||||
.badge {
|
||||
display: inline-block;
|
||||
padding: 4px 10px;
|
||||
padding: 8px 18px !important;
|
||||
border-radius: 9999px;
|
||||
font-size: 12px;
|
||||
font-size: 14px !important;
|
||||
font-weight: 600;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
@ -182,12 +235,18 @@
|
||||
padding: 24px;
|
||||
width: 100%;
|
||||
max-width: 550px;
|
||||
max-height: 90vh;
|
||||
overflow-y: auto;
|
||||
max-height: 85vh;
|
||||
box-sizing: border-box;
|
||||
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
@media (max-width: 576px) {
|
||||
.modal-card {
|
||||
padding: 16px;
|
||||
max-height: 95vh;
|
||||
}
|
||||
}
|
||||
|
||||
.modal-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
@ -198,7 +257,7 @@
|
||||
.modal-header h2 {
|
||||
font-size: 20px;
|
||||
font-weight: 700;
|
||||
color: #1f2937;
|
||||
color: #fff;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
@ -208,6 +267,12 @@
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.modal-card .input-field,
|
||||
.modal-card .select-field,
|
||||
.modal-card textarea {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.form-group {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
@ -241,12 +306,23 @@
|
||||
gap: 10px;
|
||||
margin-top: 24px;
|
||||
}
|
||||
.input-field,
|
||||
.select-field,
|
||||
textarea {
|
||||
padding: 10px 12px;
|
||||
border: 1px solid #d1d5db;
|
||||
border-radius: 8px;
|
||||
box-sizing: border-box;
|
||||
font-size: 14px;
|
||||
transition: border-color 0.2s, box-shadow 0.2s;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
|
||||
/* Inputs e selects */
|
||||
.input-field,
|
||||
.select-field,
|
||||
textarea {
|
||||
width: 100%;
|
||||
padding: 10px 12px;
|
||||
border: 1px solid #d1d5db;
|
||||
border-radius: 8px;
|
||||
@ -269,6 +345,26 @@ textarea {
|
||||
min-height: 80px;
|
||||
}
|
||||
|
||||
.financeiro-wrap .input-field:not(.modal-card *),
|
||||
.financeiro-wrap .select-field:not(.modal-card *),
|
||||
.financeiro-wrap textarea:not(.modal-card *) {
|
||||
width: 30%;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.financeiro-wrap .input-field:not(.modal-card *),
|
||||
.financeiro-wrap .select-field:not(.modal-card *),
|
||||
.financeiro-wrap textarea:not(.modal-card *) {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.modal-card .input-field,
|
||||
.modal-card .select-field,
|
||||
.modal-card textarea {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
/* Mensagem quando não há pagamentos */
|
||||
.empty {
|
||||
text-align: center;
|
||||
|
||||
@ -1,5 +1,136 @@
|
||||
/* Inicio.css */
|
||||
|
||||
/* Container Principal */
|
||||
|
||||
/* Responsividade */
|
||||
@media (max-width: 1200px) {
|
||||
.dashboard-container {
|
||||
padding: 1.5rem;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.dashboard-container {
|
||||
padding: 1rem;
|
||||
}
|
||||
|
||||
.dashboard-header h1 {
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
|
||||
.dashboard-header p {
|
||||
margin-bottom: 1.5rem;
|
||||
}
|
||||
|
||||
.stats-grid {
|
||||
grid-template-columns: 1fr 1fr; /* 2 colunas em tablets */
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.stat-value {
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
|
||||
.stat-icon-wrapper {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
.stat-icon {
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.actions-grid {
|
||||
grid-template-columns: 1fr; /* 1 coluna em tablets */
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.action-icon {
|
||||
font-size: 1.8rem;
|
||||
}
|
||||
|
||||
.action-title {
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.appointments-section {
|
||||
padding: 1.5rem;
|
||||
}
|
||||
|
||||
.agendamento-info {
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.agendamento-time-date {
|
||||
flex-direction: row;
|
||||
gap: 1rem;
|
||||
min-width: auto;
|
||||
}
|
||||
|
||||
.agendamento-detalhes {
|
||||
min-width: auto;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 576px) {
|
||||
.dashboard-container {
|
||||
padding: 0.5rem;
|
||||
}
|
||||
|
||||
.dashboard-header h1 {
|
||||
font-size: 1.3rem;
|
||||
}
|
||||
|
||||
.dashboard-header p {
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.stats-grid {
|
||||
grid-template-columns: 1fr; /* 1 coluna em celulares */
|
||||
}
|
||||
|
||||
.stat-card {
|
||||
padding: 1rem;
|
||||
}
|
||||
|
||||
.stat-value {
|
||||
font-size: 1.3rem;
|
||||
}
|
||||
|
||||
.action-button {
|
||||
padding: 1rem;
|
||||
}
|
||||
|
||||
.appointments-section {
|
||||
padding: 1rem;
|
||||
}
|
||||
|
||||
.agendamento-item {
|
||||
padding: 0.75rem 1rem;
|
||||
}
|
||||
|
||||
.agendamento-hora {
|
||||
font-size: 1.1rem;
|
||||
}
|
||||
|
||||
.agendamento-data {
|
||||
font-size: 0.7rem;
|
||||
}
|
||||
|
||||
.agendamento-paciente,
|
||||
.agendamento-medico {
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
|
||||
.manage-button,
|
||||
.view-all-button {
|
||||
padding: 0.6rem 1.2rem;
|
||||
font-size: 0.8rem;
|
||||
}
|
||||
}
|
||||
|
||||
/* Container Principal */
|
||||
.dashboard-container {
|
||||
padding: 2rem;
|
||||
@ -72,10 +203,10 @@
|
||||
}
|
||||
|
||||
/* Cores dos ícones */
|
||||
.stat-icon-wrapper.blue { background-color: #5d5dff; }
|
||||
.stat-icon-wrapper.green { background-color: #30d158; }
|
||||
.stat-icon-wrapper.purple { background-color: #a272ff; }
|
||||
.stat-icon-wrapper.orange { background-color: #f1952e; }
|
||||
.stat-icon-wrapper.blue { background-color: #1D3B88; }
|
||||
.stat-icon-wrapper.green { background-color: #399CE5; }
|
||||
.stat-icon-wrapper.purple { background-color: #5F5DF2; }
|
||||
.stat-icon-wrapper.orange { background-color: #051AFF; }
|
||||
|
||||
/* Seção de Ações Rápidas */
|
||||
.quick-actions h2 {
|
||||
|
||||
121
src/_assets/css/pages/medico/RelatorioAudio.css
Normal file
121
src/_assets/css/pages/medico/RelatorioAudio.css
Normal file
@ -0,0 +1,121 @@
|
||||
/* NovoRelatorioAudio.css */
|
||||
|
||||
/* Container que ocupa toda a altura da tela (menos o header do site) */
|
||||
.ai-editor-container {
|
||||
display: flex;
|
||||
min-height: calc(100vh - 80px); /* Ajuste conforme seu header */
|
||||
background-color: #e9ecef; /* Cor de "Mesa" */
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* --- LADO ESQUERDO: PAINEL DE CONTROLE --- */
|
||||
.editor-sidebar {
|
||||
width: 400px;
|
||||
background-color: #212529; /* Dark Mode para o painel */
|
||||
color: #fff;
|
||||
padding: 20px;
|
||||
overflow-y: auto;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 15px;
|
||||
box-shadow: 4px 0 10px rgba(0,0,0,0.1);
|
||||
}
|
||||
|
||||
.editor-sidebar h4 {
|
||||
color: #0dcaf0; /* Ciano para destaque */
|
||||
margin-bottom: 20px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.editor-sidebar label {
|
||||
font-size: 0.85rem;
|
||||
color: #adb5bd;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
/* Estilo customizado para inputs no fundo escuro */
|
||||
.dark-input {
|
||||
background-color: #343a40;
|
||||
border: 1px solid #495057;
|
||||
color: #fff;
|
||||
border-radius: 6px;
|
||||
}
|
||||
.dark-input:focus {
|
||||
background-color: #3b4248;
|
||||
color: #fff;
|
||||
border-color: #0dcaf0;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
/* Área de Upload Destacada */
|
||||
.ai-upload-box {
|
||||
border: 2px dashed #0dcaf0;
|
||||
border-radius: 10px;
|
||||
padding: 20px;
|
||||
text-align: center;
|
||||
background: rgba(13, 202, 240, 0.1);
|
||||
transition: 0.3s;
|
||||
cursor: pointer;
|
||||
}
|
||||
.ai-upload-box:hover {
|
||||
background: rgba(13, 202, 240, 0.2);
|
||||
}
|
||||
|
||||
/* --- LADO DIREITO: PREVIEW A4 --- */
|
||||
.preview-area {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: flex-start;
|
||||
padding: 40px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.paper-a4 {
|
||||
width: 210mm;
|
||||
min-height: 297mm;
|
||||
background: white;
|
||||
padding: 25mm;
|
||||
box-shadow: 0 0 20px rgba(0,0,0,0.15);
|
||||
color: #000;
|
||||
font-family: 'Georgia', serif; /* Fonte mais séria para o documento */
|
||||
font-size: 12pt;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
/* Responsividade: Em celular vira coluna única */
|
||||
@media (max-width: 900px) {
|
||||
.ai-editor-container {
|
||||
flex-direction: column;
|
||||
min-height: auto;
|
||||
}
|
||||
.editor-sidebar {
|
||||
width: 100%;
|
||||
height: auto;
|
||||
box-shadow: 0 4px 10px rgba(0,0,0,0.1);
|
||||
}
|
||||
.preview-area {
|
||||
padding: 20px;
|
||||
}
|
||||
.paper-a4 {
|
||||
width: 100%;
|
||||
min-height: auto;
|
||||
padding: 15mm;
|
||||
box-shadow: none;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 576px) {
|
||||
.ai-editor-container {
|
||||
padding: 0;
|
||||
}
|
||||
.editor-sidebar {
|
||||
padding: 15px;
|
||||
}
|
||||
.preview-area {
|
||||
padding: 10px;
|
||||
}
|
||||
.paper-a4 {
|
||||
padding: 10mm;
|
||||
}
|
||||
}
|
||||
@ -1,3 +1,16 @@
|
||||
/* TableDoctor.css */
|
||||
|
||||
.table-doctor-container {
|
||||
line-height: 2.5;
|
||||
}
|
||||
|
||||
/* Adiciona responsividade para a tabela */
|
||||
@media (max-width: 992px) {
|
||||
.table-doctor-card {
|
||||
overflow-x: auto;
|
||||
}
|
||||
}
|
||||
|
||||
.table-doctor-container {
|
||||
line-height: 2.5;
|
||||
}
|
||||
|
||||
@ -1,3 +1,16 @@
|
||||
/* TablePaciente.css */
|
||||
|
||||
.table-paciente-container {
|
||||
line-height: 2.5;
|
||||
}
|
||||
|
||||
/* Adiciona responsividade para a tabela */
|
||||
@media (max-width: 992px) {
|
||||
.table-paciente-card {
|
||||
overflow-x: auto;
|
||||
}
|
||||
}
|
||||
|
||||
.table-paciente-container {
|
||||
line-height: 2.5;
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
//FormNovaConsulta.jsx
|
||||
|
||||
import { useState, useEffect, useCallback } from "react";
|
||||
import InputMask from "react-input-mask";
|
||||
import { GetPatientByCPF, GetAllPatients } from "../../_assets/utils/Functions-Endpoints/Patient";
|
||||
import { GetAllDoctors } from "../../_assets/utils/Functions-Endpoints/Doctor";
|
||||
import { useAuth } from "../../_assets/utils/AuthProvider";
|
||||
@ -13,92 +14,151 @@ const FormNovaConsulta = ({ onCancel, onSave, setAgendamento, agendamento }) =>
|
||||
|
||||
const [sessoes, setSessoes] = useState(1);
|
||||
const [tempoBaseConsulta] = useState(30);
|
||||
const [showSuccessModal, setShowSuccessModal] = useState(false);
|
||||
const [horarioInicio, setHorarioInicio] = useState("");
|
||||
const [horarioTermino, setHorarioTermino] = useState("");
|
||||
const [horariosDisponiveis, sethorariosDisponiveis] = useState([]);
|
||||
const [status, setStatus] = useState(agendamento?.status || "confirmed");
|
||||
const [isSubmitting, setIsSubmitting] = useState(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([]);
|
||||
|
||||
const [todosPacientes, setTodosPacientes] = useState([])
|
||||
const [pacientesFiltrados, setPacientesFiltrados] = useState([])
|
||||
const [isDropdownPacienteOpen, setIsDropdownPacienteOpen] = useState(false)
|
||||
const [todosPacientes, setTodosPacientes] = useState([]);
|
||||
const [pacientesFiltrados, setPacientesFiltrados] = useState([]);
|
||||
const [isDropdownPacienteOpen, setIsDropdownPacienteOpen] = useState(false);
|
||||
|
||||
const [status, setStatus] = useState("confirmed")
|
||||
|
||||
let authHeader = getAuthorizationHeader()
|
||||
const authHeader = getAuthorizationHeader();
|
||||
|
||||
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
|
||||
.replace(/(\d{3})(\d)/, '$1.$2')
|
||||
.replace(/(\d{3})(\d)/, '$1.$2')
|
||||
.replace(/(\d{3})(\d{1,2})$/, '$1-$2');
|
||||
.replace(/(\d{3})(\d)/, "$1.$2")
|
||||
.replace(/(\d{3})(\d)/, "$1.$2")
|
||||
.replace(/(\d{3})(\d{1,2})$/, "$1-$2");
|
||||
};
|
||||
|
||||
const handleChange = (e) => {
|
||||
const { value, name } = e.target;
|
||||
|
||||
if (name === 'email') {
|
||||
setAgendamento(prev => ({
|
||||
if (name === "email") {
|
||||
setAgendamento((prev) => ({
|
||||
...prev,
|
||||
contato: { ...prev.contato, email: value }
|
||||
contato: {
|
||||
...(prev.contato || {}),
|
||||
email: value,
|
||||
},
|
||||
}));
|
||||
} else if (name === 'status') {
|
||||
setAgendamento(prev => ({
|
||||
} else if (name === "status") {
|
||||
setAgendamento((prev) => ({
|
||||
...prev,
|
||||
status: prev.status === 'requested' ? 'confirmed' : 'requested'
|
||||
status: prev.status === "requested" ? "confirmed" : "requested",
|
||||
}));
|
||||
} else if (name === 'paciente_cpf') {
|
||||
setStatus((prev) => (prev === "confirmed" ? "requested" : "confirmed"));
|
||||
} else if (name === "paciente_cpf") {
|
||||
const cpfFormatted = FormatCPF(value);
|
||||
const fetchPatient = async () => {
|
||||
const patientData = await GetPatientByCPF(cpfFormatted, authHeader);
|
||||
if (patientData) {
|
||||
setAgendamento(prev => ({
|
||||
setAgendamento((prev) => ({
|
||||
...prev,
|
||||
paciente_nome: patientData.full_name,
|
||||
patient_id: patientData.id
|
||||
patient_id: patientData.id,
|
||||
}));
|
||||
}
|
||||
};
|
||||
setAgendamento(prev => ({ ...prev, paciente_cpf: cpfFormatted }));
|
||||
setAgendamento((prev) => ({ ...prev, paciente_cpf: cpfFormatted }));
|
||||
fetchPatient();
|
||||
} else if (name === 'convenio') {
|
||||
setAgendamento(prev => ({ ...prev, insurance_provider: value }));
|
||||
} else if (name === "convenio") {
|
||||
setAgendamento((prev) => ({ ...prev, insurance_provider: value }));
|
||||
} else {
|
||||
setAgendamento(prev => ({ ...prev, [name]: value }));
|
||||
setAgendamento((prev) => ({ ...prev, [name]: value }));
|
||||
}
|
||||
};
|
||||
|
||||
const ChamarMedicos = useCallback(async () => {
|
||||
const Medicos = await GetAllDoctors(authHeader);
|
||||
setTodosProfissionais(Medicos);
|
||||
setTodosProfissionais(Medicos || []);
|
||||
}, [authHeader]);
|
||||
|
||||
const ChamarPacientes = useCallback (async () => {
|
||||
const ChamarPacientes = useCallback(async () => {
|
||||
const Pacientes = await GetAllPatients(authHeader);
|
||||
setTodosPacientes(Pacientes)
|
||||
console.log("pacientes")
|
||||
console.log(Pacientes)
|
||||
}, [authHeader])
|
||||
setTodosPacientes(Pacientes || []);
|
||||
}, [authHeader]);
|
||||
|
||||
// AUTOCOMPLETE PACIENTE
|
||||
const handleSearchPaciente = (e) => {
|
||||
const term = e.target.value;
|
||||
setAgendamento((prev) => ({ ...prev, paciente_nome: term }));
|
||||
|
||||
if (term.trim() === "") {
|
||||
setPacientesFiltrados([]);
|
||||
setIsDropdownPacienteOpen(false);
|
||||
return;
|
||||
}
|
||||
|
||||
const filtered = todosPacientes.filter((p) =>
|
||||
p.full_name.toLowerCase().includes(term.toLowerCase())
|
||||
);
|
||||
|
||||
setPacientesFiltrados(filtered);
|
||||
setIsDropdownPacienteOpen(filtered.length > 0);
|
||||
};
|
||||
|
||||
const handleSelectPaciente = (paciente) => {
|
||||
setAgendamento((prev) => ({
|
||||
...prev,
|
||||
patient_id: paciente.id,
|
||||
paciente_nome: paciente.full_name,
|
||||
paciente_cpf: paciente.cpf,
|
||||
}));
|
||||
setPacientesFiltrados([]);
|
||||
setIsDropdownPacienteOpen(false);
|
||||
};
|
||||
|
||||
// AUTOCOMPLETE PROFISSIONAL
|
||||
const handleSearchProfissional = (e) => {
|
||||
const term = e.target.value;
|
||||
handleChange(e);
|
||||
|
||||
if (term.trim() === "") {
|
||||
setProfissionaisFiltrados([]);
|
||||
setIsDropdownOpen(false);
|
||||
return;
|
||||
}
|
||||
|
||||
const filtered = todosProfissionais.filter((p) =>
|
||||
p.full_name.toLowerCase().includes(term.toLowerCase())
|
||||
);
|
||||
|
||||
setProfissionaisFiltrados(filtered);
|
||||
setIsDropdownOpen(filtered.length > 0);
|
||||
};
|
||||
|
||||
const handleSelectProfissional = (profissional) => {
|
||||
setAgendamento((prev) => ({
|
||||
...prev,
|
||||
doctor_id: profissional.id,
|
||||
nome_medico: profissional.full_name,
|
||||
}));
|
||||
setProfissionaisFiltrados([]);
|
||||
setIsDropdownOpen(false);
|
||||
};
|
||||
|
||||
const formatarHora = (datetimeString) => {
|
||||
return datetimeString?.substring(11, 16) || "";
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
console.log("Horario","tessssste" )
|
||||
if (agendamento?.scheduled_at) {
|
||||
setHorarioInicio(formatarHora(agendamento.scheduled_at));
|
||||
}
|
||||
}, [])
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
ChamarMedicos();
|
||||
}, [ChamarMedicos]);
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
ChamarPacientes()
|
||||
}, [ChamarPacientes])
|
||||
ChamarPacientes();
|
||||
}, [ChamarMedicos, ChamarPacientes]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!agendamento.dataAtendimento || !agendamento.doctor_id) return;
|
||||
@ -106,7 +166,7 @@ const FormNovaConsulta = ({ onCancel, onSave, setAgendamento, agendamento }) =>
|
||||
const myHeaders = new Headers();
|
||||
myHeaders.append("Content-Type", "application/json");
|
||||
myHeaders.append("apikey", API_KEY);
|
||||
myHeaders.append("Authorization", `Bearer ${authHeader.split(' ')[1]}`);
|
||||
myHeaders.append("Authorization", `Bearer ${authHeader.split(" ")[1]}`);
|
||||
|
||||
const raw = JSON.stringify({
|
||||
doctor_id: agendamento.doctor_id,
|
||||
@ -115,163 +175,138 @@ const FormNovaConsulta = ({ onCancel, onSave, setAgendamento, agendamento }) =>
|
||||
});
|
||||
|
||||
const requestOptions = {
|
||||
method: 'POST',
|
||||
method: "POST",
|
||||
headers: myHeaders,
|
||||
body: raw,
|
||||
};
|
||||
|
||||
fetch("https://yuanqfswhberkoevtmfr.supabase.co/functions/v1/get-available-slots", requestOptions)
|
||||
.then(response => response.json())
|
||||
.then(result => sethorariosDisponiveis(result))
|
||||
.catch(error => console.log('error', error));
|
||||
fetch(
|
||||
"https://yuanqfswhberkoevtmfr.supabase.co/functions/v1/get-available-slots",
|
||||
requestOptions
|
||||
)
|
||||
.then((response) => response.json())
|
||||
.then((result) => {
|
||||
sethorariosDisponiveis(result);
|
||||
})
|
||||
.catch((error) => console.log("error", error));
|
||||
}, [agendamento.dataAtendimento, agendamento.doctor_id, authHeader]);
|
||||
|
||||
const handleSearchProfissional = (e) => {
|
||||
const term = e.target.value;
|
||||
handleChange(e);
|
||||
const slotsArray = Array.isArray(horariosDisponiveis)
|
||||
? horariosDisponiveis
|
||||
: horariosDisponiveis?.slots || [];
|
||||
|
||||
if (term.trim() === '') {
|
||||
setProfissionaisFiltrados([]);
|
||||
setIsDropdownOpen(false);
|
||||
return;
|
||||
}
|
||||
|
||||
const filtered = todosProfissionais.filter(p =>
|
||||
p.full_name.toLowerCase().includes(term.toLowerCase())
|
||||
);
|
||||
|
||||
setProfissionaisFiltrados(filtered);
|
||||
setIsDropdownOpen(filtered.length > 0);
|
||||
};
|
||||
|
||||
const handleSearchPaciente = (e) => {
|
||||
const term = e.target.value;
|
||||
handleChange(e);
|
||||
|
||||
if (term.trim() === '') {
|
||||
setPacientesFiltrados([]);
|
||||
setIsDropdownPacienteOpen(false);
|
||||
return;
|
||||
}
|
||||
|
||||
const filtered = todosPacientes.filter(p =>
|
||||
p.full_name.toLowerCase().includes(term.toLowerCase())
|
||||
);
|
||||
console.log(filtered.length > 0, "filtrados")
|
||||
|
||||
setPacientesFiltrados(filtered);
|
||||
setIsDropdownPacienteOpen(filtered.length > 0);
|
||||
}
|
||||
|
||||
const handleSelectProfissional = (profissional) => {
|
||||
setAgendamento(prev => ({
|
||||
...prev,
|
||||
doctor_id: profissional.id,
|
||||
nome_medico: profissional.full_name
|
||||
}));
|
||||
setProfissionaisFiltrados([]);
|
||||
setIsDropdownOpen(false);
|
||||
};
|
||||
|
||||
const handleSelectPaciente = (paciente) => {
|
||||
setAgendamento(prev => ({
|
||||
...prev,
|
||||
patient_id:paciente.id,
|
||||
paciente_nome: paciente.full_name,
|
||||
paciente_cpf: paciente.cpf
|
||||
}))
|
||||
setProfissionaisFiltrados([])
|
||||
setIsDropdownPacienteOpen(false)
|
||||
|
||||
}
|
||||
|
||||
const formatarHora = (datetimeString) => {
|
||||
return datetimeString?.substring(11, 16) || '';
|
||||
};
|
||||
|
||||
const opcoesDeHorario = horariosDisponiveis?.slots?.map(item => ({
|
||||
const opcoesDeHorario = slotsArray.map((item) => ({
|
||||
value: formatarHora(item.datetime),
|
||||
label: formatarHora(item.datetime),
|
||||
disabled: !item.available
|
||||
})) || [];
|
||||
disabled: !item.available,
|
||||
}));
|
||||
|
||||
const calcularHorarioTermino = useCallback((inicio, sessoes, tempoBase) => {
|
||||
if (!inicio || inicio.length !== 5 || !inicio.includes(':')) return '';
|
||||
const calcularHorarioTermino = useCallback((inicio, sessoesParam, tempoBase) => {
|
||||
if (!inicio || inicio.length !== 5 || !inicio.includes(":")) return "";
|
||||
|
||||
const [horas, minutos] = inicio.split(':').map(Number);
|
||||
const minutosInicio = (horas * 60) + minutos;
|
||||
const duracaoTotalMinutos = sessoes * tempoBase;
|
||||
const [horas, minutos] = inicio.split(":").map(Number);
|
||||
const minutosInicio = horas * 60 + minutos;
|
||||
const duracaoTotalMinutos = sessoesParam * tempoBase;
|
||||
const minutosTermino = minutosInicio + duracaoTotalMinutos;
|
||||
|
||||
const horaTermino = Math.floor(minutosTermino / 60) % 24;
|
||||
const minutoTermino = minutosTermino % 60;
|
||||
|
||||
const formatar = (num) => String(num).padStart(2, '0');
|
||||
const formatar = (num) => String(num).padStart(2, "0");
|
||||
return `${formatar(horaTermino)}:${formatar(minutoTermino)}`;
|
||||
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
const novoTermino = calcularHorarioTermino(horarioInicio, sessoes, tempoBaseConsulta);
|
||||
const novoTermino = calcularHorarioTermino(
|
||||
horarioInicio,
|
||||
sessoes,
|
||||
tempoBaseConsulta
|
||||
);
|
||||
|
||||
setHorarioTermino(novoTermino);
|
||||
setAgendamento(prev => ({
|
||||
setAgendamento((prev) => ({
|
||||
...prev,
|
||||
horarioTermino: novoTermino
|
||||
horarioTermino: novoTermino,
|
||||
}));
|
||||
}, [horarioInicio, sessoes, tempoBaseConsulta, setAgendamento, calcularHorarioTermino]);
|
||||
}, [horarioInicio, sessoes, tempoBaseConsulta, calcularHorarioTermino, setAgendamento]);
|
||||
|
||||
const handleSubmit = (e) => {
|
||||
e.preventDefault();
|
||||
setShowSuccessModal(true);
|
||||
if (isSubmitting) return;
|
||||
|
||||
if (
|
||||
!agendamento.doctor_id ||
|
||||
!agendamento.patient_id ||
|
||||
!agendamento.dataAtendimento ||
|
||||
!horarioInicio
|
||||
) {
|
||||
alert(
|
||||
"Por favor, preencha o profissional, paciente, data e horário de início."
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
setIsSubmitting(true);
|
||||
|
||||
const payload = {
|
||||
...agendamento,
|
||||
horarioInicio,
|
||||
status,
|
||||
duration_minutes: sessoes * tempoBaseConsulta,
|
||||
};
|
||||
|
||||
const handleCloseModal = () => {
|
||||
setShowSuccessModal(false);
|
||||
onSave({ ...agendamento, horarioInicio: horarioInicio, status:status });
|
||||
onSave?.(payload);
|
||||
setIsSubmitting(false);
|
||||
};
|
||||
|
||||
const handleCheckbox = () => {
|
||||
if(status === "confirmed"){
|
||||
setStatus("requested")
|
||||
}else{
|
||||
setStatus("confirmed")
|
||||
if (status === "confirmed") {
|
||||
setStatus("requested");
|
||||
setAgendamento((prev) => ({ ...prev, status: "requested" }));
|
||||
} else {
|
||||
setStatus("confirmed");
|
||||
setAgendamento((prev) => ({ ...prev, status: "confirmed" }));
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
return (<div className="form-container">
|
||||
{showSuccessModal && (
|
||||
<div className="modal-overlay">
|
||||
<div className="modal-content">
|
||||
<div className="modal-header">
|
||||
<h5 className="modal-title">Sucesso</h5>
|
||||
</div>
|
||||
<div className="modal-body">
|
||||
<p className="modal-message">Agendamento salvo com sucesso!</p>
|
||||
</div>
|
||||
<div className="modal-footer">
|
||||
<button onClick={handleCloseModal} className="modal-confirm-btn">Fechar</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
return (
|
||||
<div className="form-container">
|
||||
<form className="form-agendamento" onSubmit={handleSubmit}>
|
||||
<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-container">
|
||||
<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={(e) => handleSearchPaciente(e)}
|
||||
value={agendamento?.paciente_nome || ""}
|
||||
onChange={handleSearchPaciente}
|
||||
autoComplete="off"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="campo-de-input">
|
||||
<label>CPF do paciente</label>
|
||||
<InputMask
|
||||
mask="999.999.999-99"
|
||||
maskChar={null}
|
||||
type="text"
|
||||
name="paciente_cpf"
|
||||
placeholder="000.000.000-00"
|
||||
value={agendamento.paciente_cpf || ""}
|
||||
onChange={handleChange}
|
||||
autoComplete="off"
|
||||
/>
|
||||
</div>
|
||||
|
||||
{isDropdownPacienteOpen && pacientesFiltrados.length > 0 && (
|
||||
<div className="dropdown-pacientes">
|
||||
{pacientesFiltrados.map((paciente) => (
|
||||
@ -280,29 +315,25 @@ const FormNovaConsulta = ({ onCancel, onSave, setAgendamento, agendamento }) =>
|
||||
className="dropdown-item"
|
||||
onClick={() => handleSelectPaciente(paciente)}
|
||||
>
|
||||
{`${paciente.full_name.split(" ")[0]} ${paciente.full_name.split(" ")[1]} - ${paciente.cpf}`}
|
||||
{`${paciente.full_name} - ${paciente.cpf}`}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="campo-de-input campo-cpf">
|
||||
<label>CPF do paciente</label>
|
||||
<input
|
||||
type="text"
|
||||
name="paciente_cpf"
|
||||
placeholder="000.000.000-00"
|
||||
onChange={handleChange}
|
||||
value={agendamento.paciente_cpf}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="campos-informacoes-paciente" id="informacoes-paciente-linha-tres">
|
||||
<div
|
||||
className="campos-informacoes-paciente"
|
||||
id="informacoes-paciente-linha-tres"
|
||||
>
|
||||
<div>
|
||||
<label>Convênio</label>
|
||||
<select name="convenio" onChange={handleChange} value={agendamento.insurance_provider}>
|
||||
<select
|
||||
name="convenio"
|
||||
onChange={handleChange}
|
||||
value={agendamento.insurance_provider || "publico"}
|
||||
>
|
||||
<option value="publico">Público</option>
|
||||
<option value="unimed">Unimed</option>
|
||||
<option value="bradesco_saude">Bradesco Saúde</option>
|
||||
@ -321,7 +352,7 @@ const FormNovaConsulta = ({ onCancel, onSave, setAgendamento, agendamento }) =>
|
||||
type="text"
|
||||
name="nome_medico"
|
||||
onChange={handleSearchProfissional}
|
||||
value={agendamento?.nome_medico || ''}
|
||||
value={agendamento?.nome_medico || ""}
|
||||
autoComplete="off"
|
||||
required
|
||||
/>
|
||||
@ -344,7 +375,11 @@ const FormNovaConsulta = ({ onCancel, onSave, setAgendamento, agendamento }) =>
|
||||
|
||||
<div className="tipo_atendimento">
|
||||
<label>Tipo de atendimento *</label>
|
||||
<select name="tipo_atendimento" onChange={handleChange} value={agendamento.tipo_atendimento}>
|
||||
<select
|
||||
name="tipo_atendimento"
|
||||
onChange={handleChange}
|
||||
value={agendamento.tipo_atendimento || "presencial"}
|
||||
>
|
||||
<option value="presencial">Presencial</option>
|
||||
<option value="teleconsulta">Teleconsulta</option>
|
||||
</select>
|
||||
@ -352,6 +387,7 @@ const FormNovaConsulta = ({ onCancel, onSave, setAgendamento, agendamento }) =>
|
||||
</div>
|
||||
|
||||
<section id="informacoes-atendimento-segunda-linha">
|
||||
<section id="informacoes-atendimento-segunda-linha-esquerda">
|
||||
<div className="campo-informacoes-atendimento">
|
||||
<div className="campo-de-input">
|
||||
<label>Data *</label>
|
||||
@ -359,7 +395,7 @@ const FormNovaConsulta = ({ onCancel, onSave, setAgendamento, agendamento }) =>
|
||||
type="date"
|
||||
name="dataAtendimento"
|
||||
onChange={handleChange}
|
||||
value={agendamento.dataAtendimento}
|
||||
value={agendamento.dataAtendimento || ""}
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
@ -370,13 +406,19 @@ const FormNovaConsulta = ({ onCancel, onSave, setAgendamento, agendamento }) =>
|
||||
<select
|
||||
id="inicio"
|
||||
name="inicio"
|
||||
required
|
||||
value={horarioInicio}
|
||||
onChange={(e) => setHorarioInicio(e.target.value)}
|
||||
required
|
||||
>
|
||||
<option value="" disabled>Selecione a hora de início</option>
|
||||
<option value="" disabled>
|
||||
Selecione a hora de início
|
||||
</option>
|
||||
{opcoesDeHorario.map((opcao, index) => (
|
||||
<option key={index} value={opcao.value} disabled={opcao.disabled}>
|
||||
<option
|
||||
key={index}
|
||||
value={opcao.value}
|
||||
disabled={opcao.disabled}
|
||||
>
|
||||
{opcao.label}
|
||||
{opcao.disabled && " (Indisponível)"}
|
||||
</option>
|
||||
@ -390,46 +432,47 @@ const FormNovaConsulta = ({ onCancel, onSave, setAgendamento, agendamento }) =>
|
||||
type="text"
|
||||
id="termino"
|
||||
name="termino"
|
||||
value={horarioTermino || '— —'}
|
||||
value={horarioTermino || "— —"}
|
||||
readOnly
|
||||
className="horario-termino-readonly"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<div className="campo-de-input observacoes">
|
||||
<section className="informacoes-atendimento-segunda-linha-direita">
|
||||
<div className="campo-de-input">
|
||||
<label>Observações</label>
|
||||
<textarea
|
||||
name="observacoes"
|
||||
rows="4"
|
||||
cols="1"
|
||||
onChange={handleChange}
|
||||
value={agendamento.observacoes || ''}
|
||||
/>
|
||||
value={agendamento.observacoes || ""}
|
||||
></textarea>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<div className="campo-de-input-check">
|
||||
<input
|
||||
className="form-check-input form-custom-check"
|
||||
type="checkbox"
|
||||
name="status"
|
||||
onChange={handleCheckbox}
|
||||
checked={status === "requested"}
|
||||
/>
|
||||
<label className="form-check-label checkbox-label" htmlFor="status">
|
||||
Adicionar à fila de espera
|
||||
</label>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<div className="form-actions">
|
||||
<button type="submit" className="btn-primary">Salvar agendamento</button>
|
||||
<button type="button" className="btn-cancel" onClick={onCancel}>Cancelar</button>
|
||||
<button
|
||||
type="submit"
|
||||
className="btn-primary"
|
||||
disabled={isSubmitting}
|
||||
>
|
||||
{isSubmitting ? "Salvando..." : "Salvar agendamento"}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
className="btn-cancel"
|
||||
onClick={onCancel}
|
||||
>
|
||||
Cancelar
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
//Nesta página falta: ajustar caminho do CSS
|
||||
|
||||
import { useState } from 'react'
|
||||
import { useNavigate } from 'react-router-dom'
|
||||
import { useAuth } from '../_assets/utils/AuthProvider'
|
||||
@ -9,13 +7,56 @@ import html2pdf from 'html2pdf.js'
|
||||
|
||||
import '../../_assets/css/medico/FormRelatorio.css'
|
||||
|
||||
const FormRelatorio = ({onSave, DictInfo, setDictInfo }) => {
|
||||
const {getAuthorizationHeader} = useAuth()
|
||||
const FormRelatorio = ({ onSave, DictInfo, setDictInfo }) => {
|
||||
const { getAuthorizationHeader } = useAuth()
|
||||
let authHeader = getAuthorizationHeader()
|
||||
const navigate= useNavigate()
|
||||
const navigate = useNavigate()
|
||||
|
||||
const [showModal, setShowModal] = useState(false)
|
||||
|
||||
// --- NOVO: Estado para controlar o loading da transcrição ---
|
||||
const [isTranscribing, setIsTranscribing] = useState(false);
|
||||
|
||||
// --- NOVA FUNÇÃO: Envia o áudio e preenche o formulário ---
|
||||
const handleAudioUpload = async (e) => {
|
||||
const file = e.target.files[0];
|
||||
if (!file) return;
|
||||
|
||||
setIsTranscribing(true); // Ativa o spinner
|
||||
|
||||
const formData = new FormData();
|
||||
formData.append('audio', file); // 'audio' deve ser o nome esperado no backend
|
||||
|
||||
try {
|
||||
// ⚠️ ATENÇÃO: Substitua essa URL pela rota do seu backend que criamos
|
||||
const response = await fetch('http://localhost:3001/api/transcrever-relatorio', {
|
||||
method: 'POST',
|
||||
body: formData,
|
||||
// headers: { 'Authorization': authHeader } // Descomente se seu backend precisar de token
|
||||
});
|
||||
|
||||
if (!response.ok) throw new Error("Falha na transcrição");
|
||||
|
||||
const data = await response.json();
|
||||
|
||||
// Atualiza o DictInfo com os dados vindos da IA
|
||||
setDictInfo((prev) => ({
|
||||
...prev,
|
||||
exam: data.exam || prev.exam, // Preenche se a IA achou, senão mantém o antigo
|
||||
diagnostico: data.diagnostico || prev.diagnostico,
|
||||
conclusao: data.conclusao || prev.conclusao
|
||||
}));
|
||||
|
||||
} catch (error) {
|
||||
console.error("Erro no upload de áudio:", error);
|
||||
alert("Não foi possível gerar o relatório por áudio. Verifique o backend.");
|
||||
} finally {
|
||||
setIsTranscribing(false); // Desativa o spinner
|
||||
e.target.value = null; // Limpa o input para permitir enviar o mesmo arquivo novamente se quiser
|
||||
}
|
||||
};
|
||||
// -----------------------------------------------------------
|
||||
|
||||
const BaixarPDFdoRelatorio = () => {
|
||||
const elemento = document.getElementById("folhaA4"); // tua div do relatório
|
||||
const opt = {
|
||||
@ -31,7 +72,7 @@ const FormRelatorio = ({onSave, DictInfo, setDictInfo }) => {
|
||||
const handleChange = (e) => {
|
||||
const { name, value } = e.target;
|
||||
console.log(name, value)
|
||||
if(name === 'paciente_cpf') {
|
||||
if (name === 'paciente_cpf') {
|
||||
const formattedCPF = FormatCPF(value);
|
||||
setDictInfo((prev) => ({ ...prev, [name]: formattedCPF }));
|
||||
|
||||
@ -40,17 +81,17 @@ const FormRelatorio = ({onSave, DictInfo, setDictInfo }) => {
|
||||
if (patientData) {
|
||||
setDictInfo((prev) => ({
|
||||
...prev,
|
||||
paciente_cpf:value,
|
||||
paciente_cpf: value,
|
||||
paciente_nome: patientData.full_name,
|
||||
paciente_id: patientData.id
|
||||
}));
|
||||
}
|
||||
|
||||
};
|
||||
if(formattedCPF.length === 14){
|
||||
if (formattedCPF.length === 14) {
|
||||
fetchPatient();
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
setDictInfo((prev) => ({ ...prev, [name]: value }));
|
||||
}
|
||||
}
|
||||
@ -60,25 +101,21 @@ const FormRelatorio = ({onSave, DictInfo, setDictInfo }) => {
|
||||
console.log(DictInfo)
|
||||
setShowModal(true)
|
||||
|
||||
|
||||
onSave({
|
||||
onSave({
|
||||
"patient_id": DictInfo.paciente_id,
|
||||
|
||||
"exam": DictInfo.exam,
|
||||
"diagnosis": DictInfo.diagnosis,
|
||||
"diagnosis": DictInfo.diagnostico, // Garanta que o backend espera 'diagnosis' mas seu state usa 'diagnostico'
|
||||
"conclusion": DictInfo.conclusao,
|
||||
"status": "draft",
|
||||
"requested_by": DictInfo.requested_by,
|
||||
|
||||
"hide_date": false,
|
||||
"hide_signature": false,
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
return (
|
||||
<div>
|
||||
{showModal &&(
|
||||
{showModal && (
|
||||
<div className="modal" style={{ display: 'block', backgroundColor: 'rgba(0,0,0,0.5)' }}>
|
||||
<div className="modal-dialog">
|
||||
<div className="modal-content">
|
||||
@ -94,12 +131,12 @@ onSave({
|
||||
<p>Você também pode baixa-lo agora em pdf</p>
|
||||
</div>
|
||||
<div className="modal-footer">
|
||||
<button className="btn btn-primary" onClick={ BaixarPDFdoRelatorio}><i className='bi bi-file-pdf-fill'></i> baixar em pdf</button>
|
||||
<button className="btn btn-primary" onClick={BaixarPDFdoRelatorio}><i className='bi bi-file-pdf-fill'></i> baixar em pdf</button>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-primary"
|
||||
onClick={() => {setShowModal(false); navigate(('/medico/relatorios'))}}
|
||||
onClick={() => { setShowModal(false); navigate(('/medico/relatorios')) }}
|
||||
>
|
||||
Fechar
|
||||
</button>
|
||||
@ -112,6 +149,28 @@ onSave({
|
||||
|
||||
<div className='card'>
|
||||
|
||||
{/* --- ÁREA DE UPLOAD DE ÁUDIO (INSERIDA AQUI) --- */}
|
||||
<div className="p-3 mb-3 border-bottom bg-light">
|
||||
<label className="form-label fw-bold">🎙️ Preenchimento Automático via Áudio</label>
|
||||
<div className="d-flex align-items-center gap-3">
|
||||
{isTranscribing ? (
|
||||
<div className="d-flex align-items-center text-primary">
|
||||
<div className="spinner-border spinner-border-sm me-2" role="status"></div>
|
||||
<span>A IA está gerando o relatório... aguarde.</span>
|
||||
</div>
|
||||
) : (
|
||||
<input
|
||||
type="file"
|
||||
className="form-control"
|
||||
accept="audio/*"
|
||||
onChange={handleAudioUpload}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
<small className="text-muted">Envie um áudio ditando o exame, diagnóstico e conclusão.</small>
|
||||
</div>
|
||||
{/* ----------------------------------------------- */}
|
||||
|
||||
<form action="" onSubmit={handleSubmit}>
|
||||
<div id='primeiraLinha'>
|
||||
|
||||
@ -133,7 +192,7 @@ onSave({
|
||||
|
||||
<div className="col-md-2 mb-3">
|
||||
<label >Exame:</label>
|
||||
<input type="text" className="form-control" name="exam" onChange={handleChange} />
|
||||
<input type="text" className="form-control" name="exam" onChange={handleChange} value={DictInfo.exam || ''} />
|
||||
</div>
|
||||
|
||||
|
||||
@ -179,7 +238,8 @@ onSave({
|
||||
<p>Paciente: {DictInfo?.paciente_nome}</p>
|
||||
<p>Data de nascimento: </p>
|
||||
|
||||
<p>Data do exame: {DictInfo.data_exam}</p>
|
||||
{/* Corrigi de data_exam para data_exame para bater com o state */}
|
||||
<p>Data do exame: {DictInfo.data_exame}</p>
|
||||
|
||||
<p>Exame: {DictInfo.exam}</p>
|
||||
|
||||
@ -191,7 +251,7 @@ onSave({
|
||||
|
||||
<div>
|
||||
<p>Dr {DictInfo.requested_by}</p>
|
||||
<p>Emitido em: 0</p>
|
||||
<p>Emitido em: {new Date().toLocaleDateString()}</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@ -25,5 +25,10 @@
|
||||
"name": "Painel Administrativo",
|
||||
"icon": "file-bar-graph-fill",
|
||||
"url": "/admin/painel"
|
||||
},
|
||||
{
|
||||
"name": "Gestão de Usuários",
|
||||
"icon": "people-fill",
|
||||
"url": "/admin/gestao"
|
||||
}
|
||||
]
|
||||
@ -5,6 +5,12 @@
|
||||
"url": "/medico/agendamento"
|
||||
},
|
||||
|
||||
{
|
||||
"name": "Relatório por Áudio",
|
||||
"icon": "file-earmark-plus-fill",
|
||||
"url": "/medico/novo-relatorio-audio"
|
||||
},
|
||||
|
||||
{
|
||||
"name": "Relatórios",
|
||||
"icon": "file-earmark-text-fill",
|
||||
|
||||
@ -1,13 +1,12 @@
|
||||
//gestao.jsx
|
||||
|
||||
import { FaEdit, FaTrash } from "react-icons/fa";
|
||||
import React from "react";
|
||||
import "../../_assets/css/pages/admin/DashboardUsuarios.css";
|
||||
|
||||
function UserDashboard() {
|
||||
return (
|
||||
|
||||
<div className="dashboard-container">
|
||||
|
||||
<div className="dashboard-header">
|
||||
<div>
|
||||
<h1 className="dashboard-title">Gestão de Usuários</h1>
|
||||
@ -90,8 +89,9 @@ function UserDashboard() {
|
||||
<td><span className="status-badge ativo">Ativo</span></td>
|
||||
<td>20/12/2024, 08:30</td>
|
||||
<td className="actions">
|
||||
<span className="action-icon"></span>
|
||||
<span className="action-icon"></span>
|
||||
<button className="action-btn detalhes">Ver Detalhes</button>
|
||||
<button className="action-btn editar">Editar</button>
|
||||
<button className="action-btn excluir">Excluir</button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -102,8 +102,9 @@ function UserDashboard() {
|
||||
<td><span className="status-badge ativo">Ativo</span></td>
|
||||
<td>19/12/2024, 14:20</td>
|
||||
<td className="actions">
|
||||
<span className="action-icon"></span>
|
||||
<span className="action-icon"></span>
|
||||
<button className="action-btn detalhes">Ver Detalhes</button>
|
||||
<button className="action-btn editar">Editar</button>
|
||||
<button className="action-btn excluir">Excluir</button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -114,8 +115,9 @@ function UserDashboard() {
|
||||
<td><span className="status-badge ativo">Ativo</span></td>
|
||||
<td>20/12/2024, 07:45</td>
|
||||
<td className="actions">
|
||||
<span className="action-icon"></span>
|
||||
<span className="action-icon"></span>
|
||||
<button className="action-btn detalhes">Ver Detalhes</button>
|
||||
<button className="action-btn editar">Editar</button>
|
||||
<button className="action-btn excluir">Excluir</button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -126,8 +128,9 @@ function UserDashboard() {
|
||||
<td><span className="status-badge inativo">Inativo</span></td>
|
||||
<td>15/12/2024, 16:30</td>
|
||||
<td className="actions">
|
||||
<span className="action-icon"></span>
|
||||
<span className="person-badge-fill"></span>
|
||||
<button className="action-btn detalhes">Ver Detalhes</button>
|
||||
<button className="action-btn editar">Editar</button>
|
||||
<button className="action-btn excluir">Excluir</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@ -137,5 +140,4 @@ function UserDashboard() {
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
export default UserDashboard;
|
||||
@ -10,7 +10,7 @@ const CONVENIOS_LIST = [
|
||||
"SulAmérica",
|
||||
"Unimed",
|
||||
"Cassio",
|
||||
"Outro"
|
||||
"Outro",
|
||||
];
|
||||
|
||||
function CurrencyInput({ value, onChange, label, id }) {
|
||||
@ -19,22 +19,25 @@ function CurrencyInput({ value, onChange, label, id }) {
|
||||
|
||||
let stringValue = String(numericValue);
|
||||
while (stringValue.length < 3) {
|
||||
stringValue = '0' + stringValue;
|
||||
stringValue = "0" + stringValue;
|
||||
}
|
||||
|
||||
const integerPart = stringValue.slice(0, -2);
|
||||
const decimalPart = stringValue.slice(-2);
|
||||
|
||||
const formattedInteger = integerPart.replace(/\B(?=(\d{3})+(?!\d))/g, '.');
|
||||
const formattedInteger = integerPart.replace(/\B(?=(\d{3})+(?!\d))/g, ".");
|
||||
|
||||
return `R$ ${formattedInteger},${decimalPart}`;
|
||||
}, [value]);
|
||||
|
||||
const handleKeyDown = useCallback((e) => {
|
||||
const handleKeyDown = useCallback(
|
||||
(e) => {
|
||||
const key = e.key;
|
||||
|
||||
if (['Backspace', 'Delete', 'ArrowLeft', 'ArrowRight', 'Tab'].includes(key)) {
|
||||
if (key === 'Backspace' || key === 'Delete') {
|
||||
if (
|
||||
["Backspace", "Delete", "ArrowLeft", "ArrowRight", "Tab"].includes(key)
|
||||
) {
|
||||
if (key === "Backspace" || key === "Delete") {
|
||||
e.preventDefault();
|
||||
const numericValue = value || 0;
|
||||
let newValueString = String(numericValue);
|
||||
@ -65,7 +68,9 @@ function CurrencyInput({ value, onChange, label, id }) {
|
||||
const newNumericValue = parseInt(newValueString);
|
||||
|
||||
onChange(newNumericValue);
|
||||
}, [value, onChange]);
|
||||
},
|
||||
[value, onChange]
|
||||
);
|
||||
|
||||
return (
|
||||
<div className="form-group">
|
||||
@ -93,7 +98,7 @@ function mockFetchPagamentos() {
|
||||
data_vencimento: "2025-09-30",
|
||||
status: "pendente",
|
||||
desconto: 0,
|
||||
observacoes: "Pagamento parcelado em 2x"
|
||||
observacoes: "Pagamento parcelado em 2x",
|
||||
},
|
||||
{
|
||||
id: "PAY-002",
|
||||
@ -103,7 +108,7 @@ function mockFetchPagamentos() {
|
||||
data_vencimento: "2025-09-15",
|
||||
status: "pago",
|
||||
desconto: 1000,
|
||||
observacoes: ""
|
||||
observacoes: "",
|
||||
},
|
||||
{
|
||||
id: "PAY-003",
|
||||
@ -113,7 +118,7 @@ function mockFetchPagamentos() {
|
||||
data_vencimento: "2025-09-20",
|
||||
status: "vencido",
|
||||
desconto: 0,
|
||||
observacoes: "Não respondeu ao contato"
|
||||
observacoes: "Não respondeu ao contato",
|
||||
},
|
||||
{
|
||||
id: "PAY-004",
|
||||
@ -123,8 +128,8 @@ function mockFetchPagamentos() {
|
||||
data_vencimento: "2025-09-29",
|
||||
status: "pago",
|
||||
desconto: 500,
|
||||
observacoes: "Desconto por pagamento adiantado"
|
||||
}
|
||||
observacoes: "Desconto por pagamento adiantado",
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
@ -134,7 +139,11 @@ export default function FinanceiroDashboard() {
|
||||
const [query, setQuery] = useState("");
|
||||
const [filtroStatus, setFiltroStatus] = useState("Todos");
|
||||
const [novoPagamento, setNovoPagamento] = useState(false);
|
||||
const [summary, setSummary] = useState({ totalRecebido: 0, totalAReceber: 0, totalDescontos: 0 });
|
||||
const [summary, setSummary] = useState({
|
||||
totalRecebido: 0,
|
||||
totalAReceber: 0,
|
||||
totalDescontos: 0,
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
const data = mockFetchPagamentos();
|
||||
@ -143,7 +152,13 @@ export default function FinanceiroDashboard() {
|
||||
|
||||
function formatCurrency(centavos) {
|
||||
const valorEmReais = centavos / 100;
|
||||
return "R$ " + valorEmReais.toFixed(2).replace(".", ",").replace(/\B(?=(\d{3})+(?!\d))/g, '.');
|
||||
return (
|
||||
"R$ " +
|
||||
valorEmReais
|
||||
.toFixed(2)
|
||||
.replace(".", ",")
|
||||
.replace(/\B(?=(\d{3})+(?!\d))/g, ".")
|
||||
);
|
||||
}
|
||||
|
||||
function getValorLiquido(valor, desconto) {
|
||||
@ -151,10 +166,11 @@ export default function FinanceiroDashboard() {
|
||||
}
|
||||
|
||||
const filteredPagamentos = useMemo(() => {
|
||||
return pagamentos.filter(p => {
|
||||
return pagamentos.filter((p) => {
|
||||
const q = query.toLowerCase();
|
||||
const statusOk = filtroStatus === "Todos" || p.status === filtroStatus;
|
||||
const buscaOk = p.paciente.nome.toLowerCase().includes(q) ||
|
||||
const buscaOk =
|
||||
p.paciente.nome.toLowerCase().includes(q) ||
|
||||
p.id.toLowerCase().includes(q);
|
||||
return statusOk && buscaOk;
|
||||
});
|
||||
@ -165,42 +181,50 @@ export default function FinanceiroDashboard() {
|
||||
let aReceber = 0;
|
||||
let descontos = 0;
|
||||
|
||||
filteredPagamentos.forEach(p => {
|
||||
filteredPagamentos.forEach((p) => {
|
||||
const valorLiquido = getValorLiquido(p.valor, p.desconto);
|
||||
if (p.status === 'pago') {
|
||||
if (p.status === "pago") {
|
||||
recebido += valorLiquido;
|
||||
descontos += p.desconto;
|
||||
} else {
|
||||
aReceber += p.valor;
|
||||
aReceber += valorLiquido;
|
||||
}
|
||||
});
|
||||
|
||||
setSummary({
|
||||
totalRecebido: recebido,
|
||||
totalAReceber: aReceber,
|
||||
totalDescontos: descontos
|
||||
totalDescontos: descontos,
|
||||
});
|
||||
}, [filteredPagamentos]);
|
||||
|
||||
function handleDelete(id) {
|
||||
if (window.confirm("Tem certeza que deseja excluir este pagamento?")) {
|
||||
setPagamentos(prev => prev.filter(p => p.id !== id));
|
||||
setPagamentos((prev) => prev.filter((p) => p.id !== id));
|
||||
setModalPagamento(null);
|
||||
}
|
||||
}
|
||||
|
||||
function handleSave(pagamento) {
|
||||
if (!pagamento.paciente.nome || !pagamento.valor || !pagamento.data_vencimento || !pagamento.paciente.convenio) {
|
||||
if (
|
||||
!pagamento.paciente.nome ||
|
||||
!pagamento.valor ||
|
||||
!pagamento.data_vencimento ||
|
||||
!pagamento.paciente.convenio
|
||||
) {
|
||||
alert("Preencha Paciente, Convênio, Valor e Data de Vencimento.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (novoPagamento) {
|
||||
const newId = "PAY-" + (pagamentos.length + 1).toString().padStart(3, "0");
|
||||
const newId =
|
||||
"PAY-" + (pagamentos.length + 1).toString().padStart(3, "0");
|
||||
pagamento.id = newId;
|
||||
setPagamentos(prev => [...prev, pagamento]);
|
||||
setPagamentos((prev) => [...prev, pagamento]);
|
||||
} else {
|
||||
setPagamentos(prev => prev.map(p => p.id === pagamento.id ? pagamento : p));
|
||||
setPagamentos((prev) =>
|
||||
prev.map((p) => (p.id === pagamento.id ? pagamento : p))
|
||||
);
|
||||
}
|
||||
setModalPagamento(null);
|
||||
setNovoPagamento(false);
|
||||
@ -231,32 +255,35 @@ export default function FinanceiroDashboard() {
|
||||
</div>
|
||||
|
||||
<div className="list-page-card">
|
||||
<div style={{ display:"flex", gap:12, marginBottom:20 }}>
|
||||
<div style={{ display: "flex", gap: 12, marginBottom: 20 }}>
|
||||
<input
|
||||
className="input-field"
|
||||
placeholder="Buscar paciente"
|
||||
value={query}
|
||||
onChange={e => setQuery(e.target.value)}
|
||||
onChange={(e) => setQuery(e.target.value)}
|
||||
style={{ flexGrow: 1 }}
|
||||
/>
|
||||
<select className="select-field" value={filtroStatus} onChange={e => setFiltroStatus(e.target.value)}>
|
||||
<select
|
||||
className="select-field"
|
||||
value={filtroStatus}
|
||||
onChange={(e) => setFiltroStatus(e.target.value)}
|
||||
>
|
||||
<option value="Todos">Todos</option>
|
||||
<option value="pago">Pago</option>
|
||||
<option value="pendente">Pendente</option>
|
||||
<option value="vencido">Vencido</option>
|
||||
</select>
|
||||
<button
|
||||
className="action-btn"
|
||||
style={{ background: "#3b82f6", color: "#fff", borderColor: "#3b82f6" }}
|
||||
className="btn btn-primary"
|
||||
onClick={() => {
|
||||
setModalPagamento({
|
||||
paciente: { nome:"", convenio: CONVENIOS_LIST[0] },
|
||||
valor:0,
|
||||
forma_pagamento:"Dinheiro",
|
||||
data_vencimento: new Date().toISOString().split('T')[0],
|
||||
status:"pendente",
|
||||
desconto:0,
|
||||
observacoes:""
|
||||
paciente: { nome: "", convenio: CONVENIOS_LIST[0] },
|
||||
valor: 0,
|
||||
forma_pagamento: "Dinheiro",
|
||||
data_vencimento: new Date().toISOString().split("T")[0],
|
||||
status: "pendente",
|
||||
desconto: 0,
|
||||
observacoes: "",
|
||||
});
|
||||
setNovoPagamento(true);
|
||||
}}
|
||||
@ -284,29 +311,38 @@ export default function FinanceiroDashboard() {
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{filteredPagamentos.map(p => (
|
||||
{filteredPagamentos.map((p) => (
|
||||
<tr key={p.id}>
|
||||
<td>{p.paciente.nome}</td>
|
||||
<td style={{ fontWeight: 600 }}>{p.paciente.nome}</td>
|
||||
<td>{p.paciente.convenio}</td>
|
||||
<td>{formatCurrency(p.valor)}</td>
|
||||
<td>{formatCurrency(p.desconto)}</td>
|
||||
<td style={{ fontWeight: 600 }}>{formatCurrency(getValorLiquido(p.valor, p.desconto))}</td>
|
||||
<td style={{ fontWeight: 600 }}>
|
||||
{formatCurrency(getValorLiquido(p.valor, p.desconto))}
|
||||
</td>
|
||||
<td>{p.forma_pagamento}</td>
|
||||
<td>{p.data_vencimento.split('-').reverse().join('/')}</td>
|
||||
<td><span className={`badge ${p.status}`}>{p.status.toUpperCase()}</span></td>
|
||||
<td>{p.data_vencimento.split("-").reverse().join("/")}</td>
|
||||
<td>
|
||||
<span className={`badge ${p.status}`}>
|
||||
{p.status.toUpperCase()}
|
||||
</span>
|
||||
</td>
|
||||
<td>
|
||||
<div className="action-group">
|
||||
<button
|
||||
className="action-btn"
|
||||
onClick={() => { setModalPagamento({...p}); setNovoPagamento(false); }}
|
||||
className="btn-view"
|
||||
onClick={() => {
|
||||
setModalPagamento({ ...p });
|
||||
setNovoPagamento(false);
|
||||
}}
|
||||
>
|
||||
Ver / Editar
|
||||
<i className="bi bi-eye me-1"></i> Ver Detalhes
|
||||
</button>
|
||||
<button
|
||||
className="action-btn delete"
|
||||
className="btn-delete"
|
||||
onClick={() => handleDelete(p.id)}
|
||||
>
|
||||
Excluir
|
||||
<i className="bi bi-trash me-1"></i> Excluir
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
@ -319,11 +355,20 @@ export default function FinanceiroDashboard() {
|
||||
</div>
|
||||
|
||||
{modalPagamento && (
|
||||
<div className="modal" onClick={(e) => e.target.classList.contains('modal') && closeModal()}>
|
||||
<div
|
||||
className="modal"
|
||||
onClick={(e) => e.target.classList.contains("modal") && closeModal()}
|
||||
>
|
||||
<div className="modal-card">
|
||||
<div className="modal-header">
|
||||
<h2>{novoPagamento ? "Adicionar Pagamento" : `Editar Pagamento - ${modalPagamento.paciente.nome}`}</h2>
|
||||
<button className="close-btn" onClick={closeModal}>×</button>
|
||||
<h2>
|
||||
{novoPagamento
|
||||
? "Adicionar Pagamento"
|
||||
: `Editar Pagamento - ${modalPagamento.paciente.nome}`}
|
||||
</h2>
|
||||
<button className="close-btn" onClick={closeModal}>
|
||||
×
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div className="modal-body">
|
||||
@ -333,7 +378,15 @@ export default function FinanceiroDashboard() {
|
||||
id="paciente_nome"
|
||||
className="input-field"
|
||||
value={modalPagamento.paciente.nome}
|
||||
onChange={e => setModalPagamento({...modalPagamento, paciente:{...modalPagamento.paciente, nome:e.target.value}})}
|
||||
onChange={(e) =>
|
||||
setModalPagamento({
|
||||
...modalPagamento,
|
||||
paciente: {
|
||||
...modalPagamento.paciente,
|
||||
nome: e.target.value,
|
||||
},
|
||||
})
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
|
||||
@ -343,11 +396,21 @@ export default function FinanceiroDashboard() {
|
||||
id="convenio"
|
||||
className="select-field"
|
||||
value={modalPagamento.paciente.convenio}
|
||||
onChange={e => setModalPagamento({...modalPagamento, paciente:{...modalPagamento.paciente, convenio:e.target.value}})}
|
||||
onChange={(e) =>
|
||||
setModalPagamento({
|
||||
...modalPagamento,
|
||||
paciente: {
|
||||
...modalPagamento.paciente,
|
||||
convenio: e.target.value,
|
||||
},
|
||||
})
|
||||
}
|
||||
>
|
||||
<option value="">Selecione</option>
|
||||
{CONVENIOS_LIST.map(conv => (
|
||||
<option key={conv} value={conv}>{conv}</option>
|
||||
{CONVENIOS_LIST.map((conv) => (
|
||||
<option key={conv} value={conv}>
|
||||
{conv}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</div>
|
||||
@ -355,14 +418,18 @@ export default function FinanceiroDashboard() {
|
||||
id="valor"
|
||||
label="Valor da consulta (R$)"
|
||||
value={modalPagamento.valor}
|
||||
onChange={newValue => setModalPagamento({...modalPagamento, valor: newValue})}
|
||||
onChange={(newValue) =>
|
||||
setModalPagamento({ ...modalPagamento, valor: newValue })
|
||||
}
|
||||
/>
|
||||
|
||||
<CurrencyInput
|
||||
id="desconto"
|
||||
label="Desconto aplicado (R$)"
|
||||
value={modalPagamento.desconto}
|
||||
onChange={newValue => setModalPagamento({...modalPagamento, desconto: newValue})}
|
||||
onChange={(newValue) =>
|
||||
setModalPagamento({ ...modalPagamento, desconto: newValue })
|
||||
}
|
||||
/>
|
||||
|
||||
<div className="form-group">
|
||||
@ -371,7 +438,12 @@ export default function FinanceiroDashboard() {
|
||||
id="forma"
|
||||
className="select-field"
|
||||
value={modalPagamento.forma_pagamento}
|
||||
onChange={e => setModalPagamento({...modalPagamento, forma_pagamento:e.target.value})}
|
||||
onChange={(e) =>
|
||||
setModalPagamento({
|
||||
...modalPagamento,
|
||||
forma_pagamento: e.target.value,
|
||||
})
|
||||
}
|
||||
>
|
||||
<option>Dinheiro</option>
|
||||
<option>Cartão</option>
|
||||
@ -387,7 +459,12 @@ export default function FinanceiroDashboard() {
|
||||
className="input-field"
|
||||
type="date"
|
||||
value={modalPagamento.data_vencimento}
|
||||
onChange={e => setModalPagamento({...modalPagamento, data_vencimento:e.target.value})}
|
||||
onChange={(e) =>
|
||||
setModalPagamento({
|
||||
...modalPagamento,
|
||||
data_vencimento: e.target.value,
|
||||
})
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
|
||||
@ -397,7 +474,12 @@ export default function FinanceiroDashboard() {
|
||||
id="status"
|
||||
className="select-field"
|
||||
value={modalPagamento.status}
|
||||
onChange={e => setModalPagamento({...modalPagamento, status:e.target.value})}
|
||||
onChange={(e) =>
|
||||
setModalPagamento({
|
||||
...modalPagamento,
|
||||
status: e.target.value,
|
||||
})
|
||||
}
|
||||
>
|
||||
<option value="pago">Pago</option>
|
||||
<option value="pendente">Pendente</option>
|
||||
@ -412,22 +494,25 @@ export default function FinanceiroDashboard() {
|
||||
className="input-field"
|
||||
rows={3}
|
||||
value={modalPagamento.observacoes}
|
||||
onChange={e => setModalPagamento({...modalPagamento, observacoes:e.target.value})}
|
||||
onChange={(e) =>
|
||||
setModalPagamento({
|
||||
...modalPagamento,
|
||||
observacoes: e.target.value,
|
||||
})
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="modal-footer">
|
||||
<button className="action-btn" onClick={() => handleSave(modalPagamento)}>
|
||||
Salvar
|
||||
</button>
|
||||
<button
|
||||
className="action-btn"
|
||||
onClick={closeModal}
|
||||
style={{ borderColor: '#d1d5db', color: '#4b5563' }}
|
||||
className="btn-view"
|
||||
onClick={() => handleSave(modalPagamento)}
|
||||
>
|
||||
Cancelar
|
||||
<i className="bi bi-check-circle me-1"></i> Salvar
|
||||
</button>
|
||||
<button className="btn-delete" onClick={closeModal}>
|
||||
<i className="bi bi-x-circle me-1"></i> Cancelar
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -4,14 +4,6 @@ import { useState, useEffect, useCallback } from "react";
|
||||
import { useLocation, useNavigate } from "react-router-dom";
|
||||
import '../../_assets/css/pages/geral/PerfilUsuario.css';
|
||||
|
||||
|
||||
const MOCK_API_BASE_URL = "https://mock.apidog.com/m1/1053378-0-default";
|
||||
|
||||
|
||||
const getLocalAvatar = () => localStorage.getItem('user_avatar');
|
||||
const setLocalAvatar = (avatarData) => localStorage.setItem('user_avatar', avatarData);
|
||||
const clearLocalAvatar = () => localStorage.removeItem('user_avatar');
|
||||
|
||||
const ROLES = {
|
||||
ADMIN: "Administrador",
|
||||
SECRETARY: "Secretária",
|
||||
@ -38,7 +30,6 @@ const ProfilePage = () => {
|
||||
const [userEmail, setUserEmail] = useState("admin@squad23.com");
|
||||
const [avatarUrl, setAvatarUrl] = useState(null);
|
||||
const [isEditingName, setIsEditingName] = useState(false);
|
||||
const [isUploading, setIsUploading] = useState(false);
|
||||
const [error, setError] = useState(null);
|
||||
|
||||
|
||||
@ -54,14 +45,21 @@ const ProfilePage = () => {
|
||||
|
||||
useEffect(() => {
|
||||
const loadProfileData = () => {
|
||||
|
||||
const localAvatar = getLocalAvatar();
|
||||
const localAvatar = localStorage.getItem('user_avatar');
|
||||
if (localAvatar) {
|
||||
setAvatarUrl(localAvatar);
|
||||
}
|
||||
};
|
||||
|
||||
loadProfileData();
|
||||
|
||||
|
||||
const handleStorageChange = () => {
|
||||
loadProfileData();
|
||||
};
|
||||
|
||||
window.addEventListener('storage', handleStorageChange);
|
||||
return () => window.removeEventListener('storage', handleStorageChange);
|
||||
}, []);
|
||||
|
||||
const handleNameSave = () => {
|
||||
@ -85,103 +83,6 @@ const ProfilePage = () => {
|
||||
|
||||
const handleClose = () => navigate(-1);
|
||||
|
||||
const handleAvatarUpload = async (event) => {
|
||||
const file = event.target.files[0];
|
||||
if (!file) return;
|
||||
|
||||
setError(null);
|
||||
|
||||
|
||||
const MAX_FILE_SIZE = 5 * 1024 * 1024;
|
||||
const ACCEPTED_TYPES = ['image/jpeg', 'image/png', 'image/gif', 'image/webp'];
|
||||
|
||||
if (file.size > MAX_FILE_SIZE) {
|
||||
setError("Arquivo muito grande. Máximo 5MB.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ACCEPTED_TYPES.includes(file.type)) {
|
||||
setError("Tipo de arquivo não suportado. Use JPEG, PNG, GIF ou WebP.");
|
||||
return;
|
||||
}
|
||||
|
||||
setIsUploading(true);
|
||||
|
||||
try {
|
||||
|
||||
try {
|
||||
const result = await uploadAvatarToMockAPI(file);
|
||||
|
||||
const newAvatarUrl = result.url || result.avatarUrl;
|
||||
if (newAvatarUrl) {
|
||||
setAvatarUrl(newAvatarUrl);
|
||||
setLocalAvatar(newAvatarUrl);
|
||||
console.log('Avatar enviado para API com sucesso');
|
||||
return;
|
||||
}
|
||||
} catch (apiError) {
|
||||
|
||||
console.log('API não disponível, salvando localmente...');
|
||||
}
|
||||
|
||||
|
||||
const reader = new FileReader();
|
||||
reader.onload = (e) => {
|
||||
const imageDataUrl = e.target.result;
|
||||
setLocalAvatar(imageDataUrl);
|
||||
setAvatarUrl(imageDataUrl);
|
||||
console.log('Avatar salvo localmente');
|
||||
};
|
||||
reader.readAsDataURL(file);
|
||||
|
||||
} catch (error) {
|
||||
|
||||
console.error('Erro no processamento:', error);
|
||||
const reader = new FileReader();
|
||||
reader.onload = (e) => {
|
||||
const imageDataUrl = e.target.result;
|
||||
setLocalAvatar(imageDataUrl);
|
||||
setAvatarUrl(imageDataUrl);
|
||||
};
|
||||
reader.readAsDataURL(file);
|
||||
} finally {
|
||||
setIsUploading(false);
|
||||
event.target.value = '';
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
const uploadAvatarToMockAPI = async (file) => {
|
||||
const formData = new FormData();
|
||||
formData.append("avatar", file);
|
||||
|
||||
const response = await fetch(`${MOCK_API_BASE_URL}/storage/v1/object/avatars/[path]`, {
|
||||
method: "POST",
|
||||
body: formData
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
return await response.json();
|
||||
};
|
||||
|
||||
|
||||
const clearAvatar = () => {
|
||||
|
||||
fetch(`${MOCK_API_BASE_URL}/storage/v1/object/avatars/[path]`, {
|
||||
method: "DELETE"
|
||||
}).catch(() => {
|
||||
|
||||
});
|
||||
|
||||
|
||||
clearLocalAvatar();
|
||||
setAvatarUrl(null);
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="profile-overlay" role="dialog" aria-modal="true">
|
||||
<div className="profile-modal">
|
||||
@ -204,7 +105,7 @@ const ProfilePage = () => {
|
||||
className="avatar-img"
|
||||
onError={() => {
|
||||
setAvatarUrl(null);
|
||||
clearLocalAvatar();
|
||||
localStorage.removeItem('user_avatar');
|
||||
}}
|
||||
/>
|
||||
) : (
|
||||
@ -214,25 +115,14 @@ const ProfilePage = () => {
|
||||
)}
|
||||
</div>
|
||||
|
||||
<label
|
||||
className={`avatar-edit-btn ${isUploading ? 'uploading' : ''}`}
|
||||
title="Alterar foto de perfil"
|
||||
>
|
||||
{isUploading ? 'Enviando...' : 'Alterar Foto'}
|
||||
<input
|
||||
type="file"
|
||||
accept="image/*"
|
||||
onChange={handleAvatarUpload}
|
||||
disabled={isUploading}
|
||||
style={{ display: "none" }}
|
||||
/>
|
||||
</label>
|
||||
|
||||
{isUploading && (
|
||||
<p className="upload-status">
|
||||
Processando imagem...
|
||||
<p style={{
|
||||
textAlign: 'center',
|
||||
marginTop: '10px',
|
||||
fontSize: '0.85rem',
|
||||
color: '#666'
|
||||
}}>
|
||||
Gerencie seu avatar no menu do perfil acima
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -288,11 +178,6 @@ const ProfilePage = () => {
|
||||
</div>
|
||||
|
||||
<div className="profile-actions">
|
||||
{avatarUrl && (
|
||||
<button onClick={clearAvatar} className="btn btn-clear">
|
||||
Remover Avatar
|
||||
</button>
|
||||
)}
|
||||
<button
|
||||
className="btn btn-close"
|
||||
onClick={handleClose}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,7 @@
|
||||
//FormNovoRelatorio.jsx
|
||||
|
||||
import { useEffect, useState, useRef } from 'react';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { useNavigate, useLocation } from 'react-router-dom';
|
||||
import { useAuth } from '../../_assets/utils/AuthProvider';
|
||||
import { GetAllPatients } from '../../_assets/utils/Functions-Endpoints/Patient';
|
||||
import { GetAllDoctors } from '../../_assets/utils/Functions-Endpoints/Doctor';
|
||||
@ -16,6 +16,7 @@ const FormNovoRelatorio = () => {
|
||||
const { getAuthorizationHeader } = useAuth();
|
||||
const authHeader = getAuthorizationHeader();
|
||||
const navigate = useNavigate();
|
||||
const location = useLocation();
|
||||
|
||||
const [patients, setPatients] = useState([]);
|
||||
const [doctors, setDoctors] = useState([]);
|
||||
@ -37,6 +38,7 @@ const FormNovoRelatorio = () => {
|
||||
const [showDoctorDropdown, setShowDoctorDropdown] = useState(false);
|
||||
const patientRef = useRef();
|
||||
const doctorRef = useRef();
|
||||
const [lockedFromAppointment, setLockedFromAppointment] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
let mounted = true;
|
||||
@ -133,7 +135,24 @@ const FormNovoRelatorio = () => {
|
||||
|
||||
const handleEditorChange = (html) => setForm(prev => ({ ...prev, contentHtml: html }));
|
||||
|
||||
// 🔹 Agora com created_by sendo o ID do usuário logado
|
||||
useEffect(() => {
|
||||
if (location && location.state && location.state.appointment) {
|
||||
const appt = location.state.appointment;
|
||||
const paciente_nome = location.state.paciente_nome || appt.paciente_nome || '';
|
||||
const medico_nome = location.state.medico_nome || appt.medico_nome || '';
|
||||
setForm(prev => ({
|
||||
...prev,
|
||||
patient_id: appt.patient_id || prev.patient_id,
|
||||
patient_name: paciente_nome || prev.patient_name,
|
||||
patient_birth: prev.patient_birth || '',
|
||||
doctor_id: appt.doctor_id || prev.doctor_id,
|
||||
doctor_name: medico_nome || prev.doctor_name,
|
||||
contentHtml: generateTemplate(paciente_nome, prev.patient_birth || '', medico_nome)
|
||||
}));
|
||||
setLockedFromAppointment(true);
|
||||
}
|
||||
}, [location]);
|
||||
|
||||
const handleSubmit = async (e) => {
|
||||
e.preventDefault();
|
||||
if (!form.patient_id) return alert('Selecione o paciente (clicando no item) antes de salvar.');
|
||||
@ -153,7 +172,6 @@ const FormNovoRelatorio = () => {
|
||||
requested_by: form.doctor_name || ''
|
||||
};
|
||||
|
||||
// Busca o id do usuário logado (via token)
|
||||
let userId = null;
|
||||
try {
|
||||
const token = authHeader?.replace(/^Bearer\s+/i, '') || '';
|
||||
@ -193,8 +211,6 @@ const FormNovoRelatorio = () => {
|
||||
}
|
||||
|
||||
const created = await res.json();
|
||||
console.log('Relatório criado:', created);
|
||||
|
||||
window.dispatchEvent(new Event('reports:refresh'));
|
||||
alert('Relatório criado com sucesso!');
|
||||
navigate('/medico/relatorios');
|
||||
@ -215,11 +231,12 @@ const FormNovoRelatorio = () => {
|
||||
<input
|
||||
className="form-control"
|
||||
placeholder="Comece a digitar (ex.: m para pacientes que começam com m)"
|
||||
value={patientQuery}
|
||||
onChange={(e) => { setPatientQuery(e.target.value); setShowPatientDropdown(true); }}
|
||||
onFocus={() => setShowPatientDropdown(true)}
|
||||
value={lockedFromAppointment ? form.patient_name : patientQuery}
|
||||
onChange={(e) => { if (!lockedFromAppointment) { setPatientQuery(e.target.value); setShowPatientDropdown(true); } }}
|
||||
onFocus={() => { if (!lockedFromAppointment) setShowPatientDropdown(true); }}
|
||||
disabled={lockedFromAppointment}
|
||||
/>
|
||||
{showPatientDropdown && patientQuery && (
|
||||
{!lockedFromAppointment && showPatientDropdown && patientQuery && (
|
||||
<ul className="list-group position-absolute" style={{ zIndex: 50, maxHeight: 220, overflowY: 'auto', width: '100%' }}>
|
||||
{filteredPatients.length > 0 ? filteredPatients.map(p => (
|
||||
<li key={p.id} className="list-group-item list-group-item-action" onClick={() => choosePatient(p)}>
|
||||
@ -236,11 +253,12 @@ const FormNovoRelatorio = () => {
|
||||
<input
|
||||
className="form-control"
|
||||
placeholder="Comece a digitar o nome do médico"
|
||||
value={doctorQuery}
|
||||
onChange={(e) => { setDoctorQuery(e.target.value); setShowDoctorDropdown(true); }}
|
||||
onFocus={() => setShowDoctorDropdown(true)}
|
||||
value={lockedFromAppointment ? form.doctor_name : doctorQuery}
|
||||
onChange={(e) => { if (!lockedFromAppointment) { setDoctorQuery(e.target.value); setShowDoctorDropdown(true); } }}
|
||||
onFocus={() => { if (!lockedFromAppointment) setShowDoctorDropdown(true); }}
|
||||
disabled={lockedFromAppointment}
|
||||
/>
|
||||
{showDoctorDropdown && doctorQuery && (
|
||||
{!lockedFromAppointment && showDoctorDropdown && doctorQuery && (
|
||||
<ul className="list-group position-absolute" style={{ zIndex: 50, maxHeight: 220, overflowY: 'auto', width: '100%' }}>
|
||||
{filteredDoctors.length > 0 ? filteredDoctors.map(d => (
|
||||
<li key={d.id} className="list-group-item list-group-item-action" onClick={() => chooseDoctor(d)}>
|
||||
|
||||
@ -47,7 +47,7 @@ const DoctorRelatorioManager = () => {
|
||||
if (authHeader) myHeaders.append('Authorization', authHeader);
|
||||
const requestOptions = { method: 'GET', headers: myHeaders, redirect: 'follow' };
|
||||
|
||||
// Tenta descobrir o ID do usuário logado para aplicar filtro por médico
|
||||
|
||||
let userId = null;
|
||||
let userFullName = null;
|
||||
try {
|
||||
@ -61,12 +61,12 @@ const DoctorRelatorioManager = () => {
|
||||
console.warn('Não foi possível obter UserInfos (pode não estar logado):', err);
|
||||
}
|
||||
|
||||
// Monta a URL com possíveis filtros preferenciais
|
||||
|
||||
const baseUrl = "https://yuanqfswhberkoevtmfr.supabase.co/rest/v1/reports?select=*";
|
||||
let data = [];
|
||||
|
||||
if (userId) {
|
||||
// 1) tenta por doctor_id
|
||||
|
||||
try {
|
||||
const res = await fetch(`${baseUrl}&doctor_id=eq.${userId}`, requestOptions);
|
||||
data = await res.json();
|
||||
@ -75,7 +75,7 @@ const DoctorRelatorioManager = () => {
|
||||
data = [];
|
||||
}
|
||||
|
||||
// 2) fallback para created_by (se vazio)
|
||||
|
||||
if ((!Array.isArray(data) || data.length === 0) && userId) {
|
||||
try {
|
||||
const res2 = await fetch(`${baseUrl}&created_by=eq.${userId}`, requestOptions);
|
||||
@ -86,10 +86,9 @@ const DoctorRelatorioManager = () => {
|
||||
}
|
||||
}
|
||||
|
||||
// 3) fallback para requested_by com nome completo (se ainda vazio)
|
||||
if ((!Array.isArray(data) || data.length === 0) && userFullName) {
|
||||
try {
|
||||
// encode para evitar problemas com espaços/caracteres especiais
|
||||
|
||||
const encodedName = encodeURIComponent(userFullName);
|
||||
const res3 = await fetch(`${baseUrl}&requested_by=eq.${encodedName}`, requestOptions);
|
||||
data = await res3.json();
|
||||
@ -100,7 +99,6 @@ const DoctorRelatorioManager = () => {
|
||||
}
|
||||
}
|
||||
|
||||
// Se não obteve userId ou nenhuma das tentativas acima retornou algo, busca tudo (comportamento anterior)
|
||||
if (!userId || (!Array.isArray(data) || data.length === 0)) {
|
||||
try {
|
||||
const resAll = await fetch(baseUrl, requestOptions);
|
||||
@ -111,7 +109,7 @@ const DoctorRelatorioManager = () => {
|
||||
}
|
||||
}
|
||||
|
||||
// garante unicidade e ordenação por criação
|
||||
|
||||
const uniqueMap = new Map();
|
||||
(Array.isArray(data) ? data : []).forEach(r => {
|
||||
if (r && r.id) uniqueMap.set(r.id, r);
|
||||
@ -145,14 +143,14 @@ const DoctorRelatorioManager = () => {
|
||||
};
|
||||
}, [authHeader]);
|
||||
|
||||
// Busca dados de pacientes e médicos baseados na lista final que aparece na tela
|
||||
|
||||
useEffect(() => {
|
||||
const fetchRelData = async () => {
|
||||
const pacientes = [];
|
||||
const medicos = [];
|
||||
for (let i = 0; i < relatoriosFinais.length; i++) {
|
||||
const rel = relatoriosFinais[i];
|
||||
// paciente
|
||||
|
||||
try {
|
||||
const pacienteRes = await GetPatientByID(rel.patient_id, authHeader);
|
||||
pacientes.push(Array.isArray(pacienteRes) ? pacienteRes[0] : pacienteRes);
|
||||
@ -160,13 +158,12 @@ const DoctorRelatorioManager = () => {
|
||||
pacientes.push(null);
|
||||
}
|
||||
|
||||
// médico: prioriza campos com id (doctor_id ou created_by). Se tiver somente requested_by (nome), usa nome.
|
||||
try {
|
||||
if (rel.doctor_id) {
|
||||
const docRes = await GetDoctorByID(rel.doctor_id, authHeader);
|
||||
medicos.push(Array.isArray(docRes) ? docRes[0] : docRes);
|
||||
} else if (rel.created_by) {
|
||||
// created_by costuma ser id
|
||||
|
||||
const docRes = await GetDoctorByID(rel.created_by, authHeader);
|
||||
medicos.push(Array.isArray(docRes) ? docRes[0] : docRes);
|
||||
} else if (rel.requested_by) {
|
||||
@ -175,7 +172,6 @@ const DoctorRelatorioManager = () => {
|
||||
medicos.push({ full_name: '' });
|
||||
}
|
||||
} catch (err) {
|
||||
// fallback para requested_by se houver
|
||||
medicos.push({ full_name: rel.requested_by || '' });
|
||||
}
|
||||
}
|
||||
@ -191,7 +187,6 @@ const DoctorRelatorioManager = () => {
|
||||
}, [relatoriosFinais, authHeader]);
|
||||
|
||||
const abrirModal = (relatorio, pageIndex) => {
|
||||
// encontra índice global do relatório no array relatoriosFinais (para alinhar com pacientes/medicos)
|
||||
const globalIndex = relatoriosFinais.findIndex(r => r.id === relatorio.id);
|
||||
const indexToUse = globalIndex >= 0 ? globalIndex : (indiceInicial + pageIndex);
|
||||
setRelatorioModal(relatorio);
|
||||
@ -199,7 +194,7 @@ const DoctorRelatorioManager = () => {
|
||||
setShowModal(true);
|
||||
};
|
||||
|
||||
// Função para limpar filtros
|
||||
|
||||
const limparFiltros = () => {
|
||||
setTermoPesquisa('');
|
||||
setFiltroExame('');
|
||||
@ -257,12 +252,11 @@ const DoctorRelatorioManager = () => {
|
||||
return (
|
||||
<div>
|
||||
{showModal && (
|
||||
<div className="modal modal-centered" role="dialog" aria-modal="true" onClick={() => setShowModal(false)}>
|
||||
<div className="modal-dialog modal-dialog-square" role="document" onClick={(e) => e.stopPropagation()}>
|
||||
<div className="modal fade show" style={{ display: "block", backgroundColor: "rgba(0, 0, 0, 0.5)" }} tabIndex="-1">
|
||||
<div className="modal-dialog modal-dialog-centered modal-lg">
|
||||
<div className="modal-content">
|
||||
<div className="modal-header custom-modal-header">
|
||||
<div className="modal-header" style={{ backgroundColor: '#1e3a8a', color: 'white' }}>
|
||||
<h5 className="modal-title">Relatório de {pacientesComRelatorios[modalIndex]?.full_name}</h5>
|
||||
<button type="button" className="btn-close modal-close-btn" aria-label="Close" onClick={() => setShowModal(false)}></button>
|
||||
</div>
|
||||
|
||||
<div className="modal-body">
|
||||
@ -291,11 +285,11 @@ const DoctorRelatorioManager = () => {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="modal-footer custom-modal-footer">
|
||||
<div className="modal-footer">
|
||||
<button className="btn btn-primary" onClick={() => BaixarPDFdoRelatorio(pacientesComRelatorios[modalIndex]?.full_name, modalIndex)}>
|
||||
<i className='bi bi-file-pdf-fill'></i> baixar em pdf
|
||||
<i className='bi bi-file-pdf-fill me-1'></i> Baixar em PDF
|
||||
</button>
|
||||
<button type="button" className="btn btn-outline-secondary" onClick={() => { setShowModal(false) }}>
|
||||
<button type="button" className="btn btn-secondary" onClick={() => { setShowModal(false) }}>
|
||||
Fechar
|
||||
</button>
|
||||
</div>
|
||||
@ -305,10 +299,11 @@ const DoctorRelatorioManager = () => {
|
||||
)}
|
||||
|
||||
<div className="page-heading"><h3>Lista de Relatórios</h3></div>
|
||||
<div className="page-content">
|
||||
<section className="row">
|
||||
<div className="col-12">
|
||||
<div className="card">
|
||||
<div className="card-header d-flex justify-content-between">
|
||||
<div className="card-header d-flex justify-content-between align-items-center">
|
||||
<h4 className="card-title mb-0">Relatórios Cadastrados</h4>
|
||||
<Link to={'criar'}>
|
||||
<button className="btn btn-primary">
|
||||
@ -455,6 +450,7 @@ const DoctorRelatorioManager = () => {
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
217
src/pages/medico/RelatorioAudio.jsx
Normal file
217
src/pages/medico/RelatorioAudio.jsx
Normal file
@ -0,0 +1,217 @@
|
||||
// NovoRelatorioAudio.jsx
|
||||
|
||||
import { useState } from 'react';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import html2pdf from 'html2pdf.js';
|
||||
import './styleMedico/NovoRelatorioAudio.css';
|
||||
|
||||
const NovoRelatorioAudio = () => {
|
||||
const navigate = useNavigate();
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
||||
const [formData, setFormData] = useState({
|
||||
paciente_nome: '',
|
||||
data_exame: new Date().toISOString().split('T')[0],
|
||||
exam: '',
|
||||
diagnostico: '',
|
||||
conclusao: '',
|
||||
medico_nome: 'Dr.______________________'
|
||||
});
|
||||
|
||||
const handleAudioUpload = async (e) => {
|
||||
const file = e.target.files[0];
|
||||
if (!file) return;
|
||||
|
||||
setLoading(true);
|
||||
const data = new FormData();
|
||||
data.append('audio', file);
|
||||
|
||||
try {
|
||||
const response = await fetch('http://localhost:3001/api/transcrever-relatorio', {
|
||||
method: 'POST',
|
||||
body: data,
|
||||
});
|
||||
|
||||
if (!response.ok) throw new Error('Erro na comunicação com a API');
|
||||
|
||||
const result = await response.json();
|
||||
|
||||
setFormData(prev => ({
|
||||
...prev,
|
||||
exam: result.exam || prev.exam,
|
||||
diagnostico: result.diagnostico || prev.diagnostico,
|
||||
conclusao: result.conclusao || prev.conclusao
|
||||
}));
|
||||
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
alert("Erro: Verifique se o backend (porta 3001) está rodando.");
|
||||
} finally {
|
||||
setLoading(false);
|
||||
e.target.value = null;
|
||||
}
|
||||
};
|
||||
|
||||
const handleChange = (e) => {
|
||||
const { name, value } = e.target;
|
||||
setFormData(prev => ({ ...prev, [name]: value }));
|
||||
};
|
||||
|
||||
const handlePrintPDF = () => {
|
||||
const element = document.getElementById('documento-final');
|
||||
const opt = {
|
||||
margin: 0,
|
||||
filename: `Laudo_${formData.paciente_nome || 'SemNome'}.pdf`,
|
||||
image: { type: 'jpeg', quality: 0.98 },
|
||||
html2canvas: { scale: 2 },
|
||||
jsPDF: { unit: 'mm', format: 'a4', orientation: 'portrait' }
|
||||
};
|
||||
html2pdf().set(opt).from(element).save();
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="ai-editor-container">
|
||||
|
||||
<div className="editor-sidebar">
|
||||
<div>
|
||||
<h4><i className="bi bi-robot me-2"></i>AI Report</h4>
|
||||
<p className="text-muted small">Gerador de laudos automatizado</p>
|
||||
</div>
|
||||
|
||||
<div className="ai-upload-box">
|
||||
{loading ? (
|
||||
<div className="spinner-border text-info" role="status"></div>
|
||||
) : (
|
||||
<>
|
||||
<label htmlFor="audioFile" style={{cursor:'pointer', width:'100%', display:'block'}}>
|
||||
<i className="bi bi-mic fs-2 text-info"></i>
|
||||
<div style={{color:'#fff', fontWeight:'bold', marginTop:'10px'}}>Gravar / Enviar Áudio</div>
|
||||
<div className="small text-muted mt-1">Clique para selecionar</div>
|
||||
</label>
|
||||
<input
|
||||
id="audioFile"
|
||||
type="file"
|
||||
accept="audio/*"
|
||||
style={{display:'none'}}
|
||||
onChange={handleAudioUpload}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<hr className="border-secondary" />
|
||||
|
||||
<div className="form-group">
|
||||
<label>NOME DO PACIENTE</label>
|
||||
<input
|
||||
type="text"
|
||||
name="paciente_nome"
|
||||
className="form-control dark-input"
|
||||
value={formData.paciente_nome}
|
||||
onChange={handleChange}
|
||||
placeholder="Ex: Maria Silva"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="form-group">
|
||||
<label>EXAME REALIZADO</label>
|
||||
<input
|
||||
type="text"
|
||||
name="exam"
|
||||
className="form-control dark-input"
|
||||
value={formData.exam}
|
||||
onChange={handleChange}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="form-group">
|
||||
<label>DIAGNÓSTICO (TEXTO)</label>
|
||||
<textarea
|
||||
name="diagnostico"
|
||||
rows="5"
|
||||
className="form-control dark-input"
|
||||
value={formData.diagnostico}
|
||||
onChange={handleChange}
|
||||
></textarea>
|
||||
</div>
|
||||
|
||||
<div className="form-group">
|
||||
<label>CONCLUSÃO</label>
|
||||
<textarea
|
||||
name="conclusao"
|
||||
rows="3"
|
||||
className="form-control dark-input"
|
||||
value={formData.conclusao}
|
||||
onChange={handleChange}
|
||||
></textarea>
|
||||
</div>
|
||||
|
||||
<div className="mt-auto d-flex gap-2">
|
||||
<button className="btn btn-outline-light flex-grow-1" onClick={() => navigate(-1)}>Voltar</button>
|
||||
<button className="btn btn-info flex-grow-1 fw-bold" onClick={handlePrintPDF}>
|
||||
<i className="bi bi-printer me-2"></i>PDF
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="preview-area">
|
||||
<div id="documento-final" className="paper-a4">
|
||||
|
||||
<div style={{borderBottom: '2px solid #000', paddingBottom: '20px', marginBottom: '30px', display:'flex', justifyContent:'space-between'}}>
|
||||
<div>
|
||||
<h2 style={{margin:0, fontSize:'18pt', fontWeight:'bold'}}>CLÍNICA RISE UP</h2>
|
||||
<p style={{margin:0, fontSize:'10pt'}}>Excelência em Diagnóstico por Imagem</p>
|
||||
</div>
|
||||
<div style={{textAlign:'right', fontSize:'10pt'}}>
|
||||
<p style={{margin:0}}><strong>{formData.medico_nome}</strong></p>
|
||||
<p style={{margin:0}}>CRM/SP 123456</p>
|
||||
<p style={{margin:0}}>{new Date().toLocaleDateString()}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style={{backgroundColor:'#f8f9fa', padding:'15px', borderRadius:'4px', marginBottom:'30px'}}>
|
||||
<table style={{width:'100%', fontSize:'11pt'}}>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style={{width:'15%', fontWeight:'bold'}}>Paciente:</td>
|
||||
<td>{formData.paciente_nome || '__________________________'}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style={{fontWeight:'bold'}}>Exame:</td>
|
||||
<td>{formData.exam || '__________________________'}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style={{fontWeight:'bold'}}>Data:</td>
|
||||
<td>{new Date(formData.data_exame).toLocaleDateString('pt-BR')}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div className="laudo-body">
|
||||
<h4 style={{textTransform:'uppercase', borderBottom:'1px solid #ccc', paddingBottom:'5px', marginBottom:'15px'}}>Relatório Médico</h4>
|
||||
|
||||
<p style={{fontWeight:'bold', marginBottom:'5px'}}>Análise:</p>
|
||||
<p style={{marginBottom:'25px', textAlign:'justify', whiteSpace:'pre-wrap'}}>
|
||||
{formData.diagnostico || <span style={{color:'#ccc'}}>O diagnóstico aparecerá aqui após o processamento do áudio...</span>}
|
||||
</p>
|
||||
|
||||
<p style={{fontWeight:'bold', marginBottom:'5px'}}>Conclusão:</p>
|
||||
<p style={{marginBottom:'40px', textAlign:'justify', fontWeight:'500'}}>
|
||||
{formData.conclusao}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div style={{marginTop:'50px', textAlign:'center', pageBreakInside:'avoid'}}>
|
||||
<p style={{marginBottom:0}}>________________________________________</p>
|
||||
<p style={{fontWeight:'bold', margin:0}}>{formData.medico_nome}</p>
|
||||
<p style={{fontSize:'10pt', color:'#666'}}>Assinatura Eletrônica</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default NovoRelatorioAudio;
|
||||
@ -1,5 +1,4 @@
|
||||
//ConsultaCadastroManager.jsx
|
||||
//Nesta página falta: mudar nomes
|
||||
|
||||
import { useState, useEffect } from 'react'
|
||||
import { useNavigate } from 'react-router-dom'
|
||||
@ -12,76 +11,103 @@ import FormConsultaPaciente from '../../components/paciente/FormConsultaPaciente
|
||||
|
||||
|
||||
const ConsultaCadastroManager = () => {
|
||||
const { getAuthorizationHeader, user } = useAuth();
|
||||
const navigate = useNavigate();
|
||||
|
||||
const {getAuthorizationHeader} = useAuth()
|
||||
const [Dict, setDict] = useState({})
|
||||
const navigate = useNavigate()
|
||||
const [idUsuario, setIDusuario] = useState("")
|
||||
|
||||
let authHeader = getAuthorizationHeader()
|
||||
const [Dict, setDict] = useState({});
|
||||
// patient_id fixo do Pedro Abravanel
|
||||
const [patientId, setPatientId] = useState('bf7d8323-05e1-437a-817c-f08eb5f174ef');
|
||||
const [idUsuario, setIDusuario] = useState('');
|
||||
|
||||
const authHeader = getAuthorizationHeader();
|
||||
|
||||
// Opcional: ainda tenta buscar infos do usuário, mas NÃO mostra mais alerta
|
||||
useEffect(() => {
|
||||
const ColherInfoUsuario =async () => {
|
||||
const result = await UserInfos(authHeader)
|
||||
const ColherInfoUsuario = async () => {
|
||||
try {
|
||||
if (!authHeader) return;
|
||||
|
||||
setIDusuario(result?.profile?.id)
|
||||
const result = await UserInfos(authHeader);
|
||||
|
||||
const pid =
|
||||
result?.patient_id ||
|
||||
result?.profile?.id ||
|
||||
user?.patient_id ||
|
||||
user?.profile?.id ||
|
||||
user?.user?.id;
|
||||
|
||||
if (pid) {
|
||||
setPatientId(pid);
|
||||
}
|
||||
ColherInfoUsuario()
|
||||
|
||||
setIDusuario(result?.profile?.id || pid || '');
|
||||
} catch (e) {
|
||||
console.error('Erro ao colher infos do usuário:', e);
|
||||
}
|
||||
};
|
||||
|
||||
}, [])
|
||||
ColherInfoUsuario();
|
||||
}, [authHeader, user]);
|
||||
|
||||
const handleSave = (Dict) => {
|
||||
// se por algum motivo não tiver, usa o fixo do Pedro
|
||||
const finalPatientId = patientId || 'bf7d8323-05e1-437a-817c-f08eb5f174ef';
|
||||
|
||||
let DataAtual = dayjs()
|
||||
var myHeaders = new Headers();
|
||||
myHeaders.append("apikey", API_KEY);
|
||||
myHeaders.append("Authorization", authHeader);
|
||||
myHeaders.append("Content-Type", "application/json");
|
||||
const myHeaders = new Headers();
|
||||
myHeaders.append('apikey', API_KEY);
|
||||
myHeaders.append('Authorization', authHeader);
|
||||
myHeaders.append('Content-Type', 'application/json');
|
||||
|
||||
|
||||
var raw = JSON.stringify({
|
||||
"patient_id": "6e7f8829-0574-42df-9290-8dbb70f75ada",
|
||||
"doctor_id": Dict.doctor_id,
|
||||
"scheduled_at": `${Dict.dataAtendimento}T${Dict.horarioInicio}:00.000Z`,
|
||||
"duration_minutes": 30,
|
||||
"appointment_type": Dict.tipo_consulta,
|
||||
|
||||
"patient_notes": "Prefiro horário pela manhã",
|
||||
"insurance_provider": Dict.convenio,
|
||||
"status": "confirmed",
|
||||
"created_by": idUsuario
|
||||
const raw = JSON.stringify({
|
||||
patient_id: finalPatientId, // paciente Pedro
|
||||
doctor_id: Dict.doctor_id,
|
||||
scheduled_at: `${Dict.dataAtendimento}T${Dict.horarioInicio}:00.000Z`,
|
||||
duration_minutes: 30,
|
||||
appointment_type: Dict.tipo_consulta,
|
||||
patient_notes: 'Prefiro horário pela manhã',
|
||||
insurance_provider: Dict.convenio,
|
||||
status: 'confirmed',
|
||||
created_by: idUsuario || finalPatientId,
|
||||
});
|
||||
|
||||
var requestOptions = {
|
||||
const requestOptions = {
|
||||
method: 'POST',
|
||||
headers: myHeaders,
|
||||
body: raw,
|
||||
redirect: 'follow'
|
||||
redirect: 'follow',
|
||||
};
|
||||
|
||||
fetch("https://yuanqfswhberkoevtmfr.supabase.co/rest/v1/appointments", requestOptions)
|
||||
.then(response => response.text())
|
||||
.then(result => console.log(result))
|
||||
.catch(error => console.log('error', error));
|
||||
|
||||
fetch(
|
||||
'https://yuanqfswhberkoevtmfr.supabase.co/rest/v1/appointments',
|
||||
requestOptions
|
||||
)
|
||||
.then(async (response) => {
|
||||
if (!response.ok) {
|
||||
const text = await response.text();
|
||||
throw new Error(`Erro ao salvar consulta: ${response.status} - ${text}`);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return response.text();
|
||||
})
|
||||
.then(() => {
|
||||
alert('Consulta solicitada com sucesso!');
|
||||
navigate('/paciente/agendamento/'); // volta para o calendário
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error('error', error);
|
||||
alert('Erro ao salvar a consulta. Tente novamente.');
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
|
||||
|
||||
<div>
|
||||
<FormConsultaPaciente agendamento={Dict} setAgendamento={setDict} onSave={handleSave} onCancel={() => navigate("/paciente/agendamento/")}/>
|
||||
<FormConsultaPaciente
|
||||
agendamento={Dict}
|
||||
setAgendamento={setDict}
|
||||
onSave={handleSave}
|
||||
onCancel={() => navigate('/paciente/agendamento/')}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
export default ConsultaCadastroManager
|
||||
export default ConsultaCadastroManager;
|
||||
@ -18,7 +18,8 @@ function InicioPaciente() {
|
||||
const [pacienteId, setPacienteId] = useState(null);
|
||||
|
||||
useEffect(() => {
|
||||
const userId = localStorage.getItem('user_id') || localStorage.getItem('patient_id');
|
||||
const userId =
|
||||
localStorage.getItem("user_id") || localStorage.getItem("patient_id");
|
||||
setPacienteId(userId);
|
||||
}, []);
|
||||
|
||||
@ -32,22 +33,25 @@ function InicioPaciente() {
|
||||
myHeaders.append("Authorization", authHeader);
|
||||
|
||||
const requestOptions = {
|
||||
method: 'GET',
|
||||
method: "GET",
|
||||
headers: myHeaders,
|
||||
redirect: 'follow'
|
||||
redirect: "follow",
|
||||
};
|
||||
|
||||
const response = await fetch("https://yuanqfswhberkoevtmfr.supabase.co/rest/v1/doctors", requestOptions);
|
||||
const response = await fetch(
|
||||
"https://yuanqfswhberkoevtmfr.supabase.co/rest/v1/doctors",
|
||||
requestOptions
|
||||
);
|
||||
|
||||
if (response.ok) {
|
||||
const data = await response.json();
|
||||
setMedicos(data);
|
||||
console.log(' Médicos carregados:', data.length);
|
||||
console.log(" Médicos carregados:", data.length);
|
||||
} else {
|
||||
console.error(' Erro ao buscar médicos:', response.status);
|
||||
console.error(" Erro ao buscar médicos:", response.status);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(' Erro ao buscar médicos:', error);
|
||||
console.error(" Erro ao buscar médicos:", error);
|
||||
}
|
||||
};
|
||||
|
||||
@ -60,23 +64,26 @@ function InicioPaciente() {
|
||||
myHeaders.append("Authorization", authHeader);
|
||||
|
||||
const requestOptions = {
|
||||
method: 'GET',
|
||||
method: "GET",
|
||||
headers: myHeaders,
|
||||
redirect: 'follow'
|
||||
redirect: "follow",
|
||||
};
|
||||
|
||||
// Buscar todos os agendamentos (depois filtraremos pelo paciente)
|
||||
const response = await fetch("https://yuanqfswhberkoevtmfr.supabase.co/rest/v1/appointments", requestOptions);
|
||||
const response = await fetch(
|
||||
"https://yuanqfswhberkoevtmfr.supabase.co/rest/v1/appointments",
|
||||
requestOptions
|
||||
);
|
||||
|
||||
if (response.ok) {
|
||||
const data = await response.json();
|
||||
setAgendamentos(data);
|
||||
console.log(' Agendamentos carregados:', data.length);
|
||||
console.log(" Agendamentos carregados:", data.length);
|
||||
} else {
|
||||
console.error(' Erro ao buscar agendamentos:', response.status);
|
||||
console.error(" Erro ao buscar agendamentos:", response.status);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(' Erro ao buscar agendamentos:', error);
|
||||
console.error(" Erro ao buscar agendamentos:", error);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
@ -90,44 +97,50 @@ function InicioPaciente() {
|
||||
|
||||
useEffect(() => {
|
||||
if (agendamentos.length > 0 && medicos.length > 0) {
|
||||
const agendamentosComNomes = agendamentos.map(agendamento => {
|
||||
const medico = medicos.find(m => m.id === agendamento.doctor_id);
|
||||
const agendamentosComNomes = agendamentos.map((agendamento) => {
|
||||
const medico = medicos.find((m) => m.id === agendamento.doctor_id);
|
||||
return {
|
||||
...agendamento,
|
||||
nomeMedico: medico?.full_name || 'Médico não encontrado',
|
||||
especialidadeMedico: medico?.specialty || ''
|
||||
nomeMedico: medico?.full_name || "Médico não encontrado",
|
||||
especialidadeMedico: medico?.specialty || "",
|
||||
};
|
||||
});
|
||||
setAgendamentosComMedicos(agendamentosComNomes);
|
||||
}
|
||||
}, [agendamentos, medicos]);
|
||||
|
||||
const meusAgendamentos = agendamentosComMedicos.filter(a =>
|
||||
const meusAgendamentos = agendamentosComMedicos.filter((a) =>
|
||||
pacienteId ? a.patient_id === pacienteId : true
|
||||
);
|
||||
|
||||
const hoje = new Date();
|
||||
hoje.setHours(0, 0, 0, 0);
|
||||
|
||||
const agendamentosFuturos = meusAgendamentos.filter(a => {
|
||||
const agendamentosFuturos = meusAgendamentos
|
||||
.filter((a) => {
|
||||
if (!a.scheduled_at) return false;
|
||||
const dataAgendamento = new Date(a.scheduled_at);
|
||||
return dataAgendamento >= hoje && a.status !== 'cancelled' && a.status !== 'completed';
|
||||
}).sort((a, b) => new Date(a.scheduled_at) - new Date(b.scheduled_at));
|
||||
return (
|
||||
dataAgendamento >= hoje &&
|
||||
a.status !== "cancelled" &&
|
||||
a.status !== "completed"
|
||||
);
|
||||
})
|
||||
.sort((a, b) => new Date(a.scheduled_at) - new Date(b.scheduled_at));
|
||||
|
||||
const proximasConsultas = agendamentosFuturos.length;
|
||||
const consultasHoje = agendamentosFuturos.filter(a => {
|
||||
const consultasHoje = agendamentosFuturos.filter((a) => {
|
||||
const dataAgendamento = new Date(a.scheduled_at);
|
||||
dataAgendamento.setHours(0, 0, 0, 0);
|
||||
return dataAgendamento.getTime() === hoje.getTime();
|
||||
}).length;
|
||||
|
||||
const consultasPendentes = meusAgendamentos.filter(a =>
|
||||
a.status === 'pending' || a.status === 'requested'
|
||||
const consultasPendentes = meusAgendamentos.filter(
|
||||
(a) => a.status === "pending" || a.status === "requested"
|
||||
).length;
|
||||
|
||||
const historicoConsultas = meusAgendamentos.filter(a =>
|
||||
a.status === 'completed'
|
||||
const historicoConsultas = meusAgendamentos.filter(
|
||||
(a) => a.status === "completed"
|
||||
).length;
|
||||
|
||||
return (
|
||||
@ -161,7 +174,9 @@ function InicioPaciente() {
|
||||
<div className="stat-paciente-card">
|
||||
<div className="stat-paciente-info">
|
||||
<span className="stat-paciente-label">Aguardando</span>
|
||||
<span className="stat-paciente-value">{loading ? '...' : consultasPendentes}</span>
|
||||
<span className="stat-paciente-value">
|
||||
{loading ? "..." : consultasPendentes}
|
||||
</span>
|
||||
</div>
|
||||
<div className="stat-paciente-icon-wrapper purple">
|
||||
<FaClock className="stat-paciente-icon" />
|
||||
@ -182,27 +197,42 @@ function InicioPaciente() {
|
||||
<div className="quick-actions-paciente">
|
||||
<h2>Acesso Rápido</h2>
|
||||
<div className="actions-paciente-grid">
|
||||
<div className="action-paciente-button" onClick={() => navigate('/paciente/agendamento')}>
|
||||
<div
|
||||
className="action-paciente-button"
|
||||
onClick={() => navigate("/paciente/agendamento")}
|
||||
>
|
||||
<FaCalendarCheck className="action-paciente-icon" />
|
||||
<div className="action-paciente-info">
|
||||
<span className="action-paciente-title">Minhas Consultas</span>
|
||||
<span className="action-paciente-desc">Ver todos os agendamentos</span>
|
||||
<span className="action-paciente-desc">
|
||||
Ver todos os agendamentos
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="action-paciente-button" onClick={() => navigate('/paciente/laudo')}>
|
||||
<div
|
||||
className="action-paciente-button"
|
||||
onClick={() => navigate("/paciente/laudo")}
|
||||
>
|
||||
<FaFileAlt className="action-paciente-icon" />
|
||||
<div className="action-paciente-info">
|
||||
<span className="action-paciente-title">Meus Laudos</span>
|
||||
<span className="action-paciente-desc">Acessar documentos médicos</span>
|
||||
<span className="action-paciente-desc">
|
||||
Acessar documentos médicos
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="action-paciente-button" onClick={() => navigate('/paciente/agendamento')}>
|
||||
<div
|
||||
className="action-paciente-button"
|
||||
onClick={() => navigate("/paciente/agendamento")}
|
||||
>
|
||||
<FaUserMd className="action-paciente-icon" />
|
||||
<div className="action-paciente-info">
|
||||
<span className="action-paciente-title">Meus Médicos</span>
|
||||
<span className="action-paciente-desc">Ver histórico de atendimentos</span>
|
||||
<span className="action-paciente-desc">
|
||||
Ver histórico de atendimentos
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -216,22 +246,28 @@ function InicioPaciente() {
|
||||
</div>
|
||||
) : agendamentosFuturos.length > 0 ? (
|
||||
<div className="consultas-paciente-list">
|
||||
{agendamentosFuturos.slice(0, 3).map(agendamento => (
|
||||
{agendamentosFuturos.slice(0, 3).map((agendamento) => (
|
||||
<div key={agendamento.id} className="consulta-paciente-item">
|
||||
<div className="consulta-paciente-info">
|
||||
<div className="consulta-paciente-time-date">
|
||||
<p className="consulta-paciente-hora">
|
||||
{new Date(agendamento.scheduled_at).toLocaleTimeString('pt-BR', {
|
||||
hour: '2-digit',
|
||||
minute: '2-digit'
|
||||
})}
|
||||
{new Date(agendamento.scheduled_at).toLocaleTimeString(
|
||||
"pt-BR",
|
||||
{
|
||||
hour: "2-digit",
|
||||
minute: "2-digit",
|
||||
}
|
||||
)}
|
||||
</p>
|
||||
<p className="consulta-paciente-data">
|
||||
{new Date(agendamento.scheduled_at).toLocaleDateString('pt-BR', {
|
||||
day: '2-digit',
|
||||
month: 'short',
|
||||
year: 'numeric'
|
||||
})}
|
||||
{new Date(agendamento.scheduled_at).toLocaleDateString(
|
||||
"pt-BR",
|
||||
{
|
||||
day: "2-digit",
|
||||
month: "short",
|
||||
year: "numeric",
|
||||
}
|
||||
)}
|
||||
</p>
|
||||
</div>
|
||||
<div className="consulta-paciente-detalhes">
|
||||
@ -245,16 +281,25 @@ function InicioPaciente() {
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
<span className={`consulta-paciente-status status-${agendamento.status}`}>
|
||||
{agendamento.status === 'scheduled' ? 'Confirmado' :
|
||||
agendamento.status === 'pending' ? 'Aguardando' :
|
||||
agendamento.status === 'requested' ? 'Solicitado' : agendamento.status}
|
||||
<span
|
||||
className={`consulta-paciente-status status-${agendamento.status}`}
|
||||
>
|
||||
{agendamento.status === "scheduled"
|
||||
? "Confirmado"
|
||||
: agendamento.status === "pending"
|
||||
? "Aguardando"
|
||||
: agendamento.status === "requested"
|
||||
? "Solicitado"
|
||||
: agendamento.status}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
{agendamentosFuturos.length > 3 && (
|
||||
<button className="view-all-paciente-button" onClick={() => navigate('/paciente/agendamento')}>
|
||||
<button
|
||||
className="view-all-paciente-button"
|
||||
onClick={() => navigate("/paciente/agendamento")}
|
||||
>
|
||||
Ver todas as consultas
|
||||
</button>
|
||||
)}
|
||||
@ -263,7 +308,10 @@ function InicioPaciente() {
|
||||
<div className="no-consultas-content">
|
||||
<FaCalendarCheck className="no-consultas-icon" />
|
||||
<p>Você não tem consultas agendadas</p>
|
||||
<button className="agendar-paciente-button" onClick={() => navigate('/paciente/agendamento/criar')}>
|
||||
<button
|
||||
className="agendar-paciente-button"
|
||||
onClick={() => navigate("/paciente/agendamento/criar")}
|
||||
>
|
||||
Agendar Consulta
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@ -1,10 +1,9 @@
|
||||
//ConsultasPaciente.jsx
|
||||
//Nesta página falta: mudar nomes
|
||||
|
||||
import { useState, useMemo, useEffect } from 'react';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { useAuth } from '../../_assets/utils/AuthProvider.js';
|
||||
import { ChevronLeft, ChevronRight, Edit, Trash2 } from 'lucide-react';
|
||||
import { ChevronLeft, ChevronRight, Trash2 } from 'lucide-react';
|
||||
import API_KEY from '../../_assets/utils/apiKeys.js';
|
||||
|
||||
import dayjs from 'dayjs';
|
||||
@ -26,8 +25,12 @@ const Agendamento = ({ setDictInfo }) => {
|
||||
const navigate = useNavigate();
|
||||
const { getAuthorizationHeader, user } = useAuth();
|
||||
|
||||
const [isLoading, setIsLoading] = useState(true);
|
||||
const [DictAgendamentosOrganizados, setDictAgendamentosOrganizados] = useState({});
|
||||
console.log('USER NO AGENDAMENTO:', user);
|
||||
|
||||
const [patientId, setPatientId] = useState('bf7d8323-05e1-437a-817c-f08eb5f174ef');
|
||||
const [isLoading, setIsLoading] = useState(false); // começa false
|
||||
const [DictAgendamentosOrganizados, setDictAgendamentosOrganizados] =
|
||||
useState({});
|
||||
const [filaEsperaData, setFilaDeEsperaData] = useState([]);
|
||||
const [FiladeEspera, setFiladeEspera] = useState(false);
|
||||
const [PageNovaConsulta, setPageConsulta] = useState(false);
|
||||
@ -36,34 +39,49 @@ const Agendamento = ({ setDictInfo }) => {
|
||||
const [selectedDay, setSelectedDay] = useState(dayjs());
|
||||
const [quickJump, setQuickJump] = useState({
|
||||
month: currentDate.month(),
|
||||
year: currentDate.year()
|
||||
year: currentDate.year(),
|
||||
});
|
||||
|
||||
const [isCancelModalOpen, setIsCancelModalOpen] = useState(false);
|
||||
const [appointmentToCancel, setAppointmentToCancel] = useState(null);
|
||||
const [cancellationReason, setCancellationReason] = useState('');
|
||||
|
||||
const authHeader = useMemo(() => getAuthorizationHeader(), [getAuthorizationHeader]);
|
||||
const authHeader = useMemo(
|
||||
() => getAuthorizationHeader(),
|
||||
[getAuthorizationHeader]
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
// Buscar consultas desse paciente
|
||||
const carregarDados = async () => {
|
||||
const patientId = user?.patient_id || "6e7f8829-0574-42df-9290-8dbb70f75ada";
|
||||
|
||||
// só tenta buscar quando tiver header e patientId
|
||||
if (!authHeader) {
|
||||
console.warn("Header de autorização não disponível.");
|
||||
setIsLoading(false);
|
||||
console.warn('Header de autorização não disponível.');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!patientId) {
|
||||
console.warn('patientId ainda não carregado, aguardando contexto.');
|
||||
return;
|
||||
}
|
||||
|
||||
setIsLoading(true);
|
||||
try {
|
||||
const myHeaders = new Headers({ "Authorization": authHeader, "apikey": API_KEY });
|
||||
const myHeaders = new Headers({
|
||||
Authorization: authHeader,
|
||||
apikey: API_KEY,
|
||||
});
|
||||
const requestOptions = { method: 'GET', headers: myHeaders };
|
||||
const response = await fetch(`https://yuanqfswhberkoevtmfr.supabase.co/rest/v1/appointments?select=*,doctors(full_name)&patient_id=eq.${patientId}`, requestOptions);
|
||||
|
||||
if (!response.ok) throw new Error(`Erro na requisição: ${response.statusText}`);
|
||||
const response = await fetch(
|
||||
`https://yuanqfswhberkoevtmfr.supabase.co/rest/v1/appointments?select=*,doctors(full_name)&patient_id=eq.${patientId}`,
|
||||
requestOptions
|
||||
);
|
||||
|
||||
const consultasBrutas = await response.json() || [];
|
||||
if (!response.ok)
|
||||
throw new Error(`Erro na requisição: ${response.statusText}`);
|
||||
|
||||
const consultasBrutas = (await response.json()) || [];
|
||||
console.log('CONSULTAS BRUTAS PACIENTE:', consultasBrutas);
|
||||
|
||||
const newDict = {};
|
||||
const newFila = [];
|
||||
@ -71,13 +89,18 @@ const Agendamento = ({ setDictInfo }) => {
|
||||
for (const agendamento of consultasBrutas) {
|
||||
const agendamentoMelhorado = {
|
||||
...agendamento,
|
||||
medico_nome: agendamento.doctors?.full_name || 'Médico não informado'
|
||||
medico_nome: agendamento.doctors?.full_name || 'Médico não informado',
|
||||
};
|
||||
|
||||
if (agendamento.status === "requested") {
|
||||
newFila.push({ agendamento: agendamentoMelhorado, Infos: agendamentoMelhorado });
|
||||
if (agendamento.status === 'requested') {
|
||||
newFila.push({
|
||||
agendamento: agendamentoMelhorado,
|
||||
Infos: agendamentoMelhorado,
|
||||
});
|
||||
} else {
|
||||
const diaAgendamento = dayjs(agendamento.scheduled_at).format("YYYY-MM-DD");
|
||||
const diaAgendamento = dayjs(
|
||||
agendamento.scheduled_at
|
||||
).format('YYYY-MM-DD');
|
||||
if (newDict[diaAgendamento]) {
|
||||
newDict[diaAgendamento].push(agendamentoMelhorado);
|
||||
} else {
|
||||
@ -87,12 +110,13 @@ const Agendamento = ({ setDictInfo }) => {
|
||||
}
|
||||
|
||||
for (const key in newDict) {
|
||||
newDict[key].sort((a, b) => a.scheduled_at.localeCompare(b.scheduled_at));
|
||||
newDict[key].sort((a, b) =>
|
||||
a.scheduled_at.localeCompare(b.scheduled_at)
|
||||
);
|
||||
}
|
||||
|
||||
setDictAgendamentosOrganizados(newDict);
|
||||
setFilaDeEsperaData(newFila);
|
||||
|
||||
} catch (err) {
|
||||
console.error('Falha ao buscar ou processar agendamentos:', err);
|
||||
setDictAgendamentosOrganizados({});
|
||||
@ -102,17 +126,28 @@ const Agendamento = ({ setDictInfo }) => {
|
||||
}
|
||||
};
|
||||
|
||||
// roda quando authHeader ou patientId mudarem
|
||||
useEffect(() => {
|
||||
carregarDados();
|
||||
}, [authHeader, user]);
|
||||
}, [authHeader, patientId]); // padrão recomendado para fetch com useEffect [web:46][web:82]
|
||||
|
||||
const updateAppointmentStatus = async (id, updates) => {
|
||||
const myHeaders = new Headers({
|
||||
"Authorization": authHeader, "apikey": API_KEY, "Content-Type": "application/json"
|
||||
Authorization: authHeader,
|
||||
apikey: API_KEY,
|
||||
'Content-Type': 'application/json',
|
||||
});
|
||||
const requestOptions = { method: 'PATCH', headers: myHeaders, body: JSON.stringify(updates) };
|
||||
const requestOptions = {
|
||||
method: 'PATCH',
|
||||
headers: myHeaders,
|
||||
body: JSON.stringify(updates),
|
||||
};
|
||||
|
||||
try {
|
||||
const response = await fetch(`https://yuanqfswhberkoevtmfr.supabase.co/rest/v1/appointments?id=eq.${id}`, requestOptions);
|
||||
const response = await fetch(
|
||||
`https://yuanqfswhberkoevtmfr.supabase.co/rest/v1/appointments?id=eq.${id}`,
|
||||
requestOptions
|
||||
);
|
||||
if (!response.ok) throw new Error('Falha ao atualizar o status.');
|
||||
return true;
|
||||
} catch (error) {
|
||||
@ -130,11 +165,13 @@ const Agendamento = ({ setDictInfo }) => {
|
||||
const executeCancellation = async () => {
|
||||
if (!appointmentToCancel) return;
|
||||
setIsLoading(true);
|
||||
const motivo = cancellationReason.trim() || "Cancelado pelo paciente (motivo não especificado)";
|
||||
const motivo =
|
||||
cancellationReason.trim() ||
|
||||
'Cancelado pelo paciente (motivo não especificado)';
|
||||
const success = await updateAppointmentStatus(appointmentToCancel, {
|
||||
status: "cancelled",
|
||||
status: 'cancelled',
|
||||
cancellation_reason: motivo,
|
||||
updated_at: new Date().toISOString()
|
||||
updated_at: new Date().toISOString(),
|
||||
});
|
||||
|
||||
setIsCancelModalOpen(false);
|
||||
@ -142,28 +179,38 @@ const Agendamento = ({ setDictInfo }) => {
|
||||
setCancellationReason('');
|
||||
|
||||
if (success) {
|
||||
alert("Solicitação cancelada com sucesso!");
|
||||
alert('Solicitação cancelada com sucesso!');
|
||||
|
||||
setDictAgendamentosOrganizados(prev => {
|
||||
setDictAgendamentosOrganizados((prev) => {
|
||||
const newDict = { ...prev };
|
||||
for (const date in newDict) {
|
||||
newDict[date] = newDict[date].filter(app => app.id !== appointmentToCancel);
|
||||
newDict[date] = newDict[date].filter(
|
||||
(app) => app.id !== appointmentToCancel
|
||||
);
|
||||
}
|
||||
return newDict;
|
||||
});
|
||||
setFilaDeEsperaData(prev => prev.filter(item => item.agendamento.id !== appointmentToCancel));
|
||||
setFilaDeEsperaData((prev) =>
|
||||
prev.filter((item) => item.agendamento.id !== appointmentToCancel)
|
||||
);
|
||||
} else {
|
||||
alert("Falha ao cancelar a solicitação.");
|
||||
alert('Falha ao cancelar a solicitação.');
|
||||
}
|
||||
setIsLoading(false);
|
||||
};
|
||||
|
||||
const handleQuickJumpChange = (type, value) => setQuickJump(prev => ({ ...prev, [type]: Number(value) }));
|
||||
const handleQuickJumpChange = (type, value) =>
|
||||
setQuickJump((prev) => ({ ...prev, [type]: Number(value) }));
|
||||
|
||||
const applyQuickJump = () => {
|
||||
const newDate = dayjs().year(quickJump.year).month(quickJump.month).date(1);
|
||||
const newDate = dayjs()
|
||||
.year(quickJump.year)
|
||||
.month(quickJump.month)
|
||||
.date(1);
|
||||
setCurrentDate(newDate);
|
||||
setSelectedDay(newDate);
|
||||
};
|
||||
|
||||
const dateGrid = useMemo(() => {
|
||||
const grid = [];
|
||||
const startOfMonth = currentDate.startOf('month');
|
||||
@ -174,111 +221,247 @@ const Agendamento = ({ setDictInfo }) => {
|
||||
}
|
||||
return grid;
|
||||
}, [currentDate]);
|
||||
|
||||
const weekDays = ['Dom', 'Seg', 'Ter', 'Qua', 'Qui', 'Sex', 'Sáb'];
|
||||
const handleDateClick = (day) => setSelectedDay(day);
|
||||
|
||||
if (isLoading) {
|
||||
return (
|
||||
<div className="form-container" style={{ display: 'flex', justifyContent: 'center', alignItems: 'center', height: '50vh' }}>
|
||||
<div
|
||||
className="form-container"
|
||||
style={{
|
||||
display: 'flex',
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
height: '50vh',
|
||||
}}
|
||||
>
|
||||
<Spinner />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div>
|
||||
<h1>Minhas consultas</h1>
|
||||
<div className="btns-gerenciamento-e-consulta" style={{ display: 'flex', gap: '10px', marginBottom: '20px' }}>
|
||||
<div
|
||||
className="btns-gerenciamento-e-consulta"
|
||||
style={{ display: 'flex', gap: '10px', marginBottom: '20px' }}
|
||||
>
|
||||
<button
|
||||
className="btn-adicionar-consulta"
|
||||
className="btn btn-primary btn-consulta-paciente"
|
||||
onClick={() => {
|
||||
setPageConsulta(true);
|
||||
setFiladeEspera(false);
|
||||
}}
|
||||
style={{
|
||||
backgroundColor: PageNovaConsulta ? '#1d4ed8' : undefined
|
||||
}}
|
||||
>
|
||||
<i className="bi bi-plus-circle"></i> Solicitar Agendamento
|
||||
</button>
|
||||
<button
|
||||
className="btn-adicionar-consulta"
|
||||
className="btn btn-primary btn-consulta-paciente"
|
||||
onClick={() => {
|
||||
setFiladeEspera(!FiladeEspera);
|
||||
setPageConsulta(false);
|
||||
}}
|
||||
style={{
|
||||
backgroundColor: FiladeEspera && !PageNovaConsulta ? '#1d4ed8' : undefined
|
||||
}}
|
||||
>
|
||||
<i className="bi bi-list-task me-1"></i> Fila de Espera ({filaEsperaData.length})
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
{!PageNovaConsulta ? (
|
||||
<div className='atendimento-eprocura'>
|
||||
<section className='calendario-ou-filaespera'>
|
||||
<div className="atendimento-eprocura">
|
||||
<section className="calendario-ou-filaespera">
|
||||
{!FiladeEspera ? (
|
||||
<div className="calendar-wrapper">
|
||||
<div className="calendar-info-panel">
|
||||
<div className="info-date-display"><span>{selectedDay.format('MMM')}</span><strong>{selectedDay.format('DD')}</strong></div>
|
||||
<div className="info-details"><h3>{selectedDay.format('dddd')}</h3><p>{selectedDay.format('D [de] MMMM [de] YYYY')}</p></div>
|
||||
<div className="info-date-display">
|
||||
<span>{selectedDay.format('MMM')}</span>
|
||||
<strong>{selectedDay.format('DD')}</strong>
|
||||
</div>
|
||||
<div className="info-details">
|
||||
<h3>{selectedDay.format('dddd')}</h3>
|
||||
<p>{selectedDay.format('D [de] MMMM [de] YYYY')}</p>
|
||||
</div>
|
||||
<div className="appointments-list">
|
||||
<div
|
||||
className="calendar-legend compact-legend"
|
||||
style={{
|
||||
marginTop: 4,
|
||||
gap: 3,
|
||||
fontSize: 8,
|
||||
lineHeight: 1.1,
|
||||
}}
|
||||
>
|
||||
<div
|
||||
className="legend-item"
|
||||
data-status="completed"
|
||||
style={{ padding: '0px 5px' }}
|
||||
>
|
||||
Realizado
|
||||
</div>
|
||||
<div
|
||||
className="legend-item"
|
||||
data-status="confirmed"
|
||||
style={{ padding: '0px 5px' }}
|
||||
>
|
||||
Confirmado
|
||||
</div>
|
||||
<div
|
||||
className="legend-item"
|
||||
data-status="agendado"
|
||||
style={{ padding: '0px 5px' }}
|
||||
>
|
||||
Agendado
|
||||
</div>
|
||||
<div
|
||||
className="legend-item"
|
||||
data-status="cancelled"
|
||||
style={{ padding: '0px 5px' }}
|
||||
>
|
||||
Cancelado
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h4>Consultas para {selectedDay.format('DD/MM')}</h4>
|
||||
{(DictAgendamentosOrganizados[selectedDay.format('YYYY-MM-DD')]?.length > 0) ? (
|
||||
DictAgendamentosOrganizados[selectedDay.format('YYYY-MM-DD')].map(app => (
|
||||
<div key={app.id} className="appointment-item" data-status={app.status}>
|
||||
<div className="item-time">{dayjs(app.scheduled_at).format('HH:mm')}</div>
|
||||
{DictAgendamentosOrganizados[
|
||||
selectedDay.format('YYYY-MM-DD')
|
||||
]?.length > 0 ? (
|
||||
DictAgendamentosOrganizados[
|
||||
selectedDay.format('YYYY-MM-DD')
|
||||
].map((app) => (
|
||||
<div
|
||||
key={app.id}
|
||||
className="appointment-item"
|
||||
data-status={app.status}
|
||||
>
|
||||
<div className="item-time">
|
||||
{dayjs(app.scheduled_at).add(3, 'hour').format('HH:mm')}
|
||||
|
||||
</div>
|
||||
<div className="item-details">
|
||||
<span>Consulta com Dr(a). {app.medico_nome}</span>
|
||||
</div>
|
||||
<div className='item-actions'>
|
||||
{app.status !== 'cancelled' && dayjs(app.scheduled_at).isAfter(dayjs()) && (
|
||||
<button className="btn btn-sm btn-outline-danger" onClick={() => handleCancelClick(app.id)} title="Cancelar Consulta">
|
||||
<div className="item-actions">
|
||||
{app.status !== 'cancelled' &&
|
||||
dayjs(app.scheduled_at).isAfter(dayjs()) && (
|
||||
<button
|
||||
className="btn btn-sm btn-outline-danger"
|
||||
onClick={() => handleCancelClick(app.id)}
|
||||
title="Cancelar Consulta"
|
||||
>
|
||||
<Trash2 size={16} />
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
))
|
||||
) : (<div className="no-appointments-info"><p>Nenhuma consulta agendada para esta data.</p></div>)}
|
||||
) : (
|
||||
<div className="no-appointments-info">
|
||||
<p>Nenhuma consulta agendada para esta data.</p>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="calendar-main">
|
||||
<div className="calendar-legend">
|
||||
<div className="legend-item" data-status="completed">Realizado</div>
|
||||
<div className="legend-item" data-status="confirmed">Confirmado</div>
|
||||
<div className="legend-item" data-status="agendado">Agendado</div>
|
||||
<div className="legend-item" data-status="cancelled">Cancelado</div>
|
||||
</div>
|
||||
<div className="calendar-legend"></div>
|
||||
<div className="calendar-controls">
|
||||
<div className="date-indicator">
|
||||
<h2>{currentDate.format('MMMM [de] YYYY')}</h2>
|
||||
<div className="quick-jump-controls" style={{ display: 'flex', gap: '5px', marginTop: '10px' }}>
|
||||
<select value={quickJump.month} onChange={(e) => handleQuickJumpChange('month', e.target.value)} className="form-select form-select-sm w-auto">
|
||||
{dayjs.months().map((month, index) => (<option key={index} value={index}>{month.charAt(0).toUpperCase() + month.slice(1)}</option>))}
|
||||
<div
|
||||
className="quick-jump-controls"
|
||||
style={{
|
||||
display: 'flex',
|
||||
gap: '5px',
|
||||
marginTop: '10px',
|
||||
}}
|
||||
>
|
||||
<select
|
||||
value={quickJump.month}
|
||||
onChange={(e) =>
|
||||
handleQuickJumpChange('month', e.target.value)
|
||||
}
|
||||
className="form-select form-select-sm w-auto"
|
||||
>
|
||||
{dayjs.months().map((month, index) => (
|
||||
<option key={index} value={index}>
|
||||
{month.charAt(0).toUpperCase() + month.slice(1)}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
<select value={quickJump.year} onChange={(e) => handleQuickJumpChange('year', e.target.value)} className="form-select form-select-sm w-auto">
|
||||
{Array.from({ length: 11 }, (_, i) => dayjs().year() - 5 + i).map(year => (<option key={year} value={year}>{year}</option>))}
|
||||
<select
|
||||
value={quickJump.year}
|
||||
onChange={(e) =>
|
||||
handleQuickJumpChange('year', e.target.value)
|
||||
}
|
||||
className="form-select form-select-sm w-auto"
|
||||
>
|
||||
{Array.from({ length: 11 }, (_, i) =>
|
||||
dayjs().year() - 5 + i
|
||||
).map((year) => (
|
||||
<option key={year} value={year}>
|
||||
{year}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
<button className="btn btn-sm btn-outline-primary" onClick={applyQuickJump} disabled={quickJump.month === currentDate.month() && quickJump.year === currentDate.year()}>Ir</button>
|
||||
<button
|
||||
className="btn btn-sm btn-outline-primary"
|
||||
onClick={applyQuickJump}
|
||||
disabled={
|
||||
quickJump.month === currentDate.month() &&
|
||||
quickJump.year === currentDate.year()
|
||||
}
|
||||
>
|
||||
Ir
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div className="nav-buttons">
|
||||
<button onClick={() => setCurrentDate(c => c.subtract(1, 'month'))}><ChevronLeft size={20} /></button>
|
||||
<button onClick={() => setCurrentDate(dayjs())}>Hoje</button>
|
||||
<button onClick={() => setCurrentDate(c => c.add(1, 'month'))}><ChevronRight size={20} /></button>
|
||||
<button
|
||||
onClick={() => setCurrentDate((c) => c.subtract(1, 'month'))}
|
||||
>
|
||||
<ChevronLeft size={20} />
|
||||
</button>
|
||||
<button onClick={() => setCurrentDate(dayjs())}>
|
||||
Hoje
|
||||
</button>
|
||||
<button
|
||||
onClick={() => setCurrentDate((c) => c.add(1, 'month'))}
|
||||
>
|
||||
<ChevronRight size={20} />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div className="calendar-grid">
|
||||
{weekDays.map(day => <div key={day} className="day-header">{day}</div>)}
|
||||
{weekDays.map((day) => (
|
||||
<div key={day} className="day-header">
|
||||
{day}
|
||||
</div>
|
||||
))}
|
||||
{dateGrid.map((day, index) => {
|
||||
const appointmentsOnDay = DictAgendamentosOrganizados[day.format('YYYY-MM-DD')] || [];
|
||||
const cellClasses = `day-cell ${day.isSame(currentDate, 'month') ? 'current-month' : 'other-month'} ${day.isSame(dayjs(), 'day') ? 'today' : ''} ${day.isSame(selectedDay, 'day') ? 'selected' : ''}`;
|
||||
const appointmentsOnDay =
|
||||
DictAgendamentosOrganizados[
|
||||
day.format('YYYY-MM-DD')
|
||||
] || [];
|
||||
const cellClasses = `day-cell ${
|
||||
day.isSame(currentDate, 'month')
|
||||
? 'current-month'
|
||||
: 'other-month'
|
||||
} ${day.isSame(dayjs(), 'day') ? 'today' : ''} ${
|
||||
day.isSame(selectedDay, 'day') ? 'selected' : ''
|
||||
}`;
|
||||
return (
|
||||
<div key={index} className={cellClasses} onClick={() => handleDateClick(day)}>
|
||||
<div
|
||||
key={index}
|
||||
className={cellClasses}
|
||||
onClick={() => handleDateClick(day)}
|
||||
>
|
||||
<span>{day.format('D')}</span>
|
||||
{appointmentsOnDay.length > 0 && <div className="appointments-indicator">{appointmentsOnDay.length}</div>}
|
||||
{appointmentsOnDay.length > 0 && (
|
||||
<div className="appointments-indicator">
|
||||
{appointmentsOnDay.length}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
@ -290,7 +473,11 @@ const Agendamento = ({ setDictInfo }) => {
|
||||
<section className="row">
|
||||
<div className="col-12">
|
||||
<div className="card table-paciente-card">
|
||||
<div className="card-header"><h4 className="card-title mb-0">Minhas Solicitações em Fila de Espera</h4></div>
|
||||
<div className="card-header">
|
||||
<h4 className="card-title mb-0">
|
||||
Minhas Solicitações em Fila de Espera
|
||||
</h4>
|
||||
</div>
|
||||
<div className="card-body">
|
||||
<div className="table-responsive">
|
||||
<table className="table table-striped table-hover">
|
||||
@ -302,20 +489,37 @@ const Agendamento = ({ setDictInfo }) => {
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{filaEsperaData.length > 0 ? (filaEsperaData.map((item) => (
|
||||
{filaEsperaData.length > 0 ? (
|
||||
filaEsperaData.map((item) => (
|
||||
<tr key={item.agendamento.id}>
|
||||
<td>Dr(a). {item.Infos?.medico_nome}</td>
|
||||
<td>{dayjs(item.agendamento.created_at).format('DD/MM/YYYY HH:mm')}</td>
|
||||
<td>
|
||||
<button className="btn btn-sm btn-danger" onClick={() => handleCancelClick(item.agendamento.id)}>
|
||||
<i className="bi bi-trash me-1"></i> Cancelar
|
||||
{dayjs(
|
||||
item.agendamento.created_at
|
||||
).format('DD/MM/YYYY HH:mm')}
|
||||
</td>
|
||||
<td>
|
||||
<button
|
||||
className="btn btn-sm btn-danger"
|
||||
onClick={() =>
|
||||
handleCancelClick(item.agendamento.id)
|
||||
}
|
||||
>
|
||||
<i className="bi bi-trash me-1"></i>{' '}
|
||||
Cancelar
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
))) : (
|
||||
))
|
||||
) : (
|
||||
<tr>
|
||||
<td colSpan="3" className="text-center py-4">
|
||||
<div className="text-muted">Nenhuma solicitação na fila de espera.</div>
|
||||
<td
|
||||
colSpan="3"
|
||||
className="text-center py-4"
|
||||
>
|
||||
<div className="text-muted">
|
||||
Nenhuma solicitação na fila de espera.
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
)}
|
||||
@ -331,15 +535,42 @@ const Agendamento = ({ setDictInfo }) => {
|
||||
</section>
|
||||
</div>
|
||||
) : (
|
||||
<AgendamentoCadastroManager setPageConsulta={setPageConsulta} />
|
||||
<AgendamentoCadastroManager
|
||||
setPageConsulta={setPageConsulta}
|
||||
onSaved={() => {
|
||||
carregarDados(); // recarrega consultas do paciente
|
||||
setPageConsulta(false);
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
|
||||
{isCancelModalOpen && (
|
||||
<div className="modal-overlay">
|
||||
<div className="modal-content" style={{ maxWidth: '400px' }}>
|
||||
<div className="modal-header" style={{ backgroundColor: '#fee2e2', borderBottom: '1px solid #fca5a5', padding: '15px', borderRadius: '8px 8px 0 0' }}>
|
||||
<h4 style={{ margin: 0, color: '#dc2626' }}>Confirmação de Cancelamento</h4>
|
||||
<button className="close-button" onClick={() => setIsCancelModalOpen(false)} style={{ background: 'none', border: 'none', fontSize: '1.5rem', cursor: 'pointer' }}>×</button>
|
||||
<div
|
||||
className="modal-header"
|
||||
style={{
|
||||
backgroundColor: '#fee2e2',
|
||||
borderBottom: '1px solid #fca5a5',
|
||||
padding: '15px',
|
||||
borderRadius: '8px 8px 0 0',
|
||||
}}
|
||||
>
|
||||
<h4 style={{ margin: 0, color: '#dc2626' }}>
|
||||
Confirmação de Cancelamento
|
||||
</h4>
|
||||
<button
|
||||
className="close-button"
|
||||
onClick={() => setIsCancelModalOpen(false)}
|
||||
style={{
|
||||
background: 'none',
|
||||
border: 'none',
|
||||
fontSize: '1.5rem',
|
||||
cursor: 'pointer',
|
||||
}}
|
||||
>
|
||||
×
|
||||
</button>
|
||||
</div>
|
||||
<div className="modal-body" style={{ padding: '20px' }}>
|
||||
<p>Qual o motivo do cancelamento?</p>
|
||||
@ -348,21 +579,48 @@ const Agendamento = ({ setDictInfo }) => {
|
||||
onChange={(e) => setCancellationReason(e.target.value)}
|
||||
placeholder="Ex: Precisei viajar, motivo pessoal, etc."
|
||||
rows="4"
|
||||
style={{ width: '100%', padding: '10px', resize: 'none', border: '1px solid #ccc', borderRadius: '4px' }}
|
||||
style={{
|
||||
width: '100%',
|
||||
padding: '10px',
|
||||
resize: 'none',
|
||||
border: '1px solid #ccc',
|
||||
borderRadius: '4px',
|
||||
}}
|
||||
></textarea>
|
||||
</div>
|
||||
<div className="modal-footer" style={{ display: 'flex', justifyContent: 'flex-end', gap: '10px', padding: '15px', borderTop: '1px solid #eee' }}>
|
||||
<div
|
||||
className="modal-footer"
|
||||
style={{
|
||||
display: 'flex',
|
||||
justifyContent: 'flex-end',
|
||||
gap: '10px',
|
||||
padding: '15px',
|
||||
borderTop: '1px solid #eee',
|
||||
}}
|
||||
>
|
||||
<button
|
||||
className="btn btn-secondary"
|
||||
onClick={() => setIsCancelModalOpen(false)}
|
||||
style={{ backgroundColor: '#6c757d', color: 'white', border: 'none', padding: '8px 15px', borderRadius: '4px' }}
|
||||
style={{
|
||||
backgroundColor: '#6c757d',
|
||||
color: 'white',
|
||||
border: 'none',
|
||||
padding: '8px 15px',
|
||||
borderRadius: '4px',
|
||||
}}
|
||||
>
|
||||
Cancelar
|
||||
</button>
|
||||
<button
|
||||
className="btn btn-danger"
|
||||
onClick={executeCancellation}
|
||||
style={{ backgroundColor: '#dc3545', color: 'white', border: 'none', padding: '8px 15px', borderRadius: '4px' }}
|
||||
style={{
|
||||
backgroundColor: '#dc3545',
|
||||
color: 'white',
|
||||
border: 'none',
|
||||
padding: '8px 15px',
|
||||
borderRadius: '4px',
|
||||
}}
|
||||
>
|
||||
<Trash2 size={16} style={{ marginRight: '5px' }} /> Excluir
|
||||
</button>
|
||||
@ -371,7 +629,7 @@ const Agendamento = ({ setDictInfo }) => {
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
export default Agendamento;
|
||||
@ -1,8 +1,6 @@
|
||||
//AgendamentoCadastroManager.jsx
|
||||
//Nesta página falta: mudar nomes
|
||||
|
||||
import { useEffect, useState } from 'react';
|
||||
import { toast } from 'react-toastify';
|
||||
import { useAuth } from '../../_assets/utils/AuthProvider';
|
||||
import { UserInfos } from '../../_assets/utils/Functions-Endpoints/General';
|
||||
import API_KEY from '../../_assets/utils/apiKeys';
|
||||
@ -11,172 +9,91 @@ import FormNovaConsulta from '../../components/agendamento/FormAgendamento';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
|
||||
const AgendamentoCadastroManager = ({ setPageConsulta, agendamentoInicial }) => {
|
||||
|
||||
const { getAuthorizationHeader } = useAuth();
|
||||
|
||||
const [agendamento, setAgendamento] = useState({ status: 'agendado' });
|
||||
const AgendamentoCadastroManager = ({ setPageConsulta, Dict, onSaved }) => {
|
||||
const { getAuthorizationHeader, user } = useAuth();
|
||||
const [agendamento, setAgendamento] = useState({ status: 'confirmed' });
|
||||
const [idUsuario, setIDusuario] = useState('0');
|
||||
const [isEditMode, setIsEditMode] = useState(false);
|
||||
|
||||
let authHeader = getAuthorizationHeader();
|
||||
// patient_id do paciente logado (ou fallback para o Pedro)
|
||||
|
||||
const patientId = 'bf7d8323-05e1-437a-817c-f08eb5f174ef';
|
||||
|
||||
const authHeader = getAuthorizationHeader();
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
|
||||
if (agendamentoInicial && agendamentoInicial.id) {
|
||||
|
||||
const scheduled_at = dayjs(agendamentoInicial.scheduled_at);
|
||||
|
||||
setAgendamento({
|
||||
...agendamentoInicial,
|
||||
|
||||
dataAtendimento: scheduled_at.format('YYYY-MM-DD'),
|
||||
horarioInicio: scheduled_at.format('HH:mm'),
|
||||
|
||||
|
||||
tipo_consulta: agendamentoInicial.appointment_type || 'Presencial',
|
||||
convenio: agendamentoInicial.insurance_provider || 'Público',
|
||||
|
||||
|
||||
paciente_nome: agendamentoInicial.paciente_nome || '',
|
||||
paciente_cpf: agendamentoInicial.paciente_cpf || '',
|
||||
medico_nome: agendamentoInicial.medico_nome || '',
|
||||
|
||||
|
||||
patient_id: agendamentoInicial.patient_id,
|
||||
doctor_id: agendamentoInicial.doctor_id,
|
||||
status: agendamentoInicial.status,
|
||||
});
|
||||
setIsEditMode(true);
|
||||
|
||||
if (!Dict) {
|
||||
setAgendamento({ status: 'confirmed' });
|
||||
} else {
|
||||
|
||||
setAgendamento({
|
||||
status: 'agendado',
|
||||
patient_id: null,
|
||||
doctor_id: null,
|
||||
dataAtendimento: dayjs().format('YYYY-MM-DD'),
|
||||
horarioInicio: '',
|
||||
tipo_consulta: 'Presencial',
|
||||
convenio: 'Público',
|
||||
paciente_nome: '',
|
||||
paciente_cpf: '',
|
||||
medico_nome: ''
|
||||
});
|
||||
setIsEditMode(false);
|
||||
setAgendamento(Dict);
|
||||
}
|
||||
|
||||
|
||||
const ColherInfoUsuario = async () => {
|
||||
try {
|
||||
const result = await UserInfos(authHeader);
|
||||
setIDusuario(result?.profile?.id);
|
||||
} catch (e) {
|
||||
console.error('Erro ao buscar infos do usuário:', e);
|
||||
}
|
||||
};
|
||||
|
||||
if (authHeader) {
|
||||
ColherInfoUsuario();
|
||||
}
|
||||
}, [Dict, authHeader]);
|
||||
|
||||
const handleSave = async (DictForm) => {
|
||||
if (!authHeader) {
|
||||
alert('Sem autorização. Faça login novamente.');
|
||||
return;
|
||||
}
|
||||
|
||||
}, [agendamentoInicial, authHeader]);
|
||||
const handleSave = async (Dict) => {
|
||||
var myHeaders = new Headers();
|
||||
myHeaders.append("apikey", API_KEY);
|
||||
myHeaders.append("Authorization", authHeader);
|
||||
myHeaders.append("Content-Type", "application/json");
|
||||
myHeaders.append("Prefer", "return=representation");
|
||||
|
||||
var raw = JSON.stringify({
|
||||
"patient_id": Dict.patient_id,
|
||||
"doctor_id": Dict.doctor_id,
|
||||
"scheduled_at": `${Dict.dataAtendimento}T${Dict.horarioInicio}:00.000Z`,
|
||||
"duration_minutes": Dict.duration_minutes || 30,
|
||||
"appointment_type": Dict.tipo_consulta,
|
||||
"insurance_provider": Dict.convenio,
|
||||
"status": Dict.status || 'agendado',
|
||||
"created_by": idUsuario,
|
||||
"created_at": dayjs().toISOString(),
|
||||
const myHeaders = new Headers();
|
||||
myHeaders.append('apikey', API_KEY);
|
||||
myHeaders.append('Authorization', authHeader);
|
||||
myHeaders.append('Content-Type', 'application/json');
|
||||
|
||||
const raw = JSON.stringify({
|
||||
patient_id: patientId, // paciente logado
|
||||
doctor_id: DictForm.doctor_id,
|
||||
scheduled_at: `${DictForm.dataAtendimento}T${DictForm.horarioInicio}:00`,
|
||||
duration_minutes: 30,
|
||||
appointment_type: DictForm.tipo_consulta,
|
||||
patient_notes: '',
|
||||
insurance_provider: DictForm.convenio,
|
||||
status: 'confirmed', // ou 'confirmed'
|
||||
created_by: idUsuario,
|
||||
created_at: dayjs().toISOString(),
|
||||
});
|
||||
|
||||
var requestOptions = {
|
||||
const requestOptions = {
|
||||
method: 'POST',
|
||||
headers: myHeaders,
|
||||
body: raw,
|
||||
redirect: 'follow'
|
||||
redirect: 'follow',
|
||||
};
|
||||
|
||||
try {
|
||||
const response = await fetch("https://yuanqfswhberkoevtmfr.supabase.co/rest/v1/appointments", requestOptions);
|
||||
const response = await fetch(
|
||||
'https://yuanqfswhberkoevtmfr.supabase.co/rest/v1/appointments',
|
||||
requestOptions
|
||||
);
|
||||
if (response.ok) {
|
||||
toast.success("Agendamento criado com sucesso! ✅");
|
||||
setPageConsulta(false);
|
||||
if (onSaved) onSaved(); // pai recarrega e fecha
|
||||
else setPageConsulta(false);
|
||||
} else {
|
||||
const errorText = await response.text();
|
||||
console.error('Erro ao cadastrar agendamento:', errorText);
|
||||
toast.error(`Falha ao criar agendamento: ${JSON.parse(errorText)?.message || 'Erro desconhecido'}`);
|
||||
console.error('Erro ao criar agendamento:', await response.text());
|
||||
alert('Falha ao criar agendamento.');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Erro de rede:', error);
|
||||
toast.error("Erro de rede ao salvar. ❌");
|
||||
alert('Erro de rede ao salvar agendamento.');
|
||||
}
|
||||
}
|
||||
const handleUpdate = async (Dict) => {
|
||||
const appointmentId = agendamentoInicial.id;
|
||||
|
||||
var myHeaders = new Headers();
|
||||
myHeaders.append("apikey", API_KEY);
|
||||
myHeaders.append("Authorization", authHeader);
|
||||
myHeaders.append("Content-Type", "application/json");
|
||||
myHeaders.append("Prefer", "return=representation");
|
||||
|
||||
var raw = JSON.stringify({
|
||||
"patient_id": Dict.patient_id,
|
||||
"doctor_id": Dict.doctor_id,
|
||||
"scheduled_at": `${Dict.dataAtendimento}T${Dict.horarioInicio}:00.000Z`,
|
||||
"duration_minutes": Dict.duration_minutes || 30,
|
||||
"appointment_type": Dict.tipo_consulta,
|
||||
"insurance_provider": Dict.convenio,
|
||||
"status": Dict.status,
|
||||
"updated_at": dayjs().toISOString(),
|
||||
"updated_by": idUsuario,
|
||||
});
|
||||
|
||||
var requestOptions = {
|
||||
method: 'PATCH',
|
||||
headers: myHeaders,
|
||||
body: raw,
|
||||
redirect: 'follow'
|
||||
};
|
||||
|
||||
try {
|
||||
const response = await fetch(`https://yuanqfswhberkoevtmfr.supabase.co/rest/v1/appointments?id=eq.${appointmentId}`, requestOptions);
|
||||
if (response.ok) {
|
||||
toast.success("Agendamento atualizado com sucesso! 📝");
|
||||
setPageConsulta(false);
|
||||
} else {
|
||||
const errorText = await response.text();
|
||||
console.error('Erro ao atualizar agendamento:', errorText);
|
||||
toast.error(`Falha ao atualizar agendamento: ${JSON.parse(errorText)?.message || 'Erro desconhecido'}`);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Erro de rede:', error);
|
||||
toast.error("Erro de rede ao atualizar. ❌");
|
||||
}
|
||||
}
|
||||
const handleFormSubmit = (Dict) => {
|
||||
if (isEditMode) {
|
||||
|
||||
handleUpdate(Dict);
|
||||
} else {
|
||||
|
||||
handleSave(Dict);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return (
|
||||
<div>
|
||||
{}
|
||||
<FormNovaConsulta
|
||||
onSave={handleFormSubmit}
|
||||
onSave={handleSave}
|
||||
agendamento={agendamento}
|
||||
setAgendamento={setAgendamento}
|
||||
onCancel={() => setPageConsulta(false)}
|
||||
|
||||
@ -41,6 +41,9 @@ const DisponibilidadesDoctorPage = () => {
|
||||
const [expandedDoctors, setExpandedDoctors] = useState({});
|
||||
const [showSuggestions, setShowSuggestions] = useState(false);
|
||||
const [availabilityEdit, setAvailabilityEdit] = useState([]);
|
||||
// Add the missing state variables
|
||||
const [showDeleteModal, setShowDeleteModal] = useState(false);
|
||||
const [selectedDisponibilidadeId, setSelectedDisponibilidadeId] = useState(null);
|
||||
|
||||
const getHeaders = () => {
|
||||
const myHeaders = new Headers();
|
||||
@ -173,8 +176,24 @@ const DisponibilidadesDoctorPage = () => {
|
||||
if (!window.confirm("Deseja realmente excluir esta disponibilidade?")) return;
|
||||
try {
|
||||
const res = await fetch(`${ENDPOINT}?id=eq.${id}`, { method: "DELETE", headers: getHeaders() });
|
||||
if (res.ok) setDisponibilidades((prev) => prev.filter((d) => d.id !== id));
|
||||
} catch (error) {}
|
||||
if (res.ok) {
|
||||
setDisponibilidades((prev) => prev.filter((d) => d.id !== id));
|
||||
setShowDeleteModal(false);
|
||||
setSelectedDisponibilidadeId(null);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Erro ao excluir disponibilidade:", error);
|
||||
}
|
||||
};
|
||||
|
||||
const handleOpenDeleteModal = (id) => {
|
||||
setSelectedDisponibilidadeId(id);
|
||||
setShowDeleteModal(true);
|
||||
};
|
||||
|
||||
const handleCloseDeleteModal = () => {
|
||||
setShowDeleteModal(false);
|
||||
setSelectedDisponibilidadeId(null);
|
||||
};
|
||||
|
||||
const disponibilidadesAgrupadas = useMemo(() => {
|
||||
@ -423,7 +442,16 @@ const DisponibilidadesDoctorPage = () => {
|
||||
<td>
|
||||
<span className={getStatusBadgeClass(disp)}>{getStatusText(disp)}</span>
|
||||
</td>
|
||||
<td>{!disp.is_empty && <button onClick={() => deletarDisponibilidade(disp.id)} className="disp-btn-delete">Excluir</button>}</td>
|
||||
<td>
|
||||
{!disp.is_empty && (
|
||||
<button
|
||||
onClick={() => handleOpenDeleteModal(disp.id)}
|
||||
className="disp-btn-delete"
|
||||
>
|
||||
Excluir
|
||||
</button>
|
||||
)}
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
@ -438,6 +466,51 @@ const DisponibilidadesDoctorPage = () => {
|
||||
)}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{showDeleteModal && (
|
||||
<div
|
||||
className="modal fade show delete-modal"
|
||||
style={{
|
||||
display: "block",
|
||||
backgroundColor: "rgba(0, 0, 0, 0.5)",
|
||||
}}
|
||||
tabIndex="-1"
|
||||
>
|
||||
<div className="modal-dialog modal-dialog-centered">
|
||||
<div className="modal-content">
|
||||
<div className="modal-header" style={{ backgroundColor: '#dc3545', color: 'white' }}>
|
||||
<h5 className="modal-title">
|
||||
Confirmação de Exclusão
|
||||
</h5>
|
||||
</div>
|
||||
|
||||
<div className="modal-body">
|
||||
<p className="mb-0 fs-5">
|
||||
Tem certeza que deseja excluir esta disponibilidade?
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="modal-footer">
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-primary"
|
||||
onClick={handleCloseDeleteModal}
|
||||
>
|
||||
Cancelar
|
||||
</button>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-danger"
|
||||
onClick={() => deletarDisponibilidade(selectedDisponibilidadeId)}
|
||||
>
|
||||
Excluir
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
//EditPage.jsx
|
||||
//Nesta página falta: mudar nomes
|
||||
|
||||
import {useEffect, useState} from 'react'
|
||||
import {useNavigate, useParams } from 'react-router-dom'
|
||||
@ -12,6 +11,7 @@ import PatientForm from '../../components/paciente/FormCadastroPaciente'
|
||||
const EditPage = ({DictInfo}) => {
|
||||
const navigate = useNavigate()
|
||||
const [PatientToPUT, setPatientPUT] = useState({})
|
||||
const [showSuccessModal, setShowSuccessModal] = useState(false)
|
||||
|
||||
const { getAuthorizationHeader, isAuthenticated } = useAuth();
|
||||
|
||||
@ -40,9 +40,15 @@ const HandlePutPatient = async () => {
|
||||
};
|
||||
|
||||
fetch(`https://yuanqfswhberkoevtmfr.supabase.co/rest/v1/patients?id=eq.${PatientToPUT.id}`,requestOptions)
|
||||
.then(response => console.log(response))
|
||||
.then(response => {
|
||||
console.log(response)
|
||||
if (response.ok) {
|
||||
setShowSuccessModal(true)
|
||||
}
|
||||
return response
|
||||
})
|
||||
.then(result => console.log(result))
|
||||
.catch(console.log("erro"))
|
||||
.catch(error => console.log("erro", error))
|
||||
|
||||
};
|
||||
|
||||
@ -56,6 +62,46 @@ const HandlePutPatient = async () => {
|
||||
setFormData={setPatientPUT}
|
||||
/>
|
||||
|
||||
{showSuccessModal && (
|
||||
<div
|
||||
className="modal fade show delete-modal"
|
||||
style={{
|
||||
display: "block",
|
||||
backgroundColor: "rgba(0, 0, 0, 0,5)",
|
||||
}}
|
||||
tabIndex="-1"
|
||||
>
|
||||
<div className="modal-dialog modal-dialog-centered">
|
||||
<div className="modal-content">
|
||||
<div className="modal-header" style={{ backgroundColor: '#1e3a8a', color: 'white' }}>
|
||||
<h5 className="modal-title">
|
||||
Paciente Editado
|
||||
</h5>
|
||||
</div>
|
||||
|
||||
<div className="modal-body">
|
||||
<p className="mb-0 fs-5">
|
||||
Paciente editado com sucesso!
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="modal-footer">
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-primary"
|
||||
onClick={() => {
|
||||
setShowSuccessModal(false)
|
||||
navigate(-1)
|
||||
}}
|
||||
>
|
||||
OK
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
@ -1,11 +1,12 @@
|
||||
//ExcecoesDisponibilidade.jsx
|
||||
|
||||
import { useState, useEffect, useCallback, useMemo } from 'react';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { useAuth } from '../../_assets/utils/AuthProvider';
|
||||
import { GetAllDoctors } from '../../_assets/utils/Functions-Endpoints/Doctor';
|
||||
import API_KEY from '../../_assets/utils/apiKeys';
|
||||
|
||||
import FormExcecaoDisponibilidade from '../../components/medico/FormExcecaoDisponibilidade';
|
||||
import FormCriarExcecao from '../../components/medico/FormExcecaoDisponibilidade';
|
||||
import '../../_assets/css/components/agendamento/FormAgendamento.css';
|
||||
import '../../_assets/css/pages/agendamento/Agendamento.css';
|
||||
import '../../_assets/css/pages/agendamento/FilaEspera.css';
|
||||
@ -17,7 +18,6 @@ dayjs.extend(weekday);
|
||||
dayjs.locale('pt-br');
|
||||
|
||||
const ENDPOINT_BASE = "https://yuanqfswhberkoevtmfr.supabase.co/rest/v1/doctor_exceptions";
|
||||
const API_ROOT = "https://yuanqfswhberkoevtmfr.supabase.co/rest/v1";
|
||||
|
||||
const getDateRange = (date, view) => {
|
||||
const startDayjs = dayjs(date);
|
||||
@ -28,12 +28,10 @@ const getDateRange = (date, view) => {
|
||||
toDate = startDayjs.format('YYYY-MM-DD');
|
||||
titleRange = startDayjs.format('DD/MM/YYYY');
|
||||
} else if (view === 'semanal') {
|
||||
// Padrão Dayjs: Sunday=0, Monday=1.
|
||||
// startOf('week') pode ser Domingo ou Segunda, dependendo do locale.
|
||||
// Se precisar forçar a Segunda-feira:
|
||||
|
||||
let weekStart = startDayjs.startOf('week');
|
||||
if (weekStart.day() !== 1) { // Se não for segunda-feira (1), ajusta
|
||||
weekStart = startDayjs.weekday(1); // Vai para a segunda-feira desta semana
|
||||
if (weekStart.day() !== 1) {
|
||||
weekStart = startDayjs.weekday(1);
|
||||
}
|
||||
|
||||
const weekEnd = weekStart.add(6, 'day');
|
||||
@ -57,12 +55,21 @@ const getDateRange = (date, view) => {
|
||||
const ExcecoesDisponibilidade = () => {
|
||||
|
||||
const { getAuthorizationHeader } = useAuth();
|
||||
const navigate = useNavigate();
|
||||
const [pageNovaExcecao, setPageNovaExcecao] = useState(false);
|
||||
const [excecoes, setExcecoes] = useState([]);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [showDeleteModal, setShowDeleteModal] = useState(false);
|
||||
const [selectedExceptionId, setSelectedExceptionId] = useState(null);
|
||||
const [showSuccessModal, setShowSuccessModal] = useState(false);
|
||||
const [successMessage, setSuccessMessage] = useState('');
|
||||
|
||||
const [filtroMedicoId, setFiltroMedicoId] = useState('');
|
||||
const [filtroData, setFiltroData] = useState(dayjs().format('YYYY-MM-DD'));
|
||||
const [listaDeMedicos, setListaDeMedicos] = useState([]);
|
||||
const [searchTermDoctor, setSearchTermDoctor] = useState('');
|
||||
const [filteredDoctors, setFilteredDoctors] = useState([]);
|
||||
const [selectedDoctor, setSelectedDoctor] = useState(null);
|
||||
|
||||
const [visualizacao, setVisualizacao] = useState('diario');
|
||||
|
||||
@ -104,52 +111,7 @@ const ExcecoesDisponibilidade = () => {
|
||||
const result = await response.json();
|
||||
|
||||
if (response.ok && Array.isArray(result)) {
|
||||
// usar função existente para obter lista de médicos
|
||||
const doctorIds = Array.from(new Set(result.map(r => r.doctor_id).filter(Boolean)));
|
||||
let doctors = [];
|
||||
try {
|
||||
// GetAllDoctors já retorna id e full_name (ver Doctor.js)
|
||||
doctors = await GetAllDoctors(authHeader);
|
||||
} catch (err) {
|
||||
console.warn('Falha ao obter lista de médicos via GetAllDoctors:', err);
|
||||
doctors = [];
|
||||
}
|
||||
const doctorMap = {};
|
||||
if (Array.isArray(doctors)) {
|
||||
doctors.forEach(d => {
|
||||
if (d && d.id != null) doctorMap[d.id] = d.full_name || d.name || d.display_name || d.id;
|
||||
});
|
||||
}
|
||||
|
||||
// buscar nomes de quem criou (profiles) — usa REST direto (não há função pronta)
|
||||
const createdByIds = Array.from(new Set(result.map(r => r.created_by).filter(Boolean)));
|
||||
const creatorMap = {};
|
||||
if (createdByIds.length > 0) {
|
||||
const inList = createdByIds.map(id => (isNaN(Number(id)) ? `"${String(id).replace(/"/g,'\\"')}"` : id)).join(',');
|
||||
const profilesUrl = `${API_ROOT}/profiles?select=*&id=in.(${inList})`;
|
||||
try {
|
||||
const resProfiles = await fetch(profilesUrl, { method: 'GET', headers: myHeaders, redirect: 'follow' });
|
||||
if (resProfiles.ok) {
|
||||
const profiles = await resProfiles.json();
|
||||
profiles.forEach(p => {
|
||||
creatorMap[p.id] = p.full_name || p.name || p.username || p.email || p.id;
|
||||
});
|
||||
} else {
|
||||
console.warn('Não foi possível buscar profiles:', resProfiles.status);
|
||||
}
|
||||
} catch (err) {
|
||||
console.warn('Erro ao buscar profiles:', err);
|
||||
}
|
||||
}
|
||||
|
||||
// anexa nomes às exceções (fallback para ids caso não encontre nome)
|
||||
const enriched = result.map(r => ({
|
||||
...r,
|
||||
doctor_name: doctorMap[r.doctor_id] || r.doctor_name || r.doctor_id,
|
||||
created_by_name: creatorMap[r.created_by] || r.created_by_name || r.created_by
|
||||
}));
|
||||
|
||||
setExcecoes(enriched);
|
||||
setExcecoes(result);
|
||||
} else {
|
||||
setExcecoes([]);
|
||||
console.error("Erro ao listar exceções (Status:", response.status, "):", result);
|
||||
@ -173,8 +135,51 @@ const ExcecoesDisponibilidade = () => {
|
||||
fetchExcecoes(fromDate, toDate, filtroMedicoId);
|
||||
}, [fetchExcecoes, filtroMedicoId, fromDate, toDate]);
|
||||
|
||||
useEffect(() => {
|
||||
const fetchDoctors = async () => {
|
||||
const myHeaders = new Headers();
|
||||
const authHeader = resolveAuthHeader();
|
||||
if (authHeader) myHeaders.append("Authorization", authHeader);
|
||||
if (API_KEY) myHeaders.append("apikey", API_KEY);
|
||||
|
||||
try {
|
||||
const response = await fetch('https://yuanqfswhberkoevtmfr.supabase.co/rest/v1/doctors?select=id,full_name', {
|
||||
method: 'GET',
|
||||
headers: myHeaders
|
||||
});
|
||||
if (response.ok) {
|
||||
const doctors = await response.json();
|
||||
setListaDeMedicos(doctors);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Erro ao buscar médicos:', error);
|
||||
}
|
||||
};
|
||||
fetchDoctors();
|
||||
}, []);
|
||||
|
||||
const handleSearchDoctors = (term) => {
|
||||
setSearchTermDoctor(term);
|
||||
if (term.trim() === '') {
|
||||
setFilteredDoctors([]);
|
||||
return;
|
||||
}
|
||||
const filtered = listaDeMedicos.filter(doc =>
|
||||
doc.full_name.toLowerCase().includes(term.toLowerCase())
|
||||
);
|
||||
setFilteredDoctors(filtered);
|
||||
};
|
||||
|
||||
const limparFiltros = () => {
|
||||
setSearchTermDoctor('');
|
||||
setFilteredDoctors([]);
|
||||
setSelectedDoctor(null);
|
||||
setFiltroMedicoId('');
|
||||
setFiltroData(dayjs().format('YYYY-MM-DD'));
|
||||
setVisualizacao('diario');
|
||||
};
|
||||
|
||||
const deleteExcecao = async (id) => {
|
||||
if (!window.confirm("Confirma exclusão desta exceção?")) return;
|
||||
const myHeaders = new Headers();
|
||||
const authHeader = resolveAuthHeader();
|
||||
if (authHeader) myHeaders.append("Authorization", authHeader);
|
||||
@ -189,6 +194,9 @@ const ExcecoesDisponibilidade = () => {
|
||||
});
|
||||
if (res.ok) {
|
||||
setExcecoes(prev => prev.filter(x => x.id !== id));
|
||||
setShowDeleteModal(false);
|
||||
setSuccessMessage('Exceção excluída com sucesso!');
|
||||
setShowSuccessModal(true);
|
||||
} else {
|
||||
const text = await res.text();
|
||||
console.error('Erro ao deletar exceção', res.status, text);
|
||||
@ -200,16 +208,6 @@ const ExcecoesDisponibilidade = () => {
|
||||
}
|
||||
}
|
||||
|
||||
// navegação de datas (adicionada, mesma lógica da versão do médico)
|
||||
const mudarData = (delta) => {
|
||||
const base = dayjs(filtroData);
|
||||
let nova;
|
||||
if (visualizacao === 'diario') nova = base.add(delta, 'day');
|
||||
else if (visualizacao === 'semanal') nova = base.add(delta, 'week');
|
||||
else nova = base.add(delta, 'month');
|
||||
setFiltroData(nova.format('YYYY-MM-DD'));
|
||||
}
|
||||
|
||||
const handleCancelForm = (recarregar = false) => {
|
||||
setPageNovaExcecao(false);
|
||||
if (recarregar) {
|
||||
@ -218,12 +216,12 @@ const ExcecoesDisponibilidade = () => {
|
||||
}
|
||||
|
||||
if (pageNovaExcecao) {
|
||||
return <FormExcecaoDisponibilidade onCancel={handleCancelForm} doctorID={filtroMedicoId} />;
|
||||
return <FormCriarExcecao onCancel={handleCancelForm} doctorID={filtroMedicoId} />;
|
||||
}
|
||||
|
||||
return (
|
||||
<div>
|
||||
{/* Título e Botão de Criação */}
|
||||
|
||||
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: '15px' }}>
|
||||
<h1>Gerenciar Exceções de Disponibilidade</h1>
|
||||
<button
|
||||
@ -235,30 +233,80 @@ const ExcecoesDisponibilidade = () => {
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div className='atendimento-eprocura'>
|
||||
<div className="card p-3 mb-3" style={{ marginTop: '20px' }}>
|
||||
<h5 className="mb-3">
|
||||
<i className="bi bi-funnel-fill me-2 text-primary"></i>
|
||||
Filtros
|
||||
</h5>
|
||||
|
||||
{/* Filtros de Médico e Data */}
|
||||
<div className='busca-atendimento'>
|
||||
<div>
|
||||
<i className="fa-solid fa-user-doctor"></i>
|
||||
<div className="row g-3 mb-3">
|
||||
<div className="col-md-6">
|
||||
<label className="form-label fw-bold">Buscar Médico</label>
|
||||
<input
|
||||
type="text"
|
||||
placeholder="Filtrar por ID do Médico..."
|
||||
value={filtroMedicoId}
|
||||
onChange={(e) => setFiltroMedicoId(e.target.value)}
|
||||
className="form-control"
|
||||
placeholder="Digite o nome do médico..."
|
||||
value={searchTermDoctor}
|
||||
onChange={(e) => handleSearchDoctors(e.target.value)}
|
||||
/>
|
||||
<small className="text-muted">Filtre as exceções por médico</small>
|
||||
{searchTermDoctor && filteredDoctors.length > 0 && (
|
||||
<div className="list-group mt-2" style={{ maxHeight: '200px', overflowY: 'auto' }}>
|
||||
{filteredDoctors.map((doc) => (
|
||||
<button
|
||||
key={doc.id}
|
||||
className="list-group-item list-group-item-action"
|
||||
onClick={() => {
|
||||
setSearchTermDoctor(doc.full_name);
|
||||
setFilteredDoctors([]);
|
||||
setSelectedDoctor(doc);
|
||||
setFiltroMedicoId(doc.id);
|
||||
}}
|
||||
>
|
||||
{doc.full_name}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
<div>
|
||||
<i className="fa-solid fa-calendar"></i>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="col-md-6">
|
||||
<label className="form-label fw-bold">Data de Referência</label>
|
||||
<input
|
||||
type="date"
|
||||
className="form-control"
|
||||
value={filtroData}
|
||||
onChange={(e) => setFiltroData(e.target.value)}
|
||||
/>
|
||||
<small className="text-muted">Selecione a data base para visualização</small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Botões de Visualização (Dia/Semana/Mês) */}
|
||||
<div className="d-flex justify-content-between align-items-center">
|
||||
<div>
|
||||
{selectedDoctor && (
|
||||
<span className="badge bg-primary me-2">
|
||||
<i className="bi bi-person-fill me-1"></i>
|
||||
{selectedDoctor.full_name}
|
||||
</span>
|
||||
)}
|
||||
<div className="contador-pacientes" style={{ display: 'inline-block' }}>
|
||||
{excecoes.length} DE {excecoes.length} EXCEÇÕES ENCONTRADAS
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button
|
||||
className="btn btn-outline-secondary btn-sm"
|
||||
onClick={limparFiltros}
|
||||
>
|
||||
<i className="bi bi-arrow-clockwise me-1"></i> Limpar Filtros
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className='atendimento-eprocura'>
|
||||
|
||||
|
||||
<div className='container-btns-agenda-fila_esepera'>
|
||||
<button
|
||||
className={`btn-agenda ${visualizacao === "diario" ? "opc-agenda-ativo" : ""}`}
|
||||
@ -280,18 +328,10 @@ const ExcecoesDisponibilidade = () => {
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{/* Tabela de Exceções (Título usa o titleRange calculado) */}
|
||||
|
||||
<section className='calendario-ou-filaespera'>
|
||||
<div className="fila-container">
|
||||
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
|
||||
<h2 className="fila-titulo">Exceções em {titleRange} ({excecoes.length})</h2>
|
||||
|
||||
<div style={{ display: 'flex', alignItems: 'center', gap: 8 }}>
|
||||
<button className="btn btn-outline-dark btn-sm" onClick={() => mudarData(-1)}><</button>
|
||||
<strong>{titleRange}</strong>
|
||||
<button className="btn btn-outline-dark btn-sm" onClick={() => mudarData(1)}>></button>
|
||||
</div>
|
||||
</div>
|
||||
{loading ? (
|
||||
<p>Carregando exceções...</p>
|
||||
) : excecoes.length === 0 ? (
|
||||
@ -300,7 +340,7 @@ const ExcecoesDisponibilidade = () => {
|
||||
<table className="fila-tabela">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Médico (Nome)</th>
|
||||
<th>Médico (ID)</th>
|
||||
<th>Data</th>
|
||||
<th>Início</th>
|
||||
<th>Término</th>
|
||||
@ -312,12 +352,12 @@ const ExcecoesDisponibilidade = () => {
|
||||
<tbody>
|
||||
{excecoes.map((exc) => (
|
||||
<tr key={exc.id}>
|
||||
<td><p>{exc.doctor_name || exc.doctor_id}</p></td>
|
||||
<td><p>{exc.doctor_id}</p></td>
|
||||
<td>{dayjs(exc.date).format('DD/MM/YYYY')}</td>
|
||||
<td>{exc.start_time ? dayjs(exc.start_time, 'HH:mm:ss').format('HH:mm') : '—'}</td>
|
||||
<td>{exc.end_time ? dayjs(exc.end_time, 'HH:mm:ss').format('HH:mm') : '—'}</td>
|
||||
<td><p>{exc.reason}</p></td>
|
||||
<td>{exc.created_by_name || exc.created_by || '—'}</td>
|
||||
<td>{exc.created_by || '—'}</td>
|
||||
<td>
|
||||
<div className="d-flex gap-2">
|
||||
<button
|
||||
@ -332,7 +372,10 @@ const ExcecoesDisponibilidade = () => {
|
||||
|
||||
<button
|
||||
className="btn btn-sm btn-delete"
|
||||
onClick={() => deleteExcecao(exc.id)}
|
||||
onClick={() => {
|
||||
setSelectedExceptionId(exc.id);
|
||||
setShowDeleteModal(true);
|
||||
}}
|
||||
>
|
||||
<i className="bi bi-trash me-1"></i> Excluir
|
||||
</button>
|
||||
@ -346,6 +389,89 @@ const ExcecoesDisponibilidade = () => {
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
{showDeleteModal && (
|
||||
<div
|
||||
className="modal fade show delete-modal"
|
||||
style={{
|
||||
display: "block",
|
||||
backgroundColor: "rgba(0, 0, 0, 0.5)",
|
||||
}}
|
||||
tabIndex="-1"
|
||||
>
|
||||
<div className="modal-dialog modal-dialog-centered">
|
||||
<div className="modal-content">
|
||||
<div className="modal-header" style={{ backgroundColor: '#dc3545', color: 'white' }}>
|
||||
<h5 className="modal-title">
|
||||
Confirmação de Exclusão
|
||||
</h5>
|
||||
</div>
|
||||
|
||||
<div className="modal-body">
|
||||
<p className="mb-0 fs-5">
|
||||
Tem certeza que deseja excluir esta exceção?
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="modal-footer">
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-primary"
|
||||
onClick={() => setShowDeleteModal(false)}
|
||||
>
|
||||
Cancelar
|
||||
</button>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-danger"
|
||||
onClick={() => deleteExcecao(selectedExceptionId)}
|
||||
>
|
||||
Excluir
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
|
||||
{showSuccessModal && (
|
||||
<div
|
||||
className="modal fade show delete-modal"
|
||||
style={{
|
||||
display: "block",
|
||||
backgroundColor: "rgba(0, 0, 0, 0.5)",
|
||||
}}
|
||||
tabIndex="-1"
|
||||
>
|
||||
<div className="modal-dialog modal-dialog-centered">
|
||||
<div className="modal-content">
|
||||
<div className="modal-header" style={{ backgroundColor: '#1e3a8a', color: 'white' }}>
|
||||
<h5 className="modal-title">
|
||||
Sucesso
|
||||
</h5>
|
||||
</div>
|
||||
|
||||
<div className="modal-body">
|
||||
<p className="mb-0 fs-5">
|
||||
{successMessage}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="modal-footer">
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-primary"
|
||||
onClick={() => setShowSuccessModal(false)}
|
||||
>
|
||||
OK
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
//Agendamento.jsx
|
||||
//Nesta página falta: mudar nomes
|
||||
|
||||
import { useState, useMemo, useEffect } from 'react';
|
||||
import React, { useState, useMemo, useEffect } from 'react';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { Search, ChevronLeft, ChevronRight, Edit, Trash2 } from 'lucide-react';
|
||||
import { ChevronLeft, ChevronRight, Edit, Trash2 } from 'lucide-react';
|
||||
import { GetPatientByID } from '../../_assets/utils/Functions-Endpoints/Patient.js';
|
||||
import { GetAllDoctors, GetDoctorByID } from '../../_assets/utils/Functions-Endpoints/Doctor.js';
|
||||
import { useAuth } from '../../_assets/utils/AuthProvider.js';
|
||||
@ -29,30 +29,35 @@ dayjs.locale('pt-br');
|
||||
dayjs.extend(isBetween);
|
||||
dayjs.extend(localeData);
|
||||
|
||||
// Offset de horário para bater com o que o paciente marca (ajuste se precisar)
|
||||
const HORARIO_OFFSET = 3; // se a diferença for 2h, troca para 2
|
||||
|
||||
const Agendamento = ({ setDictInfo }) => {
|
||||
const navigate = useNavigate();
|
||||
const [listaTodosAgendamentos, setListaTodosAgendamentos] = useState([]);
|
||||
const [selectedID, setSelectedId] = useState('0');
|
||||
const [selectedID, setSelectedId] = useState("0");
|
||||
const [filaEsperaData, setFilaEsperaData] = useState([]);
|
||||
const [FiladeEspera, setFiladeEspera] = useState(false);
|
||||
const [PageNovaConsulta, setPageConsulta] = useState(false);
|
||||
const [searchTerm, setSearchTerm] = useState('');
|
||||
const [searchTerm, setSearchTerm] = useState("");
|
||||
const { getAuthorizationHeader } = useAuth();
|
||||
const [DictAgendamentosOrganizados, setAgendamentosOrganizados] = useState({});
|
||||
const [DictAgendamentosOrganizados, setAgendamentosOrganizados] = useState(
|
||||
{}
|
||||
);
|
||||
const [showDeleteModal, setShowDeleteModal] = useState(false);
|
||||
const [ListaDeMedicos, setListaDeMedicos] = useState([]);
|
||||
const [FiltredTodosMedicos, setFiltredTodosMedicos] = useState([]);
|
||||
const [searchTermDoctor, setSearchTermDoctor] = useState('');
|
||||
const [searchTermDoctor, setSearchTermDoctor] = useState("");
|
||||
const [doctorDropdownOpen, setDoctorDropdownOpen] = useState(false);
|
||||
const [MedicoFiltrado, setMedicoFiltrado] = useState({ id: "vazio" });
|
||||
const [cacheAgendamentos, setCacheAgendamentos] = useState([]);
|
||||
const [appointmentToEdit, setAppointmentToEdit] = useState(null);
|
||||
const [showConfirmModal, setShowConfirmModal] = useState(false);
|
||||
const [motivoCancelamento, setMotivoCancelamento] = useState("");
|
||||
const [showSpinner, setShowSpinner] = useState(true);
|
||||
const [waitlistSearch, setWaitlistSearch] = useState('');
|
||||
const [waitlistSearch, setWaitlistSearch] = useState("");
|
||||
const [waitSortKey, setWaitSortKey] = useState(null);
|
||||
const [waitSortDir, setWaitSortDir] = useState('asc');
|
||||
const [waitSortDir, setWaitSortDir] = useState("asc");
|
||||
const [waitPage, setWaitPage] = useState(1);
|
||||
const [waitPerPage, setWaitPerPage] = useState(10);
|
||||
const authHeader = getAuthorizationHeader();
|
||||
@ -60,25 +65,31 @@ const Agendamento = ({ setDictInfo }) => {
|
||||
const cachePacientes = useMemo(() => ({}), []);
|
||||
const [currentDate, setCurrentDate] = useState(dayjs());
|
||||
const [selectedDay, setSelectedDay] = useState(dayjs());
|
||||
|
||||
const [editingAppointmentId, setEditingAppointmentId] = useState(null);
|
||||
|
||||
const [quickJump, setQuickJump] = useState({
|
||||
month: currentDate.month(),
|
||||
year: currentDate.year()
|
||||
year: currentDate.year(),
|
||||
});
|
||||
|
||||
const fetchAppointments = async () => {
|
||||
const myHeaders = new Headers();
|
||||
myHeaders.append("Authorization", authHeader);
|
||||
myHeaders.append("apikey", API_KEY);
|
||||
const requestOptions = { method: 'GET', headers: myHeaders, redirect: 'follow' };
|
||||
const requestOptions = {
|
||||
method: "GET",
|
||||
headers: myHeaders,
|
||||
redirect: "follow",
|
||||
};
|
||||
try {
|
||||
const res = await fetch("https://yuanqfswhberkoevtmfr.supabase.co/rest/v1/appointments?select=*", requestOptions);
|
||||
const res = await fetch(
|
||||
"https://yuanqfswhberkoevtmfr.supabase.co/rest/v1/appointments?select=*",
|
||||
requestOptions
|
||||
);
|
||||
const data = await res.json();
|
||||
setListaTodosAgendamentos(data);
|
||||
} catch (err) {
|
||||
console.error('Erro ao buscar agendamentos', err);
|
||||
console.error("Erro ao buscar agendamentos", err);
|
||||
}
|
||||
};
|
||||
|
||||
@ -88,19 +99,26 @@ const Agendamento = ({ setDictInfo }) => {
|
||||
myHeaders.append("apikey", API_KEY);
|
||||
myHeaders.append("Content-Type", "application/json");
|
||||
myHeaders.append("Prefer", "return=representation");
|
||||
const requestOptions = { method: 'PATCH', headers: myHeaders, body: JSON.stringify(updates) };
|
||||
const requestOptions = {
|
||||
method: "PATCH",
|
||||
headers: myHeaders,
|
||||
body: JSON.stringify(updates),
|
||||
};
|
||||
|
||||
try {
|
||||
const response = await fetch(`https://yuanqfswhberkoevtmfr.supabase.co/rest/v1/appointments?id=eq.${id}`, requestOptions);
|
||||
const response = await fetch(
|
||||
`https://yuanqfswhberkoevtmfr.supabase.co/rest/v1/appointments?id=eq.${id}`,
|
||||
requestOptions
|
||||
);
|
||||
if (response.ok) {
|
||||
await fetchAppointments();
|
||||
return true;
|
||||
} else {
|
||||
console.error('Erro ao atualizar agendamento:', await response.text());
|
||||
console.error("Erro ao atualizar agendamento:", await response.text());
|
||||
return false;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Erro de rede/servidor:', error);
|
||||
console.error("Erro de rede/servidor:", error);
|
||||
return false;
|
||||
}
|
||||
};
|
||||
@ -110,13 +128,13 @@ const Agendamento = ({ setDictInfo }) => {
|
||||
const success = await updateAppointmentStatus(id, {
|
||||
status: "cancelled",
|
||||
cancellation_reason: motivoCancelamento,
|
||||
updated_at: new Date().toISOString()
|
||||
updated_at: new Date().toISOString(),
|
||||
});
|
||||
setShowSpinner(false);
|
||||
if (success) {
|
||||
setShowDeleteModal(false);
|
||||
setMotivoCancelamento("");
|
||||
setSelectedId('0');
|
||||
setSelectedId("0");
|
||||
} else {
|
||||
alert("Falha ao cancelar a consulta.");
|
||||
}
|
||||
@ -127,25 +145,25 @@ const Agendamento = ({ setDictInfo }) => {
|
||||
const success = await updateAppointmentStatus(id, {
|
||||
status: "agendado",
|
||||
cancellation_reason: null,
|
||||
updated_at: new Date().toISOString()
|
||||
updated_at: new Date().toISOString(),
|
||||
});
|
||||
setShowSpinner(false);
|
||||
if (success) {
|
||||
setShowConfirmModal(false);
|
||||
setSelectedId('0');
|
||||
setSelectedId("0");
|
||||
} else {
|
||||
alert("Falha ao reverter o cancelamento.");
|
||||
}
|
||||
};
|
||||
|
||||
const handleQuickJumpChange = (type, value) => {
|
||||
setQuickJump(prev => ({ ...prev, [type]: Number(value) }));
|
||||
setQuickJump((prev) => ({ ...prev, [type]: Number(value) }));
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
setQuickJump({
|
||||
month: currentDate.month(),
|
||||
year: currentDate.year()
|
||||
year: currentDate.year(),
|
||||
});
|
||||
}, [currentDate]);
|
||||
|
||||
@ -156,7 +174,10 @@ const Agendamento = ({ setDictInfo }) => {
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (!listaTodosAgendamentos.length) { setShowSpinner(false); return; }
|
||||
if (!listaTodosAgendamentos.length) {
|
||||
setShowSpinner(false);
|
||||
return;
|
||||
}
|
||||
setShowSpinner(true);
|
||||
const fetchDados = async () => {
|
||||
const newDict = {};
|
||||
@ -164,10 +185,14 @@ const Agendamento = ({ setDictInfo }) => {
|
||||
for (const agendamento of listaTodosAgendamentos) {
|
||||
if (!agendamento.doctor_id || !agendamento.patient_id) continue;
|
||||
if (!cacheMedicos[agendamento.doctor_id]) {
|
||||
cacheMedicos[agendamento.doctor_id] = (await GetDoctorByID(agendamento.doctor_id, authHeader))[0];
|
||||
cacheMedicos[agendamento.doctor_id] = (
|
||||
await GetDoctorByID(agendamento.doctor_id, authHeader)
|
||||
)[0];
|
||||
}
|
||||
if (!cachePacientes[agendamento.patient_id]) {
|
||||
cachePacientes[agendamento.patient_id] = (await GetPatientByID(agendamento.patient_id, authHeader))[0];
|
||||
cachePacientes[agendamento.patient_id] = (
|
||||
await GetPatientByID(agendamento.patient_id, authHeader)
|
||||
)[0];
|
||||
}
|
||||
const medico = cacheMedicos[agendamento.doctor_id];
|
||||
const paciente = cachePacientes[agendamento.patient_id];
|
||||
@ -176,13 +201,18 @@ const Agendamento = ({ setDictInfo }) => {
|
||||
...agendamento,
|
||||
medico_nome: medico?.full_name,
|
||||
paciente_nome: paciente?.full_name,
|
||||
paciente_cpf: paciente?.cpf
|
||||
paciente_cpf: paciente?.cpf,
|
||||
};
|
||||
|
||||
if (agendamento.status === "requested") {
|
||||
newFila.push({ agendamento: agendamentoMelhorado, Infos: agendamentoMelhorado });
|
||||
newFila.push({
|
||||
agendamento: agendamentoMelhorado,
|
||||
Infos: agendamentoMelhorado,
|
||||
});
|
||||
} else {
|
||||
const DiaAgendamento = dayjs(agendamento.scheduled_at).format("YYYY-MM-DD");
|
||||
const DiaAgendamento = dayjs(agendamento.scheduled_at).format(
|
||||
"YYYY-MM-DD"
|
||||
);
|
||||
if (newDict[DiaAgendamento]) {
|
||||
newDict[DiaAgendamento].push(agendamentoMelhorado);
|
||||
} else {
|
||||
@ -191,7 +221,9 @@ const Agendamento = ({ setDictInfo }) => {
|
||||
}
|
||||
}
|
||||
for (const key in newDict) {
|
||||
newDict[key].sort((a, b) => a.scheduled_at.localeCompare(b.scheduled_at));
|
||||
newDict[key].sort((a, b) =>
|
||||
a.scheduled_at.localeCompare(b.scheduled_at)
|
||||
);
|
||||
}
|
||||
setAgendamentosOrganizados(newDict);
|
||||
setFilaEsperaData(newFila);
|
||||
@ -202,44 +234,59 @@ const Agendamento = ({ setDictInfo }) => {
|
||||
|
||||
useEffect(() => {
|
||||
fetchAppointments();
|
||||
GetAllDoctors(authHeader).then(docs =>
|
||||
setListaDeMedicos(docs.map(d => ({ nomeMedico: d.full_name, idMedico: d.id })))
|
||||
GetAllDoctors(authHeader).then((docs) =>
|
||||
setListaDeMedicos(
|
||||
docs.map((d) => ({ nomeMedico: d.full_name, idMedico: d.id }))
|
||||
)
|
||||
);
|
||||
}, [authHeader]);
|
||||
|
||||
const handleSearchMedicos = (term) => { };
|
||||
const handleSearchMedicos = (term) => {};
|
||||
|
||||
const filaEsperaFiltrada = useMemo(() => {
|
||||
if (!waitlistSearch.trim()) return filaEsperaData;
|
||||
const term = waitlistSearch.toLowerCase();
|
||||
return filaEsperaData.filter(item =>
|
||||
(item?.Infos?.paciente_nome?.toLowerCase() || '').includes(term) ||
|
||||
(item?.Infos?.paciente_cpf?.toLowerCase() || '').includes(term) ||
|
||||
(item?.Infos?.nome_medico?.toLowerCase() || '').includes(term)
|
||||
return filaEsperaData.filter(
|
||||
(item) =>
|
||||
(item?.Infos?.paciente_nome?.toLowerCase() || "").includes(term) ||
|
||||
(item?.Infos?.paciente_cpf?.toLowerCase() || "").includes(term) ||
|
||||
(item?.Infos?.nome_medico?.toLowerCase() || "").includes(term)
|
||||
);
|
||||
}, [waitlistSearch, filaEsperaData]);
|
||||
|
||||
const applySortingWaitlist = (arr) => {
|
||||
if (!Array.isArray(arr) || !waitSortKey) return arr;
|
||||
const copy = [...arr];
|
||||
if (waitSortKey === 'paciente') {
|
||||
copy.sort((a, b) => (a?.Infos?.paciente_nome || '').localeCompare((b?.Infos?.paciente_nome || '')));
|
||||
} else if (waitSortKey === 'medico') {
|
||||
copy.sort((a, b) => (a?.Infos?.nome_medico || '').localeCompare((b?.Infos?.nome_medico || '')));
|
||||
} else if (waitSortKey === 'data') {
|
||||
if (waitSortKey === "paciente") {
|
||||
copy.sort((a, b) =>
|
||||
new Date(a?.agendamento?.scheduled_at || 0) - new Date(b?.agendamento?.scheduled_at || 0)
|
||||
(a?.Infos?.paciente_nome || "").localeCompare(
|
||||
b?.Infos?.paciente_nome || ""
|
||||
)
|
||||
);
|
||||
} else if (waitSortKey === "medico") {
|
||||
copy.sort((a, b) =>
|
||||
(a?.Infos?.nome_medico || "").localeCompare(b?.Infos?.nome_medico || "")
|
||||
);
|
||||
} else if (waitSortKey === "data") {
|
||||
copy.sort(
|
||||
(a, b) =>
|
||||
new Date(a?.agendamento?.scheduled_at || 0) -
|
||||
new Date(b?.agendamento?.scheduled_at || 0)
|
||||
);
|
||||
}
|
||||
if (waitSortDir === 'desc') copy.reverse();
|
||||
if (waitSortDir === "desc") copy.reverse();
|
||||
return copy;
|
||||
};
|
||||
|
||||
const filaEsperaOrdenada = applySortingWaitlist(filaEsperaFiltrada);
|
||||
const waitTotalPages = Math.ceil(filaEsperaOrdenada.length / waitPerPage) || 1;
|
||||
const waitTotalPages =
|
||||
Math.ceil(filaEsperaOrdenada.length / waitPerPage) || 1;
|
||||
const waitIndiceInicial = (waitPage - 1) * waitPerPage;
|
||||
const waitIndiceFinal = waitIndiceInicial + waitPerPage;
|
||||
const filaEsperaPaginada = filaEsperaOrdenada.slice(waitIndiceInicial, waitIndiceFinal);
|
||||
const filaEsperaPaginada = filaEsperaOrdenada.slice(
|
||||
waitIndiceInicial,
|
||||
waitIndiceFinal
|
||||
);
|
||||
|
||||
const gerarNumerosWaitPages = () => {
|
||||
const paginas = [];
|
||||
@ -247,34 +294,49 @@ const Agendamento = ({ setDictInfo }) => {
|
||||
let inicio = Math.max(1, waitPage - Math.floor(paginasParaMostrar / 2));
|
||||
let fim = Math.min(waitTotalPages, inicio + paginasParaMostrar - 1);
|
||||
inicio = Math.max(1, fim - paginasParaMostrar + 1);
|
||||
for (let i = inicio; i <= fim; i++) { paginas.push(i); }
|
||||
for (let i = inicio; i <= fim; i++) {
|
||||
paginas.push(i);
|
||||
}
|
||||
return paginas;
|
||||
};
|
||||
|
||||
useEffect(() => { setWaitPage(1); }, [waitlistSearch, waitSortKey, waitSortDir]);
|
||||
useEffect(() => {
|
||||
setWaitPage(1);
|
||||
}, [waitlistSearch, waitSortKey, waitSortDir]);
|
||||
|
||||
const generateDateGrid = () => {
|
||||
const grid = [];
|
||||
const startOfMonth = currentDate.startOf('month');
|
||||
let currentDay = startOfMonth.subtract(startOfMonth.day(), 'day');
|
||||
const startOfMonth = currentDate.startOf("month");
|
||||
let currentDay = startOfMonth.subtract(startOfMonth.day(), "day");
|
||||
for (let i = 0; i < 42; i++) {
|
||||
grid.push(currentDay);
|
||||
currentDay = currentDay.add(1, 'day');
|
||||
currentDay = currentDay.add(1, "day");
|
||||
}
|
||||
return grid;
|
||||
};
|
||||
|
||||
const dateGrid = useMemo(() => generateDateGrid(), [currentDate]);
|
||||
const weekDays = ['Dom', 'Seg', 'Ter', 'Qua', 'Qui', 'Sex', 'Sáb'];
|
||||
const weekDays = ["Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sáb"];
|
||||
const handleDateClick = (day) => setSelectedDay(day);
|
||||
|
||||
const DeleteModal = () => (
|
||||
<div className="modal fade show" style={{ display: "block", backgroundColor: "rgba(0,0,0,0.5)" }} tabIndex="-1">
|
||||
<div
|
||||
className="modal fade show"
|
||||
style={{ display: "block", backgroundColor: "rgba(0,0,0,0.5)" }}
|
||||
tabIndex="-1"
|
||||
>
|
||||
<div className="modal-dialog modal-dialog-centered">
|
||||
<div className="modal-content">
|
||||
<div className="modal-header" style={{ backgroundColor: '#f8d7da', color: '#721c24' }}>
|
||||
<div
|
||||
className="modal-header"
|
||||
style={{ backgroundColor: "#f8d7da", color: "#721c24" }}
|
||||
>
|
||||
<h5 className="modal-title">Confirmação de Cancelamento</h5>
|
||||
<button type="button" className="btn-close" onClick={() => setShowDeleteModal(false)}></button>
|
||||
<button
|
||||
type="button"
|
||||
className="btn-close"
|
||||
onClick={() => setShowDeleteModal(false)}
|
||||
></button>
|
||||
</div>
|
||||
<div className="modal-body">
|
||||
<p>Qual o motivo do cancelamento?</p>
|
||||
@ -289,7 +351,10 @@ const Agendamento = ({ setDictInfo }) => {
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-secondary"
|
||||
onClick={() => { setShowDeleteModal(false); setMotivoCancelamento(""); }}
|
||||
onClick={() => {
|
||||
setShowDeleteModal(false);
|
||||
setMotivoCancelamento("");
|
||||
}}
|
||||
>
|
||||
Cancelar
|
||||
</button>
|
||||
@ -307,16 +372,29 @@ const Agendamento = ({ setDictInfo }) => {
|
||||
);
|
||||
|
||||
const ConfirmEditModal = () => (
|
||||
<div className="modal fade show" style={{ display: "block", backgroundColor: "rgba(0,0,0,0.5)" }} tabIndex="-1">
|
||||
<div
|
||||
className="modal fade show"
|
||||
style={{ display: "block", backgroundColor: "rgba(0,0,0,0.5)" }}
|
||||
tabIndex="-1"
|
||||
>
|
||||
<div className="modal-dialog modal-dialog-centered">
|
||||
<div className="modal-content">
|
||||
<div className="modal-header" style={{ backgroundColor: '#d4edda', color: '#155724' }}>
|
||||
<div
|
||||
className="modal-header"
|
||||
style={{ backgroundColor: "#d4edda", color: "#155724" }}
|
||||
>
|
||||
<h5 className="modal-title">Confirmação de edição</h5>
|
||||
<button type="button" className="btn-close" onClick={() => setShowConfirmModal(false)}></button>
|
||||
<button
|
||||
type="button"
|
||||
className="btn-close"
|
||||
onClick={() => setShowConfirmModal(false)}
|
||||
></button>
|
||||
</div>
|
||||
<div className="modal-body">
|
||||
<p>Tem certeza que deseja retirar o cancelamento?</p>
|
||||
<small className="text-muted">Isso reverterá o status do agendamento para Agendado.</small>
|
||||
<small className="text-muted">
|
||||
Isso reverterá o status do agendamento para Agendado.
|
||||
</small>
|
||||
</div>
|
||||
<div className="modal-footer justify-content-center">
|
||||
<button
|
||||
@ -331,7 +409,12 @@ const Agendamento = ({ setDictInfo }) => {
|
||||
className="btn btn-success"
|
||||
onClick={() => confirmConsulta(selectedID)}
|
||||
>
|
||||
<Trash2 size={16} className="me-1" style={{ transform: 'rotate(45deg)' }} /> Confirmar
|
||||
<Trash2
|
||||
size={16}
|
||||
className="me-1"
|
||||
style={{ transform: "rotate(45deg)" }}
|
||||
/>{" "}
|
||||
Confirmar
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@ -344,53 +427,28 @@ const Agendamento = ({ setDictInfo }) => {
|
||||
<h1>Agendar nova consulta</h1>
|
||||
|
||||
{!PageNovaConsulta ? (
|
||||
<div className='atendimento-eprocura'>
|
||||
<div className='unidade-selecionarprofissional'>
|
||||
<div className='busca-atendimento-container'>
|
||||
<div className='input-e-dropdown-wrapper'>
|
||||
<div className='busca-atendimento'>
|
||||
<div className='mb-5'>
|
||||
<input
|
||||
type="text"
|
||||
placeholder="Filtrar atendimento do medico..."
|
||||
value={searchTermDoctor}
|
||||
onChange={(e) => handleSearchMedicos(e.target.value)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
{searchTermDoctor && FiltredTodosMedicos.length > 0 && (
|
||||
<div className='dropdown-medicos'>
|
||||
{FiltredTodosMedicos.map((medico) => (
|
||||
<div
|
||||
key={medico.idMedico}
|
||||
className='dropdown-item'
|
||||
onClick={() => {
|
||||
setSearchTermDoctor(medico.nomeMedico);
|
||||
setFiltredTodosMedicos([]);
|
||||
setMedicoFiltrado(medico);
|
||||
}}
|
||||
>
|
||||
<p>{medico.nomeMedico}</p>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* ABA + BOTÕES NA MESMA BARRA */}
|
||||
<div className='container-btns-agenda-fila_esepera'>
|
||||
<div className="atendimento-eprocura">
|
||||
<div className="container-btns-agenda-fila_esepera">
|
||||
<div className="tabs-agenda-fila">
|
||||
<button
|
||||
className={`btn-agenda ${!FiladeEspera ? "opc-agenda-ativo" : ""}`}
|
||||
onClick={() => { setFiladeEspera(false); setSearchTerm(''); }}
|
||||
className={`btn-agenda ${
|
||||
!FiladeEspera ? "opc-agenda-ativo" : ""
|
||||
}`}
|
||||
onClick={() => {
|
||||
setFiladeEspera(false);
|
||||
setSearchTerm("");
|
||||
}}
|
||||
>
|
||||
Agenda
|
||||
</button>
|
||||
<button
|
||||
className={`btn-fila-espera ${FiladeEspera ? "opc-filaespera-ativo" : ""}`}
|
||||
onClick={() => { setFiladeEspera(true); setSearchTerm(''); }}
|
||||
className={`btn-fila-espera ${
|
||||
FiladeEspera ? "opc-filaespera-ativo" : ""
|
||||
}`}
|
||||
onClick={() => {
|
||||
setFiladeEspera(true);
|
||||
setSearchTerm("");
|
||||
}}
|
||||
>
|
||||
Fila de espera
|
||||
</button>
|
||||
@ -408,51 +466,93 @@ const Agendamento = ({ setDictInfo }) => {
|
||||
<i className="bi bi-plus-circle"></i> Adicionar Consulta
|
||||
</button>
|
||||
<button
|
||||
className="btn btn-primary"
|
||||
className="manage-button btn"
|
||||
onClick={() => navigate("/secretaria/excecoes-disponibilidade")}
|
||||
>
|
||||
<i className="bi bi-gear-fill me-1"></i> Gerenciar Exceções
|
||||
</button>
|
||||
<button
|
||||
className='btn btn-primary'
|
||||
onClick={() => navigate('/secretaria/disponibilidade')}
|
||||
className="manage-button btn"
|
||||
onClick={() => navigate("/secretaria/disponibilidade")}
|
||||
>
|
||||
<i className="bi bi-gear-fill me-1"></i> Mudar Disponibilidade
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<section className='calendario-ou-filaespera'>
|
||||
<section className="calendario-ou-filaespera">
|
||||
{FiladeEspera === false ? (
|
||||
<div className="calendar-wrapper">
|
||||
<div className="calendar-info-panel">
|
||||
<div className="info-date-display">
|
||||
<span>{selectedDay.format('MMM')}</span>
|
||||
<strong>{selectedDay.format('DD')}</strong>
|
||||
<span>{selectedDay.format("MMM")}</span>
|
||||
<strong>{selectedDay.format("DD")}</strong>
|
||||
</div>
|
||||
<div className="info-details">
|
||||
<h3>{selectedDay.format('dddd')}</h3>
|
||||
<p>{selectedDay.format('D [de] MMMM [de] YYYY')}</p>
|
||||
<h3>{selectedDay.format("dddd")}</h3>
|
||||
<p>{selectedDay.format("D [de] MMMM [de] YYYY")}</p>
|
||||
|
||||
<div className="calendar-legend">
|
||||
<div className="legend-item" data-status="completed">
|
||||
Realizado
|
||||
</div>
|
||||
<div className="legend-item" data-status="confirmed">
|
||||
Confirmado
|
||||
</div>
|
||||
<div className="legend-item" data-status="agendado">
|
||||
Agendado
|
||||
</div>
|
||||
<div className="legend-item" data-status="cancelled">
|
||||
Cancelado
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h4 className="subtitle-consultas">
|
||||
Consultas para {selectedDay.format("DD/MM")}
|
||||
</h4>
|
||||
</div>
|
||||
<div className="appointments-list">
|
||||
<h4>Consultas para {selectedDay.format('DD/MM')}</h4>
|
||||
{showSpinner ? (
|
||||
<Spinner />
|
||||
) : (DictAgendamentosOrganizados[selectedDay.format('YYYY-MM-DD')]?.length > 0) ? (
|
||||
DictAgendamentosOrganizados[selectedDay.format('YYYY-MM-DD')].map(app => (
|
||||
<div key={app.id} className="appointment-item" data-status={app.status}>
|
||||
) : (
|
||||
(() => {
|
||||
const allApps =
|
||||
DictAgendamentosOrganizados[
|
||||
selectedDay.format("YYYY-MM-DD")
|
||||
] || [];
|
||||
const termDoc = searchTermDoctor.toLowerCase();
|
||||
const filtered = allApps.filter((app) =>
|
||||
!termDoc
|
||||
? true
|
||||
: (app.medico_nome || "")
|
||||
.toLowerCase()
|
||||
.startsWith(termDoc)
|
||||
);
|
||||
|
||||
return filtered.length > 0 ? (
|
||||
filtered.map((app) => (
|
||||
<div
|
||||
key={app.id}
|
||||
className="appointment-item"
|
||||
data-status={app.status}
|
||||
>
|
||||
<div className="item-time">
|
||||
{dayjs(app.scheduled_at).format('HH:mm')}
|
||||
{dayjs(app.scheduled_at)
|
||||
.add(HORARIO_OFFSET, "hour")
|
||||
.format("HH:mm")}
|
||||
</div>
|
||||
<div className="item-details">
|
||||
<span>{app.paciente_nome}</span>
|
||||
<small>Dr(a). {app.medico_nome}</small>
|
||||
</div>
|
||||
<div className="appointment-actions">
|
||||
{app.status === 'cancelled' ? (
|
||||
{app.status === "cancelled" ? (
|
||||
<button
|
||||
className="btn-action btn-edit"
|
||||
onClick={() => { setSelectedId(app.id); setShowConfirmModal(true); }}
|
||||
onClick={() => {
|
||||
setSelectedId(app.id);
|
||||
setShowConfirmModal(true);
|
||||
}}
|
||||
>
|
||||
<Edit size={16} />
|
||||
</button>
|
||||
@ -470,7 +570,10 @@ const Agendamento = ({ setDictInfo }) => {
|
||||
</button>
|
||||
<button
|
||||
className="btn-action btn-delete"
|
||||
onClick={() => { setSelectedId(app.id); setShowDeleteModal(true); }}
|
||||
onClick={() => {
|
||||
setSelectedId(app.id);
|
||||
setShowDeleteModal(true);
|
||||
}}
|
||||
>
|
||||
<Trash2 size={16} />
|
||||
</button>
|
||||
@ -483,24 +586,90 @@ const Agendamento = ({ setDictInfo }) => {
|
||||
<div className="no-appointments-info">
|
||||
<p>Nenhuma consulta agendada.</p>
|
||||
</div>
|
||||
);
|
||||
})()
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<div className="calendar-main">
|
||||
<div className="calendar-header-filter">
|
||||
<div className="position-relative">
|
||||
<input
|
||||
type="text"
|
||||
className="form-control"
|
||||
placeholder="Filtrar atendimento do médico"
|
||||
value={searchTermDoctor}
|
||||
onChange={(e) => {
|
||||
setSearchTermDoctor(e.target.value);
|
||||
setDoctorDropdownOpen(true);
|
||||
}}
|
||||
onFocus={() => {
|
||||
if (searchTermDoctor.trim())
|
||||
setDoctorDropdownOpen(true);
|
||||
}}
|
||||
/>
|
||||
|
||||
{doctorDropdownOpen && searchTermDoctor.trim() && (
|
||||
<div
|
||||
className="doctor-suggestions"
|
||||
style={{
|
||||
position: "absolute",
|
||||
top: "100%",
|
||||
left: 0,
|
||||
right: 0,
|
||||
zIndex: 10,
|
||||
backgroundColor: "white",
|
||||
border: "1px solid #ced4da",
|
||||
borderTop: "none",
|
||||
maxHeight: "250px",
|
||||
overflowY: "auto",
|
||||
}}
|
||||
>
|
||||
{ListaDeMedicos.filter((m) => {
|
||||
const nome = (m.nomeMedico || "").toLowerCase();
|
||||
const term = searchTermDoctor.toLowerCase();
|
||||
return nome.startsWith(term);
|
||||
})
|
||||
.slice(0, 20)
|
||||
.map((m) => (
|
||||
<button
|
||||
key={m.idMedico}
|
||||
type="button"
|
||||
className="w-100 text-start px-3 py-1"
|
||||
style={{
|
||||
border: "none",
|
||||
background: "white",
|
||||
fontSize: "0.9rem",
|
||||
}}
|
||||
onClick={() => {
|
||||
setSearchTermDoctor(m.nomeMedico);
|
||||
setDoctorDropdownOpen(false);
|
||||
}}
|
||||
>
|
||||
{m.nomeMedico}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="calendar-main">
|
||||
<div className="calendar-legend">
|
||||
<div className="legend-item" data-status="completed">Realizado</div>
|
||||
<div className="legend-item" data-status="confirmed">Confirmado</div>
|
||||
<div className="legend-item" data-status="agendado">Agendado</div>
|
||||
<div className="legend-item" data-status="cancelled">Cancelado</div>
|
||||
</div>
|
||||
<div className="calendar-controls">
|
||||
<div className="date-indicator">
|
||||
<h2>{currentDate.format('MMMM [de] YYYY')}</h2>
|
||||
<div className="quick-jump-controls" style={{ display: 'flex', gap: '5px', marginTop: '10px' }}>
|
||||
<h2>{currentDate.format("MMMM [de] YYYY")}</h2>
|
||||
<div
|
||||
className="quick-jump-controls"
|
||||
style={{
|
||||
display: "flex",
|
||||
gap: "5px",
|
||||
marginTop: "10px",
|
||||
}}
|
||||
>
|
||||
<select
|
||||
value={quickJump.month}
|
||||
onChange={(e) => handleQuickJumpChange('month', e.target.value)}
|
||||
onChange={(e) =>
|
||||
handleQuickJumpChange("month", e.target.value)
|
||||
}
|
||||
className="form-select form-select-sm w-auto"
|
||||
>
|
||||
{dayjs.months().map((month, index) => (
|
||||
@ -511,17 +680,27 @@ const Agendamento = ({ setDictInfo }) => {
|
||||
</select>
|
||||
<select
|
||||
value={quickJump.year}
|
||||
onChange={(e) => handleQuickJumpChange('year', e.target.value)}
|
||||
onChange={(e) =>
|
||||
handleQuickJumpChange("year", e.target.value)
|
||||
}
|
||||
className="form-select form-select-sm w-auto"
|
||||
>
|
||||
{Array.from({ length: 11 }, (_, i) => dayjs().year() - 5 + i).map(year => (
|
||||
<option key={year} value={year}>{year}</option>
|
||||
{Array.from(
|
||||
{ length: 11 },
|
||||
(_, i) => dayjs().year() - 5 + i
|
||||
).map((year) => (
|
||||
<option key={year} value={year}>
|
||||
{year}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
<button
|
||||
className="btn btn-sm btn-outline-primary"
|
||||
onClick={applyQuickJump}
|
||||
disabled={quickJump.month === currentDate.month() && quickJump.year === currentDate.year()}
|
||||
disabled={
|
||||
quickJump.month === currentDate.month() &&
|
||||
quickJump.year === currentDate.year()
|
||||
}
|
||||
>
|
||||
Ir
|
||||
</button>
|
||||
@ -529,28 +708,63 @@ const Agendamento = ({ setDictInfo }) => {
|
||||
</div>
|
||||
|
||||
<div className="nav-buttons">
|
||||
<button onClick={() => { setCurrentDate(currentDate.subtract(1, 'month')); setSelectedDay(currentDate.subtract(1, 'month')); }}>
|
||||
<button
|
||||
onClick={() => {
|
||||
const newDate = currentDate.subtract(1, "month");
|
||||
setCurrentDate(newDate);
|
||||
setSelectedDay(newDate);
|
||||
}}
|
||||
>
|
||||
<ChevronLeft size={20} />
|
||||
</button>
|
||||
<button onClick={() => { setCurrentDate(dayjs()); setSelectedDay(dayjs()); }}>
|
||||
<button
|
||||
onClick={() => {
|
||||
const today = dayjs();
|
||||
setCurrentDate(today);
|
||||
setSelectedDay(today);
|
||||
}}
|
||||
>
|
||||
Hoje
|
||||
</button>
|
||||
<button onClick={() => { setCurrentDate(currentDate.add(1, 'month')); setSelectedDay(currentDate.add(1, 'month')); }}>
|
||||
<button
|
||||
onClick={() => {
|
||||
const newDate = currentDate.add(1, "month");
|
||||
setCurrentDate(newDate);
|
||||
setSelectedDay(newDate);
|
||||
}}
|
||||
>
|
||||
<ChevronRight size={20} />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="calendar-grid-scroll-wrapper">
|
||||
<div className="calendar-grid-scrollable">
|
||||
<div className="calendar-grid">
|
||||
{weekDays.map(day => (
|
||||
<div key={day} className="day-header">{day}</div>
|
||||
{weekDays.map((day) => (
|
||||
<div key={day} className="day-header">
|
||||
{day}
|
||||
</div>
|
||||
))}
|
||||
{dateGrid.map((day, index) => {
|
||||
const appointmentsOnDay = DictAgendamentosOrganizados[day.format('YYYY-MM-DD')] || [];
|
||||
const dayKey = day.format("YYYY-MM-DD");
|
||||
const appointmentsOnDay =
|
||||
DictAgendamentosOrganizados[dayKey] || [];
|
||||
const termDoc = searchTermDoctor.toLowerCase();
|
||||
const filteredAppointments =
|
||||
appointmentsOnDay.filter((app) =>
|
||||
!termDoc
|
||||
? true
|
||||
: (app.medico_nome || "")
|
||||
.toLowerCase()
|
||||
.startsWith(termDoc)
|
||||
);
|
||||
const cellClasses = `day-cell ${
|
||||
day.isSame(currentDate, 'month') ? 'current-month' : 'other-month'
|
||||
} ${day.isSame(dayjs(), 'day') ? 'today' : ''} ${
|
||||
day.isSame(selectedDay, 'day') ? 'selected' : ''
|
||||
day.isSame(currentDate, "month")
|
||||
? "current-month"
|
||||
: "other-month"
|
||||
} ${day.isSame(dayjs(), "day") ? "today" : ""} ${
|
||||
day.isSame(selectedDay, "day") ? "selected" : ""
|
||||
}`;
|
||||
return (
|
||||
<div
|
||||
@ -558,9 +772,11 @@ const Agendamento = ({ setDictInfo }) => {
|
||||
className={cellClasses}
|
||||
onClick={() => handleDateClick(day)}
|
||||
>
|
||||
<span>{day.format('D')}</span>
|
||||
{appointmentsOnDay.length > 0 && (
|
||||
<div className="appointments-indicator">{appointmentsOnDay.length}</div>
|
||||
<span>{day.format("D")}</span>
|
||||
{filteredAppointments.length > 0 && (
|
||||
<div className="appointments-indicator">
|
||||
{filteredAppointments.length}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
@ -568,6 +784,13 @@ const Agendamento = ({ setDictInfo }) => {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="d-md-none scroll-hint">
|
||||
<i className="bi bi-arrow-left-right"></i>
|
||||
<span>Arraste para ver mais dias</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
<div className="page-content table-paciente-container">
|
||||
<section className="row">
|
||||
@ -581,6 +804,7 @@ const Agendamento = ({ setDictInfo }) => {
|
||||
<h5 className="mb-3">
|
||||
<i className="bi bi-funnel-fill me-2 text-primary"></i> Filtros
|
||||
</h5>
|
||||
|
||||
<div className="mb-3">
|
||||
<input
|
||||
type="text"
|
||||
@ -593,23 +817,21 @@ const Agendamento = ({ setDictInfo }) => {
|
||||
Digite o nome do paciente, CPF ou nome do médico
|
||||
</small>
|
||||
</div>
|
||||
|
||||
<div className="d-flex flex-wrap align-items-center gap-2 mb-3">
|
||||
<div className="d-flex align-items-center gap-2">
|
||||
<span className="me-2 text-muted small">Ordenar por:</span>
|
||||
{(() => {
|
||||
const sortValue = waitSortKey ? `${waitSortKey}-${waitSortDir}` : '';
|
||||
return (
|
||||
<select
|
||||
className="form-select compact-select sort-select w-auto"
|
||||
value={sortValue}
|
||||
value={waitSortKey ? `${waitSortKey}-${waitSortDir}` : ""}
|
||||
onChange={(e) => {
|
||||
const v = e.target.value;
|
||||
if (!v) {
|
||||
setWaitSortKey(null);
|
||||
setWaitSortDir('asc');
|
||||
setWaitSortDir("asc");
|
||||
return;
|
||||
}
|
||||
const [k, d] = v.split('-');
|
||||
const [k, d] = v.split("-");
|
||||
setWaitSortKey(k);
|
||||
setWaitSortDir(d);
|
||||
}}
|
||||
@ -622,10 +844,9 @@ const Agendamento = ({ setDictInfo }) => {
|
||||
<option value="data-asc">Data (mais antiga)</option>
|
||||
<option value="data-desc">Data (mais recente)</option>
|
||||
</select>
|
||||
);
|
||||
})()}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="mt-3">
|
||||
<div className="contador-pacientes">
|
||||
{filaEsperaFiltrada.length} DE {filaEsperaData.length} SOLICITAÇÕES ENCONTRADAS
|
||||
@ -650,12 +871,17 @@ const Agendamento = ({ setDictInfo }) => {
|
||||
<tr key={index}>
|
||||
<td>{item?.Infos?.paciente_nome}</td>
|
||||
<td>{item?.Infos?.paciente_cpf}</td>
|
||||
<td>{item?.Infos?.nome_medico}</td>
|
||||
<td>{dayjs(item.agendamento.scheduled_at).format('DD/MM/YYYY')}</td>
|
||||
<td>{item?.Infos?.medico_nome}</td>
|
||||
<td>
|
||||
{dayjs(item.agendamento.scheduled_at).format("DD/MM/YYYY")}
|
||||
</td>
|
||||
<td>
|
||||
<button
|
||||
className="btn btn-sm btn-delete"
|
||||
onClick={() => { setSelectedId(item.agendamento.id); setShowDeleteModal(true); }}
|
||||
onClick={() => {
|
||||
setSelectedId(item.agendamento.id);
|
||||
setShowDeleteModal(true);
|
||||
}}
|
||||
>
|
||||
<i className="bi bi-trash me-1"></i> Excluir
|
||||
</button>
|
||||
@ -699,24 +925,30 @@ const Agendamento = ({ setDictInfo }) => {
|
||||
<option value={50}>50</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div className="d-flex align-items-center">
|
||||
<span className="me-3 text-muted">
|
||||
Página {waitPage} de {waitTotalPages} • Mostrando {waitIndiceInicial + 1}-{Math.min(waitIndiceFinal, filaEsperaFiltrada.length)} de {filaEsperaFiltrada.length}
|
||||
Página {waitPage} de {waitTotalPages} • Mostrando{" "}
|
||||
{waitIndiceInicial + 1}-
|
||||
{Math.min(waitIndiceFinal, filaEsperaFiltrada.length)} de{" "}
|
||||
{filaEsperaFiltrada.length}
|
||||
</span>
|
||||
<nav>
|
||||
<ul className="pagination pagination-sm mb-0">
|
||||
<li className={`page-item ${waitPage === 1 ? 'disabled' : ''}`}>
|
||||
<li className={`page-item ${waitPage === 1 ? "disabled" : ""}`}>
|
||||
<button
|
||||
className="page-link"
|
||||
onClick={() => setWaitPage(p => Math.max(1, p - 1))}
|
||||
onClick={() => setWaitPage((p) => Math.max(1, p - 1))}
|
||||
>
|
||||
<i className="bi bi-chevron-left"></i>
|
||||
</button>
|
||||
</li>
|
||||
{gerarNumerosWaitPages().map(pagina => (
|
||||
{gerarNumerosWaitPages().map((pagina) => (
|
||||
<li
|
||||
key={pagina}
|
||||
className={`page-item ${pagina === waitPage ? 'active' : ''}`}
|
||||
className={`page-item ${
|
||||
pagina === waitPage ? "active" : ""
|
||||
}`}
|
||||
>
|
||||
<button
|
||||
className="page-link"
|
||||
@ -726,10 +958,16 @@ const Agendamento = ({ setDictInfo }) => {
|
||||
</button>
|
||||
</li>
|
||||
))}
|
||||
<li className={`page-item ${waitPage === waitTotalPages ? 'disabled' : ''}`}>
|
||||
<li
|
||||
className={`page-item ${
|
||||
waitPage === waitTotalPages ? "disabled" : ""
|
||||
}`}
|
||||
>
|
||||
<button
|
||||
className="page-link"
|
||||
onClick={() => setWaitPage(p => Math.min(waitTotalPages, p + 1))}
|
||||
onClick={() =>
|
||||
setWaitPage((p) => Math.min(waitTotalPages, p + 1))
|
||||
}
|
||||
>
|
||||
<i className="bi bi-chevron-right"></i>
|
||||
</button>
|
||||
@ -751,8 +989,11 @@ const Agendamento = ({ setDictInfo }) => {
|
||||
) : (
|
||||
<AgendamentoCadastroManager
|
||||
setPageConsulta={setPageConsulta}
|
||||
agendamentoInicial={appointmentToEdit}
|
||||
setEditingAppointmentId={setEditingAppointmentId}
|
||||
Dict={appointmentToEdit}
|
||||
onSaved={() => {
|
||||
fetchAppointments(); // recarrega os agendamentos do médico
|
||||
setPageConsulta(false);
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
|
||||
|
||||
@ -35,7 +35,6 @@ const LaudoManager = () => {
|
||||
const [paginaAtual, setPaginaAtual] = useState(1);
|
||||
const [itensPorPagina, setItensPorPagina] = useState(10);
|
||||
|
||||
// agora guardamos a mensagem (null = sem aviso)
|
||||
const [noPermissionText, setNoPermissionText] = useState(null);
|
||||
|
||||
const isSecretary = true;
|
||||
@ -165,11 +164,11 @@ const LaudoManager = () => {
|
||||
|
||||
const handleLiberarLaudo = async (relatorio) => {
|
||||
if (isSecretary) {
|
||||
// MUDANÇA: mostrar "Ainda não implementado"
|
||||
|
||||
setNoPermissionText('Ainda não implementado');
|
||||
return;
|
||||
}
|
||||
// para médicos: implementação real já estava antes (mantive o bloco, caso queira)
|
||||
|
||||
try {
|
||||
const myHeaders = new Headers();
|
||||
myHeaders.append('apikey', API_KEY);
|
||||
@ -190,7 +189,6 @@ const LaudoManager = () => {
|
||||
throw new Error('Erro ao liberar laudo: ' + res.status + ' ' + txt);
|
||||
}
|
||||
|
||||
// refetch simples
|
||||
const refreshed = await fetch("https://yuanqfswhberkoevtmfr.supabase.co/rest/v1/reports?select=*", {
|
||||
method: 'GET',
|
||||
headers: (() => { const h=new Headers(); h.append('apikey', API_KEY); if(authHeader) h.append('Authorization', authHeader); return h; })(),
|
||||
@ -241,9 +239,11 @@ const LaudoManager = () => {
|
||||
return (
|
||||
<div>
|
||||
<div className="page-heading"><h3>Lista de Relatórios</h3></div>
|
||||
<div className="page-content">
|
||||
<section className="row">
|
||||
<div className="col-12">
|
||||
<div className="card">
|
||||
<div className="card-header d-flex justify-content-between">
|
||||
<div className="card-header d-flex justify-content-between align-items-center">
|
||||
<h4 className="card-title mb-0">Relatórios Cadastrados</h4>
|
||||
<div>
|
||||
<button
|
||||
@ -328,7 +328,7 @@ const LaudoManager = () => {
|
||||
<i className="bi bi-pencil me-1"></i> Editar
|
||||
</button>
|
||||
|
||||
{/* Removido o botão "Imprimir" daqui (agora no Ver Detalhes) */}
|
||||
|
||||
|
||||
<button className="btn btn-sm btn-protocolo" onClick={() => handleOpenProtocol(relatorio, index)}>
|
||||
<i className="bi bi-send me-1"></i> Protocolo
|
||||
@ -402,16 +402,17 @@ const LaudoManager = () => {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
|
||||
{/* Modal principal (detalhes) */}
|
||||
{showModal && relatorioModal && (
|
||||
<div className="modal modal-centered" role="dialog" aria-modal="true" onClick={() => setShowModal(false)}>
|
||||
<div className="modal-dialog modal-dialog-square" role="document" onClick={(e) => e.stopPropagation()}>
|
||||
<div className="modal fade show" style={{ display: "block", backgroundColor: "rgba(0, 0, 0, 0.5)" }} tabIndex="-1">
|
||||
<div className="modal-dialog modal-dialog-centered modal-lg">
|
||||
<div className="modal-content">
|
||||
<div className="modal-header custom-modal-header">
|
||||
<div className="modal-header" style={{ backgroundColor: '#1e3a8a', color: 'white' }}>
|
||||
<h5 className="modal-title">Relatório de {pacientesComRelatorios[modalIndex]?.full_name || relatorioModal.patient_name || 'Paciente'}</h5>
|
||||
<button type="button" className="btn-close modal-close-btn" aria-label="Close" onClick={() => setShowModal(false)}></button>
|
||||
</div>
|
||||
|
||||
<div className="modal-body">
|
||||
@ -440,11 +441,11 @@ const LaudoManager = () => {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="modal-footer custom-modal-footer">
|
||||
<div className="modal-footer">
|
||||
<button className="btn btn-primary" onClick={() => BaixarPDFdoRelatorio(pacientesComRelatorios[modalIndex]?.full_name || 'paciente', modalIndex)}>
|
||||
<i className='bi bi-file-pdf-fill'></i> baixar em pdf
|
||||
<i className='bi bi-file-pdf-fill me-1'></i> Baixar em PDF
|
||||
</button>
|
||||
<button type="button" className="btn btn-outline-secondary" onClick={() => { setShowModal(false) }}>
|
||||
<button type="button" className="btn btn-secondary" onClick={() => { setShowModal(false) }}>
|
||||
Fechar
|
||||
</button>
|
||||
</div>
|
||||
@ -453,14 +454,13 @@ const LaudoManager = () => {
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Modal Protocolo */}
|
||||
|
||||
{showProtocolModal && protocolForIndex && (
|
||||
<div className="modal modal-centered" role="dialog" aria-modal="true" onClick={() => setShowProtocolModal(false)}>
|
||||
<div className="modal-dialog modal-dialog-tabela-relatorio" role="document" onClick={(e) => e.stopPropagation()}>
|
||||
<div className="modal fade show" style={{ display: "block", backgroundColor: "rgba(0, 0, 0, 0.5)" }} tabIndex="-1">
|
||||
<div className="modal-dialog modal-dialog-centered">
|
||||
<div className="modal-content">
|
||||
<div className="modal-header custom-modal-header">
|
||||
<div className="modal-header" style={{ backgroundColor: '#1e3a8a', color: 'white' }}>
|
||||
<h5 className="modal-title">Protocolo de Entrega - {protocolForIndex.relatorio?.patient_name || 'Paciente'}</h5>
|
||||
<button type="button" className="btn-close modal-close-btn" aria-label="Close" onClick={() => setShowProtocolModal(false)}></button>
|
||||
</div>
|
||||
|
||||
<div className="modal-body">
|
||||
@ -473,14 +473,14 @@ const LaudoManager = () => {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="modal-footer custom-modal-footer">
|
||||
<div className="modal-footer">
|
||||
<button className="btn btn-primary" onClick={() => {
|
||||
const idx = protocolForIndex.index ?? 0;
|
||||
BaixarPDFdoRelatorio(protocolForIndex.relatorio?.patient_name || 'paciente', idx);
|
||||
}}>
|
||||
<i className='bi bi-file-earmark-pdf-fill'></i> baixar protocolo (PDF)
|
||||
<i className='bi bi-file-earmark-pdf-fill me-1'></i> Baixar Protocolo (PDF)
|
||||
</button>
|
||||
<button type="button" className="btn btn-outline-secondary" onClick={() => setShowProtocolModal(false)}>
|
||||
<button type="button" className="btn btn-secondary" onClick={() => setShowProtocolModal(false)}>
|
||||
Fechar
|
||||
</button>
|
||||
</div>
|
||||
@ -489,17 +489,18 @@ const LaudoManager = () => {
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Variável de aviso: mostra texto personalizado */}
|
||||
{noPermissionText && (
|
||||
<div className="modal modal-centered" role="dialog" aria-modal="true" onClick={() => setNoPermissionText(null)}>
|
||||
<div className="modal-dialog modal-dialog-square" role="document" onClick={(e) => e.stopPropagation()}>
|
||||
<div className="modal fade show" style={{ display: "block", backgroundColor: "rgba(0, 0, 0, 0.5)" }} tabIndex="-1">
|
||||
<div className="modal-dialog modal-dialog-centered">
|
||||
<div className="modal-content">
|
||||
<div style={{ padding: 18 }}>
|
||||
<h5 style={{ marginBottom: 8 }}>{noPermissionText}</h5>
|
||||
<p style={{ color: '#6c757d' }}>{/* opcional descrição aqui */}</p>
|
||||
<div style={{ textAlign: 'right', marginTop: 12 }}>
|
||||
<button className="btn btn-outline-secondary" onClick={() => setNoPermissionText(null)}>Fechar</button>
|
||||
<div className="modal-header" style={{ backgroundColor: '#1e3a8a', color: 'white' }}>
|
||||
<h5 className="modal-title">Aviso</h5>
|
||||
</div>
|
||||
<div className="modal-body">
|
||||
<p>{noPermissionText}</p>
|
||||
</div>
|
||||
<div className="modal-footer">
|
||||
<button className="btn btn-primary" onClick={() => setNoPermissionText(null)}>Fechar</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -30,9 +30,8 @@ function TableDoctor({setDictInfo}) {
|
||||
const [showDeleteModal, setShowDeleteModal] = useState(false);
|
||||
const [selectedDoctorId, setSelectedDoctorId] = useState(null);
|
||||
|
||||
// Ordenação rápida
|
||||
const [sortKey, setSortKey] = useState(null); // 'nome' | 'idade' | null
|
||||
const [sortDir, setSortDir] = useState('asc'); // 'asc' | 'desc'
|
||||
const [sortKey, setSortKey] = useState(null);
|
||||
const [sortDir, setSortDir] = useState('asc');
|
||||
|
||||
const limparFiltros = () => {
|
||||
setSearch("");
|
||||
@ -150,7 +149,6 @@ function TableDoctor({setDictInfo}) {
|
||||
return resultado;
|
||||
}) : [];
|
||||
|
||||
|
||||
const applySorting = (arr) => {
|
||||
if (!Array.isArray(arr) || !sortKey) return arr;
|
||||
const copy = [...arr];
|
||||
@ -216,7 +214,7 @@ function TableDoctor({setDictInfo}) {
|
||||
<div className="page-content table-doctor-container">
|
||||
<section className="row">
|
||||
<div className="col-12">
|
||||
<div className="table-doctor-card">
|
||||
<div className="card table-doctor-card">
|
||||
<div className="card-header">
|
||||
<h4 className="card-title mb-0">Médicos Cadastrados</h4>
|
||||
<Link to={'cadastro'}>
|
||||
@ -280,7 +278,7 @@ function TableDoctor({setDictInfo}) {
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{/* Ordenação rápida */}
|
||||
|
||||
<div className="vr mx-2 d-none d-md-block" />
|
||||
<div className="d-flex align-items-center gap-2">
|
||||
<span className="text-muted small">Ordenar por:</span>
|
||||
@ -484,7 +482,6 @@ function TableDoctor({setDictInfo}) {
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
{/* Paginação */}
|
||||
{medicosFiltrados.length > 0 && (
|
||||
<div className="d-flex justify-content-between align-items-center mt-3">
|
||||
<div className="d-flex align-items-center">
|
||||
@ -557,15 +554,10 @@ function TableDoctor({setDictInfo}) {
|
||||
>
|
||||
<div className="modal-dialog modal-dialog-centered">
|
||||
<div className="modal-content">
|
||||
<div className="modal-header">
|
||||
<div className="modal-header" style={{ backgroundColor: '#dc3545', color: 'white' }}>
|
||||
<h5 className="modal-title">
|
||||
Confirmação de Exclusão
|
||||
</h5>
|
||||
<button
|
||||
type="button"
|
||||
className="btn-close"
|
||||
onClick={() => setShowDeleteModal(false)}
|
||||
></button>
|
||||
</div>
|
||||
|
||||
<div className="modal-body">
|
||||
|
||||
@ -1,16 +1,18 @@
|
||||
//TablePaciente.jsx
|
||||
|
||||
import { useState, useEffect } from "react";
|
||||
import { Link } from "react-router-dom";
|
||||
import { Link, useNavigate } from "react-router-dom";
|
||||
import { useAuth } from "../../_assets/utils/AuthProvider";
|
||||
import ModalErro from "../../_assets/utils/fetchErros/ModalErro";
|
||||
import manager from "../../_assets/utils/fetchErros/ManagerFunction";
|
||||
import API_KEY from "../../_assets/utils/apiKeys";
|
||||
|
||||
import "../../_assets/css/pages/secretaria/TabelaPacientes.css";
|
||||
|
||||
function TablePaciente({ setDictInfo }) {
|
||||
function TablePaciente({ setPatientID, setDictInfo }) {
|
||||
|
||||
const { getAuthorizationHeader, isAuthenticated } = useAuth();
|
||||
const navigate = useNavigate();
|
||||
|
||||
const [pacientes, setPacientes] = useState([]);
|
||||
const [search, setSearch] = useState("");
|
||||
@ -25,9 +27,9 @@ function TablePaciente({ setDictInfo }) {
|
||||
const [dataInicial, setDataInicial] = useState("");
|
||||
const [dataFinal, setDataFinal] = useState("");
|
||||
|
||||
// Ordenação rápida
|
||||
const [sortKey, setSortKey] = useState(null); // 'nome' | 'idade' | null
|
||||
const [sortDir, setSortDir] = useState('asc'); // 'asc' | 'desc'
|
||||
|
||||
const [sortKey, setSortKey] = useState(null);
|
||||
const [sortDir, setSortDir] = useState('asc');
|
||||
|
||||
|
||||
const [paginaAtual, setPaginaAtual] = useState(1);
|
||||
@ -252,7 +254,7 @@ function TablePaciente({ setDictInfo }) {
|
||||
return resultado;
|
||||
}) : [];
|
||||
|
||||
// Aplica ordenação rápida
|
||||
|
||||
const applySorting = (arr) => {
|
||||
if (!Array.isArray(arr) || !sortKey) return arr;
|
||||
const copy = [...arr];
|
||||
@ -319,7 +321,7 @@ function TablePaciente({ setDictInfo }) {
|
||||
<div className="page-content table-paciente-container">
|
||||
<section className="row">
|
||||
<div className="col-12">
|
||||
<div className="table-paciente-card">
|
||||
<div className="card table-paciente-card">
|
||||
<div className="card-header">
|
||||
<h4 className="card-title mb-0">Pacientes Cadastrados</h4>
|
||||
<Link to={'cadastro'}>
|
||||
@ -379,7 +381,6 @@ function TablePaciente({ setDictInfo }) {
|
||||
<i className="bi bi-calendar me-1"></i> Aniversariantes
|
||||
</button>
|
||||
|
||||
{/* Ordenação rápida (estilo compacto por select) */}
|
||||
<div className="vr mx-2 d-none d-md-block" />
|
||||
<div className="d-flex align-items-center gap-2">
|
||||
<span className="text-muted small">Ordenar por:</span>
|
||||
@ -552,11 +553,15 @@ function TablePaciente({ setDictInfo }) {
|
||||
</button>
|
||||
</Link>
|
||||
|
||||
<Link to={"edit"}>
|
||||
<button className="btn btn-sm btn-edit" onClick={() => setDictInfo(paciente)}>
|
||||
<button
|
||||
className="btn btn-sm btn-edit"
|
||||
onClick={() => {
|
||||
setDictInfo(paciente);
|
||||
navigate('edit');
|
||||
}}
|
||||
>
|
||||
<i className="bi bi-pencil me-1"></i> Editar
|
||||
</button>
|
||||
</Link>
|
||||
|
||||
<button
|
||||
className="btn btn-sm btn-delete"
|
||||
@ -590,7 +595,7 @@ function TablePaciente({ setDictInfo }) {
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
{/* Paginação */}
|
||||
|
||||
{pacientesFiltrados.length > 0 && (
|
||||
<div className="d-flex justify-content-between align-items-center mt-3">
|
||||
<div className="d-flex align-items-center">
|
||||
@ -663,15 +668,10 @@ function TablePaciente({ setDictInfo }) {
|
||||
>
|
||||
<div className="modal-dialog modal-dialog-centered">
|
||||
<div className="modal-content">
|
||||
<div className="modal-header">
|
||||
<div className="modal-header" style={{ backgroundColor: '#dc3545', color: 'white' }}>
|
||||
<h5 className="modal-title">
|
||||
Confirmação de Exclusão
|
||||
</h5>
|
||||
<button
|
||||
type="button"
|
||||
className="btn-close"
|
||||
onClick={() => setShowDeleteModal(false)}
|
||||
></button>
|
||||
</div>
|
||||
|
||||
<div className="modal-body">
|
||||
|
||||
@ -10,12 +10,14 @@ import BotaoVideoChamada from '../../components/VideoChamada/BotaoVideoChamada';
|
||||
//Pages
|
||||
import DoctorRelatorioManager from "../../pages/medico/ListaLaudosMedico";
|
||||
import Prontuario from "../../pages/medico/Prontuario";
|
||||
import Relatorio from "../../pages/medico/Relatorio";
|
||||
import DoctorAgendamentoManager from "../../pages/medico/CadastroAgendamento";
|
||||
import Chat from "../../pages/medico/Chat";
|
||||
import FormNovoRelatorio from "../../pages/medico/FormRelatorio";
|
||||
import EditPageRelatorio from "../../pages/medico/EditarRelatorio";
|
||||
import DoctorAgendamentoEditPage from "../../pages/medico/EditarAgendamento";
|
||||
import ExcecoesDisponibilidadeDoctor from "../../pages/medico/ExcecoesDisponibilidadeMedico";
|
||||
import NovoRelatorioAudio from "../../pages/medico/RelatorioAudio";
|
||||
|
||||
//Data
|
||||
import DoctorItems from "../../data/sidebar-items-medico.json";
|
||||
@ -32,13 +34,14 @@ function PerfilMedico() {
|
||||
<div id="main">
|
||||
<Routes>
|
||||
<Route path="/" element={<DoctorRelatorioManager />} />
|
||||
<Route path="/novo-relatorio" element={<FormNovoRelatorio />} />
|
||||
<Route path="/novo-relatorio-audio" element={<NovoRelatorioAudio />} />
|
||||
<Route path="/relatorios/criar" element={<FormNovoRelatorio />} />
|
||||
<Route path="/relatorios/:id/edit" element={<EditPageRelatorio />} />
|
||||
<Route path="/prontuario" element={<Prontuario />} />
|
||||
<Route path="/relatorios" element={<DoctorRelatorioManager />} />
|
||||
<Route path="/agendamento" element={<DoctorAgendamentoManager setDictInfo={setDictInfo}/>} />
|
||||
<Route path="/agendamento/edit" element={<DoctorAgendamentoEditPage DictInfo={dictInfo} setDictInfo={setDictInfo}/>} />
|
||||
<Route path="/excecoes-disponibilidade" element={<ExcecoesDisponibilidadeDoctor />} />
|
||||
<Route path="/chat" element={<Chat />} />
|
||||
</Routes>
|
||||
</div>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user