PageSourceSearch

https://cursostaddletraining.web.app/chunk-SBSSKZMX.js

js cursostaddletraining.web.app collected 2026-10-03 12:21:01 UTC 17,974 bytes, 1 lines download raw bytes

1import{a as fe,b as Ce,c as Ee,d as ge,e as Me,f as ve,g as be,h as Pe,i as we,j as Be,k as ye}from"./chunk-7V2EBUGQ.js";import{a as Se,c as Ie}from"./chunk-LG37RV3I.js";import{a as Ae,b as De}from"./chunk-TW6WBMRQ.js";import{c as Te}from"./chunk-ZAEJJ3Q7.js";import"./chunk-VVJXDZ46.js";import"./chunk-3GQIMQSC.js";import{a as he,b as xe}from"./chunk-PBBK2JTT.js";import{a as ue,i as _e}from"./chunk-QBSV4DV6.js";import{b as de,c as pe}from"./chunk-XFPR4Y37.js";import"./chunk-CFSYY66O.js";import{a as ce}from"./chunk-7NF2NQYR.js";import{a as le,h as se}from"./chunk-6HDRR3YO.js";import"./chunk-WHB5JO34.js";import{G as me,c as ae,h as oe,m as re}from"./chunk-NR4L6IUA.js";import"./chunk-3CHLB4Q7.js";import"./chunk-WE57IZWD.js";import{c as ee,e as te}from"./chunk-M4DYHRCR.js";import"./chunk-73KTF5X2.js";import"./chunk-672BLVQC.js";import"./chunk-SQP3F6YW.js";import"./chunk-EFQHBTIH.js";import"./chunk-H2ML5XWA.js";import"./chunk-V5CVZAXB.js";import{Bb as z,Ca as ne,Eb as B,Ha as D,Pa as j,ab as O,hb as q,k as L,ma as ie,ob as X,pb as F}from"./chunk-BBWGGV3N.js";import"./chunk-M4BMCAZH.js";import"./chunk-OEQL7UYX.js";import{$b as E,Ab as b,Ba as p,Bd as W,Cd as Y,Kd as Z,Lb as f,Nb as C,Nc as T,Oc as K,Pc as R,Qb as P,Rb as w,Sb as h,Tb as r,Ub as a,Vb as k,Wb as y,Xb as S,Yc as A,Zb as N,ac as c,ga as G,hb as m,la as V,mc as Q,pc as l,qc as I,ra as u,rc as M,sa as _,sc as H,tc as J,ub as U}from"./chunk-DK4636C2.js";import{g as d}from"./chunk-RA2WU32H.js";var $=class i{firestore=V(ie);getClosedBatches(){return d(this,null,function*(){let t=D(this.firestore,"premiumExamBatches"),e=F(t,B("status","==","cerrado"),X("closedAt","desc"),q(50));return(yield O(e)).docs.map(o=>{let s=o.data();return{id:o.id,status:s.status,createdAt:s.createdAt,closedAt:s.closedAt,emails:s.emails??[]}})})}getOpenBatch(){return d(this,null,function*(){let t=D(this.firestore,"premiumExamBatches"),e=F(t,B("status","==","nuevo"),X("createdAt","desc"),q(1)),n=yield O(e);if(n.empty)return null;let o=n.docs[0],s=o.data();return{id:o.id,status:s.status,createdAt:s.createdAt,closedAt:s.closedAt,emails:s.emails??[]}})}getPremiumCourses(){return d(this,null,function*(){let t=D(this.firestore,"courses"),e=F(t,B("categories","==","PREMIUM"));return(yield O(e)).docs.map(o=>{let s=o.data();return{id:o.id,title:s?.titles?.description??"SIN NOMBRE"}})})}createBatch(t){return d(this,null,function*(){let e=D(this.firestore,"premiumExamBatches");return ne(e,{status:"nuevo",createdAt:L.now(),closedAt:null,emails:t})})}saveBatch(t,e){return d(this,null,function*(){let n=j(this.firestore,`premiumExamBatches/${t}`);return z(n,{emails:e})})}closeBatch(t,e){return d(this,null,function*(){let n=j(this.firestore,`premiumExamBatches/${t}`);return z(n,{status:"cerrado",closedAt:L.now(),emails:e})})}getExamReport(t){return d(this,null,function*(){let e=D(this.firestore,"examenes"),n=[];for(let o of t.emails){let s=F(e,B("email","==",o),B("tipoExamen","==","FINAL"),B("fechaExamen",">=",t.startMs),B("fechaExamen","<=",t.endMs)),g=yield O(s);n.push(...g.docs.map(v=>{let x=v.data();return{id:v.id,email:x.email,calificacion:x.calificacion,fechaExamen:x.fechaExamen,nombreCompleto:{nombreAlumno:x.nombreCompleto?.nombreAlumno??x.nombreAlumno,apellidoPaterno:x.nombreCompleto?.apellidoPaterno??x.apellidoPaterno,apellidoMaterno:x.nombreCompleto?.apellidoMaterno??x.apellidoMaterno},nombreExamen:x.nombreExamen,tipoExamen:x.tipoExamen}}))}return n})}static \u0275fac=function(e){return new(e||i)};static \u0275prov=G({token:i,factory:i.\u0275fac,providedIn:"root"})};var Re=(i,t)=>t.id,Oe=(i,t)=>t.email,Ne=(i,t)=>t.courseId,Fe=(i,t)=>t.nombreExamen;function $e(i,t){if(i&1&&(r(0,"mat-option",4),l(1),T(2,"date"),a()),i&2){let e=t.$implicit;h("value",e.id),m(),H(" Cerrado: ",R(2,3,e.closedAt==null?null:e.closedAt.toDate(),"dd/MM/yyyy HH:mm")," - Emails: ",(e.emails==null?null:e.emails.length)??0," ")}}function He(i,t){if(i&1&&(r(0,"span"),l(1),T(2,"date"),a()),i&2){let e=c();m(),M("Cierre: ",R(2,1,e.closedAt(),"dd/MM/yyyy HH:mm"))}}function Le(i,t){if(i&1&&(r(0,"mat-option",4),l(1),a()),i&2){let e=t.$implicit;h("value",e.id),m(),M(" ",e.title," ")}}function je(i,t){if(i&1){let e=N();r(0,"div",12)(1,"mat-form-field",2)(2,"mat-label"),l(3,"Email"),a(),r(4,"input",13),E("ngModelChange",function(o){u(e);let s=c();return _(s.currentEmail.set(o))}),a()(),r(5,"mat-form-field",2)(6,"mat-label"),l(7,"Curso"),a(),r(8,"mat-select",14),E("ngModelChange",function(o){u(e);let s=c();return _(s.selectedCourseId.set(o))})("closed",function(){u(e);let o=c();return _(o.courseSearch.set(""))}),r(9,"mat-option")(10,"input",15),E("ngModelChange",function(o){u(e);let s=c();return _(s.courseSearch.set(o))})("click",function(o){return u(e),_(o.stopPropagation())})("keydown",function(o){return u(e),_(o.stopPropagation())}),a()(),P(11,Le,2,2,"mat-option",4,Re),a()()(),r(13,"div",16)(14,"div",17)(15,"button",18),E("click",function(){u(e);let o=c();return _(o.addRelation())}),l(16," Relacionar curso "),a(),r(17,"button",19),E("click",function(){u(e);let o=c();return _(o.viewReport())}),l(18," Ver reporte o avances "),a()(),r(19,"div",20)(20,"button",21),E("click",function(){u(e);let o=c();return _(o.closeBatch())}),l(21," Cerrar semana de cursos "),a()()()}if(i&2){let e=c();m(4),h("ngModel",e.currentEmail()),m(4),h("ngModel",e.selectedCourseId()),m(2),h("ngModel",e.courseSearch()),m(),w(e.filteredCourses()),m(6),h("disabled",!e.emails().length||e.loading()),m(3),h("disabled",!e.batchId()||e.saving())}}function qe(i,t){i&1&&(r(0,"p",8),l(1," Este registro ya fue cerrado. Para agregar m\xE1s emails debes crear un nuevo registro. "),a())}function Xe(i,t){i&1&&(r(0,"p"),l(1,"No hay emails relacionados todav\xEDa."),a())}function ze(i,t){if(i&1){let e=N();r(0,"button",25),E("click",function(){u(e);let o=c().$implicit,s=c();return _(s.removeEmail(o.email))}),l(1," Eliminar email "),a()}}function Ge(i,t){if(i&1){let e=N();r(0,"button",25),E("click",function(){u(e);let o=c().$implicit,s=c().$implicit,g=c();return _(g.removeCourse(s.email,o.courseId))}),l(1," Quitar "),a()}}function Ue(i,t){if(i&1&&(r(0,"div",24)(1,"span"),l(2),a(),f(3,Ge,2,0,"button",23),a()),i&2){let e=t.$implicit,n=c(2);m(2),M("",e.title," "),m(),C(n.isClosed()?-1:3)}}function Qe(i,t){if(i&1&&(r(0,"div",9)(1,"div",22)(2,"strong"),l(3),a(),f(4,ze,2,0,"button",23),a(),P(5,Ue,4,2,"div",24,Ne),k(7,"mat-divider"),a()),i&2){let e=t.$implicit,n=c();m(3),M("Email: ",e.email),m(),C(n.isClosed()?-1:4),m(),w(e.courses)}}function Je(i,t){i&1&&(r(0,"p"),l(1,"Cargando..."),a())}function Ke(i,t){i&1&&(r(0,"p"),l(1,"No hay resultados cargados."),a())}function We(i,t){i&1&&(r(0,"th",36),l(1,"Email"),a())}function Ye(i,t){if(i&1&&(r(0,"td",37),l(1),a()),i&2){let e=t.$implicit;m(),I(e.email)}}function Ze(i,t){i&1&&(r(0,"th",36),l(1,"Alumno"),a())}function et(i,t){if(i&1&&(r(0,"td",37),l(1),a()),i&2){let e=t.$implicit,n=c(2);m(),I(n.getStudentName(e))}}function tt(i,t){i&1&&(r(0,"th",36),l(1,"Examen"),a())}function it(i,t){if(i&1&&(r(0,"td",37),l(1),a()),i&2){let e=t.$implicit;m(),I(e.nombreExamen)}}function nt(i,t){i&1&&(r(0,"th",36),l(1,"Tipo"),a())}function at(i,t){if(i&1&&(r(0,"td",37),l(1),a()),i&2){let e=t.$implicit;m(),I(e.tipoExamen)}}function ot(i,t){i&1&&(r(0,"th",36),l(1,"Calificaci\xF3n"),a())}function rt(i,t){if(i&1&&(r(0,"td",37),l(1),a()),i&2){let e=t.$implicit;m(),I(e.calificacion)}}function mt(i,t){i&1&&(r(0,"th",36),l(1,"Fecha examen"),a())}function lt(i,t){if(i&1&&(r(0,"td",37),l(1),T(2,"date"),a()),i&2){let e=t.$implicit;m(),M(" ",R(2,1,e.fechaExamen,"dd/MM/yyyy HH:mm")," ")}}function st(i,t){i&1&&k(0,"tr",38)}function ct(i,t){i&1&&k(0,"tr",39)}function dt(i,t){if(i&1&&(r(0,"table",10),y(1,26),b(2,We,2,0,"th",27)(3,Ye,2,1,"td",28),S(),y(4,29),b(5,Ze,2,0,"th",27)(6,et,2,1,"td",28),S(),y(7,30),b(8,tt,2,0,"th",27)(9,it,2,1,"td",28),S(),y(10,31),b(11,nt,2,0,"th",27)(12,at,2,1,"td",28),S(),y(13,32),b(14,ot,2,0,"th",27)(15,rt,2,1,"td",28),S(),y(16,33),b(17,mt,2,0,"th",27)(18,lt,3,4,"td",28),S(),b(19,st,1,0,"tr",34)(20,ct,1,0,"tr",35),a()),i&2){let e=c();h("dataSource",e.report()),m(19),h("matHeaderRowDef",e.displayedColumns),m(),h("matRowDefColumns",e.displayedColumns)}}function pt(i,t){if(i&1&&(r(0,"p"),l(1),a()),i&2){let e=t.$implicit;m(),J(" ",e.nombreExamen," - ",e.total," ",e.total===1?"Examen":"Ex\xE1menes"," ")}}function ut(i,t){if(i&1&&(r(0,"div",40)(1,"h4"),l(2),a(),P(3,pt,2,3,"p",null,Fe),a()),i&2){let e=t.$implicit;m(2),M("Email: ",e.email),m(),w(e.courses)}}function _t(i,t){if(i&1&&(r(0,"p",41)(1,"strong"),l(2),a(),l(3),a()),i&2){let e=t.$implicit;m(2),I(e.nombreExamen),m(),H(" - TOTAL ",e.total," ",e.total===1?"EXAMEN":"EX\xC1MENES"," ")}}function ht(i,t){if(i&1&&(r(0,"mat-card",11)(1,"h3"),l(2,"Totales por email"),a(),P(3,ut,5,1,"div",40,Oe),k(5,"mat-divider"),r(6,"h3"),l(7,"Total general de ex\xE1menes"),a(),P(8,_t,4,3,"p",41,Fe),a()),i&2){let e=c();m(3),w(e.reportTotalsByEmail()),m(5),w(e.reportGrandTotals())}}var ke=class i{batchService=V($);batchId=p(null);status=p("nuevo");createdAt=p(new Date);closedAt=p(null);courses=p([]);emails=p([]);currentEmail=p("");selectedCourseId=p(null);closedBatches=p([]);selectedClosedBatchId=p(null);viewMode=p("actual");courseSearch=p("");filteredCourses=A(()=>{let t=this.courseSearch().trim().toLowerCase();return t?this.courses().filter(e=>e.title.toLowerCase().includes(t)):this.courses()});report=p([]);loading=p(!1);saving=p(!1);displayedColumns=["email","alumno","nombreExamen","tipoExamen","calificacion","fechaExamen"];isClosed=A(()=>this.status()==="cerrado");emailList=A(()=>this.emails().map(t=>t.email));reportTotalsByEmail=A(()=>{let t=new Map;for(let e of this.report()){let n=e.email??"SIN EMAIL",o=e.nombreExamen??"SIN EXAMEN";t.has(n)||t.set(n,new Map);let s=t.get(n);s.set(o,(s.get(o)??0)+1)}return Array.from(t.entries()).map(([e,n])=>({email:e,courses:Array.from(n.entries()).map(([o,s])=>({nombreExamen:o,total:s}))}
1))});reportGrandTotals=A(()=>{let t=new Map;for(let e of this.report()){let n=e.nombreExamen??"SIN EXAMEN";t.set(n,(t.get(n)??0)+1)}return Array.from(t.entries()).map(([e,n])=>({nombreExamen:e,total:n}))});ngOnInit(){return d(this,null,function*(){this.loading.set(!0);try{let t=yield this.batchService.getPremiumCourses();this.courses.set(t);let e=yield this.batchService.getOpenBatch();e&&this.loadBatch(e);let n=yield this.batchService.getClosedBatches();this.closedBatches.set(n)}finally{this.loading.set(!1)}})}loadBatch(t){this.batchId.set(t.id),this.status.set(t.status),this.createdAt.set(t.createdAt.toDate()),this.closedAt.set(t.closedAt?t.closedAt.toDate():null),this.emails.set(t.emails??[]),this.report.set([])}selectClosedBatch(t){let e=this.closedBatches().find(n=>n.id===t);e&&(this.viewMode.set("historico"),this.selectedClosedBatchId.set(t),this.loadBatch(e))}startNewBatch(){this.viewMode.set("actual"),this.selectedClosedBatchId.set(null),this.batchId.set(null),this.status.set("nuevo"),this.createdAt.set(new Date),this.closedAt.set(null),this.emails.set([]),this.report.set([])}addRelation(){return d(this,null,function*(){if(this.isClosed())return;let t=this.currentEmail().trim().toLowerCase(),e=this.selectedCourseId();if(!t||!e)return;let n=this.courses().find(v=>v.id===e);if(!n)return;let o=structuredClone(this.emails()),s=o.find(v=>v.email===t);s||(s={email:t,courses:[]},o.push(s)),s.courses.some(v=>v.courseId===e)||s.courses.push({courseId:e,title:n.title}),this.emails.set(o),yield this.persistBatch(),this.currentEmail.set(""),this.selectedCourseId.set(null)})}removeEmail(t){return d(this,null,function*(){if(this.isClosed())return;let e=this.emails().filter(n=>n.email!==t);this.emails.set(e),yield this.persistBatch()})}removeCourse(t,e){return d(this,null,function*(){if(this.isClosed())return;let n=structuredClone(this.emails()),o=n.find(g=>g.email===t);if(!o)return;o.courses=o.courses.filter(g=>g.courseId!==e);let s=n.filter(g=>g.courses.length>0);this.emails.set(s),yield this.persistBatch()})}persistBatch(){return d(this,null,function*(){if(this.viewMode()!=="historico"){this.saving.set(!0);try{if(this.batchId())yield this.batchService.saveBatch(this.batchId(),this.emails());else{let t=yield this.batchService.getOpenBatch();if(t){this.loadBatch(t);return}let e=yield this.batchService.createBatch(this.emails());this.batchId.set(e.id)}}finally{this.saving.set(!1)}}})}closeBatch(){return d(this,null,function*(){if(this.batchId()){this.saving.set(!0);try{yield this.batchService.closeBatch(this.batchId(),this.emails()),this.status.set("cerrado"),this.closedAt.set(new Date)}finally{this.saving.set(!1)}}})}viewReport(){return d(this,null,function*(){let t=this.emailList();if(t.length){this.loading.set(!0);try{let e=this.createdAt().getTime(),n=(this.closedAt()??new Date).getTime();console.log("Rango reporte",{startMs:e,startDate:new Date(e),endMs:n,endDate:new Date(n)});let o=yield this.batchService.getExamReport({emails:t,startMs:e,endMs:n});this.report.set(o)}finally{this.loading.set(!1)}}})}getStudentName(t){let e=t.nombreCompleto;return[e?.nombreAlumno,e?.apellidoPaterno,e?.apellidoMaterno].filter(Boolean).join(" ")}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=U({type:i,selectors:[["app-premium-exam-batch"]],decls:42,vars:18,consts:[[1,"page"],[1,"card"],["appearance","outline"],[3,"ngModelChange","ngModel"],[3,"value"],["mat-stroked-button","","color","primary",3,"click"],[1,"header"],[1,"dates"],[1,"closed-message"],[1,"email-block"],["mat-table","",1,"mat-elevation-z1","report-table",3,"dataSource"],[1,"totals-card"],[1,"form-grid"],["matInput","","type","email",3,"ngModelChange","ngModel"],[3,"ngModelChange","closed","ngModel"],["matInput","","placeholder","Buscar curso...",3,"ngModelChange","click","keydown","ngModel"],[1,"actions-row"],[1,"actions-left"],["mat-raised-button","","color","primary",3,"click"],["mat-stroked-button","","color","primary",3,"click","disabled"],[1,"actions-right"],["mat-raised-button","",1,"close-batch-btn",3,"click","disabled"],[1,"email-title"],["mat-button","","color","warn"],[1,"course-row"],["mat-button","","color","warn",3,"click"],["matColumnDef","email"],["mat-header-cell","",4,"matHeaderCellDef"],["mat-cell","",4,"matCellDef"],["matColumnDef","alumno"],["matColumnDef","nombreExamen"],["matColumnDef","tipoExamen"],["matColumnDef","calificacion"],["matColumnDef","fechaExamen"],["mat-header-row","",4,"matHeaderRowDef"],["mat-row","",4,"matRowDef","matRowDefColumns"],["mat-header-cell",""],["mat-cell",""],["mat-header-row",""],["mat-row",""],[1,"total-email-block"],[1,"grand-total-row"]],template:function(e,n){e&1&&(r(0,"section",0)(1,"mat-card",1)(2,"h3"),l(3,"Registros anteriores"),a(),r(4,"mat-form-field",2)(5,"mat-label"),l(6,"Consultar registro cerrado"),a(),r(7,"mat-select",3),E("ngModelChange",function(s){return n.selectClosedBatch(s)}),P(8,$e,3,6,"mat-option",4,Re),a()(),r(10,"button",5),E("click",function(){return n.startNewBatch()}),l(11," Nuevo registro "),a()(),r(12,"mat-card",1)(13,"div",6)(14,"div")(15,"h2"),l(16,"Nuevo registro de cotizaci\xF3n SEMANAL INCOR "),a(),r(17,"p"),l(18,"Relaciona emails con uno o m\xE1s cursos."),a()(),r(19,"mat-chip"),l(20),T(21,"uppercase"),a()(),r(22,"div",7)(23,"span"),l(24),T(25,"date"),a(),f(26,He,3,4,"span"),a(),f(27,je,22,5),f(28,qe,2,0,"p",8),a(),r(29,"mat-card",1)(30,"h3"),l(31,"Resumen"),a(),f(32,Xe,2,0,"p"),P(33,Qe,8,2,"div",9,Oe),a(),r(35,"mat-card",1)(36,"h3"),l(37,"Reporte / avances"),a(),f(38,Je,2,0,"p"),f(39,Ke,2,0,"p"),f(40,dt,21,3,"table",10),f(41,ht,10,0,"mat-card",11),a()()),e&2&&(m(7),h("ngModel",n.selectedClosedBatchId()),m(),w(n.closedBatches()),m(11),Q("closed",n.isClosed()),m(),M(" Estatus: ",K(21,13,n.status())," "),m(4),M("Inicio: ",R(25,15,n.createdAt(),"dd/MM/yyyy HH:mm")),m(2),C(n.closedAt()?26:-1),m(),C(n.isClosed()?-1:27),m(),C(n.isClosed()?28:-1),m(4),C(n.emails().length?-1:32),m(),w(n.emails()),m(5),C(n.loading()?38:-1),m(),C(!n.loading()&&!n.report().length?39:-1),m(),C(n.report().length?40:-1),m(),C(n.report().length?41:-1))},dependencies:[Z,W,Y,me,ae,oe,re,_e,ue,te,ee,ce,se,le,pe,de,De,Ae,Te,Ie,Se,xe,he,ye,fe,Ee,be,ge,Ce,Pe,Me,ve,we,Be],styles:[".page[_ngcontent-%COMP%]{padding:24px;display:grid;gap:24px}.card[_ngcontent-%COMP%]{padding:20px}.header[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;gap:16px}.dates[_ngcontent-%COMP%]{display:flex;gap:24px;margin:16px 0;color:#666}.form-grid[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr 1fr;gap:16px}.actions[_ngcontent-%COMP%]{display:flex;align-items:center;gap:12px;margin-top:12px}.email-block[_ngcontent-%COMP%]{margin-bottom:20px}.email-title[_ngcontent-%COMP%], .course-row[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;gap:16px}.course-row[_ngcontent-%COMP%]{padding:6px 0}.closed-message[_ngcontent-%COMP%]{padding:12px;background:#fff3cd;border-radius:8px}.closed[_ngcontent-%COMP%]{background:#c62828!important;color:#fff!important}.report-table[_ngcontent-%COMP%]{width:100%}@media (max-width: 900px){.form-grid[_ngcontent-%COMP%]{grid-template-columns:1fr}.dates[_ngcontent-%COMP%]{flex-direction:column;gap:4px}}.totals-card[_ngcontent-%COMP%]{margin-top:24px;padding:20px}.total-email-block[_ngcontent-%COMP%]{margin-bottom:20px}
1.total-email-block[_ngcontent-%COMP%]   h4[_ngcontent-%COMP%]{margin-bottom:8px}.grand-total-row[_ngcontent-%COMP%]{font-size:15px;margin:8px 0}.close-batch-btn[_ngcontent-%COMP%]{background:#c62828!important;color:#fff!important;font-weight:700;letter-spacing:.3px;min-width:220px}.close-batch-btn[_ngcontent-%COMP%]:hover{background:#b71c1c!important}.close-batch-btn[_ngcontent-%COMP%]:disabled{background:#ccc!important;color:#666!important}.actions-row[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center;gap:16px;margin-top:16px;flex-wrap:wrap}.actions-left[_ngcontent-%COMP%], .actions-right[_ngcontent-%COMP%]{display:flex;align-items:center;gap:12px}"]})};export{ke as PremiumExamBatchComponent};

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.