import{c as f,b as h,r as l,j as a,n as d}from"./index-7c7a558c.js";import{B as x}from"./Breadcrumb-2eb871e0.js";import{d as k}from"./trainerApi-cc9df6e9.js";function p(){const i=f(),{mutate:m,isLoading:u}=h(k,{onSuccess:e=>{var t,r;(t=e==null?void 0:e.data)!=null&&t.success&&d.success((r=e==null?void 0:e.data)==null?void 0:r.success)},onError:e=>{var t,r,n,o;(r=(t=e==null?void 0:e.response)==null?void 0:t.data)!=null&&r.error?d.error((o=(n=e==null?void 0:e.response)==null?void 0:n.data)==null?void 0:o.error):d.error("something went wrong")}});l.useEffect(()=>{const e=localStorage.getItem("token"),t=localStorage.getItem("user");e&&t||i("/login")},[i]);const[s,c]=l.useState({id_number:""}),b=()=>s.id_number?!1:(d.error("Id Number is required"),!0),g=async e=>{e.preventDefault(),!b()&&!u&&m({formdata:s})};return a.jsx(a.Fragment,{children:a.jsxs(a.Fragment,{children:[a.jsx(x,{title:"Change Team Leader"}),a.jsx("div",{className:"my-12 h-screen",children:a.jsx("div",{className:"relative overflow-x-auto shadow-md sm:rounded-lg bg-white dark:bg-gray-900 p-2",children:a.jsxs("form",{className:"p-5",onSubmit:g,children:[a.jsxs("div",{className:"mb-6",children:[a.jsx("label",{htmlFor:"id_number",className:"block mb-2 text-sm font-medium text-gray-900 dark:text-white",children:"Team Leader ID"}),a.jsx("input",{value:s.id_number,onChange:e=>c({...s,id_number:e.target.value}),type:"number",step:"any",id:"id_number",className:"shadow-sm bg-gray-50 border 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 dark:shadow-sm-light  border-gray-300",required:!0})]}),a.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 px-5 py-2.5 text-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800",disabled:u,children:u?"Submitting...":"Submit"})]})})})]})})}export{p as default};
