import{c as w,b as k,r,j as t,i as v,n as s}from"./index-7c7a558c.js";import{B as j}from"./Breadcrumb-f4cb0f42.js";import{n as S}from"./studentApi-784cfec0.js";const I=()=>{const n=w(),{isLoading:o,mutate:_}=k(S,{onSuccess:()=>{s.success("Successfully saved!"),u(""),i("")},onError:e=>{var a,p,m,f,b,g,x,h;(p=(a=e==null?void 0:e.response)==null?void 0:a.data)!=null&&p.error?s.error((f=(m=e==null?void 0:e.response)==null?void 0:m.data)==null?void 0:f.error):(g=(b=e==null?void 0:e.response)==null?void 0:b.data)!=null&&g.message?s.error((h=(x=e==null?void 0:e.response)==null?void 0:x.data)==null?void 0:h.message):s.error("something went wrong!")}}),[l,u]=r.useState(""),[d,i]=r.useState("");r.useEffect(()=>{const e=localStorage.getItem("token"),a=localStorage.getItem("user");e&&a||n("/login")},[n]);const y=e=>{e.preventDefault(),o||_({formdata:{instructor_id_number:l,student_id_number:d}})};let c=null;return c=t.jsxs("form",{className:"p-5",onSubmit:y,children:[t.jsxs("div",{className:"relative z-0 w-full mb-6 group",children:[t.jsx("input",{type:"number",name:"floating_trainer_id",id:"floating_trainer_id",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:"",defaultValue:l,onChange:e=>u(e.target.value),required:!0}),t.jsx("label",{htmlFor:"floating_trainer_id",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:"Trainer ID"})]}),t.jsxs("div",{className:"relative z-0 w-full mb-6 group",children:[t.jsx("input",{type:"text",name:"floating_role_student_id",id:"floating_role_student_id",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:"",defaultValue:d,onChange:e=>i(e.target.value),required:!0}),t.jsx("label",{htmlFor:"floating_role_student_id",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:"Student ID"})]}),t.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",children:o?t.jsx(v,{color:"white",size:"lg",variant:"dots"}):"Submit"})]}),t.jsxs(t.Fragment,{children:[t.jsx(j,{title:"Student Map"}),t.jsx("div",{className:"my-12",children:t.jsx("div",{className:"relative overflow-x-auto shadow-md sm:rounded-lg section-bg p-2",children:c})})]})};export{I as default};
