From fea4918494327bd5174fd9b918eb1a7e1be54779 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Consultor=C3=ADa=20Alcaraz=20Salazar?= Date: Mon, 31 Aug 2026 05:19:13 +0000 Subject: [PATCH] Staff: campo tipo Doctor/Cosmetologa, filtro por tipo en agenda y selector editable en modulo Medicos --- frontend/src/pages/Agenda.tsx | 33 +++++++++++++++++-- frontend/src/pages/Configuracion.tsx | 6 +++- frontend/src/pages/Medicos.tsx | 31 ++++++++++++++++- frontend/src/services/odoo.ts | 3 +- .../skeen_pacientes/models/hr_employee.py | 7 ++++ .../skeen_whatsapp/controllers/frontend.py | 6 ++++ 6 files changed, 80 insertions(+), 6 deletions(-) diff --git a/frontend/src/pages/Agenda.tsx b/frontend/src/pages/Agenda.tsx index 6eeea9b..5ace19a 100644 --- a/frontend/src/pages/Agenda.tsx +++ b/frontend/src/pages/Agenda.tsx @@ -58,6 +58,7 @@ const Agenda: FC = () => { const [date, setDate] = useState(() => searchParams.get('date') || new Date().toISOString().split('T')[0]); const [stateFilter, setStateFilter] = useState(''); const [doctorFilter, setDoctorFilter] = useState(() => (medicoEmployeeId ? String(medicoEmployeeId) : '')); + const [staffTypeFilter, setStaffTypeFilter] = useState<'' | 'doctor' | 'cosmetologa'>(''); const [viewMode, setViewMode] = useState<'lista' | 'doctores' | 'horas'>('doctores'); const [quickFilter, setQuickFilter] = useState<'' | 'libres' | 'primera' | 'checkin' | 'noshow' | 'porconfirmar'>(''); const [detailApt, setDetailApt] = useState(null); @@ -228,9 +229,14 @@ const Agenda: FC = () => { (_, i) => GRID_START + i / SLOTS_PER_HOUR ); + // Filtro por tipo de staff: las pills y las columnas del grid usan esta lista + const typedDoctors = doctors.filter( + (d) => !staffTypeFilter || (d.staff_type ?? 'doctor') === staffTypeFilter + ); + const gridDoctors = doctorFilter - ? doctors.filter((d) => String(d.id) === doctorFilter) - : doctors; + ? typedDoctors.filter((d) => String(d.id) === doctorFilter) + : typedDoctors; const hasUnassigned = !doctorFilter && gridAppointments.some((a) => !a.doctor_id); const gridColumns: { key: string; label: string; subtitle: string; doctorId: number | null }[] = [ ...gridDoctors.map((d) => ({ key: `d-${d.id}`, label: d.name, subtitle: d.job_title || '', doctorId: d.id })), @@ -873,6 +879,27 @@ const Agenda: FC = () => { ) ) : (
+ {/* Selector de tipo de staff */} +
+ {([ + { key: '', label: 'Todos' }, + { key: 'doctor', label: 'Doctores' }, + { key: 'cosmetologa', label: 'Cosmetólogas' }, + ] as const).map((t) => ( + + ))} +
- {doctors.map((d) => { + {typedDoctors.map((d) => { const active = doctorFilter === String(d.id); return (