import{d as h,u as v,o,a as d,b as l,e as s,h as w,w as c,f as e,t as n,s as k,v as m,q as u,x as b,j as x,F as f,n as C,y as T,l as V,i as N}from"./app-bWy6VYs1.js";import{_ as U}from"./AppLayout.vue_vue_type_script_setup_true_lang-BwuDxc8O.js";import"./index-C32fBP6Q.js";import"./index-CMWG4mbA.js";import"./useForwardExpose-Cx2E44RD.js";import"./VisuallyHidden-0BfmsMPn.js";import"./RovingFocusGroup-D20OvR_w.js";import"./useArrowNavigation-C6Y-ieo6.js";import"./_plugin-vue_export-helper-DmjF0He4.js";const E={class:"p-4"},$={class:"flex items-center justify-between gap-3 mb-6"},j={class:"text-2xl font-bold text-gray-900"},D={class:"bg-white rounded-lg border p-6"},M={class:"space-y-4"},B={key:0,class:"text-red-500 text-sm mt-1"},F={key:0,class:"text-red-500 text-sm mt-1"},S={class:"bg-white rounded-lg border p-6"},q={key:0,class:"text-sm text-gray-500"},A={key:1,class:"space-y-2 max-h-64 overflow-y-auto"},z=["value"],L={class:"inline-flex h-8 w-8 items-center justify-center rounded-full bg-primary/10 text-sm font-medium text-primary"},G={class:"text-sm font-medium text-gray-900"},H={class:"flex items-center justify-end gap-3"},I=["disabled"],Z=h({__name:"Edit",props:{team:{},users:{}},setup(y){const a=y,r=v({name:a.team.name,description:a.team.description||"",user_ids:a.team.users.map(p=>p.id)}),g=()=>{r.put(`/administration/teams/${a.team.id}`)};return(p,t)=>(o(),d(f,null,[l(s(w),{title:`Edit ${a.team.name}`},null,8,["title"]),l(U,{breadcrumbs:[{title:"Administration",href:"/administration"},{title:"Teams",href:"/administration/teams"},{title:a.team.name,href:`/administration/teams/${a.team.id}`},{title:"Edit",href:"#"}]},{default:c(()=>[e("div",E,[e("div",$,[e("h1",j,"Edit Team: "+n(a.team.name),1)]),e("form",{onSubmit:k(g,["prevent"]),class:"max-w-2xl space-y-6"},[e("div",D,[t[5]||(t[5]=e("h2",{class:"text-lg font-semibold text-gray-900 mb-4"},"Team Details",-1)),e("div",M,[e("div",null,[t[3]||(t[3]=e("label",{class:"block text-sm font-medium text-gray-700 mb-1"},"Name *",-1)),m(e("input",{"onUpdate:modelValue":t[0]||(t[0]=i=>s(r).name=i),type:"text",class:u(["w-full rounded border px-3 py-2",{"border-red-500":s(r).errors.name}]),required:""},null,2),[[b,s(r).name]]),s(r).errors.name?(o(),d("div",B,n(s(r).errors.name),1)):x("",!0)]),e("div",null,[t[4]||(t[4]=e("label",{class:"block text-sm font-medium text-gray-700 mb-1"},"Description",-1)),m(e("textarea",{"onUpdate:modelValue":t[1]||(t[1]=i=>s(r).description=i),rows:"3",class:u(["w-full rounded border px-3 py-2",{"border-red-500":s(r).errors.description}])},null,2),[[b,s(r).description]]),s(r).errors.description?(o(),d("div",F,n(s(r).errors.description),1)):x("",!0)])])]),e("div",S,[t[6]||(t[6]=e("h2",{class:"text-lg font-semibold text-gray-900 mb-4"},"Team Members",-1)),t[7]||(t[7]=e("p",{class:"text-sm text-gray-500 mb-4"},"Select users to add to this team.",-1)),a.users.length===0?(o(),d("div",q,"No users available.")):(o(),d("div",A,[(o(!0),d(f,null,C(a.users,i=>(o(),d("label",{key:i.id,class:u(["flex items-center gap-3 rounded-lg border px-4 py-3 cursor-pointer hover:bg-gray-50 transition-colors",{"border-blue-300 bg-blue-50":s(r).user_ids.includes(i.id)}])},[m(e("input",{type:"checkbox",value:i.id,"onUpdate:modelValue":t[2]||(t[2]=_=>s(r).user_ids=_),class:"rounded border-gray-300 text-blue-600 focus:ring-blue-500"},null,8,z),[[T,s(r).user_ids]]),e("span",L,n(i.name.charAt(0).toUpperCase()),1),e("span",G,n(i.name),1)],2))),128))]))]),e("div",H,[l(s(V),{href:`/administration/teams/${a.team.id}`,class:"rounded bg-gray-500 px-4 py-2 text-white hover:bg-gray-600"},{default:c(()=>[...t[8]||(t[8]=[N(" Cancel ",-1)])]),_:1},8,["href"]),e("button",{type:"submit",disabled:s(r).processing,class:"rounded bg-primary px-4 py-2 text-sm font-medium text-white hover:bg-primary/90 disabled:opacity-50"},n(s(r).processing?"Updating...":"Update Team"),9,I)])],32)])]),_:1},8,["breadcrumbs"])],64))}});export{Z as default};
