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