import { Component, EventEmitter, Input, Output } from '@angular/core';
import { rowExpansionTrigger } from '../../annimations/app-animations';
import { LibConstants } from '../../models/LibConstants';
import * as i0 from "@angular/core";
import * as i1 from "../../services/login/login.service";
import * as i2 from "../../services/util/util.service";
import * as i3 from "@ionic/angular";
import * as i4 from "@angular/platform-browser";
import * as i5 from "@angular/common";
import * as i6 from "@fortawesome/angular-fontawesome";
const _c0 = a1 => ["far", a1];
function DashboardCardComponent_ion_card_content_4_p_scrollPanel_1_ion_row_1_fa_icon_2_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "fa-icon", 14);
} if (rf & 2) {
    const c_r5 = i0.ɵɵnextContext().$implicit;
    const ctx_r6 = i0.ɵɵnextContext(3);
    i0.ɵɵclassMapInterpolate1("icon-", ctx_r6.type, "");
    i0.ɵɵproperty("icon", i0.ɵɵpureFunction1(4, _c0, c_r5.icon));
} }
const _c1 = () => ["far", "info-circle"];
function DashboardCardComponent_ion_card_content_4_p_scrollPanel_1_ion_row_1_fa_icon_3_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "fa-icon", 14);
} if (rf & 2) {
    const ctx_r7 = i0.ɵɵnextContext(4);
    i0.ɵɵclassMapInterpolate1("icon-", ctx_r7.type, "");
    i0.ɵɵproperty("icon", i0.ɵɵpureFunction0(4, _c1));
} }
function DashboardCardComponent_ion_card_content_4_p_scrollPanel_1_ion_row_1_div_8_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div");
    i0.ɵɵelement(1, "div", 15);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const c_r5 = i0.ɵɵnextContext().$implicit;
    const ctx_r8 = i0.ɵɵnextContext(3);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("innerHTML", ctx_r8.sanitizer.bypassSecurityTrustHtml(c_r5 == null ? null : c_r5.subHeading), i0.ɵɵsanitizeHtml);
} }
function DashboardCardComponent_ion_card_content_4_p_scrollPanel_1_ion_row_1_p_11_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "p", 8);
    i0.ɵɵtext(1);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const c_r5 = i0.ɵɵnextContext().$implicit;
    i0.ɵɵadvance(1);
    i0.ɵɵtextInterpolate(c_r5.date);
} }
const _c2 = (a0, a1) => [a0, a1];
function DashboardCardComponent_ion_card_content_4_p_scrollPanel_1_ion_row_1_ion_button_13_fa_icon_1_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "fa-icon", 18);
} if (rf & 2) {
    const c_r5 = i0.ɵɵnextContext(2).$implicit;
    i0.ɵɵproperty("icon", i0.ɵɵpureFunction2(1, _c2, c_r5.button.iconType ? c_r5.button.iconType : "far", c_r5.button.buttonIcon));
} }
const _c3 = () => ["far", "play"];
function DashboardCardComponent_ion_card_content_4_p_scrollPanel_1_ion_row_1_ion_button_13_fa_icon_2_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "fa-icon", 18);
} if (rf & 2) {
    i0.ɵɵproperty("icon", i0.ɵɵpureFunction0(1, _c3));
} }
function DashboardCardComponent_ion_card_content_4_p_scrollPanel_1_ion_row_1_ion_button_13_Template(rf, ctx) { if (rf & 1) {
    const _r19 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "ion-button", 16);
    i0.ɵɵlistener("click", function DashboardCardComponent_ion_card_content_4_p_scrollPanel_1_ion_row_1_ion_button_13_Template_ion_button_click_0_listener() { i0.ɵɵrestoreView(_r19); const c_r5 = i0.ɵɵnextContext().$implicit; const ctx_r17 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r17.open(c_r5)); });
    i0.ɵɵtemplate(1, DashboardCardComponent_ion_card_content_4_p_scrollPanel_1_ion_row_1_ion_button_13_fa_icon_1_Template, 1, 4, "fa-icon", 17)(2, DashboardCardComponent_ion_card_content_4_p_scrollPanel_1_ion_row_1_ion_button_13_fa_icon_2_Template, 1, 2, "fa-icon", 17);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const c_r5 = i0.ɵɵnextContext().$implicit;
    const ctx_r10 = i0.ɵɵnextContext(3);
    i0.ɵɵstyleMapInterpolate2("--color: ", c_r5.button.color, "; --border-color: ", c_r5.button.color, "; --border-width: 2px");
    i0.ɵɵproperty("disabled", ctx_r10.disableButtons);
    i0.ɵɵattribute("aria-label", "go to" + c_r5.heading);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", c_r5.button.buttonIcon && c_r5.button.buttonIcon != "");
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", c_r5.button.buttonIcon && c_r5.button.buttonIcon == "");
} }
function DashboardCardComponent_ion_card_content_4_p_scrollPanel_1_ion_row_1_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "ion-row", 3)(1, "ion-col", 4);
    i0.ɵɵtemplate(2, DashboardCardComponent_ion_card_content_4_p_scrollPanel_1_ion_row_1_fa_icon_2_Template, 1, 6, "fa-icon", 5)(3, DashboardCardComponent_ion_card_content_4_p_scrollPanel_1_ion_row_1_fa_icon_3_Template, 1, 5, "fa-icon", 5);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(4, "ion-col", 6)(5, "ion-label", 7)(6, "p", 8);
    i0.ɵɵtext(7);
    i0.ɵɵelementEnd();
    i0.ɵɵtemplate(8, DashboardCardComponent_ion_card_content_4_p_scrollPanel_1_ion_row_1_div_8_Template, 2, 1, "div", 0);
    i0.ɵɵelementEnd()();
    i0.ɵɵelementStart(9, "ion-col", 9)(10, "ion-label", 10);
    i0.ɵɵtemplate(11, DashboardCardComponent_ion_card_content_4_p_scrollPanel_1_ion_row_1_p_11_Template, 2, 1, "p", 11);
    i0.ɵɵelementEnd()();
    i0.ɵɵelementStart(12, "ion-col", 12);
    i0.ɵɵtemplate(13, DashboardCardComponent_ion_card_content_4_p_scrollPanel_1_ion_row_1_ion_button_13_Template, 3, 8, "ion-button", 13);
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    const c_r5 = ctx.$implicit;
    i0.ɵɵproperty("@rowExpansionTrigger", "active");
    i0.ɵɵadvance(2);
    i0.ɵɵproperty("ngIf", c_r5.icon && c_r5.icon != "");
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", c_r5.icon && c_r5.icon == "");
    i0.ɵɵadvance(4);
    i0.ɵɵtextInterpolate(c_r5.heading);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", c_r5.subHeading);
    i0.ɵɵadvance(3);
    i0.ɵɵproperty("ngIf", c_r5.date);
    i0.ɵɵadvance(2);
    i0.ɵɵproperty("ngIf", c_r5.button.buttonIcon);
} }
function DashboardCardComponent_ion_card_content_4_p_scrollPanel_1_ion_row_2_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "ion-row")(1, "ion-col", 19);
    i0.ɵɵtext(2, "\u00A0");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(3, "ion-col")(4, "ion-label", 7)(5, "p", 8);
    i0.ɵɵtext(6);
    i0.ɵɵelementEnd()()()();
} if (rf & 2) {
    const ctx_r4 = i0.ɵɵnextContext(3);
    i0.ɵɵproperty("@rowExpansionTrigger", "active");
    i0.ɵɵadvance(6);
    i0.ɵɵtextInterpolate(ctx_r4.emptyMsg);
} }
const _c4 = () => ({ width: "100%", height: "252px" });
function DashboardCardComponent_ion_card_content_4_p_scrollPanel_1_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "p-scrollPanel");
    i0.ɵɵtemplate(1, DashboardCardComponent_ion_card_content_4_p_scrollPanel_1_ion_row_1_Template, 14, 7, "ion-row", 2)(2, DashboardCardComponent_ion_card_content_4_p_scrollPanel_1_ion_row_2_Template, 7, 2, "ion-row", 0);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r2 = i0.ɵɵnextContext(2);
    i0.ɵɵstyleMap(i0.ɵɵpureFunction0(4, _c4));
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngForOf", ctx_r2.data);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", ctx_r2.data != null && ctx_r2.data.length < 1);
} }
function DashboardCardComponent_ion_card_content_4_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "ion-card-content");
    i0.ɵɵtemplate(1, DashboardCardComponent_ion_card_content_4_p_scrollPanel_1_Template, 3, 5, "p-scrollPanel", 1);
    i0.ɵɵprojection(2);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r0 = i0.ɵɵnextContext();
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", ctx_r0.data);
} }
function DashboardCardComponent_ion_card_content_5_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "ion-card-content")(1, "div", 20);
    i0.ɵɵelement(2, "ion-spinner", 21);
    i0.ɵɵelementEnd()();
} }
const _c5 = ["*"];
export class DashboardCardComponent {
    constructor(ls, util, nav, sanitizer) {
        this.ls = ls;
        this.util = util;
        this.nav = nav;
        this.sanitizer = sanitizer;
        this.loading = false;
        this.disableButtons = false;
        this.onClick = new EventEmitter();
    }
    ngOnInit() { }
    open(model) {
        if (this.ls.isCsr()) {
            model.button.context = this.util.getSecurityAppContextRoot();
        }
        if (model.button.uri.includes("Popup")) {
            this.onClick.emit(model);
        }
        else if (model.button.uri != '' && model.button.uri.includes("Page")) {
            if (model.button.url.includes("history") && model.button.buttonIcon.includes("info")) {
                //passing transaction id as query param to display history against the selected hint
                // console.log(model);
                if (model.data) {
                    this.util.openPageByContextRootWithDataAndTxnId(model.button.context, model.button.url, model.data, model.transactionId, this.nav);
                }
                else {
                    this.util.openPageByContextRootWithDataAndTxnId(model.button.context, model.button.url, null, model.transactionId, this.nav);
                }
            }
            else if (model.data && model.data.qeData) {
                let jsonData = JSON.parse(model.data.qeData);
                this.util.openPageByContextRootWithData(model.button.context, model.button.url, jsonData[0].dynamicParam, this.nav);
            }
            else if (model.data) {
                this.util.openPageByContextRootWithData(model.button.context, model.button.url, model.data, this.nav);
            }
            else {
                this.util.openPageByContextRoot(model.button.context, model.button.url, this.nav);
            }
        }
        else if (model.button.uri != '' && model.button.uri.includes("uploadPopup")) {
            let userModel = this.ls.getUser();
            window.open(`${LibConstants.benefitsUrlExternal}/faces/virtual/contextswitch.xhtml?a=${userModel.access_token}&r=${userModel.refresh_token}&v=2299&CLAIMANT_PORTAL=true&view=.uploaddocumententerssn`, '_self');
        }
        else {
            let userModel = this.ls.getUser();
            this.util.showLoader().then(() => {
                window.open(`${LibConstants.benefitsUrlExternal}/faces/virtual/contextswitch.xhtml?a=${userModel.access_token}&r=${userModel.refresh_token}&v=2299`, '_self');
            });
        }
    }
    static { this.ɵfac = function DashboardCardComponent_Factory(t) { return new (t || DashboardCardComponent)(i0.ɵɵdirectiveInject(i1.LoginService), i0.ɵɵdirectiveInject(i2.UtilService), i0.ɵɵdirectiveInject(i3.NavController), i0.ɵɵdirectiveInject(i4.DomSanitizer)); }; }
    static { this.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: DashboardCardComponent, selectors: [["app-dashboard-card"]], inputs: { heading: "heading", data: "data", type: "type", loading: "loading", emptyMsg: "emptyMsg", disableButtons: "disableButtons" }, outputs: { onClick: "onClick" }, ngContentSelectors: _c5, decls: 6, vars: 9, consts: [[4, "ngIf"], [3, "style", 4, "ngIf"], ["style", "padding-top: 6px;", 4, "ngFor", "ngForOf"], [2, "padding-top", "6px"], ["size", "1", 1, "ion-text-center", 2, "padding-top", "0px"], [3, "icon", "class", 4, "ngIf"], ["size", "7"], [1, "ion-text-wrap", "full-height"], [1, "app-heading"], ["size", "2"], [1, "ion-text-right", "full-height"], ["class", "app-heading", 4, "ngIf"], ["size", "2", 1, "ion-text-center"], ["fill", "outline", "shape", "round", "class", "small-button", 3, "style", "disabled", "click", 4, "ngIf"], [3, "icon"], [1, "subheading", 3, "innerHTML"], ["fill", "outline", "shape", "round", 1, "small-button", 3, "disabled", "click"], ["class", "button-icon", 3, "icon", 4, "ngIf"], [1, "button-icon", 3, "icon"], ["size", "1"], [1, "ion-text-center"], ["name", "dots"]], template: function DashboardCardComponent_Template(rf, ctx) { if (rf & 1) {
            i0.ɵɵprojectionDef();
            i0.ɵɵelementStart(0, "ion-card")(1, "ion-card-header")(2, "ion-card-title");
            i0.ɵɵtext(3);
            i0.ɵɵelementEnd()();
            i0.ɵɵtemplate(4, DashboardCardComponent_ion_card_content_4_Template, 3, 1, "ion-card-content", 0)(5, DashboardCardComponent_ion_card_content_5_Template, 3, 0, "ion-card-content", 0);
            i0.ɵɵelementEnd();
        } if (rf & 2) {
            i0.ɵɵclassMapInterpolate1("dashboard ", ctx.type, "");
            i0.ɵɵadvance(2);
            i0.ɵɵclassMapInterpolate1("dashboard ", ctx.type, "");
            i0.ɵɵadvance(1);
            i0.ɵɵtextInterpolate(ctx.heading);
            i0.ɵɵadvance(1);
            i0.ɵɵproperty("ngIf", !ctx.loading);
            i0.ɵɵadvance(1);
            i0.ɵɵproperty("ngIf", ctx.loading);
        } }, dependencies: [i3.IonButton, i3.IonCard, i3.IonCardContent, i3.IonCardHeader, i3.IonCardTitle, i3.IonCol, i3.IonLabel, i3.IonRow, i3.IonSpinner, i5.NgForOf, i5.NgIf, i6.FaIconComponent], styles: [".dashboard[_ngcontent-%COMP%]{border-bottom-right-radius:24px}.dashboard.current[_ngcontent-%COMP%]{font-family:var(--app-font-semibold);--background: var(--ion-color-light-blue)}.dashboard.current[_ngcontent-%COMP%]   p[_ngcontent-%COMP%]{color:var(--ion-color-black);font-family:var(--app-font-regular)}.dashboard.current[_ngcontent-%COMP%]   .icon-current[_ngcontent-%COMP%]{color:var(--ion-color-black);font-size:26px;margin:-10px}.dashboard.coming-up[_ngcontent-%COMP%]{--background: var(--ion-color-lighter-blue)}.dashboard.coming-up[_ngcontent-%COMP%]   p[_ngcontent-%COMP%]{color:var(--ion-color-black);font-family:var(--app-font-regular)}.dashboard.coming-up[_ngcontent-%COMP%]   .icon-coming-up[_ngcontent-%COMP%]{color:var(--ion-color-black);font-size:26px;margin:-10px}.dashboard.pending[_ngcontent-%COMP%]{--background: var(--ion-color-light-grey)}.dashboard.pending[_ngcontent-%COMP%]   p[_ngcontent-%COMP%]{color:var(--ion-color-black);font-family:var(--app-font-regular)}.dashboard.pending[_ngcontent-%COMP%]   .icon-pending[_ngcontent-%COMP%]{color:var(--ion-color-black);font-size:26px;margin:-10px}.app-heading[_ngcontent-%COMP%]{font-size:18px;color:var(--ion-color-black);font-family:var(--app-font-light)}.subheading[_ngcontent-%COMP%]{font-family:var(--app-font-regular);font-size:14px;color:var(--ion-color-black)}.small-button[_ngcontent-%COMP%]{--padding-start: 0px;--padding-end: 0px;--background: white;--border: none !important;margin-top:1px}ion-button.small-button[_ngcontent-%COMP%]::part(native){padding:6px 12px}.button-icon[_ngcontent-%COMP%]{font-size:18px;color:var(--ion-color-primary)}a[_ngcontent-%COMP%]{color:#fff}ion-button.button-disabled[_ngcontent-%COMP%]{opacity:1!important}ion-card-content[_ngcontent-%COMP%]{height:252px}.dashboard[_ngcontent-%COMP%]   ion-card-content[_ngcontent-%COMP%]{overflow-y:auto}"], data: { animation: [rowExpansionTrigger] } }); }
}
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(DashboardCardComponent, [{
        type: Component,
        args: [{ selector: 'app-dashboard-card', animations: [rowExpansionTrigger], template: "<ion-card class=\"dashboard {{type}}\">\r\n  <ion-card-header>\r\n    <ion-card-title class=\"dashboard {{type}}\">{{heading}}</ion-card-title>\r\n  </ion-card-header>\r\n  <ion-card-content *ngIf=\"!loading\">\r\n    <p-scrollPanel [style]=\"{width: '100%', height: '252px'}\" *ngIf=\"data\">\r\n      <ion-row  style=\"padding-top: 6px;\" *ngFor=\"let c of data\" [@rowExpansionTrigger]=\"'active'\">\r\n        <ion-col size=\"1\" class=\"ion-text-center\" style=\"padding-top: 0px;\">\r\n          <fa-icon [icon]=\"['far', c.icon]\" class=\"icon-{{type}}\" *ngIf=\"c.icon && c.icon != ''\"></fa-icon>\r\n          <fa-icon [icon]=\"['far', 'info-circle']\" class=\"icon-{{type}}\" *ngIf=\"c.icon && c.icon == ''\"></fa-icon>\r\n        </ion-col>\r\n        <ion-col size=\"7\">\r\n          <ion-label class=\"ion-text-wrap full-height\">\r\n            <p class=\"app-heading\">{{c.heading}}</p>         \r\n            <div *ngIf=\"c.subHeading\">\r\n              <div [innerHTML]=\"sanitizer.bypassSecurityTrustHtml(c?.subHeading)\" class=\"subheading\"></div>\r\n            </div>\r\n          </ion-label>\r\n        </ion-col>\r\n        <ion-col size=\"2\">\r\n          <ion-label class=\"ion-text-right full-height\">\r\n            <p class=\"app-heading\" *ngIf=\"c.date\">{{c.date}}</p>\r\n          </ion-label>\r\n        </ion-col>\r\n        <ion-col size=\"2\" class=\"ion-text-center\">\r\n          <ion-button [attr.aria-label]=\"'go to' + c.heading\" fill=\"outline\" style=\"--color: {{c.button.color}}; --border-color: {{c.button.color}}; --border-width: 2px\"\r\n            shape=\"round\" class=\"small-button\" *ngIf=\"c.button.buttonIcon\" (click)=\"open(c)\" [disabled]=\"disableButtons\">\r\n            <fa-icon [icon]=\"[c.button.iconType ? c.button.iconType : 'far', c.button.buttonIcon]\" class=\"button-icon\" *ngIf=\"c.button.buttonIcon && c.button.buttonIcon != ''\"></fa-icon>\r\n            <fa-icon [icon]=\"['far', 'play']\" class=\"button-icon\" *ngIf=\"c.button.buttonIcon && c.button.buttonIcon == ''\"></fa-icon>\r\n          </ion-button>\r\n        </ion-col>\r\n      </ion-row>\r\n  \r\n      <ion-row *ngIf=\"data != null && data.length < 1\" [@rowExpansionTrigger]=\"'active'\">\r\n        <ion-col size=\"1\">&nbsp;</ion-col>\r\n        <ion-col>\r\n          <ion-label class=\"ion-text-wrap full-height\">\r\n            <p class=\"app-heading\">{{emptyMsg}}</p>\r\n          </ion-label>\r\n        </ion-col>\r\n      </ion-row>\r\n    </p-scrollPanel>\r\n    <ng-content></ng-content>\r\n  </ion-card-content>\r\n  <ion-card-content *ngIf=\"loading\">\r\n    <div class=\"ion-text-center\">\r\n      <ion-spinner name=\"dots\"></ion-spinner>\r\n    </div>\r\n  </ion-card-content>\r\n</ion-card>", styles: [".dashboard{border-bottom-right-radius:24px}.dashboard.current{font-family:var(--app-font-semibold);--background: var(--ion-color-light-blue)}.dashboard.current p{color:var(--ion-color-black);font-family:var(--app-font-regular)}.dashboard.current .icon-current{color:var(--ion-color-black);font-size:26px;margin:-10px}.dashboard.coming-up{--background: var(--ion-color-lighter-blue)}.dashboard.coming-up p{color:var(--ion-color-black);font-family:var(--app-font-regular)}.dashboard.coming-up .icon-coming-up{color:var(--ion-color-black);font-size:26px;margin:-10px}.dashboard.pending{--background: var(--ion-color-light-grey)}.dashboard.pending p{color:var(--ion-color-black);font-family:var(--app-font-regular)}.dashboard.pending .icon-pending{color:var(--ion-color-black);font-size:26px;margin:-10px}.app-heading{font-size:18px;color:var(--ion-color-black);font-family:var(--app-font-light)}.subheading{font-family:var(--app-font-regular);font-size:14px;color:var(--ion-color-black)}.small-button{--padding-start: 0px;--padding-end: 0px;--background: white;--border: none !important;margin-top:1px}ion-button.small-button::part(native){padding:6px 12px}.button-icon{font-size:18px;color:var(--ion-color-primary)}a{color:#fff}ion-button.button-disabled{opacity:1!important}ion-card-content{height:252px}.dashboard ion-card-content{overflow-y:auto}\n"] }]
    }], () => [{ type: i1.LoginService }, { type: i2.UtilService }, { type: i3.NavController }, { type: i4.DomSanitizer }], { heading: [{
            type: Input
        }], data: [{
            type: Input
        }], type: [{
            type: Input
        }], loading: [{
            type: Input
        }], emptyMsg: [{
            type: Input
        }], disableButtons: [{
            type: Input
        }], onClick: [{
            type: Output
        }] }); })();
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(DashboardCardComponent, { className: "DashboardCardComponent", filePath: "lib\\components\\dashboard-card\\dashboard-card.component.ts", lineNumber: 16 }); })();
//# sourceMappingURL=data:application/json;base64, 