import{a as i,W as u,j as s}from"./BulkImageUpload-DGPbX05r.js";import{P as h}from"./Panel-CCKAj23D.js";import{I as j}from"./Input-CR3dcIBA.js";import{S as o}from"./sweetalert2.all-CGGHY7K6.js";import"./bootstrap.esm-e_F80uXB.js";const w=({err:r,success:l})=>{const[t,v]=i.useState(""),{data:N,setData:c,post:m,put:b,processing:g,errors:a,clearErrors:n,reset:d}=u({category_id:"",file:""});i.useEffect(()=>{r[0]&&o.fire("Import Failed !",r[0],"error")},[r]);const p=e=>{c("file",e.target.files[0]),n(e.target.name)},f=e=>{e.preventDefault(),m(route("upload-bulk-business"),{onSuccess:()=>{d(),o.fire("Saved Successfully!","","success")},preserveState:x=>Object.keys(x.props.errors).length})};return s.jsxs(h,{title:"Bulk Business Import",md:"12",children:[s.jsxs("div",{className:"div p-3 pb-0",children:[t[0]?s.jsxs("div",{className:"alert mb-0 alert-danger",role:"alert",children:[t[0]," "]}):"",l?s.jsxs("div",{className:"alert mb-0 alert-success",role:"alert",children:[l," "]}):""]}),s.jsxs("form",{className:"p-4",onSubmit:f,children:[s.jsxs("div",{className:"form-group pt-2 row",children:[s.jsxs("div",{className:"col-sm-4",children:[s.jsx("label",{htmlFor:"",children:"Select Import File"}),s.jsx("span",{className:"form-indicat",children:":"})]}),s.jsxs("div",{className:"col-sm-8 sticky",children:[s.jsx(j,{type:"file",className:a.file&&"is-invalid",name:"file",handleChange:p}),a.file&&s.jsx("div",{className:"smart-valid",children:a.file})]})]}),s.jsxs("div",{className:"form-group  row",children:[s.jsx("div",{className:"col-sm-4"}),s.jsxs("div",{className:"col-sm-8 sticky",children:[s.jsx("button",{className:"btn fs-9 fw-bold  btn-primary",children:"Upload Data"}),s.jsx("a",{target:"_self",href:"../storage/listing.xlsx",className:"float-end text-primary pt-2",children:"Download Sample"})]})]})]})]})};export{w as default};
