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