import{c as v,b as w,r as o,j as t,i as k,n as a}from"./index-7c7a558c.js";import{B as j}from"./Breadcrumb-f4cb0f42.js";import{v as N}from"./adminCommonApi-0dc9ea8e.js";const E=()=>{const l=v(),{isLoading:r,mutate:y}=w(N,{onSuccess:()=>{a.success("Successfully saved!"),d(""),u("")},onError:e=>{var s,p,f,m,g,b,x,h;(p=(s=e==null?void 0:e.response)==null?void 0:s.data)!=null&&p.error?a.error((m=(f=e==null?void 0:e.response)==null?void 0:f.data)==null?void 0:m.error):(b=(g=e==null?void 0:e.response)==null?void 0:g.data)!=null&&b.message?a.error((h=(x=e==null?void 0:e.response)==null?void 0:x.data)==null?void 0:h.message):a.error("something went wrong!")}}),[n,u]=o.useState(""),[i,d]=o.useState("");o.useEffect(()=>{const e=localStorage.getItem("token"),s=localStorage.getItem("user");e&&s||l("/login")},[l]);const _=e=>{e.preventDefault(),r||y({formdata:{counsellor_id:n,user_id:i}})};let c=null;return c=t.jsxs("form",{className:"p-5",onSubmit:_,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:n,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:"Counsellor 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:i,onChange:e=>d(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:r?t.jsx(k,{color:"white",size:"lg",variant:"dots"}):"Submit"})]}),t.jsxs(t.Fragment,{children:[t.jsx(j,{title:"Counsellor 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{E as default};
