import{t as V,r as l,o as r,k as _,l as e,d as $,f as s,m as M,q as N,p as R,z as O,e as u,x as d,y as p,b as k,a as U,A as P,F as A}from"./app-44623493.js";const z={class:"grid grid-cols-3 gap-6"},x={class:"col-span-3 sm:col-span-1"},G={class:"col-span-3 sm:col-span-1"},J={class:"col-span-3 sm:col-span-1"},K={class:"col-span-3 sm:col-span-1"},Q={__name:"Filter",props:{preRequisites:{type:Object,default(){return{}}}},emits:["hide"],setup(q,{emit:b}){const g=q,v={name:"",email:"",username:"",status:""},o=V({...v}),y=V({statuses:g.preRequisites.statuses});return(c,n)=>{const m=l("BaseInput"),F=l("BaseSelect"),C=l("FilterForm");return r(),_(C,{"init-form":v,form:o,onHide:n[4]||(n[4]=t=>b("hide"))},{default:e(()=>[$("div",z,[$("div",x,[s(m,{type:"text",modelValue:o.name,"onUpdate:modelValue":n[0]||(n[0]=t=>o.name=t),name:"name",label:c.$trans("user.props.name")},null,8,["modelValue","label"])]),$("div",G,[s(m,{type:"text",modelValue:o.email,"onUpdate:modelValue":n[1]||(n[1]=t=>o.email=t),name:"email",label:c.$trans("user.props.email")},null,8,["modelValue","label"])]),$("div",J,[s(m,{type:"text",modelValue:o.username,"onUpdate:modelValue":n[2]||(n[2]=t=>o.username=t),name:"username",label:c.$trans("user.props.username")},null,8,["modelValue","label"])]),$("div",K,[s(F,{modelValue:o.status,"onUpdate:modelValue":n[3]||(n[3]=t=>o.status=t),name:"status",label:c.$trans("user.status"),options:y.statuses},null,8,["modelValue","label","options"])])])]),_:1},8,["form"])}}},W={name:"UserList"},Y=Object.assign(W,{setup(q){const b=M(),g=N("emitter");let v=["filter"];R("user:create")&&v.unshift("create");let o=[];R("user:export")&&(o=["print","pdf","excel"]);const y="user/",c=V({}),n=O(!1),m=V({}),F=t=>{Object.assign(m,t)},C=t=>{Object.assign(c,t)};return(t,i)=>{const H=l("PageHeaderAction"),S=l("PageHeader"),w=l("ParentTransition"),f=l("DataCell"),D=l("BaseBadge"),I=l("FloatingMenuItem"),T=l("FloatingMenu"),j=l("DataRow"),h=l("BaseButton"),E=l("DataTable"),L=l("ListItem");return r(),_(L,{"init-url":y,"pre-requisites":!0,onSetPreRequisites:C,onSetItems:F},{header:e(()=>[s(S,{title:t.$trans("user.user")},{default:e(()=>[s(H,{url:"users/",name:"User",title:t.$trans("user.user"),actions:u(v),"dropdown-actions":u(o),onToggleFilter:i[0]||(i[0]=a=>n.value=!n.value)},null,8,["title","actions","dropdown-actions"])]),_:1},8,["title"])]),filter:e(()=>[s(w,{appear:"",visibility:n.value},{default:e(()=>[s(Q,{onRefresh:i[1]||(i[1]=a=>u(g).emit("listItems")),"pre-requisites":c,onHide:i[2]||(i[2]=a=>n.value=!1)},null,8,["pre-requisites"])]),_:1},8,["visibility"])]),default:e(()=>[s(w,{appear:"",visibility:!0},{default:e(()=>[s(E,{header:m.headers,meta:m.meta,module:"user",onRefresh:i[4]||(i[4]=a=>u(g).emit("listItems"))},{actionButton:e(()=>[u(R)("user:create")?(r(),_(h,{key:0,onClick:i[3]||(i[3]=a=>u(b).push({name:"UserCreate"}))},{default:e(()=>[d(p(t.$trans("global.add",{attribute:t.$trans("user.user")})),1)]),_:1})):k("",!0)]),default:e(()=>[(r(!0),U(A,null,P(m.data,a=>(r(),_(j,{key:a.uuid},{default:e(()=>[s(f,{name:"name"},{default:e(()=>[d(p(a.profile.name),1)]),_:2},1024),s(f,{name:"email"},{default:e(()=>[d(p(a.email),1)]),_:2},1024),s(f,{name:"username"},{default:e(()=>[d(p(a.username),1)]),_:2},1024),s(f,{name:"roles"},{default:e(()=>[(r(!0),U(A,null,P(a.roles,B=>(r(),U("div",null,[s(D,{label:B.label},null,8,["label"])]))),256))]),_:2},1024),s(f,{name:"status"},{default:e(()=>[s(D,{label:a.status.label,design:a.status.color},null,8,["label","design"])]),_:2},1024),s(f,{name:"createdAt"},{default:e(()=>[d(p(a.createdAt.formatted),1)]),_:2},1024),s(f,{name:"action"},{default:e(()=>[a.isEditable||a.isDeletable?(r(),_(T,{key:0},{default:e(()=>[s(I,{icon:"fas fa-eye",onClick:B=>u(b).push({name:"UserShow",params:{uuid:a.uuid}})},{default:e(()=>[d(p(t.$trans("general.show")),1)]),_:2},1032,["onClick"]),a.isEditable?(r(),_(I,{key:0,icon:"fas fa-edit",onClick:B=>u(b).push({name:"UserEdit",params:{uuid:a.uuid}})},{default:e(()=>[d(p(t.$trans("general.edit")),1)]),_:2},1032,["onClick"])):k("",!0),a.isDeletable?(r(),_(I,{key:1,icon:"fas fa-trash",onClick:B=>u(g).emit("deleteItem",{uuid:a.uuid})},{default:e(()=>[d(p(t.$trans("general.delete")),1)]),_:2},1032,["onClick"])):k("",!0)]),_:2},1024)):k("",!0)]),_:2},1024)]),_:2},1024))),128))]),_:1},8,["header","meta"])]),_:1})]),_:1})}}});export{Y as default};
