import{u as A,Q as z}from"./use-meta-BJVd-nvo.js";import{l as $,t as D,v as G}from"./QItemLabel-BqC_lJqF.js";import{u as M,a as R,Q as P}from"./token-BCvVeiAJ.js";import{a as _,r as s,o as S,w as y,Z as h,_ as w,a1 as e,a2 as l,C as B,a4 as m,a0 as c,a3 as b,a8 as g,$ as V,am as F,ac as K,aj as L,e as E,a6 as H}from"./index-DXnmGVO_.js";import{Q as O,a as W,b as Z}from"./QTable-D7Z94-sl.js";import{get as J}from"./axios-3NEAMsWm.js";import{u as X}from"./vue-i18n.runtime-D9oZllZr.js";const Y={class:"q-pa-md"},ee={key:0},ae={key:1},te={__name:"UserList",setup(U){const{t:a}=X(),i=$(),v=M(),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"}]),p=s([]),d=s(""),r=s({sortBy:"username",descending:!0,page:1,rowsPerPage:1,rowsNumber:1}),q=_(()=>Q.value!==""?Math.ceil(p.value.length/r.value.rowsPerPage):0),j=s(i.screen.height*.73+"px"),I=s(i.screen.width*.825+"px"),x=s(i.dark.isActive?"#121212":"#ffffff"),Q=_(()=>v.token),N=_(()=>v.tokenDataGet);function f(t){Q.value!==""&&(J({url:"core/user/",params:{search:d.value,page:t.pagination.page,max_page:t.pagination.rowsPerPage,ordering:`-${t.pagination.sortBy}`}}).then(n=>{p.value=n.results}).catch(n=>(console.error(n),Promise.reject(n))),r.value=t.pagination)}function T(t){console.log("pageChange",t)}function C(t){return t in N.value.permissions}return S(()=>{f({pagination:r.value})}),y(()=>i.dark.isActive,t=>{x.value=t?"#121212":"#ffffff"}),y(()=>r.value,t=>{console.log("watch",t.sortBy)}),(t,n)=>(h(),w("div",Y,[e(Z,{class:L(c(i).dark.isActive?"my-sticky-header-last-column-table-dark":"my-sticky-header-last-column-table"),flat:"",bordered:"",rows:p.value,columns:k.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:I.value},"card-style":{backgroundColor:x.value},onRequest:f},{top:l(o=>[e(R,{flat:""},{default:l(()=>[B(e(m,{label:c(a)("refresh"),icon:"refresh",onClick:n[0]||(n[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(()=>[b(g(c(a)("refresh")),1)]),_:1})]),_:1},8,["label"]),[[V,C("Get User List")]]),B(e(m,{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(()=>[b(g(c(a)("new")),1)]),_:1})]),_:1},8,["label"]),[[V,C("Create One User")]])]),_:1}),b(" "+g(q.value)+" ",1),e(D),e(G,{borderless:"",dense:"",debounce:"300",color:"primary",modelValue:d.value,"onUpdate:modelValue":n[1]||(n[1]=u=>d.value=u),onInput:n[2]||(n[2]=u=>f({pagination:r.value})),onKeyup:n[3]||(n[3]=F(u=>f({pagination:r.value}),["enter"]))},{append:l(()=>[e(K,{name:"search"})]),_:1},8,["modelValue"]),e(m,{flat:"",round:"",dense:"",icon:o.inFullscreen?"fullscreen_exit":"fullscreen",onClick:o.toggleFullscreen},null,8,["icon","onClick"])]),"body-cell":l(o=>[e(O,{props:o},{default:l(()=>[o.col.name==="action"?(h(),w("div",ee,[e(m,{round:"",flat:"",icon:"admin_panel_settings"}),e(m,{round:"",flat:"",icon:"brush"}),e(m,{round:"",flat:"",icon:"delete_sweep"})])):(h(),w("div",ae,g(o.value),1))]),_:2},1032,["props"])]),pagination:l(o=>[b(g(o)+" ",1),e(W,{modelValue:o.pagination.page,"onUpdate:modelValue":[u=>o.pagination.page=u,u=>T(o)],max:o.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"])]))}},ce={__name:"UserReader",setup(U){const a=$(),i=s(!1),v=s(""),k=s(""),p=s("");return A(()=>({title:v.value,meta:{description:{name:"description",content:k.value},keywords:{name:"keywords",content:p.value}}})),S(()=>{}),E(()=>{}),y(()=>a.dark.isActive,d=>{i.value=d}),(d,r)=>(h(),H(z,{class:"flex flex-top"},{default:l(()=>[e(te)]),_:1}))}};export{ce as default};
