File: /var/www/vhost/disk-apps/pwa.sports-crowd.com/www/7930.79ff7f76248e6f29.js
"use strict";(self.webpackChunkapp=self.webpackChunkapp||[]).push([[7930,5553,7934,315],{55553:(f,h,s)=>{s.d(h,{h:()=>r});var u=s(77897),t=s(56610),v=s(41683),o=s(13721),p=s(22882),_=s(37222),c=s(36594),g=s(2978);let r=(()=>{class d{static#t=this.\u0275fac=function(e){return new(e||d)};static#e=this.\u0275mod=g.$C({type:d});static#n=this.\u0275inj=g.G2t({imports:[t.MD,u.bv,o.h,v.Y,p.h.forChild(),_.YN,c.rJ]})}return d})()},47930:(f,h,s)=>{s.r(h),s.d(h,{AcademyDocumentsPageModule:()=>a});var u=s(56610),t=s(37222),v=s(22882),o=s(77897),p=s(36075),_=s(54349),c=s(2978);const g=[{path:"",component:_.m}];let r=(()=>{class e{static#t=this.\u0275fac=function(m){return new(m||e)};static#e=this.\u0275mod=c.$C({type:e});static#n=this.\u0275inj=c.G2t({imports:[p.iI.forChild(g),p.iI]})}return e})();var d=s(55553),n=s(13797);let a=(()=>{class e{static#t=this.\u0275fac=function(m){return new(m||e)};static#e=this.\u0275mod=c.$C({type:e});static#n=this.\u0275inj=c.G2t({imports:[u.MD,t.YN,o.bv,v.h,r,d.h]})}return e})();c.wjB(_.m,[u.Sq,o.Jm,o.QW,o.hU,o.W9,o.M0,o.lO,o.eU,o.ln,o.BC,o.ai,n.V],[v.D9])},54349:(f,h,s)=>{s.d(h,{m:()=>g});var u=s(73308),t=s(2978),v=s(22882),o=s(54171),p=s(57992),_=s(77897);function c(r,d){if(1&r){const n=t.RV6();t.j41(0,"ion-col",5)(1,"app-upload-file",6),t.bIt("file",function(e){const l=t.eBV(n).$implicit,m=t.XpG();return t.Njj(m.saveFile(e,l))}),t.k0s()()}if(2&r){const n=d.$implicit,a=t.XpG();t.R7$(1),t.Y8G("document",n)("parent",a)}}let g=(()=>{class r{constructor(n,a,e,i,l){this.translateService=n,this.utilsService=a,this.academyService=e,this.modalCtrl=i,this.alertController=l,this.externalFormExclusive=!1,this.documents=[],this.parameters=[]}ngOnInit(){this.loadInit(100)}loadInit(n=0){setTimeout(()=>new Promise((a,e)=>{this.utilsService.presentLoading(this.translateService.instant("all.loading")).then(()=>{Promise.all([this.academyService.getParameters(this.typeAcademy).then(i=>{this.parameters=i}),this.academyService.getDocuments(this.academyUser,this.externalFormExclusive).then(i=>{this.documents=i})]).then(()=>{this.utilsService.closeAllAlerts(),a(!1)}).catch(i=>{this.utilsService.closeAllAlerts(),console.log("Error loadInit AcademyPage",i),e(i)})})}),n)}getParameterValue(n){let a=this.parameters.filter(e=>e.key===n)[0];return a?a.value:""}saveFile(n,a){var e=this;const i=new FormData;i.append("file",n),i.append("documentId",a.id),i.append("userId",this.academyUser.id),this.utilsService.presentLoading(this.translateService.instant("all.loading")).then(()=>{this.academyService.uploadUserAcademyDocument(i).then(function(){var l=(0,u.A)(function*(m){m.r&&(e.utilsService.presentToast(4e3,"success","top",m.m),e.loadInit(0)),e.utilsService.closeAllAlerts()});return function(m){return l.apply(this,arguments)}}(),l=>{console.log("error saveFile: ",l),this.utilsService.closeAllAlerts()})})}finishDocumentLoad(){var n=this;return(0,u.A)(function*(){for(var a of n.documents)if(a.required&&(!a.link||"pending"===a.link))return void n.utilsService.presentToast(3e3,"warning","top",n.translateService.instant(a.external_form_link?"SIGNED_DOCUMENT_REQUIRED":"DOCUMENT_REQUIRED")+a.name);n.utilsService.presentLoading(n.translateService.instant("all.loading")).then(()=>{n.academyService.finishUploadDocuments(n.academyUser.id).then(function(){var e=(0,u.A)(function*(i){i.r&&(yield(yield n.alertController.create({message:n.getParameterValue(n.externalFormExclusive?"documents_sign_alert_text":"documents_upload_alert_text"),backdropDismiss:!1,buttons:[{text:n.translateService.instant("all.accept"),handler:()=>{n.cancel(!1)}}]})).present()),n.utilsService.closeAllAlerts()});return function(i){return e.apply(this,arguments)}}(),e=>{console.log("error finishDocumentLoad: ",e),n.utilsService.closeAllAlerts()})})})()}cancel(n,a){this.modalCtrl.dismiss({status:n,valueOrder:a})}static#t=this.\u0275fac=function(a){return new(a||r)(t.rXU(v.c$),t.rXU(o.T),t.rXU(p.k),t.rXU(_.W3),t.rXU(_.hG))};static#e=this.\u0275cmp=t.VBU({type:r,selectors:[["app-academy-documents"]],decls:15,vars:6,consts:[[1,"responsive-text"],["slot","end"],["strong","","color","light",3,"click"],["size","6",4,"ngFor","ngForOf"],["expand","block","fill","solid","shape","round",1,"ion-padding-start","ion-padding-end","ion-margin-bottom","ion-margin-top",3,"click"],["size","6"],[3,"document","parent","file"]],template:function(a,e){1&a&&(t.j41(0,"ion-header")(1,"ion-toolbar")(2,"ion-title",0),t.EFF(3),t.k0s(),t.j41(4,"ion-buttons",1)(5,"ion-button",2),t.bIt("click",function(){return e.cancel(!1)}),t.EFF(6),t.nI1(7,"translate"),t.k0s()()()(),t.j41(8,"ion-content")(9,"ion-grid")(10,"ion-row"),t.DNE(11,c,2,2,"ion-col",3),t.k0s()()(),t.j41(12,"ion-footer")(13,"ion-button",4),t.bIt("click",function(){return e.finishDocumentLoad()}),t.EFF(14),t.k0s()()),2&a&&(t.R7$(3),t.SpI("",e.getParameterValue(e.externalFormExclusive?"documents_sign_title":"documents_upload_title")," "),t.R7$(3),t.JRh(t.bMT(7,4,"all.close")),t.R7$(5),t.Y8G("ngForOf",e.documents),t.R7$(3),t.SpI(" ",e.getParameterValue(e.externalFormExclusive?"documents_sign_button_text":"documents_upload_button_text")," "))}})}return r})()}}]);