@seniorsistemas/exclusion-process-component 0.0.1-40efacd8-8a6c-4d38-8102-8c977c14410a → 0.0.1-578162e8-6e18-48ad-b6a2-f63ffb1cd87a

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 (26) hide show
  1. package/bundles/seniorsistemas-exclusion-process-component.umd.js +124 -49
  2. package/bundles/seniorsistemas-exclusion-process-component.umd.js.map +1 -1
  3. package/bundles/seniorsistemas-exclusion-process-component.umd.min.js +1 -1
  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 +96 -50
  9. package/esm2015/services/filter.service.js +4 -1
  10. package/esm2015/services/logical-delete.service.js +24 -9
  11. package/esm5/exclusion-details/exclusion-details.component.js +15 -5
  12. package/esm5/exclusion-details/exclusion-details.module.js +4 -3
  13. package/esm5/exclusion-details/protocols/show-details-information.js +1 -1
  14. package/esm5/exclusions-list/exclusions-list.component.js +96 -50
  15. package/esm5/services/filter.service.js +4 -1
  16. package/esm5/services/logical-delete.service.js +24 -9
  17. package/exclusion-details/exclusion-details.component.d.ts +2 -0
  18. package/exclusion-details/protocols/show-details-information.d.ts +2 -1
  19. package/exclusions-list/exclusions-list.component.d.ts +23 -14
  20. package/fesm2015/seniorsistemas-exclusion-process-component.js +125 -50
  21. package/fesm2015/seniorsistemas-exclusion-process-component.js.map +1 -1
  22. package/fesm5/seniorsistemas-exclusion-process-component.js +125 -50
  23. package/fesm5/seniorsistemas-exclusion-process-component.js.map +1 -1
  24. package/package.json +1 -1
  25. package/seniorsistemas-exclusion-process-component.metadata.json +1 -1
  26. package/services/logical-delete.service.d.ts +5 -3
@@ -259,6 +259,8 @@
259
259
  return LogicalDeleteConfigService;
260
260
  }());
261
261
 
