import{i as w,Z as v,r as d,c as a,o as m,a as l,b as s,d as _,w as p,F as c,j as y,t as i,e as h}from"./app-BLo7SiiE.js";import{L as U}from"./Layout-BEAmuehS.js";import{T as C}from"./TextInput-D6G3wYlu.js";import{S as k}from"./SelectInput-Bl1ROfev.js";import{L as z}from"./LoadingButton-fIGCYE5-.js";import{_ as L}from"./FlashMessages-DImpr6PL.js";import"./moment-C7JtfGJw.js";import"./v4-SoommWqA.js";const A={components:{Head:v,Link:w,LoadingButton:z,SelectInput:k,TextInput:C},layout:U,props:{contact:Object,organizations:Array,countries:Array,title:String},remember:"form",data(){return{form:this.$inertia.form({first_name:this.contact.first_name,last_name:this.contact.last_name,title:this.contact.title,organization_id:this.contact.organization_id,email:this.contact.email,phone:this.contact.phone,address:this.contact.address,city:this.contact.city,country:this.contact.country})}},methods:{update(){this.form.put(route("contacts.update",this.contact.id))},destroy(){confirm("Are you sure you want to delete this contact?")&&this.$inertia.delete(route("contacts.destroy",this.contact.id))},restore(){confirm("Are you sure you want to restore this contact?")&&this.$inertia.put(route("contacts.restore",this.contact.id))}}},S={class:"max-w-full bg-white rounded-md shadow overflow-hidden"},B={class:"flex flex-wrap -mb-8 -mr-6 p-8"},T=["value"],E=["value"],F={class:"flex items-center px-8 py-4 bg-gray-50 border-t border-gray-100"};function H(t,r,f,N,o,u){const V=d("Head"),n=d("text-input"),b=d("select-input"),g=d("loading-button");return m(),a("div",null,[l(V,{title:f.title},null,8,["title"]),s("div",S,[s("form",{onSubmit:r[10]||(r[10]=_((...e)=>u.update&&u.update(...e),["prevent"]))},[s("div",B,[l(n,{modelValue:o.form.first_name,"onUpdate:modelValue":r[0]||(r[0]=e=>o.form.first_name=e),error:o.form.errors.first_name,class:"pb-8 pr-6 w-full lg:w-1/3",label:t.$t("First name")},null,8,["modelValue","error","label"]),l(n,{modelValue:o.form.last_name,"onUpdate:modelValue":r[1]||(r[1]=e=>o.form.last_name=e),error:o.form.errors.last_name,class:"pb-8 pr-6 w-full lg:w-1/3",label:t.$t("last name")},null,8,["modelValue","error","label"]),l(n,{modelValue:o.form.title,"onUpdate:modelValue":r[2]||(r[2]=e=>o.form.title=e),error:o.form.errors.title,class:"pb-8 pr-6 w-full lg:w-1/3",label:t.$t("Title")},null,8,["modelValue","error","label"]),l(b,{modelValue:o.form.organization_id,"onUpdate:modelValue":r[3]||(r[3]=e=>o.form.organization_id=e),error:o.form.errors.organization_id,class:"pb-8 pr-6 w-full lg:w-1/2",label:t.$t("Organization")},{default:p(()=>[r[11]||(r[11]=s("option",{value:null},null,-1)),(m(!0),a(c,null,y(f.organizations,e=>(m(),a("option",{key:e.id,value:e.id},i(e.name),9,T))),128))]),_:1,__:[11]},8,["modelValue","error","label"]),l(n,{modelValue:o.form.email,"onUpdate:modelValue":r[4]||(r[4]=e=>o.form.email=e),error:o.form.errors.email,class:"pb-8 pr-6 w-full lg:w-1/2",label:t.$t("Email")},null,8,["modelValue","error","label"]),l(n,{modelValue:o.form.phone,"onUpdate:modelValue":r[5]||(r[5]=e=>o.form.phone=e),error:o.form.errors.phone,class:"pb-8 pr-6 w-full lg:w-1/2",label:t.$t("Phone")},null,8,["modelValue","error","label"]),l(n,{modelValue:o.form.address,"onUpdate:modelValue":r[6]||(r[6]=e=>o.form.address=e),error:o.form.errors.address,class:"pb-8 pr-6 w-full lg:w-1/2",label:t.$t("Address")},null,8,["modelValue","error","label"]),l(n,{modelValue:o.form.city,"onUpdate:modelValue":r[7]||(r[7]=e=>o.form.city=e),error:o.form.errors.city,class:"pb-8 pr-6 w-full lg:w-1/2",label:t.$t("City")},null,8,["modelValue","error","label"]),l(b,{modelValue:o.form.country,"onUpdate:modelValue":r[8]||(r[8]=e=>o.form.country=e),error:o.form.errors.country,class:"pb-8 pr-6 w-full lg:w-1/2",label:t.$t("Country")},{default:p(()=>[r[12]||(r[12]=s("option",{value:null},null,-1)),(m(!0),a(c,null,y(f.countries,e=>(m(),a("option",{key:e.id,value:e.id},i(t.$t(e.name)),9,E))),128))]),_:1,__:[12]},8,["modelValue","error","label"])]),s("div",F,[s("button",{class:"text-red-600 hover:underline",tabindex:"-1",type:"button",onClick:r[9]||(r[9]=(...e)=>u.destroy&&u.destroy(...e))},i(t.$t("Delete"))+" "+i(t.$t("Contact")),1),l(g,{loading:o.form.processing,class:"btn-indigo ml-auto",type:"submit"},{default:p(()=>[h(i(t.$t("Update"))+" "+i(t.$t("Contact")),1)]),_:1},8,["loading"])])],32)])])}const q=L(A,[["render",H]]);export{q as default};
