import{c as q,n as Y,o as J,s as K,t as Q}from"./chunk-IO5VMYUV.js";import{a as z}from"./chunk-CW2JVE4L.js";import"./chunk-VWJFXZ25.js";import"./chunk-XZFEFO5T.js";import{a as H}from"./chunk-YXNSGUXN.js";import"./chunk-Y4QYVF5K.js";import"./chunk-6DMSCLHW.js";import"./chunk-5KBO3I44.js";import"./chunk-LPD7J4JW.js";import{a as O}from"./chunk-A6GDLS4J.js";import{a as N}from"./chunk-LILKUEZ7.js";import"./chunk-GGCQT7K6.js";import"./chunk-IQVEYGHC.js";import"./chunk-HDQXASVT.js";import{i as U}from"./chunk-CFFHWVA5.js";import"./chunk-CQICYL3N.js";import"./chunk-C7V3KKPV.js";import"./chunk-W6VI2ZDA.js";import{b as M}from"./chunk-GH7I4V3C.js";import{H as T,O as j,s as P}from"./chunk-2YE7XEKS.js";import{Ab as c,Cd as G,Hc as y,Ic as C,Jc as b,Mc as I,Nc as F,Ob as L,Pb as A,Qb as B,Sc as o,T as _,Tc as d,Vb as h,Wb as S,Xb as m,Yb as p,_ as u,ba as f,jb as a,ka as k,kc as D,m as x,pa as s,r as E,se as $,w as n,x as w,yc as v,zc as g}from"./chunk-UNHECMG2.js";var l=(()=>{class t{constructor(){this.storageService=s(O),this.loadingService=s(H),this.coursesRestService=s(q),this.subscriptionRestService=s(N),this.reportsService=s(z),this.gradingScalesRestService=s(Y),this.loading$=this.loadingService.loading$,this.studentId$=new x(1),this.subscriptionAndEventsIds$=this.studentId$.pipe(f(this.loadSubscriptionAndEventIds.bind(this)),u(1)),this.subscriptionIds$=this.subscriptionAndEventsIds$.pipe(n(e=>e.subscriptionIds)),this.eventIds$=this.subscriptionAndEventsIds$.pipe(n(e=>e.eventIds)),this.studentCourses$=this.eventIds$.pipe(f(this.loadCourses.bind(this))).pipe(u(1)),this.studentCoursesSorted$=this.studentCourses$.pipe(n(e=>e.slice().sort((i,ee)=>i.Designation.localeCompare(ee.Designation)))),this.testReports$=this.subscriptionIds$.pipe(n(e=>this.reportsService.getStudentSubscriptionGradesReports(e))),this.tests$=this.studentCourses$.pipe(n(e=>e.flatMap(i=>i.Tests).filter(M))),this.gradingScaleIds$=w([this.tests$.pipe(n(e=>[...e.map(i=>i.GradingScaleId)])),this.studentCourses$.pipe(n(e=>e.map(i=>i.GradingScaleId)))]).pipe(n(([e,i])=>j([...e,...i]).filter(M)),_(T),u(1)),this.gradingScales$=this.gradingScaleIds$.pipe(f(e=>this.gradingScalesRestService.getListForIds(e)),u(1));let r=this.storageService.getPayload()?.id_person;r&&this.studentId$.next(Number(r))}loadCourses(r){return r.length===0?E([]):this.loadingService.load(this.coursesRestService.getCoursesForMyGrades(r))}loadSubscriptionAndEventIds(r){return this.loadingService.load(this.subscriptionRestService.getSubscriptionsByStudent(r).pipe(n(e=>({subscriptionIds:e.map(i=>i.Id),eventIds:e.map(i=>i.EventId).filter(M)}))))}static{this.\u0275fac=function(e){return new(e||t)}}static{this.\u0275prov=k({token:t,factory:t.\u0275fac})}}return t})();var te=()=>[],V=(()=>{class t{constructor(){this.myGradesService=s(l)}static{this.\u0275fac=function(e){return new(e||t)}}static{this.\u0275cmp=c({type:t,selectors:[["bkd-my-grades-header"]],decls:6,vars:7,consts:[[1,"d-flex","justify-content-between","header"],[3,"reports"]],template:function(e,i){e&1&&(S(0,"div",0)(1,"div"),v(2),o(3,"translate"),m(),p(4,"bkd-student-grades-actions",1),o(5,"async"),m()),e&2&&(a(2),g(d(3,2,"my-grades.header")),a(2),h("reports",d(5,4,i.myGradesService.testReports$)??F(6,te)))},dependencies:[Q,G,$],styles:[".header[_ngcontent-%COMP%]{padding-bottom:1rem}.report[_ngcontent-%COMP%]{margin-left:1rem}"]})}}return t})();function ie(t,Z){t&1&&p(0,"bkd-spinner")}function re(t,Z){if(t&1&&p(0,"bkd-student-grades-accordion",1),t&2){D();let r=b(0),e=b(2),i=b(4);h("courses",r)("studentId",e)("gradingScales",i)("isEditable",!1)}}var W=(()=>{class t{constructor(){this.myGradesService=s(l)}static{this.\u0275fac=function(e){return new(e||t)}}static{this.\u0275cmp=c({type:t,selectors:[["bkd-my-grades-show"]],features:[I([J])],decls:14,vars:15,consts:[[1,"bkd-container","bkd-container-limited"],[3,"courses","studentId","gradingScales","isEditable"]],template:function(e,i){e&1&&(y(0),o(1,"async"),y(2),o(3,"async"),y(4),o(5,"async"),S(6,"div",0)(7,"h1"),v(8),o(9,"translate"),m(),p(10,"bkd-my-grades-header"),L(11,ie,1,0,"bkd-spinner"),o(12,"async"),A(13,re,1,4,"bkd-student-grades-accordion",1),m()),e&2&&(C(d(1,2,i.myGradesService.studentCoursesSorted$)),a(2),C(d(3,5,i.myGradesService.studentId$)),a(2),C(d(5,8,i.myGradesService.gradingScales$)),a(4),g(d(9,11,"my-grades.title")),a(3),B(d(12,13,i.myGradesService.loading$)?11:13))},dependencies:[V,K,U,G,$],encapsulation:2})}}return t})();var X=(()=>{class t{constructor(){}static{this.\u0275fac=function(e){return new(e||t)}}static{this.\u0275cmp=c({type:t,selectors:[["bkd-my-grades"]],features:[I([l])],decls:1,vars:0,template:function(e,i){e&1&&p(0,"router-outlet")},dependencies:[P],encapsulation:2})}}return t})();var Te=[{path:"",component:X,children:[{path:"",component:W}]}];export{Te as MY_GRADES_ROUTES};
