@seniorsistemas/exclusion-process-component 0.0.1-40efacd8-8a6c-4d38-8102-8c977c14410a
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 +1205 -0
- package/bundles/seniorsistemas-exclusion-process-component.umd.js.map +1 -0
- package/bundles/seniorsistemas-exclusion-process-component.umd.min.js +16 -0
- package/bundles/seniorsistemas-exclusion-process-component.umd.min.js.map +1 -0
- package/enums/enum-exclusion-process-status.d.ts +6 -0
- package/esm2015/enums/enum-exclusion-process-status.js +8 -0
- package/esm2015/exclusion-details/exclusion-details.component.js +216 -0
- package/esm2015/exclusion-details/exclusion-details.module.js +28 -0
- package/esm2015/exclusion-details/index.js +3 -0
- package/esm2015/exclusion-details/protocols/exclusion-details.js +1 -0
- package/esm2015/exclusion-details/protocols/index.js +2 -0
- package/esm2015/exclusion-details/protocols/show-details-information.js +3 -0
- package/esm2015/exclusions-list/exclusions-list.component.js +299 -0
- package/esm2015/exclusions-list/exclusions-list.module.js +47 -0
- package/esm2015/exclusions-list/exclusions-list.routing.js +115 -0
- package/esm2015/exclusions-list/index.js +4 -0
- package/esm2015/logical-delete.module.js +27 -0
- package/esm2015/models/exclusion-process-step-group.js +1 -0
- package/esm2015/models/exclusion-process-step.js +1 -0
- package/esm2015/models/exclusion-process.js +1 -0
- package/esm2015/models/index.js +1 -0
- package/esm2015/models/list-params.js +1 -0
- package/esm2015/models/list-result.js +1 -0
- package/esm2015/models/project-config.js +3 -0
- package/esm2015/public-api.js +4 -0
- package/esm2015/seniorsistemas-exclusion-process-component.js +11 -0
- package/esm2015/services/filter.service.js +104 -0
- package/esm2015/services/index.js +2 -0
- package/esm2015/services/logical-delete-config.service.js +29 -0
- package/esm2015/services/logical-delete.service.js +109 -0
- package/esm5/enums/enum-exclusion-process-status.js +8 -0
- package/esm5/exclusion-details/exclusion-details.component.js +235 -0
- package/esm5/exclusion-details/exclusion-details.module.js +31 -0
- package/esm5/exclusion-details/index.js +3 -0
- package/esm5/exclusion-details/protocols/exclusion-details.js +1 -0
- package/esm5/exclusion-details/protocols/index.js +2 -0
- package/esm5/exclusion-details/protocols/show-details-information.js +7 -0
- package/esm5/exclusions-list/exclusions-list.component.js +313 -0
- package/esm5/exclusions-list/exclusions-list.module.js +50 -0
- package/esm5/exclusions-list/exclusions-list.routing.js +127 -0
- package/esm5/exclusions-list/index.js +4 -0
- package/esm5/logical-delete.module.js +31 -0
- package/esm5/models/exclusion-process-step-group.js +1 -0
- package/esm5/models/exclusion-process-step.js +1 -0
- package/esm5/models/exclusion-process.js +1 -0
- package/esm5/models/index.js +1 -0
- package/esm5/models/list-params.js +1 -0
- package/esm5/models/list-result.js +1 -0
- package/esm5/models/project-config.js +3 -0
- package/esm5/public-api.js +4 -0
- package/esm5/seniorsistemas-exclusion-process-component.js +11 -0
- package/esm5/services/filter.service.js +109 -0
- package/esm5/services/index.js +2 -0
- package/esm5/services/logical-delete-config.service.js +30 -0
- package/esm5/services/logical-delete.service.js +112 -0
- package/exclusion-details/exclusion-details.component.d.ts +49 -0
- package/exclusion-details/exclusion-details.module.d.ts +2 -0
- package/exclusion-details/index.d.ts +2 -0
- package/exclusion-details/protocols/exclusion-details.d.ts +6 -0
- package/exclusion-details/protocols/index.d.ts +2 -0
- package/exclusion-details/protocols/show-details-information.d.ts +5 -0
- package/exclusions-list/exclusions-list.component.d.ts +59 -0
- package/exclusions-list/exclusions-list.module.d.ts +2 -0
- package/exclusions-list/exclusions-list.routing.d.ts +29 -0
- package/exclusions-list/index.d.ts +3 -0
- package/fesm2015/seniorsistemas-exclusion-process-component.js +917 -0
- package/fesm2015/seniorsistemas-exclusion-process-component.js.map +1 -0
- package/fesm5/seniorsistemas-exclusion-process-component.js +981 -0
- package/fesm5/seniorsistemas-exclusion-process-component.js.map +1 -0
- package/logical-delete.module.d.ts +5 -0
- package/models/exclusion-process-step-group.d.ts +13 -0
- package/models/exclusion-process-step.d.ts +9 -0
- package/models/exclusion-process.d.ts +13 -0
- package/models/index.d.ts +4 -0
- package/models/list-params.d.ts +9 -0
- package/models/list-result.d.ts +5 -0
- package/models/project-config.d.ts +7 -0
- package/package.json +63 -0
- package/public-api.d.ts +4 -0
- package/seniorsistemas-exclusion-process-component.d.ts +10 -0
- package/seniorsistemas-exclusion-process-component.metadata.json +1 -0
- package/services/filter.service.d.ts +19 -0
- package/services/index.d.ts +1 -0
- package/services/logical-delete-config.service.d.ts +8 -0
- package/services/logical-delete.service.d.ts +20 -0
|
@@ -0,0 +1,917 @@
|
|
|
1
|
+
import { __decorate, __param } from 'tslib';
|
|
2
|
+
import { CommonModule } from '@angular/common';
|
|
3
|
+
import { InjectionToken, Inject, Injectable, Output, Component, ViewEncapsulation, NgModule, ChangeDetectorRef, ViewChild } from '@angular/core';
|
|
4
|
+
import { PanelModule } from 'primeng/panel';
|
|
5
|
+
import { TableModule } from 'primeng/table';
|
|
6
|
+
import { EnumColumnFieldType, EnumBadgeColors, SidebarModule, ButtonModule, TableModule as TableModule$1, LoadingStateModule, LocaleModule, FieldType, FormField, LocaleService, ControlErrorsModule, InfoSignModule, EmptyStateModule, DynamicFormModule, TokenListModule } from '@seniorsistemas/angular-components';
|
|
7
|
+
import * as moment from 'moment';
|
|
8
|
+
import { Router, ActivatedRoute, RouterModule } from '@angular/router';
|
|
9
|
+
import { throwError, Subject } from 'rxjs';
|
|
10
|
+
import { catchError, map, takeUntil, finalize } from 'rxjs/operators';
|
|
11
|
+
import { HttpParams, HttpClient } from '@angular/common/http';
|
|
12
|
+
import { TranslateService, TranslateModule } from '@ngx-translate/core';
|
|
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';
|
|
19
|
+
|
|
20
|
+
var EnumExclusionProcessStatus;
|
|
21
|
+
(function (EnumExclusionProcessStatus) {
|
|
22
|
+
EnumExclusionProcessStatus["PENDING"] = "PENDING";
|
|
23
|
+
EnumExclusionProcessStatus["PROCESSING"] = "PROCESSING";
|
|
24
|
+
EnumExclusionProcessStatus["ERROR"] = "ERROR";
|
|
25
|
+
EnumExclusionProcessStatus["SUCCESS"] = "SUCCESS";
|
|
26
|
+
})(EnumExclusionProcessStatus || (EnumExclusionProcessStatus = {}));
|
|
27
|
+
|
|
28
|
+
const ProjectConfigsInjectionToken = new InjectionToken("projectConfigs");
|
|
29
|
+
|
|
30
|
+
let LogicalDeleteConfigService = class LogicalDeleteConfigService {
|
|
31
|
+
constructor(projectConfigs) {
|
|
32
|
+
this.projectConfigs = projectConfigs;
|
|
33
|
+
}
|
|
34
|
+
getDomain() {
|
|
35
|
+
return this.projectConfigs.domain;
|
|
36
|
+
}
|
|
37
|
+
getService() {
|
|
38
|
+
return this.projectConfigs.service;
|
|
39
|
+
}
|
|
40
|
+
getTranslationPrefix() {
|
|
41
|
+
if (this.projectConfigs.translationPrefix) {
|
|
42
|
+
return this.projectConfigs.translationPrefix;
|
|
43
|
+
}
|
|
44
|
+
return `${this.projectConfigs.domain}.${this.projectConfigs.service}`;
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
LogicalDeleteConfigService.ctorParameters = () => [
|
|
48
|
+
{ type: undefined, decorators: [{ type: Inject, args: [ProjectConfigsInjectionToken,] }] }
|
|
49
|
+
];
|
|
50
|
+
LogicalDeleteConfigService = __decorate([
|
|
51
|
+
Injectable(),
|
|
52
|
+
__param(0, Inject(ProjectConfigsInjectionToken))
|
|
53
|
+
], LogicalDeleteConfigService);
|
|
54
|
+
|
|
55
|
+
let LogicalDeleteService = class LogicalDeleteService {
|
|
56
|
+
constructor(http, messageService, translate, projectConfigs) {
|
|
57
|
+
this.http = http;
|
|
58
|
+
this.messageService = messageService;
|
|
59
|
+
this.translate = translate;
|
|
60
|
+
this.projectConfigs = projectConfigs;
|
|
61
|
+
const entityUrl = `${projectConfigs.getDomain()}/${projectConfigs.getService()}`;
|
|
62
|
+
this.exclusionProcessUrl = `${entityUrl}/entities/exclusionProcess`;
|
|
63
|
+
this.listExclusionsUrl = `${entityUrl}/entities/exclusionProcess`;
|
|
64
|
+
this.defaultCatch = this.defaultCatch.bind(this);
|
|
65
|
+
}
|
|
66
|
+
defaultCatch() {
|
|
67
|
+
return catchError((err) => {
|
|
68
|
+
if (err) {
|
|
69
|
+
let summary = err.status ? String(err.status) : "Error";
|
|
70
|
+
let detail = (err.error && err.error.message) || err.statusText || err.message || "Error";
|
|
71
|
+
if (err.status === 401) {
|
|
72
|
+
const prefix = this.projectConfigs.getTranslationPrefix();
|
|
73
|
+
summary = this.translate.instant(`${prefix}.error_unauthorized_title`);
|
|
74
|
+
detail = this.translate.instant(`${prefix}.error_unauthorized_description`);
|
|
75
|
+
}
|
|
76
|
+
this.messageService.add({
|
|
77
|
+
severity: "error",
|
|
78
|
+
summary,
|
|
79
|
+
detail
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
return throwError(err);
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
getListQueryParams(listParams) {
|
|
86
|
+
const { page = 0, size = 10, sort = [], filterQuery = "", displayFields = [] } = listParams;
|
|
87
|
+
let params = new HttpParams();
|
|
88
|
+
params = params.append("size", String(size));
|
|
89
|
+
params = params.append("offset", String(page));
|
|
90
|
+
if (sort && sort.length) {
|
|
91
|
+
params = params.append("orderby", sort
|
|
92
|
+
.map(s => {
|
|
93
|
+
if (s.order === -1) {
|
|
94
|
+
return `${s.field} desc`;
|
|
95
|
+
}
|
|
96
|
+
return `${s.field} asc`;
|
|
97
|
+
})
|
|
98
|
+
.join(", "));
|
|
99
|
+
}
|
|
100
|
+
if (filterQuery) {
|
|
101
|
+
params = params.append("filter", filterQuery);
|
|
102
|
+
}
|
|
103
|
+
if (displayFields && displayFields.length) {
|
|
104
|
+
params = params.append("displayfields", displayFields.join());
|
|
105
|
+
}
|
|
106
|
+
return params;
|
|
107
|
+
}
|
|
108
|
+
getProcessDetails(recordId) {
|
|
109
|
+
const filterParams = {
|
|
110
|
+
filter: `recordId eq '${recordId}'`
|
|
111
|
+
};
|
|
112
|
+
return this.http.get(this.exclusionProcessUrl, { params: filterParams })
|
|
113
|
+
.pipe(this.defaultCatch())
|
|
114
|
+
.pipe(map(value => {
|
|
115
|
+
var _a;
|
|
116
|
+
if (!((_a = value.contents) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
117
|
+
return null;
|
|
118
|
+
}
|
|
119
|
+
return value.contents[0];
|
|
120
|
+
}));
|
|
121
|
+
}
|
|
122
|
+
listExclusions(entityName, params = {}) {
|
|
123
|
+
if (params.filterQuery) {
|
|
124
|
+
params.filterQuery += ` and lower(entityName) eq lower('${entityName}')`;
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
params.filterQuery = `lower(entityName) eq lower('${entityName}')`;
|
|
128
|
+
}
|
|
129
|
+
return this.http.get(this.exclusionProcessUrl, { params: this.getListQueryParams(params) })
|
|
130
|
+
.pipe(this.defaultCatch())
|
|
131
|
+
.pipe(map(value => {
|
|
132
|
+
value.contents.forEach(p => {
|
|
133
|
+
if (p.startDate) {
|
|
134
|
+
p.startDate = moment(p.startDate).toDate();
|
|
135
|
+
}
|
|
136
|
+
if (p.finishDate) {
|
|
137
|
+
p.finishDate = moment(p.finishDate).toDate();
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
return value;
|
|
141
|
+
}));
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
LogicalDeleteService.ctorParameters = () => [
|
|
145
|
+
{ type: HttpClient },
|
|
146
|
+
{ type: MessageService },
|
|
147
|
+
{ type: TranslateService },
|
|
148
|
+
{ type: LogicalDeleteConfigService }
|
|
149
|
+
];
|
|
150
|
+
LogicalDeleteService = __decorate([
|
|
151
|
+
Injectable()
|
|
152
|
+
], LogicalDeleteService);
|
|
153
|
+
|
|
154
|
+
let ExclusionDetailsComponent = class ExclusionDetailsComponent {
|
|
155
|
+
constructor(router, route, translate, logicalDeleteService, projectConfigs) {
|
|
156
|
+
this.router = router;
|
|
157
|
+
this.route = route;
|
|
158
|
+
this.translate = translate;
|
|
159
|
+
this.logicalDeleteService = logicalDeleteService;
|
|
160
|
+
this.projectConfigs = projectConfigs;
|
|
161
|
+
this._entityName = "";
|
|
162
|
+
this._isVisible = false;
|
|
163
|
+
this._isLoading = false;
|
|
164
|
+
this._processSummaryData = [];
|
|
165
|
+
this._processSummaryColumns = [];
|
|
166
|
+
this.ngUnsubscribe = new Subject();
|
|
167
|
+
}
|
|
168
|
+
get isVisible() {
|
|
169
|
+
return this._isVisible;
|
|
170
|
+
}
|
|
171
|
+
get isLoading() {
|
|
172
|
+
return this._isLoading;
|
|
173
|
+
}
|
|
174
|
+
get processSummaryData() {
|
|
175
|
+
return this._processSummaryData;
|
|
176
|
+
}
|
|
177
|
+
get processSummaryColumns() {
|
|
178
|
+
return this._processSummaryColumns;
|
|
179
|
+
}
|
|
180
|
+
ngOnInit() {
|
|
181
|
+
this.route.data
|
|
182
|
+
.pipe(takeUntil(this.ngUnsubscribe))
|
|
183
|
+
.subscribe((data) => {
|
|
184
|
+
this.locale = data.localeConfig;
|
|
185
|
+
});
|
|
186
|
+
this._processSummaryColumns = this.getSummaryColumns();
|
|
187
|
+
}
|
|
188
|
+
ngOnDestroy() {
|
|
189
|
+
this.ngUnsubscribe.next();
|
|
190
|
+
this.ngUnsubscribe.complete();
|
|
191
|
+
}
|
|
192
|
+
showDetails(details) {
|
|
193
|
+
this.processDetails = null;
|
|
194
|
+
this._entityName = details.entityName;
|
|
195
|
+
this._isVisible = true;
|
|
196
|
+
this.entityDescription = details.entityDescription;
|
|
197
|
+
this.loadProcessDetails(details.recordId);
|
|
198
|
+
}
|
|
199
|
+
closeDetails() {
|
|
200
|
+
this._isVisible = false;
|
|
201
|
+
}
|
|
202
|
+
openExclusions() {
|
|
203
|
+
this.closeDetails();
|
|
204
|
+
this.router.navigate(["exclusions-list", this._entityName], {
|
|
205
|
+
queryParams: {
|
|
206
|
+
entityDescription: this.entityDescription
|
|
207
|
+
}
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
getRecordDescription() {
|
|
211
|
+
var _a;
|
|
212
|
+
if (!((_a = this.processDetails) === null || _a === void 0 ? void 0 : _a.description)) {
|
|
213
|
+
return "";
|
|
214
|
+
}
|
|
215
|
+
return this.processDetails.description;
|
|
216
|
+
}
|
|
217
|
+
getInicialDate() {
|
|
218
|
+
var _a;
|
|
219
|
+
if (!((_a = this.processDetails) === null || _a === void 0 ? void 0 : _a.startDate)) {
|
|
220
|
+
return "";
|
|
221
|
+
}
|
|
222
|
+
return moment(this.processDetails.startDate).format("DD/MM/YYYY HH:mm");
|
|
223
|
+
}
|
|
224
|
+
getFinishDate() {
|
|
225
|
+
var _a;
|
|
226
|
+
if (!((_a = this.processDetails) === null || _a === void 0 ? void 0 : _a.finishDate)) {
|
|
227
|
+
return "";
|
|
228
|
+
}
|
|
229
|
+
return moment(this.processDetails.finishDate).format("DD/MM/YYYY HH:mm");
|
|
230
|
+
}
|
|
231
|
+
isFinished() {
|
|
232
|
+
var _a;
|
|
233
|
+
return !!((_a = this.processDetails) === null || _a === void 0 ? void 0 : _a.finishDate);
|
|
234
|
+
}
|
|
235
|
+
getShowExclusionsButtonLabel() {
|
|
236
|
+
return this.translate.instant(`${this.projectConfigs.getTranslationPrefix()}.logical_delete_show_deletions`);
|
|
237
|
+
}
|
|
238
|
+
getCloseButtonLabel() {
|
|
239
|
+
return this.translate.instant(`${this.projectConfigs.getTranslationPrefix()}.logical_delete_close`);
|
|
240
|
+
}
|
|
241
|
+
getSummaryLabel() {
|
|
242
|
+
return this.translate.instant(`${this.projectConfigs.getTranslationPrefix()}.logical_delete_summary`);
|
|
243
|
+
}
|
|
244
|
+
getStartDateLabel() {
|
|
245
|
+
return this.translate.instant(`${this.projectConfigs.getTranslationPrefix()}.logical_delete_start`);
|
|
246
|
+
}
|
|
247
|
+
getFinishDateLabel() {
|
|
248
|
+
return this.translate.instant(`${this.projectConfigs.getTranslationPrefix()}.logical_delete_finish`);
|
|
249
|
+
}
|
|
250
|
+
getSidebarTitle() {
|
|
251
|
+
return this.translate.instant(`${this.projectConfigs.getTranslationPrefix()}.logical_delete_details_title`);
|
|
252
|
+
}
|
|
253
|
+
getSummaryColumns() {
|
|
254
|
+
return [
|
|
255
|
+
{
|
|
256
|
+
field: "description",
|
|
257
|
+
attributes: ["description"],
|
|
258
|
+
header: this.translate.instant(`${this.projectConfigs.getTranslationPrefix()}.logical_delete_description`),
|
|
259
|
+
type: EnumColumnFieldType.STRING,
|
|
260
|
+
style: {
|
|
261
|
+
width: "300px"
|
|
262
|
+
}
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
field: "status",
|
|
266
|
+
attributes: ["status"],
|
|
267
|
+
header: this.translate.instant(`${this.projectConfigs.getTranslationPrefix()}.logical_delete_status`),
|
|
268
|
+
type: EnumColumnFieldType.ENUM,
|
|
269
|
+
enumPrefix: `${this.projectConfigs.getTranslationPrefix()}.logical_delete_enum_exclusion_process_status_`,
|
|
270
|
+
style: {
|
|
271
|
+
width: "100px"
|
|
272
|
+
},
|
|
273
|
+
tooltip: this.getColumnStatusTooltip,
|
|
274
|
+
badgeConfigs: [
|
|
275
|
+
{
|
|
276
|
+
enumValue: EnumExclusionProcessStatus.ERROR,
|
|
277
|
+
color: EnumBadgeColors.RED
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
enumValue: EnumExclusionProcessStatus.PENDING,
|
|
281
|
+
color: EnumBadgeColors.YELLOW
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
enumValue: EnumExclusionProcessStatus.PROCESSING,
|
|
285
|
+
color: EnumBadgeColors.BLUE
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
enumValue: EnumExclusionProcessStatus.SUCCESS,
|
|
289
|
+
color: EnumBadgeColors.GREEN
|
|
290
|
+
}
|
|
291
|
+
]
|
|
292
|
+
}
|
|
293
|
+
];
|
|
294
|
+
}
|
|
295
|
+
getColumnStatusTooltip(rowValue) {
|
|
296
|
+
if (rowValue.errorMessage) {
|
|
297
|
+
return rowValue.errorMessage;
|
|
298
|
+
}
|
|
299
|
+
return null;
|
|
300
|
+
}
|
|
301
|
+
loadProcessDetails(recordId) {
|
|
302
|
+
this._isLoading = true;
|
|
303
|
+
this.logicalDeleteService.getProcessDetails(recordId)
|
|
304
|
+
.pipe(takeUntil(this.ngUnsubscribe))
|
|
305
|
+
.pipe(finalize(() => this._isLoading = false))
|
|
306
|
+
.subscribe((process) => {
|
|
307
|
+
this.processDetails = process;
|
|
308
|
+
this.loadProcessSummary(process);
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
loadProcessSummary(process) {
|
|
312
|
+
const stepLogs = [];
|
|
313
|
+
process.groups.forEach(group => {
|
|
314
|
+
const steps = group.steps.map(step => ({
|
|
315
|
+
description: step.description,
|
|
316
|
+
status: step.status,
|
|
317
|
+
errorMessage: step.errorMessage
|
|
318
|
+
}));
|
|
319
|
+
stepLogs.push(...steps);
|
|
320
|
+
});
|
|
321
|
+
this._processSummaryData = stepLogs;
|
|
322
|
+
}
|
|
323
|
+
};
|
|
324
|
+
ExclusionDetailsComponent.ctorParameters = () => [
|
|
325
|
+
{ type: Router },
|
|
326
|
+
{ type: ActivatedRoute },
|
|
327
|
+
{ type: TranslateService },
|
|
328
|
+
{ type: LogicalDeleteService },
|
|
329
|
+
{ type: LogicalDeleteConfigService }
|
|
330
|
+
];
|
|
331
|
+
__decorate([
|
|
332
|
+
Output()
|
|
333
|
+
], ExclusionDetailsComponent.prototype, "isVisible", null);
|
|
334
|
+
__decorate([
|
|
335
|
+
Output()
|
|
336
|
+
], ExclusionDetailsComponent.prototype, "isLoading", null);
|
|
337
|
+
__decorate([
|
|
338
|
+
Output()
|
|
339
|
+
], ExclusionDetailsComponent.prototype, "processSummaryData", null);
|
|
340
|
+
__decorate([
|
|
341
|
+
Output()
|
|
342
|
+
], ExclusionDetailsComponent.prototype, "processSummaryColumns", null);
|
|
343
|
+
__decorate([
|
|
344
|
+
Output()
|
|
345
|
+
], ExclusionDetailsComponent.prototype, "processDetails", void 0);
|
|
346
|
+
__decorate([
|
|
347
|
+
Output()
|
|
348
|
+
], ExclusionDetailsComponent.prototype, "entityDescription", void 0);
|
|
349
|
+
ExclusionDetailsComponent = __decorate([
|
|
350
|
+
Component({
|
|
351
|
+
selector: "s-exclusion-details",
|
|
352
|
+
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",
|
|
353
|
+
encapsulation: ViewEncapsulation.None,
|
|
354
|
+
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}"]
|
|
355
|
+
})
|
|
356
|
+
], ExclusionDetailsComponent);
|
|
357
|
+
|
|
358
|
+
let ExclusionDetailsModule = class ExclusionDetailsModule {
|
|
359
|
+
};
|
|
360
|
+
ExclusionDetailsModule = __decorate([
|
|
361
|
+
NgModule({
|
|
362
|
+
imports: [
|
|
363
|
+
CommonModule,
|
|
364
|
+
SidebarModule,
|
|
365
|
+
ButtonModule,
|
|
366
|
+
PanelModule,
|
|
367
|
+
TableModule,
|
|
368
|
+
TableModule$1,
|
|
369
|
+
LoadingStateModule,
|
|
370
|
+
LocaleModule
|
|
371
|
+
],
|
|
372
|
+
declarations: [ExclusionDetailsComponent],
|
|
373
|
+
exports: [ExclusionDetailsComponent],
|
|
374
|
+
entryComponents: [ExclusionDetailsComponent]
|
|
375
|
+
})
|
|
376
|
+
], ExclusionDetailsModule);
|
|
377
|
+
|
|
378
|
+
let FilterService = class FilterService {
|
|
379
|
+
constructor(logicalDeleteConfigService, translate) {
|
|
380
|
+
this.logicalDeleteConfigService = logicalDeleteConfigService;
|
|
381
|
+
this.translate = translate;
|
|
382
|
+
this.numberTypes = [FieldType.Integer, FieldType.Double];
|
|
383
|
+
}
|
|
384
|
+
getEnumQuery(name, value, multiple = false) {
|
|
385
|
+
if (multiple) {
|
|
386
|
+
const filter = value.map((selected) => `${name} eq '${selected}'`).join(" or ");
|
|
387
|
+
return `(${filter})`;
|
|
388
|
+
}
|
|
389
|
+
return `${name} eq '${value}'`;
|
|
390
|
+
}
|
|
391
|
+
createFilterString(formField, value) {
|
|
392
|
+
const { name, type, multiple } = formField;
|
|
393
|
+
if (typeof value == "number") {
|
|
394
|
+
return `${name} eq ${value}`;
|
|
395
|
+
}
|
|
396
|
+
switch (type) {
|
|
397
|
+
case FieldType.Date:
|
|
398
|
+
return `${name} eq '${moment(value).format("YYYY-MM-DD")}'`;
|
|
399
|
+
case FieldType.Time:
|
|
400
|
+
return `${name} eq '${moment(value).format("HH:mm:ss")}'`;
|
|
401
|
+
case FieldType.DateTime:
|
|
402
|
+
return `${name} eq '${moment(value).format()}'`;
|
|
403
|
+
case FieldType.LocalDateTime:
|
|
404
|
+
return `${name} eq '${moment(value).format("YYYY-MM-DD[T]HH:mm:ss.SSS")}'`;
|
|
405
|
+
case FieldType.Enum:
|
|
406
|
+
return this.getEnumQuery(name, value, multiple);
|
|
407
|
+
case FieldType.String:
|
|
408
|
+
return `containing(upper(${name}), upper('${value.replace(/'/g, "'")}'))`;
|
|
409
|
+
case FieldType.Lookup:
|
|
410
|
+
return `${name} eq '${value.id}'`;
|
|
411
|
+
default:
|
|
412
|
+
return `${name} eq '${value}'`;
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
createFilterTokens(formField, value) {
|
|
416
|
+
const { name, type, label, searchFields, options } = formField;
|
|
417
|
+
let labelValue = value;
|
|
418
|
+
switch (type) {
|
|
419
|
+
case FieldType.Date:
|
|
420
|
+
labelValue = moment(value).format("L");
|
|
421
|
+
break;
|
|
422
|
+
case FieldType.Time:
|
|
423
|
+
labelValue = moment(value).format("LTS");
|
|
424
|
+
break;
|
|
425
|
+
case FieldType.LocalDateTime:
|
|
426
|
+
case FieldType.DateTime:
|
|
427
|
+
labelValue = moment(value).format("L LTS");
|
|
428
|
+
break;
|
|
429
|
+
case FieldType.Lookup:
|
|
430
|
+
labelValue = searchFields.map((field) => this.getProp(value, field.name)).join(" - ");
|
|
431
|
+
break;
|
|
432
|
+
case FieldType.Enum:
|
|
433
|
+
if (Array.isArray(value)) {
|
|
434
|
+
labelValue = value.map((element) => {
|
|
435
|
+
return options.filter((en) => en.value === element)[0].label;
|
|
436
|
+
});
|
|
437
|
+
}
|
|
438
|
+
else {
|
|
439
|
+
labelValue = options.filter((option) => option.value === labelValue)[0].label;
|
|
440
|
+
}
|
|
441
|
+
break;
|
|
442
|
+
case FieldType.Boolean:
|
|
443
|
+
labelValue = value
|
|
444
|
+
? this.translate.instant(`${this.logicalDeleteConfigService.getTranslationPrefix()}.list_grid_boolean_true`)
|
|
445
|
+
: this.translate.instant(`${this.logicalDeleteConfigService.getTranslationPrefix()}.list_grid_boolean_false`);
|
|
446
|
+
break;
|
|
447
|
+
}
|
|
448
|
+
return { id: name, label: `${label}: ${labelValue}` };
|
|
449
|
+
}
|
|
450
|
+
getSuggestionValue(displayFields, ownerEntity, value, separator) {
|
|
451
|
+
return displayFields.map(field => this.getProp(value, `${ownerEntity}.${field}`))
|
|
452
|
+
.reduce((acc, val) => `${acc}${separator}${val}`) + "";
|
|
453
|
+
}
|
|
454
|
+
getProp(obj, path) {
|
|
455
|
+
return path.split(".").reduce((result, prop) => (result[prop] === undefined ? "" : result[prop]), obj);
|
|
456
|
+
}
|
|
457
|
+
getLabelValueRequest(contents, displayFields) {
|
|
458
|
+
return contents.map((item) => (Object.assign(Object.assign({}, item), { label: displayFields.map(field => this.getProp(item, field)).join(" - ") })));
|
|
459
|
+
}
|
|
460
|
+
isValidFilter(type, value) {
|
|
461
|
+
const isTypeNumber = this.numberTypes.includes(type);
|
|
462
|
+
const numberPattern = /^\d+\b$/;
|
|
463
|
+
const isNumber = value.match(numberPattern);
|
|
464
|
+
return !(isTypeNumber && !isNumber);
|
|
465
|
+
}
|
|
466
|
+
};
|
|
467
|
+
FilterService.ctorParameters = () => [
|
|
468
|
+
{ type: LogicalDeleteConfigService },
|
|
469
|
+
{ type: TranslateService }
|
|
470
|
+
];
|
|
471
|
+
FilterService = __decorate([
|
|
472
|
+
Injectable()
|
|
473
|
+
], FilterService);
|
|
474
|
+
|
|
475
|
+
let ExclusionsListComponent = class ExclusionsListComponent {
|
|
476
|
+
constructor(route, translate, formBuilder, changeDetectorRef, logicalDeleteService, filterService, projectConfigs) {
|
|
477
|
+
this.route = route;
|
|
478
|
+
this.translate = translate;
|
|
479
|
+
this.formBuilder = formBuilder;
|
|
480
|
+
this.changeDetectorRef = changeDetectorRef;
|
|
481
|
+
this.logicalDeleteService = logicalDeleteService;
|
|
482
|
+
this.filterService = filterService;
|
|
483
|
+
this.projectConfigs = projectConfigs;
|
|
484
|
+
this.currentListParams = { page: 0, size: 10, sort: [], filterData: {} };
|
|
485
|
+
this.showLoader = false;
|
|
486
|
+
this.totalRecords = 0;
|
|
487
|
+
this.filtersPanelCollapsed = true;
|
|
488
|
+
this.searchTokens = [];
|
|
489
|
+
this.serverError = false;
|
|
490
|
+
this.ngUnsubscribe = new Subject();
|
|
491
|
+
}
|
|
492
|
+
ngOnInit() {
|
|
493
|
+
this.filterFormGroup = this.getFormBuilder();
|
|
494
|
+
this.filterFields = this.getFilterFields();
|
|
495
|
+
this.gridColumns = this.getGridColumns();
|
|
496
|
+
this.route.data
|
|
497
|
+
.pipe(takeUntil(this.ngUnsubscribe))
|
|
498
|
+
.subscribe((data) => {
|
|
499
|
+
this.locale = data.localeConfig;
|
|
500
|
+
});
|
|
501
|
+
this.route.params
|
|
502
|
+
.pipe(takeUntil(this.ngUnsubscribe))
|
|
503
|
+
.subscribe((params) => {
|
|
504
|
+
this.entityName = params.entityName;
|
|
505
|
+
});
|
|
506
|
+
this.route.queryParams
|
|
507
|
+
.pipe(takeUntil(this.ngUnsubscribe))
|
|
508
|
+
.subscribe((queryParams) => {
|
|
509
|
+
this.entityDescription = queryParams.entityDescription;
|
|
510
|
+
});
|
|
511
|
+
}
|
|
512
|
+
ngOnDestroy() {
|
|
513
|
+
this.ngUnsubscribe.next();
|
|
514
|
+
this.ngUnsubscribe.complete();
|
|
515
|
+
}
|
|
516
|
+
getFormBuilder() {
|
|
517
|
+
return this.formBuilder.group({
|
|
518
|
+
description: [undefined, Validators.compose([])],
|
|
519
|
+
state: [undefined, Validators.compose([])],
|
|
520
|
+
startDate: [{ value: undefined, disabled: false }, Validators.compose([])],
|
|
521
|
+
endDate: [{ value: undefined, disabled: false }, Validators.compose([])]
|
|
522
|
+
});
|
|
523
|
+
}
|
|
524
|
+
getGridColumns() {
|
|
525
|
+
return [
|
|
526
|
+
{
|
|
527
|
+
field: "description",
|
|
528
|
+
attributes: ['description'],
|
|
529
|
+
header: this.translate.instant(`${this.projectConfigs.getTranslationPrefix()}.logical_delete_description`),
|
|
530
|
+
type: EnumColumnFieldType.STRING,
|
|
531
|
+
style: {
|
|
532
|
+
width: '300px'
|
|
533
|
+
}
|
|
534
|
+
},
|
|
535
|
+
{
|
|
536
|
+
field: "status",
|
|
537
|
+
attributes: ['status'],
|
|
538
|
+
header: this.translate.instant(`${this.projectConfigs.getTranslationPrefix()}.logical_delete_status`),
|
|
539
|
+
type: EnumColumnFieldType.ENUM,
|
|
540
|
+
enumPrefix: `${this.projectConfigs.getTranslationPrefix()}.logical_delete_enum_exclusion_process_status_`,
|
|
541
|
+
style: {
|
|
542
|
+
width: '100px'
|
|
543
|
+
},
|
|
544
|
+
badgeConfigs: [
|
|
545
|
+
{
|
|
546
|
+
enumValue: EnumExclusionProcessStatus.ERROR,
|
|
547
|
+
color: EnumBadgeColors.RED
|
|
548
|
+
},
|
|
549
|
+
{
|
|
550
|
+
enumValue: EnumExclusionProcessStatus.PENDING,
|
|
551
|
+
color: EnumBadgeColors.YELLOW
|
|
552
|
+
},
|
|
553
|
+
{
|
|
554
|
+
enumValue: EnumExclusionProcessStatus.PROCESSING,
|
|
555
|
+
color: EnumBadgeColors.BLUE
|
|
556
|
+
},
|
|
557
|
+
{
|
|
558
|
+
enumValue: EnumExclusionProcessStatus.SUCCESS,
|
|
559
|
+
color: EnumBadgeColors.GREEN
|
|
560
|
+
}
|
|
561
|
+
]
|
|
562
|
+
},
|
|
563
|
+
{
|
|
564
|
+
field: "startDate",
|
|
565
|
+
attributes: ['startDate'],
|
|
566
|
+
header: this.translate.instant(`${this.projectConfigs.getTranslationPrefix()}.logical_delete_start`),
|
|
567
|
+
type: EnumColumnFieldType.DATE,
|
|
568
|
+
dateFormat: "DD/MM/YYYY HH:mm",
|
|
569
|
+
style: {
|
|
570
|
+
width: '100px'
|
|
571
|
+
}
|
|
572
|
+
},
|
|
573
|
+
{
|
|
574
|
+
field: "finishDate",
|
|
575
|
+
attributes: ['finishDate'],
|
|
576
|
+
header: this.translate.instant(`${this.projectConfigs.getTranslationPrefix()}.logical_delete_finish`),
|
|
577
|
+
type: EnumColumnFieldType.DATE,
|
|
578
|
+
dateFormat: "DD/MM/YYYY HH:mm",
|
|
579
|
+
style: {
|
|
580
|
+
width: '100px'
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
];
|
|
584
|
+
}
|
|
585
|
+
getFilterFields() {
|
|
586
|
+
return [
|
|
587
|
+
new FormField({
|
|
588
|
+
type: FieldType.String,
|
|
589
|
+
name: "description",
|
|
590
|
+
label: this.translate.instant(`${this.projectConfigs.getTranslationPrefix()}.logical_delete_description`)
|
|
591
|
+
}),
|
|
592
|
+
new FormField({
|
|
593
|
+
type: FieldType.Enum,
|
|
594
|
+
name: "state",
|
|
595
|
+
label: this.translate.instant(`${this.projectConfigs.getTranslationPrefix()}.logical_delete_status`),
|
|
596
|
+
placeholder: this.translate.instant(`${this.projectConfigs.getTranslationPrefix()}.logical_delete_status`),
|
|
597
|
+
multiple: true,
|
|
598
|
+
options: [
|
|
599
|
+
{
|
|
600
|
+
label: this.translate.instant(`${this.projectConfigs.getTranslationPrefix()}.logical_delete_enum_exclusion_process_status_error`),
|
|
601
|
+
value: EnumExclusionProcessStatus.ERROR
|
|
602
|
+
},
|
|
603
|
+
{
|
|
604
|
+
label: this.translate.instant(`${this.projectConfigs.getTranslationPrefix()}.logical_delete_enum_exclusion_process_status_pending`),
|
|
605
|
+
value: EnumExclusionProcessStatus.PENDING
|
|
606
|
+
},
|
|
607
|
+
{
|
|
608
|
+
label: this.translate.instant(`${this.projectConfigs.getTranslationPrefix()}.logical_delete_enum_exclusion_process_status_processing`),
|
|
609
|
+
value: EnumExclusionProcessStatus.PROCESSING
|
|
610
|
+
},
|
|
611
|
+
{
|
|
612
|
+
label: this.translate.instant(`${this.projectConfigs.getTranslationPrefix()}.logical_delete_enum_exclusion_process_status_success`),
|
|
613
|
+
value: EnumExclusionProcessStatus.SUCCESS
|
|
614
|
+
}
|
|
615
|
+
]
|
|
616
|
+
}),
|
|
617
|
+
new FormField({
|
|
618
|
+
type: FieldType.Date,
|
|
619
|
+
name: "startDate",
|
|
620
|
+
label: this.translate.instant(`${this.projectConfigs.getTranslationPrefix()}.logical_delete_start`)
|
|
621
|
+
}),
|
|
622
|
+
new FormField({
|
|
623
|
+
type: FieldType.Date,
|
|
624
|
+
name: "endDate",
|
|
625
|
+
label: this.translate.instant(`${this.projectConfigs.getTranslationPrefix()}.logical_delete_finish`)
|
|
626
|
+
})
|
|
627
|
+
];
|
|
628
|
+
}
|
|
629
|
+
getEmptyStateTitle() {
|
|
630
|
+
return this.translate.instant(`${this.projectConfigs.getTranslationPrefix()}.logical_delete_empty_state_title`);
|
|
631
|
+
}
|
|
632
|
+
getEmptyStateDescription() {
|
|
633
|
+
return this.translate.instant(`${this.projectConfigs.getTranslationPrefix()}.logical_delete_empty_state_description`);
|
|
634
|
+
}
|
|
635
|
+
getTitle() {
|
|
636
|
+
return this.translate.instant(`${this.projectConfigs.getTranslationPrefix()}.logical_delete_list_title`);
|
|
637
|
+
}
|
|
638
|
+
getDetailsButtonTitle() {
|
|
639
|
+
return this.translate.instant(`${this.projectConfigs.getTranslationPrefix()}.logical_delete_details`);
|
|
640
|
+
}
|
|
641
|
+
onSearch() {
|
|
642
|
+
const filterData = this.filterFormGroup.getRawValue();
|
|
643
|
+
this.filtersPanelCollapsed = true;
|
|
644
|
+
this.resetGrid({ filterData });
|
|
645
|
+
}
|
|
646
|
+
onClear() {
|
|
647
|
+
this.filterFormGroup.reset();
|
|
648
|
+
const filterData = this.filterFormGroup.getRawValue();
|
|
649
|
+
this.resetGrid({ filterData });
|
|
650
|
+
}
|
|
651
|
+
onRemoveToken(token) {
|
|
652
|
+
this.filterFormGroup.get(token.id).setValue(undefined);
|
|
653
|
+
const filterData = this.filterFormGroup.getRawValue();
|
|
654
|
+
this.resetGrid({ filterData });
|
|
655
|
+
}
|
|
656
|
+
onGridChange(event) {
|
|
657
|
+
const size = event.rows;
|
|
658
|
+
const page = event.first / size;
|
|
659
|
+
const sort = event.multiSortMeta ? event.multiSortMeta : [];
|
|
660
|
+
return this.updateGrid({ page, size, sort });
|
|
661
|
+
}
|
|
662
|
+
getFilterTokens() {
|
|
663
|
+
const filterData = this.filterFormGroup.value;
|
|
664
|
+
return this.filterFields
|
|
665
|
+
.filter(({ name }) => filterData[name] != undefined && filterData[name] !== "")
|
|
666
|
+
.map(formField => this.filterService.createFilterTokens(formField, filterData[formField.name]));
|
|
667
|
+
}
|
|
668
|
+
getFilterQuery() {
|
|
669
|
+
const { filterData } = this.currentListParams;
|
|
670
|
+
const dateFields = ['startDate', 'endDate'];
|
|
671
|
+
let filterQuery = this.filterFields
|
|
672
|
+
.filter(({ name }) => !dateFields.includes(name))
|
|
673
|
+
.filter(({ name }) => filterData[name] != undefined)
|
|
674
|
+
.map(formField => this.filterService.createFilterString(formField, filterData[formField.name]))
|
|
675
|
+
.join(" and ");
|
|
676
|
+
if (filterData.startDate && filterData.endDate) {
|
|
677
|
+
const startDate = moment(filterData.startDate).format('YYYY-MM-DD');
|
|
678
|
+
const endDate = moment(filterData.endDate).format('YYYY-MM-DD');
|
|
679
|
+
const dateQuery = `startDate between '${startDate}' and '${endDate}'`;
|
|
680
|
+
if (filterQuery) {
|
|
681
|
+
filterQuery += ` and ${dateQuery}`;
|
|
682
|
+
}
|
|
683
|
+
else {
|
|
684
|
+
filterQuery = dateQuery;
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
return filterQuery;
|
|
688
|
+
}
|
|
689
|
+
updateGrid(listParams = {}) {
|
|
690
|
+
this.currentListParams = Object.assign(Object.assign({}, this.currentListParams), listParams);
|
|
691
|
+
const { page, size, sort } = this.currentListParams;
|
|
692
|
+
this.searchTokens = this.getFilterTokens();
|
|
693
|
+
const filterQuery = this.getFilterQuery();
|
|
694
|
+
const displayFields = [
|
|
695
|
+
'recordId',
|
|
696
|
+
...this.gridColumns.map(column => column.field)
|
|
697
|
+
];
|
|
698
|
+
this.listExclusions({ page, size, sort, filterQuery, displayFields });
|
|
699
|
+
}
|
|
700
|
+
listExclusions(params) {
|
|
701
|
+
this.showLoader = true;
|
|
702
|
+
this.serverError = false;
|
|
703
|
+
this.changeDetectorRef.detectChanges();
|
|
704
|
+
this.logicalDeleteService
|
|
705
|
+
.listExclusions(this.entityName, params)
|
|
706
|
+
.pipe(takeUntil(this.ngUnsubscribe), catchError((err) => {
|
|
707
|
+
if (err.status >= 500 && err.status < 600) {
|
|
708
|
+
this.serverError = true;
|
|
709
|
+
}
|
|
710
|
+
throw err;
|
|
711
|
+
}), finalize(() => this.showLoader = false))
|
|
712
|
+
.subscribe((list) => {
|
|
713
|
+
this.gridData = list.contents;
|
|
714
|
+
this.totalRecords = list.totalElements;
|
|
715
|
+
});
|
|
716
|
+
}
|
|
717
|
+
focusInput(elementId) {
|
|
718
|
+
const element = document.getElementById(`${elementId}`);
|
|
719
|
+
if (element) {
|
|
720
|
+
element.focus();
|
|
721
|
+
}
|
|
722
|
+
}
|
|
723
|
+
resetGrid(listParams) {
|
|
724
|
+
if (listParams)
|
|
725
|
+
this.currentListParams = Object.assign(Object.assign({}, this.currentListParams), listParams);
|
|
726
|
+
this.currentListParams = Object.assign(Object.assign({}, this.currentListParams), { page: 0, sort: [] });
|
|
727
|
+
this.table.reset();
|
|
728
|
+
}
|
|
729
|
+
onClickDetails(rowData) {
|
|
730
|
+
this.exclusionDetailsComponent.showDetails({
|
|
731
|
+
recordId: rowData.recordId,
|
|
732
|
+
entityDescription: this.entityDescription,
|
|
733
|
+
entityName: this.entityName
|
|
734
|
+
});
|
|
735
|
+
}
|
|
736
|
+
};
|
|
737
|
+
ExclusionsListComponent.ctorParameters = () => [
|
|
738
|
+
{ type: ActivatedRoute },
|
|
739
|
+
{ type: TranslateService },
|
|
740
|
+
{ type: FormBuilder },
|
|
741
|
+
{ type: ChangeDetectorRef },
|
|
742
|
+
{ type: LogicalDeleteService },
|
|
743
|
+
{ type: FilterService },
|
|
744
|
+
{ type: LogicalDeleteConfigService }
|
|
745
|
+
];
|
|
746
|
+
__decorate([
|
|
747
|
+
ViewChild("exclusionsTable")
|
|
748
|
+
], ExclusionsListComponent.prototype, "table", void 0);
|
|
749
|
+
__decorate([
|
|
750
|
+
ViewChild(ExclusionDetailsComponent)
|
|
751
|
+
], ExclusionsListComponent.prototype, "exclusionDetailsComponent", void 0);
|
|
752
|
+
ExclusionsListComponent = __decorate([
|
|
753
|
+
Component({
|
|
754
|
+
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>",
|
|
755
|
+
providers: []
|
|
756
|
+
})
|
|
757
|
+
], ExclusionsListComponent);
|
|
758
|
+
|
|
759
|
+
let ExclusionsListFeatureRoutingGuard = class ExclusionsListFeatureRoutingGuard {
|
|
760
|
+
canActivate() {
|
|
761
|
+
return true;
|
|
762
|
+
}
|
|
763
|
+
};
|
|
764
|
+
ExclusionsListFeatureRoutingGuard = __decorate([
|
|
765
|
+
Injectable()
|
|
766
|
+
], ExclusionsListFeatureRoutingGuard);
|
|
767
|
+
let ExclusionsListFeatureRoutingListTitleResolver = class ExclusionsListFeatureRoutingListTitleResolver {
|
|
768
|
+
constructor(translate, projectConfigs) {
|
|
769
|
+
this.translate = translate;
|
|
770
|
+
this.projectConfigs = projectConfigs;
|
|
771
|
+
}
|
|
772
|
+
resolve() {
|
|
773
|
+
return this.translate.get(`${this.projectConfigs.getTranslationPrefix()}.logical_delete_list_title`);
|
|
774
|
+
}
|
|
775
|
+
};
|
|
776
|
+
ExclusionsListFeatureRoutingListTitleResolver.ctorParameters = () => [
|
|
777
|
+
{ type: TranslateService },
|
|
778
|
+
{ type: LogicalDeleteConfigService }
|
|
779
|
+
];
|
|
780
|
+
ExclusionsListFeatureRoutingListTitleResolver = __decorate([
|
|
781
|
+
Injectable()
|
|
782
|
+
], ExclusionsListFeatureRoutingListTitleResolver);
|
|
783
|
+
let ExclusionsListFeatureRoutingPermissionResolver = class ExclusionsListFeatureRoutingPermissionResolver {
|
|
784
|
+
constructor(permissionsService) {
|
|
785
|
+
this.permissionsService = permissionsService;
|
|
786
|
+
}
|
|
787
|
+
resolve() {
|
|
788
|
+
return this.permissionsService.get();
|
|
789
|
+
}
|
|
790
|
+
};
|
|
791
|
+
ExclusionsListFeatureRoutingPermissionResolver.ctorParameters = () => [
|
|
792
|
+
{ type: PermissionsService }
|
|
793
|
+
];
|
|
794
|
+
ExclusionsListFeatureRoutingPermissionResolver = __decorate([
|
|
795
|
+
Injectable()
|
|
796
|
+
], ExclusionsListFeatureRoutingPermissionResolver);
|
|
797
|
+
let ExclusionsListFeatureRoutingLocaleResolver = class ExclusionsListFeatureRoutingLocaleResolver {
|
|
798
|
+
constructor(localeService) {
|
|
799
|
+
this.localeService = localeService;
|
|
800
|
+
}
|
|
801
|
+
resolve() {
|
|
802
|
+
return this.localeService.get();
|
|
803
|
+
}
|
|
804
|
+
};
|
|
805
|
+
ExclusionsListFeatureRoutingLocaleResolver.ctorParameters = () => [
|
|
806
|
+
{ type: LocaleService }
|
|
807
|
+
];
|
|
808
|
+
ExclusionsListFeatureRoutingLocaleResolver = __decorate([
|
|
809
|
+
Injectable()
|
|
810
|
+
], ExclusionsListFeatureRoutingLocaleResolver);
|
|
811
|
+
let EmptyComponent = class EmptyComponent {
|
|
812
|
+
};
|
|
813
|
+
EmptyComponent = __decorate([
|
|
814
|
+
Component({
|
|
815
|
+
template: `<router-outlet></router-outlet>`
|
|
816
|
+
})
|
|
817
|
+
], EmptyComponent);
|
|
818
|
+
const routes = [
|
|
819
|
+
{
|
|
820
|
+
path: "exclusions-list",
|
|
821
|
+
component: EmptyComponent,
|
|
822
|
+
canActivate: [
|
|
823
|
+
ExclusionsListFeatureRoutingGuard
|
|
824
|
+
],
|
|
825
|
+
resolve: {
|
|
826
|
+
allPermissions: ExclusionsListFeatureRoutingPermissionResolver,
|
|
827
|
+
localeConfig: ExclusionsListFeatureRoutingLocaleResolver,
|
|
828
|
+
routeTitle: ExclusionsListFeatureRoutingListTitleResolver
|
|
829
|
+
},
|
|
830
|
+
children: [
|
|
831
|
+
{
|
|
832
|
+
path: ":entityName",
|
|
833
|
+
component: ExclusionsListComponent
|
|
834
|
+
}
|
|
835
|
+
]
|
|
836
|
+
}
|
|
837
|
+
];
|
|
838
|
+
let ExclusionsListFeatureRouting = class ExclusionsListFeatureRouting {
|
|
839
|
+
};
|
|
840
|
+
ExclusionsListFeatureRouting = __decorate([
|
|
841
|
+
NgModule({
|
|
842
|
+
imports: [
|
|
843
|
+
RouterModule.forChild(routes)
|
|
844
|
+
],
|
|
845
|
+
exports: [
|
|
846
|
+
RouterModule
|
|
847
|
+
],
|
|
848
|
+
providers: [
|
|
849
|
+
ExclusionsListFeatureRoutingGuard,
|
|
850
|
+
ExclusionsListFeatureRoutingPermissionResolver,
|
|
851
|
+
ExclusionsListFeatureRoutingLocaleResolver,
|
|
852
|
+
ExclusionsListFeatureRoutingListTitleResolver
|
|
853
|
+
],
|
|
854
|
+
declarations: [
|
|
855
|
+
EmptyComponent
|
|
856
|
+
]
|
|
857
|
+
})
|
|
858
|
+
], ExclusionsListFeatureRouting);
|
|
859
|
+
|
|
860
|
+
let ExclusionsListModule = class ExclusionsListModule {
|
|
861
|
+
};
|
|
862
|
+
ExclusionsListModule = __decorate([
|
|
863
|
+
NgModule({
|
|
864
|
+
imports: [
|
|
865
|
+
FormsModule,
|
|
866
|
+
ReactiveFormsModule,
|
|
867
|
+
TranslateModule,
|
|
868
|
+
CommonModule,
|
|
869
|
+
ControlErrorsModule,
|
|
870
|
+
ButtonModule,
|
|
871
|
+
PanelModule,
|
|
872
|
+
InputTextModule,
|
|
873
|
+
InfoSignModule,
|
|
874
|
+
ConfirmDialogModule,
|
|
875
|
+
DialogModule,
|
|
876
|
+
TableModule,
|
|
877
|
+
TableModule$1,
|
|
878
|
+
LoadingStateModule,
|
|
879
|
+
EmptyStateModule,
|
|
880
|
+
DynamicFormModule,
|
|
881
|
+
TokenListModule,
|
|
882
|
+
LocaleModule.forChild(),
|
|
883
|
+
ExclusionDetailsModule,
|
|
884
|
+
ExclusionsListFeatureRouting
|
|
885
|
+
],
|
|
886
|
+
declarations: [ExclusionsListComponent],
|
|
887
|
+
exports: [ExclusionsListComponent],
|
|
888
|
+
entryComponents: [ExclusionsListComponent]
|
|
889
|
+
})
|
|
890
|
+
], ExclusionsListModule);
|
|
891
|
+
|
|
892
|
+
var LogicalDeleteModule_1;
|
|
893
|
+
let LogicalDeleteModule = LogicalDeleteModule_1 = class LogicalDeleteModule {
|
|
894
|
+
static forRoot(config) {
|
|
895
|
+
return {
|
|
896
|
+
ngModule: LogicalDeleteModule_1,
|
|
897
|
+
providers: [
|
|
898
|
+
{
|
|
899
|
+
provide: ProjectConfigsInjectionToken,
|
|
900
|
+
useValue: config
|
|
901
|
+
}
|
|
902
|
+
]
|
|
903
|
+
};
|
|
904
|
+
}
|
|
905
|
+
};
|
|
906
|
+
LogicalDeleteModule = LogicalDeleteModule_1 = __decorate([
|
|
907
|
+
NgModule({
|
|
908
|
+
providers: [LogicalDeleteService, LogicalDeleteConfigService, FilterService]
|
|
909
|
+
})
|
|
910
|
+
], LogicalDeleteModule);
|
|
911
|
+
|
|
912
|
+
/**
|
|
913
|
+
* Generated bundle index. Do not edit.
|
|
914
|
+
*/
|
|
915
|
+
|
|
916
|
+
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 };
|
|
917
|
+
//# sourceMappingURL=seniorsistemas-exclusion-process-component.js.map
|