import{_ as T}from"./BNEsDCLV.js";import{f as g,q as k,C as P,D as E,E as N,F as R,G as B,H as S,j as q,s as I,P as p,_ as U,l as n,o as V,m as $,w as s,b as a,d as C,t as v,a as W}from"./qGWCsquX.js";import{i as w}from"./D2p94zMK.js";const L=g({components:{APagination:k,ASearch:P,ATitle:E,BTable:N,AEntityDelete:R,AClients:B,AUser:S},emits:["deleted"],setup(l,{emit:u}){const _=o=>{u("deleted",o)},i=q(),{realm:b,realmManagementId:y}=I(i),r={filter:{realm_id:[y.value,null]}},c=o=>w(b.value,o.realm_id),m=i.has(p.CLIENT_EDIT),d=i.has(p.CLIENT_DROP);return{fields:[{key:"id",label:"ID",thClass:"text-left",tdClass:"text-left"},{key:"name",label:"Name",thClass:"text-left",tdClass:"text-left"},{key:"user_id",label:"User",thClass:"text-center",tdClass:"text-center"},{key:"created_at",label:"Created at",thClass:"text-center",tdClass:"text-center"},{key:"updated_at",label:"Updated at",thClass:"text-left",tdClass:"text-left"},{key:"options",label:"",tdClass:"text-left"}],isResourceWritable:c,hasEditPermission:m,hasDropPermission:d,handleDeleted:_,query:r}}},"$7HJniSYcgC"),H=W("i",{class:"fa-solid fa-bars"},null,-1);function j(l,u,_,i,b,y){const r=n("ATitle"),c=n("ASearch"),m=n("APagination"),d=n("VCTimeago"),f=n("AUser"),o=T,h=n("AEntityDelete"),A=n("BTable"),x=n("AClients");return V(),$(x,{query:l.query,onDeleted:l.handleDeleted},{header:s(e=>[a(r),a(c,{load:e.load,busy:e.busy},null,8,["load","busy"])]),footer:s(e=>[a(m,{busy:e.busy,meta:e.meta,load:e.load},null,8,["busy","meta","load"])]),body:s(e=>[a(A,{items:e.data,fields:l.fields,busy:e.busy,"head-variant":"'dark'",outlined:""},{"cell(created_at)":s(t=>[a(d,{datetime:t.item.created_at},null,8,["datetime"])]),"cell(updated_at)":s(t=>[a(d,{datetime:t.item.created_at},null,8,["datetime"])]),"cell(user_id)":s(t=>[a(f,{"entity-id":t.item.user_id},{default:s(D=>[C(v(D.data.name),1)]),error:s(()=>[C(" - ")]),_:2},1032,["entity-id"])]),"cell(options)":s(t=>[a(o,{to:"/admin/clients/"+t.item.id,class:"btn btn-xs btn-outline-primary me-1",disabled:!l.hasEditPermission||!l.isResourceWritable(t.item)},{default:s(()=>[H]),_:2},1032,["to","disabled"]),a(h,{class:"btn btn-xs btn-outline-danger","entity-id":t.item.id,"entity-type":"client","with-text":!1,disabled:!l.hasDropPermission||!l.isResourceWritable(t.item),onDeleted:e.deleted},null,8,["entity-id","disabled","onDeleted"])]),_:2},1032,["items","fields","busy"])]),_:1},8,["query","onDeleted"])}const M=U(L,[["render",j]]);export{M as default};
