import{i as g,Z as w,r as i,c as l,o as c,a as o,b as e,w as n,t as a,f as p,F as k,j as v,e as h}from"./app-BLo7SiiE.js";import{I as V}from"./moment-C7JtfGJw.js";import{t as N,S as L,p as C}from"./SearchInput-BQxs0-MZ.js";import{L as S}from"./Layout-BEAmuehS.js";import{m as $}from"./mapValues-BsTqcYnb.js";import{P as j}from"./Pagination-Bj-Q2plQ.js";import{_ as B}from"./FlashMessages-DImpr6PL.js";const I={components:{SearchInput:L,Head:w,Icon:V,Link:g,Pagination:j},layout:S,props:{filters:Object,contacts:Object,title:String},data(){return{form:{search:this.filters.search}}},watch:{form:{deep:!0,handler:N(function(){this.$inertia.get(this.route("contacts"),C(this.form),{preserveState:!0})},150)}},created(){},methods:{reset(){this.form=$(this.form,()=>null)}}},H={class:"flex items-center justify-between mb-6"},P={class:"bg-white rounded-md shadow overflow-x-auto"},E={class:"w-full whitespace-nowrap"},F={class:"text-left font-bold"},O={class:"pb-4 pt-6 px-6"},R={class:"pb-4 pt-6 px-6"},D={class:"pb-4 pt-6 px-6"},T={class:"pb-4 pt-6 px-6",colspan:"2"},U={class:"border-t"},Z={class:"border-t"},q={key:0},z={class:"border-t"},A={class:"border-t"},G={class:"w-px border-t"},J={key:0},K={class:"px-6 py-4 border-t",colspan:"4"};function M(t,f,d,Q,m,u){const _=i("Head"),b=i("search-input"),r=i("Link"),y=i("icon"),x=i("pagination");return c(),l("div",null,[o(_,{title:t.$t(d.title)},null,8,["title"]),e("div",H,[o(b,{modelValue:m.form.search,"onUpdate:modelValue":f[0]||(f[0]=s=>m.form.search=s),class:"mr-4 w-full max-w-md",onReset:u.reset},null,8,["modelValue","onReset"]),o(r,{class:"btn-indigo",href:t.route("contacts.create")},{default:n(()=>[e("span",null,a(t.$t("Create New")),1)]),_:1},8,["href"])]),e("div",P,[e("table",E,[e("tbody",null,[e("tr",F,[e("th",O,a(t.$t("Name")),1),e("th",R,a(t.$t("Email")),1),e("th",D,a(t.$t("City")),1),e("th",T,a(t.$t("Phone")),1)]),(c(!0),l(k,null,v(d.contacts.data,s=>(c(),l("tr",{key:s.id,class:"hover:bg-gray-100 focus-within:bg-gray-100"},[e("td",U,[o(r,{class:"flex items-center px-6 py-4 focus:text-indigo-500",href:t.route("contacts.edit",s.id)},{default:n(()=>[h(a(s.name),1)]),_:2},1032,["href"])]),e("td",Z,[o(r,{class:"flex items-center px-6 py-4",href:t.route("contacts.edit",s.id),tabindex:"-1"},{default:n(()=>[s.email?(c(),l("div",q,a(s.email),1)):p("",!0)]),_:2},1032,["href"])]),e("td",z,[o(r,{class:"flex items-center px-6 py-4",href:t.route("contacts.edit",s.id),tabindex:"-1"},{default:n(()=>[h(a(s.city),1)]),_:2},1032,["href"])]),e("td",A,[o(r,{class:"flex items-center px-6 py-4",href:t.route("contacts.edit",s.id),tabindex:"-1"},{default:n(()=>[h(a(s.phone),1)]),_:2},1032,["href"])]),e("td",G,[o(r,{class:"flex items-center px-4",href:t.route("contacts.edit",s.id),tabindex:"-1"},{default:n(()=>[o(y,{name:"cheveron-right",class:"block w-6 h-6 fill-gray-400"})]),_:2},1032,["href"])])]))),128)),d.contacts.data.length===0?(c(),l("tr",J,[e("td",K,a(t.$t("No contacts found.")),1)])):p("",!0)])])]),o(x,{class:"mt-6",links:d.contacts.links},null,8,["links"])])}const ae=B(I,[["render",M]]);export{ae as default};
