import{c as B,a as q,b as A,r as L,j as e,i as C,n as l}from"./index-7c7a558c.js";import{B as Q}from"./Breadcrumb-f4cb0f42.js";import{p as R}from"./settingsApi-5a4df441.js";import{u as T}from"./adminCommonApi-0dc9ea8e.js";const K=()=>{var i,u,m,p,g,b,x,f,h,y,j;const o=B(),{data:a,isLoading:E,refetch:I}=q("getFirstCounsellorDetails",T),{isLoading:r,mutate:z}=A(R,{onSuccess:()=>{l.success("Successfully saved!"),d(""),I()},onError:s=>{var t,N,k,v,_,w,S,F;(N=(t=s==null?void 0:s.response)==null?void 0:t.data)!=null&&N.error?l.error((v=(k=s==null?void 0:s.response)==null?void 0:k.data)==null?void 0:v.error):(w=(_=s==null?void 0:s.response)==null?void 0:_.data)!=null&&w.message?l.error((F=(S=s==null?void 0:s.response)==null?void 0:S.data)==null?void 0:F.message):l.error("something went wrong!")}}),[n,d]=L.useState("");L.useEffect(()=>{const s=localStorage.getItem("token"),t=localStorage.getItem("user");s&&t||o("/login")},[o]);const M=s=>{s.preventDefault(),r||z({formdata:{first_counsellor_id:n}})};let c=null;return c=e.jsxs("form",{className:"p-5",onSubmit:M,children:[e.jsxs("div",{className:"relative z-0 w-full mb-6 group",children:[e.jsx("input",{type:"number",name:"floating_first_counsellor_id",id:"floating_first_counsellor_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:s=>d(s.target.value),required:!0}),e.jsx("label",{htmlFor:"floating_first_counsellor_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"})]}),e.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?e.jsx(C,{color:"white",size:"lg",variant:"dots"}):"Submit"})]}),e.jsxs(e.Fragment,{children:[e.jsx(Q,{title:"First Counsellor Map"}),e.jsxs("div",{className:"my-12",children:[E?e.jsx("p",{className:"my-5 text-black dark:text-white",children:"Loading..."}):(u=(i=a==null?void 0:a.data)==null?void 0:i.data)!=null&&u.counsellor?e.jsxs("div",{className:"my-5 text-black dark:text-white",children:[e.jsx("h1",{className:"p-4",children:"First Counsellor Details"}),e.jsxs("div",{className:"p-4",children:[e.jsxs("p",{className:"my-4 border border-1 p-2",children:["Name: ",(g=(p=(m=a==null?void 0:a.data)==null?void 0:m.data)==null?void 0:p.counsellor)==null?void 0:g.name]}),e.jsxs("p",{className:"my-4 border border-1 p-2",children:["ID:"," ",(f=(x=(b=a==null?void 0:a.data)==null?void 0:b.data)==null?void 0:x.counsellor)==null?void 0:f.referral_code]}),e.jsxs("p",{className:"my-4 border border-1 p-2",children:["Total Student Assigned:"," ",(j=(y=(h=a==null?void 0:a.data)==null?void 0:h.data)==null?void 0:y.total_members_assigned)==null?void 0:j.length]})]})]}):e.jsx("p",{className:"my-5 text-black dark:text-white",children:"No Counsellor assigned yet!"}),e.jsx("div",{className:"relative overflow-x-auto shadow-md sm:rounded-lg section-bg p-2",children:c})]})]})};export{K as default};
