PageSourceSearch

https://schoolface.cl/build/assets/CourseGroups-lw11jvE9.js

js schoolface.cl collected 2026-09-24 14:36:34 UTC 8,103 bytes, 1 lines download raw bytes

1import{j as N,i as u,A as G,o as a,c as l,a as t,e as R,w as $,f as B,b as A,d as c,F as h,E as k,k as E,l as P,v as S,t as n,s as T,B as v,r as D,G as _,y as F,n as J}from"./app-C0MJ8J0X.js";/* empty css            */const U={class:"space-y-4 sm:space-y-6"},H={class:"flex items-center justify-between"},O={class:"flex items-center gap-2 sm:gap-3"},K={key:0,class:"flex justify-center py-12"},Q={key:1,class:"space-y-3"},W={class:"flex items-center gap-3 mb-3"},X={class:"text-xl font-bold"},Y={class:"flex-1 min-w-0"},Z={class:"font-semibold text-gray-900 truncate"},ee={class:"text-xs text-gray-600 mt-0.5"},te={class:"font-medium"},se={class:"flex gap-2"},oe=["onClick","disabled"],ae=["onClick","disabled"],le={key:2,class:"card-schoolface p-8 text-center"},re={key:3,class:"space-y-3"},ne={key:0,class:"text-sm font-semibold text-gray-700 uppercase tracking-wide"},ie={class:"text-xl font-bold"},de={class:"flex-1 min-w-0"},ue={class:"flex items-center gap-2"},ce={class:"font-semibold text-gray-900 truncate"},pe={key:0,class:"text-xs bg-purple-100 text-purple-700 px-2 py-0.5 rounded-full"},me={class:"text-xs text-gray-500 mt-0.5"},fe={class:"bg-white rounded-2xl max-w-md w-full p-6"},ve={class:"space-y-3"},xe={class:"flex gap-2 flex-wrap"},ge=["onClick"],be={class:"flex gap-2 mt-6"},ye=["disabled"],we={__name:"CourseGroups",setup(he){const q=T(),m=N(()=>q.params.id),x=u([]),w=u([]),p=u(!0),f=u(!1),g=u(!1),i=u(null),d=u({name:"",color:"#8b5cf6"}),I=["#8b5cf6","#ec4899","#f59e0b","#10b981","#3b82f6","#ef4444","#14b8a6","#a855f7"],b=N(()=>w.value.filter(o=>{var e;return((e=o.group)==null?void 0:e.course_id)===m.value}));async function y(){p.value=!0;try{const[o,e]=await Promise.all([v.get(`/courses/${m.value}/groups`),v.get("/group-invitations").catch(()=>({data:{data:[]}}))]);x.value=o.data.data||[],w.value=e.data.data||[]}catch{alert("No se pudieron cargar los grupos")}finally{p.value=!1}}async function V(o){var e,r;i.value=o.id;try{await v.post(`/group-invitations/${o.id}/accept`),await y()}catch(s){alert(((r=(e=s.response)==null?void 0:e.data)==null?void 0:r.message)||"No se pudo aceptar")}finally{i.value=null}}async function z(o){var e,r;i.value=o.id;try{await v.post(`/group-invitations/${o.id}/decline`),await y()}catch(s){alert(((r=(e=s.response)==null?void 0:e.data)==null?void 0:r.message)||"No se pudo rechazar")}finally{i.value=null}}function C(){d.value={name:"",color:"#8b5cf6"},f.value=!0}async function L(){var o,e;g.value=!0;try{await v.post(`/courses/${m.value}/groups`,d.value),f.value=!1,await y()}catch(r){alert(((e=(o=r.response)==null?void 0:o.data)==null?void 0:e.message)||"No se pudo crear el grupo")}finally{g.value=!1}}function j(o){return o.split(/\s+/).map(e=>e[0]).join("").slice(0,2).toUpperCase()}return G(y),(o,e)=>{const r=D("router-link");return a(),l("div",U,[t("div",H,[t("div",O,[R(r,{to:{name:"course-dashboard",params:{id:m.value}},class:"text-gray-500 hover:text-gray-700 p-1 -ml-1"},{default:$(()=>[...e[3]||(e[3]=[t("svg",{class:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 19l-7-7 7-7"})],-1)])]),_:1},8,["to"]),e[4]||(e[4]=t("h1",{class:"text-lg sm:text-2xl font-bold text-gray-900"},"Mis Grupos",-1))]),t("button",{onClick:C,class:"btn-schoolface text-sm flex items-center gap-1.5"},[...e[5]||(e[5]=[t("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 4v16m8-8H4"})],-1),B(" Crear grupo ",-1)])])]),e[16]||(e[16]=A('<div class="card-schoolface bg-purple-50 border-purple-200"><div class="flex items-start gap-3"><span class="text-2xl">👥</span><div><p class="text-sm text-purple-800"> Los grupos son subconjuntos privados dentro del curso para coordinar aparte (ej: &quot;Los Juanitos&quot;, &quot;Papás del equipo de fútbol&quot;). </p><p class="text-xs text-purple-600 mt-1"> Los eventos que agendes al grupo solo llegan a sus miembros. Puedes crear hasta 5 grupos por curso. </p></div></div></div>',1)),p.value?(a(),l("div",K,[...e[6]||(e[6]=[t("div",{class:"animate-spin rounded-full h-8 w-8 border-b-2 border-indigo-600"},null,-1)])])):c("",!0),!p.value&&b.value.length>0?(a(),l("div",Q,[e[8]||(e[8]=t("h2",{class:"text-sm font-semibold text-gray-700 uppercase tracking-wide"},"Invitaciones pendientes",-1)),(a(!0),l(h,null,k(b.value,s=>(a(),l("div",{key:s.id,class:"card-schoolface p-4 border-2 border-purple-200 bg-purple-50"},[t("div",W,[t("div",{class:"w-12 h-12 rounded-full flex items-center justify-center flex-shrink-0",style:_({background:s.group.color+"33",color:s.group.color})},[t("span",X,n(j(s.group.name)),1)],4),t("div",Y,[t("p",Z,n(s.group.name),1),t("p",ee,[e[7]||(e[7]=B(" Te invito ",-1)),t("span",te,n(s.invited_by.name),1)])])]),t("div",se,[t("button",{onClick:M=>z(s),disabled:i.value===s.id,class:"flex-1 px-3 py-2 border border-gray-300 rounded-lg text-gray-700 text-sm font-medium hover:bg-gray-50 disabled:opacity-50"}," Rechazar ",8,oe),t("button",{onClick:M=>V(s),disabled:i.value===s.id,class:"flex-1 btn-schoolface text-sm disabled:opacity-50"},n(i.value===s.id?"...":"Aceptar"),9,ae)])]))),128))])):c("",!0),!p.value&&x.value.length===0&&b.value.length===0?(a(),l("div",le,[e[9]||(e[9]=t("div",{class:"w-16 h-16 mx-auto rounded-full bg-purple-100 flex items-center justify-center mb-4"},[t("span",{class:"text-3xl"},"👥")],-1)),e[10]||(e[10]=t("h3",{class:"text-base font-semibold text-gray-900 mb-2"},"Aun no perteneces a ningun grupo",-1)),e[11]||(e[11]=t("p",{class:"text-sm text-gray-500 mb-4"},"Crea uno o pide que te inviten a uno existente",-1)),t("button",{onClick:C,class:"btn-schoolface text-sm"},"Crear mi primer grupo")])):c("",!0),!p.value&&x.value.length>0?(a(),l("div",re,[b.value.length>0?(a(),l("h2",ne,"Mis grupos")):c("",!0),(a(!0),l(h,null,k(x.value,s=>(a(),F(r,{key:s.id,to:{name:"course-group-detail",params:{id:m.value,groupId:s.id}},class:"card-schoolface p-4 flex items-center gap-3 hover:shadow-md transition"},{default:$(()=>[t("div",{class:"w-12 h-12 rounded-full flex items-center justify-center flex-shrink-0",style:_({background:s.
1color+"22",color:s.color})},[t("span",ie,n(j(s.name)),1)],4),t("div",de,[t("div",ue,[t("h3",ce,n(s.name),1),s.is_owner?(a(),l("span",pe,"Creador")):c("",!0)]),t("p",me,n(s.members_count)+" "+n(s.members_count===1?"miembro":"miembros"),1)]),e[12]||(e[12]=t("svg",{class:"w-5 h-5 text-gray-300 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 5l7 7-7 7"})],-1))]),_:2},1032,["to"]))),128))])):c("",!0),f.value?(a(),l("div",{key:4,class:"fixed inset-0 bg-black bg-opacity-50 flex items-end sm:items-center justify-center z-50 p-4",onClick:e[2]||(e[2]=E(s=>f.value=!1,["self"]))},[t("div",fe,[e[15]||(e[15]=t("h2",{class:"text-lg font-bold mb-4"},"Crear grupo",-1)),t("div",ve,[t("div",null,[e[13]||(e[13]=t("label",{class:"block text-sm font-medium text-gray-700 mb-1"},"Nombre",-1)),P(t("input",{"onUpdate:modelValue":e[0]||(e[0]=s=>d.value.name=s),type:"text",maxlength:"60",placeholder:"Ej: Los Juanitos",class:"w-full border border-gray-300 rounded-lg px-3 py-2 focus:ring-2 focus:ring-purple-500 focus:border-purple-500"},null,512),[[S,d.value.name]])]),t("div",null,[e[14]||(e[14]=t("label",{class:"block text-sm font-medium text-gray-700 mb-1"},"Color",-1)),t("div",xe,[(a(),l(h,null,k(I,s=>t("button",{key:s,type:"button",onClick:M=>d.value.color=s,class:J(["w-9 h-9 rounded-full border-2 transition",d.value.color===s?"border-gray-900 scale-110":"border-transparent"]),style:_({background:s})},null,14,ge)),64))])])]),t("div",be,[t("button",{onClick:e[1]||(e[1]=s=>f.value=!1),class:"flex-1 px-4 py-2 border border-gray-300 rounded-lg text-gray-700 font-medium hover:bg-gray-50"},"Cancelar"),t("button",{onClick:L,disabled:!d.value.name.trim()||g.value,class:"flex-1 btn-schoolface disabled:opacity-50"},n(g.value?"Creando...":"Crear"),9,ye)])])])):c("",!0)])}}};export{we 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.