1import{r as t,s as u,D as _,j as n}from"./index-DWPX63hm.js";import{C as g,m as x,h as c}from"./react-big-calendar-B1NNlvI9.js";import"./isPlainObject-xYXOwzOy.js";c.locale("es");const b=x(c);function C(){const[i,d]=t.useState([]),[m,f]=t.useState(!0);t.useEffect(()=>{p()},[]);const p=async()=>{try{const{data:o,error:e}=await u.from("horarios_modulos").select(` 2 *, 3 modulo:modulos( 4 id, 5 nombre, 6 codigo, 7 materia:materias( 8 id, 9 nombre, 10 grado:grados( 11 id, 12 nombre 13 ) 14 ) 15 ), 16 profesor:profesores( 17 nombre, 18 profile:profiles(first_name, last_name) 19 ) 20 `).order("created_at",{ascending:!1});if(e)throw e;const a=(o==null?void 0:o.map(r=>{var s;return{id:r.id,fecha:r.fecha,hora_inicio:r.hora_inicio,hora_fin:r.hora_fin,modulo:r.modulo,profesor:(s=r.profesor)!=null&&s.profile?{nombre:r.profesor.profile.first_name,apellido:r.profesor.profile.last_name}:null,teams_meeting_link:r.teams_meeting_link,jitsi_room_name:r.jitsi_room_name}}))||[];d(a),a.length>0&&f(!1)}catch(o){console.error("Error al cargar horarios:",o),_.error("Error al cargar los horarios")}};if(i.length===0||m)return n.jsx("div",{className:"container mx-auto p-6",children:"Cargando..."});const h=i.map(o=>{var e,a,r,s,l;return{id:o.id,title:`${(a=(e=o.modulo)==null?void 0:e.materia)==null?void 0:a.nombre} (${(r=o.modulo)==null?void 0:r.codigo})-(${(s=o.profesor)==null?void 0:s.nombre} ${(l=o.profesor)==null?void 0:l.apellido})`,start:new Date(`${o.fecha}T${o.hora_inicio}`),end:new Date(`${o.fecha}T${o.hora_fin}`)}});return n.jsxs("div",{className:"container mx-auto p-6",children:[n.jsx("h1",{className:"text-2xl font-bold mb-4",children:"Calendario de Horarios"}),n.jsx("div",{style:{height:500},children:n.jsx(g,{localizer:b,events:h,startAccessor:"start",endAccessor:"end",defaultView:"week",style:{height:"100%"}})})]})}export{C as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.