(function (global, factory) {
    typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common/http'), require('xlsx'), require('@angular/material/tabs'), require('@angular/material/grid-list'), require('@angular/material/card'), require('@angular/material/button'), require('@angular/common'), require('@angular/material/input'), require('@angular/material/form-field'), require('@angular/router'), require('@angular/material/icon'), require('@angular/material/datepicker'), require('@angular/material/select'), require('@angular/material/core'), require('@angular/forms'), require('@angular/material/table'), require('jspdf'), require('jspdf-autotable'), require('@angular/material/paginator')) :
    typeof define === 'function' && define.amd ? define('reports-hyper74', ['exports', '@angular/core', '@angular/common/http', 'xlsx', '@angular/material/tabs', '@angular/material/grid-list', '@angular/material/card', '@angular/material/button', '@angular/common', '@angular/material/input', '@angular/material/form-field', '@angular/router', '@angular/material/icon', '@angular/material/datepicker', '@angular/material/select', '@angular/material/core', '@angular/forms', '@angular/material/table', 'jspdf', 'jspdf-autotable', '@angular/material/paginator'], factory) :
    (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["reports-hyper74"] = {}, global.ng.core, global.ng.common.http, global.XLSX, global.ng.material.tabs, global.ng.material.gridList, global.ng.material.card, global.ng.material.button, global.ng.common, global.ng.material.input, global.ng.material.formField, global.ng.router, global.ng.material.icon, global.ng.material.datepicker, global.ng.material.select, global.ng.material.core, global.ng.forms, global.ng.material.table, global.jspdf, null, global.ng.material.paginator));
})(this, (function (exports, i0, i1, XLSX, i2, i3, i4, i5, i2$1, i12, i6, i1$1, i4$1, i7, i8, i9, i11, i6$1, jspdf, jspdfAutotable, i7$1) { 'use strict';

    function _interopNamespace(e) {
        if (e && e.__esModule) return e;
        var n = Object.create(null);
        if (e) {
            Object.keys(e).forEach(function (k) {
                if (k !== 'default') {
                    var d = Object.getOwnPropertyDescriptor(e, k);
                    Object.defineProperty(n, k, d.get ? d : {
                        enumerable: true,
                        get: function () { return e[k]; }
                    });
                }
            });
        }
        n["default"] = e;
        return Object.freeze(n);
    }

    var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
    var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
    var XLSX__namespace = /*#__PURE__*/_interopNamespace(XLSX);
    var i2__namespace = /*#__PURE__*/_interopNamespace(i2);
    var i3__namespace = /*#__PURE__*/_interopNamespace(i3);
    var i4__namespace = /*#__PURE__*/_interopNamespace(i4);
    var i5__namespace = /*#__PURE__*/_interopNamespace(i5);
    var i2__namespace$1 = /*#__PURE__*/_interopNamespace(i2$1);
    var i12__namespace = /*#__PURE__*/_interopNamespace(i12);
    var i6__namespace = /*#__PURE__*/_interopNamespace(i6);
    var i1__namespace$1 = /*#__PURE__*/_interopNamespace(i1$1);
    var i4__namespace$1 = /*#__PURE__*/_interopNamespace(i4$1);
    var i7__namespace = /*#__PURE__*/_interopNamespace(i7);
    var i8__namespace = /*#__PURE__*/_interopNamespace(i8);
    var i9__namespace = /*#__PURE__*/_interopNamespace(i9);
    var i11__namespace = /*#__PURE__*/_interopNamespace(i11);
    var i6__namespace$1 = /*#__PURE__*/_interopNamespace(i6$1);
    var i7__namespace$1 = /*#__PURE__*/_interopNamespace(i7$1);

    var ReportsService = /** @class */ (function () {
        function ReportsService(httpClient) {
            this.httpClient = httpClient;
        }
        ReportsService.prototype.loadGroups = function (url) {
            return this.httpClient.get(url);
        };
        ReportsService.prototype.listReportsByGroupId = function (url, groupId) {
            return this.httpClient.get(url + "/" + groupId);
        };
        ReportsService.prototype.getReportWithFilters = function (url, reportId) {
            return this.httpClient.get(url + "/" + reportId);
        };
        ReportsService.prototype.executeReport = function (url, query) {
            // console.log('query', query);
            var params = new i1.HttpParams()
                .set('pageNum', "" + query.pageNum)
                .set('pageSize', "" + query.pageSize);
            return this.httpClient.post(url + "/" + query.reportId, query.data, { params: params });
        };
        ReportsService.prototype.exportAsExcelFile = function (json, excelFileName) {
            var header = json; // columns name
            var wscols = [];
            for (var i = 0; i < header.length; i++) { // columns length added
                wscols.push({ wch: header[i].length + 5 });
            }
            // const worksheet: XLSX.WorkSheet = XLSX.utils.json_to_sheet(json);
            var table_elt = document.getElementById("excelDataTable");
            var workbook = XLSX__namespace.utils.table_to_book(table_elt);
            var ws = workbook.Sheets["Sheet1"];
            XLSX__namespace.utils.sheet_add_aoa(ws, [["Created " + new Date().toISOString()]], { origin: -1 });
            ws["!cols"] = wscols;
            XLSX__namespace.writeFile(workbook, excelFileName + ".xlsx");
        };
        return ReportsService;
    }());
    ReportsService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: ReportsService, deps: [{ token: i1__namespace.HttpClient }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
    ReportsService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: ReportsService, providedIn: 'root' });
    i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: ReportsService, decorators: [{
                type: i0.Injectable,
                args: [{
                        providedIn: 'root'
                    }]
            }], ctorParameters: function () { return [{ type: i1__namespace.HttpClient }]; } });

    var breakpoint;
    function sharedGridLayout(resize, event) {
        var size;
        if (resize) {
            size = event.target.innerWidth;
            //console.log('event',size)
        }
        else {
            size = window.innerWidth;
        }
        switchMethod(size);
        return breakpoint;
    }
    function switchMethod(size) {
        switch (true) {
            case (size <= 768):
                breakpoint = 1;
                break;
            case (size >= 768 && size <= 992):
                breakpoint = 2;
                break;
            case (size >= 992):
                breakpoint = 3;
                break;
        }
    }

    var ReportsComponent = /** @class */ (function () {
        function ReportsComponent(reportService) {
            this.reportService = reportService;
            this.reportsGroups = [];
            this.reportsByGroupId = [];
            this.$subs = [];
            this.onViewClicked = new i0.EventEmitter();
            this.breakpoint = 3;
        }
        ReportsComponent.prototype.ngOnInit = function () {
            this.loadGroups();
        };
        ReportsComponent.prototype.loadGroups = function () {
            var _this = this;
            var sub1 = this.reportService
                .loadGroups(this.urlReportGroups)
                .subscribe(function (res) {
                _this.reportsGroups = res;
                _this.$subs.push(sub1);
            });
        };
        ReportsComponent.prototype.listReportsByGroupId = function (groupId) {
            var _this = this;
            var sub2 = this.reportService
                .listReportsByGroupId(this.reportGroupByIdUrl, groupId)
                .subscribe(function (res2) {
                _this.reportsByGroupId = res2;
            });
            this.$subs.push(sub2);
        };
        ReportsComponent.prototype.onTabChanged = function (event) {
            this.listReportsByGroupId(this.reportsGroups[event].id);
        };
        ReportsComponent.prototype.viewReportFilterDetails = function (report) {
            this.onViewClicked.emit(report);
        };
        ReportsComponent.prototype.onResize = function (event) {
            this.breakpoint = sharedGridLayout(true, event);
            // console.log('breakPoint', this.breakpoint);
        };
        ReportsComponent.prototype.ngOnDestroy = function () {
            this.$subs.forEach(function (item) { return item.unsubscribe(); });
        };
        return ReportsComponent;
    }());
    ReportsComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: ReportsComponent, deps: [{ token: ReportsService }], target: i0__namespace.ɵɵFactoryTarget.Component });
    ReportsComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: ReportsComponent, selector: "lib-reports-groups", inputs: { urlReportGroups: "urlReportGroups", reportGroupByIdUrl: "reportGroupByIdUrl" }, outputs: { onViewClicked: "onViewClicked" }, ngImport: i0__namespace, template: "\n    <div class=\"reportsContainer\">\n      <div class=\"title\">\n        Marketing Reports\n      </div>\n        <mat-tab-group *ngIf=\"reportsGroups\" (selectedIndexChange)=\"onTabChanged($event)\">\n          <mat-tab  [id]=\"group.id\" *ngFor=\"let group of reportsGroups;let i=index\"\n                    label=\"{{group.name}}\" >\n          <mat-grid-list  class=\"space\" [cols]=\"breakpoint\" (window:resize)=\"onResize($event)\" rowHeight=\"200px\">\n            <mat-grid-tile *ngFor=\"let report of reportsByGroupId\">\n              <mat-card class=\"example-card\">\n                <mat-card-title class=\"title\">{{ report.name }}</mat-card-title>\n                <mat-card-content>\n                  <p>{{ report.descreption }}</p>\n                </mat-card-content>\n                <mat-card-actions>\n                  <button\n                    mat-button\n                    class=\"viewButton\"\n                    (click)=\"viewReportFilterDetails(report)\"\n                  >\n                    View\n                  </button>\n                </mat-card-actions>\n              </mat-card>\n            </mat-grid-tile>\n          </mat-grid-list>\n          </mat-tab>\n        </mat-tab-group>\n    </div>\n  ", isInline: true, styles: ["\n      .example-card {\n        max-width: 350px;\n        border-radius: 8px;\n        height: 160px;\n        overflow: auto;\n        width: 93%\n      }\n\n      .viewButton {\n        background: #FF6600;\n        color: #ffffff;\n        float: right;\n      }\n      .title{\n        font-size: 18px;\n        font-weight: 600;\n        letter-spacing: 0.34px;\n        color: #1B1B1B;\n        opacity: 1;\n        margin-bottom: 15px;\n      }\n      .reportsContainer{\n        margin: 30px;\n      }\n      .tabs{\n        margin: 45px;\n      }\n      .space{\n        margin-top: 20px;\n      }\n    "], components: [{ type: i2__namespace.MatTabGroup, selector: "mat-tab-group", inputs: ["color", "disableRipple"], exportAs: ["matTabGroup"] }, { type: i2__namespace.MatTab, selector: "mat-tab", inputs: ["disabled", "label", "aria-label", "aria-labelledby"], exportAs: ["matTab"] }, { type: i3__namespace.MatGridList, selector: "mat-grid-list", inputs: ["cols", "gutterSize", "rowHeight"], exportAs: ["matGridList"] }, { type: i3__namespace.MatGridTile, selector: "mat-grid-tile", inputs: ["rowspan", "colspan"], exportAs: ["matGridTile"] }, { type: i4__namespace.MatCard, selector: "mat-card", exportAs: ["matCard"] }, { type: i5__namespace.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button],             button[mat-fab], button[mat-mini-fab], button[mat-stroked-button],             button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }], directives: [{ type: i2__namespace$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2__namespace$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i4__namespace.MatCardTitle, selector: "mat-card-title, [mat-card-title], [matCardTitle]" }, { type: i4__namespace.MatCardContent, selector: "mat-card-content, [mat-card-content], [matCardContent]" }, { type: i4__namespace.MatCardActions, selector: "mat-card-actions", inputs: ["align"], exportAs: ["matCardActions"] }] });
    i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: ReportsComponent, decorators: [{
                type: i0.Component,
                args: [{
                        selector: 'lib-reports-groups',
                        template: "\n    <div class=\"reportsContainer\">\n      <div class=\"title\">\n        Marketing Reports\n      </div>\n        <mat-tab-group *ngIf=\"reportsGroups\" (selectedIndexChange)=\"onTabChanged($event)\">\n          <mat-tab  [id]=\"group.id\" *ngFor=\"let group of reportsGroups;let i=index\"\n                    label=\"{{group.name}}\" >\n          <mat-grid-list  class=\"space\" [cols]=\"breakpoint\" (window:resize)=\"onResize($event)\" rowHeight=\"200px\">\n            <mat-grid-tile *ngFor=\"let report of reportsByGroupId\">\n              <mat-card class=\"example-card\">\n                <mat-card-title class=\"title\">{{ report.name }}</mat-card-title>\n                <mat-card-content>\n                  <p>{{ report.descreption }}</p>\n                </mat-card-content>\n                <mat-card-actions>\n                  <button\n                    mat-button\n                    class=\"viewButton\"\n                    (click)=\"viewReportFilterDetails(report)\"\n                  >\n                    View\n                  </button>\n                </mat-card-actions>\n              </mat-card>\n            </mat-grid-tile>\n          </mat-grid-list>\n          </mat-tab>\n        </mat-tab-group>\n    </div>\n  ",
                        styles: [
                            "\n      .example-card {\n        max-width: 350px;\n        border-radius: 8px;\n        height: 160px;\n        overflow: auto;\n        width: 93%\n      }\n\n      .viewButton {\n        background: #FF6600;\n        color: #ffffff;\n        float: right;\n      }\n      .title{\n        font-size: 18px;\n        font-weight: 600;\n        letter-spacing: 0.34px;\n        color: #1B1B1B;\n        opacity: 1;\n        margin-bottom: 15px;\n      }\n      .reportsContainer{\n        margin: 30px;\n      }\n      .tabs{\n        margin: 45px;\n      }\n      .space{\n        margin-top: 20px;\n      }\n    ",
                        ],
                    }]
            }], ctorParameters: function () { return [{ type: ReportsService }]; }, propDecorators: { urlReportGroups: [{
                    type: i0.Input
                }], reportGroupByIdUrl: [{
                    type: i0.Input
                }], onViewClicked: [{
                    type: i0.Output
                }] } });

    var ReportDetailsComponent = /** @class */ (function () {
        function ReportDetailsComponent(reportService, datepipe) {
            this.reportService = reportService;
            this.datepipe = datepipe;
            this.$subs = [];
            this.breakpoint = 3;
            this.onExecuteFired = new i0.EventEmitter();
            this.backClicked = new i0.EventEmitter();
        }
        ReportDetailsComponent.prototype.ngOnInit = function () {
            this.breakpoint = sharedGridLayout();
            this.loadReportFilters();
        };
        ReportDetailsComponent.prototype.onResize = function (event) {
            this.breakpoint = sharedGridLayout(true, event);
        };
        ReportDetailsComponent.prototype.loadReportFilters = function () {
            var _this = this;
            var sub1 = this.reportService
                .getReportWithFilters(this.loadReportDetailFilters, this.reportId)
                .subscribe(function (res) {
                _this.reportDetails = res;
            });
            this.$subs.push(sub1);
        };
        ReportDetailsComponent.prototype.ngOnDestroy = function () {
            this.$subs.forEach(function (item) { return item.unsubscribe(); });
        };
        ReportDetailsComponent.prototype.validateAndConvertData = function () {
            var _a, _b;
            if (this.reportDetails && this.reportDetails.reportFilters) {
                for (var i = 0; i < ((_b = (_a = this.reportDetails) === null || _a === void 0 ? void 0 : _a.reportFilters) === null || _b === void 0 ? void 0 : _b.length); i++) {
                    this.reportDetails.reportFilters[i].value =
                        this.reportDetails.reportFilters[i].dataType.toLocaleLowerCase() ===
                            'date'
                            ? this.datepipe.transform(this.reportDetails.reportFilters[i].value, 'yyyy-MM-dd')
                            : this.reportDetails.reportFilters[i].value;
                }
            }
            return true;
        };
        ReportDetailsComponent.prototype.execute = function () {
            var _a;
            if ((_a = this.executeForm) === null || _a === void 0 ? void 0 : _a.invalid) {
                this.executeForm.form.markAllAsTouched();
                return;
            }
            this.validateAndConvertData();
            sessionStorage.setItem('executeForm', JSON.stringify(this.reportDetails.reportFilters));
            sessionStorage.setItem('reportName', this.reportDetails.name);
            this.onExecuteFired.emit({ fired: true });
        };
        ReportDetailsComponent.prototype.onBackClicked = function () {
            this.backClicked.emit({ back: true });
        };
        return ReportDetailsComponent;
    }());
    ReportDetailsComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: ReportDetailsComponent, deps: [{ token: ReportsService }, { token: i2__namespace$1.DatePipe }], target: i0__namespace.ɵɵFactoryTarget.Component });
    ReportDetailsComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: ReportDetailsComponent, selector: "lib-report-details", inputs: { reportId: "reportId", loadReportDetailFilters: "loadReportDetailFilters" }, outputs: { onExecuteFired: "onExecuteFired", backClicked: "backClicked" }, viewQueries: [{ propertyName: "executeForm", first: true, predicate: ["f"], descendants: true }], ngImport: i0__namespace, template: "<mat-card class=\"example-card\">\n  <mat-card-title><mat-icon (click)=\"onBackClicked()\" class=\"back-btn\">arrow_back</mat-icon> {{reportDetails?.name}}</mat-card-title>\n  <mat-card-subtitle>{{reportDetails?.descreption}}</mat-card-subtitle>\n  <mat-card-content *ngIf=\"reportDetails\">\n    <form name=\"form\"  #f=\"ngForm\" novalidate >\n      <mat-grid-list class=\"mt-2\" [cols]=\"breakpoint\" (window:resize)=\"onResize($event)\" rowHeight=\"100px\">\n        <mat-grid-tile *ngFor=\"let filter of reportDetails.reportFilters\">\n          <mat-form-field class=\"form-field\" appearance=\"outline\" *ngIf=\"filter.dataType.toLowerCase() == 'date' \">\n            <mat-label class=\"form-label\">{{filter.name}} </mat-label>\n            <input matInput [matDatepicker]=\"picker\" #date=\"ngModel\"\n                   [name]=\"filter.name\" [(ngModel)]=\"filter.value\" [required]=\"filter.required\">\n            <mat-datepicker-toggle matSuffix [for]=\"picker\"></mat-datepicker-toggle>\n            <mat-datepicker #picker></mat-datepicker>\n\n          </mat-form-field>\n\n          <mat-form-field class=\"form-field\" appearance=\"outline\" *ngIf=\"filter.dataType.toLowerCase() == 'text' \">\n            <mat-label class=\"form-label\">{{filter.name}} </mat-label>\n            <input matInput *ngIf=\"filter.dataType.toLowerCase() == 'text' \" [name]=\"filter.name\"\n                   [(ngModel)]=\"filter.value\" [required]=\"filter.required\">\n          </mat-form-field>\n          <mat-form-field class=\"form-field\" appearance=\"outline\" *ngIf=\"filter.dataType.toLowerCase() == 'number' \">\n            <mat-label class=\"form-label\">{{filter.name}} </mat-label>\n            <input matInput type=\"number\" [name]=\"filter.name\"\n                   [(ngModel)]=\"filter.value\" [required]=\"filter.required\" >\n          </mat-form-field>\n\n          <mat-form-field class=\"form-field\" appearance=\"outline\"\n                          *ngIf=\"filter.dataType.toLowerCase() == 'query' || filter.dataType.toLowerCase() ==='lookup'\">\n            <mat-label class=\"form-label\">{{filter.name}} </mat-label>\n            <mat-select *ngIf=\"filter.dataType.toLowerCase() == 'query' || filter.dataType.toLowerCase() ==='lookup'\"\n                        [name]=\"filter.name\" [(ngModel)]=\"filter.value\" [required]=\"filter.required\">\n              <mat-option *ngFor=\"let option of filter.lookUps\" [value]=\"option.id\">{{option.name}}</mat-option>\n            </mat-select>\n          </mat-form-field>\n        </mat-grid-tile>\n      </mat-grid-list>\n    </form>\n    <button  type=\"submit\" mat-button class=\"viewButton\" (click)=\"execute()\">Execute</button>\n\n  </mat-card-content>\n</mat-card>\n", styles: [".example-card{height:100%;width:100%;border-radius:8px}.back-btn{vertical-align:sub;color:#f60;cursor:pointer}.mat-form-field{width:93%}.viewButton{background:#FF6600;color:#fff}\n"], components: [{ type: i4__namespace.MatCard, selector: "mat-card", exportAs: ["matCard"] }, { type: i4__namespace$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: i3__namespace.MatGridList, selector: "mat-grid-list", inputs: ["cols", "gutterSize", "rowHeight"], exportAs: ["matGridList"] }, { type: i3__namespace.MatGridTile, selector: "mat-grid-tile", inputs: ["rowspan", "colspan"], exportAs: ["matGridTile"] }, { type: i6__namespace.MatFormField, selector: "mat-form-field", inputs: ["color", "floatLabel", "appearance", "hideRequiredMarker", "hintLabel"], exportAs: ["matFormField"] }, { type: i7__namespace.MatDatepickerToggle, selector: "mat-datepicker-toggle", inputs: ["tabIndex", "disabled", "for", "aria-label", "disableRipple"], exportAs: ["matDatepickerToggle"] }, { type: i7__namespace.MatDatepicker, selector: "mat-datepicker", exportAs: ["matDatepicker"] }, { type: i8__namespace.MatSelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex"], exportAs: ["matSelect"] }, { type: i9__namespace.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { type: i5__namespace.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button],             button[mat-fab], button[mat-mini-fab], button[mat-stroked-button],             button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }], directives: [{ type: i4__namespace.MatCardTitle, selector: "mat-card-title, [mat-card-title], [matCardTitle]" }, { type: i4__namespace.MatCardSubtitle, selector: "mat-card-subtitle, [mat-card-subtitle], [matCardSubtitle]" }, { type: i2__namespace$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i4__namespace.MatCardContent, selector: "mat-card-content, [mat-card-content], [matCardContent]" }, { type: i11__namespace.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i11__namespace.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i11__namespace.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i2__namespace$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i6__namespace.MatLabel, selector: "mat-label" }, { type: i12__namespace.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl],      input[matNativeControl], textarea[matNativeControl]", inputs: ["id", "disabled", "required", "type", "value", "readonly", "placeholder", "errorStateMatcher", "aria-describedby"], exportAs: ["matInput"] }, { type: i7__namespace.MatDatepickerInput, selector: "input[matDatepicker]", inputs: ["matDatepicker", "min", "max", "matDatepickerFilter"], exportAs: ["matDatepickerInput"] }, { type: i11__namespace.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i11__namespace.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i11__namespace.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i11__namespace.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { type: i6__namespace.MatSuffix, selector: "[matSuffix]" }, { type: i11__namespace.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }] });
    i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: ReportDetailsComponent, decorators: [{
                type: i0.Component,
                args: [{
                        selector: 'lib-report-details',
                        templateUrl: './report-details.component.html',
                        styleUrls: ['./report-details.component.css'],
                        // encapsulation: ViewEncapsulation.None,
                    }]
            }], ctorParameters: function () { return [{ type: ReportsService }, { type: i2__namespace$1.DatePipe }]; }, propDecorators: { reportId: [{
                    type: i0.Input
                }], executeForm: [{
                    type: i0.ViewChild,
                    args: ['f']
                }], loadReportDetailFilters: [{
                    type: i0.Input
                }], onExecuteFired: [{
                    type: i0.Output
                }], backClicked: [{
                    type: i0.Output
                }] } });

    var NoDataComponent = /** @class */ (function () {
        function NoDataComponent() {
        }
        NoDataComponent.prototype.ngOnInit = function () {
        };
        return NoDataComponent;
    }());
    NoDataComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: NoDataComponent, deps: [], target: i0__namespace.ɵɵFactoryTarget.Component });
    NoDataComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: NoDataComponent, selector: "lib-no-data", ngImport: i0__namespace, template: "<div class=\"empty-state\">\n  <div class=\"empty-state__content\">\n    <div class=\"empty-state__icon\">\n      <img\n        src=\"data:image/png;base64, \"\n        alt=\"\">\n    </div>\n    <div class=\"empty-state__message\">No Data has been added yet.</div>\n  </div>\n</div>\n", styles: ["body{background:#ebedf2;font-family:\"Poppins\",sans-serif}.empty-state__message{color:#38a169;font-size:1.5rem;font-weight:500;margin-top:.85rem;text-align:center!important;align-items:center!important}.credit{color:#a2a5b9;font-size:.75rem;text-align:center}a{color:#444}.empty-state__icon{text-align:center}\n"] });
    i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: NoDataComponent, decorators: [{
                type: i0.Component,
                args: [{
                        selector: 'lib-no-data',
                        templateUrl: './no-data.component.html',
                        styleUrls: ['./no-data.component.css']
                    }]
            }], ctorParameters: function () { return []; } });

    var ExecuteReportComponent = /** @class */ (function () {
        function ExecuteReportComponent(route, cd, reportService, datePipe) {
            this.route = route;
            this.cd = cd;
            this.reportService = reportService;
            this.datePipe = datePipe;
            this.backClicked = new i0.EventEmitter();
            this.$subs = [];
            this.query = { total: 0, pageNum: 0, pageSize: 10, data: null, reportId: null };
            this.excel = [];
            this.reportId = +this.route.snapshot.params['id'];
            this.query.reportId = this.reportId;
            var formExecuted = sessionStorage.getItem('executeForm');
            this.executeForm = JSON.parse(formExecuted);
            this.reportName = sessionStorage.getItem('reportName');
            this.query.data = this.executeForm;
        }
        ExecuteReportComponent.prototype.ngOnInit = function () {
            this.query.pageNum = 1;
            this.loadDataExecuted();
        };
        ExecuteReportComponent.prototype.loadDataExecuted = function (fileType) {
            var _this = this;
            var sub1 = this.reportService
                .executeReport(this.urlRpt, this.query)
                .subscribe(function (res) {
                switch (fileType) {
                    case 'excel':
                        // console.log('res.detailsExcel', res.details);
                        _this.hiddenListData = new i6$1.MatTableDataSource(res.details);
                        _this.hiddenData = res;
                        _this.hiddenDisplayedColumns = res.headers.map(function (el) { return el.property; });
                        _this.cd.detectChanges();
                        _this.reportService.exportAsExcelFile(_this.excel, _this.reportName);
                        break;
                    case 'pdf':
                        _this.hiddenListData = new i6$1.MatTableDataSource(res.details);
                        _this.hiddenData = res;
                        _this.hiddenDisplayedColumns = res.headers.map(function (el) { return el.property; });
                        _this.cd.detectChanges();
                        _this.pdfPreparing();
                        break;
                    default:
                        _this.data = res;
                        _this.list = new i6$1.MatTableDataSource(res.details);
                        _this.query.total = res.totalCount;
                        _this.displayedColumns = res.headers.map(function (el) { return el.property; });
                        break;
                }
            });
            this.$subs.push(sub1);
        };
        ExecuteReportComponent.prototype.ngOnDestroy = function () {
            this.query = {
                total: 0,
                pageNum: 0,
                pageSize: 10,
                data: null,
                reportId: null,
            };
            // console.log('query', this.query);
            this.$subs.forEach(function (item) { return item.unsubscribe(); });
        };
        ExecuteReportComponent.prototype.getNextPage = function (e) {
            this.query.pageNum = e.pageIndex + 1;
            this.query.pageSize = e.pageSize;
            this.loadDataExecuted();
        };
        ExecuteReportComponent.prototype.SavePDF = function () {
            this.query.pageSize = -1;
            this.query.pageNum = -1;
            this.loadDataExecuted('pdf');
        };
        ExecuteReportComponent.prototype.SaveEXCEL = function () {
            this.query.pageSize = -1;
            this.query.pageNum = -1;
            this.loadDataExecuted('excel');
        };
        ExecuteReportComponent.prototype.pdfPreparing = function () {
            var pdfsize = 'a0';
            var doc = new jspdf.jsPDF('l', 'pt', pdfsize);
            // @ts-ignore
            doc.autoTable({
                html: '#excelDataTable',
                startY: 60,
                margin: { horizontal: 7 },
                styles: {
                    fontSize: 50,
                    cellWidth: 'wrap'
                },
                columnStyles: {
                    1: { cellWidth: 'auto' }
                }
            });
            doc.save(this.reportName + '.pdf');
        };
        ExecuteReportComponent.prototype.onBackClicked = function () {
            this.backClicked.emit({ back: true });
        };
        ExecuteReportComponent.prototype.check = function (el, type) {
            if (type === 'Timestamp') {
                el = this.datePipe.transform(el, 'yyyy-MM-dd h:mm a');
            }
            return el;
        };
        return ExecuteReportComponent;
    }());
    ExecuteReportComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: ExecuteReportComponent, deps: [{ token: i1__namespace$1.ActivatedRoute }, { token: i0__namespace.ChangeDetectorRef }, { token: ReportsService }, { token: i2__namespace$1.DatePipe }], target: i0__namespace.ɵɵFactoryTarget.Component });
    ExecuteReportComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: ExecuteReportComponent, selector: "lib-execute-report", inputs: { urlRpt: "urlRpt" }, outputs: { backClicked: "backClicked" }, ngImport: i0__namespace, template: "<div class=\"mat-elevation-z8\">\n  <div class=\"backBtn\">\n    <h3><mat-icon (click)=\"onBackClicked()\" class=\"back-btn\">arrow_back</mat-icon> Report Results</h3>\n  </div>\n  <div class=\"btns\">\n    <button *ngIf=\"data?.details.length>0\" type=\"button\" mat-button value=\"PDF\" class=\"btn savePdf\" (click)=\"SavePDF()\">PDF</button>\n    &nbsp;\n    <button *ngIf=\"data?.details.length>0\" type=\"button\" mat-button value=\"XLS\" class=\"btn savePdf\" (click)=\"SaveEXCEL()\">Excel</button>\n  </div>\n\n  <table *ngIf=\"data?.details.length>0\" mat-table [dataSource]=\"list\">\n    <ng-container *ngFor=\"let el of data.headers\" matColumnDef=\"{{el.property}}\">\n      <th mat-header-cell *matHeaderCellDef> {{el.property}} </th>\n      <td mat-cell *matCellDef=\"let row\">\n        <span>{{row[el.property] ? check(row[el.property],el.type) : \"N/A\"}}</span>\n      </td>\n    </ng-container>\n\n    <tr mat-header-row *matHeaderRowDef=\"displayedColumns\"></tr>\n    <tr mat-row *matRowDef=\"let row; columns: displayedColumns;\"></tr>\n    <tr class=\"mat-row\" *matNoDataRow>\n      <td class=\"mat-cell\" colspan=\"4\">No data matching</td>\n    </tr>\n  </table>\n  <mat-paginator  *ngIf=\"data?.totalCount>0\" [length]=\"query.total\"\n                 (page)=\"getNextPage($event)\"\n                 [pageSizeOptions]=\"[10, 25, 100]\">\n  </mat-paginator>\n\n\n  <table style=\"display: none;width: 100%\" mat-table [dataSource]=\"hiddenListData\" id=\"excelDataTable\">\n    <ng-container *ngFor=\"let el of hiddenData?.headers\" matColumnDef=\"{{el.property}}\">\n      <th mat-header-cell *matHeaderCellDef> {{el.property}} </th>\n      <td  mat-cell *matCellDef=\"let row\">\n        <span>{{row[el.property] !== undefined ? check(row[el.property],el.type) : \"N/A\"}}</span>\n<!--        <span *ngIf=\"row[el.type]==='Timestamp'\">{{row[el.property] ? (row[el.property]|date:'short') : 'N/A'}}</span>;-->\n      </td>\n    </ng-container>\n\n    <tr mat-header-row *matHeaderRowDef=\"hiddenDisplayedColumns\"></tr>\n    <tr mat-row *matRowDef=\"let row; columns: hiddenDisplayedColumns;\"></tr>\n    <tr class=\"mat-row\" *matNoDataRow>\n      <td class=\"mat-cell\" colspan=\"4\">No data matching</td>\n    </tr>\n  </table>\n</div>\n\n\n<lib-no-data *ngIf=\"data?.details?.length===0\"></lib-no-data>\n", styles: ["table{width:100%}.savePdf{color:#fff;background-color:#f60;border-color:#f60}.mat-elevation-z8{box-shadow:none;background:#ffffff}.btns{text-align:right;margin-bottom:25px;margin-right:5px}.back-btn{vertical-align:sub;color:#f60;cursor:pointer}h3{font-size:18px;font-weight:600;color:#000}\n"], components: [{ type: i4__namespace$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: i5__namespace.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button],             button[mat-fab], button[mat-mini-fab], button[mat-stroked-button],             button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { type: i6__namespace$1.MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { type: i6__namespace$1.MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { type: i6__namespace$1.MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }, { type: i7__namespace$1.MatPaginator, selector: "mat-paginator", inputs: ["disabled"], exportAs: ["matPaginator"] }, { type: NoDataComponent, selector: "lib-no-data" }], directives: [{ type: i2__namespace$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2__namespace$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i6__namespace$1.MatColumnDef, selector: "[matColumnDef]", inputs: ["sticky", "matColumnDef"] }, { type: i6__namespace$1.MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { type: i6__namespace$1.MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { type: i6__namespace$1.MatCellDef, selector: "[matCellDef]" }, { type: i6__namespace$1.MatCell, selector: "mat-cell, td[mat-cell]" }, { type: i6__namespace$1.MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { type: i6__namespace$1.MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { type: i6__namespace$1.MatNoDataRow, selector: "ng-template[matNoDataRow]" }] });
    i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: ExecuteReportComponent, decorators: [{
                type: i0.Component,
                args: [{
                        selector: 'lib-execute-report',
                        templateUrl: './execute-report.component.html',
                        styleUrls: ['./execute-report.component.css']
                    }]
            }], ctorParameters: function () { return [{ type: i1__namespace$1.ActivatedRoute }, { type: i0__namespace.ChangeDetectorRef }, { type: ReportsService }, { type: i2__namespace$1.DatePipe }]; }, propDecorators: { urlRpt: [{
                    type: i0.Input
                }], backClicked: [{
                    type: i0.Output
                }] } });

    var ReportsModule = /** @class */ (function () {
        function ReportsModule() {
        }
        return ReportsModule;
    }());
    ReportsModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: ReportsModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
    ReportsModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: ReportsModule, declarations: [ReportsComponent,
            ReportDetailsComponent,
            ExecuteReportComponent,
            NoDataComponent], imports: [i2$1.CommonModule,
            i12.MatInputModule,
            i6.MatFormFieldModule,
            i2.MatTabsModule,
            i3.MatGridListModule,
            i4.MatCardModule,
            i5.MatButtonModule,
            i1.HttpClientModule,
            i1$1.RouterModule,
            i7.MatDatepickerModule,
            i11.FormsModule,
            i8.MatSelectModule,
            i9.MatOptionModule,
            i6$1.MatTableModule,
            i7$1.MatPaginatorModule,
            i4$1.MatIconModule], exports: [ReportsComponent,
            ReportDetailsComponent,
            ExecuteReportComponent,
            NoDataComponent] });
    ReportsModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: ReportsModule, providers: [i2$1.DatePipe], imports: [[
                i2$1.CommonModule,
                i12.MatInputModule,
                i6.MatFormFieldModule,
                i2.MatTabsModule,
                i3.MatGridListModule,
                i4.MatCardModule,
                i5.MatButtonModule,
                i1.HttpClientModule,
                i1$1.RouterModule,
                i7.MatDatepickerModule,
                i11.FormsModule,
                i8.MatSelectModule,
                i9.MatOptionModule,
                i6$1.MatTableModule,
                i7$1.MatPaginatorModule,
                i4$1.MatIconModule
            ]] });
    i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: ReportsModule, decorators: [{
                type: i0.NgModule,
                args: [{
                        declarations: [
                            ReportsComponent,
                            ReportDetailsComponent,
                            ExecuteReportComponent,
                            NoDataComponent
                        ],
                        imports: [
                            i2$1.CommonModule,
                            i12.MatInputModule,
                            i6.MatFormFieldModule,
                            i2.MatTabsModule,
                            i3.MatGridListModule,
                            i4.MatCardModule,
                            i5.MatButtonModule,
                            i1.HttpClientModule,
                            i1$1.RouterModule,
                            i7.MatDatepickerModule,
                            i11.FormsModule,
                            i8.MatSelectModule,
                            i9.MatOptionModule,
                            i6$1.MatTableModule,
                            i7$1.MatPaginatorModule,
                            i4$1.MatIconModule
                        ],
                        exports: [
                            ReportsComponent,
                            ReportDetailsComponent,
                            ExecuteReportComponent,
                            NoDataComponent
                        ],
                        providers: [i2$1.DatePipe]
                    }]
            }] });

    /*
     * Public API Surface of reports
     */

    /**
     * Generated bundle index. Do not edit.
     */

    exports.ExecuteReportComponent = ExecuteReportComponent;
    exports.NoDataComponent = NoDataComponent;
    exports.ReportDetailsComponent = ReportDetailsComponent;
    exports.ReportsComponent = ReportsComponent;
    exports.ReportsModule = ReportsModule;
    exports.ReportsService = ReportsService;
    exports.sharedGridLayout = sharedGridLayout;

    Object.defineProperty(exports, '__esModule', { value: true });

}));
//# sourceMappingURL=reports-hyper74.umd.js.map
