1import{aK as P,bh as U,aL as k,aN as _,bk as G,b7 as K,aP as W,aR as n,b5 as r,a$ as b,aT as c,aS as o,aU as a,a_ as j,aX as q,bd as O,aM as X,bc as $,be as p,bf as D,aO as Z}from"./D5V0YTTi.js";import{u as H}from"./LLoj_qSh.js";import{V as J}from"./D2WEl5kl.js";import{V as Q}from"./D0SUCtkz.js";import{V as S}from"./m1_lq_9n.js";import{V as R,b as E,a as N,c as I}from"./BrxK6o3p.js";import{V as B}from"./WNAnl_GO.js";import"./hdPqLcsX.js";import"./C69phyQL.js";import"./H25sA6Ze.js";import"./U6Vwky11.js";import"./DUGuu0ut.js";import"./BL1unfFh.js";import"./D1ZR9v46.js";import"./D4ASZpZ1.js";import"./D8QKQeYv.js";import"./CSaPBoKG.js";import"./B2eZLTPJ.js";import"./wHSkpj89.js";import"./C-nqkqy0.js";import"./Dpfl30kC.js";import"./BBRCaXK2.js";import"./H696g9Ma.js";import"./BWAD52SL.js";import"./Bu6g2SmM.js";import"./k6Wkf0fY.js";import"./C6yTmTy7.js";import"./BKUWlEyO.js";(function(){try{var m=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},s=new m.Error().stack;s&&(m._sentryDebugIds=m._sentryDebugIds||{},m._sentryDebugIds[s]="88d9e850-ffdc-4b53-93ad-ac438873cac7",m._sentryDebugIdIdentifier="sentry-dbid-88d9e850-ffdc-4b53-93ad-ac438873cac7")}catch{}})();const Y={class:"flex flex-col"},ee={class:"d-flex flex-lg-row flex-column items-center ga-2 mb-8"},oe={class:"d-flex align-center justify-start ga-4"},le={class:"font-bold mb-0"},ae={class:"actions d-none d-md-flex align-center ga-2"},se={class:"actions d-flex flex-column d-md-none align-center ga-2 pt-2"},te={class:"d-flex ga-2"},Be=P({__name:"index",async setup(m){let s,f;U();const i=([s,f]=k(()=>X()),s=await s,f(),s).GUESTSThemeColors,y=_(i==null?void 0:i.MainColor);_(i==null?void 0:i.SecondColor);const z=_(i==null?void 0:i.ThirdColor);_("#AF441B");const{snackError:v,snackSuccess:A}=H(),{data:F}=([s,f]=k(()=>$("/api/admin/users/employee","$3PBLxrqUbd")),s=await s,f(),s),{data:V}=([s,f]=k(()=>$("/api/admin/users/employee/count","$GIp3f_Zu2M")),s=await s,f(),s),C=G(F.value.map(u=>({_id:u._id,name:u.userName,role:u.role}))),L=[{title:"Name",key:"name"},{title:"Actions",key:"actions"}],M=K(()=>C),x=_(""),h=U(),w=u=>{h.push(`/dashboard/Users/${u}`)};async function T(u,e){try{const d=await $fetch(u,{method:"put"});if((d==null?void 0:d.message)==="User removed"){A("User has Removed Successful");const l=e,t=C.findIndex(g=>g._id===l);t!==-1&&C.splice(t,1),V.value--}else v((d==null?void 0:d.message)||"We Catch Error")}catch(d){v(d||"We Catch Error")}finally{setTimeout(()=>{h.push("/dashboard/users")},2e3)}}return(u,e)=>{const d=q;return Z(),W("div",Y,[n("div",ee,[n("div",oe,[n("p",le,[e[1]||(e[1]=r("Number of User: ")),n("span",null,b(c(V)),1)]),o(d,{style:j(`background-color: ${c(y)}; color: ${c(z)}`),class:"text-center text-decoration-none py-3 px-9 pa-1 mb-0 rounded-lg text-button text-decoration-none",to:"/dashboard/users/add_user"},{default:a(()=>e[2]||(e[2]=[r(" Add User ")])),_:1},8,["style"])])]),n("div",null,[o(J,{modelValue:c(x),"onUpdate:modelValue":e[0]||(e[0]=l=>O(x)?x.value=l:null),label:"Search","prepend-inner-icon":"mdi-magnify",variant:"outlined","hide-details":"","single-line":""},null,8,["modelValue"]),o(Q,{items:c(M),headers:L,search:c(x)},{"item.actions":a(({item:l})=>[n("div",ae,[o(p,{color:c(y),onClick:t=>w(l==null?void 0:l._id),icon:"mdi-pencil",size:"small"},null,8,["color","onClick"]),o(S,{"max-width":"500"},{activator:a(({props:t})=>[o(p,D(t,{color:"error",icon:"mdi-delete",size:"small"}),null,16)]),default:a(({isActive:t})=>[o(R,null,{default:a(()=>[o(E,{class:"headline"},{default:a(()=>e[3]||(e[3]=[r(" Delete Role ")])),_:1}),o(N,null,{default:a(()=>[n("p",null,[e[4]||(e[4]=r("Are you sure you want to Remove ")),n("b",null,"( "+b(l==null?void 0:l.name)+" )",1),e[5]||(e[5]=r(" from ")),n("b",null,b(l.role),1),e[6]||(e[6]=r(" Role?"))])]),_:2},1024),o(I,null,{default:a(()=>[o(B),o(p,{color:"green darken-1",text:"Close",onClick:g=>t.value=!1},null,8,["onClick"]),o(p,{color:"red darken-1",onClick:()=>{T(`/api/admin/users/employee/role/${l._id}?role=user`,l._id),t.value=!1}},{default:a(()=>e[7]||(e[7]=[r(" Delete ")])),_:2},1032,["onClick"])]),_:2},1024)]),_:2},1024)]),_:2},1024)]),n("div",se,[n("div",te,[o(p,{color:c(y),onClick:t=>w(l==null?void 0:l._id),text:"Edit",size:"default"},null,8,["color","onClick"]),o(S,{"max-width":"500"},{activator:a(({props:t})=>[o(p,D(t,{color:"error",text:"Delete",size:"default"}),null,16)]),default:a(({isActive:t})=>[o(R,null,{default:a(()=>[o(E,{class:"headline"},{default:a(()=>e[8]||(e[8]=[r(" Delete Role ")])),_:1}),o(N,null,{default:a(()=>[n("p",null,[e[9]||(e[9]=r("Are you sure you want to Remove ")),n("b",null,"( "+b(l==null?void 0:l.name)+" )",1),r(" from "+b(l.role)+" Role?",1)])]),_:2},1024),o(I,null,{default:a(()=>[o(B),o(p,{color:"green darken-1",text:"Close",onClick:g=>t.value=!1}
1,null,8,["onClick"]),o(p,{color:"red darken-1",onClick:()=>{T(`/api/admin/users/${l._id}`,l._id),t.value=!1}},{default:a(()=>e[10]||(e[10]=[r(" Delete ")])),_:2},1032,["onClick"])]),_:2},1024)]),_:2},1024)]),_:2},1024)])])]),_:1},8,["items","search"])])])}}});export{Be 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.