@churchillliving/se-ui-toolkit 6.53.468 → 6.53.470

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
2
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('primeng/api'), require('@angular/core'), require('primeng/dynamicdialog'), require('file-saver'), require('jspdf'), require('@angular/common'), require('ngx-toastr'), require('@angular/common/http'), require('rxjs'), require('@angular/platform-browser'), require('@angular/router'), require('primeng/table'), require('primeng/multiselect'), require('@angular/forms'), require('@angular/platform-browser/animations'), require('primeng/tabview'), require('primeng/dropdown'), require('primeng/calendar'), require('primeng/button'), require('primeng/ripple'), require('primeng/checkbox'), require('primeng/inputtext'), require('primeng/tristatecheckbox'), require('primeng/inputtextarea'), require('primeng/tooltip'), require('primeng/panelmenu'), require('ngx-cookie-service'), require('@angular/cdk/portal'), require('primeng/menu'), require('primeng/galleria'), require('primeng/autocomplete'), require('primeng/accordion'), require('primeng/confirmdialog'), require('primeng/messages'), require('primeng/progressspinner'), require('primeng/inputnumber'), require('primeng/avatar'), require('primeng/card'), require('@angular/cdk/drag-drop'), require('primeng/inputswitch')) :
3
3
  typeof define === 'function' && define.amd ? define('@churchillliving/se-ui-toolkit', ['exports', 'primeng/api', '@angular/core', 'primeng/dynamicdialog', 'file-saver', 'jspdf', '@angular/common', 'ngx-toastr', '@angular/common/http', 'rxjs', '@angular/platform-browser', '@angular/router', 'primeng/table', 'primeng/multiselect', '@angular/forms', '@angular/platform-browser/animations', 'primeng/tabview', 'primeng/dropdown', 'primeng/calendar', 'primeng/button', 'primeng/ripple', 'primeng/checkbox', 'primeng/inputtext', 'primeng/tristatecheckbox', 'primeng/inputtextarea', 'primeng/tooltip', 'primeng/panelmenu', 'ngx-cookie-service', '@angular/cdk/portal', 'primeng/menu', 'primeng/galleria', 'primeng/autocomplete', 'primeng/accordion', 'primeng/confirmdialog', 'primeng/messages', 'primeng/progressspinner', 'primeng/inputnumber', 'primeng/avatar', 'primeng/card', '@angular/cdk/drag-drop', 'primeng/inputswitch'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.churchillliving = global.churchillliving || {}, global.churchillliving["se-ui-toolkit"] = {}), global.api, global.ng.core, global.dynamicdialog, global.fileSaver, global.jsPDF, global.ng.common, global.ngxToastr, global.ng.common.http, global.rxjs, global.ng.platformBrowser, global.ng.router, global.table, global.multiselect, global.ng.forms, global.ng.platformBrowser.animations, global.tabview, global.dropdown, global.calendar, global.button, global.ripple, global.checkbox, global.inputtext, global.tristatecheckbox, global.inputtextarea, global.tooltip, global.panelmenu, global.ngxCookieService, global.ng.cdk.portal, global.menu, global.galleria, global.autocomplete, global.accordion, global.confirmdialog, global.messages, global.progressspinner, global.inputnumber, global.avatar, global.card, global.ng.cdk.dragDrop, global.inputswitch));
5
- })(this, (function (exports, api, i0, dynamicdialog, fileSaver, jsPDF, i1$1, ngxToastr, i1, rxjs, platformBrowser, router, table, multiselect, forms, animations, tabview, dropdown, calendar, button, ripple, checkbox, inputtext, tristatecheckbox, inputtextarea, tooltip, panelmenu, ngxCookieService, portal, menu, galleria, autocomplete, accordion, confirmdialog, messages, progressspinner, inputnumber, avatar, card, dragDrop, inputswitch) { 'use strict';
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.churchillliving = global.churchillliving || {}, global.churchillliving["se-ui-toolkit"] = {}), global.api, global.ng.core, global.i1, global.fileSaver, global.jsPDF, global.ng.common, global.ngxToastr, global.ng.common.http, global.rxjs, global.ng.platformBrowser, global.ng.router, global.table, global.multiselect, global.ng.forms, global.ng.platformBrowser.animations, global.tabview, global.dropdown, global.calendar, global.button, global.ripple, global.checkbox, global.inputtext, global.tristatecheckbox, global.inputtextarea, global.tooltip, global.panelmenu, global.ngxCookieService, global.ng.cdk.portal, global.menu, global.galleria, global.autocomplete, global.accordion, global.confirmdialog, global.messages, global.progressspinner, global.inputnumber, global.avatar, global.card, global.ng.cdk.dragDrop, global.inputswitch));
5
+ })(this, (function (exports, api, i0, i1, fileSaver, jsPDF, i1$2, ngxToastr, i1$1, rxjs, platformBrowser, router, table, multiselect, forms, animations, tabview, dropdown, calendar, button, ripple, checkbox, inputtext, tristatecheckbox, inputtextarea, tooltip, panelmenu, ngxCookieService, portal, menu, galleria, autocomplete, accordion, confirmdialog, messages, progressspinner, inputnumber, avatar, card, dragDrop, inputswitch) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
@@ -25,9 +25,10 @@
25
25
  }
26
26
 
27
27
  var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
28
+ var i1__namespace$2 = /*#__PURE__*/_interopNamespace(i1);
28
29
  var jsPDF__default = /*#__PURE__*/_interopDefaultLegacy(jsPDF);
29
- var i1__namespace$1 = /*#__PURE__*/_interopNamespace(i1$1);
30
- var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
30
+ var i1__namespace$1 = /*#__PURE__*/_interopNamespace(i1$2);
31
+ var i1__namespace = /*#__PURE__*/_interopNamespace(i1$1);
31
32
 
32
33
  /******************************************************************************
33
34
  Copyright (c) Microsoft Corporation.
@@ -596,8 +597,8 @@
596
597
  ];
597
598
  /** @nocollapse */
598
599
  AlertPopUpComponent.ctorParameters = function () { return [
599
- { type: dynamicdialog.DynamicDialogConfig, decorators: [{ type: i0.Optional }] },
600
- { type: dynamicdialog.DynamicDialogRef, decorators: [{ type: i0.Optional }] }
600
+ { type: i1.DynamicDialogConfig, decorators: [{ type: i0.Optional }] },
601
+ { type: i1.DynamicDialogRef, decorators: [{ type: i0.Optional }] }
601
602
  ]; };
602
603
 
603
604
  var AlertService = /** @class */ (function () {
@@ -681,7 +682,7 @@
681
682
  /** @nocollapse */
682
683
  AlertService.ctorParameters = function () { return [
683
684
  { type: ngxToastr.ToastrService },
684
- { type: dynamicdialog.DialogService },
685
+ { type: i1.DialogService },
685
686
  { type: api.ConfirmationService }
686
687
  ]; };
687
688
 
@@ -729,7 +730,7 @@
729
730
  ];
730
731
  /** @nocollapse */
731
732
  RequestService.ctorParameters = function () { return [
732
- { type: i1.HttpClient },
733
+ { type: i1$1.HttpClient },
733
734
  { type: undefined, decorators: [{ type: i0.Inject, args: ['env',] }] }
734
735
  ]; };
735
736
 
@@ -1147,7 +1148,7 @@
1147
1148
  return value;
1148
1149
  }
1149
1150
  else {
1150
- return i1$1.formatDate(value, 'MM/dd/yyyy', 'en-US');
1151
+ return i1$2.formatDate(value, 'MM/dd/yyyy', 'en-US');
1151
1152
  }
1152
1153
  }
