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 (