import{d as y,s as x,j as T,k as M,T as C,r as W,c as m,o as i,a as s,b as a,e as $,t,F as k,g as V,h as f,u as d,w as B,x as S,_ as U}from"./app-Do7K7VDV.js";import{_ as j}from"./SpinnerBtn-C-rqKjUt.js";import{_ as I}from"./Paginate-BZTS8QtF.js";import{_ as D}from"./NoDataFound-BCWTwO3P.js";import{_ as F}from"./UserLayout-B1erUghk.js";import{s as N}from"./multiselect-D1A7YaZl.js";import"./AssetModal-C18ToIEK.js";import"./_plugin-vue_export-helper-DlAUqK2U.js";import"./InputFieldError-0BmYlL24.js";import"./ToastrContainer-CtYDvNPN.js";const A={class:"table-responsive mt-4 w-full"},z={class:"table"},E={class:"w-[5%]"},L={class:"!text-right"},O={key:0,class:"tbody"},P={class:"flex items-center gap-2"},R=["src"],q={class:"flex justify-end"},G={class:"dropdown","data-placement":"bottom-start"},H={class:"dropdown-toggle"},J={class:"dropdown-content w-56"},K={class:"dropdown-list"},Q={class:"dropdown-list-item"},X=["onClick"],Y={class:"dropdown-list-item"},Z=["onClick"],ss={class:"w-full"},es=y({layout:F}),ps=Object.assign(es,{__name:"Index",props:["myWorkspaces","myTeamMembers"],setup(c){const{deleteRow:b}=x(),u=T(),_=M(null),w=e=>{var l;_.value=e,n.workspace_ids=(l=e.assigned_workspaces)==null?void 0:l.map(r=>r.id),u.open("assignToWorkspace")},n=C({workspace_ids:[]}),g=()=>{n.put(route("user.teams.update",_.value.id),{onSuccess:()=>{n.reset(),u.close("assignToWorkspace")}})};return(e,l)=>{const r=W("Icon");return i(),m(k,null,[s("div",A,[s("table",z,[s("thead",null,[s("tr",null,[s("th",E,t(e.trans("ID")),1),s("th",null,t(e.trans("User")),1),s("th",null,t(e.trans("Workspaces")),1),s("th",L,t(e.trans("Action")),1)])]),c.myTeamMembers.data.length?(i(),m("tbody",O,[(i(!0),m(k,null,V(c.myTeamMembers.data,(o,v)=>{var h;return i(),m("tr",{key:v},[s("td",null,t(o.id),1),s("td",null,[s("div",P,[s("img",{src:o.avatar,class:"mr-3 h-8 w-8 rounded-full"},null,8,R),s("div",null,[s("b",null,t(o.name),1),s("p",null,t(o.email),1)])])]),s("td",null,t((h=o.assigned_workspaces)==null?void 0:h.map(p=>p.name).join(", ")),1),s("td",null,[s("div",q,[s("div",G,[s("div",H,[a(r,{class:"h-5 text-3xl text-slate-400",icon:"bx:dots-vertical-rounded"})]),s("div",J,[s("ul",K,[s("li",Q,[s("a",{class:"dropdown-link",onClick:p=>w(o)},[a(r,{class:"h-5 text-3xl text-slate-400",icon:"bx:user-plus"}),f(" "+t(e.trans("Manage Workspaces")),1)],8,X)]),s("li",Y,[s("a",{class:"dropdown-link",onClick:p=>d(b)(e.route("user.teams.destroy",o.id))},[a(r,{class:"h-5 text-3xl text-slate-400",icon:"bx:trash"}),f(" "+t(e.trans("Delete")),1)],8,Z)])])])])])])])}),128))])):(i(),$(D,{key:1,forTable:!0}))]),s("div",ss,[a(I,{links:c.myTeamMembers.links},null,8,["links"])])]),a(U,{"modal-type":"sidebar","header-state":!0,"header-title":e.trans("Assign Workspaces to User"),state:"assignToWorkspace","modal-size":"w-1/3 2xl:w-1/4"},{default:B(()=>[s("form",{onSubmit:S(g,["prevent"]),class:"space-y-4"},[a(d(N),{modelValue:d(n).workspace_ids,"onUpdate:modelValue":l[0]||(l[0]=o=>d(n).workspace_ids=o),options:c.myWorkspaces,searchable:!0,mode:"tags",valueProp:"id",trackBy:"name",label:"name",class:"multiselect-dark"},null,8,["modelValue","options"]),a(j,{class:"w-full",icon:"bx:send",processing:d(n).processing,"btn-text":e.trans("Update Members")},null,8,["processing","btn-text"])],32)]),_:1},8,["header-title"])],64)}}});export{ps as default};
