import{I as x}from"./moment-BywspGD9.js";import{S as y,t as w,p as k}from"./SearchInput-C5NjNnwl.js";import{L as v}from"./Layout-DIVdUaBZ.js";import{m as V}from"./mapValues-BykAXOI1.js";import{P as I}from"./Pagination-MejnxKj7.js";import{i as L,Z as B,r as i,c as d,a as o,b as t,w as n,t as a,F as C,j as N,h as S,o as c,e as p}from"./app-CK3cEAAe.js";import{_ as $}from"./FlashMessages-ByEdcHWZ.js";const j={metaInfo:{title:"Blog posts"},components:{Icon:x,Pagination:I,SearchInput:y,Link:L,Head:B},layout:v,props:{filters:Object,posts:Object,title:String},data(){return{form:{search:this.filters.search}}},watch:{form:{deep:!0,handler:w(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,h,l,M,f,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:f.form.search,"onUpdate:modelValue":h[0]||(h[0]=s=>f.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(C,null,N(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"})]),_:2},1032,["href"])])]))),128)),l.posts.data.length===0?(c(),d("tr",G,[t("td",J,a(e.$t("No post base found.")),1)])):S("",!0)])])]),o(g,{class:"mt-6",links:l.posts.links},null,8,["links"])])}const ot=$(j,[["render",K]]);export{ot as default};
