1import{A as H}from"./AuthenticatedLayout-DcpqZk2r.js";import{i as j,Z as z,r as a,f as h,a as n,w as m,b as s,e as C,o as c,F as x,j as T,n as w,t as f,c as O,g as y,T as k}from"./app-B9KORyBa.js";import{P as Z}from"./PrimaryButton-vaEit9c1.js";import{_ as q}from"./CheckmarkCircleOutline-D-9-1wJh.js";import{_ as G,a as J,b as K,c as Q}from"./EyeOutline-BJItCWaF.js";import{_ as R}from"./Modal-Bzvoe6wK.js";import{_ as W}from"./ArrowUpOutline-BhcV9wP_.js";import{_ as X}from"./ArrowDownOutline-DJK0Og38.js";import{_ as Y}from"./ChevronDownOutline-DkbFw82G.js";import{_ as I}from"./_plugin-vue_export-helper-DlAUqK2U.js";import"./ApplicationLogo-DrAX-EpC.js";import"./NavLink-BiVKPBr8.js";import"./TextOutline-CGLkonHp.js";import"./DocumentTextOutline-B7A647Cs.js";import"./InformationCircleOutline-DCl6slX2.js";const $={components:{ChevronDownOutline:Y,ArrowDownOutline:X,ArrowUpOutline:W,Modal:R,EyeOutline:Q,TrashOutline:K,EditOutline:J,CloseCircleOutline:G,CheckmarkCircleOutline:q,PrimaryButton:Z,AuthenticatedLayout:H,Head:z,Link:j},props:{categories:{type:Object,default:[]}},data(){return{showCategoryContent:[],orderChanged:!1,itemOrderChanged:!1,showDeleteModal:!1,deleteModal:{type:null,name:null,id:null},categoryOrderForm:k({changes:[]}),itemOrderForm:k({changes:[]})}},methods:{moveCategoryUp(t){const e=this.categories[t],r=t,l=t-1;this.categories[r].order=e.order+1,this.categories[l].order=e.order-1,this.updateCategoryOrderForm(r,l),this.reorderCategoriesByOrderAsc()},moveCategoryDown(t){const e=this.categories[t],r=t,l=t+1;this.categories[r].order=e.order-1,this.categories[l].order=e.order+1,this.updateCategoryOrderForm(r,l),this.reorderCategoriesByOrderAsc()},updateCategoryOrderForm(t,e){const r=this.categories[t],l=this.categories[e];this.categoryOrderForm.changes=this.categoryOrderForm.changes.filter(i=>i.id!==r.id&&i.id!==l.id),this.categoryOrderForm.changes.push({id:r.id,order:r.order},{id:l.id,order:l.order})},reorderCategoriesByOrderAsc(){this.categories.sort((t,e)=>e.order-t.order),this.orderChanged=!0},submitCategoryChangeForm(){this.categoryOrderForm.post(route("admin.categories.order",{type:"students"}),{preserveState:"errors"})},moveItemUp(t,e,r){if(!r)return;const l=this.categories[t].students[e],i=e,o=e-1;this.categories[t].students[i].pivot.order=l.pivot.order-1,this.categories[t].students[o].pivot.order=l.pivot.order+1,this.updateItemOrderForm(t,i,o),this.reorderItemsByOrderAsc(t)},moveItemDown(t,e,r){if(!r)return;const l=this.categories[t].students[e],i=e,o=e+1;this.categories[t].students[i].pivot.order=l.pivot.order+1,this.categories[t].students[o].pivot.order=l.pivot.order-1,this.updateItemOrderForm(t,i,o),this.reorderItemsByOrderAsc(t)},updateItemOrderForm(t,e,r){const l=this.categories[t],i=this.categories[t].students[e],o=this.categories[t].students[r];this.itemOrderForm.changes=this.itemOrderForm.changes.filter(_=>!(_.id===i.id&&_.categoryIndex===t)&&!(_.id===o.id&&_.categoryIndex===t)),this.itemOrderForm.changes.push({id:i.id,categoryIndex:t,categoryId:l.id,order:i.pivot.order},{id:o.id,categoryIndex:t,categoryId:l.id,order:o.pivot.order})},reorderItemsByOrderAsc(t){this.categories[t].students.sort((e,r)=>e.pivot.order-r.pivot.order),this.itemOrderChanged=!0},submitItemChangeForm(){this.itemOrderForm.post(route("admin.posts.order",{type:"students"}),{preserveState:"errors"})},showCategoriesContentToggle(t){const e=this.showCategoryContent.indexOf(t);e>-1?this.showCategoryContent.splice(e,1):this.showCategoryContent.push(t)},openDeleteModal(t,e,r){this.deleteModal={type:t,name:e,id:r},this.showDeleteModal=!0},closeDeleteModal(){this.showDeleteModal=!1,this.deleteModal={type:null,name:null,id:null}},destroyCategory(t){k({}).delete(route("admin.categories.destroy",{category:t,type:"students"}),{preserveState:!1})},destroy(t){k({}).delete(route("admin.students.destroy",{student:t}),{preserveState:!1})}}},ee={class:"flex"},te={class:"flex space-x-2"},se={class:"py-12 space-y-5"},oe={class:"flex"},re={class:"bg-white overflow-hidden shadow-sm sm:rounded-lg p-4 space-y-12"},ie={class:"flex border-b-2 px-4 py-5 bg-gray-100"},le=["onClick"],ne=["onClick"],de={class:"font-semibold"},ae={class:"flex space-x-2"},ce={class:"flex space-x-1"},ue=["onClick"],me={key:0},pe={class:"border-b-2"},he={class:"col-span-1 xl:col-span-1"},ge={key:0},_e={key:1},ve={class:"col-span-2 xl:col-span-2"},Ce={class:"col-span-7 xl:col-span-7"},fe={class:"col-span-2 text-right flex"},ye={class:"flex space-x-2"},we={class:"flex space-x-1"},Oe=["onClick"],ke={class:"flex w-full p-4 border-b-2"},be={key:1},xe={class:"space-y-5"},De={class:"p-4 space-y-5"},Fe={class:"text-gray-700"},Me={class:"flex space-x-4"};function Ae(t,e,r,l,i,o){const _=a("Head"),b=a("PrimaryButton"),v=a("Link"),E=a("ChevronDownOutline"),D=a("ArrowUpOutline"),F=a("ArrowDownOutline"),M=a("EditOutline"),A=a("TrashOutline"),L=a("CheckmarkCircleOutline"),U=a("CloseCircleOutline"),N=a("EyeOutline"),P=a("Modal"),V=a("AuthenticatedLayout");return c(),h(x,null,[n(_,{title:"Students"}),n(V,null,{header:m(()=>[s("div",ee,[e[4]||(e[4]=s("h2",{class:"font-semibold text-xl text-gray-800 leading-tight"},"Students",-1)),e[5]||(e[5]=s("div",{class:"flex-grow"},null,-1)),s("div",te,[i.orderChanged?(c(),O(b,{key:0,onClick:o.submitCategoryChangeForm},{default:m(()=>[...e[2]||(e[2]=[C("Save categories order",-1)])]),_:1},8,["onClick"])):y("",!0),i.itemOrderChanged?(c(),O(b,{key:1,onClick:o.submitItemChangeForm},{default:m(()=>[...e[3]||(e[3]=[C("Save posts order",-1)])]),_:1},8,["onClick"])):y("",!0)])])]),default:m(()=>[s("div",se,[s("div",oe,[e[7]||(e[7]=s("div",{class:"flex-grow"},null,-1)),n(v,{href:t.route("admin.categories.create",{type:"students"})},{default:m(()=>[n(b,null,{default:m(()=>[...e[6]||(e[6]=[C("Add Category",-1)])]),_:1})]),_:1},8,["href"])]),s("div",re,[r.categories.length?(c(!0),h(x,{key:0},T(r.categories,(d,p)=>{var B;return c(),h("div",null,[s("div",ie,[s("div",{class:"mr-4",onClick:u=>o.showCategoriesContentToggle(p)},[n(E,{class:w(["w-6 transition-all duration-300",{"rotate-180":i.showCategoryContent.includes(p)}])},null,8,["class"])],8,le),s("div",{class:"flex-grow",onClick:u=>o.showCategoriesContentToggle(p)}
1,[s("span",de,f(d.name.lv),1)],8,ne),s("div",ae,[s("div",ce,[p>0?(c(),O(D,{key:0,class:"w-5 cursor-pointer",onClick:u=>o.moveCategoryUp(p)},null,8,["onClick"])):y("",!0),p<r.categories.length-1?(c(),O(F,{key:1,class:"w-5 cursor-pointer",onClick:u=>o.moveCategoryDown(p)},null,8,["onClick"])):y("",!0)]),n(v,{class:"cursor-pointer my-auto",href:t.route("admin.categories.edit",{category:d.id,type:"students"})},{default:m(()=>[n(M,{class:"w-6"})]),_:1},8,["href"]),s("div",{class:"cursor-pointer my-auto",onClick:u=>o.openDeleteModal("category",d.name.lv,d.id)},[n(A,{class:"w-6 fill-red-600 text-red-600"})],8,ue)])]),s("div",null,[(B=d.students)!=null&&B.length&&i.showCategoryContent.includes(p)?(c(),h("div",me,[e[9]||(e[9]=s("div",{class:"grid grid-cols-12 p-4 border-b-2"},[s("div",{class:"col-span-1 xl:col-span-1"},"Active"),s("div",{class:"col-span-2 xl:col-span-2"},"Student PID"),s("div",{class:"col-span-7 xl:col-span-7"},"Name"),s("div",{class:"col-span-2 text-right"},"Actions")],-1)),s("div",pe,[(c(!0),h(x,null,T(d.students,(u,g)=>(c(),h("div",{class:w(["py-2 px-4 grid grid-cols-12",{"border-b-2":d.students.length!==g+1}])},[s("div",he,[u.published?(c(),h("div",ge,[n(L,{class:"w-6 text-green-600"})])):(c(),h("div",_e,[n(U,{class:"w-6 text-red-600"})]))]),s("div",ve,f(u.student_pid),1),s("div",Ce,f(u.name.lv),1),s("div",fe,[e[8]||(e[8]=s("div",{class:"flex-grow"},null,-1)),s("div",ye,[s("div",we,[n(D,{class:w(["w-5",g>0?"cursor-pointer":"cursor-not-allowed text-gray-300"]),onClick:S=>o.moveItemUp(p,g,g>0)},null,8,["class","onClick"]),n(F,{class:w(["w-5",g<d.students.length-1?"cursor-pointer":"cursor-not-allowed text-gray-300"]),onClick:S=>o.moveItemDown(p,g,g<d.students.length-1)},null,8,["class","onClick"])]),n(v,{class:"cursor-pointer my-auto",href:t.route("admin.students.show",{student:u.id})},{default:m(()=>[n(N,{class:"w-6"})]),_:1},8,["href"]),n(v,{class:"cursor-pointer my-auto",href:t.route("admin.students.edit",{student:u.id})},{default:m(()=>[n(M,{class:"w-6"})]),_:1},8,["href"]),s("div",{class:"cursor-pointer my-auto",onClick:S=>o.openDeleteModal("post",u.name.lv,u.id)},[n(A,{class:"w-6 fill-red-600 text-red-600"})],8,Oe)])])],2))),256))])])):y("",!0),s("div",ke,[n(v,{href:t.route("admin.students.create",{category:d.id}),class:"mx-auto"},{default:m(()=>[...e[10]||(e[10]=[C("Add student",-1)])]),_:1},8,["href"])])])])}),256)):(c(),h("div",be," No categories created "))])]),n(P,{show:i.showDeleteModal,onClose:o.closeDeleteModal},{default:m(()=>[s("div",xe,[e[12]||(e[12]=s("div",{class:"w-full bg-gray-200 py-2 px-4"},[s("p",{class:"text-gray-700 font-bold"},"Delete confirmation")],-1)),s("div",De,[s("h1",Fe,[C("Are you sure you want to delete "+f(i.deleteModal.type)+": ",1),s("strong",null,f(i.deleteModal.name),1)]),s("div",Me,[e[11]||(e[11]=s("div",{class:"flex-grow"},null,-1)),s("div",{class:"border border-gray-900 font-semibold text-white bg-gray-900 rounded-lg py-1 px-3 cursor-pointer",onClick:e[0]||(e[0]=(...d)=>o.closeDeleteModal&&o.closeDeleteModal(...d))},"Cancel"),s("div",{class:"border border-red-600 font-semibold text-white bg-red-600 rounded-lg py-1 px-3 cursor-pointer",onClick:e[1]||(e[1]=d=>i.deleteModal.type==="category"?o.destroyCategory(i.deleteModal.id):o.destroy(i.deleteModal.id))},"Delete")])])])]),_:1},8,["show","onClose"])]),_:1})],64)}const Je=I($,[["render",Ae]]);export{Je 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.