import{r as y,o as j,b as v,j as t,M as k,n as s}from"./index-7c7a558c.js";import{e as N}from"./studentApi-784cfec0.js";function C({studentID:d,buttonText:c,refetchFn:g,selectedZone:b}){const[n,m]=y.useState(b),[f,{open:x,close:i}]=j(!1),{isLoading:l,mutate:h}=v(N,{onSuccess:e=>{var a,o;(a=e==null?void 0:e.data)!=null&&a.success&&(s.success((o=e==null?void 0:e.data)==null?void 0:o.success),g(),i())},onError:e=>{var a,o,r,u;(o=(a=e==null?void 0:e.response)==null?void 0:a.data)!=null&&o.error?s.error((u=(r=e==null?void 0:e.response)==null?void 0:r.data)==null?void 0:u.error):s.error("something went wrong")}}),p=e=>{if(e.preventDefault(),s.dismiss(),!n)return s.error("Type field is required"),!1;l||h({formdata:{id:d,status:n}})};return t.jsxs(t.Fragment,{children:[t.jsx(k,{opened:f,onClose:i,title:"Update Zone",centered:!0,classNames:{content:"bg-gray-900 text-white",header:"bg-gray-900 text-white"},children:t.jsxs("div",{className:"my-10",children:[t.jsx("div",{className:"relative z-0 w-full mb-6 group",children:t.jsxs("select",{name:"floating_zone_type",id:"floating_zone_type",className:"bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500",placeholder:"",value:n||"",onChange:e=>m(e.target.value),required:!0,children:[t.jsx("option",{value:"",children:"Select Zone Type"}),t.jsx("option",{value:"Whatsapp Number Wrong",children:"Whatsapp Number Wrong"}),t.jsx("option",{value:"Not Yet Paid",children:"Not Yet Paid"}),t.jsx("option",{value:"No activity since joining",children:"No activity since joining"}),t.jsx("option",{value:"Counsellor Messaged",children:"Counsellor Messaged"})]})}),t.jsx("div",{className:"flex gap-4 my-4",children:t.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:e=>p(e),children:l?"Updating...":"Update"})})]})}),t.jsx("button",{onClick:x,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 px-5 py-2.5 text-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800",children:c})]})}export{C as S};
