import{r as t,h as e,H as o}from"./p-d55626d1.js";import{c as r}from"./p-2fd22ed9.js";import"./p-0bc4f624.js";import"./p-9bfc48ee.js";import"./p-097729d8.js";import{a}from"./p-c1c5b589.js";import{s as i}from"./p-62c3d279.js";import"./p-c7f96882.js";import{p as s}from"./p-716f6fe3.js";const c=class{constructor(e){t(this,e),this.activePage=1,this.tableHeader=["Email","Role","Status","Date Created"]}rerenderForPage(){this.queryData()}async queryData(){const t=await r.client.query({query:i(s),variables:{page:this.page,size:15}});this._data=t.data.paginateUsers}async componentWillRender(){a.identity&&await this.queryData()}render(){return a.identity?e(o,null,e("corejam-box",{max:"xl",flex:!0,direction:"col",mx:"auto"},e("corejam-box",null,e("corejam-type",{as:"h2",size:"xl"},"Users")),e("corejam-box",{flex:!0,direction:"col"},e("corejam-box",{px:5,bColor:"gray-300",bWidth:1,flex:!0,pt:3,pb:3},this.tableHeader.map(((t,o)=>e("corejam-box",{w:"3",key:o},t)))),this._data.items.map(((t,o)=>{let r="";return o%2==0&&(r="lightBlue-900"),e("corejam-box",{px:5,bg:r,bStyle:"solid",bColor:"gray-300",bWidth:1,flex:!0,pt:3,pb:3},e("corejam-box",{w:"3"},e("corejam-base-link",{"data-cy":"user-link",href:`/admin/users/edit/${t.id}`},e("corejam-type",null,t.email))),e("corejam-box",{w:"3"},t.role),e("corejam-box",{w:"3"},t.active),e("corejam-box",{w:"3"},t.dateCreated))}))),e("corejam-box",{px:5,bColor:"gray-300",bWidth:1,flex:!0,justify:"between",pt:3,pb:3},"Showing ",this._data.items.length," of ",this._data.totalItems," entries",e("corejam-pagination",{paginator:this._data})))):e("corejam-box",{mx:"auto"},"Not authorized")}static get watchers(){return{page:["rerenderForPage"]}}},n=class{constructor(e){t(this,e),this._paginator={currentPage:1,lastPage:5,items:[]}}watchPaginator(){this.setState()}setState(){this.paginator&&(this._paginator="string"==typeof this.paginator?JSON.parse(this.paginator):this.paginator)}componentWillLoad(){this.setState()}renderPaginate(){const t=[];for(let o=1;o<=this._paginator.lastPage;o++){const r={color:"gray-400"};o===this._paginator.currentPage&&(r.color="gray-900"),t.push(e("corejam-box",{px:4,bWidthRight:1,bColor:"gray-200"},e("corejam-base-link",{href:`${o}`,decoration:"none"},e("corejam-type",Object.assign({},r),o.toString()))))}return t}render(){return e(o,null,e("corejam-box",{flex:!0,w:"12",mt:8,justify:"between",bWidthTop:1,bColor:"gray-300",pt:4},e("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"24",height:"24"},e("path",{class:"heroicon-ui",d:"M5.41 11H21a1 1 0 0 1 0 2H5.41l5.3 5.3a1 1 0 0 1-1.42 1.4l-7-7a1 1 0 0 1 0-1.4l7-7a1 1 0 0 1 1.42 1.4L5.4 11z"})),e("corejam-box",{flex:!0,direction:"row"},this.renderPaginate()),e("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"24",height:"24"},e("path",{class:"heroicon-ui",d:"M18.59 13H3a1 1 0 0 1 0-2h15.59l-5.3-5.3a1 1 0 1 1 1.42-1.4l7 7a1 1 0 0 1 0 1.4l-7 7a1 1 0 0 1-1.42-1.4l5.3-5.3z"}))))}static get watchers(){return{paginator:["watchPaginator"]}}};export{c as auth_admin_user_list,n as corejam_pagination}