import{a as r,j as e,y as j}from"./BulkImageUpload-DGPbX05r.js";import{A as u}from"./Authenticated-DQno4VYw.js";import{P as g}from"./PageTitle-feHaMeNG.js";import{P as f}from"./Panel-CCKAj23D.js";import{P as N}from"./Pagination-C_2iCAT4.js";import{S as c}from"./sweetalert2.all-CGGHY7K6.js";import"./bootstrap.esm-e_F80uXB.js";const k=t=>{const[a,l]=r.useState(t.listing.data),[n,b]=r.useState(t.listing.links),[d,m]=r.useState("");r.useEffect(()=>{t.listing.links&&t.listing.links.map(s=>{s.active&&m(parseInt(s.label))})},[t.listing]);const h=s=>()=>{c.fire({title:"Are you sure want to Restore?",icon:"warning",showCancelButton:!0,confirmButtonText:"Yes, Restore!"}).then(i=>{i.isConfirmed&&j.delete(route("restore-listing",s),{onSuccess:()=>{l(x=>x.filter(o=>o.id!=s)),c.fire("Restored!","Business Restored Successfully","success")},preserveState:!0})})};return e.jsxs(u,{auth:t.auth,errors:t.errors,current:t.current,children:[e.jsx(g,{title:"View Trashed Listing",path:"Trashed",pathurl:""}),e.jsxs(f,{title:"Manage Trashed Listing",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:"slno text-center",children:"#"}),e.jsx("th",{children:"Image"}),e.jsx("th",{children:"Business Name"}),e.jsx("th",{children:"User"}),e.jsx("th",{className:"center",children:"Featured"}),e.jsx("th",{className:"center",children:"City"}),e.jsx("th",{className:"center",children:"Active Plan"}),e.jsx("th",{className:"center",children:"Rating"}),e.jsx("th",{className:"text-center",children:"Action"})]}),a&&a.map((s,i)=>e.jsxs("tr",{children:[e.jsx("td",{children:i+d*t.listing.per_page-1}),e.jsx("td",{style:{maxWidth:"80px"},children:e.jsx("img",{style:{width:"50px"},src:s.image,alt:""})}),e.jsxs("td",{children:[s.business_name," ",e.jsx("br",{}),e.jsx("small",{children:s.email})]}),e.jsx("td",{children:s.user}),e.jsx("td",{className:"center",children:s.featured==0?e.jsx("i",{className:"bi text-primary fs-4 bi-toggle-off"}):e.jsx("i",{className:"bi text-primary fs-4 bi-toggle-on"})}),e.jsx("td",{className:"center",children:s.city}),e.jsx("td",{className:"center",children:s.plan}),e.jsxs("td",{className:"center",children:[s.rating?s.rating:"No"," Star"]}),e.jsx("td",{className:"text-center",children:e.jsxs("button",{onClick:h(s.id),className:"btn btn-danger me-2 btn-xs",children:[e.jsx("i",{className:"bi bi-recycle"})," Restore"]})})]},i))]})})}),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",children:e.jsx(N,{links:n})})]})})]})]})};export{k as default};
