import{e as v,i as y,r as o,j as s,C as p}from"./index-sga-FecS.js";import{u as k,f as c}from"./DefaultLayout-R679muSx.js";import{b as d,a as h}from"./index.esm-7CdJvro0.js";import{C as a,a as r}from"./CRow-BaMSc2yS.js";import{C as i,a as n}from"./CCardBody-e8lVonr1.js";import{C as x}from"./CCardHeader-B7SoQ3bq.js";import"./university-logo-full-HPG0vyLU.js";import"./cil-user-Dlmw-Gem.js";function D(){const{t:e,i18n:g}=v(),m=y(),{user:t,loading:N,error:f}=k(),[l,b]=o.useState({total_students:0,provisional_students:0,documents_pending:0,active_students:0,todays_imports:0}),[C,u]=o.useState(!1),_=g.language==="ar";return o.useEffect(()=>{if(!t||t.role!=="registrar")return;(async()=>{try{u(!0);const j=_?"/ar":"/en";b({total_students:1250,provisional_students:80,documents_pending:35,active_students:1120,todays_imports:45})}catch(j){console.error("Error loading registrar stats:",j)}finally{u(!1)}})()},[t,_]),N?s.jsx(d,{fluid:!0,className:"py-4",children:s.jsx(a,{children:s.jsxs(r,{children:[s.jsx(p,{size:"sm"})," ",e("loading_user")]})})}):f?s.jsx(d,{fluid:!0,className:"py-4",children:s.jsx(a,{children:s.jsx(r,{children:s.jsx("p",{children:e("error_loading_user")})})})}):!t||t.role!=="registrar"?s.jsx(d,{fluid:!0,className:"py-4",children:s.jsx(a,{children:s.jsx(r,{children:s.jsx("p",{children:e("not_authorized")})})})}):s.jsxs(d,{fluid:!0,className:"py-4",children:[s.jsx(a,{className:"mb-4",children:s.jsxs(r,{xs:"12",children:[s.jsx("h2",{className:"mb-1",children:e("registrar_dashboard")}),s.jsxs("p",{className:"text-medium-emphasis mb-0",children:[e("registrar_dashboard_welcome")," ",s.jsx("strong",{children:t.full_name||t.username})]})]})}),s.jsxs(a,{className:"mb-4",children:[s.jsx(r,{md:3,sm:6,className:"mb-3",children:s.jsx(i,{children:s.jsxs(n,{children:[s.jsx("div",{className:"text-medium-emphasis small mb-1",children:e("registrar_stat_total_students")}),s.jsx("h4",{className:"mb-0",children:l.total_students}),s.jsx(c,{color:"primary",className:"mt-2",children:e("registrar_stat_total_label")})]})})}),s.jsx(r,{md:3,sm:6,className:"mb-3",children:s.jsx(i,{children:s.jsxs(n,{children:[s.jsx("div",{className:"text-medium-emphasis small mb-1",children:e("registrar_stat_provisional")}),s.jsx("h4",{className:"mb-0",children:l.provisional_students}),s.jsx(c,{color:"warning",className:"mt-2",children:e("status_provisional")})]})})}),s.jsx(r,{md:3,sm:6,className:"mb-3",children:s.jsx(i,{children:s.jsxs(n,{children:[s.jsx("div",{className:"text-medium-emphasis small mb-1",children:e("registrar_stat_documents_pending")}),s.jsx("h4",{className:"mb-0",children:l.documents_pending}),s.jsx(c,{color:"danger",className:"mt-2",children:e("registrar_badge_need_action")})]})})}),s.jsx(r,{md:3,sm:6,className:"mb-3",children:s.jsx(i,{children:s.jsxs(n,{children:[s.jsx("div",{className:"text-medium-emphasis small mb-1",children:e("registrar_stat_active_students")}),s.jsx("h4",{className:"mb-0",children:l.active_students}),s.jsx(c,{color:"success",className:"mt-2",children:e("status_active")})]})})})]}),s.jsxs(a,{children:[s.jsx(r,{md:4,className:"mb-3",children:s.jsxs(i,{children:[s.jsx(x,{children:e("registrar_quick_students")}),s.jsxs(n,{children:[s.jsx("p",{className:"text-medium-emphasis mb-3",children:e("registrar_quick_students_desc")}),s.jsx(h,{color:"primary",variant:"outline",onClick:()=>m("/registrar/students"),children:e("registrar_go_to_students")})]})]})}),s.jsx(r,{md:4,className:"mb-3",children:s.jsxs(i,{children:[s.jsx(x,{children:e("import_accepted_students_title")}),s.jsxs(n,{children:[s.jsx("p",{className:"text-medium-emphasis mb-2",children:e("registrar_quick_import_desc")}),s.jsx("p",{className:"text-medium-emphasis small mb-3",children:e("registrar_quick_import_today",{count:l.todays_imports})}),s.jsx(h,{color:"secondary",variant:"outline",onClick:()=>m("/registrar/import-accepted-students"),children:e("registrar_go_to_import")})]})]})}),s.jsx(r,{md:4,className:"mb-3",children:s.jsxs(i,{children:[s.jsx(x,{children:e("transfer_student_title")}),s.jsxs(n,{children:[s.jsx("p",{className:"text-medium-emphasis mb-3",children:e("registrar_quick_transfer_desc")}),s.jsx(h,{color:"info",variant:"outline",onClick:()=>m("/registrar/transfer-student"),children:e("registrar_go_to_transfer")})]})]})})]}),C&&s.jsx(a,{className:"mt-3",children:s.jsxs(r,{children:[s.jsx(p,{size:"sm"})," ",e("registrar_loading_stats")]})})]})}export{D as default};
