var h=(s,o,t)=>new Promise((i,n)=>{var x=r=>{try{l(t.next(r))}catch(a){n(a)}},c=r=>{try{l(t.throw(r))}catch(a){n(a)}},l=r=>r.done?i(r.value):Promise.resolve(r.value).then(x,c);l((t=t.apply(s,o)).next())});import{j as e}from"./radixui-DBNNXUn7.js";import{r as p,L as u}from"./router-ZPDjRWWZ.js";import{M as f}from"./master-pagination-component-CxDfFOcS.js";import{u as g}from"./useQuery-tXf2Qa8J.js";import{e as N}from"./settings-services-C1WB00Jx.js";import{C as b}from"./pagination-CCE7qJl8.js";import{D as w,f as C,B as v,G as y,g as M,h as P,i as D,j as T}from"./index-C1-9bQes.js";import{B as E}from"./badge-BMZJ96FB.js";import{C as R,a as A}from"./card-BaxfxC-x.js";import{T as B,a as I,b as j,c as d,d as q,e as m}from"./table-Be5yzNoc.js";import"./vendor-C0DUGSOM.js";import"./icons-DvPHMWAM.js";import"./utils-CbOYy0fT.js";const G=()=>{const{isPending:s,data:o,isError:t,error:i}=g({queryKey:["getRoles"],queryFn:()=>h(null,null,function*(){const n=yield N();if(n.status==200)return n.data.data;throw new Error("Error fetching")})});return{isPending:s,roles:o,isError:t,error:i}};function Y(){const{roles:s}=G(),[o,t]=p.useState(1),i=10,n=(o-1)*i,x=n+i,c=(s==null?void 0:s.slice(n,x))||[],l=(s==null?void 0:s.length)||0,r=a=>{t(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:c==null?void 0:c.map(a=>e.jsxs(j,{children:[e.jsx(m,{className:"text-center",children:e.jsx("div",{children:a.id})}),e.jsx(m,{children:e.jsx("div",{children:a.name})}),e.jsx(m,{className:"text-center",children:e.jsx("div",{children:e.jsx(E,{variant:"success-soft",children:"Active"})})}),e.jsx(m,{className:"text-center",children:e.jsxs(w,{children:[e.jsx(C,{asChild:!0,children:e.jsx(v,{size:"sm",variant:"outline",children:e.jsx(y,{})})}),e.jsxs(M,{children:[e.jsx(P,{children:"Acciones"}),e.jsx(D,{}),e.jsx(T,{children:e.jsxs(u,{to:"permissions/"+a.name,className:"flex",children:[e.jsx(b,{className:"mr-2 h-4 w-4"}),e.jsx("span",{children:"Modificar"})]})})]})]})})]},a.id))})]})})}),e.jsx(f,{currentPage:o,totalItems:l,itemsPerPage:i,onPageChange:r})]})}export{Y as default};
