File: /var/www/vhost/disk-apps/pwa.sports-crowd.com/www/4088.1d503596556ffe2e.js
"use strict";(self.webpackChunkapp=self.webpackChunkapp||[]).push([[4088],{24088:(m,f,e)=>{e.r(f),e.d(f,{NotificationPageModule:()=>E});var r=e(56610),d=e(37222),a=e(77897),g=e(36075),c=e(73308),t=e(2978),s=e(22882),u=e(87473),v=e(54171);function _(o,h){if(1&o&&(t.j41(0,"p",9),t.EFF(1),t.k0s()),2&o){const i=t.XpG(2).$implicit;t.R7$(1),t.JRh(i.title)}}function N(o,h){if(1&o){const i=t.RV6();t.j41(0,"ion-card",4),t.DNE(1,_,2,1,"p",5),t.j41(2,"p",6),t.EFF(3),t.k0s(),t.j41(4,"ion-item",7)(5,"span"),t.EFF(6),t.k0s(),t.j41(7,"ion-icon",8),t.bIt("click",function(){t.eBV(i);const l=t.XpG().$implicit,p=t.XpG();return t.Njj(p.deleteNotification(l.id))}),t.k0s()()()}if(2&o){const i=t.XpG().$implicit,n=t.XpG();t.R7$(1),t.Y8G("ngIf",i.title),t.R7$(2),t.JRh(i.message),t.R7$(3),t.SpI("\u2714\ufe0f ",n.dateFormat(i.when_send?i.when_send:i.created_at),"")}}function I(o,h){if(1&o&&(t.j41(0,"div"),t.DNE(1,N,8,3,"ion-card",3),t.k0s()),2&o){const i=h.$implicit,n=t.XpG();t.R7$(1),t.Y8G("ngIf",!n.deletedNotifications.includes(i.id))}}const F=[{path:"",component:(()=>{class o{constructor(i,n,l,p){this.alertController=i,this.translateService=n,this.notificationService=l,this.utilsService=p,this.notifications=[],this.deletedNotifications=[]}ngOnInit(){this.getNotifications(),this.getDeletedNotifications()}getNotifications(){var i=this;this.utilsService.presentLoading(this.translateService.instant("all.loading")).then((0,c.A)(function*(){(yield i.notificationService.getNotifications()).subscribe(n=>{i.notifications=n,i.utilsService.dismissLoading(),i.setViewed()})}))}getDeletedNotifications(){let i=localStorage.getItem("deletedNotifications");i&&(this.deletedNotifications=JSON.parse(i))}setViewed(){localStorage.setItem("viewedNotificationsCount",this.notifications.length.toString())}deleteNotification(i){var n=this;return(0,c.A)(function*(){yield(yield n.alertController.create({message:n.translateService.instant("DELETE_NOTIFICATION_QUESTION"),buttons:[{text:n.translateService.instant("all.cancel"),role:"cancel",cssClass:"secondary"},{text:n.translateService.instant("all.accept"),handler:()=>{n.deletedNotifications.push(i),localStorage.setItem("deletedNotifications",JSON.stringify(n.deletedNotifications)),n.getDeletedNotifications()}}]})).present()})()}dateFormat(i){return new Date(i).toLocaleString()}static#t=this.\u0275fac=function(n){return new(n||o)(t.rXU(a.hG),t.rXU(s.c$),t.rXU(u.J),t.rXU(v.T))};static#i=this.\u0275cmp=t.VBU({type:o,selectors:[["app-notification"]],decls:9,vars:4,consts:[["slot","start"],["defaultHref","/app/tabs/home"],[4,"ngFor","ngForOf"],["class","notification-card",4,"ngIf"],[1,"notification-card"],["class","notification-title",4,"ngIf"],[1,"notification-content"],["lines","none",1,"notification-date"],["slot","end","name","trash-outline",2,"color","gray",3,"click"],[1,"notification-title"]],template:function(n,l){1&n&&(t.j41(0,"ion-header")(1,"ion-toolbar")(2,"ion-buttons",0),t.nrm(3,"ion-back-button",1),t.k0s(),t.j41(4,"ion-title"),t.EFF(5),t.nI1(6,"translate"),t.k0s()()(),t.j41(7,"ion-content"),t.DNE(8,I,2,1,"div",2),t.k0s()),2&n&&(t.R7$(5),t.JRh(t.bMT(6,2,"NOTIFICATIONS")),t.R7$(3),t.Y8G("ngForOf",l.notifications))},dependencies:[r.Sq,r.bT,a.el,a.QW,a.b_,a.W9,a.eU,a.iq,a.uz,a.BC,a.ai,a.tY,s.D9],styles:[".notification-card[_ngcontent-%COMP%]{padding:10px}.notification-title[_ngcontent-%COMP%]{text-align:justify;padding:10px 10px 0;color:#000;font-weight:700}.notification-content[_ngcontent-%COMP%]{text-align:justify;padding:10px 10px 0;color:#000}.notification-date[_ngcontent-%COMP%]{font-size:12px;color:gray}"]})}return o})()}];let C=(()=>{class o{static#t=this.\u0275fac=function(n){return new(n||o)};static#i=this.\u0275mod=t.$C({type:o});static#n=this.\u0275inj=t.G2t({imports:[g.iI.forChild(F),g.iI]})}return o})(),E=(()=>{class o{static#t=this.\u0275fac=function(n){return new(n||o)};static#i=this.\u0275mod=t.$C({type:o});static#n=this.\u0275inj=t.G2t({imports:[r.MD,d.YN,a.bv,C,s.h.forChild()]})}return o})()},87473:(m,f,e)=>{e.d(f,{J:()=>g});var r=e(73308),d=e(2978),a=e(3366);let g=(()=>{class c{constructor(s){this.api=s}getNotifications(){var s=this;return(0,r.A)(function*(){return s.api.get("notification/get")})()}getNotificationsCount(){var s=this;return(0,r.A)(function*(){return s.api.get("notification/count")})()}static#t=this.\u0275fac=function(u){return new(u||c)(d.KVO(a.G))};static#i=this.\u0275prov=d.jDH({token:c,factory:c.\u0275fac,providedIn:"root"})}return c})()}}]);