import{s as b,p as e,T as w,h as x,c as _,a as n,b as t,t as o,u as s,w as g,d as y,v as k,F as C,r as P,i as h,e as A,g as $,o as i,n as D,j as I,z as S}from"./app-13978987.js";import{h as T}from"./moment-a9aaa855.js";import{_ as B}from"./NoDataFound-bc81d7fa.js";import M from"./OverviewGrid-21ea6fc2.js";import{_ as j}from"./Paginate-f61b79b2.js";import{_ as F}from"./AdminLayout-bd13ff9d.js";import{_ as V}from"./PageHeader-8c638686.js";import"./dropdown-45d66330.js";const q={class:"container flex-grow p-4 sm:p-6"},z={class:"space-y-6"},E={class:"flex items-center justify-end gap-x-2"},N={class:"dropdown","data-placement":"bottom-end"},L={class:"dropdown-toggle"},O={type:"button",class:"btn bg-white font-medium shadow-sm dark:bg-slate-800"},R={class:"dropdown-content w-72 !overflow-visible"},U={class:"dropdown-list space-y-4 p-4"},Y={class:"dropdown-list-item"},G={class:"my-1 text-sm font-medium"},H={class:"mb-2"},J={class:"dropdown-list-item"},K={type:"submit",class:"btn btn-primary w-full"},Q={class:"table-responsive whitespace-nowrap rounded-primary"},W={class:"table"},X={class:"col-3"},Z={class:"col-1"},tt={class:"col-2"},st={class:"col-1"},et={class:"text-right"},ot={key:0},at={class:"flex"},nt=["src"],lt={class:"text-left"},it={class:"flex justify-end"},ct={class:"dropdown","data-placement":"bottom-start"},dt={class:"dropdown-toggle"},rt={class:"dropdown-content w-40"},_t={class:"dropdown-list"},ut={class:"dropdown-list-item"},mt={class:"dropdown-list-item"},ht=["onClick"],pt=$({layout:F}),Pt=Object.assign(pt,{__name:"Index",props:["posts","totalPosts","totalActivePosts","totalInActivePosts","buttons","type","request"],setup(l){const{textExcerpt:p,deleteRow:f}=b(),d=l,v=[{value:d.totalPosts,title:e("Total Posts"),iconClass:"bx:bar-chart"},{value:d.totalActivePosts,title:e("Total Active Posts"),iconClass:"bx:check-circle"},{value:d.totalInActivePosts,title:e("Total Inactive Posts"),iconClass:"bx:x-circle"}],u=w({search:d.request.search});return(m,r)=>{const c=x("Icon");return i(),_("main",q,[n(V,{title:"Create a blog post",buttons:l.buttons},null,8,["buttons"]),t("div",z,[n(M,{items:v,grid:"3"}),t("div",E,[t("div",N,[t("div",L,[t("button",O,[n(c,{icon:"fe:filter"}),t("span",null,o(s(e)("Filter")),1),n(c,{icon:"bx:chevron-down"})])]),t("div",R,[t("form",{onSubmit:r[1]||(r[1]=g(a=>s(u).get(m.route("admin.blog.index")),["prevent"]))},[t("ul",U,[t("li",Y,[t("h2",G,o(s(e)("Status")),1),t("div",H,[y(t("input",{type:"text",name:"search","onUpdate:modelValue":r[0]||(r[0]=a=>s(u).search=a),class:"input",placeholder:"Search......"},null,512),[[k,s(u).search]])])]),t("li",J,[t("button",K,o(s(e)("Filter")),1)])])],32)])])]),t("div",Q,[t("table",W,[t("thead",null,[t("tr",null,[t("th",X,o(s(e)("Title")),1),t("th",Z,o(s(e)("Status")),1),t("th",tt,o(s(e)("Created At")),1),t("th",st,[t("div",et,o(s(e)("Action")),1)])])]),l.posts.data!=0?(i(),_("tbody",ot,[(i(!0),_(C,null,P(l.posts.data,a=>(i(),_("tr",{key:a.id},[t("td",at,[t("img",{src:a.preview.value,class:"avatar rounded-square mr-3"},null,8,nt),t("p",null,o(s(p)(a.title,80)),1)]),t("td",lt,[t("span",{class:D(["badge",a.status==1?"badge-success":"badge-danger"])},o(a.status==1?s(e)("Active"):s(e)("Draft")),3)]),t("td",null,o(s(T)(a.created_at).format("D-MMM-Y")),1),t("td",null,[t("div",it,[t("div",ct,[t("div",dt,[n(c,{class:"text-2xl",icon:"bx:dots-horizontal-rounded"})]),t("div",rt,[t("ul",_t,[t("li",ut,[n(s(S),{href:m.route("admin.blog.edit",a.id),class:"dropdown-link"},{default:I(()=>[n(c,{icon:"fe:edit"}),t("span",null,o(s(e)("Edit")),1)]),_:2},1032,["href"])]),t("li",mt,[t("button",{class:"dropdown-link",onClick:ft=>s(f)(m.route("admin.blog.destroy",a.slug),s(e)("Blog has been deleted successfully"))},[n(c,{icon:"fe:trash"}),t("span",null,o(s(e)("Delete")),1)],8,ht)])])])])])])]))),128))])):(i(),h(B,{key:1,"for-table":"true"}))]),l.posts.data.length!=0?(i(),h(j,{key:0,links:l.posts.links},null,8,["links"])):A("",!0)])])])}}});export{Pt as default};
