import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output, ViewChild } from '@angular/core';
import { NG_VALUE_ACCESSOR } from '@angular/forms';
import * as i0 from "@angular/core";
import * as i1 from "../../services/questionnaire/validation.service";
import * as i2 from "../../services/claims/claims.service";
import * as i3 from "../../services/weekly-cert/weekly-cert.service";
import * as i4 from "@ionic/angular";
import * as i5 from "@angular/common";
import * as i6 from "primeng/api";
import * as i7 from "primeng/dialog";
import * as i8 from "primeng/table";
import * as i9 from "primeng/accordion";
import * as i10 from "@fortawesome/angular-fontawesome";
import * as i11 from "../weekly-cert-employer/weekly-cert-employer.component";
import * as i12 from "@ngx-translate/core";
const _c0 = ["accordionTab"];
function WeeklyCertEmployerGridComponent_ng_template_3_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "tr")(1, "th");
    i0.ɵɵtext(2);
    i0.ɵɵpipe(3, "translate");
    i0.ɵɵelementEnd();
    i0.ɵɵelement(4, "th");
    i0.ɵɵelementStart(5, "th");
    i0.ɵɵtext(6);
    i0.ɵɵpipe(7, "translate");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(8, "th");
    i0.ɵɵtext(9);
    i0.ɵɵpipe(10, "translate");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(11, "th");
    i0.ɵɵtext(12);
    i0.ɵɵpipe(13, "translate");
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate1(" ", i0.ɵɵpipeBind1(3, 4, "weeklies.employer.grid.header.name"), " ");
    i0.ɵɵadvance(4);
    i0.ɵɵtextInterpolate1(" ", i0.ɵɵpipeBind1(7, 6, "weeklies.employer.grid.header.lastDay"), " ");
    i0.ɵɵadvance(3);
    i0.ɵɵtextInterpolate1(" ", i0.ɵɵpipeBind1(10, 8, "weeklies.employer.grid.header.status"), " ");
    i0.ɵɵadvance(3);
    i0.ɵɵtextInterpolate1(" ", i0.ɵɵpipeBind1(13, 10, "weeklies.employer.grid.header.grossEarnings"), " ");
} }
const _c1 = () => ["far", "arrows-rotate"];
function WeeklyCertEmployerGridComponent_ng_template_4_ion_button_12_Template(rf, ctx) { if (rf & 1) {
    const _r13 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "ion-button", 14);
    i0.ɵɵlistener("click", function WeeklyCertEmployerGridComponent_ng_template_4_ion_button_12_Template_ion_button_click_0_listener() { i0.ɵɵrestoreView(_r13); const employer_r6 = i0.ɵɵnextContext().$implicit; const ctx_r11 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r11.editEmployer(employer_r6)); });
    i0.ɵɵelement(1, "fa-icon", 15);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const employer_r6 = i0.ɵɵnextContext().$implicit;
    const ctx_r8 = i0.ɵɵnextContext();
    i0.ɵɵproperty("disabled", ctx_r8.isDisabled)("color", employer_r6.isPartTimeEmployer && !employer_r6.isPartTimeEmployerEdited && employer_r6.isEmployerGridSubmitted ? "danger" : "");
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("icon", i0.ɵɵpureFunction0(3, _c1));
} }
const _c2 = () => ["fal", "edit"];
function WeeklyCertEmployerGridComponent_ng_template_4_ion_button_13_Template(rf, ctx) { if (rf & 1) {
    const _r17 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "ion-button", 16);
    i0.ɵɵlistener("click", function WeeklyCertEmployerGridComponent_ng_template_4_ion_button_13_Template_ion_button_click_0_listener() { i0.ɵɵrestoreView(_r17); const employer_r6 = i0.ɵɵnextContext().$implicit; const ctx_r15 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r15.editEmployer(employer_r6)); });
    i0.ɵɵelement(1, "fa-icon", 15);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const rowIndex_r7 = i0.ɵɵnextContext().rowIndex;
    const ctx_r9 = i0.ɵɵnextContext();
    i0.ɵɵproperty("id", "btnEditEmployer-" + rowIndex_r7)("disabled", ctx_r9.isDisabled);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("icon", i0.ɵɵpureFunction0(3, _c2));
} }
const _c3 = () => ["fal", "trash-alt"];
function WeeklyCertEmployerGridComponent_ng_template_4_ion_button_14_Template(rf, ctx) { if (rf & 1) {
    const _r21 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "ion-button", 16);
    i0.ɵɵlistener("click", function WeeklyCertEmployerGridComponent_ng_template_4_ion_button_14_Template_ion_button_click_0_listener() { i0.ɵɵrestoreView(_r21); const employer_r6 = i0.ɵɵnextContext().$implicit; const ctx_r19 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r19.deleteDependent(employer_r6)); });
    i0.ɵɵelement(1, "fa-icon", 15);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const rowIndex_r7 = i0.ɵɵnextContext().rowIndex;
    const ctx_r10 = i0.ɵɵnextContext();
    i0.ɵɵproperty("id", "btnDeleteEmployer-" + rowIndex_r7)("disabled", ctx_r10.isDisabled);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("icon", i0.ɵɵpureFunction0(3, _c3));
} }
function WeeklyCertEmployerGridComponent_ng_template_4_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "tr", 9)(1, "td")(2, "span", 10);
    i0.ɵɵtext(3);
    i0.ɵɵpipe(4, "translate");
    i0.ɵɵelementEnd();
    i0.ɵɵtext(5);
    i0.ɵɵelement(6, "br");
    i0.ɵɵelementStart(7, "span", 11);
    i0.ɵɵtext(8);
    i0.ɵɵelement(9, "br");
    i0.ɵɵtext(10);
    i0.ɵɵelementEnd()();
    i0.ɵɵelementStart(11, "td");
    i0.ɵɵtemplate(12, WeeklyCertEmployerGridComponent_ng_template_4_ion_button_12_Template, 2, 4, "ion-button", 12)(13, WeeklyCertEmployerGridComponent_ng_template_4_ion_button_13_Template, 2, 4, "ion-button", 13)(14, WeeklyCertEmployerGridComponent_ng_template_4_ion_button_14_Template, 2, 4, "ion-button", 13);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(15, "td")(16, "span", 10);
    i0.ɵɵtext(17);
    i0.ɵɵpipe(18, "translate");
    i0.ɵɵelementEnd();
    i0.ɵɵtext(19);
    i0.ɵɵpipe(20, "date");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(21, "td")(22, "span", 10);
    i0.ɵɵtext(23);
    i0.ɵɵpipe(24, "translate");
    i0.ɵɵelementEnd();
    i0.ɵɵtext(25);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(26, "td")(27, "span", 10);
    i0.ɵɵtext(28);
    i0.ɵɵpipe(29, "translate");
    i0.ɵɵelementEnd();
    i0.ɵɵtext(30);
    i0.ɵɵpipe(31, "currency");
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    const employer_r6 = ctx.$implicit;
    const ctx_r2 = i0.ɵɵnextContext();
    i0.ɵɵadvance(1);
    i0.ɵɵstyleProp("color", employer_r6.isPartTimeEmployer && !employer_r6.isPartTimeEmployerEdited && employer_r6.isEmployerGridSubmitted ? "#eb445a" : "");
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(4, 17, "weeklies.employer.grid.header.name"));
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate1(" ", employer_r6.employerName, "");
    i0.ɵɵadvance(3);
    i0.ɵɵtextInterpolate(employer_r6.line1);
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate3("", employer_r6.city, "\u00A0", employer_r6.state, "\u00A0", employer_r6.zip, "");
    i0.ɵɵadvance(2);
    i0.ɵɵproperty("ngIf", employer_r6.isPartTimeEmployer && !employer_r6.isPartTimeEmployerEdited);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", !employer_r6.isPartTimeEmployer || employer_r6.isPartTimeEmployer && employer_r6.isPartTimeEmployerEdited);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", !employer_r6.isPartTimeEmployer);
    i0.ɵɵadvance(3);
    i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(18, 19, "weeklies.employer.grid.header.lastDay"));
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate1(" ", i0.ɵɵpipeBind2(20, 21, employer_r6.lastDayWorked, "MMMM d, y"), " ");
    i0.ɵɵadvance(4);
    i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(24, 24, "weeklies.employer.grid.header.status"));
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate1(" ", ctx_r2.getSepReason(employer_r6.reasonSeparation), " ");
    i0.ɵɵadvance(3);
    i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(29, 26, "weeklies.employer.grid.header.grossEarnings"));
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate1(" ", i0.ɵɵpipeBind1(31, 28, employer_r6.grossEarning), " ");
} }
function WeeklyCertEmployerGridComponent_5_ng_template_0_app_weekly_cert_employer_qe_5_Template(rf, ctx) { if (rf & 1) {
    const _r26 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "app-weekly-cert-employer-qe", 22);
    i0.ɵɵlistener("success", function WeeklyCertEmployerGridComponent_5_ng_template_0_app_weekly_cert_employer_qe_5_Template_app_weekly_cert_employer_qe_success_0_listener($event) { i0.ɵɵrestoreView(_r26); const ctx_r25 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r25.addEmployer($event)); })("onClose", function WeeklyCertEmployerGridComponent_5_ng_template_0_app_weekly_cert_employer_qe_5_Template_app_weekly_cert_employer_qe_onClose_0_listener() { i0.ɵɵrestoreView(_r26); const ctx_r27 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r27.close()); });
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r24 = i0.ɵɵnextContext(3);
    i0.ɵɵproperty("dynamicParam", ctx_r24.dynamicParam)("empToEdit", ctx_r24.selectedEmployer);
} }
function WeeklyCertEmployerGridComponent_5_ng_template_0_Template(rf, ctx) { if (rf & 1) {
    const _r29 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "div", 18)(1, "p-accordion", 19);
    i0.ɵɵlistener("onClose", function WeeklyCertEmployerGridComponent_5_ng_template_0_Template_p_accordion_onClose_1_listener() { i0.ɵɵrestoreView(_r29); const ctx_r28 = i0.ɵɵnextContext(2); ctx_r28.selected = false; ctx_r28.isEditMode = false; ctx_r28.close(); return i0.ɵɵresetView(ctx_r28.activeIndex = null); })("onOpen", function WeeklyCertEmployerGridComponent_5_ng_template_0_Template_p_accordion_onOpen_1_listener() { i0.ɵɵrestoreView(_r29); const ctx_r30 = i0.ɵɵnextContext(2); ctx_r30.selected = true; return i0.ɵɵresetView(ctx_r30.activeIndex = 0); });
    i0.ɵɵelementStart(2, "p-accordionTab", 20);
    i0.ɵɵpipe(3, "translate");
    i0.ɵɵpipe(4, "translate");
    i0.ɵɵtemplate(5, WeeklyCertEmployerGridComponent_5_ng_template_0_app_weekly_cert_employer_qe_5_Template, 1, 2, "app-weekly-cert-employer-qe", 21);
    i0.ɵɵelementEnd()()();
} if (rf & 2) {
    const ctx_r23 = i0.ɵɵnextContext(2);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("selected", ctx_r23.selected)("activeIndex", ctx_r23.activeIndex);
    i0.ɵɵadvance(1);
    i0.ɵɵpropertyInterpolate("header", ctx_r23.isEditMode ? i0.ɵɵpipeBind1(3, 4, "weeklies.employer.grid.header.edit") : i0.ɵɵpipeBind1(4, 6, "weeklies.employer.grid.header.add"));
    i0.ɵɵadvance(3);
    i0.ɵɵproperty("ngIf", ctx_r23.selected);
} }
function WeeklyCertEmployerGridComponent_5_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵtemplate(0, WeeklyCertEmployerGridComponent_5_ng_template_0_Template, 6, 8, "ng-template", 17);
} }
function WeeklyCertEmployerGridComponent_ng_template_11_Template(rf, ctx) { if (rf & 1) {
    const _r32 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "ion-button", 23);
    i0.ɵɵlistener("click", function WeeklyCertEmployerGridComponent_ng_template_11_Template_ion_button_click_0_listener() { i0.ɵɵrestoreView(_r32); const ctx_r31 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r31.close()); });
    i0.ɵɵtext(1, " Close ");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(2, "ion-button", 24);
    i0.ɵɵlistener("click", function WeeklyCertEmployerGridComponent_ng_template_11_Template_ion_button_click_2_listener() { i0.ɵɵrestoreView(_r32); const ctx_r33 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r33.editDuplicateEmployer()); });
    i0.ɵɵtext(3, " Edit ");
    i0.ɵɵelementEnd();
} }
const _c4 = () => ({ width: "45vw" });
const _c5 = () => ({ "1200px": "660px", "992px": "660px", "768px": "660px", "576px": "100vw" });
export class WeeklyCertEmployerGridComponent {
    constructor(vs, cs, wcService) {
        this.vs = vs;
        this.cs = cs;
        this.wcService = wcService;
        this.onComplete = new EventEmitter();
        this.selected = false;
        this.activeIndex = null;
        this.isEditMode = false;
        this.employmentStatusOptionsAll = [];
        this.indexToEdit = null;
        this.employers = [];
        this.showAddEmpPopup = false;
        this.showDuplicatePopup = false;
        this.isDisabled = false;
        this.onChange = (value) => { };
        this.onTouch = () => { };
        this.onChangeSubs = [];
    }
    ngOnDestroy() {
        for (let sub of this.onChangeSubs) {
            sub.unsubscribe();
        }
    }
    writeValue(value) {
        if (value) {
            this.employers = value;
            this.publishEmployer();
        }
        else {
            this.setupEmployer();
        }
    }
    async setupEmployer() {
        this.wcService.fetchWeeklyEmployerDetails(this.dynamicParam['claimantId'], this.dynamicParam['claimWeekEndDate']).subscribe(res => {
            if (res && res.length > 0) {
                this.employers = [...res];
                this.publishEmployer();
            }
        });
    }
    registerOnChange(fn) {
        let sub = this.vs.weeklyEmployers.subscribe(fn);
        this.onChangeSubs.push(sub);
    }
    registerOnTouched(onTouch) {
        this.onTouch = onTouch;
    }
    setDisabledState(isDisabled) {
        this.isDisabled = isDisabled;
    }
    ngOnInit() {
        this.loadMasterData();
        this.employers = this.vs.weeklyEmployers.getValue() || [];
    }
    loadMasterData() {
        this.cs.loadMasterData();
        this.cs.getReasonSeparation().subscribe(value => {
            value.forEach(arr => this.employmentStatusOptionsAll.push(arr));
        });
    }
    addEmployer(employer) {
        if (this.checkForDuplicate(employer)) {
            this.selectedEmployer = employer;
            this.showAddEmpPopup = false;
            this.showDuplicatePopup = true;
            return;
        }
        if (this.indexToEdit != null) {
            this.employers[this.indexToEdit] = employer;
        }
        else {
            this.employers.push(employer);
        }
        this.showAddEmpPopup = false;
        this.selectedEmployer = null;
        this.indexToEdit = null;
        this.publishEmployer();
        if (this.employers.length > 0) {
            this.form.controls['workPerformed'].setValue('Y');
        }
        this.selected = false;
        this.activeIndex = -1;
        this.isEditMode = false;
    }
    publishEmployer() {
        this.vs.weeklyEmployers.next(this.employers.length > 0 ? this.employers : null);
    }
    editEmployer(employer) {
        if (this.showAddEmpPopup && this.selectedEmployer !== employer) {
            this.close();
            setTimeout(() => {
                this.selectedEmployer = employer;
                this.indexToEdit = this.employers.indexOf(employer);
                this.showAddEmpPopup = true;
                this.selected = true;
                this.activeIndex = 0;
                this.isEditMode = true;
            }, 0);
        }
        else {
            this.selectedEmployer = employer;
            this.indexToEdit = this.employers.indexOf(employer);
            this.showAddEmpPopup = true;
            this.selected = true;
            this.activeIndex = 0;
            this.isEditMode = true;
        }
    }
    editDuplicateEmployer() {
        this.showDuplicatePopup = false;
        this.showAddEmpPopup = true;
        this.selected = true;
        this.activeIndex = 0;
        this.isEditMode = true;
    }
    deleteDependent(employer) {
        let index = this.employers.indexOf(employer);
        this.employers.splice(index, 1);
        this.publishEmployer();
        if (this.employers.length == 0) {
            this.form.controls['workPerformed'].setValue('N');
        }
    }
    close() {
        this.showAddEmpPopup = false;
        this.indexToEdit = null;
        this.selectedEmployer = null;
        this.showDuplicatePopup = false;
        this.selected = false;
        this.activeIndex = -1;
        this.isEditMode = false;
    }
    checkForDuplicate(employer) {
        if (this.employers) {
            let employers = this.employers.filter(e => {
                if (this.indexToEdit == this.employers.indexOf(e)) {
                    return false;
                }
                let result = (employer.employerId && e.employerId && employer.employerId == e.employerId)
                    ||
                        (employer.employerName == e.employerName &&
                            employer.state == e.state &&
                            employer.city == e.city);
                return result;
            });
            return employers.length > 0;
        }
        else {
            return false;
        }
    }
    getSepReason(value) {
        if (this.employmentStatusOptionsAll.length > 0 && value) {
            return this.employmentStatusOptionsAll.filter(s => s.value == value)[0].text;
        }
    }
    submit() {
        this.employers.forEach(e => {
            if (!e.isPartTimeEmployerEdited && e.isPartTimeEmployer) {
                e.isEmployerGridSubmitted = true;
            }
        });
    }
    static { this.ɵfac = function WeeklyCertEmployerGridComponent_Factory(t) { return new (t || WeeklyCertEmployerGridComponent)(i0.ɵɵdirectiveInject(i1.ValidationService), i0.ɵɵdirectiveInject(i2.ClaimService), i0.ɵɵdirectiveInject(i3.WeeklyCertService)); }; }
    static { this.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: WeeklyCertEmployerGridComponent, selectors: [["app-weekly-cert-employer-grid"]], viewQuery: function WeeklyCertEmployerGridComponent_Query(rf, ctx) { if (rf & 1) {
            i0.ɵɵviewQuery(_c0, 5);
        } if (rf & 2) {
            let _t;
            i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.accordionTab = _t.first);
        } }, inputs: { dynamicParam: "dynamicParam", form: "form" }, outputs: { onComplete: "onComplete" }, features: [i0.ɵɵProvidersFeature([{
                    provide: NG_VALUE_ACCESSOR,
                    useExisting: WeeklyCertEmployerGridComponent,
                    multi: true
                }])], decls: 12, vars: 13, consts: [[2, "margin-left", "-5px"], ["styleClass", "p-datatable-striped app-datatable ion-padding-top", 3, "rowHover", "value"], ["dt", ""], ["pTemplate", "header"], ["pTemplate", "body"], [4, "ngIf"], ["appendTo", "body", "position", "top", "appendTo", "body", "closeOnEscape", "false", 3, "visible", "modal", "breakpoints", "baseZIndex", "draggable", "resizable"], [1, "heading"], ["pTemplate", "footer"], [1, "ion-padding-top", "ion-padding-bottom"], [1, "p-column-title"], [2, "font-size", "12px"], ["fill", "outline", "size", "small", "class", "action-button", 3, "disabled", "color", "click", 4, "ngIf"], ["fill", "outline", "size", "small", "class", "action-button", 3, "id", "disabled", "click", 4, "ngIf"], ["fill", "outline", "size", "small", 1, "action-button", 3, "disabled", "color", "click"], [1, "action-icon", 3, "icon"], ["fill", "outline", "size", "small", 1, "action-button", 3, "id", "disabled", "click"], ["pTemplate", "summary"], [1, "align-items-center", "justify-content-between"], ["expandIcon", "pi pi-plus-circle", "collapseIcon", "pi pi-minus-circle", "id", "wcAddEmployer", 3, "selected", "activeIndex", "onClose", "onOpen"], [3, "header"], [3, "dynamicParam", "empToEdit", "success", "onClose", 4, "ngIf"], [3, "dynamicParam", "empToEdit", "success", "onClose"], ["shape", "round", "size", "small", "type", "submit", "fill", "outline", 3, "click"], ["shape", "round", "size", "small", "type", "submit", "fill", "solid", 3, "click"]], template: function WeeklyCertEmployerGridComponent_Template(rf, ctx) { if (rf & 1) {
            i0.ɵɵelementStart(0, "div", 0)(1, "p-table", 1, 2);
            i0.ɵɵtemplate(3, WeeklyCertEmployerGridComponent_ng_template_3_Template, 14, 12, "ng-template", 3)(4, WeeklyCertEmployerGridComponent_ng_template_4_Template, 32, 30, "ng-template", 4)(5, WeeklyCertEmployerGridComponent_5_Template, 1, 0, null, 5);
            i0.ɵɵelementEnd();
            i0.ɵɵelementStart(6, "p-dialog", 6)(7, "h4", 7);
            i0.ɵɵtext(8, "Duplicate employer not allowed");
            i0.ɵɵelementEnd();
            i0.ɵɵelementStart(9, "ion-label");
            i0.ɵɵtext(10, "It seems like you have added a employer that has been added already. Please check details and try adding employer again.");
            i0.ɵɵelementEnd();
            i0.ɵɵtemplate(11, WeeklyCertEmployerGridComponent_ng_template_11_Template, 4, 0, "ng-template", 8);
            i0.ɵɵelementEnd()();
        } if (rf & 2) {
            i0.ɵɵadvance(1);
            i0.ɵɵproperty("rowHover", true)("value", ctx.employers);
            i0.ɵɵadvance(4);
            i0.ɵɵproperty("ngIf", !ctx.isDisabled);
            i0.ɵɵadvance(1);
            i0.ɵɵstyleMap(i0.ɵɵpureFunction0(11, _c4));
            i0.ɵɵproperty("visible", ctx.showDuplicatePopup)("modal", true)("breakpoints", i0.ɵɵpureFunction0(12, _c5))("baseZIndex", 5000)("draggable", false)("resizable", false);
        } }, dependencies: [i4.IonButton, i4.IonLabel, i5.NgIf, i6.PrimeTemplate, i7.Dialog, i8.Table, i9.Accordion, i9.AccordionTab, i10.FaIconComponent, i11.WeeklyCertEmployerComponentQe, i5.CurrencyPipe, i5.DatePipe, i12.TranslatePipe], styles: ["[_nghost-%COMP%]     .p-datatable-footer{padding:10px 0!important}[_nghost-%COMP%]     .p-accordion-content{padding:0!important}[_nghost-%COMP%]     .p-fluid .p-autocomplete{display:flex!important}[_nghost-%COMP%]     .p-fluid .p-calendar{width:100%!important}[_nghost-%COMP%]     .p-calendar .p-inputtext{max-width:100%!important}"] }); }
}
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(WeeklyCertEmployerGridComponent, [{
        type: Component,
        args: [{ selector: 'app-weekly-cert-employer-grid', providers: [{
                        provide: NG_VALUE_ACCESSOR,
                        useExisting: WeeklyCertEmployerGridComponent,
                        multi: true
                    }], changeDetection: ChangeDetectionStrategy.Default, template: "<div style=\"margin-left: -5px;\">\r\n    <p-table #dt [rowHover]=\"true\" styleClass=\"p-datatable-striped app-datatable ion-padding-top\" [value]=\"employers\">\r\n        <ng-template pTemplate=\"header\" let-columns>\r\n            <tr>\r\n                <th>\r\n                    {{\"weeklies.employer.grid.header.name\"|translate}}\r\n                </th>\r\n                <th></th>\r\n                <th>\r\n                    {{\"weeklies.employer.grid.header.lastDay\"|translate}}\r\n                </th>\r\n                <th>\r\n                    {{\"weeklies.employer.grid.header.status\"|translate}}\r\n                </th>\r\n                <th>\r\n                    {{\"weeklies.employer.grid.header.grossEarnings\"|translate}}\r\n                </th>\r\n            </tr>\r\n        </ng-template>\r\n\r\n        <ng-template pTemplate=\"body\" let-employer let-rowIndex=\"rowIndex\">\r\n            <tr class=\"ion-padding-top ion-padding-bottom\">\r\n                <td [style.Color]=\"(employer.isPartTimeEmployer && !employer.isPartTimeEmployerEdited && employer.isEmployerGridSubmitted) ? '#eb445a':''\">\r\n                    <span class=\"p-column-title\">{{\"weeklies.employer.grid.header.name\"|translate}}</span>\r\n                    {{employer.employerName}}<br/>\r\n                    <span style=\"font-size: 12px;\">{{employer.line1}}<br/>{{employer.city}}&nbsp;{{employer.state}}&nbsp;{{employer.zip}}</span>\r\n                </td>\r\n                <td>\r\n                    <ion-button fill=\"outline\" size=\"small\" class=\"action-button\" (click)=\"editEmployer(employer)\" [disabled]=\"isDisabled\" *ngIf=\"employer.isPartTimeEmployer && !employer.isPartTimeEmployerEdited\" [color]=\"(employer.isPartTimeEmployer && !employer.isPartTimeEmployerEdited && employer.isEmployerGridSubmitted) ? 'danger':''\">\r\n                        <fa-icon [icon]=\"['far', 'arrows-rotate']\" class=\"action-icon\"></fa-icon>\r\n                    </ion-button>   \r\n                    <ion-button [id]=\"'btnEditEmployer-' + rowIndex\" fill=\"outline\" size=\"small\" class=\"action-button\" (click)=\"editEmployer(employer)\" [disabled]=\"isDisabled\" *ngIf=\"!employer.isPartTimeEmployer || (employer.isPartTimeEmployer && employer.isPartTimeEmployerEdited)\">\r\n                        <fa-icon [icon]=\"['fal', 'edit']\" class=\"action-icon\"></fa-icon>\r\n                    </ion-button>\r\n                    <ion-button [id]=\"'btnDeleteEmployer-' + rowIndex\" fill=\"outline\" size=\"small\" class=\"action-button\" (click)=\"deleteDependent(employer)\" [disabled]=\"isDisabled\" *ngIf=\"!employer.isPartTimeEmployer\">\r\n                        <fa-icon [icon]=\"['fal', 'trash-alt']\" class=\"action-icon\"></fa-icon>\r\n                    </ion-button>\r\n                </td>\r\n                <td>\r\n                    <span class=\"p-column-title\">{{\"weeklies.employer.grid.header.lastDay\"|translate}}</span>\r\n                    {{employer.lastDayWorked | date:'MMMM d, y'}}\r\n                </td>\r\n                <td>\r\n                    <span class=\"p-column-title\">{{\"weeklies.employer.grid.header.status\"|translate}}</span>\r\n                    {{getSepReason(employer.reasonSeparation)}}\r\n                </td>\r\n                <td>\r\n                    <span class=\"p-column-title\">{{\"weeklies.employer.grid.header.grossEarnings\"|translate}}</span>\r\n                    {{employer.grossEarning | currency}}\r\n                </td>\r\n            </tr>\r\n        </ng-template>\r\n\r\n        <ng-template pTemplate=\"summary\" *ngIf=\"!isDisabled\">\r\n            <div class=\"align-items-center justify-content-between\">\r\n                 <p-accordion expandIcon=\"pi pi-plus-circle\" collapseIcon=\"pi pi-minus-circle\" [selected]=\"selected\" (onClose)=\"selected = false; isEditMode= false; close(); activeIndex = null\"\r\n                 (onOpen)=\"selected = true; activeIndex=0\" [activeIndex]=\"activeIndex\" id=\"wcAddEmployer\">\r\n                  <!-- <p-accordionTab header='{{\"weeklies.employer.grid.header.add\"|translate}}'> -->\r\n                    <p-accordionTab header='{{ isEditMode ? (\"weeklies.employer.grid.header.edit\"|translate) : (\"weeklies.employer.grid.header.add\"|translate) }}'>\r\n                        <app-weekly-cert-employer-qe [dynamicParam]=\"dynamicParam\" (success)=\"addEmployer($event)\" \r\n                        (onClose)=\"close()\" [empToEdit]=\"selectedEmployer\" *ngIf=\"selected\"></app-weekly-cert-employer-qe>\r\n                    </p-accordionTab>\r\n                </p-accordion>\r\n            </div>\r\n        </ng-template>\r\n    </p-table>\r\n    <p-dialog [visible]=\"showDuplicatePopup\" [modal]=\"true\" appendTo=\"body\" position=\"top\" [breakpoints]=\"{'1200px': '660px', '992px': '660px', '768px': '660px', '576px': '100vw'}\" [style]=\"{width: '45vw'}\"\r\n    [baseZIndex]=\"5000\" [draggable]=\"false\" [resizable]=\"false\" appendTo=\"body\" closeOnEscape=\"false\">\r\n        <h4 class=\"heading\">Duplicate employer not allowed</h4>\r\n        <ion-label>It seems like you have added a employer that has been added already. Please check details and try adding employer again.</ion-label>\r\n        <ng-template pTemplate=\"footer\">\r\n            <ion-button shape=\"round\" size=\"small\" type=\"submit\" fill=\"outline\" (click)=\"close()\">\r\n                Close\r\n            </ion-button>\r\n            <ion-button shape=\"round\" size=\"small\" type=\"submit\" fill=\"solid\" (click)=\"editDuplicateEmployer()\">\r\n                Edit\r\n            </ion-button>\r\n        </ng-template>\r\n    </p-dialog>\r\n</div>", styles: [":host ::ng-deep .p-datatable-footer{padding:10px 0!important}:host ::ng-deep .p-accordion-content{padding:0!important}:host ::ng-deep .p-fluid .p-autocomplete{display:flex!important}:host ::ng-deep .p-fluid .p-calendar{width:100%!important}:host ::ng-deep .p-calendar .p-inputtext{max-width:100%!important}\n"] }]
    }], () => [{ type: i1.ValidationService }, { type: i2.ClaimService }, { type: i3.WeeklyCertService }], { dynamicParam: [{
            type: Input
        }], form: [{
            type: Input
        }], onComplete: [{
            type: Output
        }], accordionTab: [{
            type: ViewChild,
            args: ['accordionTab']
        }] }); })();
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(WeeklyCertEmployerGridComponent, { className: "WeeklyCertEmployerGridComponent", filePath: "lib\\components\\weekly-cert-employer-grid\\weekly-cert-employer-grid.component.ts", lineNumber: 24 }); })();
//# sourceMappingURL=data:application/json;base64, 