File: /var/www/vhost/disk-apps/pwa.sports-crowd.com/www/4083.40d0385a74799406.js
"use strict";(self.webpackChunkapp=self.webpackChunkapp||[]).push([[4083,2697,5553,7934,1337,315],{55553:(D,u,n)=>{n.d(u,{h:()=>p});var o=n(77897),E=n(56610),f=n(41683),t=n(13721),v=n(22882),r=n(37222),c=n(36594),y=n(2978);let p=(()=>{class d{static#t=this.\u0275fac=function(U){return new(U||d)};static#e=this.\u0275mod=y.$C({type:d});static#n=this.\u0275inj=y.G2t({imports:[E.MD,o.bv,t.h,f.Y,v.h.forChild(),r.YN,c.rJ]})}return d})()},81337:(D,u,n)=>{n.d(u,{O:()=>r});var o=n(2978),E=n(56610),f=n(77897);function t(c,y){if(1&c&&o.nrm(0,"img",5),2&c){const p=o.XpG();o.FS9("src",p.emptySettingsSlide.urlImage,o.B4B)}}function v(c,y){if(1&c&&(o.j41(0,"p"),o.EFF(1),o.k0s()),2&c){const p=o.XpG();o.R7$(1),o.SpI(" ",p.emptySettingsSlide.text," ")}}let r=(()=>{class c{constructor(){this.emptySettingsSlide=[],this.slideOpts={allowSlidePrev:!1,allowSlideNext:!1,initialSlide:1,speed:400}}ngOnInit(){}static#t=this.\u0275fac=function(d){return new(d||c)};static#e=this.\u0275cmp=o.VBU({type:c,selectors:[["app-empty-component"]],inputs:{emptySettingsSlide:"emptySettingsSlide"},decls:6,vars:3,consts:[["pager","false",3,"options"],[1,"slide_center"],[1,"slide"],["alt","image_camponent",3,"src",4,"ngIf"],[4,"ngIf"],["alt","image_camponent",3,"src"]],template:function(d,_){1&d&&(o.j41(0,"ion-slides",0)(1,"ion-slide",1)(2,"div",2),o.DNE(3,t,1,1,"img",3),o.j41(4,"ion-label"),o.DNE(5,v,2,1,"p",4),o.k0s()()()()),2&d&&(o.Y8G("options",_.slideOpts),o.R7$(3),o.Y8G("ngIf",_.emptySettingsSlide.showImage),o.R7$(2),o.Y8G("ngIf",_.emptySettingsSlide.showText))},dependencies:[E.bT,f.he,f.q3,f.tR],styles:["ion-slides[_ngcontent-%COMP%]{height:100%}.swiper-slide[_ngcontent-%COMP%]{display:block}.swiper-slide[_ngcontent-%COMP%] h2[_ngcontent-%COMP%]{margin-top:2.8rem}.swiper-slide[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{max-height:50%;max-width:40%;margin:60px 0 40px;pointer-events:none}b[_ngcontent-%COMP%]{font-weight:500}p[_ngcontent-%COMP%]{padding:0 40px;font-size:14px;line-height:1.5;color:var(--ion-color-step-600, #60646b)}p[_ngcontent-%COMP%] b[_ngcontent-%COMP%]{color:var(--ion-text-color, #000000)}.slide_center[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center}"]})}return c})()},24083:(D,u,n)=>{n.r(u),n.d(u,{AcademyUserCardPageModule:()=>_});var o=n(56610),E=n(37222),f=n(22882),t=n(77897),v=n(36075),r=n(22577),c=n(2978);const y=[{path:"",component:r.l}];let p=(()=>{class g{static#t=this.\u0275fac=function(T){return new(T||g)};static#e=this.\u0275mod=c.$C({type:g});static#n=this.\u0275inj=c.G2t({imports:[v.iI.forChild(y),v.iI]})}return g})();var d=n(55553);let _=(()=>{class g{static#t=this.\u0275fac=function(T){return new(T||g)};static#e=this.\u0275mod=c.$C({type:g});static#n=this.\u0275inj=c.G2t({imports:[o.MD,E.YN,t.bv,f.h,p,d.h]})}return g})()},22577:(D,u,n)=>{n.d(u,{l:()=>w});var o=n(73308),E=n(72979),f=n(29606),t=n(2978),v=n(36075),r=n(77897),c=n(54171),y=n(3366);let p=(()=>{class m{constructor(i,e){this.utilsService=i,this.api=e}getCarnets(i){var e=this;return(0,o.A)(function*(){return e.api.get("carnet/get",yield e.utilsService.getAccessToken(),i)})()}static#t=this.\u0275fac=function(e){return new(e||m)(t.KVO(c.T),t.KVO(y.G))};static#e=this.\u0275prov=t.jDH({token:m,factory:m.\u0275fac,providedIn:"root"})}return m})();var d=n(7125),_=n(22882),g=n(56610),U=n(81337);const A=["barCanvas"];function T(m,R){if(1&m&&t.nrm(0,"app-empty-component",7),2&m){const i=t.XpG();t.Y8G("emptySettingsSlide",i.emptyDataSlide)}}function j(m,R){if(1&m){const i=t.RV6();t.j41(0,"ion-card",9),t.nrm(1,"canvas",10,11),t.j41(3,"ion-fab",12)(4,"ion-fab-button",13),t.bIt("click",function(){const s=t.eBV(i).$implicit,a=t.XpG(2);return t.Njj(a.optionImage("canvasid_"+s.id,"share"))}),t.nrm(5,"ion-icon",14),t.k0s()()()}if(2&m){const i=R.$implicit;t.R7$(1),t.Mz_("id","canvasid_",i.id,"")}}function $(m,R){if(1&m&&(t.j41(0,"div"),t.DNE(1,j,6,1,"ion-card",8),t.k0s()),2&m){const i=t.XpG();t.R7$(1),t.Y8G("ngForOf",i.carnets)}}let w=(()=>{class m{constructor(i,e,l,s,a){this.route=i,this.modalCtrl=e,this.carnetService=l,this.cityProvider=s,this.translateService=a,this.carnets=[]}ngOnInit(){this.emptyDataSlide={showImage:!1,urlImage:"",showText:!0,text:this.translateService.instant("NOT_USER_CARDS")},this.getCarnets()}getCarnets(){var i=this;return(0,o.A)(function*(){(yield i.carnetService.getCarnets({show_in:"academy",academy_user_id:i.user.id})).subscribe({next:e=>{i.carnets=e;for(const l of i.carnets)i.paintImageCanvas(l)},error:e=>{console.error("error provider getCarnets: ",e)},complete:()=>{}})})()}paintImageCanvas(i){var e=this;setTimeout(()=>{this.canvaslist.forEach(function(){var l=(0,o.A)(function*(s){let a=s.nativeElement.getContext("2d");s.nativeElement.width=600;let h=new Image;h.crossOrigin="*";let C=s.nativeElement.id;C=C.slice(9);let P=`${e.user.student_name} ${e.user.student_last_name}`,B=e.user.identification,G=e.user.student_document_type.alias,O=i.name,M=i.optional?i.optional:"",x=i.font_type,S=i.font_color,N=(G?G+": "+B:B).toUpperCase();P=P.toUpperCase(),O=O.toUpperCase(),e.user.academy_category&&(O+=" - "+e.user.academy_category.name);var L={u:e.user.id,c:i.id,t:"A"};let F=new Image;F.src=String(yield e.generateQR(JSON.stringify(L))),h.onload=()=>{s.nativeElement.height=s.nativeElement.width*(h.height/h.width),a.drawImage(h,0,0,s.nativeElement.width,s.nativeElement.height),a.beginPath(),a.fillStyle=S||"white",a.font=x?"bold 22px "+x:"bold 22px Arial black",a.textAlign="left";let I=P.split(" ");I.length>3?(a.fillText(I[0]+" "+I[1],20,200),a.fillText(I[2]+" "+I[3],20,220)):a.fillText(P.length>23?P.substring(0,22)+"...":P,20,215),a.font=x?"18px "+x:"bold 18px Arial",a.fillText(O.length>30?O.substring(0,29)+"...":O,20,240),a.fillText(N,s.nativeElement.width/4,265),e.user.academy_place&&a.fillText(e.user.academy_place,s.nativeElement.width/4,285),e.user.blood_type&&a.fillText("RH: "+e.user.blood_type,s.nativeElement.width/4,305),M&&a.fillText(M.length>30?M.substring(0,29)+"...":M,s.nativeElement.width/4,290),a.fillStyle=S||"#edd549",a.fillText("> ",s.nativeElement.width/4-20,265),M&&a.fillText("\u2714 ",s.nativeElement.width/4-20,290),a.drawImage(F,s.nativeElement.width-130,s.nativeElement.height-200,110,110),a.closePath()},h.src=(yield e.cityProvider.getGalleryUrl())+"carnet/"+i.image});return function(s){return l.apply(this,arguments)}}())},500)}generateQR(i){return new Promise((e,l)=>{E.toDataURL(i,{errorCorrectionLevel:"H",quality:1,margin:2},function(h,C){e(C)})})}optionImage(i,e){if("share"==e){let s=this.canvaslist.find(C=>C.nativeElement.id==i).nativeElement.toDataURL(),a=s.split("/")[1].split(";")[0],h=s.split(",")[1];f.Y.share({filename:(new Date).getTime()+"."+a,contentType:"application/"+a,base64Data:h}).then(()=>{}).catch(C=>{console.error("File sharing failed",C.message)})}else window.canvas2ImagePlugin.saveImageDataToLibrary(function(l){console.log(l)},function(l){console.log(l)},document.getElementById(i))}cancel(i,e){this.modalCtrl.dismiss({status:i,valueOrder:e})}static#t=this.\u0275fac=function(e){return new(e||m)(t.rXU(v.nX),t.rXU(r.W3),t.rXU(p),t.rXU(d.h),t.rXU(_.c$))};static#e=this.\u0275cmp=t.VBU({type:m,selectors:[["app-academy-user-card"]],viewQuery:function(e,l){if(1&e&&t.GBs(A,5),2&e){let s;t.mGM(s=t.lsd())&&(l.canvaslist=s)}},decls:13,vars:8,consts:[[1,"ion-no-border"],["slot","start"],[1,"ion-text-center"],["slot","end"],["strong","","color","light",3,"click"],[3,"emptySettingsSlide",4,"ngIf"],[4,"ngIf"],[3,"emptySettingsSlide"],["class","h-214",4,"ngFor","ngForOf"],[1,"h-214"],["crossorigin","anonymous",1,"imageCard",3,"id"],["barCanvas",""],[1,"fab_button"],["color","light",3,"click"],["ios","share-outline","md","share-social-outline"]],template:function(e,l){1&e&&(t.j41(0,"ion-header",0)(1,"ion-toolbar"),t.nrm(2,"ion-back-button",1),t.j41(3,"ion-title",2),t.EFF(4),t.nI1(5,"translate"),t.k0s(),t.j41(6,"ion-buttons",3)(7,"ion-button",4),t.bIt("click",function(){return l.cancel(!1)}),t.EFF(8),t.nI1(9,"translate"),t.k0s()()()(),t.j41(10,"ion-content"),t.DNE(11,T,1,1,"app-empty-component",5),t.DNE(12,$,2,1,"div",6),t.k0s()),2&e&&(t.R7$(4),t.JRh(t.bMT(5,4,"ACADEMY_ACTIONS_BUTTONS.CARNET")),t.R7$(4),t.JRh(t.bMT(9,6,"all.close")),t.R7$(3),t.Y8G("ngIf",l.carnets&&!l.carnets.length),t.R7$(1),t.Y8G("ngIf",l.carnets&&l.carnets.length))},dependencies:[g.Sq,g.bT,r.el,r.Jm,r.QW,r.b_,r.W9,r.Q8,r.YW,r.eU,r.iq,r.BC,r.ai,r.tY,U.O,_.D9],styles:[".imageCard[_ngcontent-%COMP%]{width:100%;height:214px}.h-214[_ngcontent-%COMP%]{height:214px;position:relative}.label_image[_ngcontent-%COMP%]{position:absolute;top:56%;left:6%;font-size:14px;width:135px}.fab_button[_ngcontent-%COMP%]{position:absolute;bottom:0;right:0}.fab_button_download[_ngcontent-%COMP%]{position:absolute;bottom:0;right:65px}"]})}return m})()}}]);