import{r as b,a as W,c as q,j as a,v as B,i as J,n as A}from"./index-7c7a558c.js";import{B as G}from"./Breadcrumb-f4cb0f42.js";import{a as H}from"./gmeetApi-2aebdc2b.js";const V=()=>{var d,g,f,N,y,w,v,S,_,D;const[h,P]=b.useState(25),Q=25,c=5,{data:r,isLoading:m,isError:R,isFetching:i,error:p,refetch:n}=W("getStudentClicks",()=>H({count:h}),{onError:e=>{var s,t,x,l;(t=(s=e==null?void 0:e.response)==null?void 0:s.data)!=null&&t.error&&A.error((l=(x=e==null?void 0:e.response)==null?void 0:x.data)==null?void 0:l.error)}}),j=q();b.useEffect(()=>{const e=localStorage.getItem("token"),s=localStorage.getItem("user");e&&s||j("/login")},[j]),b.useEffect(()=>{n()},[h,n]);let o=null;return m&&(o=a.jsx("tr",{className:"section-bg border-b dark:text-white",children:a.jsx("td",{colSpan:c,className:"text-center text-white",children:a.jsx("div",{className:"text-center flex justify-center items-center my-6",children:a.jsx(J,{color:"white",size:"lg",variant:"dots"})})})})),!m&&R&&(o=a.jsx("tr",{className:"section-bg border-b dark:text-white",children:a.jsx("td",{colSpan:c,className:"text-center text-white py-6",children:`${(g=(d=p==null?void 0:p.response)==null?void 0:d.data)==null?void 0:g.error}`})})),!m&&((N=(f=r==null?void 0:r.data)==null?void 0:f.data)==null?void 0:N.length)===0&&(o=a.jsx("tr",{className:"section-bg border-b dark:text-white",children:a.jsx("td",{colSpan:c,className:"text-center text-white py-6",children:"No Student Click Found!"})})),!m&&((w=(y=r==null?void 0:r.data)==null?void 0:y.data)==null?void 0:w.length)>0&&(o=(S=(v=r==null?void 0:r.data)==null?void 0:v.data)==null?void 0:S.map((e,s)=>{var t,x,l,E,L,I,M,T,F,$,z;return a.jsxs("tr",{className:"section-bg border-b dark:text-white",children:[a.jsx("td",{"data-label":"Serial",className:"px-6 py-4",children:s+1}),a.jsxs("td",{"data-label":"",className:"px-6 py-4",children:[a.jsx("p",{className:"font-bold block md:hidden",children:"Student Details"})," ",a.jsx("br",{}),"Student ID: ",(t=e==null?void 0:e.user)==null?void 0:t.referral_code,a.jsx("br",{}),"Name: ",(x=e==null?void 0:e.user)==null?void 0:x.name,a.jsx("br",{}),"Email: ",(l=e==null?void 0:e.user)==null?void 0:l.email,a.jsx("br",{}),"Phone: ",(E=e==null?void 0:e.user)==null?void 0:E.phone_number,a.jsx("br",{}),"TL Name: ",(I=(L=e==null?void 0:e.user)==null?void 0:L.team_leader)==null?void 0:I.name,a.jsx("br",{}),a.jsx("p",{className:"mt-4",children:a.jsx("a",{href:`https://api.whatsapp.com/send?phone=${(M=e==null?void 0:e.user)==null?void 0:M.area_code}${(T=e==null?void 0:e.user)==null?void 0:T.mobile_number}`,className:"bg-purple-500 text-white p-2 rounded-lg",target:"_blank",rel:"noreferrer",children:"Whatsapp"})})]}),a.jsxs("td",{"data-label":"",className:"px-6 py-4",children:[a.jsx("p",{className:"font-bold block md:hidden",children:"Meet Details"})," ",a.jsx("br",{}),"Meet ID: ",(F=e==null?void 0:e.meet)==null?void 0:F.id,a.jsx("br",{}),"Name: ",($=e==null?void 0:e.meet)==null?void 0:$.meetlink,a.jsx("br",{}),"Creation Date: ",B((z=e==null?void 0:e.meet)==null?void 0:z.created_at),a.jsx("br",{})]}),a.jsx("td",{"data-label":"Click Time",className:"px-6 py-4",children:e!=null&&e.clicks?parseInt(e==null?void 0:e.clicks):0}),a.jsx("td",{"data-label":"Click Time",className:"px-6 py-4",children:B(e==null?void 0:e.created_at)})]},s)})),a.jsxs(a.Fragment,{children:[a.jsx(G,{title:"Student Meet Join List"}),a.jsx("div",{className:"container mx-auto my-5 p-5",children:a.jsxs("div",{className:"relative overflow-x-auto shadow-md sm:rounded-lg bg-white dark:bg-gray-900 p-2 table-wrapper",children:[a.jsxs("table",{className:"w-full text-sm text-left text-gray-500 dark:text-gray-400",children:[a.jsx("thead",{className:"text-xs text-gray-700 uppercase bg-white text-black",children:a.jsxs("tr",{children:[a.jsx("th",{scope:"col",className:"p-4",children:"Serial"}),a.jsx("th",{scope:"col",className:"p-4",children:"Student Details"}),a.jsx("th",{scope:"col",className:"px-6 py-3",children:"Meet Details"}),a.jsx("th",{scope:"col",className:"px-6 py-3",children:"Total Clicks"}),a.jsx("th",{scope:"col",className:"px-6 py-3",children:"Click Time"})]})}),a.jsx("tbody",{children:o})]}),i&&a.jsx("div",{className:"text-center flex justify-center items-center my-6",children:a.jsx(J,{color:"white",size:"lg",variant:"dots"})}),!i&&((D=(_=r==null?void 0:r.data)==null?void 0:_.data)==null?void 0:D.length)==h&&a.jsx("div",{className:"flex justify-center my-6",children:a.jsx("button",{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",onClick:()=>P(e=>e+Q),children:"Load More"})})]})})]})};export{V as default};
