var h=(s,i,n)=>new Promise((c,t)=>{var m=r=>{try{o(n.next(r))}catch(a){t(a)}},l=r=>{try{o(n.throw(r))}catch(a){t(a)}},o=r=>r.done?c(r.value):Promise.resolve(r.value).then(m,l);o((n=n.apply(s,i)).next())});import{r as u,j as e,D as p,f,B as g,g as N,h as b,i as w,k as C,l as v,L as y}from"./index-C7Y5J1TO.js";import{M}from"./master-pagination-component-BErGcWEw.js";import{u as P}from"./useQuery-DGaD2i6Y.js";import{e as D}from"./settings-services-CMNk-eHJ.js";import{C as T}from"./pagination-DcGqVpvk.js";import{B as E}from"./badge-DLmsfCsp.js";import{C as R,a as A}from"./card-DDrJ6Iia.js";import{T as B,a as I,b as j,c as d,d as q,e as x}from"./table-DmBfZH6x.js";const L=()=>{const{isPending:s,data:i,isError:n,error:c}=P({queryKey:["getRoles"],queryFn:()=>h(null,null,function*(){const t=yield D();if(t.status==200)return t.data.data;throw new Error("Error fetching")})});return{isPending:s,roles:i,isError:n,error:c}};function O(){const{roles:s}=L(),[i,n]=u.useState(1),c=10,t=(i-1)*c,m=t+c,l=(s==null?void 0:s.slice(t,m))||[],o=(s==null?void 0:s.length)||0,r=a=>{n(a)};return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex justify-between",children:e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"text-primary text-3xl font-bold",children:"Administrar de roles"}),e.jsx("small",{className:"text-muted-foreground",children:"Aquí podrás administrar los roles que tendrán acceso a la app camsoda"})]})}),e.jsx(R,{className:"bg-thertiary/70 p-2 xl:col-span-2",children:e.jsx(A,{className:"p-0",children:e.jsxs(B,{className:"overflow-hidden rounded-md",children:[e.jsx(I,{className:"border-thertiary bg-accent h-12 border-b-4",children:e.jsxs(j,{className:"hover:bg-white",children:[e.jsx(d,{className:"w-16 text-center",children:"# ID"}),e.jsx(d,{className:"w-[80%]",children:"Role"}),e.jsx(d,{className:"text-center",children:"Estado"}),e.jsx(d,{className:"text-center",children:"Acciones"})]})}),e.jsx(q,{children:l==null?void 0:l.map(a=>e.jsxs(j,{children:[e.jsx(x,{className:"text-center",children:e.jsx("div",{children:a.id})}),e.jsx(x,{children:e.jsx("div",{children:a.name})}),e.jsx(x,{className:"text-center",children:e.jsx("div",{children:e.jsx(E,{variant:"success-soft",children:"Active"})})}),e.jsx(x,{className:"text-center",children:e.jsxs(p,{children:[e.jsx(f,{asChild:!0,children:e.jsx(g,{size:"sm",variant:"outline",children:e.jsx(N,{})})}),e.jsxs(b,{children:[e.jsx(w,{children:"Acciones"}),e.jsx(C,{}),e.jsx(v,{children:e.jsxs(y,{to:"permissions/"+a.name,className:"flex",children:[e.jsx(T,{className:"mr-2 h-4 w-4"}),e.jsx("span",{children:"Modificar"})]})})]})]})})]},a.id))})]})})}),e.jsx(M,{currentPage:i,totalItems:o,itemsPerPage:c,onPageChange:r})]})}export{O as default};
