import{o as f,b as p,j as e,M as w,n as t}from"./index-7c7a558c.js";import{G as v}from"./Group-801c960a.js";function k({buttonText:r,className:u,mutationFn:c,refetchFn:d,deleteId:g}){const[h,{open:m,close:n}]=f(!1),{isLoading:b,mutate:x}=p(c,{onSuccess:()=>{n(),d(),t.dismiss(),t.success("Successfully deleted!")},onError:s=>{var o,a,l,i;t.dismiss(),(a=(o=s==null?void 0:s.response)==null?void 0:o.data)!=null&&a.error?t.error((i=(l=s==null?void 0:s.response)==null?void 0:l.data)==null?void 0:i.error):t.error("something went wrong. Please try again")}});return e.jsxs(e.Fragment,{children:[e.jsxs(w,{opened:h,onClose:n,title:"Confirmation",centered:!0,classNames:{content:"bg-gray-900 text-white",header:"bg-gray-900 text-white"},children:[e.jsx("p",{children:"Are you sure you want to delete this item?"}),e.jsxs("div",{className:"flex gap-4 my-4",children:[e.jsx("button",{type:"submit",className:"text-white bg-orange-500 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm w-full sm:w-auto px-5 py-2.5 text-center dark:bg-orange-500 dark:hover:bg-orange-500 dark:focus:ring-blue-800",onClick:()=>x(g),children:b?"Deleting...":"Delete"}),e.jsx("button",{type:"submit",className:"text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm w-full sm:w-auto px-5 py-2.5 text-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800",onClick:n,children:"Cancel"})]})]}),e.jsx(v,{position:"center",children:e.jsx("button",{onClick:m,className:u,children:r})})]})}function M(){return e.jsxs("svg",{style:{color:"red"},xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"currentColor",className:"bi bi-trash",viewBox:"0 0 16 16",children:[" ",e.jsx("path",{d:"M5.5 5.5A.5.5 0 0 1 6 6v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5zm2.5 0a.5.5 0 0 1 .5.5v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5zm3 .5a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0V6z",fill:"red"})," ",e.jsx("path",{fillRule:"evenodd",d:"M14.5 3a1 1 0 0 1-1 1H13v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V4h-.5a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1H6a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1h3.5a1 1 0 0 1 1 1v1zM4.118 4 4 4.059V13a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1V4.059L11.882 4H4.118zM2.5 3V2h11v1h-11z",fill:"red"})," "]})}export{k as D,M as T};
