diff --git a/src/PagesMedico/DoctorAgendamentoManager.jsx b/src/PagesMedico/DoctorAgendamentoManager.jsx index c2c0f830..d0ebd457 100644 --- a/src/PagesMedico/DoctorAgendamentoManager.jsx +++ b/src/PagesMedico/DoctorAgendamentoManager.jsx @@ -1,4 +1,4 @@ -import React, { useState, useMemo, useEffect, useCallback } from "react"; +import React, { useState, useMemo, useEffect, useCallback } from "react"; import { useNavigate } from "react-router-dom"; import API_KEY from "../components/utils/apiKeys.js"; import AgendamentoCadastroManager from "../pages/AgendamentoCadastroManager.jsx"; @@ -15,6 +15,7 @@ import { Edit, Trash2, CheckCircle, + FileText, } from "lucide-react"; import "../pages/style/Agendamento.css"; import "../pages/style/FilaEspera.css"; @@ -295,6 +296,18 @@ const Agendamento = () => { setPageConsulta(true); }; + const handleCreateReport = (appointment) => { + navigate("/medico/novo-relatorio", { + state: { + appointment, + patient_id: appointment.patient_id, + doctor_id: appointment.doctor_id, + paciente_nome: appointment.paciente_nome, + medico_nome: appointment.medico_nome, + }, + }); + }; + const handleSearchMedicos = (term) => { setSearchTermDoctor(term); if (term.trim()) { @@ -609,6 +622,16 @@ const filtrarPorPaciente = (appointments) => { )} + {app.status !== "cancelled" && ( + + )} {app.status !== "cancelled" && ( @@ -299,7 +348,10 @@ const Agendamento = ({ setDictInfo }) => { @@ -317,21 +369,29 @@ const Agendamento = ({ setDictInfo }) => { ); const ConfirmEditModal = () => ( -
-
+
Confirmação de edição
-

Tem certeza que deseja retirar o cancelamento?

- Isso reverterá o status do agendamento para Agendado. + + Isso reverterá o status do agendamento para Agendado. +
@@ -359,18 +424,28 @@ const Agendamento = ({ setDictInfo }) => {

Agendar nova consulta

{!PageNovaConsulta ? ( -
-
+
+
@@ -394,173 +469,204 @@ const Agendamento = ({ setDictInfo }) => { Gerenciar Exceções
-
+
{FiladeEspera === false ? (
- {selectedDay.format('MMM')} - {selectedDay.format('DD')} + {selectedDay.format("MMM")} + {selectedDay.format("DD")}
-

{selectedDay.format('dddd')}

-

{selectedDay.format('D [de] MMMM [de] YYYY')}

+

{selectedDay.format("dddd")}

+

{selectedDay.format("D [de] MMMM [de] YYYY")}

-
-
Realizado
-
Confirmado
-
Agendado
-
Cancelado
+
+
+ Realizado +
+
+ Confirmado +
+
+ Agendado +
+
+ Cancelado +

- Consultas para {selectedDay.format('DD/MM')} + Consultas para {selectedDay.format("DD/MM")}

{showSpinner ? ( - ) : (() => { - 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) -); + ) : ( + (() => { + 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 => ( -
-
- {dayjs(app.scheduled_at).add(3, 'hour').format('HH:mm')} -
-
- {app.paciente_nome} - Dr(a). {app.medico_nome} -
-
- {app.status === 'cancelled' ? ( - - ) : ( - <> + return filtered.length > 0 ? ( + filtered.map((app) => ( +
+
+ {dayjs(app.scheduled_at) + .add(HORARIO_OFFSET, "hour") + .format("HH:mm")} +
+
+ {app.paciente_nome} + Dr(a). {app.medico_nome} +
+
+ {app.status === "cancelled" ? ( - - - )} + ) : ( + <> + + + + )} +
+ )) + ) : ( +
+

Nenhuma consulta agendada.

- )) - ) : ( -
-

Nenhuma consulta agendada.

-
- ); - })()} + ); + })() + )} +
+
+
+
+
+ { + setSearchTermDoctor(e.target.value); + setDoctorDropdownOpen(true); + }} + onFocus={() => { + if (searchTermDoctor.trim()) + setDoctorDropdownOpen(true); + }} + /> + + {doctorDropdownOpen && searchTermDoctor.trim() && ( +
+ {ListaDeMedicos.filter((m) => { + const nome = (m.nomeMedico || "").toLowerCase(); + const term = searchTermDoctor.toLowerCase(); + return nome.startsWith(term); + }) + .slice(0, 20) + .map((m) => ( + + ))} +
+ )} +
-
-
- {/* SUBSTITUIR POR ESTE BLOCO 👇 */} -
-
- { - setSearchTermDoctor(e.target.value); - setDoctorDropdownOpen(true); - }} - onFocus={() => { - if (searchTermDoctor.trim()) setDoctorDropdownOpen(true); - }} - /> - {doctorDropdownOpen && searchTermDoctor.trim() && ( -
- {ListaDeMedicos - .filter((m) => { - const nome = (m.nomeMedico || "").toLowerCase(); - const term = searchTermDoctor.toLowerCase(); - return nome.startsWith(term); - }) - .slice(0, 20) - .map((m) => ( - - ))} -
- )} -
-
- -
-

{currentDate.format('MMMM [de] YYYY')}

-
{currentDate.format("MMMM [de] YYYY")} +
- - -
-
- {weekDays.map(day => ( -
{day}
- ))} - {dateGrid.map((day, index) => { - 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' : '' - }`; - return ( -
handleDateClick(day)} - > - {day.format('D')} - {filteredAppointments.length > 0 && ( -
- {filteredAppointments.length} +
+
+
+ {weekDays.map((day) => ( +
+ {day} +
+ ))} + {dateGrid.map((day, index) => { + 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" : "" + }`; + return ( +
handleDateClick(day)} + > + {day.format("D")} + {filteredAppointments.length > 0 && ( +
+ {filteredAppointments.length} +
+ )}
- )} -
- ); - })} + ); + })} +
+
+
+ +
+ + Arraste para ver mais dias
@@ -661,7 +797,184 @@ const filteredAppointments = appointmentsOnDay.filter(app =>

Fila de Espera

- {/* ... resto da fila de espera igual ao seu código ... */} +
+
+ Filtros +
+ +
+ setWaitlistSearch(e.target.value)} + /> + + Digite o nome do paciente, CPF ou nome do médico + +
+ +
+
+ Ordenar por: + +
+
+ +
+
+ {filaEsperaFiltrada.length} DE {filaEsperaData.length} SOLICITAÇÕES ENCONTRADAS +
+
+
+ +
+ + + + + + + + + + + + {filaEsperaPaginada.length > 0 ? ( + filaEsperaPaginada.map((item, index) => ( + + + + + + + + )) + ) : ( + + + + )} + +
Nome do PacienteCPFMédico SolicitadoData da SolicitaçãoAções
{item?.Infos?.paciente_nome}{item?.Infos?.paciente_cpf}{item?.Infos?.medico_nome} + {dayjs(item.agendamento.scheduled_at).format("DD/MM/YYYY")} + + +
+
+ {showSpinner ? ( + + ) : ( + <> + +

Nenhuma solicitação encontrada.

+ + )} +
+
+ + {filaEsperaFiltrada.length > 0 && ( +
+
+ Itens por página: + +
+ +
+ + Página {waitPage} de {waitTotalPages} • Mostrando{" "} + {waitIndiceInicial + 1}- + {Math.min(waitIndiceFinal, filaEsperaFiltrada.length)} de{" "} + {filaEsperaFiltrada.length} + + +
+
+ )} +
@@ -670,12 +983,12 @@ const filteredAppointments = appointmentsOnDay.filter(app => )}
- ) : ( + ) : ( { - fetchAppointments(); // recarrega os agendamentos do médico + fetchAppointments(); // recarrega os agendamentos do médico setPageConsulta(false); }} /> @@ -688,4 +1001,3 @@ const filteredAppointments = appointmentsOnDay.filter(app => }; export default Agendamento; - diff --git a/src/pages/style/Agendamento.css b/src/pages/style/Agendamento.css index 734d4042..eac69387 100644 --- a/src/pages/style/Agendamento.css +++ b/src/pages/style/Agendamento.css @@ -43,33 +43,6 @@ margin-left: 0; } -@media (max-width: 576px) { - .busca-atendimento { - flex-direction: column; - gap: 10px; - } - -.container-btns-agenda-fila_esepera { - flex-direction: column; - align-items: flex-start; - gap: 10px; - flex-wrap: wrap; /* Adicionado para permitir quebra de linha nos botões */ -} - -.btns-gerenciamento-e-consulta { - width: 100%; - justify-content: space-between; - flex-wrap: wrap; /* Adicionado para permitir quebra de linha nos botões */ -} - -.btn-adicionar-consulta { - padding: 8px 12px; /* Reduzido o padding */ - font-size: 0.8rem; /* Reduzido o tamanho da fonte */ - white-space: normal; /* Permite quebra de linha no texto do botão */ - text-align: center; -} -} - .container-btns-agenda-fila_esepera { margin-top: 20px; margin-left: 0; @@ -84,7 +57,7 @@ background-color: transparent; border: 0; border-bottom: 2px solid transparent; - padding: 10px 12px; /* Reduzido o padding */ + padding: 10px 12px; border-radius: 0; font-weight: 600; color: #718096; @@ -136,22 +109,8 @@ margin-top: 20px; } -@media (max-width: 768px) { - .calendar-wrapper { - flex-direction: column; - padding: 16px; - } -} .calendar-info-panel { flex: 0 0 300px; border-right: 1px solid #E2E8F0; padding-right: 24px; display: flex; flex-direction: column; } -@media (max-width: 768px) { - .calendar-info-panel { - border-right: none; - border-bottom: 1px solid #E2E8F0; - padding-right: 0; - padding-bottom: 16px; - } -} .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; } @@ -179,13 +138,6 @@ .nav-buttons button:hover { background-color: #EDF2F7; } .calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; } -@media (max-width: 1200px) { - .calendar-grid { grid-template-columns: repeat(4, 1fr); } -} - -@media (max-width: 768px) { - .calendar-grid { grid-template-columns: repeat(2, 1fr); } -} .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; } @@ -232,7 +184,6 @@ color: #C53030; } - .appointment-item { display: flex; align-items: center; @@ -275,87 +226,104 @@ 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: 1fr; } /* 1 coluna em telas muito pequenas */ + .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; - border-radius: 8px; - border: none; - font-weight: 600; - font-size: 1rem; - display: flex; - align-items: center; - gap: 8px; - cursor: pointer; - transition: background 0.2s; -} -.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; - align-items: center; - margin: 15px 0 20px; - color: #fff; -} -.tabs-agenda-fila { - display: flex; - gap: 10px; -} - -.btns-gerenciamento-e-consulta { - display: flex; - gap: 10px; - flex-wrap: wrap; /* Permite quebra de linha */ -} -.container-btns-agenda-fila_esepera { - display: flex; - justify-content: space-between; - align-items: center; - margin: 0 0 8px; -} - - -.calendario-ou-filaespera { - margin-top: 0; - padding-top: 0; -} - - -.calendar-wrapper { - margin-top: 0; -} -.calendar-legend { - display: flex; - gap: 8px; - margin-top: 12px; /* afasta dos filtros acima */ +@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; + margin-bottom: 16px; + } + + table { + min-width: 600px; + font-size: 0.875rem; + } + + table th, + table td { + padding: 8px; + white-space: nowrap; } +} \ No newline at end of file