@seniorsistemas/exclusion-process-component 0.0.1-c049d10c-e93a-4d63-9c2a-b17bca40c324 → 0.6.0-44030ff3-2eeb-49f7-8927-0920cc01a805

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 (200) hide show
  1. package/.editorconfig +19 -0
  2. package/.gitlab-ci.yml +74 -0
  3. package/.prettierrc +8 -0
  4. package/.senior-ci-extensions.sh +21 -0
  5. package/.vscode/settings.json +6 -0
  6. package/CHANGELOG.md +22 -0
  7. package/README.md +16 -0
  8. package/angular.json +144 -0
  9. package/archive.tar.gz +0 -0
  10. package/e2e/app.e2e-spec.ts +14 -0
  11. package/e2e/app.po.ts +11 -0
  12. package/e2e/tsconfig.e2e.json +14 -0
  13. package/karma.conf.js +53 -0
  14. package/lib/.browserslistrc +5 -0
  15. package/lib/package.json +19 -0
  16. package/{enums/enum-exclusion-process-status.d.ts → lib/src/enums/enum-exclusion-process-status.ts} +1 -1
  17. package/lib/src/exclusion-details/exclusion-details.component.html +84 -0
  18. package/lib/src/exclusion-details/exclusion-details.component.scss +47 -0
  19. package/lib/src/exclusion-details/exclusion-details.component.spec.ts +171 -0
  20. package/lib/src/exclusion-details/exclusion-details.component.ts +235 -0
  21. package/lib/src/exclusion-details/exclusion-details.module.ts +23 -0
  22. package/{exclusion-details/protocols/exclusion-details.d.ts → lib/src/exclusion-details/protocols/exclusion-details.ts} +1 -0
  23. package/{exclusion-details/protocols/show-details-information.d.ts → lib/src/exclusion-details/protocols/show-details-information.ts} +1 -1
  24. package/lib/src/exclusions-list/exclusions-list.component.html +157 -0
  25. package/lib/src/exclusions-list/exclusions-list.component.spec.ts +526 -0
  26. package/lib/src/exclusions-list/exclusions-list.component.ts +335 -0
  27. package/lib/src/exclusions-list/exclusions-list.module.ts +52 -0
  28. package/lib/src/exclusions-list/exclusions-list.routing.ts +89 -0
  29. package/lib/src/exclusions-list/index.ts +2 -0
  30. package/lib/src/logical-delete.module.ts +22 -0
  31. package/{models/exclusion-process-step-group.d.ts → lib/src/models/exclusion-process-step-group.ts} +1 -0
  32. package/{models/exclusion-process-step.d.ts → lib/src/models/exclusion-process-step.ts} +1 -0
  33. package/{models/exclusion-process.d.ts → lib/src/models/exclusion-process.ts} +1 -0
  34. package/{models/list-params.d.ts → lib/src/models/list-params.ts} +1 -0
  35. package/{models/project-config.d.ts → lib/src/models/project-config.ts} +3 -1
  36. package/lib/src/services/filter.service.spec.ts +290 -0
  37. package/lib/src/services/filter.service.ts +109 -0
  38. package/lib/src/services/index.ts +1 -0
  39. package/lib/src/services/logical-delete-config.service.spec.ts +59 -0
  40. package/lib/src/services/logical-delete-config.service.ts +25 -0
  41. package/lib/src/services/logical-delete.service.spec.ts +322 -0
  42. package/lib/src/services/logical-delete.service.ts +122 -0
  43. package/lib/test.ts +14 -0
  44. package/lib/tsconfig.lib.json +19 -0
  45. package/lib/tsconfig.lib.prod.json +6 -0
  46. package/lib/tsconfig.spec.json +12 -0
  47. package/lib/tslint.json +19 -0
  48. package/package.json +59 -18
  49. package/protractor.conf.js +28 -0
  50. package/senior-ci/.devcontainer/Dockerfile +27 -0
  51. package/senior-ci/.devcontainer/devcontainer.json +71 -0
  52. package/senior-ci/.editorconfig +14 -0
  53. package/senior-ci/.gitattributes +5 -0
  54. package/senior-ci/.gitlab-ci.yml +53 -0
  55. package/senior-ci/.pylintrc +562 -0
  56. package/senior-ci/.vscode/launch.json +102 -0
  57. package/senior-ci/CHANGELOG.md +1564 -0
  58. package/senior-ci/CONTRIBUTING.md +31 -0
  59. package/senior-ci/README.md +26 -0
  60. package/senior-ci/ci/ci.sh +74 -0
  61. package/senior-ci/ci/sonar_scanner.py +48 -0
  62. package/senior-ci/common/__init__.py +250 -0
  63. package/senior-ci/common/default-files/pom.xml +10 -0
  64. package/senior-ci/common/docker-helpers.sh +57 -0
  65. package/senior-ci/common/extensions.py +88 -0
  66. package/senior-ci/common/flutter-helpers.sh +3 -0
  67. package/senior-ci/common/getopt_helper.py +168 -0
  68. package/senior-ci/common/graphql_client.py +40 -0
  69. package/senior-ci/common/helm_helpers.py +40 -0
  70. package/senior-ci/common/notification-helpers.sh +15 -0
  71. package/senior-ci/common/npm-helper.sh +4 -0
  72. package/senior-ci/common/parallel-helper.sh +8 -0
  73. package/senior-ci/common/release-helpers.sh +196 -0
  74. package/senior-ci/common/s3cache-helpers.sh +47 -0
  75. package/senior-ci/common/senior-ci-extensions-helpers.sh +15 -0
  76. package/senior-ci/common/sonar_helper.py +203 -0
  77. package/senior-ci/common/validations/buildable_project.py +61 -0
  78. package/senior-ci/common/validations/check_deprecated_primitives.py +49 -0
  79. package/senior-ci/common/validations/check_project_path.py +40 -0
  80. package/senior-ci/common/validations/check_sonar_config_files.py +41 -0
  81. package/senior-ci/common/validations/check_tags.py +41 -0
  82. package/senior-ci/common/validations/validate_changelog.py +151 -0
  83. package/senior-ci/common/validations/validate_issues.py +320 -0
  84. package/senior-ci/docker/build.sh +18 -0
  85. package/senior-ci/docker/config-host.sh +29 -0
  86. package/senior-ci/docker/deploy-service.sh +79 -0
  87. package/senior-ci/docker/push.sh +22 -0
  88. package/senior-ci/frontend/npm/bibliotecas/ci.sh +149 -0
  89. package/senior-ci/frontend/npm/ci.sh +370 -0
  90. package/senior-ci/frontend/npm/release-translations.sh +164 -0
  91. package/senior-ci/helm/deploy.py +56 -0
  92. package/senior-ci/helm/publish.py +41 -0
  93. package/senior-ci/hook/release_notification.sh +88 -0
  94. package/senior-ci/hook/text_notification.sh +10 -0
  95. package/senior-ci/java/bibliotecas/ci.sh +215 -0
  96. package/senior-ci/java/sdl/ci.sh +372 -0
  97. package/senior-ci/java/sdl/scripts/hotfix.sh +78 -0
  98. package/senior-ci/mobile/flutter/apps/__main__.py +5 -0
  99. package/senior-ci/mobile/flutter/apps/ci.py +193 -0
  100. package/senior-ci/mobile/flutter/libs/__main__.py +5 -0
  101. package/senior-ci/mobile/flutter/libs/ci.py +178 -0
  102. package/senior-ci/mobile/flutter/scripts/release.sh +54 -0
  103. package/senior-ci/release-candidate/backend/get_version.sh +64 -0
  104. package/senior-ci/release-candidate/close_branch.sh +113 -0
  105. package/senior-ci/release-candidate/common/create_hotfix.sh +28 -0
  106. package/senior-ci/release-candidate/common/create_release.sh +30 -0
  107. package/senior-ci/release-candidate/create_branch.sh +64 -0
  108. package/senior-ci/release-candidate/frontend/get_version.sh +43 -0
  109. package/senior-ci/requirements-dev.txt +5 -0
  110. package/senior-ci/requirements.txt +5 -0
  111. package/senior-ci/scripts/apply_yamls.py +229 -0
  112. package/senior-ci/scripts/create_sre_issue/__main__.py +7 -0
  113. package/senior-ci/scripts/create_sre_issue/create_sre_issue.py +267 -0
  114. package/senior-ci/scripts/create_sre_issue/helpers.py +166 -0
  115. package/senior-ci/scripts/create_sre_issue/jira_manager.py +37 -0
  116. package/senior-ci/scripts/validate_changelog.sh +3 -0
  117. package/senior-ci/sonar-project.properties +1 -0
  118. package/server.js +5 -0
  119. package/sonar-project.properties +10 -0
  120. package/src/app/app.component.html +43 -0
  121. package/src/app/app.component.scss +36 -0
  122. package/src/app/app.component.ts +56 -0
  123. package/src/app/app.module.ts +64 -0
  124. package/src/app/shared/shared.module.ts +28 -0
  125. package/src/environments/environment.default.ts +3 -0
  126. package/src/environments/environment.prod.ts +6 -0
  127. package/src/environments/environment.ts +7 -0
  128. package/src/favicon.ico +0 -0
  129. package/src/index.html +17 -0
  130. package/src/locale/en-US.json +3 -0
  131. package/src/locale/es-ES.json +3 -0
  132. package/src/locale/pt-BR.json +3 -0
  133. package/src/main.ts +13 -0
  134. package/src/polyfills.ts +58 -0
  135. package/src/styles.scss +11 -0
  136. package/src/tsconfig.app.json +21 -0
  137. package/src/typings.d.ts +15 -0
  138. package/tsconfig.json +39 -0
  139. package/tslint.json +80 -0
  140. package/bundles/seniorsistemas-exclusion-process-component.umd.js +0 -747
  141. package/bundles/seniorsistemas-exclusion-process-component.umd.js.map +0 -1
  142. package/bundles/seniorsistemas-exclusion-process-component.umd.min.js +0 -16
  143. package/bundles/seniorsistemas-exclusion-process-component.umd.min.js.map +0 -1
  144. package/esm2015/enums/enum-exclusion-process-status.js +0 -8
  145. package/esm2015/exclusion-details/exclusion-details.component.js +0 -216
  146. package/esm2015/exclusion-details/exclusion-details.module.js +0 -28
  147. package/esm2015/exclusion-details/index.js +0 -3
  148. package/esm2015/exclusion-details/protocols/exclusion-details.js +0 -1
  149. package/esm2015/exclusion-details/protocols/index.js +0 -2
  150. package/esm2015/exclusion-details/protocols/show-details-information.js +0 -3
  151. package/esm2015/logical-delete.module.js +0 -27
  152. package/esm2015/models/exclusion-process-step-group.js +0 -1
  153. package/esm2015/models/exclusion-process-step.js +0 -1
  154. package/esm2015/models/exclusion-process.js +0 -1
  155. package/esm2015/models/index.js +0 -1
  156. package/esm2015/models/list-params.js +0 -1
  157. package/esm2015/models/list-result.js +0 -1
  158. package/esm2015/models/project-config.js +0 -3
  159. package/esm2015/public-api.js +0 -3
  160. package/esm2015/seniorsistemas-exclusion-process-component.js +0 -9
  161. package/esm2015/services/filter.service.js +0 -104
  162. package/esm2015/services/logical-delete-config.service.js +0 -29
  163. package/esm2015/services/logical-delete.service.js +0 -109
  164. package/esm5/enums/enum-exclusion-process-status.js +0 -8
  165. package/esm5/exclusion-details/exclusion-details.component.js +0 -235
  166. package/esm5/exclusion-details/exclusion-details.module.js +0 -31
  167. package/esm5/exclusion-details/index.js +0 -3
  168. package/esm5/exclusion-details/protocols/exclusion-details.js +0 -1
  169. package/esm5/exclusion-details/protocols/index.js +0 -2
  170. package/esm5/exclusion-details/protocols/show-details-information.js +0 -7
  171. package/esm5/logical-delete.module.js +0 -31
  172. package/esm5/models/exclusion-process-step-group.js +0 -1
  173. package/esm5/models/exclusion-process-step.js +0 -1
  174. package/esm5/models/exclusion-process.js +0 -1
  175. package/esm5/models/index.js +0 -1
  176. package/esm5/models/list-params.js +0 -1
  177. package/esm5/models/list-result.js +0 -1
  178. package/esm5/models/project-config.js +0 -3
  179. package/esm5/public-api.js +0 -3
  180. package/esm5/seniorsistemas-exclusion-process-component.js +0 -9
  181. package/esm5/services/filter.service.js +0 -109
  182. package/esm5/services/logical-delete-config.service.js +0 -30
  183. package/esm5/services/logical-delete.service.js +0 -112
  184. package/exclusion-details/exclusion-details.component.d.ts +0 -49
  185. package/exclusion-details/exclusion-details.module.d.ts +0 -2
  186. package/fesm2015/seniorsistemas-exclusion-process-component.js +0 -495
  187. package/fesm2015/seniorsistemas-exclusion-process-component.js.map +0 -1
  188. package/fesm5/seniorsistemas-exclusion-process-component.js +0 -530
  189. package/fesm5/seniorsistemas-exclusion-process-component.js.map +0 -1
  190. package/logical-delete.module.d.ts +0 -5
  191. package/seniorsistemas-exclusion-process-component.d.ts +0 -8
  192. package/seniorsistemas-exclusion-process-component.metadata.json +0 -1
  193. package/services/filter.service.d.ts +0 -19
  194. package/services/logical-delete-config.service.d.ts +0 -8
  195. package/services/logical-delete.service.d.ts +0 -20
  196. /package/{exclusion-details/index.d.ts → lib/src/exclusion-details/index.ts} +0 -0
  197. /package/{exclusion-details/protocols/index.d.ts → lib/src/exclusion-details/protocols/index.ts} +0 -0
  198. /package/{models/index.d.ts → lib/src/models/index.ts} +0 -0
  199. /package/{models/list-result.d.ts → lib/src/models/list-result.ts} +0 -0
  200. /package/{public-api.d.ts → lib/src/public-api.ts} +0 -0
