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