262
+ var HTTP_UNAUTHORIZED_CODE = 401;
263
+ var DEFAULT_PAGE_SIZE = 10;
262
264
  var LogicalDeleteService = /** @class */ (function () {
263
265
  function LogicalDeleteService(http, messageService, translate, projectConfigs) {
264
266
  this.http = http;
@@ -273,10 +275,11 @@
273
275
  LogicalDeleteService.prototype.defaultCatch = function () {
274
276
  var _this = this;
275
277
  return operators.catchError(function (err) {
278
+ var _a;
276
279
  if (err) {
277
280
  var summary = err.status ? String(err.status) : "Error";
278
- var detail = (err.error && err.error.message) || err.statusText || err.message || "Error";
279
- if (err.status === 401) {
281
+ var detail = ((_a = err.error) === null || _a === void 0 ? void 0 : _a.message) || err.statusText || err.message;
282
+ if (err.status === HTTP_UNAUTHORIZED_CODE) {
280
283
  var prefix = _this.projectConfigs.getTranslationPrefix();
281
284
  summary = _this.translate.instant(prefix + ".error_unauthorized_title");
282
285
  detail = _this.translate.instant(prefix + ".error_unauthorized_description");
@@ -284,14 +287,14 @@
284
287
  _this.messageService.add({
285
288
  severity: "error",
286
289
  summary: summary,
287
- detail: detail
290
+ detail: detail || "Error"
288
291
  });
289
292
  }
290
293
  return rxjs.throwError(err);
291
294
  });
292
295
  };
293
296
  LogicalDeleteService.prototype.getListQueryParams = function (listParams) {
294
- 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;
297
+ 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;
295
298
  var params = new http.HttpParams();
296
299
  params = params.append("size", String(size));
297
300
  params = params.append("offset", String(page));
@@ -313,10 +316,22 @@
313
316
  }
314
317
  return params;
315
318
  };
316
- LogicalDeleteService.prototype.getProcessDetails = function (recordId) {
317
- var filterParams = {
318
- filter: "recordId eq '" + recordId + "'"
319
- };
319
+ LogicalDeleteService.prototype.getProcessDetails = function (id) {
320
+ return this.doGetProcessDetails({
321
+ filter: "id eq '" + id + "'",
322
+ size: "1",
323
+ offset: "0",
324
+ });
325
+ };
326
+ LogicalDeleteService.prototype.getLatestProcessDetails = function (recordId) {
327
+ return this.doGetProcessDetails({
328
+ filter: "recordId eq '" + recordId + "'",
329
+ size: "1",
330
+ offset: "0",
331
+ orderby: "startDate desc"
332
+ });
333
+ };
334
+ LogicalDeleteService.prototype.doGetProcessDetails = function (filterParams) {
320
335
  return this.http.get(this.exclusionProcessUrl, { params: filterParams })
321
336
  .pipe(this.defaultCatch())
322
337
  .pipe(operators.map(function (value) {
@@ -420,8 +435,9 @@
420
435
  this.processDetails = null;
421
436
  this._entityName = details.entityName;
422
437
  this._isVisible = true;
438
+ this._processSummaryData = [];
423
439
  this.entityDescription = details.entityDescription;
424
- this.loadProcessDetails(details.recordId);
440
+ this.loadProcessDetails(details);
425
441
  };
426
442
  ExclusionDetailsComponent.prototype.closeDetails = function () {
427
443
  this._isVisible = false;
@@ -477,6 +493,12 @@
477
493
  ExclusionDetailsComponent.prototype.getSidebarTitle = function () {
478
494
  return this.translate.instant(this.projectConfigs.getTranslationPrefix() + ".logical_delete_details_title");
479
495
  };
496
+ ExclusionDetailsComponent.prototype.getEmptyStateTitle = function () {
497
+ return this.translate.instant(this.projectConfigs.getTranslationPrefix() + ".logical_delete_empty_state_title");
498
+ };
499
+ ExclusionDetailsComponent.prototype.getEmptyStateDescription = function () {
500
+ return this.translate.instant(this.projectConfigs.getTranslationPrefix() + ".logical_delete_empty_state_description");
501
+ };
480
502
  ExclusionDetailsComponent.prototype.getSummaryColumns = function () {
481
503
  return [
482
504
  {
@@ -525,10 +547,13 @@
525
547
  }
526
548
  return null;
527
549
  };
528
- ExclusionDetailsComponent.prototype.loadProcessDetails = function (recordId) {
550
+ ExclusionDetailsComponent.prototype.loadProcessDetails = function (details) {
529
551
  var _this = this;
530
552
  this._isLoading = true;
531
- this.logicalDeleteService.getProcessDetails(recordId)
553
+ var processObservable = details.processId
554
+ ? this.logicalDeleteService.getProcessDetails(details.processId)
555
+ : this.logicalDeleteService.getLatestProcessDetails(details.recordId);
556
+ processObservable
532
557
  .pipe(operators.takeUntil(this.ngUnsubscribe))
533
558
  .pipe(operators.finalize(function () { return _this._isLoading = false; }))
534
559
  .subscribe(function (process) {
@@ -576,7 +601,7 @@
576
601
  ExclusionDetailsComponent = __decorate([
577
602
  core.Component({
578
603
  selector: "s-exclusion-details",
579
- 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",
604
+ 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\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",
580
605
  encapsulation: core.ViewEncapsulation.None,
581
606
  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}"]
582
607
  })
@@ -597,7 +622,8 @@
597
622
  table.TableModule,
598
623
  angularComponents.TableModule,
599
624
  angularComponents.LoadingStateModule,
600
- angularComponents.LocaleModule
625
+ angularComponents.LocaleModule,
626
+ angularComponents.EmptyStateModule
601
627
  ],
602
628
  declarations: [ExclusionDetailsComponent],
603
629
  exports: [ExclusionDetailsComponent],
@@ -678,6 +704,9 @@
678
704
  ? this.translate.instant(this.logicalDeleteConfigService.getTranslationPrefix() + ".list_grid_boolean_true")
679
705
  : this.translate.instant(this.logicalDeleteConfigService.getTranslationPrefix() + ".list_grid_boolean_false");
680
706
  break;
707
+ default:
708
+ labelValue = value;
709
+ break;
681
710
  }
682
711
  return { id: name, label: label + ": " + labelValue };
683
712
  };
@@ -709,6 +738,8 @@
709
738
  return FilterService;
710
739
  }());
711
740
 
741
+ var HTTP_CODE_SERVER_ERROR_START = 500;
742
+ var HTTP_CODE_SERVER_ERROR_END = 600;
712
743
  var ExclusionsListComponent = /** @class */ (function () {
713
744
  function ExclusionsListComponent(route, translate, formBuilder, changeDetectorRef, logicalDeleteService, filterService, projectConfigs) {
714
745
  this.route = route;
@@ -740,13 +771,25 @@
740
771
  .pipe(operators.takeUntil(this.ngUnsubscribe))
741
772
  .subscribe(function (params) {
742
773
  _this.entityName = params.entityName;
774
+ _this.showBasedOnRoute();
743
775
  });
744
776
  this.route.queryParams
745
777
  .pipe(operators.takeUntil(this.ngUnsubscribe))
746
778
  .subscribe(function (queryParams) {
747
779
  _this.entityDescription = queryParams.entityDescription;
780
+ _this.processId = queryParams.processId;
781
+ _this.showBasedOnRoute();
748
782
  });
749
783
  };
784
+ ExclusionsListComponent.prototype.showBasedOnRoute = function () {
785
+ if (this.entityName && this.entityDescription && this.processId) {
786
+ this.exclusionDetailsComponent.showDetails({
787
+ processId: this.processId,
788
+ entityDescription: this.entityDescription,
789
+ entityName: this.entityName
790
+ });
791
+ }
792
+ };
750
793
  ExclusionsListComponent.prototype.ngOnDestroy = function () {
751
794
  this.ngUnsubscribe.next();
752
795
  this.ngUnsubscribe.complete();
@@ -754,7 +797,7 @@
754
797
  ExclusionsListComponent.prototype.getFormBuilder = function () {
755
798
  return this.formBuilder.group({
756
799
  description: [undefined, forms.Validators.compose([])],
757
- state: [undefined, forms.Validators.compose([])],
800
+ status: [undefined, forms.Validators.compose([])],
758
801
  startDate: [{ value: undefined, disabled: false }, forms.Validators.compose([])],
759
802
  endDate: [{ value: undefined, disabled: false }, forms.Validators.compose([])]
760
803
  });
@@ -763,21 +806,21 @@
763
806
  return [
764
807
  {
765
808
  field: "description",
766
- attributes: ['description'],
809
+ attributes: ["description"],
767
810
  header: this.translate.instant(this.projectConfigs.getTranslationPrefix() + ".logical_delete_description"),
768
811
  type: angularComponents.EnumColumnFieldType.STRING,
769
812
  style: {
770
- width: '300px'
813
+ width: "300px"
771
814
  }
772
815
  },
773
816
  {
774
817
  field: "status",
775
- attributes: ['status'],
818
+ attributes: ["status"],
776
819
  header: this.translate.instant(this.projectConfigs.getTranslationPrefix() + ".logical_delete_status"),
777
820
  type: angularComponents.EnumColumnFieldType.ENUM,
778
821
  enumPrefix: this.projectConfigs.getTranslationPrefix() + ".logical_delete_enum_exclusion_process_status_",
779
822
  style: {
780
- width: '100px'
823
+ width: "100px"
781
824
  },
782
825
  badgeConfigs: [
783
826
  {
@@ -800,54 +843,55 @@
800
843
  },
801
844
  {
802
845
  field: "startDate",
803
- attributes: ['startDate'],
846
+ attributes: ["startDate"],
804
847
  header: this.translate.instant(this.projectConfigs.getTranslationPrefix() + ".logical_delete_start"),
805
848
  type: angularComponents.EnumColumnFieldType.DATE,
806
849
  dateFormat: "DD/MM/YYYY HH:mm",
807
850
  style: {
808
- width: '100px'
851
+ width: "100px"
809
852
  }
810
853
  },
811
854
  {
812
855
  field: "finishDate",
813
- attributes: ['finishDate'],
856
+ attributes: ["finishDate"],
814
857
  header: this.translate.instant(this.projectConfigs.getTranslationPrefix() + ".logical_delete_finish"),
815
858
  type: angularComponents.EnumColumnFieldType.DATE,
816
859
  dateFormat: "DD/MM/YYYY HH:mm",
817
860
  style: {
818
- width: '100px'
861
+ width: "100px"
819
862
  }
820
863
  }
821
864
  ];
822
865
  };
823
866
  ExclusionsListComponent.prototype.getFilterFields = function () {
867
+ var translationPrefix = this.projectConfigs.getTranslationPrefix();
824
868
  return [
825
869
  new angularComponents.FormField({
826
870
  type: angularComponents.FieldType.String,
827
871
  name: "description",
828
- label: this.translate.instant(this.projectConfigs.getTranslationPrefix() + ".logical_delete_description")
872
+ label: this.translate.instant(translationPrefix + ".logical_delete_description")
829
873
  }),
830
874
  new angularComponents.FormField({
831
875
  type: angularComponents.FieldType.Enum,
832
- name: "state",
833
- label: this.translate.instant(this.projectConfigs.getTranslationPrefix() + ".logical_delete_status"),
834
- placeholder: this.translate.instant(this.projectConfigs.getTranslationPrefix() + ".logical_delete_status"),
876
+ name: "status",
877
+ label: this.translate.instant(translationPrefix + ".logical_delete_status"),
878
+ placeholder: this.translate.instant(translationPrefix + ".logical_delete_status"),
835
879
  multiple: true,
836
880
  options: [
837
881
  {
838
- label: this.translate.instant(this.projectConfigs.getTranslationPrefix() + ".logical_delete_enum_exclusion_process_status_error"),
882
+ label: this.translate.instant(translationPrefix + ".logical_delete_enum_exclusion_process_status_error"),
839
883
  value: EnumExclusionProcessStatus.ERROR
840
884
  },
841
885
  {
842
- label: this.translate.instant(this.projectConfigs.getTranslationPrefix() + ".logical_delete_enum_exclusion_process_status_pending"),
886
+ label: this.translate.instant(translationPrefix + ".logical_delete_enum_exclusion_process_status_pending"),
843
887
  value: EnumExclusionProcessStatus.PENDING
844
888
  },
845
889
  {
846
- label: this.translate.instant(this.projectConfigs.getTranslationPrefix() + ".logical_delete_enum_exclusion_process_status_processing"),
890
+ label: this.translate.instant(translationPrefix + ".logical_delete_enum_exclusion_process_status_processing"),
847
891
  value: EnumExclusionProcessStatus.PROCESSING
848
892
  },
849
893
  {
850
- label: this.translate.instant(this.projectConfigs.getTranslationPrefix() + ".logical_delete_enum_exclusion_process_status_success"),
894
+ label: this.translate.instant(translationPrefix + ".logical_delete_enum_exclusion_process_status_success"),
851
895
  value: EnumExclusionProcessStatus.SUCCESS
852
896
  }
853
897
  ]
@@ -855,12 +899,12 @@
855
899
  new angularComponents.FormField({
856
900
  type: angularComponents.FieldType.Date,
857
901
  name: "startDate",
858
- label: this.translate.instant(this.projectConfigs.getTranslationPrefix() + ".logical_delete_start")
902
+ label: this.translate.instant(translationPrefix + ".logical_delete_start")
859
903
  }),
860
904
  new angularComponents.FormField({
861
905
  type: angularComponents.FieldType.Date,
862
906
  name: "endDate",
863
- label: this.translate.instant(this.projectConfigs.getTranslationPrefix() + ".logical_delete_finish")
907
+ label: this.translate.instant(translationPrefix + ".logical_delete_finish")
864
908
  })
865
909
  ];
866
910
  };
@@ -876,6 +920,27 @@
876
920
  ExclusionsListComponent.prototype.getDetailsButtonTitle = function () {
877
921
  return this.translate.instant(this.projectConfigs.getTranslationPrefix() + ".logical_delete_details");
878
922
  };
923
+ ExclusionsListComponent.prototype.getFiltersTitle = function () {
924
+ return this.translate.instant(this.projectConfigs.getTranslationPrefix() + ".filters");
925
+ };
926
+ ExclusionsListComponent.prototype.getFilterButtonTitle = function () {
927
+ return this.translate.instant(this.projectConfigs.getTranslationPrefix() + ".filter");
928
+ };
929
+ ExclusionsListComponent.prototype.getClearButtonTitle = function () {
930
+ return this.translate.instant(this.projectConfigs.getTranslationPrefix() + ".clear");
931
+ };
932
+ ExclusionsListComponent.prototype.getErrorInvalid = function () {
933
+ return this.translate.instant(this.projectConfigs.getTranslationPrefix() + ".error_invalid");
934
+ };
935
+ ExclusionsListComponent.prototype.getErrorServerTitle = function () {
936
+ return this.translate.instant(this.projectConfigs.getTranslationPrefix() + ".error_server_title");
937
+ };
938
+ ExclusionsListComponent.prototype.getErrorServerDescription = function () {
939
+ return this.translate.instant(this.projectConfigs.getTranslationPrefix() + ".error_server_description");
940
+ };
941
+ ExclusionsListComponent.prototype.getActionsColumnLabel = function () {
942
+ return this.translate.instant(this.projectConfigs.getTranslationPrefix() + ".actions");
943
+ };
879
944
  ExclusionsListComponent.prototype.onSearch = function () {
880
945
  var filterData = this.filterFormGroup.getRawValue();
881
946
  this.filtersPanelCollapsed = true;
@@ -903,14 +968,14 @@
903
968
  return this.filterFields
904
969
  .filter(function (_a) {
905
970
  var name = _a.name;
906
- return filterData[name] != undefined && filterData[name] !== "";
971
+ return filterData[name] !== undefined && filterData[name] !== "" && filterData[name] !== null;
907
972
  })
908
973
  .map(function (formField) { return _this.filterService.createFilterTokens(formField, filterData[formField.name]); });
909
974
  };
910
975
  ExclusionsListComponent.prototype.getFilterQuery = function () {
911
976
  var _this = this;
912
977
  var filterData = this.currentListParams.filterData;
913
- var dateFields = ['startDate', 'endDate'];
978
+ var dateFields = ["startDate", "endDate"];
914
979
  var filterQuery = this.filterFields
915
980
  .filter(function (_a) {
916
981
  var name = _a.name;
@@ -918,20 +983,29 @@
918
983
  })
919
984
  .filter(function (_a) {
920
985
  var name = _a.name;
921
- return filterData[name] != undefined;
986
+ return filterData[name] !== undefined && filterData[name] !== "" && filterData[name] !== null;
922
987
  })
923
988
  .map(function (formField) { return _this.filterService.createFilterString(formField, filterData[formField.name]); })
924
989
  .join(" and ");
990
+ var dateQuery;
925
991
  if (filterData.startDate && filterData.endDate) {
926
- var startDate = moment(filterData.startDate).format('YYYY-MM-DD');
927
- var endDate = moment(filterData.endDate).format('YYYY-MM-DD');
928
- var dateQuery = "startDate between '" + startDate + "' and '" + endDate + "'";
929
- if (filterQuery) {
930
- filterQuery += " and " + dateQuery;
931
- }
932
- else {
933
- filterQuery = dateQuery;
934
- }
992
+ var startDate = moment(filterData.startDate).format("YYYY-MM-DD");
993
+ var endDate = moment(filterData.endDate).format("YYYY-MM-DD");
994
+ dateQuery = "startDate between '" + startDate + "T00:00:00Z' and '" + endDate + "T23:59:59Z'";
995
+ }
996
+ else if (filterData.startDate) {
997
+ var startDate = moment(filterData.startDate).format("YYYY-MM-DD");
998
+ dateQuery = "startDate >= '" + startDate + "T00:00:00Z'";
999
+ }
1000
+ else if (filterData.endDate) {
1001
+ var endDate = moment(filterData.endDate).format("YYYY-MM-DD");
1002
+ dateQuery = "finishDate <= '" + endDate + "T23:59:59Z'";
1003
+ }
1004
+ else {
1005
+ // Não é necessário nenhuma condição a mais no filtro.
1006
+ }
1007
+ if (dateQuery) {
1008
+ filterQuery += filterQuery ? " and " + dateQuery : dateQuery;
935
1009
  }
936
1010
  return filterQuery;
937
1011
  };
@@ -942,7 +1016,7 @@
942
1016
  this.searchTokens = this.getFilterTokens();
943
1017
  var filterQuery = this.getFilterQuery();
944
1018
  var displayFields = __spread([
945
- 'recordId'
1019
+ "recordId"
946
1020
  ], this.gridColumns.map(function (column) { return column.field; }));
947
1021
  this.listExclusions({ page: page, size: size, sort: sort, filterQuery: filterQuery, displayFields: displayFields });
948
1022
  };
@@ -954,7 +1028,7 @@
954
1028
  this.logicalDeleteService
955
1029
  .listExclusions(this.entityName, params)
956
1030
  .pipe(operators.takeUntil(this.ngUnsubscribe), operators.catchError(function (err) {
957
- if (err.status >= 500 && err.status < 600) {
1031
+ if (err.status >= HTTP_CODE_SERVER_ERROR_START && err.status < HTTP_CODE_SERVER_ERROR_END) {
958
1032
  _this.serverError = true;
959
1033
  }
960
1034
  throw err;
@@ -971,14 +1045,15 @@
971
1045
  }
972
1046
  };
973
1047
  ExclusionsListComponent.prototype.resetGrid = function (listParams) {
974
- if (listParams)
1048
+ if (listParams) {
975
1049
  this.currentListParams = __assign(__assign({}, this.currentListParams), listParams);
1050
+ }
976
1051
  this.currentListParams = __assign(__assign({}, this.currentListParams), { page: 0, sort: [] });
977
1052
  this.table.reset();
978
1053
  };
979
1054
  ExclusionsListComponent.prototype.onClickDetails = function (rowData) {
980
1055
  this.exclusionDetailsComponent.showDetails({
981
- recordId: rowData.recordId,
1056
+ processId: rowData.id,
982
1057
  entityDescription: this.entityDescription,
983
1058
  entityName: this.entityName
984
1059
  });
@@ -1000,7 +1075,7 @@
1000
1075
  ], ExclusionsListComponent.prototype, "exclusionDetailsComponent", void 0);
1001
1076
  ExclusionsListComponent = __decorate([
1002
1077
  core.Component({
1003
- 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 {{ 'filters' | translate }}\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: 'error_invalid' | translate }\"\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]=\"'filter' | translate\"\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]=\"'clear' | translate\"\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=\"{{ 'error_server_title' | translate }}\"\n primaryActionLabel=\"{{ 'error_server_try_again' | translate }}\"\n (primaryAction)=\"resetGrid()\"\n description=\"{{ 'error_server_description' | 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\">{{'A\u00E7\u00F5es'}}</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>",
1078
+ 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",
1004
1079
  providers: []
1005
1080
  })
1006
1081
  ], ExclusionsListComponent);