import{d as k,u as _,o as n,a,b as u,e as t,h as v,w as b,f as o,s as w,v as d,F as x,n as V,t as i,A as g,j as p,x as m,y as C,l as U,i as h}from"./app-D9-EssCM.js";import{s as c,_ as N}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:"grid gap-4 md:grid-cols-2"},M={class:"block"},S=["value"],B={key:0,class:"text-sm text-red-600"},F={class:"block"},P={key:0,class:"text-sm text-red-600"},q={class:"block"},D={key:0,class:"text-sm text-red-600"},T={class:"block"},j={key:0,class:"text-sm text-red-600"},A={class:"block"},L={key:0,class:"text-sm text-red-600"},$={class:"block"},z={class:"flex items-center"},G={class:"block"},H={key:0,class:"text-sm text-red-600"},I={class:"flex items-center gap-2"},J=["disabled"],os=k({__name:"Edit",props:{contact:{},customers:{}},setup(f){const l=f,e=_({customer_id:l.contact.customer.id,name:l.contact.name,email:l.contact.email||"",phone:l.contact.phone||"",position:l.contact.position||"",notes:l.contact.notes||"",is_primary:l.contact.is_primary});function y(){e.put(c.update(l.contact.id).url)}return(K,s)=>(n(),a(x,null,[u(t(v),{title:"Edit Contact"}),u(N,{breadcrumbs:[{title:"Contacts",href:t(c).index().url},{title:"Edit",href:"#"}]},{default:b(()=>[o("form",{onSubmit:w(y,["prevent"]),class:"space-y-4 p-4"},[o("div",E,[o("label",M,[s[8]||(s[8]=o("span",{class:"mb-1 block"},"Customer *",-1)),d(o("select",{"onUpdate:modelValue":s[0]||(s[0]=r=>t(e).customer_id=r),class:"w-full rounded border px-3 py-2",required:""},[s[7]||(s[7]=o("option",{value:""},"Select a customer",-1)),(n(!0),a(x,null,V(l.customers,r=>(n(),a("option",{key:r.id,value:r.id},i(r.name),9,S))),128))],512),[[g,t(e).customer_id]]),t(e).errors.customer_id?(n(),a("div",B,i(t(e).errors.customer_id),1)):p("",!0)]),o("label",F,[s[9]||(s[9]=o("span",{class:"mb-1 block"},"Name *",-1)),d(o("input",{"onUpdate:modelValue":s[1]||(s[1]=r=>t(e).name=r),class:"w-full rounded border px-3 py-2",required:""},null,512),[[m,t(e).name]]),t(e).errors.name?(n(),a("div",P,i(t(e).errors.name),1)):p("",!0)]),o("label",q,[s[10]||(s[10]=o("span",{class:"mb-1 block"},"Email",-1)),d(o("input",{"onUpdate:modelValue":s[2]||(s[2]=r=>t(e).email=r),type:"email",class:"w-full rounded border px-3 py-2"},null,512),[[m,t(e).email]]),t(e).errors.email?(n(),a("div",D,i(t(e).errors.email),1)):p("",!0)]),o("label",T,[s[11]||(s[11]=o("span",{class:"mb-1 block"},"Phone",-1)),d(o("input",{"onUpdate:modelValue":s[3]||(s[3]=r=>t(e).phone=r),class:"w-full rounded border px-3 py-2"},null,512),[[m,t(e).phone]]),t(e).errors.phone?(n(),a("div",j,i(t(e).errors.phone),1)):p("",!0)]),o("label",A,[s[12]||(s[12]=o("span",{class:"mb-1 block"},"Position",-1)),d(o("input",{"onUpdate:modelValue":s[4]||(s[4]=r=>t(e).position=r),class:"w-full rounded border px-3 py-2"},null,512),[[m,t(e).position]]),t(e).errors.position?(n(),a("div",L,i(t(e).errors.position),1)):p("",!0)]),o("label",$,[s[14]||(s[14]=o("span",{class:"mb-1 block"},"Primary Contact",-1)),o("label",z,[d(o("input",{"onUpdate:modelValue":s[5]||(s[5]=r=>t(e).is_primary=r),type:"checkbox",class:"mr-2"},null,512),[[C,t(e).is_primary]]),s[13]||(s[13]=o("span",{class:"text-sm"},"Mark as primary contact for this customer",-1))])])]),o("label",G,[s[15]||(s[15]=o("span",{class:"mb-1 block"},"Notes",-1)),d(o("textarea",{"onUpdate:modelValue":s[6]||(s[6]=r=>t(e).notes=r),rows:"3",class:"w-full rounded border px-3 py-2"},null,512),[[m,t(e).notes]]),t(e).errors.notes?(n(),a("div",H,i(t(e).errors.notes),1)):p("",!0)]),o("div",I,[o("button",{type:"submit",disabled:t(e).processing,class:"rounded bg-blue-600 px-4 py-2 text-white disabled:opacity-50"},i(t(e).processing?"Updating...":"Update Contact"),9,J),u(t(U),{href:t(c).show(l.contact.id).url,class:"rounded border px-4 py-2"},{default:b(()=>[...s[16]||(s[16]=[h("Cancel",-1)])]),_:1},8,["href"])])],32)]),_:1},8,["breadcrumbs"])],64))}});export{os as default};
