diff --git a/frontend/App.tsx b/frontend/App.tsx index 5fd88c0..8bc3d10 100644 --- a/frontend/App.tsx +++ b/frontend/App.tsx @@ -130,7 +130,7 @@ const App: React.FC = () => { const permissions: Record = { paciente: ['tratamentos', 'notificacoes', 'configuracoes'], - dentista: ['dashboard', 'pacientes', 'agenda', 'ortodontia', 'tratamentos', 'notificacoes', 'clinicas', 'configuracoes', 'contratos'], + dentista: ['dashboard', 'pacientes', 'agenda', 'ortodontia', 'tratamentos', 'lancar-gto', 'notificacoes', 'clinicas', 'configuracoes', 'contratos'], funcionario: ['dashboard', 'leads', 'pacientes', 'agenda', 'financeiro', 'tratamentos', 'lancar-gto', 'relatorios', 'notificacoes', 'clinicas', 'configuracoes', 'contratos'], }; @@ -218,7 +218,7 @@ const App: React.FC = () => { case 'leads': return ; case 'public': return ; case 'pacientes': return ; - case 'agenda': return ; + case 'agenda': return ; case 'ortodontia': return ; case 'financeiro': return ; case 'dentistas': return ; diff --git a/frontend/views/AgendaView.tsx b/frontend/views/AgendaView.tsx index fcd6076..74590ce 100644 --- a/frontend/views/AgendaView.tsx +++ b/frontend/views/AgendaView.tsx @@ -8,6 +8,7 @@ import { AgendaSettingsModal } from '../components/AgendaSettingsModal.tsx'; import { DragDropContext, Droppable, Draggable } from '@hello-pangea/dnd'; import { HybridBackend } from '../services/backend.ts'; import { Dentista, Agendamento, Paciente, DentistaHorario } from '../types.ts'; +import { useGTOStore } from './LancarGTO.tsx'; import { useHybridBackend } from '../hooks/useHybridBackend.ts'; import { useToast } from '../contexts/ToastContext.tsx'; import { PageHeader } from '../components/PageHeader.tsx'; @@ -263,7 +264,7 @@ const AppointmentModal: React.FC<{ ); }; -export const AgendaView: React.FC = () => { +export const AgendaView: React.FC<{ onNavigate?: (view: string) => void }> = ({ onNavigate }) => { const { data: agendamentos, refresh } = useHybridBackend(HybridBackend.getAgendamentos); const { data: dentists, refresh: refreshDentists } = useHybridBackend(HybridBackend.getDentistas); const { data: googleEvents, refresh: refreshGoogle } = useHybridBackend(HybridBackend.getGoogleEvents); @@ -373,6 +374,14 @@ export const AgendaView: React.FC = () => { const currentRole = HybridBackend.getCurrentRole(); const currentUserEmail = HybridBackend.getCurrentUser(); + const gtoStore = useGTOStore(); + + const handleAtender = () => { + if (!selectedAppointment || !onNavigate) return; + gtoStore.setPendingSearch(selectedAppointment.pacienteNome); + setShowDetails(false); + onNavigate('lancar-gto'); + }; const filteredDentists = dentists?.filter(d => { if (currentRole === 'admin' || currentRole === 'donoclinica' || currentRole === 'funcionario') return true; @@ -537,8 +546,16 @@ export const AgendaView: React.FC = () => { - {/* Footer: Reagendar */} + {/* Footer: Ações */}
+ {onNavigate && currentRole !== 'paciente' && ( + + )} +
+ ) : ( + + )} {/* STEP 2: ESPECIALIDADE & PROCEDIMENTO */} @@ -529,6 +573,62 @@ export const LancarGTO: React.FC = () => { + + {/* MODAL DE BUSCA DE PACIENTE */} + {patientSearchOpen && ( +
+
+
+

+ BUSCAR PACIENTE +

+ +
+
+ setPatientSearchTerm(e.target.value.toUpperCase())} + placeholder="NOME OU CPF..." + className="w-full p-4 bg-gray-50 border-2 border-gray-100 rounded-2xl font-black text-gray-800 text-sm focus:border-blue-500 outline-none transition-all uppercase" + /> +
+ {filteredPatients.length === 0 ? ( +
+ {patientSearchTerm ? 'NENHUM PACIENTE ENCONTRADO' : 'CARREGANDO...'} +
+ ) : ( + filteredPatients.map(p => ( + + )) + )} +
+
+
+
+ )} ); };