1"use strict";(self.webpackChunkseekjob=self.webpackChunkseekjob||[]).push([[711],{8711:(e,s,a)=>{a.r(s),a.d(s,{default:()=>w});var t=a(5043),l=a(5094),r=a(8753),i=a(484);const d=async()=>await(0,i._d)(`${r.s}/admin/dashboard/seeker/summary`),n=async()=>await(0,i._d)(`${r.s}/admin/dashboard/student/summary`),c=async()=>await(0,i._d)(`${r.s}/admin/dashboard/university/summary`),o=async()=>await(0,i._d)(`${r.s}/admin/dashboard/employer/summary`);var m=a(108),u=a(5392),h=a(7734),x=a(2185),b=a(6026),j=a(6150),v=a(2798),y=a(3086),f=a(8756),p=a(579);const N={seeker:["active_users","jobs_viewed","jobs_saved","jobs_applied","jobs_posted","job_leads_sent","new_users","resumes_enhanced","insider_connections","seeky_queries"],student:["active_users","jobs_viewed","jobs_saved","jobs_applied","jobs_posted","job_leads_sent","new_users","resumes_enhanced","insider_connections","seeky_queries"],university:["active_users","job_leads_sent","students_added"],employer:["active_users","jobs_posted","applications_received"]},g=e=>{let{userType:s}=e;const[a,l]=(0,t.useState)("active_users"),[d,n]=(0,t.useState)("daily"),[c,o]=(0,t.useState)((0,y.GP)((0,f.e)(new Date,7),"yyyy-MM-dd")),[g,w]=(0,t.useState)((0,y.GP)(new Date,"yyyy-MM-dd")),[_,k]=(0,t.useState)((0,y.GP)(new Date,"yyyy-MM-dd'T'HH:mm")),[D,T]=(0,t.useState)(24),[C,S]=(0,t.useState)([]),[U,M]=(0,t.useState)(0),[$,P]=(0,t.useState)(null),[F,z]=(0,t.useState)(!1),[E,G]=(0,t.useState)(null);(0,t.useEffect)((()=>{N[s].includes(a)||l("active_users")}),[s,a]),(0,t.useEffect)((()=>{const e=setTimeout((()=>{H()}),500);return()=>clearTimeout(e)}),[s,a,d,c,g,_,D]);const H=async()=>{z(!0),G(null);try{let e={user_type:s,view:d,metric:a};if("daily"===d){if(!c||!g)return;e.start_date=c,e.end_date=g}else{if(!_||!D)return;e.date_time=new Date(_).toISOString(),e.hours=parseInt(D,10)}const t=await(async e=>await(0,i.Y7)(`${r.s}/admin/dashboard/analytics`,e))(e);if(t&&t.error)G(t.error),S([]),M(0),P(null);else if(t&&t.chart_data){const e=t.chart_data.map(((e,s)=>{try{let r=e.label;if("hourly"===d){const i=r.match(/^(\d{1,2})-(\d{1,2})$/);if(i){const l=parseInt(i[1],10),r=parseInt(i[2],10);let d;if(e.date)d=new Date(e.date);else if(e.day)d=new Date(e.day);else{var a;const e=new Date(_),l=t.chart_data.length-1-s,r=parseInt((null===(a=t.meta)||void 0===a?void 0:a.bucket_size_hours)||2,10);d=new Date(e.getTime()-l*r*3600*1e3)}const n=new Date(d.getTime());n.setUTCHours(l,0,0,0);const c=(n-d)/36e5;c>12?n.setUTCDate(n.getUTCDate()-1):c<-12&&n.setUTCDate(n.getUTCDate()+1);const o=new Date(d.getTime());o.setUTCHours(r,0,0,0);const m=(o-d)/36e5;return m>12?o.setUTCDate(o.getUTCDate()-1):m<-12&&o.setUTCDate(o.getUTCDate()+1),{...e,label:`${(0,y.GP)(n,"MMM d, h:mm a")} - ${(0,y.GP)(o,"h:mm a")}`}}const d=r.match(/^(\d{1,2})$/);if(d){const a=parseInt(d[1],10);let r;if(e.date)r=new Date(e.date);else if(e.day)r=new Date(e.day);else{var l;const e=new Date(_),a=t.chart_data.length-1-s,i=parseInt((null===(l=t.meta)||void 0===l?void 0:l.bucket_size_hours)||1,10);r=new Date(e.getTime()-a*i*3600*1e3)}const i=new Date(r.getTime());i.setUTCHours(a,0,0,0);const n=(i-r)/36e5;return n>12?i.setUTCDate(i.getUTCDate()-1):n<-12&&i.setUTCDate(i.getUTCDate()+1),{...e,label:(0,y.GP)(i,"MMM d, h:mm a")}}}r.length>10&&!r.endsWith("Z")&&!r.match(/[+-]\d{2}:\d{2}$/)?r+="Z":10===r.length&&r.includes("-")&&(r+="T00:00:00Z");const i=new Date(r);if(isNaN(i))return e;if(2001===i.getFullYear()){const e=c?c.substring(0,4):(new Date).getFullYear();i.setFullYear(parseInt(e,10))}const n="hourly"===d?(0,y.GP)(i,"MMM d, h:mm a"):(0,y.GP)(i,"MMM d, yyyy");return{...e,label:n}}catch(r){return e}}));S(e),M(t.total),P(t.meta)}else G("Invalid response from server.")}catch(e){console.error(e),G("An error occurred while fetching analytics.")}finally{z(!1)}},I=e=>e.replace(/_/g," ").replace(/\b\w/g,(e=>e.toUpperCase()));return(0,p.jsx)("div",{className:"card shadow-sm mt-4",children:(0,p.jsxs)("div",{className:"card-body px-4 pt-4",children:[(0,p.jsxs)("div",{className:"d-flex flex-wrap gap-2 mb-4 align-items-center",children:[(0,p.jsxs)("button",{className:`btn ${"hourly"===d?"btn-primary text-white":"btn-light border"} d-flex align-items-center`,onClick:()=>n("hourly"),style:{color:"hourly"===d?"#fff":"#333"},children:[(0,p.jsx)("i",{className:"far fa-clock me-2"})," Hourly View"]}
1),(0,p.jsxs)("button",{className:`btn ${"daily"===d?"btn-primary text-white":"btn-light border"} d-flex align-items-center`,onClick:()=>n("daily"),style:{color:"daily"===d?"#fff":"#333"},children:[(0,p.jsx)("i",{className:"far fa-calendar-alt me-2"})," Daily View"]})]}),(0,p.jsxs)("div",{className:"mb-4",children:[(0,p.jsx)("label",{className:"form-label text-muted fw-bold",children:"Metric"}),(0,p.jsx)("select",{className:"form-select form-select-sm bg-white",style:{color:"#333",border:"1px solid #ced4da"},value:a,onChange:e=>l(e.target.value),children:N[s].map((e=>(0,p.jsx)("option",{value:e,style:{color:"#333",backgroundColor:"#fff"},children:I(e)},e)))})]}),(0,p.jsx)("div",{className:"row mb-4 align-items-end",children:"daily"===d?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)("div",{className:"col-md-3",children:[(0,p.jsx)("label",{className:"form-label small text-muted",children:"Start Date"}),(0,p.jsx)("input",{type:"date",className:"form-control",value:c,max:g,onChange:e=>o(e.target.value)})]}),(0,p.jsxs)("div",{className:"col-md-3",children:[(0,p.jsx)("label",{className:"form-label small text-muted",children:"End Date"}),(0,p.jsx)("input",{type:"date",className:"form-control",value:g,min:c,onChange:e=>w(e.target.value)})]})]}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)("div",{className:"col-md-3",children:[(0,p.jsx)("label",{className:"form-label small text-muted",children:"Date & Time"}),(0,p.jsx)("input",{type:"datetime-local",className:"form-control",value:_,onChange:e=>k(e.target.value)})]}),(0,p.jsxs)("div",{className:"col-md-3",children:[(0,p.jsx)("label",{className:"form-label small text-muted",children:"Hours (Multiple of 2)"}),(0,p.jsx)("input",{type:"number",step:"2",min:"2",max:"744",className:"form-control",value:D,onChange:e=>T(e.target.value)})]})]})}),E&&(0,p.jsx)("div",{className:"alert alert-danger p-2 small",children:E}),(0,p.jsxs)("div",{className:"mb-3 d-flex justify-content-between align-items-center",children:[(0,p.jsxs)("h6",{className:"mb-0 text-muted",children:["Total ",I(a),": ",(0,p.jsx)("strong",{className:"text-dark fs-4 ms-1",children:U})]}),F&&(0,p.jsx)("span",{className:"spinner-border spinner-border-sm text-primary",role:"status"})]}),(0,p.jsx)("div",{style:{width:"100%",height:350},children:(0,p.jsx)(m.u,{children:(0,p.jsxs)(u.E,{data:C,margin:{top:5,right:30,left:0,bottom:25},children:[(0,p.jsx)(h.d,{strokeDasharray:"3 3",vertical:!1}),(0,p.jsx)(x.W,{dataKey:"label",tick:{fontSize:12},tickMargin:10}),(0,p.jsx)(b.h,{allowDecimals:!1}),(0,p.jsx)(j.m,{cursor:{fill:"#f4f6f8"},contentStyle:{borderRadius:"8px",border:"none",boxShadow:"0 4px 6px rgba(0,0,0,0.1)"}}),(0,p.jsx)(v.y,{dataKey:"value",name:I(a),fill:"#235594",radius:[4,4,0,0],barSize:40})]})})}),$&&(0,p.jsxs)("div",{className:"text-end small text-muted mt-2",children:["Aggregation: ",$.total_aggregation," | Bucket Size: ","daily"===d?`${$.bucket_size_days} Days`:`${$.bucket_size_hours} Hours`]})]})})},w=()=>{const{setDashboardLoader:e,Dashboardloader:s}=(0,t.useContext)(l.vR),[a,r]=(0,t.useState)("seeker"),[i,m]=(0,t.useState)(null),[u,h]=(0,t.useState)(null),[x,b]=(0,t.useState)(null),[j,v]=(0,t.useState)(null);return(0,t.useEffect)((()=>{(async()=>{e(!0);try{const[e,s,a,t]=await Promise.all([d(),n(),c(),o()]);e&&m(e),s&&h(s),a&&b(a),t&&v(t)}catch(s){console.error("Failed to fetch admin dashboard summaries",s)}finally{e(!1)}})()}),[e]),(0,p.jsx)("div",{className:"page-body-wrapper",style:{minHeight:"100vh",overflowY:"auto",display:"flex",flexDirection:"column",marginLeft:"0px"},children:(0,p.jsx)("div",{className:"page-body",style:{flexGrow:1,boxSizing:"border-box"},children:(0,p.jsxs)("div",{className:"dashboard-container",style:{maxWidth:"1440px",margin:"0 auto",padding:"20px 20px",width:"100%"},children:[(0,p.jsx)("div",{className:"row mb-4",children:(0,p.jsxs)("div",{className:"col-12",children:[(0,p.jsx)("h2",{className:"mb-2",children:"Platform Admin Dashboard"}),(0,p.jsx)("p",{className:"text-muted",children:"Overview of platform users and organizations"})]})}),(0,p.jsx)("div",{className:"card shadow-sm mb-4",children:(0,p.jsx)("div",{className:"card-body p-0",children:(0,p.jsxs)("ul",{className:"nav nav-tabs nav-justified",style:{borderBottom:"none"},children:[(0,p.jsx)("li",{className:"nav-item",children:(0,p.jsx)("button",{className:"nav-link fw-bold p-3 border-0 w-100 "+("seeker"===a?"active bg-primary text-white":"bg-white"),onClick:()=>r("seeker"),style:{borderRadius:"seeker"===a?"4px 4px 0 0":"0",color:"seeker"===a?"#fff":"#333"},children:"Seeker"})}),(0,p.jsx)("li",{className:"nav-item",children:(0,p.jsx)("button",{className:"nav-link fw-bold p-3 border-0 w-100 "+("student"===a?"active bg-primary text-white":"bg-white"),onClick:()=>r("student"),style:{borderRadius:"student"===a?"4px 4px 0 0":"0",color:"student"===a?"#fff":"#333"},children:"Student"})}),(0,p.jsx)("li",{className:"nav-item",children:(0,p.jsx)("button",{className:"nav-link fw-bold p-3 border-0 w-100 "+("university"===a?"active bg-primary text-white":"bg-white"),onClick:()=>r("university"),style:{borderRadius:"university"===a?"4px 4px 0 0":"0",color:"university"===a?"#fff":"#333"},children:"University"})}),(0,p.jsx)("li",{className:"nav-item",children:(0,p.jsx)("button",{className:"nav-link fw-bold p-3 border-0 w-100 "+("employer"===a?"active bg-primary text-white":"bg-white"),onClick:()=>r("employer"),style:{borderRadius:"employer"===a?"4px 4px 0 0":"0",color:"employer"===a?"#fff":"#333"},children:"Employer"})})]})})}),s?(0,p.jsx)("div",{className:"text-center p-5",children:"Loading dashboard data..."}):(0,p.jsxs)("div",{className:"row g-4 mb-4",children:["seeker"===a&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("div",{className:"col-md-4",children:(0,p.jsx)("div",{className:"card h-100 border shadow-sm",children:(0,p.jsxs)("div",{className:"card-body p-4 d-flex justify-content-between align-items-center",children:[(0,p.jsxs)("div",{children:[(0,p.jsx)("p",{className:"text-muted mb-1",children:"Total Seekers"}),(0,p.jsx)("h2",{className:"mb-0",children:(null===i||void 0===i?void 0:i.total_seekers)||0})]}),(0,p.jsx)("i",{className:"fas fa-users fa-2x text-muted opacity-50"})]})})}),(0,p.jsx)("div",{className:"col-md-4",children:(0,p.jsx)("div",{className:"card h-100 border shadow-sm",children:(0,p.jsxs)("div",{className:"card-body p-4 d-flex justify-content-between align-items-center",children:[(0,p.jsxs)("div",{children:[(0,p.jsx)("p",{className:"text-muted mb-1",children:"Free Users"}),(0,p.jsx)("h2",{className:"mb-0",children:(null===i||void 0===i?void 0:i.free_users)||0})]}),(0,p.jsx)("i",{className:"fas fa-user fa-2x text-muted opacity-50"})]})})}),(0,p.jsx)("div",{className:"col-md-4",children:(0,p.jsx)("div",{className:"card h-100 border shadow-sm",children:(0,p.jsxs)("div",{className:"card-body p-4 d-flex justify-content-between align-items-center",children:[(0,p.jsxs)("div",{children:[(0,p.jsx)("p",{className:"text-muted mb-1",children:"Premium / Elite Users"}),(0,p.jsx)("h2",{className:"mb-0",children:((null===i||void 0===i?void 0:i.premium_users)||0)+((null===i||void 0===i?void 0:i.elite_users)||0)})]}),(0,p.jsx)("i",{className:"fas fa-crown fa-2x text-muted opacity-50"})]})})})]}),"student"===a&&(0,p.jsx)("div",{className:"col-md-4",children:(0,p.jsx)("div",{className:"card h-100 border shadow-sm",children:(0,p.jsxs)("div",{className:"card-body p-4 d-flex justify-content-between align-items-center",children:[(0,p.jsxs)("div",{children:[(0,p.jsx)("p",{className:"text-muted mb-1",children:"Total Students"}),(0,p.jsx)("h2",{className:"mb-0",children:(null===u||void 0===u?void 0:u.total_students)||0})]}),(0,p.jsx)("i",{className:"fas fa-user-graduate fa-2x text-muted opacity-50"})]})})}),"university"===a&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("div",{className:"col-md-4",children:(0,p.jsx)("div",{className:"card h-100 border shadow-sm",children:(0,p.jsxs)("div",{className:"card-body p-4 d-flex justify-content-between align-items-center",children:[(0,p.jsxs)("div",{children:[(0,p.jsx)("p",{className:"text-muted mb-1",children:"Partnered Universities"}),(0,p.jsx)("h2",{className:"mb-0",children:(null===x||void 0===x?void 0:x.partnered_universities)||0})]}),(0,p.jsx)("i",{className:"fas fa-university fa-2x text-muted opacity-50"})]})})}),(0,p.jsx)("div",{className:"col-md-4",children:(0,p.jsx)("div",{className:"card h-100 border shadow-sm",children:(0,p.jsxs)("div",{className:"card-body p-4 d-flex justify-content-between align-items-center",children:[(0,p.jsxs)("div",{children:[(0,p.jsx)("p",{className:"text-muted mb-1",children:"Total University Users"}),(0,p.jsx)("h2",{className:"mb-0",children:(null===x||void 0===x?void 0:x.total_university_users)||0})]}),(0,p.jsx)("i",{className:"fas fa-users fa-2x text-muted opacity-50"})]})})})]}),"employer"===a&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("div",{className:"col-md-4",children:(0,p.jsx)("div",{className:"card h-100 border shadow-sm",children:(0,p.jsxs)("div",{className:"card-body p-4 d-flex justify-content-between align-items-center",children:[(0,p.jsxs)("div",{children:[(0,p.jsx)("p",{className:"text-muted mb-1",children:"Partnered Employers"}),(0,p.jsx)("h2",{className:"mb-0",children:(null===j||void 0===j?void 0:j.partnered_employers)||0})]}),(0,p.jsx)("i",{className:"fas fa-building fa-2x text-muted opacity-50"})]})})}),(0,p.jsx)("div",{className:"col-md-4",children:(0,p.jsx)("div",{className:"card h-100 border shadow-sm",children:(0,p.jsxs)("div",{className:"card-body p-4 d-flex justify-content-between align-items-center",children:[(0,p.jsxs)("div",{children:[(0,p.jsx)("p",{className:"text-muted mb-1",children:"Total Employer Users"}),(0,p.jsx)("h2",{className:"mb-0",children:(null===j||void 0===j?void 0:j.total_employer_users)||0})]}),(0,p.jsx)("i",{className:"fas fa-users fa-2x text-muted opacity-50"})]})})})]})]}),(0,p.jsx)("div",{className:"row mt-4",children:(0,p.jsx)("div",{className:"col-12",children:(0,p.jsx)(g,{userType:a})})})]})})})}}}]); 2//# sourceMappingURL=711.ccda8a1a.chunk.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.