import{u as A,Q as I}from"./use-meta-DojAUcSy.js";import{l as S,t as z,v as M}from"./QItemLabel-Ca7AFIYY.js";import{u as R,a as D,Q as P}from"./token-cjhLXN1D.js";import{a as k,r as s,o as U,w as y,Z as b,_ as w,a1 as e,a2 as l,C as V,a4 as d,a0 as c,a3 as v,a8 as g,$ as B,am as F,ac as G,aj as K,e as L,a6 as E}from"./index-BjX5DxyZ.js";import{Q as H,a as O,b as W}from"./QTable-C3OFwMm-.js";import{get as Z}from"./axios-DYwtcsq2.js";import{u as J}from"./vue-i18n.runtime-DjveMvYz.js";const X={class:"q-pa-md"},Y={key:0},ee={key:1},ae={__name:"UserList",setup($){const{t:a}=J(),i=S(),_=R(),h=k(()=>[{name:"username",required:!0,label:a("username"),align:"left",field:"username",sortable:!0},{name:"email",align:"center",label:a("email"),field:"email",sortable:!0},{name:"date_joined",label:a("date_joined"),field:"date_joined",sortable:!0},{name:"last_login",label:a("last_login"),field:"last_login",sortable:!0},{name:"updated_time",label:a("updated_time"),field:"updated_time",sortable:!0},{name:"action",label:a("action"),align:"right"}]),m=s([]),p=s(""),r=s({sortBy:"username",descending:!1,page:1,rowsPerPage:1,rowsNumber:1}),q=k(()=>Q.value!==""?Math.ceil(m.value.length/r.value.rowsPerPage):0),j=s(i.screen.height*.73+"px"),N=s(i.screen.width*.825+"px"),x=s(i.dark.isActive?"#121212":"#ffffff"),Q=k(()=>_.token);function f(o){Z("core/user/").then(t=>{m.value=t.results}).catch(t=>(console.error(t),Promise.reject(t))),console.log(o),r.value=o.pagination}function T(o){console.log("pageChange",o)}function C(o){return console.log("PermissionCheck",o),!0}return U(()=>{Q.value!==""&&f({pagination:r.value})}),y(()=>i.dark.isActive,o=>{x.value=o?"#121212":"#ffffff"}),y(()=>r.value,o=>{console.log("watch",o)}),(o,t)=>(b(),w("div",X,[e(W,{class:K(c(i).dark.isActive?"my-sticky-header-last-column-table-dark":"my-sticky-header-last-column-table"),flat:"",bordered:"",rows:m.value,columns:h.value,"row-key":"name",pagination:r.value,separator:"cell","no-data-label":c(a)("nodata"),"rows-per-page-label":c(a)("per_page"),"rows-per-page-options":[1,10,30,50,200,0],"table-style":{height:j.value,width:N.value},"card-style":{backgroundColor:x.value},onRequest:f},{top:l(n=>[e(D,{flat:""},{default:l(()=>[V(e(d,{label:c(a)("refresh"),icon:"refresh",onClick:t[0]||(t[0]=u=>f({pagination:r.value}))},{default:l(()=>[e(P,{"content-class":"bg-indigo text-black shadow-4",offset:[10,10],"content-style":"font-size: 12px"},{default:l(()=>[v(g(c(a)("refresh")),1)]),_:1})]),_:1},8,["label"]),[[B,C("Get User List")]]),V(e(d,{label:c(a)("new"),icon:"add"},{default:l(()=>[e(P,{"content-class":"bg-indigo text-black shadow-4",offset:[10,10],"content-style":"font-size: 12px"},{default:l(()=>[v(g(c(a)("new")),1)]),_:1})]),_:1},8,["label"]),[[B,C("Create One User")]])]),_:1}),v(" "+g(q.value)+" ",1),e(z),e(M,{borderless:"",dense:"",debounce:"300",color:"primary",modelValue:p.value,"onUpdate:modelValue":t[1]||(t[1]=u=>p.value=u),onInput:t[2]||(t[2]=u=>f({pagination:r.value})),onKeyup:t[3]||(t[3]=F(u=>f({pagination:r.value}),["enter"]))},{append:l(()=>[e(G,{name:"search"})]),_:1},8,["modelValue"]),e(d,{flat:"",round:"",dense:"",icon:n.inFullscreen?"fullscreen_exit":"fullscreen",onClick:n.toggleFullscreen},null,8,["icon","onClick"])]),"body-cell":l(n=>[e(H,{props:n},{default:l(()=>[n.col.name==="action"?(b(),w("div",Y,[e(d,{round:"",flat:"",icon:"admin_panel_settings"}),e(d,{round:"",flat:"",icon:"brush"}),e(d,{round:"",flat:"",icon:"delete_sweep"})])):(b(),w("div",ee,g(n.value),1))]),_:2},1032,["props"])]),pagination:l(n=>[v(g(n)+" ",1),e(O,{modelValue:n.pagination.page,"onUpdate:modelValue":[u=>n.pagination.page=u,u=>T(n)],max:n.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"])]))}},ue={__name:"UserReader",setup($){const a=S(),i=s(!1),_=s(""),h=s(""),m=s("");return A(()=>({title:_.value,meta:{description:{name:"description",content:h.value},keywords:{name:"keywords",content:m.value}}})),U(()=>{}),L(()=>{}),y(()=>a.dark.isActive,p=>{i.value=p}),(p,r)=>(b(),E(I,{class:"flex flex-top"},{default:l(()=>[e(ae)]),_:1}))}};export{ue as default};
