PageSourceSearch

https://www.becerikli.ai/assets/LMSReports-B9qwibLt.js

js becerikli.ai collected 2026-10-05 15:13:31 UTC 10,709 bytes, 7 lines download raw bytes

1import{c as ee,o as se,d as te,v as ae,u as re,r as t,j as e,A as le,R as T,F as L,C as A}from"./index-DfrukQi_.js";import{l as oe}from"./lmsService-CgK0zAKt.js";import{D as $}from"./lmsMockData-CAD2O6qf.js";import{b as v,a as r,c as x,e as m,d as N,v as l,f as o,V as B,i as ne}from"./palette-BLa50qaq.js";import{D as ie}from"./download-CFKU7v22.js";import{P as ce}from"./printer-DRN1b4G0.js";import{T as de}from"./trending-up-ChaKOAPQ.js";import{U as xe}from"./users-aPsUVn9k.js";import{C as me}from"./chart-column-DYTyTqmW.js";import{A as pe}from"./award-Bp1NPUkc.js";import{C as ue}from"./circle-x-BZeO8vE7.js";import"./classCovers-DammqvFR.js";const he=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],fe=ee("activity",he),w=({title:n,value:y,subtitle:h,icon:f,color:p})=>e.jsxs("div",{className:"rounded-[16px] p-6",style:{background:m,border:x,boxShadow:l(2)},children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-[13px] font-semibold",style:{color:o},children:n}),e.jsx(f,{className:`w-5 h-5 ${p}`})]}),e.jsx("div",{className:"text-[26px] font-extrabold leading-8",style:{color:r},children:y}),e.jsx("div",{className:"mt-1 text-[12px] font-medium",style:{color:o},children:h})]});function _e(){const{classId:n}=se(),y=te(),{user:h,isLoading:f}=ae(),{toast:p}=re(),[a,R]=t.useState(n),[E,O]=t.useState([]),[b,I]=t.useState(null),[i,G]=t.useState(null),[k,V]=t.useState("progress"),[D,_]=t.useState(!1),[M,P]=t.useState(!0),[U,H]=t.useState(!1),[g,be]=t.useState({averageGrade:0,completionRate:0,activeStudents:0,totalSubmissions:0});t.useEffect(()=>{!f&&h&&(n?(R(n),F()):z())},[n,h,f]),t.useEffect(()=>{if(a){F();const s=setTimeout(()=>{Y()},100);return()=>clearTimeout(s)}},[a]);const z=t.useCallback(async()=>{O($),P(!1)},[h?.id,a]),F=t.useCallback(async()=>{a&&I($.find(s=>s.id===a)||null)},[a]),K=t.useCallback(async()=>{if(a){_(!0);try{const s=await oe.generateClassReport(a,k);s.success?(p.success("Başarılı","Rapor oluşturuldu"),G(s.data.data)):p.error("Hata","Rapor oluşturulurken bir hata oluştu")}catch(s){console.error("Error generating report:",s),p.error("Hata","Rapor oluşturulurken bir hata oluştu")}finally{_(!1)}}},[a,k]),Y=t.useCallback(async()=>{a&&H(!1)},[a]),W=t.useCallback(()=>{if(!i||!b)return;let s=`Sınıf Raporu
2`;s+=`Sınıf: ${b.name}
3`,s+=`Oluşturulma Tarihi: ${new Date(i.generatedAt).toLocaleDateString("tr-TR")}
4
5`,s+=`Öğrenci,Teslim Edilen Ödev,Ortalama Puan
6`,i.students.forEach(d=>{const C=`${d.profiles?.first_name||""} ${d.profiles?.last_name||""}`.trim()||d.profiles?.email,j=d.lms_submissions?.length||0,q=d.lms_submissions?.reduce((Q,Z)=>Q+(Z.grade||0),0)||0,J=j>0?Math.round(q/j):0;s+=`${C},${j},${J}
7`});const S=new Blob([s],{type:"text/csv;charset=utf-8;"}),u=URL.createObjectURL(S),c=document.createElement("a");c.setAttribute("href",u),c.setAttribute("download",`sinif_raporu_${b.name}_${Date.now()}.csv`),c.style.visibility="hidden",document.body.appendChild(c),c.click(),document.body.removeChild(c),p.success("Başarılı","Rapor indirildi")},[i,b]),X=t.useMemo(()=>s=>s>=85?"text-green-600":s>=70?"text-yellow-600":s>=50?"text-orange-600":"text-red-600",[]);return M||f?e.jsx("div",{className:"flex items-center justify-center min-h-[400px]",style:{background:v},children:e.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-[#2D5BFF]"})}):e.jsx("div",{className:"min-h-screen",style:{background:v,color:r},children:e.jsxs("div",{className:"max-w-7xl mx-auto p-6",children:[e.jsx("div",{className:"rounded-[20px] p-6 mb-6",style:{background:m,border:x,boxSh
7adow:l(4)},children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("button",{onClick:()=>y(n?`/app/lms/class/${n}`:"/app/lms"),className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-[12px] transition-transform hover:-translate-y-0.5 active:translate-y-0",style:{background:m,border:N,boxShadow:l(2),color:r},children:e.jsx(le,{className:"w-5 h-5"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-[28px] font-extrabold leading-9 tracking-[-0.01em]",style:{color:r},children:"Sınıf Raporları"}),e.jsx("p",{className:"text-[14px] font-medium",style:{color:o},children:b?.name||"Sınıf seçin"})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("button",{onClick:K,disabled:D||!a,className:"px-4 py-2 rounded-[12px] text-[14px] font-extrabold text-white transition-transform hover:-translate-y-0.5 active:translate-y-0 flex items-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed",style:{background:B,border:N,boxShadow:l(3)},children:[D?e.jsx(T,{className:"w-4 h-4 animate-spin"}):e.jsx(T,{className:"w-4 h-4"}),"Yeni Rapor Oluştur"]}),e.jsxs("button",{onClick:W,disabled:!i,className:"px-4 py-2 rounded-[12px] text-[14px] font-extrabold transition-transform hover:-translate-y-0.5 active:translate-y-0 flex items-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed",style:{background:ne,color:r,border:N,boxShadow:l(3)},children:[e.jsx(ie,{className:"w-4 h-4"}),"İndir"]}),e.jsxs("button",{onClick:()=>window.print(),className:"px-4 py-2 rounded-[12px] text-[14px] font-extrabold transition-transform hover:-translate-y-0.5 active:translate-y-0 flex items-center gap-2",style:{background:m,color:r,border:x,boxSh
7adow:l(2)},children:[e.jsx(ce,{className:"w-4 h-4"}),"Yazdır"]})]})]})}),!n&&E.length>0&&e.jsx("div",{className:"rounded-[16px] p-4 mb-6",style:{background:m,border:x,boxShadow:l(3)},children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("span",{className:"text-[13px] font-bold",style:{color:r},children:"Sınıf Seçin:"}),e.jsxs("select",{value:a||"",onChange:s=>R(s.target.value),className:"h-10 rounded-[12px] border-2 border-[#EDE4CE] bg-white px-3 text-[14px] font-medium text-[#141414] outline-none transition-colors focus:border-[#2D5BFF] focus:ring-2 focus:ring-[#2D5BFF]/15",children:[e.jsx("option",{value:"",children:"Sınıf seçin..."}),E.map(s=>e.jsxs("option",{value:s.id,children:[s.name," - ",s.grade,". Sınıf"]},s.id))]})]})}),e.jsx("div",{className:"rounded-[16px] p-4 mb-6",style:{background:m,border:x,boxShadow:l(3)},children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("span",{className:"text-[13px] font-bold",style:{color:r},children:"Rapor Türü:"}),e.jsx("div",{className:"flex gap-2",children:[{value:"progress",label:"İlerleme",icon:de},{value:"attendance",label:"Katılım",icon:xe},{value:"performance",label:"Performans",icon:me},{value:"assignment",label:"Ödev",icon:L}].map(s=>e.jsxs("button",{onClick:()=>V(s.value),className:"px-4 py-2 rounded-[12px] text-[13px] font-bold transition-transform hover:-translate-y-0.5 active:translate-y-0 flex items-center gap-2",style:k===s.value?{background:B,color:m,border:N,boxShadow:l(3)}
7:{background:v,color:o,border:x,boxShadow:l(1)},children:[e.jsx(s.icon,{className:"w-4 h-4"}),s.label]},s.value))})]})}),a&&e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4 mb-6",children:U?e.jsx("div",{className:"col-span-4 flex justify-center py-8",children:e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-[#2D5BFF]"})}):e.jsxs(e.Fragment,{children:[e.jsx(w,{title:"Ortalama Not",value:g.averageGrade,subtitle:"100 üzerinden",icon:pe,color:"text-[#2D5BFF]"}),e.jsx(w,{title:"Tamamlanma Oranı",value:`%${g.completionRate}`,subtitle:"Ödev teslim oranı",icon:A,color:"text-[#FFB326]"}),e.jsx(w,{title:"Aktif Öğrenci",value:g.activeStudents,subtitle:"Ödev teslim eden",icon:fe,color:"text-[#8B5CF6]"}),e.jsx(w,{title:"Toplam Teslim",value:g.totalSubmissions,subtitle:"Ödev teslimi",icon:L,color:"text-[#FF5C4D]"})]})}),i&&e.jsxs("div",{className:"rounded-[20px] p-6",style:{background:m,border:x,boxShadow:l(4)},children:[e.jsxs("div",{className:"mb-6",children:[e.jsx("h2",{className:"mb-2 text-[20px] font-extrabold tracking-[-0.01em]",style:{color:r},children:"Detaylı Rapor"}),e.jsxs("p",{className:"text-[13px] font-medium",style:{color:o},children:["Oluşturulma: ",new Date(i.generatedAt).toLocaleDateString("tr-TR")]})]}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"min-w-full divide-y divide-[#EDE4CE]",children:[e.jsx("thead",{style:{background:v},children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-6 py-3 text-left text-[11px] font-black uppercase tracking-[0.12em]",style:{color:o},children:"Öğrenci"}),e.jsx("th",{className:"px-6 py-3 text-left text-[11px] font-black uppercase tracking-[0.12em]",style:{color:o},children:"E-posta"}),e.jsx("th",{className:"px-6 py-3 text-center text-[11px] font-black uppercase tracking-[0.12em]",style:{color:o},children:"Teslim Edilen"}),e.jsx("th",{className:"px-6 py-3 text-center text-[11px] font-black uppercase tracking-[0.12em]",style:{color:o},children:"Ortalama Not"}),e.jsx("th",{className:"px-6 py-3 text-center text-[11px] font-black uppercase tracking-[0.12em]",style:{color:o},children:"Durum"})]})}),e.jsx("tbody",{className:"bg-white divide-y divide-[#EDE4CE]",children:i.students.slice(0,50).map((s,S)=>{const u=s.lms_submissions?.length||0,c=s.lms_submissions?.reduce((C,j)=>C+(j.grade||0),0)||0,d=u>0?Math.round(c/u):0;return e.jsxs("tr",{className:"transition-colors hover:bg-[#FFF6E4]",children:[e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center text-[13px] font-extrabold mr-3",style:{background:v,color:r,border:x},children:s.profiles?.first_name?.[0]||s.profiles?.email?.[0]||"?"}),e.jsx("div",{className:"text-[14px] font-bold",style:{color:r},children:s.profiles?.first_name&&s.profiles?.last_name?`${s.profiles.first_name} ${s.profiles.last_name}`:"İsimsiz"})]})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-[13px] font-medium",style:{color:o},children:s.profiles?.email||"-"}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-center",children:e.jsxs("span",{className:"text-[13px] font-semibold",style:{color:r},children:[u," / ",i.assignmentCount]})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-center",children:e.jsx("span",{className:`text-[14px] font-extrabold ${X(d)}`,children:d})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-center",children:e.jsx("div",{className:"flex justify-center",children:u>0?e.jsx(A,{className:"w-5 h-5 text-green-500"}):e.jsx(ue,{className:"w-5 h-5 text-red-500"})})})]},s.id||S)})})]})})]})]})})}export{_e as default};

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.