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 p,x as b,j as x,F as f,n as C,y as T,l as V,i as N}from"./app-D9-EssCM.js";import{_ as U}from"./AppLayout.vue_vue_type_script_setup_true_lang-C-UlPCqH.js";import"./index-CcjNLu6f.js";import"./index-CMWG4mbA.js";import"./useForwardExpose-MNmriUeS.js";import"./VisuallyHidden-DG35s1YI.js";import"./RovingFocusGroup-Diffidi3.js";import"./useArrowNavigation-C6Y-ieo6.js";import"./x-DwmBYYXD.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"],ee=h({__name:"Edit",props:{team:{},users:{}},setup(y){const i=y,r=v({name:i.team.name,description:i.team.description||"",user_ids:i.team.users.map(u=>u.id)}),g=()=>{r.put(`/administration/teams/${i.team.id}`)};return(u,t)=>(o(),d(f,null,[l(s(w),{title:`Edit ${i.team.name}`},null,8,["title"]),l(U,{breadcrumbs:[{title:"Administration",href:"/administration"},{title:"Teams",href:"/administration/teams"},{title:i.team.name,href:`/administration/teams/${i.team.id}`},{title:"Edit",href:"#"}]},{default:c(()=>[e("div",E,[e("div",$,[e("h1",j,"Edit Team: "+n(i.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]=a=>s(r).name=a),type:"text",class:p(["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]=a=>s(r).description=a),rows:"3",class:p(["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)),i.users.length===0?(o(),d("div",q,"No users available.")):(o(),d("div",A,[(o(!0),d(f,null,C(i.users,a=>(o(),d("label",{key:a.id,class:p(["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(a.id)}])},[m(e("input",{type:"checkbox",value:a.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(a.name.charAt(0).toUpperCase()),1),e("span",G,n(a.name),1)],2))),128))]))]),e("div",H,[l(s(V),{href:`/administration/teams/${i.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{ee as default};
