import{a as t,W as f,j as e,b as c}from"./BulkImageUpload-DGPbX05r.js";import{I as b}from"./Input-CR3dcIBA.js";import{U as N}from"./User-DMCQU0ZG.js";import y from"./TabLink-DQDfvC1b.js";import{S as d}from"./sweetalert2.all-CGGHY7K6.js";import w from"./Path-BGQq4Hlj.js";import"./bootstrap.esm-e_F80uXB.js";const F=l=>{const[o,S]=t.useState("gallery"),[n,k]=t.useState(""),[m,D]=t.useState(l.lid),[i,I]=t.useState(l.gallery),{data:C,setData:h,post:x,processing:u,errors:r,reset:G,clearErrors:A,delete:j}=f({image:"",lid:l.lid}),p=s=>{h(s.target.name,s.target.files[0])},g=s=>{s.preventDefault(),x(route("gallery.store"),{preserveState:a=>Object.keys(a.props.errors).length})},v=s=>()=>{d.fire({title:"Are you sure want to Delete?",icon:"warning",showCancelButton:!0,confirmButtonText:"Yes, delete!"}).then(a=>{a.isConfirmed&&j(route("gallery.destroy",i[s].id),{onSuccess:()=>{d.fire("Deleted!","Image Removed Sucessfully","success")},preserveState:!1})})};return e.jsxs(N,{children:[e.jsx(w,{title:"Business Gallery"}),e.jsx("div",{className:"container",children:e.jsx("div",{className:"row new-listing",children:e.jsx("div",{className:"col-md-10 p-0 listing-col mx-auto",children:e.jsxs("div",{className:"card shadow text-center",children:[e.jsx("div",{className:"card-header p-0",children:e.jsx(y,{active:o,typ:n,lid:m})}),e.jsx("div",{className:"card-body tab-content p-0",children:e.jsxs("div",{className:"form-container ",children:[r.limit&&e.jsxs("div",{className:"alert mb-4 alert-danger",role:"alert",children:["You reached your Maximum Limit",e.jsx(c,{className:"fw-bolder text-decoration-underline",href:route("choos-package"),children:" Upgrade your plan "}),"to add more"]}),e.jsxs("div",{className:"row form-row",children:[e.jsx("form",{onSubmit:g,children:e.jsxs("div",{className:"row form-row",children:[e.jsxs("div",{className:"col-md-4",children:[e.jsx(b,{type:"file",className:r.image&&"inerror",name:"image",handleChange:p}),r.image&&e.jsx("div",{className:"smart-valid",children:r.image})]}),e.jsx("div",{className:"col-md-2",children:e.jsx("button",{disabled:u,type:"submit",className:"btn btn-primary",children:"Add Image"})})]})}),e.jsx("div",{className:"row pb-1",children:i&&i.map((s,a)=>e.jsxs("div",{className:"col-md-2 mb-4",children:[e.jsx("div",{className:"img-cover",children:e.jsx("img",{src:s.image,alt:""})}),e.jsx("button",{onClick:v(a),className:"btn btn-danger w-100 btn-sm",children:"Remove"})]},a))})]})]})}),e.jsx("div",{className:"card-footer text-muted",children:e.jsxs("div",{className:"row",children:[e.jsx("div",{className:"col-md-6 pt-2 left",children:e.jsx("p",{children:"Step 6 of 7"})}),e.jsx("div",{className:"col-md-6 right",children:e.jsx(c,{href:route("user-dashboard"),children:e.jsx("button",{className:"btn  btn-light",children:"Skip and Go to Dashboard"})})})]})})]})})})})]})};export{F as default};
