import{u as C,Q as q}from"./use-meta-BEEo_F_M.js";import{z as x,G as U,H as j}from"./QItemLabel-DfLXYZOe.js";import{a as w,r as o,l as Q,w as b,Z as m,_ as g,a1 as l,a2 as i,a4 as y,ac as A,a8 as f,a3 as N,aj as S,a0 as _,o as $,a6 as I}from"./index-BcMbclKg.js";import{Q as M,a as R,b as T}from"./QTable-Dtzgu65T.js";import{get as z}from"./axios-DNbIgy22.js";import{u as F}from"./vue-i18n.runtime-DlSY5lgv.js";const H={class:"q-pa-md"},D={key:0},E={key:1},G={__name:"UserList",setup(V){const{t}=F(),n=x(),p=w(()=>[{name:"username",required:!0,label:t("username"),align:"left",field:e=>e.name,format:e=>`${e}`,sortable:!0},{name:"email",align:"center",label:t("email"),field:"email",sortable:!0},{name:"date_joined",label:t("date_joined"),field:"date_joined",sortable:!0},{name:"last_login",label:t("last_login"),field:"last_login",sortable:!0},{name:"updated_time",label:t("updated_time"),field:"updated_time",sortable:!0},{name:"action",label:t("action"),align:"right"}]),c=o([]),s=o({sortBy:"username",descending:!1,page:1,rowsPerPage:1,rowsNumber:1}),u=w(()=>Math.ceil(c.value.length/s.value.rowsPerPage)),v=o(n.screen.height*.73+"px"),P=o(n.screen.width*.825+"px"),h=o(n.dark.isActive?"#121212":"#ffffff");function k(e){z("core/user/").then(r=>{c.value=r.data.results}).catch(r=>(console.error(r),Promise.reject(r))),console.log(e),s.value=e.pagination}function B(e){console.log(e)}return Q(()=>{k({pagination:s.value})}),b(()=>n.dark.isActive,e=>{h.value=e?"#121212":"#ffffff"}),b(()=>s.value,e=>{console.log(e)}),(e,r)=>(m(),g("div",H,[l(T,{class:S(_(n).dark.isActive?"my-sticky-header-last-column-table-dark":"my-sticky-header-last-column-table"),flat:"",bordered:"",rows:c.value,columns:p.value,"row-key":"name",pagination:s.value,separator:"cell","no-data-label":_(t)("nodata"),"rows-per-page-label":_(t)("per_page"),"rows-per-page-options":[1,10,30,50,200,0],"table-style":{height:v.value,width:P.value},"card-style":{backgroundColor:h.value},onRequest:k},{top:i(a=>[l(y,{color:"primary",label:"Add row"}),l(U),l(j,{borderless:"",dense:"",debounce:"300",color:"primary",modelValue:u.value,"onUpdate:modelValue":r[0]||(r[0]=d=>u.value=d)},{append:i(()=>[l(A,{name:"search"})]),_:1},8,["modelValue"]),l(y,{flat:"",round:"",dense:"",icon:a.inFullscreen?"fullscreen_exit":"fullscreen",onClick:a.toggleFullscreen},null,8,["icon","onClick"])]),"body-cell":i(a=>[l(M,{props:a},{default:i(()=>[a.col.name==="action"?(m(),g("div",D,f(a),1)):(m(),g("div",E,f(a.value),1))]),_:2},1032,["props"])]),pagination:i(a=>[N(f(a)+" ",1),l(R,{modelValue:a.pagination.page,"onUpdate:modelValue":[d=>a.pagination.page=d,d=>B(a)],max:a.pagesNumber,input:"","input-class":"text-orange-10"},null,8,["modelValue","onUpdate:modelValue","max"])]),_:1},8,["class","rows","columns","pagination","no-data-label","rows-per-page-label","table-style","card-style"])]))}},X={__name:"UserReader",setup(V){const t=x(),n=o(!1),p=o(""),c=o(""),s=o("");return C(()=>({title:p.value,meta:{description:{name:"description",content:c.value},keywords:{name:"keywords",content:s.value}}})),Q(()=>{}),$(()=>{}),b(()=>t.dark.isActive,u=>{n.value=u}),(u,v)=>(m(),I(q,{class:"flex flex-top"},{default:i(()=>[l(G)]),_:1}))}};export{X as default};
