import{a as l,j as e,b as n}from"./BulkImageUpload-DGPbX05r.js";import{A as m}from"./Authenticated-DQno4VYw.js";import{P as u}from"./PageTitle-feHaMeNG.js";import{S as c}from"./sweetalert2.all-CGGHY7K6.js";import{P as x}from"./Pagination-C_2iCAT4.js";import"./bootstrap.esm-e_F80uXB.js";const p=a=>{const[r,o]=l.useState(a.blogs.data),[i,h]=l.useState(a.blogs.links),d=s=>()=>{c.fire({title:"Are you sure want to Delete?",icon:"warning",showCancelButton:!0,confirmButtonText:"Yes, delete!"}).then(t=>{t.isConfirmed&&Inertia.delete(route("blog.destroy",r[s].id),{onSuccess:()=>{r.splice(s,1),o(Array.from(r)),c.fire("Deleted!","Blog Removed Sucessfully","success")}})})};return e.jsxs(m,{auth:a.auth,errors:a.errors,current:a.current,children:[e.jsx(u,{title:"Manage Blog",path:"Blog",pathurl:""}),e.jsx("div",{className:"row",children:r&&r.map((s,t)=>e.jsx("div",{className:"col-md-4 mb-3",children:e.jsxs("div",{className:"card shadow-sm",children:[e.jsx("div",{className:"imgcover p-2 pb-0",children:e.jsx("img",{src:s.resize,className:"card-img-top rounded",alt:"..."})}),e.jsx("div",{className:"card-body border-bottom",children:e.jsx("h6",{className:"card-title fs-6 text-truncate mb-0",children:s.title})}),e.jsxs("div",{className:"card-body text-end",children:[e.jsxs(n,{href:route("blog.edit",s.id),className:"card-link",children:[e.jsx("i",{className:"bi bi-pencil-square"})," Edit"]}),e.jsxs("a",{onClick:d(t),className:"card-link cp",children:[e.jsx("i",{className:"bi bi-trash3"})," Delete"]})]})]})},t))}),i.length===3?"":e.jsx("div",{className:"card-footer border-0",children:e.jsxs("div",{className:"row",children:[e.jsx("div",{className:"col-md-6 pt-2"}),e.jsx("div",{className:"col-md-6",children:e.jsx(x,{links:i})})]})})]})};export{p as default};
