import { Component } from '@angular/core';
import { rowExpansionTrigger } from '../../../annimations/app-animations';
import * as i0 from "@angular/core";
import * as i1 from "@ionic/angular";
import * as i2 from "../../../services/login/login.service";
import * as i3 from "../../../services/util/util.service";
import * as i4 from "../../../services/notification/notification.service";
import * as i5 from "@angular/common";
import * as i6 from "primeng/tabview";
import * as i7 from "@angular/material/expansion";
function MyNotificationsPage_div_7_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 7);
    i0.ɵɵelement(1, "br")(2, "ion-progress-bar", 8);
    i0.ɵɵelementEnd();
} }
function MyNotificationsPage_div_8_mat_accordion_3_mat_expansion_panel_1_Template(rf, ctx) { if (rf & 1) {
    const _r11 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "mat-expansion-panel", 14);
    i0.ɵɵlistener("opened", function MyNotificationsPage_div_8_mat_accordion_3_mat_expansion_panel_1_Template_mat_expansion_panel_opened_0_listener() { const restoredCtx = i0.ɵɵrestoreView(_r11); const n_r9 = restoredCtx.$implicit; const ctx_r10 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r10.notificationOpened(n_r9.userNotificationId)); })("closed", function MyNotificationsPage_div_8_mat_accordion_3_mat_expansion_panel_1_Template_mat_expansion_panel_closed_0_listener() { const restoredCtx = i0.ɵɵrestoreView(_r11); const n_r9 = restoredCtx.$implicit; const ctx_r12 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r12.notificationClosed(n_r9.userNotificationId)); });
    i0.ɵɵelementStart(1, "mat-expansion-panel-header", 15)(2, "mat-panel-title", 16)(3, "p", 17);
    i0.ɵɵtext(4);
    i0.ɵɵelementEnd()()();
    i0.ɵɵelementStart(5, "div", 1);
    i0.ɵɵtext(6);
    i0.ɵɵelementStart(7, "div", 18)(8, "ion-text", 19);
    i0.ɵɵtext(9);
    i0.ɵɵelementEnd()()()();
} if (rf & 2) {
    const n_r9 = ctx.$implicit;
    const ctx_r8 = i0.ɵɵnextContext(3);
    i0.ɵɵproperty("@rowExpansionTrigger", "active");
    i0.ɵɵadvance(4);
    i0.ɵɵtextInterpolate(n_r9.messageHeading);
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate1(" ", n_r9.messageDetails, " ");
    i0.ɵɵadvance(3);
    i0.ɵɵtextInterpolate1(" Displayed Till : ", ctx_r8.util.getDateInMMDDYYYY(n_r9.validTill), " ");
} }
function MyNotificationsPage_div_8_mat_accordion_3_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "mat-accordion");
    i0.ɵɵtemplate(1, MyNotificationsPage_div_8_mat_accordion_3_mat_expansion_panel_1_Template, 10, 4, "mat-expansion-panel", 13);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r2 = i0.ɵɵnextContext(2);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngForOf", ctx_r2.ns.getUnReadNotifications());
} }
function MyNotificationsPage_div_8_div_4_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 7)(1, "div", 20);
    i0.ɵɵelement(2, "ion-icon", 21);
    i0.ɵɵelementStart(3, "h4", 22);
    i0.ɵɵtext(4, "You don't have any notifications");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(5, "ion-label", 23);
    i0.ɵɵtext(6, "Please check back later.");
    i0.ɵɵelementEnd()()();
} }
function MyNotificationsPage_div_8_mat_expansion_panel_7_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "mat-expansion-panel", 24)(1, "mat-expansion-panel-header", 15)(2, "mat-panel-title", 16)(3, "p", 17);
    i0.ɵɵtext(4);
    i0.ɵɵelementEnd()()();
    i0.ɵɵelementStart(5, "div", 1);
    i0.ɵɵtext(6);
    i0.ɵɵelementStart(7, "div", 18)(8, "ion-text", 19);
    i0.ɵɵtext(9);
    i0.ɵɵelementEnd()()()();
} if (rf & 2) {
    const n_r13 = ctx.$implicit;
    const ctx_r4 = i0.ɵɵnextContext(2);
    i0.ɵɵadvance(4);
    i0.ɵɵtextInterpolate(n_r13.messageHeading);
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate1(" ", n_r13.messageDetails, " ");
    i0.ɵɵadvance(3);
    i0.ɵɵtextInterpolate1(" Displayed Till : ", ctx_r4.util.getDateInMMDDYYYY(n_r13.validTill), " ");
} }
function MyNotificationsPage_div_8_div_8_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 7)(1, "div", 20);
    i0.ɵɵelement(2, "ion-icon", 21);
    i0.ɵɵelementStart(3, "h4", 22);
    i0.ɵɵtext(4, "You don't have any notifications");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(5, "ion-label", 23);
    i0.ɵɵtext(6, "Please check back later.");
    i0.ɵɵelementEnd()()();
} }
function MyNotificationsPage_div_8_mat_expansion_panel_11_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "mat-expansion-panel", 24)(1, "mat-expansion-panel-header", 15)(2, "mat-panel-title", 16)(3, "p", 17);
    i0.ɵɵtext(4);
    i0.ɵɵelementEnd()()();
    i0.ɵɵelementStart(5, "div", 1);
    i0.ɵɵtext(6);
    i0.ɵɵelementStart(7, "div", 18)(8, "ion-text", 19);
    i0.ɵɵtext(9);
    i0.ɵɵelementEnd()()()();
} if (rf & 2) {
    const n_r14 = ctx.$implicit;
    const ctx_r6 = i0.ɵɵnextContext(2);
    i0.ɵɵadvance(4);
    i0.ɵɵtextInterpolate(n_r14.messageHeading);
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate1(" ", n_r14.messageDetails, " ");
    i0.ɵɵadvance(3);
    i0.ɵɵtextInterpolate1(" Displayed Till : ", ctx_r6.util.getDateInMMDDYYYY(n_r14.validTill), " ");
} }
function MyNotificationsPage_div_8_div_12_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 7)(1, "div", 20);
    i0.ɵɵelement(2, "ion-icon", 21);
    i0.ɵɵelementStart(3, "h4", 22);
    i0.ɵɵtext(4, "You don't have any notifications");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(5, "ion-label", 23);
    i0.ɵɵtext(6, "Please check back later.");
    i0.ɵɵelementEnd()()();
} }
function MyNotificationsPage_div_8_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 9)(1, "p-tabView")(2, "p-tabPanel", 10);
    i0.ɵɵtemplate(3, MyNotificationsPage_div_8_mat_accordion_3_Template, 2, 1, "mat-accordion", 11)(4, MyNotificationsPage_div_8_div_4_Template, 7, 0, "div", 5);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(5, "p-tabPanel", 10)(6, "mat-accordion");
    i0.ɵɵtemplate(7, MyNotificationsPage_div_8_mat_expansion_panel_7_Template, 10, 3, "mat-expansion-panel", 12);
    i0.ɵɵelementEnd();
    i0.ɵɵtemplate(8, MyNotificationsPage_div_8_div_8_Template, 7, 0, "div", 5);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(9, "p-tabPanel", 10)(10, "mat-accordion");
    i0.ɵɵtemplate(11, MyNotificationsPage_div_8_mat_expansion_panel_11_Template, 10, 3, "mat-expansion-panel", 12);
    i0.ɵɵelementEnd();
    i0.ɵɵtemplate(12, MyNotificationsPage_div_8_div_12_Template, 7, 0, "div", 5);
    i0.ɵɵelementEnd()()();
} if (rf & 2) {
    const ctx_r1 = i0.ɵɵnextContext();
    i0.ɵɵadvance(2);
    i0.ɵɵpropertyInterpolate1("header", "Unread (", ctx_r1.ns.getUnreadNotificationCount(), ")");
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", ctx_r1.ns.getUnreadNotificationCount() > 0);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", ctx_r1.ns.getUnreadNotificationCount() == 0);
    i0.ɵɵadvance(1);
    i0.ɵɵpropertyInterpolate1("header", "Read (", ctx_r1.ns.getReadNotificationCount(), ")");
    i0.ɵɵadvance(2);
    i0.ɵɵproperty("ngForOf", ctx_r1.ns.getReadNotifications());
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", ctx_r1.ns.getReadNotificationCount() == 0);
    i0.ɵɵadvance(1);
    i0.ɵɵpropertyInterpolate1("header", "All (", ctx_r1.ns.notifications.getValue().length, ")");
    i0.ɵɵadvance(2);
    i0.ɵɵproperty("ngForOf", ctx_r1.ns.notifications.getValue());
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", ctx_r1.ns.notifications.getValue().length == 0);
} }
export class MyNotificationsPage {
    constructor(popup, loginService, util, navParams, ns) {
        this.popup = popup;
        this.loginService = loginService;
        this.util = util;
        this.navParams = navParams;
        this.ns = ns;
        this.showLoader = false;
    }
    ngOnInit() {
        this.showLoader = true;
        this.ns
            .getNotifications()
            .subscribe(res => {
            this.ns.notifications.next(res);
            this.ns.getUnreadNotificationCount();
            this.showLoader = false;
        }, err => {
            this.ns.notificationCount.next(0);
            this.ns.notifications.next([]);
            this.showLoader = false;
        });
    }
    close() {
        this.ns.updateReadFlag();
        this.popup.dismiss(null);
    }
    notificationOpened(id) {
        this.ns.markForUpdate(id);
    }
    notificationClosed(id) {
        this.ns.markAsRead(id);
    }
    static { this.ɵfac = function MyNotificationsPage_Factory(t) { return new (t || MyNotificationsPage)(i0.ɵɵdirectiveInject(i1.PopoverController), i0.ɵɵdirectiveInject(i2.LoginService), i0.ɵɵdirectiveInject(i3.UtilService), i0.ɵɵdirectiveInject(i1.NavParams), i0.ɵɵdirectiveInject(i4.NotificationService)); }; }
    static { this.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: MyNotificationsPage, selectors: [["app-my-notifications"]], decls: 9, vars: 2, consts: [[2, "margin", "0px"], [1, "ion-padding"], [2, "font-size", "large"], ["color", "dark"], [2, "padding", "0px"], ["class", "ion-text-center", 4, "ngIf"], ["class", "app-box", 4, "ngIf"], [1, "ion-text-center"], ["type", "indeterminate"], [1, "app-box"], [3, "header"], [4, "ngIf"], ["class", "ion-padding-top", 4, "ngFor", "ngForOf"], ["class", "ion-padding-top", 3, "opened", "closed", 4, "ngFor", "ngForOf"], [1, "ion-padding-top", 3, "opened", "closed"], ["color", "primary"], [1, "ion-text-wrap"], [1, "ion-padding-left"], [1, "ion-text-right", "ion-padding-top"], ["color", "white", 2, "font-size", "smaller", "font-style", "italic"], [1, "ion-text-center", "ion-padding"], ["name", "notifications-outline", 2, "font-size", "60px"], [2, "color", "var(--ion-color-dark)"], ["color", "grey"], [1, "ion-padding-top"]], template: function MyNotificationsPage_Template(rf, ctx) { if (rf & 1) {
            i0.ɵɵelementStart(0, "ion-content")(1, "ion-card", 0)(2, "ion-card-header", 1)(3, "ion-card-subtitle", 2)(4, "ion-label", 3);
            i0.ɵɵtext(5, "My Notifications");
            i0.ɵɵelementEnd()()();
            i0.ɵɵelementStart(6, "ion-card-content", 4);
            i0.ɵɵtemplate(7, MyNotificationsPage_div_7_Template, 3, 0, "div", 5)(8, MyNotificationsPage_div_8_Template, 13, 9, "div", 6);
            i0.ɵɵelementEnd()()();
        } if (rf & 2) {
            i0.ɵɵadvance(7);
            i0.ɵɵproperty("ngIf", ctx.showLoader);
            i0.ɵɵadvance(1);
            i0.ɵɵproperty("ngIf", !ctx.showLoader);
        } }, dependencies: [i1.IonCard, i1.IonCardContent, i1.IonCardHeader, i1.IonCardSubtitle, i1.IonContent, i1.IonIcon, i1.IonLabel, i1.IonProgressBar, i1.IonText, i5.NgForOf, i5.NgIf, i6.TabView, i6.TabPanel, i7.MatAccordion, i7.MatExpansionPanel, i7.MatExpansionPanelHeader, i7.MatExpansionPanelTitle], styles: [".mat-expansion-panel-header[_ngcontent-%COMP%]{padding:0 10px}"], data: { animation: [rowExpansionTrigger] } }); }
}
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MyNotificationsPage, [{
        type: Component,
        args: [{ selector: 'app-my-notifications', animations: [rowExpansionTrigger], template: "<ion-content>\r\n  <ion-card style=\"margin: 0px;\">\r\n    <ion-card-header class=\"ion-padding\">\r\n      <ion-card-subtitle style=\"font-size:large\">\r\n        <ion-label color=\"dark\">My Notifications</ion-label>\r\n      </ion-card-subtitle>\r\n    </ion-card-header>\r\n    <ion-card-content style=\"padding: 0px;\">\r\n      <div class=\"ion-text-center\" *ngIf=\"showLoader\">\r\n        <br />\r\n        <ion-progress-bar type=\"indeterminate\"></ion-progress-bar>\r\n      </div>\r\n      <div class=\"app-box\" *ngIf=\"!showLoader\">\r\n        <p-tabView>\r\n          <p-tabPanel header=\"Unread ({{ns.getUnreadNotificationCount()}})\">\r\n            <mat-accordion *ngIf=\"ns.getUnreadNotificationCount() > 0\">\r\n              <mat-expansion-panel *ngFor=\"let n of ns.getUnReadNotifications()\"\r\n                (opened)=\"notificationOpened(n.userNotificationId)\" (closed)=\"notificationClosed(n.userNotificationId)\"\r\n                class=\"ion-padding-top\" [@rowExpansionTrigger]=\"'active'\">\r\n                <mat-expansion-panel-header color=\"primary\">\r\n                  <mat-panel-title class=\"ion-text-wrap\">\r\n                    <p class=\"ion-padding-left\">{{n.messageHeading}}</p>\r\n                  </mat-panel-title>\r\n                </mat-expansion-panel-header>\r\n\r\n                <div class=\"ion-padding\">\r\n                  {{n.messageDetails}}\r\n                  <div class=\"ion-text-right ion-padding-top\">\r\n                    <ion-text style=\"font-size: smaller; font-style: italic;\" color=\"white\">\r\n                      Displayed Till : {{util.getDateInMMDDYYYY(n.validTill)}}\r\n                    </ion-text>\r\n                  </div>\r\n                </div>\r\n              </mat-expansion-panel>\r\n            </mat-accordion>\r\n            <div *ngIf=\"ns.getUnreadNotificationCount() == 0\" class=\"ion-text-center\">\r\n              <div class=\"ion-text-center ion-padding\">\r\n                <ion-icon name=\"notifications-outline\" style=\"font-size: 60px;\"></ion-icon>\r\n                <h4 style=\"color: var(--ion-color-dark);\">You don't have any notifications</h4>\r\n                <ion-label color=\"grey\">Please check back later.</ion-label>\r\n              </div>\r\n            </div>\r\n          </p-tabPanel>\r\n          <p-tabPanel header=\"Read ({{ns.getReadNotificationCount()}})\">\r\n            <mat-accordion>\r\n              <mat-expansion-panel *ngFor=\"let n of ns.getReadNotifications()\" class=\"ion-padding-top\">\r\n                <mat-expansion-panel-header color=\"primary\">\r\n                  <mat-panel-title class=\"ion-text-wrap\">\r\n                    <p class=\"ion-padding-left\">{{n.messageHeading}}</p>\r\n                  </mat-panel-title>\r\n                </mat-expansion-panel-header>\r\n\r\n                <div class=\"ion-padding\">\r\n                  {{n.messageDetails}}\r\n                  <div class=\"ion-text-right ion-padding-top\">\r\n                    <ion-text style=\"font-size: smaller; font-style: italic;\" color=\"white\">\r\n                      Displayed Till : {{util.getDateInMMDDYYYY(n.validTill)}}\r\n                    </ion-text>\r\n                  </div>\r\n                </div>\r\n              </mat-expansion-panel>\r\n            </mat-accordion>\r\n\r\n            <div *ngIf=\"ns.getReadNotificationCount() == 0\" class=\"ion-text-center\">\r\n              <div class=\"ion-text-center ion-padding\">\r\n                <ion-icon name=\"notifications-outline\" style=\"font-size: 60px;\"></ion-icon>\r\n                <h4 style=\"color: var(--ion-color-dark);\">You don't have any notifications</h4>\r\n                <ion-label color=\"grey\">Please check back later.</ion-label>\r\n              </div>\r\n            </div>\r\n          </p-tabPanel>\r\n          <p-tabPanel header=\"All ({{ns.notifications.getValue().length}})\">\r\n            <mat-accordion>\r\n              <mat-expansion-panel *ngFor=\"let n of ns.notifications.getValue()\" class=\"ion-padding-top\">\r\n                <mat-expansion-panel-header color=\"primary\">\r\n                  <mat-panel-title class=\"ion-text-wrap\">\r\n                    <p class=\"ion-padding-left\">{{n.messageHeading}}</p>\r\n                  </mat-panel-title>\r\n                </mat-expansion-panel-header>\r\n\r\n                <div class=\"ion-padding\">\r\n                  {{n.messageDetails}}\r\n                  <div class=\"ion-text-right ion-padding-top\">\r\n                    <ion-text style=\"font-size: smaller; font-style: italic;\" color=\"white\">\r\n                      Displayed Till : {{util.getDateInMMDDYYYY(n.validTill)}}\r\n                    </ion-text>\r\n                  </div>\r\n                </div>\r\n              </mat-expansion-panel>\r\n            </mat-accordion>\r\n            <div *ngIf=\"ns.notifications.getValue().length == 0\" class=\"ion-text-center\">\r\n              <div class=\"ion-text-center ion-padding\">\r\n                <ion-icon name=\"notifications-outline\" style=\"font-size: 60px;\"></ion-icon>\r\n                <h4 style=\"color: var(--ion-color-dark);\">You don't have any notifications</h4>\r\n                <ion-label color=\"grey\">Please check back later.</ion-label>\r\n              </div>\r\n            </div>\r\n          </p-tabPanel>\r\n        </p-tabView>\r\n\r\n      </div>\r\n    </ion-card-content>\r\n  </ion-card>\r\n</ion-content>", styles: [".mat-expansion-panel-header{padding:0 10px}\n"] }]
    }], () => [{ type: i1.PopoverController }, { type: i2.LoginService }, { type: i3.UtilService }, { type: i1.NavParams }, { type: i4.NotificationService }], null); })();
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MyNotificationsPage, { className: "MyNotificationsPage", filePath: "lib\\pages\\popovers\\my-notifications\\my-notifications.page.ts", lineNumber: 14 }); })();
//# sourceMappingURL=data:application/json;base64, 