@seniorsistemas/exclusion-process-component 0.0.1-c049d10c-e93a-4d63-9c2a-b17bca40c324 → 0.1.0

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.
Files changed (44) hide show
  1. package/bundles/seniorsistemas-exclusion-process-component.umd.js +554 -18
  2. package/bundles/seniorsistemas-exclusion-process-component.umd.js.map +1 -1
  3. package/bundles/seniorsistemas-exclusion-process-component.umd.min.js +2 -2
  4. package/bundles/seniorsistemas-exclusion-process-component.umd.min.js.map +1 -1
  5. package/esm2015/exclusion-details/exclusion-details.component.js +15 -5
  6. package/esm2015/exclusion-details/exclusion-details.module.js +4 -3
  7. package/esm2015/exclusion-details/protocols/show-details-information.js +1 -1
  8. package/esm2015/exclusions-list/exclusions-list.component.js +347 -0
  9. package/esm2015/exclusions-list/exclusions-list.module.js +47 -0
  10. package/esm2015/exclusions-list/exclusions-list.routing.js +115 -0
  11. package/esm2015/exclusions-list/index.js +4 -0
  12. package/esm2015/public-api.js +2 -1
  13. package/esm2015/seniorsistemas-exclusion-process-component.js +4 -2
  14. package/esm2015/services/filter.service.js +4 -1
  15. package/esm2015/services/index.js +2 -0
  16. package/esm2015/services/logical-delete.service.js +24 -9
  17. package/esm5/exclusion-details/exclusion-details.component.js +15 -5
  18. package/esm5/exclusion-details/exclusion-details.module.js +4 -3
  19. package/esm5/exclusion-details/protocols/show-details-information.js +1 -1
  20. package/esm5/exclusions-list/exclusions-list.component.js +362 -0
  21. package/esm5/exclusions-list/exclusions-list.module.js +50 -0
  22. package/esm5/exclusions-list/exclusions-list.routing.js +127 -0
  23. package/esm5/exclusions-list/index.js +4 -0
  24. package/esm5/public-api.js +2 -1
  25. package/esm5/seniorsistemas-exclusion-process-component.js +4 -2
  26. package/esm5/services/filter.service.js +4 -1
  27. package/esm5/services/index.js +2 -0
  28. package/esm5/services/logical-delete.service.js +24 -9
  29. package/exclusion-details/exclusion-details.component.d.ts +2 -0
  30. package/exclusion-details/protocols/show-details-information.d.ts +2 -1
  31. package/exclusions-list/exclusions-list.component.d.ts +69 -0
  32. package/exclusions-list/exclusions-list.module.d.ts +2 -0
  33. package/exclusions-list/exclusions-list.routing.d.ts +29 -0
  34. package/exclusions-list/index.d.ts +3 -0
  35. package/fesm2015/seniorsistemas-exclusion-process-component.js +517 -18
  36. package/fesm2015/seniorsistemas-exclusion-process-component.js.map +1 -1
  37. package/fesm5/seniorsistemas-exclusion-process-component.js +547 -18
  38. package/fesm5/seniorsistemas-exclusion-process-component.js.map +1 -1
  39. package/package.json +1 -1
  40. package/public-api.d.ts +1 -0
  41. package/seniorsistemas-exclusion-process-component.d.ts +3 -1
  42. package/seniorsistemas-exclusion-process-component.metadata.json +1 -1
  43. package/services/index.d.ts +1 -0
  44. package/services/logical-delete.service.d.ts +5 -3
@@ -1,16 +1,21 @@
1
1
  import { __decorate, __param, __spread, __assign } from 'tslib';
2
2
  import { CommonModule } from '@angular/common';
3
- import { InjectionToken, Inject, Injectable, Output, Component, ViewEncapsulation, NgModule } from '@angular/core';
3
+ import { InjectionToken, Inject, Injectable, Output, Component, ViewEncapsulation, NgModule, ChangeDetectorRef, ViewChild } from '@angular/core';
4
4
  import { PanelModule } from 'primeng/panel';
5
5
  import { TableModule } from 'primeng/table';
6
- import { EnumColumnFieldType, EnumBadgeColors, SidebarModule, ButtonModule, TableModule as TableModule$1, LoadingStateModule, LocaleModule, FieldType } from '@seniorsistemas/angular-components';
6
+ import { EnumColumnFieldType, EnumBadgeColors, SidebarModule, ButtonModule, TableModule as TableModule$1, LoadingStateModule, LocaleModule, EmptyStateModule, FieldType, FormField, LocaleService, ControlErrorsModule, InfoSignModule, DynamicFormModule, TokenListModule } from '@seniorsistemas/angular-components';
7
7
  import * as moment from 'moment';
8
- import { Router, ActivatedRoute } from '@angular/router';
8
+ import { Router, ActivatedRoute, RouterModule } from '@angular/router';
9
9
  import { throwError, Subject } from 'rxjs';
10
10
  import { catchError, map, takeUntil, finalize } from 'rxjs/operators';
11
11
  import { HttpParams, HttpClient } from '@angular/common/http';
12
- import { TranslateService } from '@ngx-translate/core';
12
+ import { TranslateService, TranslateModule } from '@ngx-translate/core';
13
13
  import { MessageService } from 'primeng/api';
14
+ import { Validators, FormBuilder, FormsModule, ReactiveFormsModule } from '@angular/forms';
15
+ import { DialogModule } from 'primeng/dialog';
16
+ import { ConfirmDialogModule } from 'primeng/confirmdialog';
17
+ import { InputTextModule } from 'primeng/inputtext';
18
+ import { PermissionsService } from '@seniorsistemas/platform-components';
14
19
 
15
20
  var EnumExclusionProcessStatus;