@@ -0,0 +1,335 @@
1
+ import * as moment from 'moment';
2
+ import { ChangeDetectorRef, Component, OnDestroy, OnInit, ViewChild } from '@angular/core';
3
+ import { FormBuilder, FormGroup, Validators } from '@angular/forms';
4
+ import { TranslateService } from '@ngx-translate/core';
5
+ import { LazyLoadEvent } from 'primeng/api';
6
+ import { Subject } from 'rxjs';
7
+ import { catchError, finalize, takeUntil } from 'rxjs/operators';
8
+ import { EnumBadgeColors, EnumColumnFieldType, FieldType, FormField, IToken, TableColumnLocaleOptions } from '@seniorsistemas/angular-components';
9
+ import { EnumExclusionProcessStatus } from '../enums/enum-exclusion-process-status';
10
+ import { ExclusionProcess } from '../models';
11
+ import { Table } from 'primeng/table';
12
+ import { LogicalDeleteService } from '../services';
13
+ import { ActivatedRoute } from '@angular/router';
14
+ import { ListParams } from '../models/list-params';
15
+ import { LogicalDeleteConfigService } from '../services/logical-delete-config.service';
16
+ import { ExclusionDetailsComponent } from '../exclusion-details';
17
+ import { FilterService } from '../services/filter.service';
18
+
19
+ @Component({
20
+ templateUrl: "./exclusions-list.component.html",
21
+ styleUrls: [],
22
+ providers: []
23
+ })
24
+ export class ExclusionsListComponent implements OnInit, OnDestroy {
25
+ public locale!: TableColumnLocaleOptions;
26
+ public entityName: string;
27
+ public entityDescription: string;
28
+
29
+ public currentListParams: ListParams = { page: 0, size: 10, sort: [], filterData: {} };
30
+ public gridData: ExclusionProcess[];
31
+ public gridColumns: any[];
32
+ public showLoader: boolean = false;
33
+ public totalRecords = 0;
34
+
35
+ public filterFields: FormField[];
36
+ public filterFormGroup: FormGroup;
37
+ public filtersPanelCollapsed = true;
38
+ public searchTokens: IToken[] = [];
39
+ public serverError: boolean = false;
40
+
41
+ @ViewChild("exclusionsTable")
42
+ public table: Table;
43
+
44
+ @ViewChild(ExclusionDetailsComponent)
45
+ public exclusionDetailsComponent: ExclusionDetailsComponent;
46
+
47
+ private ngUnsubscribe = new Subject();
48
+
49
+ constructor(
50
+ private readonly route: ActivatedRoute,
51
+ private readonly translate: TranslateService,
52
+ private readonly formBuilder: FormBuilder,
53
+ private readonly changeDetectorRef: ChangeDetectorRef,
54
+ private readonly logicalDeleteService: LogicalDeleteService,
55
+ private readonly filterService: FilterService,
56
+ private readonly projectConfigs: LogicalDeleteConfigService
57
+ ) {
58
+ }
59
+
60
+ public ngOnInit() {
61
+ this.filterFormGroup = this.getFormBuilder();
62
+ this.filterFields = this.getFilterFields();
63
+ this.gridColumns = this.getGridColumns();
64
+
65
+ this.route.data
66
+ .pipe(takeUntil(this.ngUnsubscribe))
67
+ .subscribe((data: { [configs: string]: any, localeConfig: TableColumnLocaleOptions }) => {
68
+ this.locale = data.localeConfig;
69
+ });
70
+ this.route.params
71
+ .pipe(takeUntil(this.ngUnsubscribe))
72
+ .subscribe((params: any) => {
73
+ this.entityName = params.entityName;
74
+ });
75
+ this.route.queryParams
76
+ .pipe(takeUntil(this.ngUnsubscribe))
77
+ .subscribe((queryParams: any) => {
78
+ this.entityDescription = queryParams.entityDescription;
79
+ });
80
+ }
81
+
82
+ public ngOnDestroy() {
83
+ this.ngUnsubscribe.next();
84
+ this.ngUnsubscribe.complete();
85
+ }
86
+
87
+ private getFormBuilder() {
88
+ return this.formBuilder.group({
89
+ description: [undefined, Validators.compose([])],
90
+ state: [undefined, Validators.compose([])],
91
+ startDate: [{ value: undefined, disabled: false }, Validators.compose([])],
92
+ endDate: [{ value: undefined, disabled: false }, Validators.compose([])]
93
+ });
94
+ }
95
+
96
+ private getGridColumns() {
97
+ return [
98
+ {
99
+ field: "description",
100
+ attributes: ['description'],
101
+ header: this.translate.instant(`${this.projectConfigs.getTranslationPrefix()}.logical_delete_description`),
102
+ type: EnumColumnFieldType.STRING,
103
+ style: {
104
+ width: '300px'
105
+ }
106
+ },
107
+ {
108
+ field: "status",
109
+ attributes: ['status'],
110
+ header: this.translate.instant(`${this.projectConfigs.getTranslationPrefix()}.logical_delete_status`),
111
+ type: EnumColumnFieldType.ENUM,
112
+ enumPrefix: `${this.projectConfigs.getTranslationPrefix()}.logical_delete_enum_exclusion_process_status_`,
113
+ style: {
114
+ width: '100px'
115
+ },
116
+ badgeConfigs: [
117
+ {
118
+ enumValue: EnumExclusionProcessStatus.ERROR,
119
+ color: EnumBadgeColors.RED
120
+ },
121
+ {
122
+ enumValue: EnumExclusionProcessStatus.PENDING,
123
+ color: EnumBadgeColors.YELLOW
124
+ },
125
+ {
126
+ enumValue: EnumExclusionProcessStatus.PROCESSING,
127
+ color: EnumBadgeColors.BLUE
128
+ },
129
+ {
130
+ enumValue: EnumExclusionProcessStatus.SUCCESS,
131
+ color: EnumBadgeColors.GREEN
132
+ }
133
+ ]
134
+ },
135
+ {
136
+ field: "startDate",
137
+ attributes: ['startDate'],
138
+ header: this.translate.instant(`${this.projectConfigs.getTranslationPrefix()}.logical_delete_start`),
139
+ type: EnumColumnFieldType.DATE,
140
+ dateFormat: "DD/MM/YYYY HH:mm",
141
+ style: {
142
+ width: '100px'
143
+ }
144
+ },
145
+ {
146
+ field: "finishDate",
147
+ attributes: ['finishDate'],
148
+ header: this.translate.instant(`${this.projectConfigs.getTranslationPrefix()}.logical_delete_finish`),
149
+ type: EnumColumnFieldType.DATE,
150
+ dateFormat: "DD/MM/YYYY HH:mm",
151
+ style: {
152
+ width: '100px'
153
+ }
154
+ }
155
+ ];
156
+ }
157
+
158
+ private getFilterFields() {
159
+ return [
160
+ new FormField({
161
+ type: FieldType.String,
162
+ name: "description",
163
+ label: this.translate.instant(`${this.projectConfigs.getTranslationPrefix()}.logical_delete_description`)
164
+ }),
165
+ new FormField({
166
+ type: FieldType.Enum,
167
+ name: "state",
168
+ label: this.translate.instant(`${this.projectConfigs.getTranslationPrefix()}.logical_delete_status`),
169
+ placeholder: this.translate.instant(`${this.projectConfigs.getTranslationPrefix()}.logical_delete_status`),
170
+ multiple: true,
171
+ options: [
172
+ {
173
+ label: this.translate.instant(`${this.projectConfigs.getTranslationPrefix()}.logical_delete_enum_exclusion_process_status_error`),
174
+ value: EnumExclusionProcessStatus.ERROR
175
+ },
176
+ {
177
+ label: this.translate.instant(`${this.projectConfigs.getTranslationPrefix()}.logical_delete_enum_exclusion_process_status_pending`),
178
+ value: EnumExclusionProcessStatus.PENDING
179
+ },
180
+ {
181
+ label: this.translate.instant(`${this.projectConfigs.getTranslationPrefix()}.logical_delete_enum_exclusion_process_status_processing`),
182
+ value: EnumExclusionProcessStatus.PROCESSING
183
+ },
184
+ {
185
+ label: this.translate.instant(`${this.projectConfigs.getTranslationPrefix()}.logical_delete_enum_exclusion_process_status_success`),
186
+ value: EnumExclusionProcessStatus.SUCCESS
187
+ }
188
+ ]
189
+ }),
190
+ new FormField({
191
+ type: FieldType.Date,
192
+ name: "startDate",
193
+ label: this.translate.instant(`${this.projectConfigs.getTranslationPrefix()}.logical_delete_start`)
194
+ }),
195
+
196
+ new FormField({
197
+ type: FieldType.Date,
198
+ name: "endDate",
199
+ label: this.translate.instant(`${this.projectConfigs.getTranslationPrefix()}.logical_delete_finish`)
200
+ })
201
+ ];
202
+ }
203
+
204
+ public getEmptyStateTitle() {
205
+ return this.translate.instant(`${this.projectConfigs.getTranslationPrefix()}.logical_delete_empty_state_title`);
206
+ }
207
+
208
+ public getEmptyStateDescription() {
209
+ return this.translate.instant(`${this.projectConfigs.getTranslationPrefix()}.logical_delete_empty_state_description`);
210
+ }
211
+
212
+ public getTitle() {
213
+ return this.translate.instant(`${this.projectConfigs.getTranslationPrefix()}.logical_delete_list_title`);
214
+ }
215
+
216
+ public getDetailsButtonTitle() {
217
+ return this.translate.instant(`${this.projectConfigs.getTranslationPrefix()}.logical_delete_details`);
218
+ }
219
+
220
+ public onSearch() {
221
+ const filterData = this.filterFormGroup.getRawValue();
222
+ this.filtersPanelCollapsed = true;
223
+ this.resetGrid({ filterData });
224
+ }
225
+
226
+ public onClear() {
227
+ this.filterFormGroup.reset();
228
+ const filterData = this.filterFormGroup.getRawValue();
229
+ this.resetGrid({ filterData });
230
+ }
231
+
232
+ public onRemoveToken(token: IToken) {
233
+ this.filterFormGroup.get(token.id).setValue(undefined);
234
+ const filterData = this.filterFormGroup.getRawValue();
235
+ this.resetGrid({ filterData });
236
+ }
237
+
238
+ public onGridChange(event: LazyLoadEvent) {
239
+ const size = event.rows;
240
+ const page = event.first / size;
241
+ const sort = event.multiSortMeta ? event.multiSortMeta : [];
242
+ return this.updateGrid({ page, size, sort });
243
+ }
244
+
245
+ private getFilterTokens() {
246
+ const filterData = this.filterFormGroup.value;
247
+
248
+ return this.filterFields
249
+ .filter(({ name }) => filterData[name] != undefined && filterData[name] !== "")
250
+ .map(formField => this.filterService.createFilterTokens(formField, filterData[formField.name]));
251
+ }
252
+
253
+ private getFilterQuery(): string {
254
+ const { filterData } = this.currentListParams;
255
+ const dateFields = ['startDate', 'endDate'];
256
+
257
+ let filterQuery = this.filterFields
258
+ .filter(({ name }) => !dateFields.includes(name))
259
+ .filter(({ name }) => filterData[name] != undefined)
260
+ .map(formField => this.filterService.createFilterString(formField, filterData[formField.name]))
261
+ .join(" and ");
262
+
263
+ if (filterData.startDate && filterData.endDate) {
264
+ const startDate = moment(filterData.startDate).format('YYYY-MM-DD');
265
+ const endDate = moment(filterData.endDate).format('YYYY-MM-DD');
266
+ const dateQuery = `startDate between '${startDate}' and '${endDate}'`;
267
+ if (filterQuery) {
268
+ filterQuery += ` and ${dateQuery}`;
269
+ } else {
270
+ filterQuery = dateQuery;
271
+ }
272
+ }
273
+
274
+ return filterQuery;
275
+ }
276
+
277
+ private updateGrid(listParams: ListParams = {}) {
278
+ this.currentListParams = { ...this.currentListParams, ...listParams };
279
+ const { page, size, sort } = this.currentListParams;
280
+
281
+ this.searchTokens = this.getFilterTokens();
282
+ const filterQuery = this.getFilterQuery();
283
+ const displayFields = [
284
+ 'recordId',
285
+ ...this.gridColumns.map(column => column.field)
286
+ ];
287
+
288
+ this.listExclusions({ page, size, sort, filterQuery, displayFields });
289
+ }
290
+
291
+ public listExclusions(params: any) {
292
+ this.showLoader = true;
293
+ this.serverError = false;
294
+
295
+ this.changeDetectorRef.detectChanges();
296
+
297
+ this.logicalDeleteService
298
+ .listExclusions(this.entityName, params)
299
+ .pipe(
300
+ takeUntil(this.ngUnsubscribe),
301
+ catchError((err: any) => {
302
+ if (err.status >= 500 && err.status < 600) {
303
+ this.serverError = true;
304
+ }
305
+ throw err;
306
+ }),
307
+ finalize(() => this.showLoader = false)
308
+ )
309
+ .subscribe((list: any) => {
310
+ this.gridData = list.contents;
311
+ this.totalRecords = list.totalElements;
312
+ });
313
+ }
314
+
315
+ public focusInput(elementId: string) {
316
+ const element: any = document.getElementById(`${elementId}`);
317
+ if (element) {
318
+ element.focus();
319
+ }
320
+ }
321
+
322
+ public resetGrid(listParams?: ListParams) {
323
+ if (listParams) this.currentListParams = { ...this.currentListParams, ...listParams };
324
+ this.currentListParams = { ...this.currentListParams, page: 0, sort: [] };
325
+ this.table.reset();
326
+ }
327
+
328
+ public onClickDetails(rowData: ExclusionProcess) {
329
+ this.exclusionDetailsComponent.showDetails({
330
+ recordId: rowData.recordId,
331
+ entityDescription: this.entityDescription,
332
+ entityName: this.entityName
333
+ });
334
+ }
335
+ }
@@ -0,0 +1,52 @@
1
+ import { CommonModule } from "@angular/common";
2
+ import { NgModule } from "@angular/core";
3
+ import { PanelModule } from "primeng/panel";
4
+ import { TableModule as PrimeTableModule } from "primeng/table";
5
+ import {
6
+ ButtonModule,
7
+ LoadingStateModule,
8
+ TableModule,
9
+ LocaleModule,
10
+ TokenListModule,
11
+ DynamicFormModule,
12
+ EmptyStateModule,
13
+ ControlErrorsModule,
14
+ InfoSignModule
15
+ } from "@seniorsistemas/angular-components";
16
+ import { ExclusionsListComponent } from "./exclusions-list.component";
17
+ import { TranslateModule } from "@ngx-translate/core";
18
+ import { FormsModule, ReactiveFormsModule } from "@angular/forms";
19
+ import { DialogModule } from "primeng/dialog";
20
+ import { ConfirmDialogModule } from "primeng/confirmdialog";
21
+ import { InputTextModule } from "primeng/inputtext";
22
+ import { ExclusionDetailsModule } from "../exclusion-details";
23
+ import { ExclusionsListFeatureRouting } from "./exclusions-list.routing";
24
+
25
+ @NgModule({
26
+ imports: [
27
+ FormsModule,
28
+ ReactiveFormsModule,
29
+ TranslateModule,
30
+ CommonModule,
31
+ ControlErrorsModule,
32
+ ButtonModule,
33
+ PanelModule,
34
+ InputTextModule,
35
+ InfoSignModule,
36
+ ConfirmDialogModule,
37
+ DialogModule,
38
+ PrimeTableModule,
39
+ TableModule,
40
+ LoadingStateModule,
41
+ EmptyStateModule,
42
+ DynamicFormModule,
43
+ TokenListModule,
44
+ LocaleModule.forChild(),
45
+ ExclusionDetailsModule,
46
+ ExclusionsListFeatureRouting
47
+ ],
48
+ declarations: [ExclusionsListComponent],
49
+ exports: [ExclusionsListComponent],
50
+ entryComponents: [ExclusionsListComponent]
51
+ })
52
+ export class ExclusionsListModule {}
@@ -0,0 +1,89 @@
1
+ import { NgModule, Injectable, Component } from "@angular/core";
2
+ import { RouterModule, Routes, CanActivate } from "@angular/router";
3
+ import { TranslateService } from "@ngx-translate/core";
4
+ import { PermissionsService } from "@seniorsistemas/platform-components";
5
+ import { LocaleService } from "@seniorsistemas/angular-components";
6
+ import { ExclusionsListComponent } from "./exclusions-list.component";
7
+ import { LogicalDeleteConfigService } from "../services/logical-delete-config.service";
8
+
9
+ @Injectable()
10
+ export class ExclusionsListFeatureRoutingGuard implements CanActivate {
11
+ public canActivate() {
12
+ return true;
13
+ }
14
+ }
15
+
16
+ @Injectable()
17
+ export class ExclusionsListFeatureRoutingListTitleResolver {
18
+ constructor(
19
+ private readonly translate: TranslateService,
20
+ private readonly projectConfigs: LogicalDeleteConfigService
21
+ ) {}
22
+
23
+ public resolve() {
24
+ return this.translate.get(`${this.projectConfigs.getTranslationPrefix()}.logical_delete_list_title`);
25
+ }
26
+ }
27
+
28
+ @Injectable()
29
+ export class ExclusionsListFeatureRoutingPermissionResolver {
30
+ constructor(private readonly permissionsService: PermissionsService) {}
31
+
32
+ public resolve() {
33
+ return this.permissionsService.get();
34
+ }
35
+ }
36
+
37
+ @Injectable()
38
+ export class ExclusionsListFeatureRoutingLocaleResolver {
39
+ constructor(private readonly localeService: LocaleService) {}
40
+
41
+ public resolve() {
42
+ return this.localeService.get();
43
+ }
44
+ }
45
+
46
+ @Component({
47
+ template: `<router-outlet></router-outlet>`
48
+ })
49
+ export class EmptyComponent {}
50
+
51
+ export const routes: Routes = [
52
+ {
53
+ path: "exclusions-list",
54
+ component: EmptyComponent,
55
+ canActivate: [
56
+ ExclusionsListFeatureRoutingGuard
57
+ ],
58
+ resolve: {
59
+ allPermissions: ExclusionsListFeatureRoutingPermissionResolver,
60
+ localeConfig: ExclusionsListFeatureRoutingLocaleResolver,
61
+ routeTitle: ExclusionsListFeatureRoutingListTitleResolver
62
+ },
63
+ children: [
64
+ {
65
+ path: ":entityName",
66
+ component: ExclusionsListComponent
67
+ }
68
+ ]
69
+ }
70
+ ];
71
+
72
+ @NgModule({
73
+ imports: [
74
+ RouterModule.forChild(routes)
75
+ ],
76
+ exports: [
77
+ RouterModule
78
+ ],
79
+ providers: [
80
+ ExclusionsListFeatureRoutingGuard,
81
+ ExclusionsListFeatureRoutingPermissionResolver,
82
+ ExclusionsListFeatureRoutingLocaleResolver,
83
+ ExclusionsListFeatureRoutingListTitleResolver
84
+ ],
85
+ declarations: [
86
+ EmptyComponent
87
+ ]
88
+ })
89
+ export class ExclusionsListFeatureRouting {}
@@ -0,0 +1,2 @@
1
+ export * from "./exclusions-list.module";
2
+ export * from "./exclusions-list.component";
@@ -0,0 +1,22 @@
1
+ import { ModuleWithProviders, NgModule } from "@angular/core";
2
+ import { ProjectConfigs, ProjectConfigsInjectionToken } from "./models/project-config";
3
+ import { FilterService } from "./services/filter.service";
4
+ import { LogicalDeleteConfigService } from "./services/logical-delete-config.service";
5
+ import { LogicalDeleteService } from "./services/logical-delete.service";
6
+
7
+ @NgModule({
8
+ providers: [LogicalDeleteService, LogicalDeleteConfigService, FilterService]
9
+ })
10
+ export class LogicalDeleteModule {
11
+ static forRoot(config: ProjectConfigs): ModuleWithProviders<LogicalDeleteModule> {
12
+ return {
13
+ ngModule: LogicalDeleteModule,
14
+ providers: [
15
+ {
16
+ provide: ProjectConfigsInjectionToken,
17
+ useValue: config
18
+ }
19
+ ]
20
+ };
21
+ }
22
+ }
@@ -1,6 +1,7 @@
1
1
  import { EnumExclusionProcessStatus } from "../enums/enum-exclusion-process-status";
