@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.
- package/bundles/seniorsistemas-exclusion-process-component.umd.js +124 -49
- package/bundles/seniorsistemas-exclusion-process-component.umd.js.map +1 -1
- package/bundles/seniorsistemas-exclusion-process-component.umd.min.js +1 -1
- package/bundles/seniorsistemas-exclusion-process-component.umd.min.js.map +1 -1
- package/esm2015/exclusion-details/exclusion-details.component.js +15 -5
- package/esm2015/exclusion-details/exclusion-details.module.js +4 -3
- package/esm2015/exclusion-details/protocols/show-details-information.js +1 -1
- package/esm2015/exclusions-list/exclusions-list.component.js +96 -50
- package/esm2015/services/filter.service.js +4 -1
- package/esm2015/services/logical-delete.service.js +24 -9
- package/esm5/exclusion-details/exclusion-details.component.js +15 -5
- package/esm5/exclusion-details/exclusion-details.module.js +4 -3
- package/esm5/exclusion-details/protocols/show-details-information.js +1 -1
- package/esm5/exclusions-list/exclusions-list.component.js +96 -50
- package/esm5/services/filter.service.js +4 -1
- package/esm5/services/logical-delete.service.js +24 -9
- package/exclusion-details/exclusion-details.component.d.ts +2 -0
- package/exclusion-details/protocols/show-details-information.d.ts +2 -1
- package/exclusions-list/exclusions-list.component.d.ts +23 -14
- package/fesm2015/seniorsistemas-exclusion-process-component.js +125 -50
- package/fesm2015/seniorsistemas-exclusion-process-component.js.map +1 -1
- package/fesm5/seniorsistemas-exclusion-process-component.js +125 -50
- package/fesm5/seniorsistemas-exclusion-process-component.js.map +1 -1
- package/package.json +1 -1
- package/seniorsistemas-exclusion-process-component.metadata.json +1 -1
- package/services/logical-delete.service.d.ts +5 -3
|
@@ -3,7 +3,7 @@ import { CommonModule } from '@angular/common';
|
|
|
3
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, FormField, LocaleService, ControlErrorsModule, InfoSignModule,
|
|
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
8
|
import { Router, ActivatedRoute, RouterModule } from '@angular/router';
|
|
9
9
|
import { throwError, Subject } from 'rxjs';
|
|
@@ -53,6 +53,8 @@ var LogicalDeleteConfigService = /** @class */ (function () {
|
|
|
53
53
|
return LogicalDeleteConfigService;
|
|
54
54
|
}());
|
|
55
55
|
|
|
56
|
+
var HTTP_UNAUTHORIZED_CODE = 401;
|
|
57
|
+
var DEFAULT_PAGE_SIZE = 10;
|
|
56
58
|
var LogicalDeleteService = /** @class */ (function () {
|
|
57
59
|
function LogicalDeleteService(http, messageService, translate, projectConfigs) {
|
|
58
60
|
this.http = http;
|
|
@@ -67,10 +69,11 @@ var LogicalDeleteService = /** @class */ (function () {
|
|
|
67
69
|
LogicalDeleteService.prototype.defaultCatch = function () {
|
|
68
70
|
var _this = this;
|
|
69
71
|
return catchError(function (err) {
|
|
72
|
+
var _a;
|
|
70
73
|
if (err) {
|
|
71
74
|
var summary = err.status ? String(err.status) : "Error";
|
|
72
|
-
var detail = (err.error
|
|
73
|
-
if (err.status ===
|
|
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) {
|
|
74
77
|
var prefix = _this.projectConfigs.getTranslationPrefix();
|
|
75
78
|
summary = _this.translate.instant(prefix + ".error_unauthorized_title");
|
|
76
79
|
detail = _this.translate.instant(prefix + ".error_unauthorized_description");
|
|
@@ -78,14 +81,14 @@ var LogicalDeleteService = /** @class */ (function () {
|
|
|
78
81
|
_this.messageService.add({
|
|
79
82
|
severity: "error",
|
|
80
83
|
summary: summary,
|
|
81
|
-
detail: detail
|
|
84
|
+
detail: detail || "Error"
|
|
82
85
|
});
|
|
83
86
|
}
|
|
84
87
|
return throwError(err);
|
|
85
88
|
});
|
|
86
89
|
};
|
|
87
90
|
LogicalDeleteService.prototype.getListQueryParams = function (listParams) {
|
|
88
|
-
var _a = listParams.page, page = _a === void 0 ? 0 : _a, _b = listParams.size, size = _b === void 0 ?
|
|
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;
|
|
89
92
|
var params = new HttpParams();
|
|
90
93
|
params = params.append("size", String(size));
|
|
91
94
|
params = params.append("offset", String(page));
|
|
@@ -107,10 +110,22 @@ var LogicalDeleteService = /** @class */ (function () {
|
|
|
107
110
|
}
|
|
108
111
|
return params;
|
|
109
112
|
};
|
|
110
|
-
LogicalDeleteService.prototype.getProcessDetails = function (
|
|
111
|
-
|
|
112
|
-
filter: "
|
|
113
|
-
|
|
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) {
|
|
114
129
|
return this.http.get(this.exclusionProcessUrl, { params: filterParams })
|
|
115
130
|
.pipe(this.defaultCatch())
|
|
116
131
|
.pipe(map(function (value) {
|
|
@@ -214,8 +229,9 @@ var ExclusionDetailsComponent = /** @class */ (function () {
|
|
|
214
229
|
this.processDetails = null;
|
|
215
230
|
this._entityName = details.entityName;
|
|
216
231
|
this._isVisible = true;
|
|
232
|
+
this._processSummaryData = [];
|
|
217
233
|
this.entityDescription = details.entityDescription;
|
|
218
|
-
this.loadProcessDetails(details
|
|
234
|
+
this.loadProcessDetails(details);
|
|
219
235
|
};
|
|
220
236
|
ExclusionDetailsComponent.prototype.closeDetails = function () {
|
|
221
237
|
this._isVisible = false;
|
|
@@ -271,6 +287,12 @@ var ExclusionDetailsComponent = /** @class */ (function () {
|
|
|
271
287
|
ExclusionDetailsComponent.prototype.getSidebarTitle = function () {
|
|
272
288
|
return this.translate.instant(this.projectConfigs.getTranslationPrefix() + ".logical_delete_details_title");
|
|
273
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
|
+
};
|
|
274
296
|
ExclusionDetailsComponent.prototype.getSummaryColumns = function () {
|
|
275
297
|
return [
|
|
276
298
|
{
|
|
@@ -319,10 +341,13 @@ var ExclusionDetailsComponent = /** @class */ (function () {
|
|
|
319
341
|
}
|
|
320
342
|
return null;
|
|
321
343
|
};
|
|
322
|
-
ExclusionDetailsComponent.prototype.loadProcessDetails = function (
|
|
344
|
+
ExclusionDetailsComponent.prototype.loadProcessDetails = function (details) {
|
|
323
345
|
var _this = this;
|
|
324
346
|
this._isLoading = true;
|
|
325
|
-
|
|
347
|
+
var processObservable = details.processId
|
|
348
|
+
? this.logicalDeleteService.getProcessDetails(details.processId)
|
|
349
|
+
: this.logicalDeleteService.getLatestProcessDetails(details.recordId);
|
|
350
|
+
processObservable
|
|
326
351
|
.pipe(takeUntil(this.ngUnsubscribe))
|
|
327
352
|
.pipe(finalize(function () { return _this._isLoading = false; }))
|
|
328
353
|
.subscribe(function (process) {
|
|
@@ -370,7 +395,7 @@ var ExclusionDetailsComponent = /** @class */ (function () {
|
|
|
370
395
|
ExclusionDetailsComponent = __decorate([
|
|
371
396
|
Component({
|
|
372
397
|
selector: "s-exclusion-details",
|
|
373
|
-
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\"
|
|
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 <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",
|
|
374
399
|
encapsulation: ViewEncapsulation.None,
|
|
375
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}"]
|
|
376
401
|
})
|
|
@@ -391,7 +416,8 @@ var ExclusionDetailsModule = /** @class */ (function () {
|
|
|
391
416
|
TableModule,
|
|
392
417
|
TableModule$1,
|
|
393
418
|
LoadingStateModule,
|
|
394
|
-
LocaleModule
|
|
419
|
+
LocaleModule,
|
|
420
|
+
EmptyStateModule
|
|
395
421
|
],
|
|
396
422
|
declarations: [ExclusionDetailsComponent],
|
|
397
423
|
exports: [ExclusionDetailsComponent],
|
|
@@ -472,6 +498,9 @@ var FilterService = /** @class */ (function () {
|
|
|
472
498
|
? this.translate.instant(this.logicalDeleteConfigService.getTranslationPrefix() + ".list_grid_boolean_true")
|
|
473
499
|
: this.translate.instant(this.logicalDeleteConfigService.getTranslationPrefix() + ".list_grid_boolean_false");
|
|
474
500
|
break;
|
|
501
|
+
default:
|
|
502
|
+
labelValue = value;
|
|
503
|
+
break;
|
|
475
504
|
}
|
|
476
505
|
return { id: name, label: label + ": " + labelValue };
|
|
477
506
|
};
|
|
@@ -503,6 +532,8 @@ var FilterService = /** @class */ (function () {
|
|
|
503
532
|
return FilterService;
|
|
504
533
|
}());
|
|
505
534
|
|
|
535
|
+
var HTTP_CODE_SERVER_ERROR_START = 500;
|
|
536
|
+
var HTTP_CODE_SERVER_ERROR_END = 600;
|
|
506
537
|
var ExclusionsListComponent = /** @class */ (function () {
|
|
507
538
|
function ExclusionsListComponent(route, translate, formBuilder, changeDetectorRef, logicalDeleteService, filterService, projectConfigs) {
|
|
508
539
|
this.route = route;
|
|
@@ -534,13 +565,25 @@ var ExclusionsListComponent = /** @class */ (function () {
|
|
|
534
565
|
.pipe(takeUntil(this.ngUnsubscribe))
|
|
535
566
|
.subscribe(function (params) {
|
|
536
567
|
_this.entityName = params.entityName;
|
|
568
|
+
_this.showBasedOnRoute();
|
|
537
569
|
});
|
|
538
570
|
this.route.queryParams
|
|
539
571
|
.pipe(takeUntil(this.ngUnsubscribe))
|
|
540
572
|
.subscribe(function (queryParams) {
|
|
541
573
|
_this.entityDescription = queryParams.entityDescription;
|
|
574
|
+
_this.processId = queryParams.processId;
|
|
575
|
+
_this.showBasedOnRoute();
|
|
542
576
|
});
|
|
543
577
|
};
|
|
578
|
+
ExclusionsListComponent.prototype.showBasedOnRoute = function () {
|
|
579
|
+
if (this.entityName && this.entityDescription && this.processId) {
|
|
580
|
+
this.exclusionDetailsComponent.showDetails({
|
|
581
|
+
processId: this.processId,
|
|
582
|
+
entityDescription: this.entityDescription,
|
|
583
|
+
entityName: this.entityName
|
|
584
|
+
});
|
|
585
|
+
}
|
|
586
|
+
};
|
|
544
587
|
ExclusionsListComponent.prototype.ngOnDestroy = function () {
|
|
545
588
|
this.ngUnsubscribe.next();
|
|
546
589
|
this.ngUnsubscribe.complete();
|
|
@@ -548,7 +591,7 @@ var ExclusionsListComponent = /** @class */ (function () {
|
|
|
548
591
|
ExclusionsListComponent.prototype.getFormBuilder = function () {
|
|
549
592
|
return this.formBuilder.group({
|
|
550
593
|
description: [undefined, Validators.compose([])],
|
|
551
|
-
|
|
594
|
+
status: [undefined, Validators.compose([])],
|
|
552
595
|
startDate: [{ value: undefined, disabled: false }, Validators.compose([])],
|
|
553
596
|
endDate: [{ value: undefined, disabled: false }, Validators.compose([])]
|
|
554
597
|
});
|
|
@@ -557,21 +600,21 @@ var ExclusionsListComponent = /** @class */ (function () {
|
|
|
557
600
|
return [
|
|
558
601
|
{
|
|
559
602
|
field: "description",
|
|
560
|
-
attributes: [
|
|
603
|
+
attributes: ["description"],
|
|
561
604
|
header: this.translate.instant(this.projectConfigs.getTranslationPrefix() + ".logical_delete_description"),
|
|
562
605
|
type: EnumColumnFieldType.STRING,
|
|
563
606
|
style: {
|
|
564
|
-
width:
|
|
607
|
+
width: "300px"
|
|
565
608
|
}
|
|
566
609
|
},
|
|
567
610
|
{
|
|
568
611
|
field: "status",
|
|
569
|
-
attributes: [
|
|
612
|
+
attributes: ["status"],
|
|
570
613
|
header: this.translate.instant(this.projectConfigs.getTranslationPrefix() + ".logical_delete_status"),
|
|
571
614
|
type: EnumColumnFieldType.ENUM,
|
|
572
615
|
enumPrefix: this.projectConfigs.getTranslationPrefix() + ".logical_delete_enum_exclusion_process_status_",
|
|
573
616
|
style: {
|
|
574
|
-
width:
|
|
617
|
+
width: "100px"
|
|
575
618
|
},
|
|
576
619
|
badgeConfigs: [
|
|
577
620
|
{
|
|
@@ -594,54 +637,55 @@ var ExclusionsListComponent = /** @class */ (function () {
|
|
|
594
637
|
},
|
|
595
638
|
{
|
|
596
639
|
field: "startDate",
|
|
597
|
-
attributes: [
|
|
640
|
+
attributes: ["startDate"],
|
|
598
641
|
header: this.translate.instant(this.projectConfigs.getTranslationPrefix() + ".logical_delete_start"),
|
|
599
642
|
type: EnumColumnFieldType.DATE,
|
|
600
643
|
dateFormat: "DD/MM/YYYY HH:mm",
|
|
601
644
|
style: {
|
|
602
|
-
width:
|
|
645
|
+
width: "100px"
|
|
603
646
|
}
|
|
604
647
|
},
|
|
605
648
|
{
|
|
606
649
|
field: "finishDate",
|
|
607
|
-
attributes: [
|
|
650
|
+
attributes: ["finishDate"],
|
|
608
651
|
header: this.translate.instant(this.projectConfigs.getTranslationPrefix() + ".logical_delete_finish"),
|
|
609
652
|
type: EnumColumnFieldType.DATE,
|
|
610
653
|
dateFormat: "DD/MM/YYYY HH:mm",
|
|
611
654
|
style: {
|
|
612
|
-
width:
|
|
655
|
+
width: "100px"
|
|
613
656
|
}
|
|
614
657
|
}
|
|
615
658
|
];
|
|
616
659
|
};
|
|
617
660
|
ExclusionsListComponent.prototype.getFilterFields = function () {
|
|
661
|
+
var translationPrefix = this.projectConfigs.getTranslationPrefix();
|
|
618
662
|
return [
|
|
619
663
|
new FormField({
|
|
620
664
|
type: FieldType.String,
|
|
621
665
|
name: "description",
|
|
622
|
-
label: this.translate.instant(
|
|
666
|
+
label: this.translate.instant(translationPrefix + ".logical_delete_description")
|
|
623
667
|
}),
|
|
624
668
|
new FormField({
|
|
625
669
|
type: FieldType.Enum,
|
|
626
|
-
name: "
|
|
627
|
-
label: this.translate.instant(
|
|
628
|
-
placeholder: this.translate.instant(
|
|
670
|
+
name: "status",
|
|
671
|
+
label: this.translate.instant(translationPrefix + ".logical_delete_status"),
|
|
672
|
+
placeholder: this.translate.instant(translationPrefix + ".logical_delete_status"),
|
|
629
673
|
multiple: true,
|
|
630
674
|
options: [
|
|
631
675
|
{
|
|
632
|
-
label: this.translate.instant(
|
|
676
|
+
label: this.translate.instant(translationPrefix + ".logical_delete_enum_exclusion_process_status_error"),
|
|
633
677
|
value: EnumExclusionProcessStatus.ERROR
|
|
634
678
|
},
|
|
635
679
|
{
|
|
636
|
-
label: this.translate.instant(
|
|
680
|
+
label: this.translate.instant(translationPrefix + ".logical_delete_enum_exclusion_process_status_pending"),
|
|
637
681
|
value: EnumExclusionProcessStatus.PENDING
|
|
638
682
|
},
|
|
639
683
|
{
|
|
640
|
-
label: this.translate.instant(
|
|
684
|
+
label: this.translate.instant(translationPrefix + ".logical_delete_enum_exclusion_process_status_processing"),
|
|
641
685
|
value: EnumExclusionProcessStatus.PROCESSING
|
|
642
686
|
},
|
|
643
687
|
{
|
|
644
|
-
label: this.translate.instant(
|
|
688
|
+
label: this.translate.instant(translationPrefix + ".logical_delete_enum_exclusion_process_status_success"),
|
|
645
689
|
value: EnumExclusionProcessStatus.SUCCESS
|
|
646
690
|
}
|
|
647
691
|
]
|
|
@@ -649,12 +693,12 @@ var ExclusionsListComponent = /** @class */ (function () {
|
|
|
649
693
|
new FormField({
|
|
650
694
|
type: FieldType.Date,
|
|
651
695
|
name: "startDate",
|
|
652
|
-
label: this.translate.instant(
|
|
696
|
+
label: this.translate.instant(translationPrefix + ".logical_delete_start")
|
|
653
697
|
}),
|
|
654
698
|
new FormField({
|
|
655
699
|
type: FieldType.Date,
|
|
656
700
|
name: "endDate",
|
|
657
|
-
label: this.translate.instant(
|
|
701
|
+
label: this.translate.instant(translationPrefix + ".logical_delete_finish")
|
|
658
702
|
})
|
|
659
703
|
];
|
|
660
704
|
};
|
|
@@ -670,6 +714,27 @@ var ExclusionsListComponent = /** @class */ (function () {
|
|
|
670
714
|
ExclusionsListComponent.prototype.getDetailsButtonTitle = function () {
|
|
671
715
|
return this.translate.instant(this.projectConfigs.getTranslationPrefix() + ".logical_delete_details");
|
|
672
716
|
};
|
|
717
|
+
ExclusionsListComponent.prototype.getFiltersTitle = function () {
|
|
718
|
+
return this.translate.instant(this.projectConfigs.getTranslationPrefix() + ".filters");
|
|
719
|
+
};
|
|
720
|
+
ExclusionsListComponent.prototype.getFilterButtonTitle = function () {
|
|
721
|
+
return this.translate.instant(this.projectConfigs.getTranslationPrefix() + ".filter");
|
|
722
|
+
};
|
|
723
|
+
ExclusionsListComponent.prototype.getClearButtonTitle = function () {
|
|
724
|
+
return this.translate.instant(this.projectConfigs.getTranslationPrefix() + ".clear");
|
|
725
|
+
};
|
|
726
|
+
ExclusionsListComponent.prototype.getErrorInvalid = function () {
|
|
727
|
+
return this.translate.instant(this.projectConfigs.getTranslationPrefix() + ".error_invalid");
|
|
728
|
+
};
|
|
729
|
+
ExclusionsListComponent.prototype.getErrorServerTitle = function () {
|
|
730
|
+
return this.translate.instant(this.projectConfigs.getTranslationPrefix() + ".error_server_title");
|
|
731
|
+
};
|
|
732
|
+
ExclusionsListComponent.prototype.getErrorServerDescription = function () {
|
|
733
|
+
return this.translate.instant(this.projectConfigs.getTranslationPrefix() + ".error_server_description");
|
|
734
|
+
};
|
|
735
|
+
ExclusionsListComponent.prototype.getActionsColumnLabel = function () {
|
|
736
|
+
return this.translate.instant(this.projectConfigs.getTranslationPrefix() + ".actions");
|
|
737
|
+
};
|
|
673
738
|
ExclusionsListComponent.prototype.onSearch = function () {
|
|
674
739
|
var filterData = this.filterFormGroup.getRawValue();
|
|
675
740
|
this.filtersPanelCollapsed = true;
|
|
@@ -697,14 +762,14 @@ var ExclusionsListComponent = /** @class */ (function () {
|
|
|
697
762
|
return this.filterFields
|
|
698
763
|
.filter(function (_a) {
|
|
699
764
|
var name = _a.name;
|
|
700
|
-
return filterData[name]
|
|
765
|
+
return filterData[name] !== undefined && filterData[name] !== "" && filterData[name] !== null;
|
|
701
766
|
})
|
|
702
767
|
.map(function (formField) { return _this.filterService.createFilterTokens(formField, filterData[formField.name]); });
|
|
703
768
|
};
|
|
704
769
|
ExclusionsListComponent.prototype.getFilterQuery = function () {
|
|
705
770
|
var _this = this;
|
|
706
771
|
var filterData = this.currentListParams.filterData;
|
|
707
|
-
var dateFields = [
|
|
772
|
+
var dateFields = ["startDate", "endDate"];
|
|
708
773
|
var filterQuery = this.filterFields
|
|
709
774
|
.filter(function (_a) {
|
|
710
775
|
var name = _a.name;
|
|
@@ -712,20 +777,29 @@ var ExclusionsListComponent = /** @class */ (function () {
|
|
|
712
777
|
})
|
|
713
778
|
.filter(function (_a) {
|
|
714
779
|
var name = _a.name;
|
|
715
|
-
return filterData[name]
|
|
780
|
+
return filterData[name] !== undefined && filterData[name] !== "" && filterData[name] !== null;
|
|
716
781
|
})
|
|
717
782
|
.map(function (formField) { return _this.filterService.createFilterString(formField, filterData[formField.name]); })
|
|
718
783
|
.join(" and ");
|
|
784
|
+
var dateQuery;
|
|
719
785
|
if (filterData.startDate && filterData.endDate) {
|
|
720
|
-
var startDate = moment(filterData.startDate).format(
|
|
721
|
-
var endDate = moment(filterData.endDate).format(
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
786
|
+
var startDate = moment(filterData.startDate).format("YYYY-MM-DD");
|
|
787
|
+
var endDate = moment(filterData.endDate).format("YYYY-MM-DD");
|
|
788
|
+
dateQuery = "startDate between '" + startDate + "T00:00:00Z' and '" + endDate + "T23:59:59Z'";
|
|
789
|
+
}
|
|
790
|
+
else if (filterData.startDate) {
|
|
791
|
+
var startDate = moment(filterData.startDate).format("YYYY-MM-DD");
|
|
792
|
+
dateQuery = "startDate >= '" + startDate + "T00:00:00Z'";
|
|
793
|
+
}
|
|
794
|
+
else if (filterData.endDate) {
|
|
795
|
+
var endDate = moment(filterData.endDate).format("YYYY-MM-DD");
|
|
796
|
+
dateQuery = "finishDate <= '" + endDate + "T23:59:59Z'";
|
|
797
|
+
}
|
|
798
|
+
else {
|
|
799
|
+
// Não é necessário nenhuma condição a mais no filtro.
|
|
800
|
+
}
|
|
801
|
+
if (dateQuery) {
|
|
802
|
+
filterQuery += filterQuery ? " and " + dateQuery : dateQuery;
|
|
729
803
|
}
|
|
730
804
|
return filterQuery;
|
|
731
805
|
};
|
|
@@ -736,7 +810,7 @@ var ExclusionsListComponent = /** @class */ (function () {
|
|
|
736
810
|
this.searchTokens = this.getFilterTokens();
|
|
737
811
|
var filterQuery = this.getFilterQuery();
|
|
738
812
|
var displayFields = __spread([
|
|
739
|
-
|
|
813
|
+
"recordId"
|
|
740
814
|
], this.gridColumns.map(function (column) { return column.field; }));
|
|
741
815
|
this.listExclusions({ page: page, size: size, sort: sort, filterQuery: filterQuery, displayFields: displayFields });
|
|
742
816
|
};
|
|
@@ -748,7 +822,7 @@ var ExclusionsListComponent = /** @class */ (function () {
|
|
|
748
822
|
this.logicalDeleteService
|
|
749
823
|
.listExclusions(this.entityName, params)
|
|
750
824
|
.pipe(takeUntil(this.ngUnsubscribe), catchError(function (err) {
|
|
751
|
-
if (err.status >=
|
|
825
|
+
if (err.status >= HTTP_CODE_SERVER_ERROR_START && err.status < HTTP_CODE_SERVER_ERROR_END) {
|
|
752
826
|
_this.serverError = true;
|
|
753
827
|
}
|
|
754
828
|
throw err;
|
|
@@ -765,14 +839,15 @@ var ExclusionsListComponent = /** @class */ (function () {
|
|
|
765
839
|
}
|
|
766
840
|
};
|
|
767
841
|
ExclusionsListComponent.prototype.resetGrid = function (listParams) {
|
|
768
|
-
if (listParams)
|
|
842
|
+
if (listParams) {
|
|
769
843
|
this.currentListParams = __assign(__assign({}, this.currentListParams), listParams);
|
|
844
|
+
}
|
|
770
845
|
this.currentListParams = __assign(__assign({}, this.currentListParams), { page: 0, sort: [] });
|
|
771
846
|
this.table.reset();
|
|
772
847
|
};
|
|
773
848
|
ExclusionsListComponent.prototype.onClickDetails = function (rowData) {
|
|
774
849
|
this.exclusionDetailsComponent.showDetails({
|
|
775
|
-
|
|
850
|
+
processId: rowData.id,
|
|
776
851
|
entityDescription: this.entityDescription,
|
|
777
852
|
entityName: this.entityName
|
|
778
853
|
});
|
|
@@ -794,7 +869,7 @@ var ExclusionsListComponent = /** @class */ (function () {
|
|
|
794
869
|
], ExclusionsListComponent.prototype, "exclusionDetailsComponent", void 0);
|
|
795
870
|
ExclusionsListComponent = __decorate([
|
|
796
871
|
Component({
|
|
797
|
-
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 {{
|
|
872
|
+
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",
|
|
798
873
|
providers: []
|
|
799
874
|
})
|
|
800
875
|
], ExclusionsListComponent);
|