import{a,j as e,y as h}from"./BulkImageUpload-DGPbX05r.js";import{A as x}from"./Authenticated-DQno4VYw.js";import{P as j}from"./PageTitle-feHaMeNG.js";import{P as u}from"./Panel-CCKAj23D.js";import{P as f}from"./Pagination-C_2iCAT4.js";import{S as l}from"./sweetalert2.all-CGGHY7K6.js";import"./bootstrap.esm-e_F80uXB.js";const p=t=>{const[i,c]=a.useState(t.messages.data),[n,g]=a.useState(t.messages.links);a.useState("");const d=s=>()=>{l.fire({title:"Are you sure want to Delete?",icon:"warning",showCancelButton:!0,confirmButtonText:"Yes, delete!"}).then(r=>{r.isConfirmed&&h.delete(route("message.destroy",s),{onSuccess:()=>{c(m=>m.filter(o=>o.id!=s)),l.fire("Deleted!","Message Removed Successfully","success")},preserveState:!0})})};return e.jsxs(x,{auth:t.auth,errors:t.errors,current:t.current,children:[e.jsx(j,{title:"View Messages",path:"",pathurl:""}),e.jsxs(u,{title:"View Messages",md:"12",children:[e.jsx("div",{className:"table-responsive-md",children:e.jsx("table",{className:"table mb-0",children:e.jsxs("tbody",{children:[e.jsxs("tr",{children:[e.jsx("th",{className:"text-center",children:"#"}),e.jsx("th",{children:"Full Name"}),e.jsx("th",{children:"Mobile Number"}),e.jsx("th",{children:"Email Address"}),e.jsx("th",{children:"Message"}),e.jsx("th",{children:"Action"})]}),i&&i.map((s,r)=>e.jsxs("tr",{children:[e.jsx("td",{className:"center",children:r+t.messages.from}),e.jsx("td",{children:s.name}),e.jsx("td",{children:s.mobile}),e.jsx("td",{children:s.email}),e.jsxs("td",{children:[s.message," "]}),e.jsx("td",{className:"acn",children:e.jsxs("button",{onClick:d(s.id),className:"btn btn-sm btn-danger",children:[e.jsx("i",{className:"bi bi-trash"})," Delete"]})})]},r))]})})}),n.length===3?"":e.jsx("div",{className:"card-footer",children:e.jsxs("div",{className:"row",children:[e.jsx("div",{className:"col-md-6 pt-2"}),e.jsx("div",{className:"col-md-6 d-flex justify-content-end",children:e.jsx(f,{links:n})})]})})]})]})};export{p as default};
