import{r as k,o as w,b as y,j as e,M as j,n as o}from"./index-7c7a558c.js";function N({refetchFn:u,Id:d,mutationFn:b,currentStatus:t}){const[g,f]=k.useState(""),[p,{open:m,close:a}]=w(!1),{isLoading:n,mutate:x}=y(b,{onSuccess:()=>{a(),u(),o.success("Successfully balance updated!")},onError:s=>{var l,r,c,i;(r=(l=s==null?void 0:s.response)==null?void 0:l.data)!=null&&r.error?o.error((i=(c=s==null?void 0:s.response)==null?void 0:c.data)==null?void 0:i.error):o.error("something went wrong. Please try again")}}),h=s=>{s.preventDefault(),o.dismiss(),n||x({Id:d,formdata:{is_lock:t=="1"?"0":"1",description:g}})};return e.jsxs(e.Fragment,{children:[e.jsx(j,{opened:p,onClose:a,title:"Update Balance",centered:!0,classNames:{content:"bg-gray-900 text-white",header:"bg-gray-900 text-white"},children:e.jsxs("div",{className:"my-6",children:[e.jsx("div",{className:"relative z-0 w-full mb-6 group",children:e.jsxs("p",{children:["Lock Status: ",t=="1"?"Locked":"Unlocked"]})}),e.jsxs("div",{className:"relative z-0 w-full mb-6 group",children:[e.jsx("textarea",{name:"floating_description",id:"floating_description",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:s=>f(s.target.value)}),e.jsx("label",{htmlFor:"floating_description",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:"Description"})]}),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:s=>h(s),children:t==1?n?"Unlocking...":"Unlock":n?"Locking...":"Lock"}),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:a,children:"Cancel"})]})]})}),e.jsx("button",{onClick:m,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:t=="1"?"Unlock":"Lock"})]})}export{N as U};