16
21
  (function (EnumExclusionProcessStatus) {
@@ -48,6 +53,8 @@ var LogicalDeleteConfigService = /** @class */ (function () {
48
53
  return LogicalDeleteConfigService;
49
54
  }());
50
55
 
56
+ var HTTP_UNAUTHORIZED_CODE = 401;
57
+ var DEFAULT_PAGE_SIZE = 10;
51
58
  var LogicalDeleteService = /** @class */ (function () {
52
59
  function LogicalDeleteService(http, messageService, translate, projectConfigs) {
53
60
  this.http = http;
@@ -62,10 +69,11 @@ var LogicalDeleteService = /** @class */ (function () {
62
69
  LogicalDeleteService.prototype.defaultCatch = function () {
63
70
  var _this = this;
64
71
  return catchError(function (err) {
72
+ var _a;
65
73
  if (err) {
66
74
  var summary = err.status ? String(err.status) : "Error";
67
- var detail = (err.error && err.error.message) || err.statusText || err.message || "Error";
68
- if (err.status === 401) {
75
+ var detail = ((_a = err.error) === null || _a === void 0 ? void 0 : _a.message) || err.statusText || err.message;
76
+ if (err.status === HTTP_UNAUTHORIZED_CODE) {
69
77
  var prefix = _this.projectConfigs.getTranslationPrefix();
70
78
  summary = _this.translate.instant(prefix + ".error_unauthorized_title");
71
79
  detail = _this.translate.instant(prefix + ".error_unauthorized_description");
@@ -73,14 +81,14 @@ var LogicalDeleteService = /** @class */ (function () {
73
81
  _this.messageService.add({
74
82
  severity: "error",
75
83
  summary: summary,
76
- detail: detail
84
+ detail: detail || "Error"
77
85
  });
78
86
  }
79
87
  return throwError(err);
80
88
  });
81
89
  };
82
90
  LogicalDeleteService.prototype.getListQueryParams = function (listParams) {
83
- var _a = listParams.page, page = _a === void 0 ? 0 : _a, _b = listParams.size, size = _b === void 0 ? 10 : _b, _c = listParams.sort, sort = _c === void 0 ? [] : _c, _d = listParams.filterQuery, filterQuery = _d === void 0 ? "" : _d, _e = listParams.displayFields, displayFields = _e === void 0 ? [] : _e;
91
+ var _a = listParams.page, page = _a === void 0 ? 0 : _a, _b = listParams.size, size = _b === void 0 ? DEFAULT_PAGE_SIZE : _b, _c = listParams.sort, sort = _c === void 0 ? [] : _c, _d = listParams.filterQuery, filterQuery = _d === void 0 ? "" : _d, _e = listParams.displayFields, displayFields = _e === void 0 ? [] : _e;
84
92
  var params = new HttpParams();
85
93
  params = params.append("size", String(size));
86
94
  params = params.append("offset", String(page));
@@ -102,10 +110,22 @@ var LogicalDeleteService = /** @class */ (function () {
102
110
  }
103
111
  return params;
104
112
  };
105
- LogicalDeleteService.prototype.getProcessDetails = function (recordId) {
106
- var filterParams = {
107
- filter: "recordId eq '" + recordId + "'"
108
- };
113
+ LogicalDeleteService.prototype.getProcessDetails = function (id) {
114
+ return this.doGetProcessDetails({
115
+ filter: "id eq '" + id + "'",
116
+ size: "1",
117
+ offset: "0",
118
+ });
119
+ };
120
+ LogicalDeleteService.prototype.getLatestProcessDetails = function (recordId) {
121
+ return this.doGetProcessDetails({
122
+ filter: "recordId eq '" + recordId + "'",
123
+ size: "1",
124
+ offset: "0",
125
+ orderby: "startDate desc"
126
+ });
127
+ };
128
+ LogicalDeleteService.prototype.doGetProcessDetails = function (filterParams) {
109
129
  return this.http.get(this.exclusionProcessUrl, { params: filterParams })
110
130
  .pipe(this.defaultCatch())
111
131
  .pipe(map(function (value) {
@@ -209,8 +229,9 @@ var ExclusionDetailsComponent = /** @class */ (function () {
209
229
  this.processDetails = null;
210
230
  this._entityName = details.entityName;
211
231
  this._isVisible = true;
232
+ this._processSummaryData = [];
212
233
  this.entityDescription = details.entityDescription;
213
- this.loadProcessDetails(details.recordId);
234
+ this.loadProcessDetails(details);
214
235
  };
215
236
  ExclusionDetailsComponent.prototype.closeDetails = function () {
216
237
  this._isVisible = false;
@@ -266,6 +287,12 @@ var ExclusionDetailsComponent = /** @class */ (function () {
266
287
  ExclusionDetailsComponent.prototype.getSidebarTitle = function () {
267
288
  return this.translate.instant(this.projectConfigs.getTranslationPrefix() + ".logical_delete_details_title");
268
289
  };
290
+ ExclusionDetailsComponent.prototype.getEmptyStateTitle = function () {
291
+ return this.translate.instant(this.projectConfigs.getTranslationPrefix() + ".logical_delete_empty_state_title");
292
+ };
293
+ ExclusionDetailsComponent.prototype.getEmptyStateDescription = function () {
294
+ return this.translate.instant(this.projectConfigs.getTranslationPrefix() + ".logical_delete_empty_state_description");
295
+ };
269
296
  ExclusionDetailsComponent.prototype.getSummaryColumns = function () {
270
297
  return [
271
298
  {
@@ -314,10 +341,13 @@ var ExclusionDetailsComponent = /** @class */ (function () {
314
341
  }
315
342
  return null;
316
343
  };
317
- ExclusionDetailsComponent.prototype.loadProcessDetails = function (recordId) {
344
+ ExclusionDetailsComponent.prototype.loadProcessDetails = function (details) {
318
345
  var _this = this;
319
346
  this._isLoading = true;
320
- this.logicalDeleteService.getProcessDetails(recordId)
347
+ var processObservable = details.processId
348
+ ? this.logicalDeleteService.getProcessDetails(details.processId)
349
+ : this.logicalDeleteService.getLatestProcessDetails(details.recordId);
350
+ processObservable
321
351
  .pipe(takeUntil(this.ngUnsubscribe))
322
352
  .pipe(finalize(function () { return _this._isLoading = false; }))
323
353
  .subscribe(function (process) {
@@ -365,7 +395,7 @@ var ExclusionDetailsComponent = /** @class */ (function () {
365
395
  ExclusionDetailsComponent = __decorate([
366
396
  Component({
367
397
  selector: "s-exclusion-details",
368
- template: "<s-sidebar [visible]=\"isVisible\" (visibleChange)=\"closeDetails()\" [header]=\"getSidebarTitle()\">\n <s-loading-state [loading]=\"isLoading\">\n <p-panel [showHeader]=\"false\" styleClass=\"s-exclusion-details-record-details-panel\">\n <div class=\"s-exclusion-details-record-details-container\">\n <div class=\"s-exclusion-details-record-icon-background\">\n <i class=\"far fa-file-alt s-exclusion-details-record-icon\"></i>\n </div>\n\n <div class=\"s-exclusion-details-record-details-recordinfo\">\n <span class=\"s-exclusion-details-record-details-type\">\n {{entityDescription}}\n </span>\n <span>\n {{getRecordDescription()}}\n </span>\n </div>\n\n <div class=\"s-exclusion-details-record-details-dateinfo\">\n <span>\n {{getStartDateLabel()}}: {{getInicialDate()}}\n </span>\n <span *ngIf=\"isFinished()\">\n {{getFinishDateLabel()}}: {{getFinishDate()}}\n </span>\n </div>\n </div>\n </p-panel>\n\n <p-panel>\n <p-header>\n {{getSummaryLabel()}}\n </p-header>\n <p-table\n [value]=\"processSummaryData\"\n [columns]=\"processSummaryColumns\"\n dataKey=\"id\"\n [lazy]=\"false\"\n [scrollable]=\"false\"\n [paginator]=\"false\">\n\n <ng-template pTemplate=\"colgroup\" let-columns>\n <colgroup>\n <col *ngFor=\"let col of columns\"\n [style.width]=\"col.width\"\n />\n </colgroup>\n </ng-template>\n\n <ng-template pTemplate=\"header\" let-columns>\n <tr>\n <th *ngFor=\"let col of columns\"\n [id]=\"col.field\"\n [ngStyle]=\"col.style\" \n [pSortableColumn]=\"col.field\">\n <div class=\"senior-header\">\n <span class=\"senior-header-title\">{{ col.header }}</span>\n <p-sortIcon [field]=\"col.field\" ></p-sortIcon>\n </div>\n </th>\n </tr>\n </ng-template>\n\n <ng-template pTemplate=\"body\" let-rowData let-columns=\"columns\">\n <tr>\n <s-table-columns\n [columns]=\"columns\"\n [rowValue]=\"rowData\"\n [locale]=\"locale\">\n </s-table-columns>\n </tr>\n </ng-template>\n </p-table>\n </p-panel>\n </s-loading-state>\n\n <s-footer>\n <div class=\"ui-fluid\">\n <div class=\"ui-g\">\n <s-button [label]=\"getShowExclusionsButtonLabel()\" (onClick)=\"openExclusions()\"></s-button>\n <s-button [label]=\"getCloseButtonLabel()\" priority=\"link\" (onClick)=\"closeDetails()\"></s-button>\n </div>\n </div>\n </s-footer>\n</s-sidebar>\n",
398
+ template: "<s-sidebar [visible]=\"isVisible\" (visibleChange)=\"closeDetails()\" [header]=\"getSidebarTitle()\">\n <s-loading-state [loading]=\"isLoading\">\n <p-panel [showHeader]=\"false\" styleClass=\"s-exclusion-details-record-details-panel\">\n <div class=\"s-exclusion-details-record-details-container\">\n <div class=\"s-exclusion-details-record-icon-background\">\n <em class=\"far fa-file-alt s-exclusion-details-record-icon\"></em>\n </div>\n\n <div class=\"s-exclusion-details-record-details-recordinfo\">\n <span class=\"s-exclusion-details-record-details-type\">\n {{entityDescription}}\n </span>\n <span>\n {{getRecordDescription()}}\n </span>\n </div>\n\n <div class=\"s-exclusion-details-record-details-dateinfo\">\n <span>\n {{getStartDateLabel()}}: {{getInicialDate()}}\n </span>\n <span *ngIf=\"isFinished()\">\n {{getFinishDateLabel()}}: {{getFinishDate()}}\n </span>\n </div>\n </div>\n </p-panel>\n\n <p-panel>\n <p-header>\n {{getSummaryLabel()}}\n </p-header>\n\n <s-empty-state\n *ngIf=\"processSummaryData && !processSummaryData.length\"\n [title]=\"getEmptyStateTitle()\"\n [description]=\"getEmptyStateDescription()\">\n [showPrimaryAction]=\"false\"\n </s-empty-state>\n\n <p-table\n [value]=\"processSummaryData\"\n [columns]=\"processSummaryColumns\"\n dataKey=\"id\"\n [lazy]=\"false\"\n [scrollable]=\"false\"\n [paginator]=\"false\"\n *ngIf=\"processSummaryData && processSummaryData.length\">\n\n <ng-template pTemplate=\"colgroup\" let-columns>\n <colgroup>\n <col *ngFor=\"let col of columns\"\n [style.width]=\"col.width\"\n />\n </colgroup>\n </ng-template>\n\n <ng-template pTemplate=\"header\" let-columns>\n <tr>\n <th *ngFor=\"let col of columns\"\n [id]=\"col.field\"\n [ngStyle]=\"col.style\"\n [pSortableColumn]=\"col.field\">\n <div class=\"senior-header\">\n <span class=\"senior-header-title\">{{ col.header }}</span>\n <p-sortIcon [field]=\"col.field\" ></p-sortIcon>\n </div>\n </th>\n </tr>\n </ng-template>\n\n <ng-template pTemplate=\"body\" let-rowData let-columns=\"columns\">\n <tr>\n <s-table-columns\n [columns]=\"columns\"\n [rowValue]=\"rowData\"\n [locale]=\"locale\">\n </s-table-columns>\n </tr>\n </ng-template>\n </p-table>\n </p-panel>\n </s-loading-state>\n\n <s-footer>\n <div class=\"ui-fluid\">\n <div class=\"ui-g\">\n <s-button [label]=\"getShowExclusionsButtonLabel()\" (onClick)=\"openExclusions()\"></s-button>\n <s-button [label]=\"getCloseButtonLabel()\" priority=\"link\" (onClick)=\"closeDetails()\"></s-button>\n </div>\n </div>\n </s-footer>\n</s-sidebar>\n",
369
399
  encapsulation: ViewEncapsulation.None,
370
400
  styles: [".s-exclusion-details-record-details-panel{margin-bottom:10px}.s-exclusion-details-record-details-container{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center}.s-exclusion-details-record-details-recordinfo{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;margin-left:10px;-ms-flex:1;flex:1}.s-exclusion-details-record-details-dateinfo{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;margin-left:10px;-ms-flex-align:end;align-items:flex-end;font-size:12px}.s-exclusion-details-record-details-type{color:#999}.s-exclusion-details-record-icon{font-size:22pt;color:#7e8d95}.s-exclusion-details-record-icon-background{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;padding:16px;background-color:#c1cad1;border-radius:50%;height:60px;width:60px}"]
371
401
  })
@@ -386,7 +416,8 @@ var ExclusionDetailsModule = /** @class */ (function () {
386
416
  TableModule,
387
417
  TableModule$1,
388
418
  LoadingStateModule,
389
- LocaleModule
419
+ LocaleModule,
420
+ EmptyStateModule
390
421
  ],
391
422
  declarations: [ExclusionDetailsComponent],
392
423
  exports: [ExclusionDetailsComponent],
@@ -467,6 +498,9 @@ var FilterService = /** @class */ (function () {
467
498
  ? this.translate.instant(this.logicalDeleteConfigService.getTranslationPrefix() + ".list_grid_boolean_true")
468
499
  : this.translate.instant(this.logicalDeleteConfigService.getTranslationPrefix() + ".list_grid_boolean_false");
469
500
  break;
501
+ default:
502
+ labelValue = value;
503
+ break;
470
504
  }
471
505
  return { id: name, label: label + ": " + labelValue };
472
506
  };
@@ -498,6 +532,501 @@ var FilterService = /** @class */ (function () {
498
532
  return FilterService;
499
533
  }());
500
534
 
535
+ var HTTP_CODE_SERVER_ERROR_START = 500;
536
+ var HTTP_CODE_SERVER_ERROR_END = 600;
537
+ var ExclusionsListComponent = /** @class */ (function () {
538
+ function ExclusionsListComponent(route, translate, formBuilder, changeDetectorRef, logicalDeleteService, filterService, projectConfigs) {
539
+ this.route = route;
540
+ this.translate = translate;
541
+ this.formBuilder = formBuilder;
542
+ this.changeDetectorRef = changeDetectorRef;
543
+ this.logicalDeleteService = logicalDeleteService;
544
+ this.filterService = filterService;
545
+ this.projectConfigs = projectConfigs;
546
+ this.currentListParams = { page: 0, size: 10, sort: [], filterData: {} };
547
+ this.showLoader = false;
548
+ this.totalRecords = 0;
549
+ this.filtersPanelCollapsed = true;
550
+ this.searchTokens = [];
551
+ this.serverError = false;
552
+ this.ngUnsubscribe = new Subject();
553
+ }
554
+ ExclusionsListComponent_1 = ExclusionsListComponent;
555
+ ExclusionsListComponent.prototype.ngOnInit = function () {
556
+ var _this = this;
557
+ this.filterFormGroup = this.getFormBuilder();
558
+ this.filterFields = this.getFilterFields();
559
+ this.gridColumns = this.getGridColumns();
560
+ this.route.data
561
+ .pipe(takeUntil(this.ngUnsubscribe))
562
+ .subscribe(function (data) {
563
+ _this.locale = data.localeConfig;
564
+ });
565
+ this.route.params
566
+ .pipe(takeUntil(this.ngUnsubscribe))
567
+ .subscribe(function (params) {
568
+ _this.entityName = params.entityName;
569
+ _this.showBasedOnRoute();
570
+ });
571
+ this.route.queryParams
572
+ .pipe(takeUntil(this.ngUnsubscribe))
573
+ .subscribe(function (queryParams) {
574
+ _this.entityDescription = queryParams.entityDescription;
575
+ _this.processId = queryParams.processId;
576
+ _this.showBasedOnRoute();
577
+ });
578
+ };
579
+ ExclusionsListComponent.prototype.showBasedOnRoute = function () {
580
+ if (this.entityName && this.entityDescription && this.processId) {
581
+ this.exclusionDetailsComponent.showDetails({
582
+ processId: this.processId,
583
+ entityDescription: this.entityDescription,
584
+ entityName: this.entityName
585
+ });
586
+ }
587
+ };
588
+ ExclusionsListComponent.prototype.ngOnDestroy = function () {
589
+ this.ngUnsubscribe.next();
590
+ this.ngUnsubscribe.complete();
591
+ };
592
+ ExclusionsListComponent.prototype.getFormBuilder = function () {
593
+ return this.formBuilder.group({
594
+ description: [undefined, Validators.compose([])],
595
+ status: [undefined, Validators.compose([])],
596
+ startDate: [{ value: undefined, disabled: false }, Validators.compose([])],
597
+ endDate: [{ value: undefined, disabled: false }, Validators.compose([])]
598
+ });
599
+ };
600
+ ExclusionsListComponent.prototype.getGridColumns = function () {
601
+ return [
602
+ {
603
+ field: "description",
604
+ attributes: ["description"],
605
+ header: this.translate.instant(this.projectConfigs.getTranslationPrefix() + ".logical_delete_description"),
606
+ type: EnumColumnFieldType.STRING,
607
+ style: {
608
+ width: "300px"
609
+ }
610
+ },
611
+ {
612
+ field: "status",
613
+ attributes: ["status"],
614
+ header: this.translate.instant(this.projectConfigs.getTranslationPrefix() + ".logical_delete_status"),
615
+ type: EnumColumnFieldType.ENUM,
616
+ enumPrefix: this.projectConfigs.getTranslationPrefix() + ".logical_delete_enum_exclusion_process_status_",
617
+ style: {
618
+ width: "100px"
619
+ },
620
+ badgeConfigs: [
621
+ {
622
+ enumValue: EnumExclusionProcessStatus.ERROR,
623
+ color: EnumBadgeColors.RED
624
+ },
625
+ {
626
+ enumValue: EnumExclusionProcessStatus.PENDING,
627
+ color: EnumBadgeColors.YELLOW
628
+ },
629
+ {
630
+ enumValue: EnumExclusionProcessStatus.PROCESSING,
631
+ color: EnumBadgeColors.BLUE
632
+ },
633
+ {
634
+ enumValue: EnumExclusionProcessStatus.SUCCESS,
635
+ color: EnumBadgeColors.GREEN
636
+ }
637
+ ]
638
+ },
639
+ {
640
+ field: "startDate",
641
+ attributes: ["startDate"],
642
+ header: this.translate.instant(this.projectConfigs.getTranslationPrefix() + ".logical_delete_start"),
643
+ type: EnumColumnFieldType.DATE,
644
+ dateFormat: "DD/MM/YYYY HH:mm",
645
+ style: {
646
+ width: "100px"
647
+ }
648
+ },
649
+ {
650
+ field: "finishDate",
651
+ attributes: ["finishDate"],
652
+ header: this.translate.instant(this.projectConfigs.getTranslationPrefix() + ".logical_delete_finish"),
653
+ type: EnumColumnFieldType.DATE,
654
+ dateFormat: "DD/MM/YYYY HH:mm",
655
+ style: {
656
+ width: "100px"
657
+ }
658
+ }
659
+ ];
660
+ };
661
+ ExclusionsListComponent.prototype.getFilterFields = function () {
662
+ var translationPrefix = this.projectConfigs.getTranslationPrefix();
663
+ return [
664
+ new FormField({
665
+ type: FieldType.String,
666
+ name: "description",
667
+ label: this.translate.instant(translationPrefix + ".logical_delete_description")
668
+ }),
669
+ new FormField({
670
+ type: FieldType.Enum,
671
+ name: "status",
672
+ label: this.translate.instant(translationPrefix + ".logical_delete_status"),
673
+ placeholder: this.translate.instant(translationPrefix + ".logical_delete_status"),
674
+ multiple: true,
675
+ options: [
676
+ {
677
+ label: this.translate.instant(translationPrefix + ".logical_delete_enum_exclusion_process_status_error"),
678
+ value: EnumExclusionProcessStatus.ERROR
679
+ },
680
+ {
681
+ label: this.translate.instant(translationPrefix + ".logical_delete_enum_exclusion_process_status_pending"),
682
+ value: EnumExclusionProcessStatus.PENDING
683
+ },
684
+ {
685
+ label: this.translate.instant(translationPrefix + ".logical_delete_enum_exclusion_process_status_processing"),
686
+ value: EnumExclusionProcessStatus.PROCESSING
687
+ },
688
+ {
689
+ label: this.translate.instant(translationPrefix + ".logical_delete_enum_exclusion_process_status_success"),
690
+ value: EnumExclusionProcessStatus.SUCCESS
691
+ }
692
+ ]
693
+ }),
694
+ new FormField({
695
+ type: FieldType.Date,
696
+ name: "startDate",
697
+ label: this.translate.instant(translationPrefix + ".logical_delete_start")
698
+ }),
699
+ new FormField({
700
+ type: FieldType.Date,
701
+ name: "endDate",
702
+ label: this.translate.instant(translationPrefix + ".logical_delete_finish")
703
+ })
704
+ ];
705
+ };
706
+ ExclusionsListComponent.prototype.getEmptyStateTitle = function () {
707
+ return this.translate.instant(this.projectConfigs.getTranslationPrefix() + ".logical_delete_empty_state_title");
708
+ };
709
+ ExclusionsListComponent.prototype.getEmptyStateDescription = function () {
710
+ return this.translate.instant(this.projectConfigs.getTranslationPrefix() + ".logical_delete_empty_state_description");
711
+ };
712
+ ExclusionsListComponent.prototype.getTitle = function () {
713
+ return this.translate.instant(this.projectConfigs.getTranslationPrefix() + ".logical_delete_list_title");
714
+ };
715
+ ExclusionsListComponent.prototype.getDetailsButtonTitle = function () {
716
+ return this.translate.instant(this.projectConfigs.getTranslationPrefix() + ".logical_delete_details");
717
+ };
718
+ ExclusionsListComponent.prototype.getFiltersTitle = function () {
719
+ return this.translate.instant(this.projectConfigs.getTranslationPrefix() + ".filters");
720
+ };
721
+ ExclusionsListComponent.prototype.getFilterButtonTitle = function () {
722
+ return this.translate.instant(this.projectConfigs.getTranslationPrefix() + ".filter");
723
+ };
724
+ ExclusionsListComponent.prototype.getClearButtonTitle = function () {
725
+ return this.translate.instant(this.projectConfigs.getTranslationPrefix() + ".clear");
726
+ };
727
+ ExclusionsListComponent.prototype.getErrorInvalid = function () {
728
+ return this.translate.instant(this.projectConfigs.getTranslationPrefix() + ".error_invalid");
729
+ };
730
+ ExclusionsListComponent.prototype.getErrorServerTitle = function () {
731
+ return this.translate.instant(this.projectConfigs.getTranslationPrefix() + ".error_server_title");
732
+ };
733
+ ExclusionsListComponent.prototype.getErrorServerDescription = function () {
734
+ return this.translate.instant(this.projectConfigs.getTranslationPrefix() + ".error_server_description");
735
+ };
736
+ ExclusionsListComponent.prototype.getActionsColumnLabel = function () {
737
+ return this.translate.instant(this.projectConfigs.getTranslationPrefix() + ".actions");
738
+ };
739
+ ExclusionsListComponent.prototype.onSearch = function () {
740
+ var filterData = this.filterFormGroup.getRawValue();
741
+ this.filtersPanelCollapsed = true;
742
+ this.resetGrid({ filterData: filterData });
743
+ };
744
+ ExclusionsListComponent.prototype.onClear = function () {
745
+ this.filterFormGroup.reset();
746
+ var filterData = this.filterFormGroup.getRawValue();
747
+ this.resetGrid({ filterData: filterData });
748
+ };
749
+ ExclusionsListComponent.prototype.onRemoveToken = function (token) {
750
+ this.filterFormGroup.get(token.id).setValue(undefined);
751
+ var filterData = this.filterFormGroup.getRawValue();
752
+ this.resetGrid({ filterData: filterData });
753
+ };
754
+ ExclusionsListComponent.prototype.onGridChange = function (event) {
755
+ var size = event.rows;
756
+ var page = event.first / size;
757
+ var sort = event.multiSortMeta ? event.multiSortMeta : [];
758
+ return this.updateGrid({ page: page, size: size, sort: sort });
759
+ };
760
+ ExclusionsListComponent.prototype.getFilterTokens = function () {
761
+ var _this = this;
762
+ var filterData = this.filterFormGroup.value;
763
+ return this.filterFields
764
+ .filter(function (_a) {
765
+ var name = _a.name;
766
+ return filterData[name] !== undefined && filterData[name] !== "" && filterData[name] !== null;
767
+ })
768
+ .map(function (formField) { return _this.filterService.createFilterTokens(formField, filterData[formField.name]); });
769
+ };
770
+ ExclusionsListComponent.prototype.getFilterQuery = function () {
771
+ var _this = this;
772
+ var filterData = this.currentListParams.filterData;
773
+ var dateFields = ["startDate", "endDate"];
774
+ var filterQuery = this.filterFields
775
+ .filter(function (_a) {
776
+ var name = _a.name;
777
+ return !dateFields.includes(name);
778
+ })
779
+ .filter(function (_a) {
780
+ var name = _a.name;
781
+ return filterData[name] !== undefined && filterData[name] !== "" && filterData[name] !== null;
782
+ })
783
+ .map(function (formField) { return _this.filterService.createFilterString(formField, filterData[formField.name]); })
784
+ .join(" and ");
785
+ var dateQuery;
786
+ if (filterData.startDate && filterData.endDate) {
787
+ var startDate = moment(filterData.startDate).format(ExclusionsListComponent_1.DATE_FORMAT);
788
+ var endDate = moment(filterData.endDate).format(ExclusionsListComponent_1.DATE_FORMAT);
789
+ dateQuery = "startDate between '" + startDate + "T00:00:00Z' and '" + endDate + "T23:59:59Z'";
790
+ }
791
+ else if (filterData.startDate) {
792
+ var startDate = moment(filterData.startDate).format(ExclusionsListComponent_1.DATE_FORMAT);
793
+ dateQuery = "startDate >= '" + startDate + "T00:00:00Z'";
794
+ }
795
+ else if (filterData.endDate) {
796
+ var endDate = moment(filterData.endDate).format(ExclusionsListComponent_1.DATE_FORMAT);
797
+ dateQuery = "finishDate <= '" + endDate + "T23:59:59Z'";
798
+ }
799
+ else {
800
+ // Não é necessário nenhuma condição a mais no filtro.
801
+ }
802
+ if (dateQuery) {
803
+ filterQuery += filterQuery ? " and " + dateQuery : dateQuery;
804
+ }
805
+ return filterQuery;
806
+ };
807
+ ExclusionsListComponent.prototype.updateGrid = function (listParams) {
808
+ if (listParams === void 0) { listParams = {}; }
809
+ this.currentListParams = __assign(__assign({}, this.currentListParams), listParams);
810
+ var _a = this.currentListParams, page = _a.page, size = _a.size, sort = _a.sort;
811
+ this.searchTokens = this.getFilterTokens();
812
+ var filterQuery = this.getFilterQuery();
813
+ var displayFields = __spread([
814
+ "recordId"
815
+ ], this.gridColumns.map(function (column) { return column.field; }));
816
+ this.listExclusions({ page: page, size: size, sort: sort, filterQuery: filterQuery, displayFields: displayFields });
817
+ };
818
+ ExclusionsListComponent.prototype.listExclusions = function (params) {
819
+ var _this = this;
820
+ this.showLoader = true;
821
+ this.serverError = false;
822
+ this.changeDetectorRef.detectChanges();
823
+ this.logicalDeleteService
824
+ .listExclusions(this.entityName, params)
825
+ .pipe(takeUntil(this.ngUnsubscribe), catchError(function (err) {
826
+ if (err.status >= HTTP_CODE_SERVER_ERROR_START && err.status < HTTP_CODE_SERVER_ERROR_END) {
827
+ _this.serverError = true;
828
+ }
829
+ throw err;
830
+ }), finalize(function () { return _this.showLoader = false; }))
831
+ .subscribe(function (list) {
832
+ _this.gridData = list.contents;
833
+ _this.totalRecords = list.totalElements;
834
+ });
835
+ };
836
+ ExclusionsListComponent.prototype.focusInput = function (elementId) {
837
+ var element = document.getElementById("" + elementId);
838
+ if (element) {
839
+ element.focus();
840
+ }
841
+ };
842
+ ExclusionsListComponent.prototype.resetGrid = function (listParams) {
843
+ if (listParams) {
844
+ this.currentListParams = __assign(__assign({}, this.currentListParams), listParams);
845
+ }
846
+ this.currentListParams = __assign(__assign({}, this.currentListParams), { page: 0, sort: [] });
847
+ this.table.reset();
848
+ };
849
+ ExclusionsListComponent.prototype.onClickDetails = function (rowData) {
850
+ this.exclusionDetailsComponent.showDetails({
851
+ processId: rowData.id,
852
+ entityDescription: this.entityDescription,
853
+ entityName: this.entityName
854
+ });
855
+ };
856
+ var ExclusionsListComponent_1;
857
+ ExclusionsListComponent.DATE_FORMAT = "YYYY-MM-DD";
858
+ ExclusionsListComponent.ctorParameters = function () { return [
859
+ { type: ActivatedRoute },
860
+ { type: TranslateService },
861
+ { type: FormBuilder },
862
+ { type: ChangeDetectorRef },
863
+ { type: LogicalDeleteService },
864
+ { type: FilterService },
865
+ { type: LogicalDeleteConfigService }
866
+ ]; };
867
+ __decorate([
868
+ ViewChild("exclusionsTable")
869
+ ], ExclusionsListComponent.prototype, "table", void 0);
870
+ __decorate([
871
+ ViewChild(ExclusionDetailsComponent)
872
+ ], ExclusionsListComponent.prototype, "exclusionDetailsComponent", void 0);
873
+ ExclusionsListComponent = ExclusionsListComponent_1 = __decorate([
874
+ Component({
875
+ template: "<div>\n <form [formGroup]=\"filterFormGroup\" autocomplete=\"off\">\n <p-panel\n *sLoadingState=\"showLoader\"\n styleClass=\"form-group\"\n [toggleable]=\"true\"\n [(collapsed)]=\"filtersPanelCollapsed\"\n (onAfterToggle)=\"focusInput('description')\"\n >\n <p-header>\n {{ getFiltersTitle() }}\n <s-token-list\n [tokens]=\"searchTokens\"\n (tokenRemoved)=\"onRemoveToken($event)\"\n [removableTokens]=\"true\"\n ></s-token-list>\n </p-header>\n <div>\n <s-dynamic-form\n [fields]=\"filterFields\"\n [form]=\"filterFormGroup\"\n [errorMessages]=\"{ pattern: getErrorInvalid() }\"\n ></s-dynamic-form>\n </div>\n <p-footer>\n <div class=\"ui-g\">\n <div class=\"ui-g-12\">\n <button\n id=\"filter-button\"\n class=\"ui-button\"\n type=\"submit\"\n pButton\n [label]=\"getFilterButtonTitle()\"\n (click)=\"onSearch()\"\n ></button>\n <button\n id=\"clear-button\"\n class=\"ui-button ui-button-link\"\n type=\"button\"\n pButton\n [label]=\"getClearButtonTitle()\"\n (click)=\"onClear()\"\n ></button>\n </div>\n </div>\n </p-footer>\n </p-panel>\n </form>\n <p-panel *sLoadingState=\"showLoader\">\n <p-header>\n {{ getTitle() }}\n </p-header>\n <ng-container>\n <s-empty-state\n *ngIf=\"serverError && !showLoader\"\n iconClass=\"fa fa-exclamation-triangle\"\n title=\"{{ getErrorServerTitle() | translate }}\"\n primaryActionLabel=\"{{ 'error_server_try_again' | translate }}\"\n (primaryAction)=\"resetGrid()\"\n description=\"{{ getErrorServerDescription() | translate }}\"\n ></s-empty-state>\n\n <s-empty-state\n *ngIf=\"!showLoader && !serverError && totalRecords === 0\"\n [title]=\"getEmptyStateTitle()\"\n [showPrimaryAction]=\"false\"\n [description]=\"getEmptyStateDescription()\"\n ></s-empty-state>\n\n <div class=\"ui-g\">\n <div class=\"ui-g-12\">\n <p-table\n #exclusionsTable\n id=\"exclusionsTable\"\n [hidden]=\"totalRecords === 0 || serverError\"\n [value]=\"gridData\"\n [columns]=\"gridColumns\"\n dataKey=\"id\"\n [lazy]=\"true\"\n [scrollable]=\"true\"\n [resizableColumns]=\"true\"\n sortMode=\"multiple\"\n [paginator]=\"true\"\n [totalRecords]=\"totalRecords\"\n [rows]=\"10\"\n rows=\"10\"\n [rowsPerPageOptions]=\"[10, 20, 50, 100]\"\n (onLazyLoad)=\"onGridChange($event)\"\n >\n <ng-template pTemplate=\"colgroup\" let-columns>\n <colgroup>\n <col\n *ngFor=\"let col of columns\"\n [style.width]=\"col.width\"\n />\n </colgroup>\n </ng-template>\n\n <ng-template\n pTemplate=\"header\"\n let-columns\n >\n <tr>\n <th *ngFor=\"let col of columns\"\n [id]=\"col.field\"\n [pSortableColumn]=\"col.field\"\n [ngStyle]=\"col.style\"\n pResizableColumn\n >\n <div class=\"senior-header\">\n <span class=\"senior-header-title\">\n {{ col.header }}\n </span>\n <p-sortIcon [field]=\"col.field\"></p-sortIcon>\n </div>\n </th>\n <th id=\"action-column\" style=\"width: 100px\">\n <div class=\"senior-header\">\n <span class=\"senior-header-title\">{{ getActionsColumnLabel() }}</span>\n </div>\n </th>\n </tr>\n </ng-template>\n\n <ng-template pTemplate=\"body\" let-rowData let-columns=\"columns\">\n <tr [pSelectableRow]=\"rowData\">\n <s-table-columns\n [columns]=\"columns\"\n [rowValue]=\"rowData\"\n [locale]=\"locale\">\n </s-table-columns>\n <td style=\"width: 100px\">\n <s-button\n id=\"details-button\"\n priority=\"default\"\n [label]=\"getDetailsButtonTitle()\"\n [auxiliary]=\"true\"\n (onClick)=\"onClickDetails(rowData)\">\n </s-button>\n </td>\n </tr>\n </ng-template>\n\n <ng-template pTemplate=\"paginatorright\">\n <s-table-paging\n [table]=\"exclusionsTable\"\n [totalRecords]=\"totalRecords\"\n ></s-table-paging>\n </ng-template>\n </p-table>\n </div>\n </div>\n </ng-container>\n </p-panel>\n</div>\n\n<s-exclusion-details></s-exclusion-details>\n",
876
+ providers: []
877
+ })
878
+ ], ExclusionsListComponent);
879
+ return ExclusionsListComponent;
880
+ }());
881
+
882
+ var ExclusionsListFeatureRoutingGuard = /** @class */ (function () {
883
+ function ExclusionsListFeatureRoutingGuard() {
884
+ }
885
+ ExclusionsListFeatureRoutingGuard.prototype.canActivate = function () {
886
+ return true;
887
+ };
888
+ ExclusionsListFeatureRoutingGuard = __decorate([
889
+ Injectable()
890
+ ], ExclusionsListFeatureRoutingGuard);
891
+ return ExclusionsListFeatureRoutingGuard;
892
+ }());
893
+ var ExclusionsListFeatureRoutingListTitleResolver = /** @class */ (function () {
894
+ function ExclusionsListFeatureRoutingListTitleResolver(translate, projectConfigs) {
895
+ this.translate = translate;
896
+ this.projectConfigs = projectConfigs;
897
+ }
898
+ ExclusionsListFeatureRoutingListTitleResolver.prototype.resolve = function () {
899
+ return this.translate.get(this.projectConfigs.getTranslationPrefix() + ".logical_delete_list_title");
900
+ };
901
+ ExclusionsListFeatureRoutingListTitleResolver.ctorParameters = function () { return [
902
+ { type: TranslateService },
903
+ { type: LogicalDeleteConfigService }
904
+ ]; };
905
+ ExclusionsListFeatureRoutingListTitleResolver = __decorate([
906
+ Injectable()
907
+ ], ExclusionsListFeatureRoutingListTitleResolver);
908
+ return ExclusionsListFeatureRoutingListTitleResolver;
909
+ }());
910
+ var ExclusionsListFeatureRoutingPermissionResolver = /** @class */ (function () {
911
+ function ExclusionsListFeatureRoutingPermissionResolver(permissionsService) {
912
+ this.permissionsService = permissionsService;
913
+ }
914
+ ExclusionsListFeatureRoutingPermissionResolver.prototype.resolve = function () {
915
+ return this.permissionsService.get();
916
+ };
917
+ ExclusionsListFeatureRoutingPermissionResolver.ctorParameters = function () { return [
918
+ { type: PermissionsService }
919
+ ]; };
920
+ ExclusionsListFeatureRoutingPermissionResolver = __decorate([
921
+ Injectable()
922
+ ], ExclusionsListFeatureRoutingPermissionResolver);
923
+ return ExclusionsListFeatureRoutingPermissionResolver;
924
+ }());
925
+ var ExclusionsListFeatureRoutingLocaleResolver = /** @class */ (function () {
926
+ function ExclusionsListFeatureRoutingLocaleResolver(localeService) {
927
+ this.localeService = localeService;
928
+ }
929
+ ExclusionsListFeatureRoutingLocaleResolver.prototype.resolve = function () {
930
+ return this.localeService.get();
931
+ };
932
+ ExclusionsListFeatureRoutingLocaleResolver.ctorParameters = function () { return [
933
+ { type: LocaleService }
934
+ ]; };
935
+ ExclusionsListFeatureRoutingLocaleResolver = __decorate([
936
+ Injectable()
937
+ ], ExclusionsListFeatureRoutingLocaleResolver);
938
+ return ExclusionsListFeatureRoutingLocaleResolver;
939
+ }());
940
+ var EmptyComponent = /** @class */ (function () {
941
+ function EmptyComponent() {
942
+ }
943
+ EmptyComponent = __decorate([
944
+ Component({
945
+ template: "<router-outlet></router-outlet>"
946
+ })
947
+ ], EmptyComponent);
948
+ return EmptyComponent;
949
+ }());
950
+ var routes = [
951
+ {
952
+ path: "exclusions-list",
953
+ component: EmptyComponent,
954
+ canActivate: [
955
+ ExclusionsListFeatureRoutingGuard
956
+ ],
957
+ resolve: {
958
+ allPermissions: ExclusionsListFeatureRoutingPermissionResolver,
959
+ localeConfig: ExclusionsListFeatureRoutingLocaleResolver,
960
+ routeTitle: ExclusionsListFeatureRoutingListTitleResolver
961
+ },
962
+ children: [
963
+ {
964
+ path: ":entityName",
965
+ component: ExclusionsListComponent
966
+ }
967
+ ]
968
+ }
969
+ ];
970
+ var ExclusionsListFeatureRouting = /** @class */ (function () {
971
+ function ExclusionsListFeatureRouting() {
972
+ }
973
+ ExclusionsListFeatureRouting = __decorate([
974
+ NgModule({
975
+ imports: [
976
+ RouterModule.forChild(routes)
977
+ ],
978
+ exports: [
979
+ RouterModule
980
+ ],
981
+ providers: [
982
+ ExclusionsListFeatureRoutingGuard,
983
+ ExclusionsListFeatureRoutingPermissionResolver,
984
+ ExclusionsListFeatureRoutingLocaleResolver,
985
+ ExclusionsListFeatureRoutingListTitleResolver
986
+ ],
987
+ declarations: [
988
+ EmptyComponent
989
+ ]
990
+ })
991
+ ], ExclusionsListFeatureRouting);
992
+ return ExclusionsListFeatureRouting;
993
+ }());
994
+
995
+ var ExclusionsListModule = /** @class */ (function () {
996
+ function ExclusionsListModule() {
997
+ }
998
+ ExclusionsListModule = __decorate([
999
+ NgModule({
1000
+ imports: [
1001
+ FormsModule,
1002
+ ReactiveFormsModule,
1003
+ TranslateModule,
1004
+ CommonModule,
1005
+ ControlErrorsModule,
1006
+ ButtonModule,
1007
+ PanelModule,
1008
+ InputTextModule,
1009
+ InfoSignModule,
1010
+ ConfirmDialogModule,
1011
+ DialogModule,
1012
+ TableModule,
1013
+ TableModule$1,
1014
+ LoadingStateModule,
1015
+ EmptyStateModule,
1016
+ DynamicFormModule,
1017
+ TokenListModule,
1018
+ LocaleModule.forChild(),
1019
+ ExclusionDetailsModule,
1020
+ ExclusionsListFeatureRouting
1021
+ ],
1022
+ declarations: [ExclusionsListComponent],
1023
+ exports: [ExclusionsListComponent],
1024
+ entryComponents: [ExclusionsListComponent]
1025
+ })
1026
+ ], ExclusionsListModule);
1027
+ return ExclusionsListModule;
1028
+ }());
1029
+
501
1030
  var LogicalDeleteModule = /** @class */ (function () {
502
1031
  function LogicalDeleteModule() {
503
1032
  }
@@ -526,5 +1055,5 @@ var LogicalDeleteModule = /** @class */ (function () {
526
1055
  * Generated bundle index. Do not edit.
527
1056
  */
528
1057
 
529
- export { ExclusionDetailsComponent, ExclusionDetailsModule, LogicalDeleteModule, LogicalDeleteService as ɵa, LogicalDeleteConfigService as ɵb, ProjectConfigsInjectionToken as ɵc, FilterService as ɵe };
1058
+ export { EmptyComponent, ExclusionDetailsComponent, ExclusionDetailsModule, ExclusionsListComponent, ExclusionsListFeatureRouting, ExclusionsListFeatureRoutingGuard, ExclusionsListFeatureRoutingListTitleResolver, ExclusionsListFeatureRoutingLocaleResolver, ExclusionsListFeatureRoutingPermissionResolver, ExclusionsListModule, LogicalDeleteModule, routes, LogicalDeleteService as ɵa, LogicalDeleteConfigService as ɵb, ProjectConfigsInjectionToken as ɵc, ExclusionDetailsModule as ɵe, ExclusionDetailsComponent as ɵf, LogicalDeleteService as ɵg, FilterService as ɵh };
530
1059
  //# sourceMappingURL=seniorsistemas-exclusion-process-component.js.map