2
2
  import { ExclusionProcess } from "./exclusion-process";
3
3
  import { ExclusionProcessStep } from "./exclusion-process-step";
4
+
4
5
  export interface ExclusionProcessStepGroup {
5
6
  id: string;
6
7
  description: string;
@@ -1,4 +1,5 @@
1
1
  import { EnumExclusionProcessStatus } from "../enums/enum-exclusion-process-status";
2
+
2
3
  export interface ExclusionProcessStep {
3
4
  id: string;
4
5
  description: string;
@@ -1,5 +1,6 @@
1
1
  import { EnumExclusionProcessStatus } from "../enums/enum-exclusion-process-status";
2
2
  import { ExclusionProcessStepGroup } from "./exclusion-process-step-group";
3
+
3
4
  export interface ExclusionProcess {
4
5
  id: string;
5
6
  entityName: string;
@@ -1,4 +1,5 @@
1
1
  import { SortMeta } from "primeng/api";
2
+
2
3
  export interface ListParams {
3
4
  page?: number;
4
5
  size?: number;
@@ -1,5 +1,7 @@
1
1
  import { InjectionToken } from "@angular/core";
2
- export declare const ProjectConfigsInjectionToken: InjectionToken<ProjectConfigs>;
2
+
3
+ export const ProjectConfigsInjectionToken = new InjectionToken<ProjectConfigs>("projectConfigs");
4
+
3
5
  export interface ProjectConfigs {
4
6
  domain: string;
5
7
  service: string;