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