import{r as d,o as k,b as y,j as e,M as j,n as a}from"./index-7c7a558c.js";import{p as v}from"./withdrawApi-ab06adf3.js";function C({refetchFn:g,withdrawId:b}){const[n,f]=d.useState(!1),[m,x]=d.useState(""),[p,{open:h,close:o}]=k(!1),{isLoading:r,mutate:w}=y(v,{onSuccess:()=>{o(),g(),a.dismiss(),a.success("Successfully status updated!")},onError:t=>{var s,u,i,c;a.dismiss(),(u=(s=t==null?void 0:t.response)==null?void 0:s.data)!=null&&u.error?a.error((c=(i=t==null?void 0:t.response)==null?void 0:i.data)==null?void 0:c.error):a.error("something went wrong. Please try again")}}),l=(t,s)=>{t.preventDefault(),r||w({formdata:{uuid:b,status:s,note:m}}),f(s)};return e.jsxs(e.Fragment,{children:[e.jsx(j,{opened:p,onClose:o,title:"Update Withdrawal Status",centered:!0,classNames:{content:"bg-gray-900 text-white",header:"bg-gray-900 text-white"},children:e.jsxs("div",{className:"my-6",children:[e.jsxs("div",{className:"relative z-0 w-full mb-6 group",children:[e.jsx("textarea",{name:"floating_note",id:"floating_note",className:"block py-2.5 px-0 w-full text-sm text-gray-900 bg-transparent border-0 border-b-2 border-gray-300 appearance-none dark:text-white dark:border-gray-600 dark:focus:border-blue-500 focus:outline-none focus:ring-0 focus:border-blue-600",placeholder:"",onChange:t=>x(t.target.value),required:!0}),e.jsx("label",{htmlFor:"floating_note",className:"peer-focus:font-medium absolute text-sm text-gray-500 dark:text-gray-400 duration-300 transform -translate-y-6 scale-75 top-3 -z-10 origin-[0] peer-focus:left-0 peer-focus:text-blue-600 peer-focus:dark:text-blue-500 peer-placeholder-shown:scale-100 peer-placeholder-shown:translate-y-0 peer-focus:scale-75 peer-focus:-translate-y-6",children:"Note"})]}),e.jsxs("div",{className:"flex gap-4 my-4",children:[e.jsx("button",{className:"text-white bg-amber-500 hover:bg-amber-600 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:focus:ring-blue-800",onClick:t=>l(t,1),children:r&&n==1?"Approving...":"Approve"}),e.jsx("button",{className:"text-white bg-orange-600 hover:bg-orange-700 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:focus:ring-blue-800",onClick:t=>l(t,2),children:r&&n==2?"Rejecting...":"Reject"}),e.jsx("button",{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:o,children:"Cancel"})]})]})}),e.jsx("button",{onClick:h,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 sm:w-auto px-5 py-2.5 text-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800",children:e.jsxs("svg",{className:"w-3 h-3 text-white dark:text-white","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 20 18",children:[e.jsx("path",{d:"M12.687 14.408a3.01 3.01 0 0 1-1.533.821l-3.566.713a3 3 0 0 1-3.53-3.53l.713-3.566a3.01 3.01 0 0 1 .821-1.533L10.905 2H2.167A2.169 2.169 0 0 0 0 4.167v11.666A2.169 2.169 0 0 0 2.167 18h11.666A2.169 2.169 0 0 0 16 15.833V11.1l-3.313 3.308Zm5.53-9.065.546-.546a2.518 2.518 0 0 0 0-3.56 2.576 2.576 0 0 0-3.559 0l-.547.547 3.56 3.56Z"}),e.jsx("path",{d:"M13.243 3.2 7.359 9.081a.5.5 0 0 0-.136.256L6.51 12.9a.5.5 0 0 0 .59.59l3.566-.713a.5.5 0 0 0 .255-.136L16.8 6.757 13.243 3.2Z"})]})})]})}export{C as S};