1153
1154
  else {
@@ -1162,7 +1163,7 @@
1162
1163
  return value;
1163
1164
  }
1164
1165
  else {
1165
- return i1$1.formatDate(value, 'MM/dd/yyyy hh:mm a', 'en-US');
1166
+ return i1$2.formatDate(value, 'MM/dd/yyyy hh:mm a', 'en-US');
1166
1167
  }
1167
1168
  }
1168
1169
  else {
@@ -3595,7 +3596,7 @@
3595
3596
  ];
3596
3597
  /** @nocollapse */
3597
3598
  GridService.ctorParameters = function () { return [
3598
- { type: i1$1.DatePipe },
3599
+ { type: i1$2.DatePipe },
3599
3600
  { type: HyperlinkService },
3600
3601
  { type: DropdownService },
3601
3602
  { type: AlertService },
@@ -3700,8 +3701,8 @@
3700
3701
  /** @nocollapse */
3701
3702
  IframeComponent.ctorParameters = function () { return [
3702
3703
  { type: platformBrowser.DomSanitizer },
3703
- { type: dynamicdialog.DynamicDialogRef, decorators: [{ type: i0.Optional }] },
3704
- { type: dynamicdialog.DynamicDialogConfig, decorators: [{ type: i0.Optional }] }
3704
+ { type: i1.DynamicDialogRef, decorators: [{ type: i0.Optional }] },
3705
+ { type: i1.DynamicDialogConfig, decorators: [{ type: i0.Optional }] }
3705
3706
  ]; };
3706
3707
 
3707
3708
  var PageLoggerService = /** @class */ (function () {
@@ -6331,19 +6332,19 @@
6331
6332
  ];
6332
6333
  /** @nocollapse */
6333
6334
  GridComponent.ctorParameters = function () { return [
6334
- { type: dynamicdialog.DialogService },
6335
+ { type: i1.DialogService },
6335
6336
  { type: GridService },
6336
6337
  { type: AlertService },
6337
6338
  { type: AuthenticationService },
6338
6339
  { type: i0.ElementRef },
6339
- { type: i1$1.DecimalPipe },
6340
+ { type: i1$2.DecimalPipe },
6340
6341
  { type: PageLoggerService },
6341
6342
  { type: i0.ChangeDetectorRef },
6342
6343
  { type: router.Router },
6343
- { type: i1$1.DatePipe },
6344
+ { type: i1$2.DatePipe },
6344
6345
  { type: api.ConfirmationService },
6345
- { type: dynamicdialog.DynamicDialogConfig, decorators: [{ type: i0.Optional }] },
6346
- { type: dynamicdialog.DynamicDialogRef, decorators: [{ type: i0.Optional }] }
6346
+ { type: i1.DynamicDialogConfig, decorators: [{ type: i0.Optional }] },
6347
+ { type: i1.DynamicDialogRef, decorators: [{ type: i0.Optional }] }
6347
6348
  ]; };
6348
6349
  GridComponent.propDecorators = {
6349
6350
  gridRow: [{ type: i0.ViewChildren, args: ['gridRow',] }],
@@ -6926,8 +6927,8 @@
6926
6927
  ];
6927
6928
  /** @nocollapse */
6928
6929
  NotesComponent.ctorParameters = function () { return [
6929
- { type: dynamicdialog.DynamicDialogRef },
6930
- { type: dynamicdialog.DynamicDialogConfig }
6930
+ { type: i1.DynamicDialogRef },
6931
+ { type: i1.DynamicDialogConfig }
6931
6932
  ]; };
6932
6933
 
6933
6934
  var FormComponent = /** @class */ (function () {
@@ -8073,12 +8074,12 @@
8073
8074
  { type: FormService },
8074
8075
  { type: AlertService },
8075
8076
  { type: platformBrowser.DomSanitizer },
8076
- { type: dynamicdialog.DialogService },
8077
+ { type: i1.DialogService },
8077
8078
  { type: i0.ComponentFactoryResolver },
8078
8079
  { type: i0.ChangeDetectorRef },
8079
8080
  { type: router.Router },
8080
8081
  { type: i0.ElementRef },
8081
- { type: i1$1.DatePipe },
8082
+ { type: i1$2.DatePipe },
8082
8083
  { type: GridService },
8083
8084
  { type: PageLoggerService }
8084
8085
  ]; };
@@ -8373,6 +8374,7 @@
8373
8374
  ESidebarAction["NAVIGATION"] = "navigation";
8374
8375
  ESidebarAction["OPENDIALOG"] = "dialog";
8375
8376
  ESidebarAction["IFRAME"] = "_iframe";
8377
+ ESidebarAction["REPORT"] = "report";
8376
8378
  })(exports.ESidebarAction || (exports.ESidebarAction = {}));
8377
8379
 
8378
8380
  var SideBarService = /** @class */ (function () {
@@ -8464,11 +8466,309 @@
8464
8466
  { type: i0.ApplicationRef }
8465
8467
  ]; };
8466
8468
 
8469
+ var ReportFilterComponent = /** @class */ (function () {
8470
+ function ReportFilterComponent(config, requestService, formService, alertService) {
8471
+ this.config = config;
8472
+ this.requestService = requestService;
8473
+ this.formService = formService;
8474
+ this.alertService = alertService;
8475
+ this.formFields = [];
8476
+ }
8477
+ ReportFilterComponent.prototype.ngOnInit = function () {
8478
+ this.createDynamicFields();
8479
+ };
8480
+ ReportFilterComponent.prototype.initializeForm = function () {
8481
+ var _this = this;
8482
+ var _a, _b;
8483
+ this.dynamicForm = {
8484
+ formSections: [
8485
+ {
8486
+ fields: __spreadArray(__spreadArray([], __read(this.formFields)), [
8487
+ {
8488
+ label: 'Download Report',
8489
+ control: exports.EFormControl.ADD_BUTTON,
8490
+ hidden: (_b = (_a = this.config) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.hideGenerateReportBtn,
8491
+ onClick: function () {
8492
+ _this.downloadReport();
8493
+ },
8494
+ }
8495
+ ])
8496
+ }
8497
+ ]
8498
+ };
8499
+ };
8500
+ ReportFilterComponent.prototype.createDynamicFields = function () {
8501
+ var _this = this;
8502
+ var _a;
8503
+ this.requestService.getOne('/ReportConfig/ById', (_a = this.config.data) === null || _a === void 0 ? void 0 : _a.Id).subscribe(function (data) {
8504
+ var reportJson = JSON.parse(data === null || data === void 0 ? void 0 : data.report);
8505
+ _this.formFields = reportJson === null || reportJson === void 0 ? void 0 : reportJson.FormFields;
8506
+ _this.setParamFieldValue();
8507
+ _this.initializeForm();
8508
+ // set dropdown data based on matched field.
8509
+ _this.setDropDownData(reportJson);
8510
+ }, function (error) {
8511
+ _this.initializeForm();
8512
+ _this.alertService.error(error);
8513
+ });
8514
+ };
8515
+ ReportFilterComponent.prototype.setParamFieldValue = function () {
8516
+ var _this = this;
8517
+ var _a;
8518
+ if (this.config.data && ((_a = this.config.data.param) === null || _a === void 0 ? void 0 : _a.length) > 0) {
8519
+ this.config.data.param.forEach(function (param) {
8520
+ _this.formFields.forEach(function (field) {
8521
+ var _a;
8522
+ var matchKey = (_a = Object.keys(param)) === null || _a === void 0 ? void 0 : _a.find(function (key) { var _a; return (key === null || key === void 0 ? void 0 : key.toLowerCase()) === ((_a = field.field) === null || _a === void 0 ? void 0 : _a.toLowerCase()); });
8523
+ if (matchKey && matchKey.length > 0) {
8524
+ field.value = param[matchKey];
8525
+ }
8526
+ });
8527
+ });
8528
+ }
8529
+ };
8530
+ ReportFilterComponent.prototype.setDropDownData = function (reportJson) {
8531
+ var _this = this;
8532
+ var _a;
8533
+ (_a = reportJson.Parameters) === null || _a === void 0 ? void 0 : _a.forEach(function (record) {
8534
+ if (record.isuniquekey) {
8535
+ _this.requestService.get('/Data/Fetch', {
8536
+ uniqueKey: record.isuniquekey,
8537
+ filters: []
8538
+ }).subscribe(function (response) {
8539
+ _this.formService.setFormFieldProp(_this.dynamicForm, record.paramname, [
8540
+ { name: 'data', value: response.records },
8541
+ ]);
8542
+ }, function (error) {
8543
+ _this.alertService.apiError(error);
8544
+ });
8545
+ }
8546
+ });
8547
+ };
8548
+ ReportFilterComponent.prototype.getFilters = function () {
8549
+ var _a, _b;
8550
+ var filters = [];
8551
+ (_b = (_a = this.dynamicForm) === null || _a === void 0 ? void 0 : _a.formSections) === null || _b === void 0 ? void 0 : _b.forEach(function (section) {
8552
+ var _a;
8553
+ (_a = section.fields) === null || _a === void 0 ? void 0 : _a.forEach(function (field) {
8554
+ if (field && field.value) {
8555
+ filters.push({ field: field.field, matchMode: 'equal', operator: 'and', value: field.value });
8556
+ }
8557
+ ;
8558
+ });
8559
+ });
8560
+ return filters;
8561
+ };
8562
+ ReportFilterComponent.prototype.downloadReport = function () {
8563
+ var _this = this;
8564
+ var _a, _b;
8565
+ var filters = this.getFilters();
8566
+ this.requestService.download('/Report/Generate', { Id: (_b = (_a = this.config) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.Id, filters: filters })
8567
+ .subscribe(function (response) {
8568
+ var _a, _b, _c, _d;
8569
+ var newBlob = new Blob([response.body], { type: 'application/pdf' });
8570
+ var data = window.URL.createObjectURL(newBlob);
8571
+ var a = document.createElement('a');
8572
+ a.href = data;
8573
+ var header = (_a = response === null || response === void 0 ? void 0 : response.headers) === null || _a === void 0 ? void 0 : _a.get('Content-Disposition');
8574
+ var fileName = (_d = (_c = (_b = header === null || header === void 0 ? void 0 : header.split('filename=')) === null || _b === void 0 ? void 0 : _b[1]) === null || _c === void 0 ? void 0 : _c.split(";")[0]) === null || _d === void 0 ? void 0 : _d.replaceAll(/\"/g, '');
8575
+ a.download = fileName;
8576
+ document.body.appendChild(a);
8577
+ a.click();
8578
+ document.body.removeChild(a);
8579
+ }, function (error) {
8580
+ _this.alertService.apiError(error);
8581
+ });
8582
+ };
8583
+ return ReportFilterComponent;
8584
+ }());
8585
+ ReportFilterComponent.decorators = [
8586
+ { type: i0.Component, args: [{
8587
+ selector: 'se-report-filter',
8588
+ template: "<se-form \n*ngIf=\"dynamicForm\"\n[form]=\"dynamicForm\"\n[hideSaveButton]=\"true\"\n[hideCancelButton]=\"true\"\n>\n</se-form>\n",
8589
+ styles: [""]
8590
+ },] }
8591
+ ];
8592
+ /** @nocollapse */
8593
+ ReportFilterComponent.ctorParameters = function () { return [
8594
+ { type: i1.DynamicDialogConfig, decorators: [{ type: i0.Optional }] },
8595
+ { type: RequestService },
8596
+ { type: FormService },
8597
+ { type: AlertService }
8598
+ ]; };
8599
+
8600
+ var ReportService = /** @class */ (function () {
8601
+ function ReportService(dialogService, requestService, alertService) {
8602
+ this.dialogService = dialogService;
8603
+ this.requestService = requestService;
8604
+ this.alertService = alertService;
8605
+ this.formFields = [];
8606
+ this.paramsCopy = [];
8607
+ }
8608
+ ReportService.prototype.downloadReport = function (repId, params, showDialog, form) {
8609
+ var _this = this;
8610
+ if (showDialog === void 0) { showDialog = false; }
8611
+ if (form === void 0) { form = {}; }
8612
+ params === null || params === void 0 ? void 0 : params.forEach(function (p) {
8613
+ _this.paramsCopy.push(Object.assign({}, p));
8614
+ });
8615
+ this.createDynamicFields(repId, params, showDialog, form);
8616
+ };
8617
+ ReportService.prototype.createDynamicFields = function (repId, params, showDialog, form) {
8618
+ var _this = this;
8619
+ this.requestService
8620
+ .getOne('/ReportConfig/ById', repId)
8621
+ .subscribe(function (data) {
8622
+ if (data) {
8623
+ var reportJson = JSON.parse(data === null || data === void 0 ? void 0 : data.report);
8624
+ _this.formFields = reportJson === null || reportJson === void 0 ? void 0 : reportJson.FormFields;
8625
+ }
8626
+ _this.generateReport(repId, params, showDialog, form);
8627
+ }, function (error) {
8628
+ _this.alertService.error(error);
8629
+ });
8630
+ };
8631
+ ReportService.prototype.generateReport = function (repId, params, showDialog, form) {
8632
+ if (showDialog === void 0) { showDialog = false; }
8633
+ if (form === void 0) { form = {}; }
8634
+ this.getFormFieldValues(form, params);
8635
+ if ((this.formFields.some(function (field) { return !field.hidden; }) &&
8636
+ showDialog === undefined) ||
8637
+ showDialog === true) {
8638
+ this.dialogService.open(ReportFilterComponent, {
8639
+ width: '80%',
8640
+ height: '100%',
8641
+ header: 'Generate Report',
8642
+ style: { background: '#fff' },
8643
+ data: { Id: repId, param: params },
8644
+ });
8645
+ }
8646
+ else {
8647
+ this.downloadQuickReport(params, repId);
8648
+ }
8649
+ };
8650
+ ReportService.prototype.getFormFieldValues = function (form, params) {
8651
+ var _a;
8652
+ if (((_a = this.paramsCopy) === null || _a === void 0 ? void 0 : _a.length) > 0) {
8653
+ this.paramsCopy.forEach(function (paramCopy) {
8654
+ var _a, _b;
8655
+ var key = Object.keys(paramCopy)[0];
8656
+ if (paramCopy[key] === '' || !paramCopy[key]) {
8657
+ (_a = form === null || form === void 0 ? void 0 : form.formSections) === null || _a === void 0 ? void 0 : _a.forEach(function (section) {
8658
+ section.fields.forEach(function (field) {
8659
+ var _a;
8660
+ if (key.toString().toLowerCase() === ((_a = field.field) === null || _a === void 0 ? void 0 : _a.toLowerCase())) {
8661
+ params.forEach(function (origParam) {
8662
+ var origKey = Object.keys(origParam)[0];
8663
+ if (origKey == key) {
8664
+ //origParam[origKey] = field.value;
8665
+ if (field.control == exports.EFormControl.CALENDAR) {
8666
+ origParam[origKey] = field.value ? field.value.toLocaleDateString() : null;
8667
+ }
8668
+ else {
8669
+ origParam[origKey] = field.value;
8670
+ }
8671
+ }
8672
+ });
8673
+ }
8674
+ });
8675
+ });
8676
+ }
8677
+ else if (paramCopy[key].toString().includes('{') &&
8678
+ paramCopy[key].toString().includes('}')) {
8679
+ var newValue = paramCopy[key].replace('{', '').replace('}', '');
8680
+ (_b = form === null || form === void 0 ? void 0 : form.formSections) === null || _b === void 0 ? void 0 : _b.forEach(function (section) {
8681
+ section.fields.forEach(function (field) {
8682
+ var _a;
8683
+ if (newValue.toString().toLowerCase() === ((_a = field.field) === null || _a === void 0 ? void 0 : _a.toLowerCase())) {
8684
+ params.forEach(function (origParam) {
8685
+ var origKey = Object.keys(origParam)[0];
8686
+ if (origKey == key) {
8687
+ if (field.control == exports.EFormControl.CALENDAR) {
8688
+ origParam[origKey] = field.value ? field.value.toLocaleDateString() : null;
8689
+ }
8690
+ else {
8691
+ origParam[origKey] = field.value;
8692
+ }
8693
+ }
8694
+ });
8695
+ }
8696
+ });
8697
+ });
8698
+ }
8699
+ });
8700
+ }
8701
+ };
8702
+ ReportService.prototype.downloadQuickReport = function (params, repId) {
8703
+ var _this = this;
8704
+ var filters = [];
8705
+ if (params && params.length > 0) {
8706
+ params.forEach(function (param) {
8707
+ Object.keys(param).map(function (key) { return filters.push({
8708
+ field: key,
8709
+ matchMode: 'equal',
8710
+ operator: 'and',
8711
+ value: param[key],
8712
+ }); });
8713
+ });
8714
+ }
8715
+ else {
8716
+ filters = this.getFilters();
8717
+ }
8718
+ this.requestService
8719
+ .download('/Report/Generate', { Id: repId, filters: filters })
8720
+ .subscribe(function (response) {
8721
+ var _a, _b, _c, _d;
8722
+ var newBlob = new Blob([response.body], { type: 'application/pdf' });
8723
+ var data = window.URL.createObjectURL(newBlob);
8724
+ var a = document.createElement('a');
8725
+ a.href = data;
8726
+ var header = (_a = response === null || response === void 0 ? void 0 : response.headers) === null || _a === void 0 ? void 0 : _a.get('Content-Disposition');
8727
+ var fileName = (_d = (_c = (_b = header === null || header === void 0 ? void 0 : header.split('filename=')) === null || _b === void 0 ? void 0 : _b[1]) === null || _c === void 0 ? void 0 : _c.split(';')[0]) === null || _d === void 0 ? void 0 : _d.replaceAll(/\"/g, '');
8728
+ a.download = fileName;
8729
+ document.body.appendChild(a);
8730
+ a.click();
8731
+ document.body.removeChild(a);
8732
+ }, function (error) {
8733
+ _this.alertService.apiError(error);
8734
+ });
8735
+ };
8736
+ ReportService.prototype.getFilters = function () {
8737
+ var filters = [];
8738
+ this.formFields.forEach(function (field) {
8739
+ var _a, _b;
8740
+ if (field && ((_b = (_a = field.value) === null || _a === void 0 ? void 0 : _a.toString()) === null || _b === void 0 ? void 0 : _b.length) > 0) {
8741
+ filters.push({
8742
+ field: field.field,
8743
+ matchMode: 'equal',
8744
+ operator: 'and',
8745
+ value: field.value,
8746
+ });
8747
+ }
8748
+ });
8749
+ return filters;
8750
+ };
8751
+ return ReportService;
8752
+ }());
8753
+ /** @nocollapse */ ReportService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function ReportService_Factory() { return new ReportService(i0__namespace.ɵɵinject(i1__namespace$2.DialogService), i0__namespace.ɵɵinject(RequestService), i0__namespace.ɵɵinject(AlertService)); }, token: ReportService, providedIn: "root" });
8754
+ ReportService.decorators = [
8755
+ { type: i0.Injectable, args: [{
8756
+ providedIn: 'root'
8757
+ },] }
8758
+ ];
8759
+ /** @nocollapse */
8760
+ ReportService.ctorParameters = function () { return [
8761
+ { type: i1.DialogService },
8762
+ { type: RequestService },
8763
+ { type: AlertService }
8764
+ ]; };
8765
+
8467
8766
  var SidebarComponent = /** @class */ (function () {
8468
- function SidebarComponent(instance, authService, dialogService, router, pageLoggerService, hyperlinkService, sidebarService) {
8767
+ function SidebarComponent(instance, authService, dialogService, reportService, router, pageLoggerService, hyperlinkService, sidebarService) {
8469
8768
  this.instance = instance;
8470
8769
  this.authService = authService;
8471
8770
  this.dialogService = dialogService;
8771
+ this.reportService = reportService;
8472
8772
  this.router = router;
8473
8773
  this.pageLoggerService = pageLoggerService;
8474
8774
  this.hyperlinkService = hyperlinkService;
@@ -8544,6 +8844,9 @@
8544
8844
  else if (x.action && x.action === exports.ESidebarAction.IFRAME) {
8545
8845
  _this.loadIFrame(x, item);
8546
8846
  }
8847
+ else if (x.action && x.action === exports.ESidebarAction.REPORT) {
8848
+ _this.downloadReport(x);
8849
+ }
8547
8850
  else {
8548
8851
  _this.handleActiveItem(item);
8549
8852
  }
@@ -8620,6 +8923,10 @@
8620
8923
  disabled: menu.disabled,
8621
8924
  }); });
8622
8925
  };
8926
+ SidebarComponent.prototype.downloadReport = function (menu) {
8927
+ console.log('menu: ', menu);
8928
+ this.reportService.downloadReport(menu.reportId, menu.params, menu.showDialog);
8929
+ };
8623
8930
  SidebarComponent.prototype.loadIFrame = function (menu, item) {
8624
8931
  var _this = this;
8625
8932
  var _a, _b, _c, _d;
@@ -8791,7 +9098,8 @@
8791
9098
  SidebarComponent.ctorParameters = function () { return [
8792
9099
  { type: i0.Renderer2 },
8793
9100
  { type: AuthenticationService },
8794
- { type: dynamicdialog.DialogService },
9101
+ { type: i1.DialogService },
9102
+ { type: ReportService },
8795
9103
  { type: router.Router },
8796
9104
  { type: PageLoggerService },
8797
9105
  { type: HyperlinkService },
@@ -8895,7 +9203,7 @@
8895
9203
  /** @nocollapse */
8896
9204
  HeaderComponent.ctorParameters = function () { return [
8897
9205
  { type: AuthenticationService },
8898
- { type: i1$1.DatePipe }
9206
+ { type: i1$2.DatePipe }
8899
9207
  ]; };
8900
9208
  HeaderComponent.propDecorators = {
8901
9209
  headers: [{ type: i0.Input }]
@@ -9115,8 +9423,8 @@
9115
9423
  { type: FormService },
9116
9424
  { type: RequestService },
9117
9425
  { type: AlertService },
9118
- { type: dynamicdialog.DynamicDialogConfig, decorators: [{ type: i0.Optional }] },
9119
- { type: dynamicdialog.DynamicDialogRef, decorators: [{ type: i0.Optional }] }
9426
+ { type: i1.DynamicDialogConfig, decorators: [{ type: i0.Optional }] },
9427
+ { type: i1.DynamicDialogRef, decorators: [{ type: i0.Optional }] }
9120
9428
  ]; };
9121
9429
 
9122
9430
  var CardComponent = /** @class */ (function () {
@@ -9261,7 +9569,7 @@
9261
9569
  ];
9262
9570
  /** @nocollapse */
9263
9571
  CardComponent.ctorParameters = function () { return [
9264
- { type: dynamicdialog.DialogService },
9572
+ { type: i1.DialogService },
9265
9573
  { type: GridService },
9266
9574
  { type: api.ConfirmationService }
9267
9575
  ]; };
@@ -9386,299 +9694,27 @@
9386
9694
  allowDeleteFile: [{ type: i0.Input }]
9387
9695
  };
9388
9696
 
9389
- var ReportFilterComponent = /** @class */ (function () {
9390
- function ReportFilterComponent(config, requestService, formService, alertService) {
9391
- this.config = config;
9392
- this.requestService = requestService;
9393
- this.formService = formService;
9394
- this.alertService = alertService;
9395
- this.formFields = [];
9396
- }
9397
- ReportFilterComponent.prototype.ngOnInit = function () {
9398
- this.createDynamicFields();
9399
- };
9400
- ReportFilterComponent.prototype.initializeForm = function () {
9401
- var _this = this;
9402
- var _a, _b;
9403
- this.dynamicForm = {
9404
- formSections: [
9405
- {
9406
- fields: __spreadArray(__spreadArray([], __read(this.formFields)), [
9407
- {
9408
- label: 'Download Report',
9409
- control: exports.EFormControl.ADD_BUTTON,
9410
- hidden: (_b = (_a = this.config) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.hideGenerateReportBtn,
9411
- onClick: function () {
9412
- _this.downloadReport();
9413
- },
9414
- }
9415
- ])
9416
- }
9417
- ]
9418
- };
9419
- };
9420
- ReportFilterComponent.prototype.createDynamicFields = function () {
9421
- var _this = this;
9422
- var _a;
9423
- this.requestService.getOne('/ReportConfig/ById', (_a = this.config.data) === null || _a === void 0 ? void 0 : _a.Id).subscribe(function (data) {
9424
- var reportJson = JSON.parse(data === null || data === void 0 ? void 0 : data.report);
9425
- _this.formFields = reportJson === null || reportJson === void 0 ? void 0 : reportJson.FormFields;
9426
- _this.setParamFieldValue();
9427
- _this.initializeForm();
9428
- // set dropdown data based on matched field.
9429
- _this.setDropDownData(reportJson);
9430
- }, function (error) {
9431
- _this.initializeForm();
9432
- _this.alertService.error(error);
9433
- });
9434
- };
9435
- ReportFilterComponent.prototype.setParamFieldValue = function () {
9436
- var _this = this;
9437
- var _a;
9438
- if (this.config.data && ((_a = this.config.data.param) === null || _a === void 0 ? void 0 : _a.length) > 0) {
9439
- this.config.data.param.forEach(function (param) {
9440
- _this.formFields.forEach(function (field) {
9441
- var _a;
9442
- var matchKey = (_a = Object.keys(param)) === null || _a === void 0 ? void 0 : _a.find(function (key) { var _a; return (key === null || key === void 0 ? void 0 : key.toLowerCase()) === ((_a = field.field) === null || _a === void 0 ? void 0 : _a.toLowerCase()); });
9443
- if (matchKey && matchKey.length > 0) {
9444
- field.value = param[matchKey];
9445
- }
9446
- });
9447
- });
9448
- }
9449
- };
9450
- ReportFilterComponent.prototype.setDropDownData = function (reportJson) {
9451
- var _this = this;
9452
- var _a;
9453
- (_a = reportJson.Parameters) === null || _a === void 0 ? void 0 : _a.forEach(function (record) {
9454
- if (record.isuniquekey) {
9455
- _this.requestService.get('/Data/Fetch', {
9456
- uniqueKey: record.isuniquekey,
9457
- filters: []
9458
- }).subscribe(function (response) {
9459
- _this.formService.setFormFieldProp(_this.dynamicForm, record.paramname, [
9460
- { name: 'data', value: response.records },
9461
- ]);
9462
- }, function (error) {
9463
- _this.alertService.apiError(error);
9464
- });
9465
- }
9466
- });
9467
- };
9468
- ReportFilterComponent.prototype.getFilters = function () {
9469
- var _a, _b;
9470
- var filters = [];
9471
- (_b = (_a = this.dynamicForm) === null || _a === void 0 ? void 0 : _a.formSections) === null || _b === void 0 ? void 0 : _b.forEach(function (section) {
9472
- var _a;
9473
- (_a = section.fields) === null || _a === void 0 ? void 0 : _a.forEach(function (field) {
9474
- if (field && field.value) {
9475
- filters.push({ field: field.field, matchMode: 'equal', operator: 'and', value: field.value });
9476
- }
9477
- ;
9478
- });
9479
- });
9480
- return filters;
9481
- };
9482
- ReportFilterComponent.prototype.downloadReport = function () {
9483
- var _this = this;
9484
- var _a, _b;
9485
- var filters = this.getFilters();
9486
- this.requestService.download('/Report/Generate', { Id: (_b = (_a = this.config) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.Id, filters: filters })
9487
- .subscribe(function (response) {
9488
- var _a, _b, _c, _d;
9489
- var newBlob = new Blob([response.body], { type: 'application/pdf' });
9490
- var data = window.URL.createObjectURL(newBlob);
9491
- var a = document.createElement('a');
9492
- a.href = data;
9493
- var header = (_a = response === null || response === void 0 ? void 0 : response.headers) === null || _a === void 0 ? void 0 : _a.get('Content-Disposition');
9494
- var fileName = (_d = (_c = (_b = header === null || header === void 0 ? void 0 : header.split('filename=')) === null || _b === void 0 ? void 0 : _b[1]) === null || _c === void 0 ? void 0 : _c.split(";")[0]) === null || _d === void 0 ? void 0 : _d.replaceAll(/\"/g, '');
9495
- a.download = fileName;
9496
- document.body.appendChild(a);
9497
- a.click();
9498
- document.body.removeChild(a);
9499
- }, function (error) {
9500
- _this.alertService.apiError(error);
9501
- });
9502
- };
9503
- return ReportFilterComponent;
9504
- }());
9505
- ReportFilterComponent.decorators = [
9506
- { type: i0.Component, args: [{
9507
- selector: 'se-report-filter',
9508
- template: "<se-form \n*ngIf=\"dynamicForm\"\n[form]=\"dynamicForm\"\n[hideSaveButton]=\"true\"\n[hideCancelButton]=\"true\"\n>\n</se-form>\n",
9509
- styles: [""]
9510
- },] }
9511
- ];
9512
- /** @nocollapse */
9513
- ReportFilterComponent.ctorParameters = function () { return [
9514
- { type: dynamicdialog.DynamicDialogConfig, decorators: [{ type: i0.Optional }] },
9515
- { type: RequestService },
9516
- { type: FormService },
9517
- { type: AlertService }
9518
- ]; };
9519
-
9520
- //import { EFormControl, IDynamicForm } from '@churchillliving/se-ui-toolkit';
9521
9697
  var GenerateReportBtnComponent = /** @class */ (function () {
9522
- function GenerateReportBtnComponent(dialogService, requestService, alertService) {
9523
- this.dialogService = dialogService;
9524
- this.requestService = requestService;
9525
- this.alertService = alertService;
9526
- this.formFields = [];
9527
- this.paramsCopy = [];
9698
+ function GenerateReportBtnComponent(reportService) {
9699
+ this.reportService = reportService;
9528
9700
  }
9529
9701
  GenerateReportBtnComponent.prototype.ngOnInit = function () {
9530
- var _this = this;
9531
- this.params.forEach(function (p) {
9532
- _this.paramsCopy.push(Object.assign({}, p));
9533
- });
9534
- this.createDynamicFields();
9535
9702
  };
9536
9703
  GenerateReportBtnComponent.prototype.reportClickEvent = function () {
9537
- this.getFormFieldValues();
9538
- if ((this.formFields.some(function (field) { return !field.hidden; }) &&
9539
- this.showDialog === undefined) ||
9540
- this.showDialog === true) {
9541
- this.dialogService.open(ReportFilterComponent, {
9542
- width: '80%',
9543
- height: '100%',
9544
- header: 'Generate Report',
9545
- data: { Id: this.repId, param: this.params },
9546
- });
9547
- }
9548
- else {
9549
- this.downloadQuickReport();
9550
- }
9551
- };
9552
- GenerateReportBtnComponent.prototype.createDynamicFields = function () {
9553
- var _this = this;
9554
- this.requestService
9555
- .getOne('/ReportConfig/ById', this.repId)
9556
- .subscribe(function (data) {
9557
- if (data) {
9558
- var reportJson = JSON.parse(data === null || data === void 0 ? void 0 : data.report);
9559
- _this.formFields = reportJson === null || reportJson === void 0 ? void 0 : reportJson.FormFields;
9560
- }
9561
- }, function (error) {
9562
- _this.alertService.error(error);
9563
- });
9564
- };
9565
- GenerateReportBtnComponent.prototype.getFilters = function () {
9566
- var filters = [];
9567
- this.formFields.forEach(function (field) {
9568
- var _a, _b;
9569
- if (field && ((_b = (_a = field.value) === null || _a === void 0 ? void 0 : _a.toString()) === null || _b === void 0 ? void 0 : _b.length) > 0) {
9570
- filters.push({
9571
- field: field.field,
9572
- matchMode: 'equal',
9573
- operator: 'and',
9574
- value: field.value,
9575
- });
9576
- }
9577
- });
9578
- return filters;
9579
- };
9580
- GenerateReportBtnComponent.prototype.getFormFieldValues = function () {
9581
- var _this = this;
9582
- var _a;
9583
- if (((_a = this.paramsCopy) === null || _a === void 0 ? void 0 : _a.length) > 0) {
9584
- this.paramsCopy.forEach(function (paramCopy) {
9585
- var _a, _b, _c, _d;
9586
- var key = Object.keys(paramCopy)[0];
9587
- if (paramCopy[key] === '' || !paramCopy[key]) {
9588
- (_b = (_a = _this.form) === null || _a === void 0 ? void 0 : _a.formSections) === null || _b === void 0 ? void 0 : _b.forEach(function (section) {
9589
- section.fields.forEach(function (field) {
9590
- var _a;
9591
- if (key.toString().toLowerCase() === ((_a = field.field) === null || _a === void 0 ? void 0 : _a.toLowerCase())) {
9592
- _this.params.forEach(function (origParam) {
9593
- var origKey = Object.keys(origParam)[0];
9594
- if (origKey == key) {
9595
- //origParam[origKey] = field.value;
9596
- if (field.control == exports.EFormControl.CALENDAR) {
9597
- origParam[origKey] = field.value ? field.value.toLocaleDateString() : null;
9598
- }
9599
- else {
9600
- origParam[origKey] = field.value;
9601
- }
9602
- }
9603
- });
9604
- }
9605
- });
9606
- });
9607
- }
9608
- else if (paramCopy[key].toString().includes('{') &&
9609
- paramCopy[key].toString().includes('}')) {
9610
- var newValue = paramCopy[key].replace('{', '').replace('}', '');
9611
- (_d = (_c = _this.form) === null || _c === void 0 ? void 0 : _c.formSections) === null || _d === void 0 ? void 0 : _d.forEach(function (section) {
9612
- section.fields.forEach(function (field) {
9613
- var _a;
9614
- if (newValue.toString().toLowerCase() === ((_a = field.field) === null || _a === void 0 ? void 0 : _a.toLowerCase())) {
9615
- _this.params.forEach(function (origParam) {
9616
- var origKey = Object.keys(origParam)[0];
9617
- if (origKey == key) {
9618
- if (field.control == exports.EFormControl.CALENDAR) {
9619
- origParam[origKey] = field.value ? field.value.toLocaleDateString() : null;
9620
- }
9621
- else {
9622
- origParam[origKey] = field.value;
9623
- }
9624
- }
9625
- });
9626
- }
9627
- });
9628
- });
9629
- }
9630
- });
9631
- //console.log('new params', this.params);
9632
- }
9633
- };
9634
- GenerateReportBtnComponent.prototype.downloadQuickReport = function () {
9635
- var _this = this;
9636
- var filters = [];
9637
- if (this.params && this.params.length > 0) {
9638
- this.params.forEach(function (param) {
9639
- Object.keys(param).map(function (key) { return filters.push({
9640
- field: key,
9641
- matchMode: 'equal',
9642
- operator: 'and',
9643
- value: param[key],
9644
- }); });
9645
- });
9646
- }
9647
- else {
9648
- filters = this.getFilters();
9649
- }
9650
- this.requestService
9651
- .download('/Report/Generate', { Id: this.repId, filters: filters })
9652
- .subscribe(function (response) {
9653
- var _a, _b, _c, _d;
9654
- var newBlob = new Blob([response.body], { type: 'application/pdf' });
9655
- var data = window.URL.createObjectURL(newBlob);
9656
- var a = document.createElement('a');
9657
- a.href = data;
9658
- var header = (_a = response === null || response === void 0 ? void 0 : response.headers) === null || _a === void 0 ? void 0 : _a.get('Content-Disposition');
9659
- var fileName = (_d = (_c = (_b = header === null || header === void 0 ? void 0 : header.split('filename=')) === null || _b === void 0 ? void 0 : _b[1]) === null || _c === void 0 ? void 0 : _c.split(';')[0]) === null || _d === void 0 ? void 0 : _d.replaceAll(/\"/g, '');
9660
- a.download = fileName;
9661
- document.body.appendChild(a);
9662
- a.click();
9663
- document.body.removeChild(a);
9664
- }, function (error) {
9665
- _this.alertService.apiError(error);
9666
- });
9704
+ this.reportService.downloadReport(this.repId, this.params, this.showDialog, this.form);
9667
9705
  };
9668
9706
  return GenerateReportBtnComponent;
9669
9707
  }());
9670
9708
  GenerateReportBtnComponent.decorators = [
9671
9709
  { type: i0.Component, args: [{
9672
9710
  selector: 'se-generate-report-btn',
9673
- template: "<button\n class=\"report-btn generate-report-btn\"\n pButton\n type=\"button\"\n [label]=\"label ? label : 'Generate Report'\"\n (click)=\"reportClickEvent()\"\n></button>\n",
9711
+ template: "<button\n class=\"report-btn generate-report-btn\"\n pButton\n type=\"button\"\n id=\"reportbtn\"\n [label]=\"label ? label : 'Generate Report'\"\n (click)=\"reportClickEvent()\"\n></button>\n",
9674
9712
  styles: [""]
9675
9713
  },] }
9676
9714
  ];
9677
9715
  /** @nocollapse */
9678
9716
  GenerateReportBtnComponent.ctorParameters = function () { return [
9679
- { type: dynamicdialog.DialogService },
9680
- { type: RequestService },
9681
- { type: AlertService }
9717
+ { type: ReportService }
9682
9718
  ]; };
9683
9719
  GenerateReportBtnComponent.propDecorators = {
9684
9720
  repId: [{ type: i0.Input }],
@@ -10160,11 +10196,11 @@
10160
10196
  ];
10161
10197
  /** @nocollapse */
10162
10198
  SeGlobalFilterComponent.ctorParameters = function () { return [
10163
- { type: i1$1.DatePipe },
10164
- { type: dynamicdialog.DynamicDialogRef, decorators: [{ type: i0.Optional }] },
10165
- { type: dynamicdialog.DynamicDialogConfig, decorators: [{ type: i0.Optional }] },
10199
+ { type: i1$2.DatePipe },
10200
+ { type: i1.DynamicDialogRef, decorators: [{ type: i0.Optional }] },
10201
+ { type: i1.DynamicDialogConfig, decorators: [{ type: i0.Optional }] },
10166
10202
  { type: GridService },
10167
- { type: dynamicdialog.DialogService },
10203
+ { type: i1.DialogService },
10168
10204
  { type: AlertService },
10169
10205
  { type: i0.ElementRef }
10170
10206
  ]; };
@@ -10220,7 +10256,7 @@
10220
10256
  ];
10221
10257
  /** @nocollapse */
10222
10258
  SeFilterComponent.ctorParameters = function () { return [
10223
- { type: dynamicdialog.DialogService }
10259
+ { type: i1.DialogService }
10224
10260
  ]; };
10225
10261
  SeFilterComponent.propDecorators = {
10226
10262
  globalFilters: [{ type: i0.Input }],
@@ -10322,9 +10358,9 @@
10322
10358
  SeFilterComponent,
10323
10359
  AlertPopUpComponent
10324
10360
  ],
10325
- providers: [dynamicdialog.DialogService, AlertService, i1$1.DecimalPipe, i1$1.DatePipe, RequestService],
10361
+ providers: [i1.DialogService, AlertService, i1$2.DecimalPipe, i1$2.DatePipe, RequestService],
10326
10362
  imports: [
10327
- i1$1.CommonModule,
10363
+ i1$2.CommonModule,
10328
10364
  table.TableModule,
10329
10365
  panelmenu.PanelMenuModule,
10330
10366
  menu.MenuModule,
@@ -10666,7 +10702,8 @@
10666
10702
  exports["ɵb"] = AddRowDirective;
10667
10703
  exports["ɵc"] = NotesComponent;
10668
10704
  exports["ɵd"] = AppFilterMenuComponent;
10669
- exports["ɵe"] = AlertPopUpComponent;
10705
+ exports["ɵe"] = ReportService;
10706
+ exports["ɵf"] = AlertPopUpComponent;
10670
10707
  Object.keys(api).forEach(function (k) {
10671
10708
  if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
10672
10709
  enumerable: true,