dts-backoffice-util 16.0.0 → 17.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/README.md +143 -52
  2. package/esm2022/dts-backoffice-util.mjs +4 -4
  3. package/esm2022/lib/components/totvs-schedule-execution/totvs-schedule-execution.component.mjs +305 -272
  4. package/esm2022/lib/components/totvs-schedule-execution/totvs-schedule-execution.model.mjs +7 -7
  5. package/esm2022/lib/components/totvs-schedule-execution/totvs-schedule-execution.service.mjs +208 -183
  6. package/esm2022/lib/dts-backoffice-util.module.mjs +54 -54
  7. package/esm2022/lib/interfaces/filter-range.interface.mjs +1 -1
  8. package/esm2022/lib/interfaces/totvs-response.interface.mjs +1 -1
  9. package/esm2022/lib/model/session-info.model.mjs +67 -67
  10. package/esm2022/lib/pipes/dts-date-format.pipe.mjs +20 -20
  11. package/esm2022/lib/services/breadcrumb-control.service.mjs +99 -99
  12. package/esm2022/lib/services/cache-params.service.mjs +25 -25
  13. package/esm2022/lib/services/menu-datasul.service.mjs +118 -118
  14. package/esm2022/lib/services/profile.service.mjs +55 -55
  15. package/esm2022/lib/services/report.service.mjs +57 -57
  16. package/esm2022/lib/services/session-info.service.mjs +36 -36
  17. package/esm2022/lib/services/translate.service.mjs +23 -23
  18. package/esm2022/lib/utils/date.util.mjs +56 -56
  19. package/esm2022/lib/utils/disclaimer.util.mjs +490 -490
  20. package/esm2022/lib/utils/field-validation.util.mjs +179 -179
  21. package/esm2022/lib/utils/file.util.mjs +151 -151
  22. package/esm2022/lib/utils/filter-range.util.mjs +32 -32
  23. package/esm2022/lib/utils/generic-functions.utils.mjs +170 -170
  24. package/esm2022/public-api.mjs +33 -33
  25. package/fesm2022/dts-backoffice-util.mjs +2013 -1955
  26. package/fesm2022/dts-backoffice-util.mjs.map +1 -1
  27. package/index.d.ts +5 -5
  28. package/lib/components/totvs-schedule-execution/totvs-schedule-execution.component.d.ts +53 -49
  29. package/lib/components/totvs-schedule-execution/totvs-schedule-execution.model.d.ts +68 -60
  30. package/lib/components/totvs-schedule-execution/totvs-schedule-execution.service.d.ts +30 -30
  31. package/lib/dts-backoffice-util.module.d.ts +14 -14
  32. package/lib/interfaces/filter-range.interface.d.ts +18 -18
  33. package/lib/interfaces/totvs-response.interface.d.ts +4 -4
  34. package/lib/model/session-info.model.d.ts +40 -40
  35. package/lib/pipes/dts-date-format.pipe.d.ts +7 -7
  36. package/lib/services/breadcrumb-control.service.d.ts +18 -18
  37. package/lib/services/cache-params.service.d.ts +10 -10
  38. package/lib/services/menu-datasul.service.d.ts +27 -27
  39. package/lib/services/profile.service.d.ts +25 -25
  40. package/lib/services/report.service.d.ts +31 -31
  41. package/lib/services/session-info.service.d.ts +12 -12
  42. package/lib/services/translate.service.d.ts +8 -8
  43. package/lib/utils/date.util.d.ts +9 -9
  44. package/lib/utils/disclaimer.util.d.ts +40 -40
  45. package/lib/utils/field-validation.util.d.ts +21 -21
  46. package/lib/utils/file.util.d.ts +23 -23
  47. package/lib/utils/filter-range.util.d.ts +7 -7
  48. package/lib/utils/generic-functions.utils.d.ts +24 -24
  49. package/package.json +5 -5
  50. package/public-api.d.ts +20 -20
@@ -11,1992 +11,2050 @@ import { CommonModule } from '@angular/common';
11
11
  import * as i4 from '@angular/forms';
12
12
  import { FormsModule } from '@angular/forms';
13
13
 
14
- class UserLoginService {
15
- constructor(http) {
16
- this.http = http;
17
- this.apiUrl = '/totvs-menu/rest/getSessionInfo';
18
- this.userLogin = undefined;
19
- }
20
- getUserLogin() {
21
- if (localStorage.getItem('username')) {
22
- return of(localStorage.getItem('username'));
23
- }
24
- if (this.userLogin) {
25
- return of(this.userLogin);
26
- }
27
- else {
28
- return this.http.get(`${this.apiUrl}`)
29
- .pipe(map((response) => {
30
- this.userLogin = response.userName;
31
- return response.userName;
32
- }));
33
- }
34
- }
35
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: UserLoginService, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
36
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: UserLoginService, providedIn: 'root' }); }
37
- }
38
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: UserLoginService, decorators: [{
39
- type: Injectable,
40
- args: [{
41
- providedIn: 'root'
42
- }]
43
- }], ctorParameters: function () { return [{ type: i1.HttpClient }]; } });
14
+ class UserLoginService {
15
+ constructor(http) {
16
+ this.http = http;
17
+ this.apiUrl = '/totvs-menu/rest/getSessionInfo';
18
+ this.userLogin = undefined;
19
+ }
20
+ getUserLogin() {
21
+ if (localStorage.getItem('username')) {
22
+ return of(localStorage.getItem('username'));
23
+ }
24
+ if (this.userLogin) {
25
+ return of(this.userLogin);
26
+ }
27
+ else {
28
+ return this.http.get(`${this.apiUrl}`)
29
+ .pipe(map((response) => {
30
+ this.userLogin = response.userName;
31
+ return response.userName;
32
+ }));
33
+ }
34
+ }
35
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: UserLoginService, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
36
+ /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: UserLoginService, providedIn: 'root' }); }
37
+ }
38
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: UserLoginService, decorators: [{
39
+ type: Injectable,
40
+ args: [{
41
+ providedIn: 'root'
42
+ }]
43
+ }], ctorParameters: () => [{ type: i1.HttpClient }] });
44
44
 
45
- var EDataType;
46
- (function (EDataType) {
47
- EDataType[EDataType["STRING"] = 1] = "STRING";
48
- EDataType[EDataType["JSON"] = 2] = "JSON";
49
- })(EDataType || (EDataType = {}));
50
- class ProfileService {
51
- constructor(http) {
52
- this.http = http;
53
- this.apiURL = '/dts/datasul-rest/resources/api/btb/btapi930za';
54
- }
55
- setProfile(profile) {
56
- const headers = { 'X-PO-Screen-Lock': 'true' };
57
- const { pageId, userCode } = profile;
58
- return this.http
59
- .post(`${this.apiURL}/setProfile?userCode=${userCode}&pageId=${pageId}`, profile, { headers });
60
- }
61
- getProfileAsString(profile, showLoading) {
62
- return this.getProfile(profile, EDataType.STRING, showLoading ? 'true' : 'false');
63
- }
64
- getProfileAsJSON(profile, showLoading) {
65
- return this.getProfile(profile, EDataType.JSON, showLoading ? 'true' : 'false');
66
- }
67
- getProfile(profile, dataType, showLoading) {
68
- const headers = { 'X-PO-Screen-Lock': showLoading };
69
- const { pageId, dataCode, userCode } = profile;
70
- return this.http
71
- .get(`${this.apiURL}/getProfile?userCode=${userCode}&pageId=${pageId}&dataCode=${dataCode}`, { headers })
72
- .pipe(map(preference => {
73
- if (preference.data[0]) {
74
- if (dataType === EDataType.STRING) {
75
- return preference.data[0].dataValue;
76
- }
77
- if (dataType === EDataType.JSON) {
78
- return JSON.parse(preference.data[0].dataValue);
79
- }
80
- }
81
- else {
82
- return undefined;
83
- }
84
- }));
85
- }
86
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ProfileService, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
87
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ProfileService, providedIn: 'root' }); }
88
- }
89
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ProfileService, decorators: [{
90
- type: Injectable,
91
- args: [{
92
- providedIn: 'root'
93
- }]
94
- }], ctorParameters: function () { return [{ type: i1.HttpClient }]; } });
45
+ var EDataType;
46
+ (function (EDataType) {
47
+ EDataType[EDataType["STRING"] = 1] = "STRING";
48
+ EDataType[EDataType["JSON"] = 2] = "JSON";
49
+ })(EDataType || (EDataType = {}));
50
+ class ProfileService {
51
+ constructor(http) {
52
+ this.http = http;
53
+ this.apiURL = '/dts/datasul-rest/resources/api/btb/btapi930za';
54
+ }
55
+ setProfile(profile) {
56
+ const headers = { 'X-PO-Screen-Lock': 'true' };
57
+ const { pageId, userCode } = profile;
58
+ return this.http
59
+ .post(`${this.apiURL}/setProfile?userCode=${userCode}&pageId=${pageId}`, profile, { headers });
60
+ }
61
+ getProfileAsString(profile, showLoading) {
62
+ return this.getProfile(profile, EDataType.STRING, showLoading ? 'true' : 'false');
63
+ }
64
+ getProfileAsJSON(profile, showLoading) {
65
+ return this.getProfile(profile, EDataType.JSON, showLoading ? 'true' : 'false');
66
+ }
67
+ getProfile(profile, dataType, showLoading) {
68
+ const headers = { 'X-PO-Screen-Lock': showLoading };
69
+ const { pageId, dataCode, userCode } = profile;
70
+ return this.http
71
+ .get(`${this.apiURL}/getProfile?userCode=${userCode}&pageId=${pageId}&dataCode=${dataCode}`, { headers })
72
+ .pipe(map(preference => {
73
+ if (preference.data[0]) {
74
+ if (dataType === EDataType.STRING) {
75
+ return preference.data[0].dataValue;
76
+ }
77
+ if (dataType === EDataType.JSON) {
78
+ return JSON.parse(preference.data[0].dataValue);
79
+ }
80
+ }
81
+ else {
82
+ return undefined;
83
+ }
84
+ }));
85
+ }
86
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: ProfileService, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
87
+ /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: ProfileService, providedIn: 'root' }); }
88
+ }
89
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: ProfileService, decorators: [{
90
+ type: Injectable,
91
+ args: [{
92
+ providedIn: 'root'
93
+ }]
94
+ }], ctorParameters: () => [{ type: i1.HttpClient }] });
95
95
 
96
- var ReportFormats;
97
- (function (ReportFormats) {
98
- ReportFormats["XLSX"] = "xlsx";
99
- ReportFormats["PDF"] = "pdf";
100
- ReportFormats["DOCX"] = "docx";
101
- ReportFormats["HTML"] = "html";
102
- })(ReportFormats || (ReportFormats = {}));
103
- class ReportService {
104
- constructor(httpClient) {
105
- this.httpClient = httpClient;
106
- this.URL = window.location.href.indexOf('totvs-menu') > 0 ? '/totvs-menu/rest/report/run/'
107
- : '/dts/datasul-report/resources/run/';
108
- }
109
- generate(params, showLoading = true) {
110
- const headers = { 'X-PO-Screen-Lock': showLoading ? 'true' : 'false' };
111
- let reportURL = `${this.URL}${params.reportName}`;
112
- if (params.properties.length > 0) {
113
- reportURL += '?';
114
- params.properties.forEach((property, index) => {
115
- if (index > 0) {
116
- reportURL += '&';
117
- }
118
- reportURL += `c_properties=${property.name}&c_values=${property.value}`;
119
- });
120
- }
121
- reportURL += `&dialect=${params.dialect}&format=${params.format}`;
122
- reportURL += `&program=${params.programName}&resultFileName=${params.downloadName}`;
123
- return this.httpClient.post(reportURL, {}, { headers, responseType: 'blob' })
124
- .pipe(map(report => {
125
- if (params.download) {
126
- this.download(report, `${params.downloadName}.${params.format}`);
127
- }
128
- return report;
129
- }));
130
- }
131
- download(file, fileName) {
132
- const binaryData = [file];
133
- const downloadLink = document.createElement('a');
134
- const urlDownload = window.URL.createObjectURL(new Blob(binaryData, { type: file.type }));
135
- downloadLink.href = urlDownload;
136
- downloadLink.setAttribute('download', fileName);
137
- document.body.appendChild(downloadLink);
138
- downloadLink.click();
139
- window.URL.revokeObjectURL(urlDownload);
140
- downloadLink.remove();
141
- }
142
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ReportService, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
143
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ReportService }); }
144
- }
145
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ReportService, decorators: [{
146
- type: Injectable
147
- }], ctorParameters: function () { return [{ type: i1.HttpClient }]; } });
96
+ var ReportFormats;
97
+ (function (ReportFormats) {
98
+ ReportFormats["XLSX"] = "xlsx";
99
+ ReportFormats["PDF"] = "pdf";
100
+ ReportFormats["DOCX"] = "docx";
101
+ ReportFormats["HTML"] = "html";
102
+ })(ReportFormats || (ReportFormats = {}));
103
+ class ReportService {
104
+ constructor(httpClient) {
105
+ this.httpClient = httpClient;
106
+ this.URL = window.location.href.indexOf('totvs-menu') > 0 ? '/totvs-menu/rest/report/run/'
107
+ : '/dts/datasul-report/resources/run/';
108
+ }
109
+ generate(params, showLoading = true) {
110
+ const headers = { 'X-PO-Screen-Lock': showLoading ? 'true' : 'false' };
111
+ let reportURL = `${this.URL}${params.reportName}`;
112
+ if (params.properties.length > 0) {
113
+ reportURL += '?';
114
+ params.properties.forEach((property, index) => {
115
+ if (index > 0) {
116
+ reportURL += '&';
117
+ }
118
+ reportURL += `c_properties=${property.name}&c_values=${property.value}`;
119
+ });
120
+ }
121
+ reportURL += `&dialect=${params.dialect}&format=${params.format}`;
122
+ reportURL += `&program=${params.programName}&resultFileName=${params.downloadName}`;
123
+ return this.httpClient.post(reportURL, {}, { headers, responseType: 'blob' })
124
+ .pipe(map(report => {
125
+ if (params.download) {
126
+ this.download(report, `${params.downloadName}.${params.format}`);
127
+ }
128
+ return report;
129
+ }));
130
+ }
131
+ download(file, fileName) {
132
+ const binaryData = [file];
133
+ const downloadLink = document.createElement('a');
134
+ const urlDownload = window.URL.createObjectURL(new Blob(binaryData, { type: file.type }));
135
+ downloadLink.href = urlDownload;
136
+ downloadLink.setAttribute('download', fileName);
137
+ document.body.appendChild(downloadLink);
138
+ downloadLink.click();
139
+ window.URL.revokeObjectURL(urlDownload);
140
+ downloadLink.remove();
141
+ }
142
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: ReportService, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
143
+ /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: ReportService }); }
144
+ }
145
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: ReportService, decorators: [{
146
+ type: Injectable
147
+ }], ctorParameters: () => [{ type: i1.HttpClient }] });
148
148
 
149
- /*
150
- Versão: 1.004
151
- Data Criação: 06/08/2018
152
- */
153
- class BreadcrumbControlService {
154
- constructor() { }
155
- newBreadcrumb() {
156
- this.breadcrumb = { items: [] };
157
- }
158
- addBreadcrumb(literal, activatedRoute) {
159
- this.addBreadcrumbURL(literal, decodeURIComponent(activatedRoute.snapshot['_routerState'].url));
160
- }
161
- addBreadcrumbURL(literal, url) {
162
- if (!literal || literal === '') {
163
- return;
164
- }
165
- if (!this.breadcrumb) {
166
- this.newBreadcrumb();
167
- }
168
- const breadcrumbAux = { items: [] };
169
- for (let idx = 0; idx < this.breadcrumb.items.length; idx++) {
170
- if (this.breadcrumb.items[idx].label !== literal) {
171
- breadcrumbAux.items.push(this.breadcrumb.items[idx]);
172
- }
173
- else {
174
- break;
175
- }
176
- }
177
- breadcrumbAux.items.push({ label: literal, link: url });
178
- this.breadcrumb = breadcrumbAux;
179
- }
180
- updBreadcrumbURL(literal, valueOld, valueNew) {
181
- let currentRouterURL = this.getCurrentRouter();
182
- if (!currentRouterURL) {
183
- return;
184
- }
185
- if (!valueOld) {
186
- return;
187
- }
188
- if (!valueNew) {
189
- return;
190
- }
191
- currentRouterURL = currentRouterURL.replace(valueOld, valueNew);
192
- this.addBreadcrumbURL(literal, currentRouterURL);
193
- }
194
- delBreadcrumb(literal) {
195
- if (!literal || literal === '') {
196
- return;
197
- }
198
- if (!this.breadcrumb || !this.breadcrumb.items) {
199
- return;
200
- }
201
- if (this.breadcrumb.items.length === 0) {
202
- return;
203
- }
204
- const breadcrumbAux = { items: [] };
205
- for (let idx = 0; idx < this.breadcrumb.items.length; idx++) {
206
- if (this.breadcrumb.items[idx].label !== literal) {
207
- breadcrumbAux.items.push(this.breadcrumb.items[idx]);
208
- }
209
- }
210
- this.breadcrumb = breadcrumbAux;
211
- }
212
- getBreadcrumb() {
213
- if (!this.breadcrumb) {
214
- this.newBreadcrumb();
215
- }
216
- return this.breadcrumb;
217
- }
218
- getCurrentRouter() {
219
- if (!this.breadcrumb) {
220
- this.newBreadcrumb();
221
- }
222
- if (this.breadcrumb.items.length <= 0) {
223
- return '';
224
- }
225
- return this.breadcrumb.items[this.breadcrumb.items.length - 1].link;
226
- }
227
- getPrevRouter() {
228
- if (!this.breadcrumb) {
229
- this.newBreadcrumb();
230
- }
231
- if (this.breadcrumb.items.length <= 1) {
232
- return '';
233
- }
234
- return this.breadcrumb.items[this.breadcrumb.items.length - 2].link;
235
- }
236
- hasPreviousRouter() {
237
- return this.breadcrumb.items.length > 1;
238
- }
239
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: BreadcrumbControlService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
240
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: BreadcrumbControlService }); }
241
- }
242
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: BreadcrumbControlService, decorators: [{
243
- type: Injectable
244
- }], ctorParameters: function () { return []; } });
149
+ /*
150
+ Versão: 1.004
151
+ Data Criação: 06/08/2018
152
+ */
153
+ class BreadcrumbControlService {
154
+ constructor() { }
155
+ newBreadcrumb() {
156
+ this.breadcrumb = { items: [] };
157
+ }
158
+ addBreadcrumb(literal, activatedRoute) {
159
+ this.addBreadcrumbURL(literal, decodeURIComponent(activatedRoute.snapshot['_routerState'].url));
160
+ }
161
+ addBreadcrumbURL(literal, url) {
162
+ if (!literal || literal === '') {
163
+ return;
164
+ }
165
+ if (!this.breadcrumb) {
166
+ this.newBreadcrumb();
167
+ }
168
+ const breadcrumbAux = { items: [] };
169
+ for (let idx = 0; idx < this.breadcrumb.items.length; idx++) {
170
+ if (this.breadcrumb.items[idx].label !== literal) {
171
+ breadcrumbAux.items.push(this.breadcrumb.items[idx]);
172
+ }
173
+ else {
174
+ break;
175
+ }
176
+ }
177
+ breadcrumbAux.items.push({ label: literal, link: url });
178
+ this.breadcrumb = breadcrumbAux;
179
+ }
180
+ updBreadcrumbURL(literal, valueOld, valueNew) {
181
+ let currentRouterURL = this.getCurrentRouter();
182
+ if (!currentRouterURL) {
183
+ return;
184
+ }
185
+ if (!valueOld) {
186
+ return;
187
+ }
188
+ if (!valueNew) {
189
+ return;
190
+ }
191
+ currentRouterURL = currentRouterURL.replace(valueOld, valueNew);
192
+ this.addBreadcrumbURL(literal, currentRouterURL);
193
+ }
194
+ delBreadcrumb(literal) {
195
+ if (!literal || literal === '') {
196
+ return;
197
+ }
198
+ if (!this.breadcrumb || !this.breadcrumb.items) {
199
+ return;
200
+ }
201
+ if (this.breadcrumb.items.length === 0) {
202
+ return;
203
+ }
204
+ const breadcrumbAux = { items: [] };
205
+ for (let idx = 0; idx < this.breadcrumb.items.length; idx++) {
206
+ if (this.breadcrumb.items[idx].label !== literal) {
207
+ breadcrumbAux.items.push(this.breadcrumb.items[idx]);
208
+ }
209
+ }
210
+ this.breadcrumb = breadcrumbAux;
211
+ }
212
+ getBreadcrumb() {
213
+ if (!this.breadcrumb) {
214
+ this.newBreadcrumb();
215
+ }
216
+ return this.breadcrumb;
217
+ }
218
+ getCurrentRouter() {
219
+ if (!this.breadcrumb) {
220
+ this.newBreadcrumb();
221
+ }
222
+ if (this.breadcrumb.items.length <= 0) {
223
+ return '';
224
+ }
225
+ return this.breadcrumb.items[this.breadcrumb.items.length - 1].link;
226
+ }
227
+ getPrevRouter() {
228
+ if (!this.breadcrumb) {
229
+ this.newBreadcrumb();
230
+ }
231
+ if (this.breadcrumb.items.length <= 1) {
232
+ return '';
233
+ }
234
+ return this.breadcrumb.items[this.breadcrumb.items.length - 2].link;
235
+ }
236
+ hasPreviousRouter() {
237
+ return this.breadcrumb.items.length > 1;
238
+ }
239
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: BreadcrumbControlService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
240
+ /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: BreadcrumbControlService }); }
241
+ }
242
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: BreadcrumbControlService, decorators: [{
243
+ type: Injectable
244
+ }], ctorParameters: () => [] });
245
245
 
246
- class MenuDatasulService {
247
- constructor(http) {
248
- this.http = http;
249
- this.urlMenuPrograms = '/dts/datasul-rest/resources/prg/fwk/v1/menuPrograms/list';
250
- }
251
- /**
252
- * var program = {};
253
- * program['prg'] = "cd0210";
254
- * program['params'] = '01|123456'
255
- */
256
- callProgress(program) {
257
- parent.postMessage({ program }, '*');
258
- }
259
- /**
260
- * var notification = {};
261
- * notification['type'] = 'success';
262
- * notification['title'] = 'Notification Title'
263
- * notification['detail'] = 'Notification Detail'
264
- */
265
- sendNotification(notification) {
266
- parent.postMessage({ notification }, '*');
267
- }
268
- openPath(programName, params, parent = true) {
269
- this.openHTMLProgram('THF2', programName, params, parent);
270
- }
271
- openTHF(externalName, params, parent = true) {
272
- this.openHTMLProgram('THF1', externalName, params, parent);
273
- }
274
- openHTMLProgram(type, HTMLProgram, params, parent) {
275
- const datasulPath = document.referrer.indexOf('totvs-menu') > 0 ? 'totvs-menu' : 'menu-html';
276
- HTMLProgram = HTMLProgram.replace(/\\/g, '/');
277
- if (HTMLProgram.charAt(0) === '/') {
278
- HTMLProgram = HTMLProgram.slice(1);
279
- }
280
- if (HTMLProgram.charAt(HTMLProgram.length - 1) === '/') {
281
- HTMLProgram = HTMLProgram.slice(0, -1);
282
- }
283
- let baseUrl = `/${datasulPath}/#/`;
284
- if (type === 'THF2') {
285
- baseUrl = `${baseUrl}${datasulPath}/program-html/${HTMLProgram}/`;
286
- }
287
- else {
288
- baseUrl = `${baseUrl}${HTMLProgram}`;
289
- }
290
- if (params) {
291
- if (baseUrl.charAt(baseUrl.length - 1) === '/') {
292
- baseUrl = baseUrl.slice(0, -1);
293
- }
294
- baseUrl = `${baseUrl}/#/${params}`;
295
- }
296
- if (parent) {
297
- window.open(baseUrl, '_parent');
298
- }
299
- else {
300
- window.open(baseUrl);
301
- }
302
- }
303
- programSecurity(programName) {
304
- let programList = [];
305
- if (Array.isArray(programName)) {
306
- programList = programName;
307
- }
308
- else {
309
- if (programName && programName !== '') {
310
- programList.push(programName);
311
- }
312
- }
313
- if (!programList || programList.length === 0) {
314
- return of({
315
- code: 400,
316
- message: 'Não foi possível validar a Segurança dos Programas, lista vazia !',
317
- detailedMessage: 'A lista de programas indicados para validação de segurança é inválida ou está vazia.'
318
- });
319
- }
320
- const aRequest = [];
321
- programList.forEach(programSearch => {
322
- aRequest.push(this.http.post(this.urlMenuPrograms, { search: programSearch }));
323
- });
324
- return forkJoin(aRequest).pipe(map$1((response) => {
325
- if (!response) {
326
- return response;
327
- }
328
- if (!Array.isArray(response)) {
329
- return response;
330
- }
331
- const responseReturn = new Array();
332
- for (let idx = 0; idx < programList.length; idx++) {
333
- const responseProg = response[idx];
334
- let hasAcess = false;
335
- if (responseProg && responseProg.programs &&
336
- Array.isArray(responseProg.programs) &&
337
- responseProg.programs.length > 0) {
338
- responseProg.programs.forEach(prog => {
339
- if (prog.prg === programList[idx]) {
340
- hasAcess = true;
341
- }
342
- });
343
- }
344
- responseReturn.push({
345
- programName: programList[idx],
346
- hasAccess: hasAcess
347
- });
348
- }
349
- return responseReturn;
350
- }));
351
- }
352
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MenuDatasulService, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
353
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MenuDatasulService }); }
354
- }
355
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MenuDatasulService, decorators: [{
356
- type: Injectable
357
- }], ctorParameters: function () { return [{ type: i1.HttpClient }]; } });
246
+ class MenuDatasulService {
247
+ constructor(http) {
248
+ this.http = http;
249
+ this.urlMenuPrograms = '/dts/datasul-rest/resources/prg/fwk/v1/menuPrograms/list';
250
+ }
251
+ /**
252
+ * var program = {};
253
+ * program['prg'] = "cd0210";
254
+ * program['params'] = '01|123456'
255
+ */
256
+ callProgress(program) {
257
+ parent.postMessage({ program }, '*');
258
+ }
259
+ /**
260
+ * var notification = {};
261
+ * notification['type'] = 'success';
262
+ * notification['title'] = 'Notification Title'
263
+ * notification['detail'] = 'Notification Detail'
264
+ */
265
+ sendNotification(notification) {
266
+ parent.postMessage({ notification }, '*');
267
+ }
268
+ openPath(programName, params, parent = true) {
269
+ this.openHTMLProgram('THF2', programName, params, parent);
270
+ }
271
+ openTHF(externalName, params, parent = true) {
272
+ this.openHTMLProgram('THF1', externalName, params, parent);
273
+ }
274
+ openHTMLProgram(type, HTMLProgram, params, parent) {
275
+ const datasulPath = document.referrer.indexOf('totvs-menu') > 0 ? 'totvs-menu' : 'menu-html';
276
+ HTMLProgram = HTMLProgram.replace(/\\/g, '/');
277
+ if (HTMLProgram.charAt(0) === '/') {
278
+ HTMLProgram = HTMLProgram.slice(1);
279
+ }
280
+ if (HTMLProgram.charAt(HTMLProgram.length - 1) === '/') {
281
+ HTMLProgram = HTMLProgram.slice(0, -1);
282
+ }
283
+ let baseUrl = `/${datasulPath}/#/`;
284
+ if (type === 'THF2') {
285
+ baseUrl = `${baseUrl}${datasulPath}/program-html/${HTMLProgram}/`;
286
+ }
287
+ else {
288
+ baseUrl = `${baseUrl}${HTMLProgram}`;
289
+ }
290
+ if (params) {
291
+ if (baseUrl.charAt(baseUrl.length - 1) === '/') {
292
+ baseUrl = baseUrl.slice(0, -1);
293
+ }
294
+ baseUrl = `${baseUrl}/#/${params}`;
295
+ }
296
+ if (parent) {
297
+ window.open(baseUrl, '_parent');
298
+ }
299
+ else {
300
+ window.open(baseUrl);
301
+ }
302
+ }
303
+ programSecurity(programName) {
304
+ let programList = [];
305
+ if (Array.isArray(programName)) {
306
+ programList = programName;
307
+ }
308
+ else {
309
+ if (programName && programName !== '') {
310
+ programList.push(programName);
311
+ }
312
+ }
313
+ if (!programList || programList.length === 0) {
314
+ return of({
315
+ code: 400,
316
+ message: 'Não foi possível validar a Segurança dos Programas, lista vazia !',
317
+ detailedMessage: 'A lista de programas indicados para validação de segurança é inválida ou está vazia.'
318
+ });
319
+ }
320
+ const aRequest = [];
321
+ programList.forEach(programSearch => {
322
+ aRequest.push(this.http.post(this.urlMenuPrograms, { search: programSearch }));
323
+ });
324
+ return forkJoin(aRequest).pipe(map$1((response) => {
325
+ if (!response) {
326
+ return response;
327
+ }
328
+ if (!Array.isArray(response)) {
329
+ return response;
330
+ }
331
+ const responseReturn = new Array();
332
+ for (let idx = 0; idx < programList.length; idx++) {
333
+ const responseProg = response[idx];
334
+ let hasAcess = false;
335
+ if (responseProg && responseProg.programs &&
336
+ Array.isArray(responseProg.programs) &&
337
+ responseProg.programs.length > 0) {
338
+ responseProg.programs.forEach(prog => {
339
+ if (prog.prg === programList[idx]) {
340
+ hasAcess = true;
341
+ }
342
+ });
343
+ }
344
+ responseReturn.push({
345
+ programName: programList[idx],
346
+ hasAccess: hasAcess
347
+ });
348
+ }
349
+ return responseReturn;
350
+ }));
351
+ }
352
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: MenuDatasulService, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
353
+ /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: MenuDatasulService }); }
354
+ }
355
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: MenuDatasulService, decorators: [{
356
+ type: Injectable
357
+ }], ctorParameters: () => [{ type: i1.HttpClient }] });
358
358
 
359
- class CacheParamsService {
360
- constructor() {
361
- this.values = {};
362
- }
363
- setValue(key, value) {
364
- this.values[key] = value;
365
- }
366
- getValue(key) {
367
- return this.values[key];
368
- }
369
- removeValue(key) {
370
- delete this.values[key];
371
- }
372
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CacheParamsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
373
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CacheParamsService, providedIn: 'root' }); }
374
- }
375
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CacheParamsService, decorators: [{
376
- type: Injectable,
377
- args: [{
378
- providedIn: 'root'
379
- }]
380
- }], ctorParameters: function () { return []; } });
359
+ class CacheParamsService {
360
+ constructor() {
361
+ this.values = {};
362
+ }
363
+ setValue(key, value) {
364
+ this.values[key] = value;
365
+ }
366
+ getValue(key) {
367
+ return this.values[key];
368
+ }
369
+ removeValue(key) {
370
+ delete this.values[key];
371
+ }
372
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: CacheParamsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
373
+ /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: CacheParamsService, providedIn: 'root' }); }
374
+ }
375
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: CacheParamsService, decorators: [{
376
+ type: Injectable,
377
+ args: [{
378
+ providedIn: 'root'
379
+ }]
380
+ }], ctorParameters: () => [] });
381
381
 
382
- class TranslateService {
383
- static getSuportLanguage() {
384
- return ['pt-BR', 'pt', 'en-US', 'en', 'es'];
385
- }
386
- static getDefaultCurrencyCode() {
387
- return '$';
388
- }
389
- static getCurrentLanguage() {
390
- const locale = localStorage.getItem('user.language') || navigator.language;
391
- if (locale && this.getSuportLanguage().includes(locale)) {
392
- return locale;
393
- }
394
- return 'en-US';
395
- }
396
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TranslateService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
397
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TranslateService }); }
398
- }
399
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TranslateService, decorators: [{
400
- type: Injectable
382
+ class TranslateService {
383
+ static getSuportLanguage() {
384
+ return ['pt-BR', 'pt', 'en-US', 'en', 'es'];
385
+ }
386
+ static getDefaultCurrencyCode() {
387
+ return '$';
388
+ }
389
+ static getCurrentLanguage() {
390
+ const locale = localStorage.getItem('user.language') || navigator.language;
391
+ if (locale && this.getSuportLanguage().includes(locale)) {
392
+ return locale;
393
+ }
394
+ return 'en-US';
395
+ }
396
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: TranslateService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
397
+ /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: TranslateService }); }
398
+ }
399
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: TranslateService, decorators: [{
400
+ type: Injectable
401
401
  }] });
402
402
 
403
- /*
404
- Versão: 1.000
405
- Data Criação: 18/04/2019
406
- */
407
- class DateUtil {
408
- constructor() { }
409
- /* Transforma data para o padrão YYYY-MM-DD */
410
- static dateToQueryParam(date) {
411
- const iDay = date.getDate();
412
- const iMonth = date.getMonth() + 1;
413
- const iYear = date.getFullYear();
414
- return `${iYear}-${this.pad(iMonth)}-${this.pad(iDay)}`;
415
- }
416
- /* Transforma data no padrão YYYY-MM-DD para DATE */
417
- static queryParamToDate(param) {
418
- const iDay = +param.split('-')[2];
419
- const iMonth = +param.split('-')[1];
420
- const iYear = +param.split('-')[0];
421
- return new Date(iYear, iMonth - 1, iDay);
422
- }
423
- /* Valida se foi informado uma data válida */
424
- static isValidDate(date) {
425
- return date instanceof Date && !isNaN(date.getTime());
426
- }
427
- /* Ajusta a data retornando o padrão DATE */
428
- static ajustDate(param) {
429
- if (param instanceof Date) {
430
- return param;
431
- }
432
- if (!param) {
433
- return param;
434
- }
435
- return this.queryParamToDate(param.split('T')[0]);
436
- }
437
- /* Ajusta a data para o padrão DATE - utilizada nos construtores dos modelos */
438
- static ajustDateToModel(values = {}, fieldName) {
439
- if (values.hasOwnProperty(fieldName) && (values[fieldName])) {
440
- if (values[fieldName].indexOf('T') >= 0) {
441
- return new Date(values[fieldName]);
442
- }
443
- const iDay = +values[fieldName].split('-')[2];
444
- const iMonth = +values[fieldName].split('-')[1];
445
- const iYear = +values[fieldName].split('-')[0];
446
- return new Date(iYear, iMonth - 1, iDay);
447
- }
448
- return null;
449
- }
450
- /* Adicona zero a esquerda do número */
451
- static pad(number) {
452
- if (number < 10) {
453
- return '0' + number;
454
- }
455
- return number;
456
- }
403
+ /*
404
+ Versão: 1.000
405
+ Data Criação: 18/04/2019
406
+ */
407
+ class DateUtil {
408
+ constructor() { }
409
+ /* Transforma data para o padrão YYYY-MM-DD */
410
+ static dateToQueryParam(date) {
411
+ const iDay = date.getDate();
412
+ const iMonth = date.getMonth() + 1;
413
+ const iYear = date.getFullYear();
414
+ return `${iYear}-${this.pad(iMonth)}-${this.pad(iDay)}`;
415
+ }
416
+ /* Transforma data no padrão YYYY-MM-DD para DATE */
417
+ static queryParamToDate(param) {
418
+ const iDay = +param.split('-')[2];
419
+ const iMonth = +param.split('-')[1];
420
+ const iYear = +param.split('-')[0];
421
+ return new Date(iYear, iMonth - 1, iDay);
422
+ }
423
+ /* Valida se foi informado uma data válida */
424
+ static isValidDate(date) {
425
+ return date instanceof Date && !isNaN(date.getTime());
426
+ }
427
+ /* Ajusta a data retornando o padrão DATE */
428
+ static ajustDate(param) {
429
+ if (param instanceof Date) {
430
+ return param;
431
+ }
432
+ if (!param) {
433
+ return param;
434
+ }
435
+ return this.queryParamToDate(param.split('T')[0]);
436
+ }
437
+ /* Ajusta a data para o padrão DATE - utilizada nos construtores dos modelos */
438
+ static ajustDateToModel(values = {}, fieldName) {
439
+ if (values.hasOwnProperty(fieldName) && (values[fieldName])) {
440
+ if (values[fieldName].indexOf('T') >= 0) {
441
+ return new Date(values[fieldName]);
442
+ }
443
+ const iDay = +values[fieldName].split('-')[2];
444
+ const iMonth = +values[fieldName].split('-')[1];
445
+ const iYear = +values[fieldName].split('-')[0];
446
+ return new Date(iYear, iMonth - 1, iDay);
447
+ }
448
+ return null;
449
+ }
450
+ /* Adicona zero a esquerda do número */
451
+ static pad(number) {
452
+ if (number < 10) {
453
+ return '0' + number;
454
+ }
455
+ return number;
456
+ }
457
457
  }
458
458
 
459
- /*
460
- Versão: 1.009
461
- Data Criação: 06/08/2018
462
- */
463
- class DisclaimerUtil {
464
- constructor(poNotification, poI18nPipe, literals) {
465
- this.literals = {};
466
- this.poNotification = poNotification;
467
- this.poI18nPipe = poI18nPipe;
468
- this.literals = literals;
469
- }
470
- makeDisclaimer(property, value, hideClose = false, tradValue = false, vldBlank = false) {
471
- if (value === null || value === undefined) {
472
- return { label: '', property: '', value: '' };
473
- }
474
- if (vldBlank && value === '') {
475
- return { label: '', property: '', value: '' };
476
- }
477
- return {
478
- hideClose,
479
- label: `${this.literals[property]}: ${tradValue ? this.literals[value] : value}`,
480
- property: `${property}`,
481
- value: `${value}`
482
- };
483
- }
484
- makeDisclaimerFromNumber(property, value, hideClose = false, vldBlank = false) {
485
- if (value === null || value === undefined) {
486
- return { label: '', property: '', value: '' };
487
- }
488
- if (vldBlank && value === 0) {
489
- return { label: '', property: '', value: '' };
490
- }
491
- return {
492
- hideClose,
493
- label: `${this.literals[property]}: ${value}`,
494
- property: `${property}`,
495
- value: `${value}`
496
- };
497
- }
498
- makeDisclaimerFromBoolean(property, value, hideClose = false) {
499
- if (value === null || value === undefined) {
500
- return { label: '', property: '', value: '' };
501
- }
502
- return {
503
- hideClose,
504
- label: `${this.literals[property]}: ${value ? this.literals['yes'] : this.literals['no']}`,
505
- property: `${property}`,
506
- value: `${value}`
507
- };
508
- }
509
- makeDisclaimerFromDate(property, value, hideClose = false) {
510
- const dDate = this.ajustDate(value);
511
- if (!this.isValidDate(dDate)) {
512
- return { label: '', property: '', value: '' };
513
- }
514
- return {
515
- hideClose,
516
- label: `${this.literals[property]}: ${dDate.toLocaleDateString()}`,
517
- property: `${property}`,
518
- value: `${this.dateToQueryParam(dDate)}`
519
- };
520
- }
521
- makeDisclaimerFromMultiSelect(property, value, length = 0, hideClose = false, tradValue = false) {
522
- let lstLabels = '';
523
- let lstValues = '';
524
- if (!value) {
525
- return { label: '', property: '', value: '' };
526
- }
527
- if (value.length === 0 || (length > 0 && value.length === length)) {
528
- lstLabels = this.literals['all'];
529
- lstValues = 'all';
530
- }
531
- else {
532
- value.map(item => {
533
- if (lstLabels !== '') {
534
- lstLabels = `${lstLabels}, `;
535
- }
536
- if (lstValues !== '') {
537
- lstValues = `${lstValues},`;
538
- }
539
- lstLabels = `${lstLabels}${tradValue ? this.literals[item] : item}`;
540
- lstValues = `${lstValues}${item}`;
541
- });
542
- }
543
- return {
544
- hideClose,
545
- label: `${this.literals[property]}: ${lstLabels}`,
546
- property: `${property}`,
547
- value: `${lstValues}`
548
- };
549
- }
550
- makeDisclaimerFromMultiSelectNumber(property, value, options, length = 0, hideClose = false) {
551
- let lstLabels = '';
552
- let lstValues = '';
553
- let opt = null;
554
- if (!value || !options) {
555
- return { label: '', property: '', value: '' };
556
- }
557
- if (value.length === 0 || (length > 0 && value.length === length)) {
558
- lstLabels = this.literals['all'];
559
- lstValues = 'all';
560
- }
561
- else {
562
- value.map(item => {
563
- if (lstLabels !== '') {
564
- lstLabels = `${lstLabels}, `;
565
- }
566
- if (lstValues !== '') {
567
- lstValues = `${lstValues},`;
568
- }
569
- opt = options.find(itOpt => itOpt.value === item);
570
- lstLabels = `${lstLabels}${opt ? opt.label : item}`;
571
- lstValues = `${lstValues}${item}`;
572
- });
573
- }
574
- return {
575
- hideClose,
576
- label: `${this.literals[property]}: ${lstLabels}`,
577
- property: `${property}`,
578
- value: `${lstValues}`
579
- };
580
- }
581
- makeDisclaimerFromCheckboxGroup(property, value, length = 0, hideClose = false) {
582
- let lstLabels = '';
583
- let lstValues = '';
584
- if (!value) {
585
- return { label: '', property: '', value: '' };
586
- }
587
- if (value.length === 0) {
588
- lstLabels = this.literals['none'];
589
- lstValues = 'none';
590
- }
591
- else if (length > 0 && value.length === length) {
592
- lstLabels = this.literals['all'];
593
- lstValues = 'all';
594
- }
595
- else {
596
- value.map(checkParam => {
597
- if (lstLabels !== '') {
598
- lstLabels = `${lstLabels}, `;
599
- }
600
- if (lstValues !== '') {
601
- lstValues = `${lstValues},`;
602
- }
603
- lstLabels = `${lstLabels}${this.literals[checkParam]}`;
604
- lstValues = `${lstValues}${checkParam}`;
605
- });
606
- }
607
- return {
608
- hideClose,
609
- label: `${this.literals[property]}: ${lstLabels}`,
610
- property: `${property}`,
611
- value: `${lstValues}`
612
- };
613
- }
614
- makeDisclaimerFromRangeCharacter(property, value, hideClose = false, validateEqual = true) {
615
- if (value.valInitial === null || value.valInitial === undefined) {
616
- value.valInitial = value.iniInitial;
617
- }
618
- if (value.valFinal === null || value.valFinal === undefined) {
619
- value.valFinal = value.iniFinal;
620
- }
621
- if (validateEqual &&
622
- value.iniInitial === value.valInitial &&
623
- value.iniFinal === value.valFinal) {
624
- return { label: '', property: '', value: '' };
625
- }
626
- return {
627
- hideClose,
628
- label: this.poI18nPipe.transform(this.literals['filterRange'], [this.literals[property], `'${value.valInitial}'`, `'${value.valFinal}'`]),
629
- property: `${property}`,
630
- value: `${value.valInitial};${value.valFinal}`
631
- };
632
- }
633
- makeDisclaimerFromRangeNumber(property, value, hideClose = false, validateEqual = true) {
634
- if (value.valInitial === null || value.valInitial === undefined) {
635
- value.valInitial = value.iniInitial;
636
- }
637
- if (value.valFinal === null || value.valFinal === undefined) {
638
- value.valFinal = value.iniFinal;
639
- }
640
- if (validateEqual &&
641
- value.iniInitial === value.valInitial &&
642
- value.iniFinal === value.valFinal) {
643
- return { label: '', property: '', value: '' };
644
- }
645
- return {
646
- hideClose,
647
- label: this.poI18nPipe.transform(this.literals['filterRange'], [this.literals[property], value.valInitial, value.valFinal]),
648
- property: `${property}`,
649
- value: `${value.valInitial};${value.valFinal}`
650
- };
651
- }
652
- makeDisclaimerFromDatepickerRange(property, value, hideClose = false) {
653
- if (!value) {
654
- return { label: '', property: '', value: '' };
655
- }
656
- let filterRangeDate = {
657
- iniInitial: new Date(1900, 1, 1),
658
- valInitial: this.ajustDate(value.start),
659
- iniFinal: new Date(9999, 11, 31),
660
- valFinal: this.ajustDate(value.end)
661
- };
662
- return this.makeDisclaimerFromRangeDate(property, filterRangeDate, hideClose, true);
663
- }
664
- makeDisclaimerFromRangeDate(property, value, hideClose = false, validateEqual = true) {
665
- let valInitDate = this.ajustDate(value.valInitial);
666
- let valFinalDate = this.ajustDate(value.valFinal);
667
- if (!this.isValidDate(valInitDate)) {
668
- valInitDate = value.iniInitial;
669
- value.valInitial = value.iniInitial;
670
- }
671
- if (!this.isValidDate(valFinalDate)) {
672
- valFinalDate = value.iniFinal;
673
- value.valFinal = value.iniFinal;
674
- }
675
- if (validateEqual &&
676
- this.dateToQueryParam(value.iniInitial) === this.dateToQueryParam(valInitDate) &&
677
- this.dateToQueryParam(value.iniFinal) === this.dateToQueryParam(valFinalDate)) {
678
- return { label: '', property: '', value: '' };
679
- }
680
- return {
681
- hideClose,
682
- label: this.poI18nPipe.transform(this.literals['filterRange'], [this.literals[property], valInitDate.toLocaleDateString(), valFinalDate.toLocaleDateString()]),
683
- property: `${property}`,
684
- value: `${this.dateToQueryParam(valInitDate)};${this.dateToQueryParam(valFinalDate)}`
685
- };
686
- }
687
- atzCharFromDisclamer(disclaimers, property, defaultValue) {
688
- let returnValue = defaultValue;
689
- if (disclaimers && disclaimers.length > 0) {
690
- disclaimers.find((item) => {
691
- if (item.property === property) {
692
- if (item.value === null) {
693
- return false;
694
- }
695
- returnValue = item.value;
696
- return true;
697
- }
698
- return false;
699
- });
700
- }
701
- return returnValue;
702
- }
703
- atzNumberFromDisclamer(disclaimers, property, defaultValue) {
704
- let returnValue = defaultValue;
705
- if (disclaimers && disclaimers.length > 0) {
706
- disclaimers.find((item) => {
707
- if (item.property === property) {
708
- if (item.value === null) {
709
- return false;
710
- }
711
- returnValue = item.value;
712
- return true;
713
- }
714
- return false;
715
- });
716
- }
717
- return returnValue;
718
- }
719
- atzBooleanFromDisclamer(disclaimers, property, defaultValue) {
720
- const returnValue = defaultValue;
721
- if (disclaimers && disclaimers.length > 0) {
722
- const disclaimerFind = disclaimers.find((item) => item.property === property);
723
- if (disclaimerFind && disclaimerFind.value !== null && disclaimerFind.value !== undefined) {
724
- if (disclaimerFind.value === 'true') {
725
- return true;
726
- }
727
- else {
728
- return false;
729
- }
730
- }
731
- }
732
- return returnValue;
733
- }
734
- atzDateFromDisclamer(disclaimers, property, defaultValue) {
735
- let returnValue = this.ajustDate(defaultValue);
736
- if (disclaimers && disclaimers.length > 0) {
737
- disclaimers.find((item) => {
738
- if (item.property === property) {
739
- if (item.value === null) {
740
- return false;
741
- }
742
- returnValue = this.ajustDate(item.value);
743
- return true;
744
- }
745
- return false;
746
- });
747
- }
748
- return returnValue;
749
- }
750
- atzMultiSelectCharFromDisclamer(disclaimers, property, defaultValue) {
751
- return this.atzMultiSelectFromDisclamer('char', disclaimers, property, defaultValue);
752
- }
753
- atzMultiSelectNumberFromDisclamer(disclaimers, property, defaultValue) {
754
- return this.atzMultiSelectFromDisclamer('number', disclaimers, property, defaultValue);
755
- }
756
- atzMultiSelectFromDisclamer(type, disclaimers, property, defaultValue) {
757
- let returnValue = [];
758
- defaultValue.map(item => {
759
- returnValue.push(item.value);
760
- });
761
- if (disclaimers && disclaimers.length > 0) {
762
- disclaimers.find((item) => {
763
- if (item.property === property) {
764
- if (item.value === null || item.value === 'all' || item.value === 'none') {
765
- return false;
766
- }
767
- returnValue = [];
768
- item.value.split(',').forEach(itemOpt => {
769
- if (type === 'char') {
770
- returnValue.push(itemOpt);
771
- }
772
- if (type === 'number') {
773
- returnValue.push(+itemOpt);
774
- }
775
- });
776
- return true;
777
- }
778
- return false;
779
- });
780
- }
781
- return returnValue;
782
- }
783
- atzCheckboxFromDisclamer(disclaimers, property, options) {
784
- let returnValue = [];
785
- options.map(item => {
786
- returnValue.push(item.value);
787
- });
788
- if (disclaimers && disclaimers.length > 0) {
789
- disclaimers.find((item) => {
790
- if (item.property === property) {
791
- if (item.value === null || item.value === 'all' || item.value === 'none') {
792
- return false;
793
- }
794
- returnValue = [];
795
- item.value.split(',').forEach(itemOpt => {
796
- returnValue.push(itemOpt);
797
- });
798
- return true;
799
- }
800
- return false;
801
- });
802
- }
803
- return returnValue;
804
- }
805
- atzRangeCharFromDisclamer(disclaimers, property, rangeChar) {
806
- let value = '';
807
- if (disclaimers && disclaimers.length > 0) {
808
- disclaimers.find((item) => {
809
- if (item.property === property) {
810
- if (item.value === null) {
811
- return false;
812
- }
813
- value = item.value;
814
- return true;
815
- }
816
- return false;
817
- });
818
- }
819
- return this.atzRangeCharFromQueryParam(value, rangeChar);
820
- }
821
- atzRangeNumFromDisclamer(disclaimers, property, rangeNum) {
822
- let value = '';
823
- if (disclaimers && disclaimers.length > 0) {
824
- disclaimers.find((item) => {
825
- if (item.property === property) {
826
- if (item.value === null) {
827
- return false;
828
- }
829
- value = item.value;
830
- return true;
831
- }
832
- return false;
833
- });
834
- }
835
- return this.atzRangeNumFromQueryParam(value, rangeNum);
836
- }
837
- atzDatepickerRangeFromDisclamer(disclaimers, property, rangeDate) {
838
- let filterRangeDate = {
839
- iniInitial: null,
840
- valInitial: rangeDate ? this.ajustDate(rangeDate.start) : null,
841
- iniFinal: null,
842
- valFinal: rangeDate ? this.ajustDate(rangeDate.end) : null
843
- };
844
- filterRangeDate = this.atzRangeDateFromDisclamer(disclaimers, property, filterRangeDate);
845
- if (filterRangeDate.valInitial === null || filterRangeDate.valFinal === null) {
846
- return null;
847
- }
848
- return {
849
- start: filterRangeDate.valInitial,
850
- end: filterRangeDate.valFinal
851
- };
852
- }
853
- atzRangeDateFromDisclamer(disclaimers, property, rangeDate) {
854
- let value = '';
855
- if (disclaimers && disclaimers.length > 0) {
856
- disclaimers.find((item) => {
857
- if (item.property === property) {
858
- if (item.value === null) {
859
- return false;
860
- }
861
- value = item.value;
862
- return true;
863
- }
864
- return false;
865
- });
866
- }
867
- return this.atzRangeDateFromQueryParam(value, rangeDate);
868
- }
869
- atzRangeCharFromQueryParam(value, rangeChar) {
870
- rangeChar.valInitial = rangeChar.iniInitial;
871
- rangeChar.valFinal = rangeChar.iniFinal;
872
- if (!value || value === '') {
873
- return rangeChar;
874
- }
875
- rangeChar.valInitial = value.split(';')[0];
876
- rangeChar.valFinal = value.split(';')[1];
877
- if (rangeChar.valFinal === null || rangeChar.valFinal === undefined) {
878
- rangeChar.valFinal = rangeChar.iniFinal;
879
- }
880
- return rangeChar;
881
- }
882
- atzRangeNumFromQueryParam(value, rangeNum) {
883
- rangeNum.valInitial = rangeNum.iniInitial;
884
- rangeNum.valFinal = rangeNum.iniFinal;
885
- if (!value || value === '') {
886
- return rangeNum;
887
- }
888
- rangeNum.valInitial = +value.split(';')[0];
889
- rangeNum.valFinal = +value.split(';')[1];
890
- if (rangeNum.valFinal === null || rangeNum.valFinal === undefined) {
891
- rangeNum.valFinal = rangeNum.iniFinal;
892
- }
893
- return rangeNum;
894
- }
895
- atzRangeDateFromQueryParam(value, rangeDate) {
896
- rangeDate.valInitial = rangeDate.iniInitial;
897
- rangeDate.valFinal = rangeDate.iniFinal;
898
- if (!value || value === '') {
899
- return rangeDate;
900
- }
901
- rangeDate.valInitial = this.queryParamToDate(value.split(';')[0]);
902
- rangeDate.valFinal = this.queryParamToDate(value.split(';')[1]);
903
- if (rangeDate.valFinal === null || rangeDate.valFinal === undefined) {
904
- rangeDate.valFinal = rangeDate.iniFinal;
905
- }
906
- return rangeDate;
907
- }
908
- dateToQueryParam(date) {
909
- if (date === null) {
910
- return null;
911
- }
912
- const iDay = date.getDate();
913
- const iMonth = date.getMonth() + 1;
914
- const iYear = date.getFullYear();
915
- return `${iYear}-${this.pad(iMonth)}-${this.pad(iDay)}`;
916
- }
917
- queryParamToDate(param) {
918
- if (param === null) {
919
- return null;
920
- }
921
- const iDay = +param.split('-')[2];
922
- const iMonth = +param.split('-')[1];
923
- const iYear = +param.split('-')[0];
924
- return new Date(iYear, iMonth - 1, iDay);
925
- }
926
- isValidDate(date) {
927
- return date instanceof Date && !isNaN(date.getTime());
928
- }
929
- ajustDate(param) {
930
- if (param === null) {
931
- return null;
932
- }
933
- if (param instanceof Date) {
934
- return param;
935
- }
936
- if (!param) {
937
- return param;
938
- }
939
- return this.queryParamToDate(param.split('T')[0]);
940
- }
941
- pad(number) {
942
- if (number < 10) {
943
- return '0' + number;
944
- }
945
- return number;
946
- }
459
+ /*
460
+ Versão: 1.009
461
+ Data Criação: 06/08/2018
462
+ */
463
+ class DisclaimerUtil {
464
+ constructor(poNotification, poI18nPipe, literals) {
465
+ this.literals = {};
466
+ this.poNotification = poNotification;
467
+ this.poI18nPipe = poI18nPipe;
468
+ this.literals = literals;
469
+ }
470
+ makeDisclaimer(property, value, hideClose = false, tradValue = false, vldBlank = false) {
471
+ if (value === null || value === undefined) {
472
+ return { label: '', property: '', value: '' };
473
+ }
474
+ if (vldBlank && value === '') {
475
+ return { label: '', property: '', value: '' };
476
+ }
477
+ return {
478
+ hideClose,
479
+ label: `${this.literals[property]}: ${tradValue ? this.literals[value] : value}`,
480
+ property: `${property}`,
481
+ value: `${value}`
482
+ };
483
+ }
484
+ makeDisclaimerFromNumber(property, value, hideClose = false, vldBlank = false) {
485
+ if (value === null || value === undefined) {
486
+ return { label: '', property: '', value: '' };
487
+ }
488
+ if (vldBlank && value === 0) {
489
+ return { label: '', property: '', value: '' };
490
+ }
491
+ return {
492
+ hideClose,
493
+ label: `${this.literals[property]}: ${value}`,
494
+ property: `${property}`,
495
+ value: `${value}`
496
+ };
497
+ }
498
+ makeDisclaimerFromBoolean(property, value, hideClose = false) {
499
+ if (value === null || value === undefined) {
500
+ return { label: '', property: '', value: '' };
501
+ }
502
+ return {
503
+ hideClose,
504
+ label: `${this.literals[property]}: ${value ? this.literals['yes'] : this.literals['no']}`,
505
+ property: `${property}`,
506
+ value: `${value}`
507
+ };
508
+ }
509
+ makeDisclaimerFromDate(property, value, hideClose = false) {
510
+ const dDate = this.ajustDate(value);
511
+ if (!this.isValidDate(dDate)) {
512
+ return { label: '', property: '', value: '' };
513
+ }
514
+ return {
515
+ hideClose,
516
+ label: `${this.literals[property]}: ${dDate.toLocaleDateString()}`,
517
+ property: `${property}`,
518
+ value: `${this.dateToQueryParam(dDate)}`
519
+ };
520
+ }
521
+ makeDisclaimerFromMultiSelect(property, value, length = 0, hideClose = false, tradValue = false) {
522
+ let lstLabels = '';
523
+ let lstValues = '';
524
+ if (!value) {
525
+ return { label: '', property: '', value: '' };
526
+ }
527
+ if (value.length === 0 || (length > 0 && value.length === length)) {
528
+ lstLabels = this.literals['all'];
529
+ lstValues = 'all';
530
+ }
531
+ else {
532
+ value.map(item => {
533
+ if (lstLabels !== '') {
534
+ lstLabels = `${lstLabels}, `;
535
+ }
536
+ if (lstValues !== '') {
537
+ lstValues = `${lstValues},`;
538
+ }
539
+ lstLabels = `${lstLabels}${tradValue ? this.literals[item] : item}`;
540
+ lstValues = `${lstValues}${item}`;
541
+ });
542
+ }
543
+ return {
544
+ hideClose,
545
+ label: `${this.literals[property]}: ${lstLabels}`,
546
+ property: `${property}`,
547
+ value: `${lstValues}`
548
+ };
549
+ }
550
+ makeDisclaimerFromMultiSelectNumber(property, value, options, length = 0, hideClose = false) {
551
+ let lstLabels = '';
552
+ let lstValues = '';
553
+ let opt = null;
554
+ if (!value || !options) {
555
+ return { label: '', property: '', value: '' };
556
+ }
557
+ if (value.length === 0 || (length > 0 && value.length === length)) {
558
+ lstLabels = this.literals['all'];
559
+ lstValues = 'all';
560
+ }
561
+ else {
562
+ value.map(item => {
563
+ if (lstLabels !== '') {
564
+ lstLabels = `${lstLabels}, `;
565
+ }
566
+ if (lstValues !== '') {
567
+ lstValues = `${lstValues},`;
568
+ }
569
+ opt = options.find(itOpt => itOpt.value === item);
570
+ lstLabels = `${lstLabels}${opt ? opt.label : item}`;
571
+ lstValues = `${lstValues}${item}`;
572
+ });
573
+ }
574
+ return {
575
+ hideClose,
576
+ label: `${this.literals[property]}: ${lstLabels}`,
577
+ property: `${property}`,
578
+ value: `${lstValues}`
579
+ };
580
+ }
581
+ makeDisclaimerFromCheckboxGroup(property, value, length = 0, hideClose = false) {
582
+ let lstLabels = '';
583
+ let lstValues = '';
584
+ if (!value) {
585
+ return { label: '', property: '', value: '' };
586
+ }
587
+ if (value.length === 0) {
588
+ lstLabels = this.literals['none'];
589
+ lstValues = 'none';
590
+ }
591
+ else if (length > 0 && value.length === length) {
592
+ lstLabels = this.literals['all'];
593
+ lstValues = 'all';
594
+ }
595
+ else {
596
+ value.map(checkParam => {
597
+ if (lstLabels !== '') {
598
+ lstLabels = `${lstLabels}, `;
599
+ }
600
+ if (lstValues !== '') {
601
+ lstValues = `${lstValues},`;
602
+ }
603
+ lstLabels = `${lstLabels}${this.literals[checkParam]}`;
604
+ lstValues = `${lstValues}${checkParam}`;
605
+ });
606
+ }
607
+ return {
608
+ hideClose,
609
+ label: `${this.literals[property]}: ${lstLabels}`,
610
+ property: `${property}`,
611
+ value: `${lstValues}`
612
+ };
613
+ }
614
+ makeDisclaimerFromRangeCharacter(property, value, hideClose = false, validateEqual = true) {
615
+ if (value.valInitial === null || value.valInitial === undefined) {
616
+ value.valInitial = value.iniInitial;
617
+ }
618
+ if (value.valFinal === null || value.valFinal === undefined) {
619
+ value.valFinal = value.iniFinal;
620
+ }
621
+ if (validateEqual &&
622
+ value.iniInitial === value.valInitial &&
623
+ value.iniFinal === value.valFinal) {
624
+ return { label: '', property: '', value: '' };
625
+ }
626
+ return {
627
+ hideClose,
628
+ label: this.poI18nPipe.transform(this.literals['filterRange'], [this.literals[property], `'${value.valInitial}'`, `'${value.valFinal}'`]),
629
+ property: `${property}`,
630
+ value: `${value.valInitial};${value.valFinal}`
631
+ };
632
+ }
633
+ makeDisclaimerFromRangeNumber(property, value, hideClose = false, validateEqual = true) {
634
+ if (value.valInitial === null || value.valInitial === undefined) {
635
+ value.valInitial = value.iniInitial;
636
+ }
637
+ if (value.valFinal === null || value.valFinal === undefined) {
638
+ value.valFinal = value.iniFinal;
639
+ }
640
+ if (validateEqual &&
641
+ value.iniInitial === value.valInitial &&
642
+ value.iniFinal === value.valFinal) {
643
+ return { label: '', property: '', value: '' };
644
+ }
645
+ return {
646
+ hideClose,
647
+ label: this.poI18nPipe.transform(this.literals['filterRange'], [this.literals[property], value.valInitial, value.valFinal]),
648
+ property: `${property}`,
649
+ value: `${value.valInitial};${value.valFinal}`
650
+ };
651
+ }
652
+ makeDisclaimerFromDatepickerRange(property, value, hideClose = false) {
653
+ if (!value) {
654
+ return { label: '', property: '', value: '' };
655
+ }
656
+ let filterRangeDate = {
657
+ iniInitial: new Date(1900, 1, 1),
658
+ valInitial: this.ajustDate(value.start),
659
+ iniFinal: new Date(9999, 11, 31),
660
+ valFinal: this.ajustDate(value.end)
661
+ };
662
+ return this.makeDisclaimerFromRangeDate(property, filterRangeDate, hideClose, true);
663
+ }
664
+ makeDisclaimerFromRangeDate(property, value, hideClose = false, validateEqual = true) {
665
+ let valInitDate = this.ajustDate(value.valInitial);
666
+ let valFinalDate = this.ajustDate(value.valFinal);
667
+ if (!this.isValidDate(valInitDate)) {
668
+ valInitDate = value.iniInitial;
669
+ value.valInitial = value.iniInitial;
670
+ }
671
+ if (!this.isValidDate(valFinalDate)) {
672
+ valFinalDate = value.iniFinal;
673
+ value.valFinal = value.iniFinal;
674
+ }
675
+ if (validateEqual &&
676
+ this.dateToQueryParam(value.iniInitial) === this.dateToQueryParam(valInitDate) &&
677
+ this.dateToQueryParam(value.iniFinal) === this.dateToQueryParam(valFinalDate)) {
678
+ return { label: '', property: '', value: '' };
679
+ }
680
+ return {
681
+ hideClose,
682
+ label: this.poI18nPipe.transform(this.literals['filterRange'], [this.literals[property], valInitDate.toLocaleDateString(), valFinalDate.toLocaleDateString()]),
683
+ property: `${property}`,
684
+ value: `${this.dateToQueryParam(valInitDate)};${this.dateToQueryParam(valFinalDate)}`
685
+ };
686
+ }
687
+ atzCharFromDisclamer(disclaimers, property, defaultValue) {
688
+ let returnValue = defaultValue;
689
+ if (disclaimers && disclaimers.length > 0) {
690
+ disclaimers.find((item) => {
691
+ if (item.property === property) {
692
+ if (item.value === null) {
693
+ return false;
694
+ }
695
+ returnValue = item.value;
696
+ return true;
697
+ }
698
+ return false;
699
+ });
700
+ }
701
+ return returnValue;
702
+ }
703
+ atzNumberFromDisclamer(disclaimers, property, defaultValue) {
704
+ let returnValue = defaultValue;
705
+ if (disclaimers && disclaimers.length > 0) {
706
+ disclaimers.find((item) => {
707
+ if (item.property === property) {
708
+ if (item.value === null) {
709
+ return false;
710
+ }
711
+ returnValue = item.value;
712
+ return true;
713
+ }
714
+ return false;
715
+ });
716
+ }
717
+ return returnValue;
718
+ }
719
+ atzBooleanFromDisclamer(disclaimers, property, defaultValue) {
720
+ const returnValue = defaultValue;
721
+ if (disclaimers && disclaimers.length > 0) {
722
+ const disclaimerFind = disclaimers.find((item) => item.property === property);
723
+ if (disclaimerFind && disclaimerFind.value !== null && disclaimerFind.value !== undefined) {
724
+ if (disclaimerFind.value === 'true') {
725
+ return true;
726
+ }
727
+ else {
728
+ return false;
729
+ }
730
+ }
731
+ }
732
+ return returnValue;
733
+ }
734
+ atzDateFromDisclamer(disclaimers, property, defaultValue) {
735
+ let returnValue = this.ajustDate(defaultValue);
736
+ if (disclaimers && disclaimers.length > 0) {
737
+ disclaimers.find((item) => {
738
+ if (item.property === property) {
739
+ if (item.value === null) {
740
+ return false;
741
+ }
742
+ returnValue = this.ajustDate(item.value);
743
+ return true;
744
+ }
745
+ return false;
746
+ });
747
+ }
748
+ return returnValue;
749
+ }
750
+ atzMultiSelectCharFromDisclamer(disclaimers, property, defaultValue) {
751
+ return this.atzMultiSelectFromDisclamer('char', disclaimers, property, defaultValue);
752
+ }
753
+ atzMultiSelectNumberFromDisclamer(disclaimers, property, defaultValue) {
754
+ return this.atzMultiSelectFromDisclamer('number', disclaimers, property, defaultValue);
755
+ }
756
+ atzMultiSelectFromDisclamer(type, disclaimers, property, defaultValue) {
757
+ let returnValue = [];
758
+ defaultValue.map(item => {
759
+ returnValue.push(item.value);
760
+ });
761
+ if (disclaimers && disclaimers.length > 0) {
762
+ disclaimers.find((item) => {
763
+ if (item.property === property) {
764
+ if (item.value === null || item.value === 'all' || item.value === 'none') {
765
+ return false;
766
+ }
767
+ returnValue = [];
768
+ item.value.split(',').forEach(itemOpt => {
769
+ if (type === 'char') {
770
+ returnValue.push(itemOpt);
771
+ }
772
+ if (type === 'number') {
773
+ returnValue.push(+itemOpt);
774
+ }
775
+ });
776
+ return true;
777
+ }
778
+ return false;
779
+ });
780
+ }
781
+ return returnValue;
782
+ }
783
+ atzCheckboxFromDisclamer(disclaimers, property, options) {
784
+ let returnValue = [];
785
+ options.map(item => {
786
+ returnValue.push(item.value);
787
+ });
788
+ if (disclaimers && disclaimers.length > 0) {
789
+ disclaimers.find((item) => {
790
+ if (item.property === property) {
791
+ if (item.value === null || item.value === 'all' || item.value === 'none') {
792
+ return false;
793
+ }
794
+ returnValue = [];
795
+ item.value.split(',').forEach(itemOpt => {
796
+ returnValue.push(itemOpt);
797
+ });
798
+ return true;
799
+ }
800
+ return false;
801
+ });
802
+ }
803
+ return returnValue;
804
+ }
805
+ atzRangeCharFromDisclamer(disclaimers, property, rangeChar) {
806
+ let value = '';
807
+ if (disclaimers && disclaimers.length > 0) {
808
+ disclaimers.find((item) => {
809
+ if (item.property === property) {
810
+ if (item.value === null) {
811
+ return false;
812
+ }
813
+ value = item.value;
814
+ return true;
815
+ }
816
+ return false;
817
+ });
818
+ }
819
+ return this.atzRangeCharFromQueryParam(value, rangeChar);
820
+ }
821
+ atzRangeNumFromDisclamer(disclaimers, property, rangeNum) {
822
+ let value = '';
823
+ if (disclaimers && disclaimers.length > 0) {
824
+ disclaimers.find((item) => {
825
+ if (item.property === property) {
826
+ if (item.value === null) {
827
+ return false;
828
+ }
829
+ value = item.value;
830
+ return true;
831
+ }
832
+ return false;
833
+ });
834
+ }
835
+ return this.atzRangeNumFromQueryParam(value, rangeNum);
836
+ }
837
+ atzDatepickerRangeFromDisclamer(disclaimers, property, rangeDate) {
838
+ let filterRangeDate = {
839
+ iniInitial: null,
840
+ valInitial: rangeDate ? this.ajustDate(rangeDate.start) : null,
841
+ iniFinal: null,
842
+ valFinal: rangeDate ? this.ajustDate(rangeDate.end) : null
843
+ };
844
+ filterRangeDate = this.atzRangeDateFromDisclamer(disclaimers, property, filterRangeDate);
845
+ if (filterRangeDate.valInitial === null || filterRangeDate.valFinal === null) {
846
+ return null;
847
+ }
848
+ return {
849
+ start: filterRangeDate.valInitial,
850
+ end: filterRangeDate.valFinal
851
+ };
852
+ }
853
+ atzRangeDateFromDisclamer(disclaimers, property, rangeDate) {
854
+ let value = '';
855
+ if (disclaimers && disclaimers.length > 0) {
856
+ disclaimers.find((item) => {
857
+ if (item.property === property) {
858
+ if (item.value === null) {
859
+ return false;
860
+ }
861
+ value = item.value;
862
+ return true;
863
+ }
864
+ return false;
865
+ });
866
+ }
867
+ return this.atzRangeDateFromQueryParam(value, rangeDate);
868
+ }
869
+ atzRangeCharFromQueryParam(value, rangeChar) {
870
+ rangeChar.valInitial = rangeChar.iniInitial;
871
+ rangeChar.valFinal = rangeChar.iniFinal;
872
+ if (!value || value === '') {
873
+ return rangeChar;
874
+ }
875
+ rangeChar.valInitial = value.split(';')[0];
876
+ rangeChar.valFinal = value.split(';')[1];
877
+ if (rangeChar.valFinal === null || rangeChar.valFinal === undefined) {
878
+ rangeChar.valFinal = rangeChar.iniFinal;
879
+ }
880
+ return rangeChar;
881
+ }
882
+ atzRangeNumFromQueryParam(value, rangeNum) {
883
+ rangeNum.valInitial = rangeNum.iniInitial;
884
+ rangeNum.valFinal = rangeNum.iniFinal;
885
+ if (!value || value === '') {
886
+ return rangeNum;
887
+ }
888
+ rangeNum.valInitial = +value.split(';')[0];
889
+ rangeNum.valFinal = +value.split(';')[1];
890
+ if (rangeNum.valFinal === null || rangeNum.valFinal === undefined) {
891
+ rangeNum.valFinal = rangeNum.iniFinal;
892
+ }
893
+ return rangeNum;
894
+ }
895
+ atzRangeDateFromQueryParam(value, rangeDate) {
896
+ rangeDate.valInitial = rangeDate.iniInitial;
897
+ rangeDate.valFinal = rangeDate.iniFinal;
898
+ if (!value || value === '') {
899
+ return rangeDate;
900
+ }
901
+ rangeDate.valInitial = this.queryParamToDate(value.split(';')[0]);
902
+ rangeDate.valFinal = this.queryParamToDate(value.split(';')[1]);
903
+ if (rangeDate.valFinal === null || rangeDate.valFinal === undefined) {
904
+ rangeDate.valFinal = rangeDate.iniFinal;
905
+ }
906
+ return rangeDate;
907
+ }
908
+ dateToQueryParam(date) {
909
+ if (date === null) {
910
+ return null;
911
+ }
912
+ const iDay = date.getDate();
913
+ const iMonth = date.getMonth() + 1;
914
+ const iYear = date.getFullYear();
915
+ return `${iYear}-${this.pad(iMonth)}-${this.pad(iDay)}`;
916
+ }
917
+ queryParamToDate(param) {
918
+ if (param === null) {
919
+ return null;
920
+ }
921
+ const iDay = +param.split('-')[2];
922
+ const iMonth = +param.split('-')[1];
923
+ const iYear = +param.split('-')[0];
924
+ return new Date(iYear, iMonth - 1, iDay);
925
+ }
926
+ isValidDate(date) {
927
+ return date instanceof Date && !isNaN(date.getTime());
928
+ }
929
+ ajustDate(param) {
930
+ if (param === null) {
931
+ return null;
932
+ }
933
+ if (param instanceof Date) {
934
+ return param;
935
+ }
936
+ if (!param) {
937
+ return param;
938
+ }
939
+ return this.queryParamToDate(param.split('T')[0]);
940
+ }
941
+ pad(number) {
942
+ if (number < 10) {
943
+ return '0' + number;
944
+ }
945
+ return number;
946
+ }
947
947
  }
948
948
 
949
- /*
950
- Versão: 1.002
951
- Data Criação: 19/02/2019
952
- */
953
- class FieldValidationUtil {
954
- constructor(poNotification, poI18nPipe, literals) {
955
- this.literals = {};
956
- this.poNotification = poNotification;
957
- this.poI18nPipe = poI18nPipe;
958
- this.literals = literals;
959
- this.disclaimerUtil = new DisclaimerUtil(this.poNotification, this.poI18nPipe, this.literals);
960
- }
961
- vldFieldCharacter(field, value) {
962
- if (!value || value.trim() === '') {
963
- this.poNotification.error({
964
- message: this.poI18nPipe.transform(this.literals['fieldVldRequered'], [this.literals[field]])
965
- });
966
- return false;
967
- }
968
- return true;
969
- }
970
- // Valida uma faixa de caracteres se o inicial é menor que final
971
- vldRangeCharacter(initialField, finalField, initialValue, finalValue) {
972
- if (!initialValue || !finalValue) {
973
- return true;
974
- }
975
- if (initialValue.trim().toUpperCase() > finalValue.trim().toUpperCase()) {
976
- this.poNotification.error({
977
- message: this.poI18nPipe.transform(this.literals['fieldVldRange'], [this.literals[initialField], this.literals[finalField]])
978
- });
979
- return false;
980
- }
981
- return true;
982
- }
983
- vldFieldNumber(field, value, vldValue = false, zeroAccept = false) {
984
- if (vldValue && !this.vldValueOfNumber(field, value)) {
985
- return false;
986
- }
987
- if ((!value) || value <= 0) {
988
- if (value === 0 && zeroAccept === true) {
989
- return true;
990
- }
991
- this.poNotification.error({
992
- message: this.poI18nPipe.transform(this.literals['fieldVldRequered'], [this.literals[field]])
993
- });
994
- return false;
995
- }
996
- return true;
997
- }
998
- vldValueOfNumber(field, value) {
999
- if (value && value < 0) {
1000
- this.poNotification.error({ message: this.poI18nPipe.transform(this.literals['fieldVldNumber'], [value.toString(), this.literals[field]]) });
1001
- return false;
1002
- }
1003
- return true;
1004
- }
1005
- vldFieldPercent(field, value, vldValue = false) {
1006
- if (vldValue && !this.vldValueOfPercent(field, value)) {
1007
- return false;
1008
- }
1009
- if (!this.vldFieldNumber(field, value)) {
1010
- return false;
1011
- }
1012
- return true;
1013
- }
1014
- vldValueOfPercent(field, value) {
1015
- if (value && value < 0) {
1016
- this.poNotification.error({ message: this.poI18nPipe.transform(this.literals['fieldVldNumber'], [value.toString(), this.literals[field]]) });
1017
- return false;
1018
- }
1019
- if (value && value > 100) {
1020
- this.poNotification.error({ message: this.poI18nPipe.transform(this.literals['fieldVldNumber'], [value.toString(), this.literals[field]]) });
1021
- return false;
1022
- }
1023
- return true;
1024
- }
1025
- // Valida uma faixa de números se o inicial é menor que final
1026
- vldRangeNumber(initialField, finalField, initialValue, finalValue) {
1027
- if (!initialValue) {
1028
- initialValue = 0;
1029
- }
1030
- if (!finalValue) {
1031
- finalValue = 0;
1032
- }
1033
- if (initialValue > finalValue) {
1034
- this.poNotification.error({
1035
- message: this.poI18nPipe.transform(this.literals['fieldVldRange'], [this.literals[initialField], this.literals[finalField]])
1036
- });
1037
- return false;
1038
- }
1039
- return true;
1040
- }
1041
- vldFieldDate(field, value) {
1042
- const valDate = this.disclaimerUtil.ajustDate(value);
1043
- if (!this.disclaimerUtil.isValidDate(valDate)) {
1044
- this.poNotification.error({
1045
- message: this.poI18nPipe.transform(this.literals['fieldVldDate'], [this.literals[field]])
1046
- });
1047
- return false;
1048
- }
1049
- return true;
1050
- }
1051
- // Valida uma faixa de datas se o inicial é menor que final
1052
- vldRangeDate(initialField, finalField, initialValue, finalValue) {
1053
- if (!initialValue || !finalValue) {
1054
- return true;
1055
- }
1056
- const valInitialDate = this.disclaimerUtil.ajustDate(initialValue).getTime();
1057
- const valFinalDate = this.disclaimerUtil.ajustDate(finalValue).getTime();
1058
- if (valInitialDate > valFinalDate) {
1059
- this.poNotification.error({
1060
- message: this.poI18nPipe.transform(this.literals['fieldVldRange'], [this.literals[initialField], this.literals[finalField]])
1061
- });
1062
- return false;
1063
- }
1064
- return true;
1065
- }
1066
- vldFieldMultiSelect(field, value) {
1067
- if (!value || value.length === 0) {
1068
- this.poNotification.error({
1069
- message: this.poI18nPipe.transform(this.literals['fieldVldSelected'], [this.literals[field]])
1070
- });
1071
- return false;
1072
- }
1073
- return true;
1074
- }
1075
- vldFieldCheckbox(field, value) {
1076
- if (!value || value.length === 0) {
1077
- this.poNotification.error({
1078
- message: this.poI18nPipe.transform(this.literals['fieldVldSelected'], [this.literals[field]])
1079
- });
1080
- return false;
1081
- }
1082
- return true;
1083
- }
1084
- // Valida formato conforme regra: "9" apenas números, "X" qualquer caracter, "!" apenas letras maiúsculas
1085
- vldFieldFormat(field, value, format, replacePoint = false) {
1086
- let lOK = true;
1087
- let oldFormat;
1088
- if (!value) {
1089
- return lOK;
1090
- }
1091
- /*Retira os pontos do formato*/
1092
- if (replacePoint) {
1093
- oldFormat = format;
1094
- format = format.replace(/\./g, '');
1095
- }
1096
- if (value.length !== format.length) {
1097
- lOK = false;
1098
- }
1099
- else {
1100
- for (let idx = 0; idx < format.length; idx++) {
1101
- if (format[idx] === '9') {
1102
- if (value[idx].replace(/[0-9]/, '9') !== '9') {
1103
- lOK = false;
1104
- break;
1105
- }
1106
- }
1107
- if (format[idx] === '!') {
1108
- if (value[idx].replace(/[A-Z]/, 'A') !== 'A') {
1109
- lOK = false;
1110
- break;
1111
- }
1112
- }
1113
- }
1114
- }
1115
- if (replacePoint) {
1116
- format = oldFormat;
1117
- }
1118
- if (!lOK) {
1119
- this.poNotification.error({
1120
- message: this.poI18nPipe.transform(this.literals['fieldVldFormat'], [this.literals[field], format])
1121
- });
1122
- }
1123
- return lOK;
1124
- }
949
+ /*
950
+ Versão: 1.002
951
+ Data Criação: 19/02/2019
952
+ */
953
+ class FieldValidationUtil {
954
+ constructor(poNotification, poI18nPipe, literals) {
955
+ this.literals = {};
956
+ this.poNotification = poNotification;
957
+ this.poI18nPipe = poI18nPipe;
958
+ this.literals = literals;
959
+ this.disclaimerUtil = new DisclaimerUtil(this.poNotification, this.poI18nPipe, this.literals);
960
+ }
961
+ vldFieldCharacter(field, value) {
962
+ if (!value || value.trim() === '') {
963
+ this.poNotification.error({
964
+ message: this.poI18nPipe.transform(this.literals['fieldVldRequered'], [this.literals[field]])
965
+ });
966
+ return false;
967
+ }
968
+ return true;
969
+ }
970
+ // Valida uma faixa de caracteres se o inicial é menor que final
971
+ vldRangeCharacter(initialField, finalField, initialValue, finalValue) {
972
+ if (!initialValue || !finalValue) {
973
+ return true;
974
+ }
975
+ if (initialValue.trim().toUpperCase() > finalValue.trim().toUpperCase()) {
976
+ this.poNotification.error({
977
+ message: this.poI18nPipe.transform(this.literals['fieldVldRange'], [this.literals[initialField], this.literals[finalField]])
978
+ });
979
+ return false;
980
+ }
981
+ return true;
982
+ }
983
+ vldFieldNumber(field, value, vldValue = false, zeroAccept = false) {
984
+ if (vldValue && !this.vldValueOfNumber(field, value)) {
985
+ return false;
986
+ }
987
+ if ((!value) || value <= 0) {
988
+ if (value === 0 && zeroAccept === true) {
989
+ return true;
990
+ }
991
+ this.poNotification.error({
992
+ message: this.poI18nPipe.transform(this.literals['fieldVldRequered'], [this.literals[field]])
993
+ });
994
+ return false;
995
+ }
996
+ return true;
997
+ }
998
+ vldValueOfNumber(field, value) {
999
+ if (value && value < 0) {
1000
+ this.poNotification.error({ message: this.poI18nPipe.transform(this.literals['fieldVldNumber'], [value.toString(), this.literals[field]]) });
1001
+ return false;
1002
+ }
1003
+ return true;
1004
+ }
1005
+ vldFieldPercent(field, value, vldValue = false) {
1006
+ if (vldValue && !this.vldValueOfPercent(field, value)) {
1007
+ return false;
1008
+ }
1009
+ if (!this.vldFieldNumber(field, value)) {
1010
+ return false;
1011
+ }
1012
+ return true;
1013
+ }
1014
+ vldValueOfPercent(field, value) {
1015
+ if (value && value < 0) {
1016
+ this.poNotification.error({ message: this.poI18nPipe.transform(this.literals['fieldVldNumber'], [value.toString(), this.literals[field]]) });
1017
+ return false;
1018
+ }
1019
+ if (value && value > 100) {
1020
+ this.poNotification.error({ message: this.poI18nPipe.transform(this.literals['fieldVldNumber'], [value.toString(), this.literals[field]]) });
1021
+ return false;
1022
+ }
1023
+ return true;
1024
+ }
1025
+ // Valida uma faixa de números se o inicial é menor que final
1026
+ vldRangeNumber(initialField, finalField, initialValue, finalValue) {
1027
+ if (!initialValue) {
1028
+ initialValue = 0;
1029
+ }
1030
+ if (!finalValue) {
1031
+ finalValue = 0;
1032
+ }
1033
+ if (initialValue > finalValue) {
1034
+ this.poNotification.error({
1035
+ message: this.poI18nPipe.transform(this.literals['fieldVldRange'], [this.literals[initialField], this.literals[finalField]])
1036
+ });
1037
+ return false;
1038
+ }
1039
+ return true;
1040
+ }
1041
+ vldFieldDate(field, value) {
1042
+ const valDate = this.disclaimerUtil.ajustDate(value);
1043
+ if (!this.disclaimerUtil.isValidDate(valDate)) {
1044
+ this.poNotification.error({
1045
+ message: this.poI18nPipe.transform(this.literals['fieldVldDate'], [this.literals[field]])
1046
+ });
1047
+ return false;
1048
+ }
1049
+ return true;
1050
+ }
1051
+ // Valida uma faixa de datas se o inicial é menor que final
1052
+ vldRangeDate(initialField, finalField, initialValue, finalValue) {
1053
+ if (!initialValue || !finalValue) {
1054
+ return true;
1055
+ }
1056
+ const valInitialDate = this.disclaimerUtil.ajustDate(initialValue).getTime();
1057
+ const valFinalDate = this.disclaimerUtil.ajustDate(finalValue).getTime();
1058
+ if (valInitialDate > valFinalDate) {
1059
+ this.poNotification.error({
1060
+ message: this.poI18nPipe.transform(this.literals['fieldVldRange'], [this.literals[initialField], this.literals[finalField]])
1061
+ });
1062
+ return false;
1063
+ }
1064
+ return true;
1065
+ }
1066
+ vldFieldMultiSelect(field, value) {
1067
+ if (!value || value.length === 0) {
1068
+ this.poNotification.error({
1069
+ message: this.poI18nPipe.transform(this.literals['fieldVldSelected'], [this.literals[field]])
1070
+ });
1071
+ return false;
1072
+ }
1073
+ return true;
1074
+ }
1075
+ vldFieldCheckbox(field, value) {
1076
+ if (!value || value.length === 0) {
1077
+ this.poNotification.error({
1078
+ message: this.poI18nPipe.transform(this.literals['fieldVldSelected'], [this.literals[field]])
1079
+ });
1080
+ return false;
1081
+ }
1082
+ return true;
1083
+ }
1084
+ // Valida formato conforme regra: "9" apenas números, "X" qualquer caracter, "!" apenas letras maiúsculas
1085
+ vldFieldFormat(field, value, format, replacePoint = false) {
1086
+ let lOK = true;
1087
+ let oldFormat;
1088
+ if (!value) {
1089
+ return lOK;
1090
+ }
1091
+ /*Retira os pontos do formato*/
1092
+ if (replacePoint) {
1093
+ oldFormat = format;
1094
+ format = format.replace(/\./g, '');
1095
+ }
1096
+ if (value.length !== format.length) {
1097
+ lOK = false;
1098
+ }
1099
+ else {
1100
+ for (let idx = 0; idx < format.length; idx++) {
1101
+ if (format[idx] === '9') {
1102
+ if (value[idx].replace(/[0-9]/, '9') !== '9') {
1103
+ lOK = false;
1104
+ break;
1105
+ }
1106
+ }
1107
+ if (format[idx] === '!') {
1108
+ if (value[idx].replace(/[A-Z]/, 'A') !== 'A') {
1109
+ lOK = false;
1110
+ break;
1111
+ }
1112
+ }
1113
+ }
1114
+ }
1115
+ if (replacePoint) {
1116
+ format = oldFormat;
1117
+ }
1118
+ if (!lOK) {
1119
+ this.poNotification.error({
1120
+ message: this.poI18nPipe.transform(this.literals['fieldVldFormat'], [this.literals[field], format])
1121
+ });
1122
+ }
1123
+ return lOK;
1124
+ }
1125
1125
  }
1126
1126
 
1127
- /*
1128
- Versão: 1.000
1129
- Data Criação: 06/08/2018
1130
- */
1131
- class FilterRangeUtil {
1132
- constructor() {
1133
- }
1134
- static makeFilterRangeCharacter(iniInitial, iniFinal) {
1135
- return {
1136
- iniInitial,
1137
- iniFinal,
1138
- valInitial: iniInitial,
1139
- valFinal: iniFinal
1140
- };
1141
- }
1142
- static makeFilterRangeNumber(iniInitial, iniFinal) {
1143
- return {
1144
- iniInitial,
1145
- iniFinal,
1146
- valInitial: iniInitial,
1147
- valFinal: iniFinal
1148
- };
1149
- }
1150
- static makeFilterRangeDate(iniInitial, iniFinal) {
1151
- return {
1152
- iniInitial,
1153
- iniFinal,
1154
- valInitial: iniInitial,
1155
- valFinal: iniFinal
1156
- };
1157
- }
1127
+ /*
1128
+ Versão: 1.000
1129
+ Data Criação: 06/08/2018
1130
+ */
1131
+ class FilterRangeUtil {
1132
+ constructor() {
1133
+ }
1134
+ static makeFilterRangeCharacter(iniInitial, iniFinal) {
1135
+ return {
1136
+ iniInitial,
1137
+ iniFinal,
1138
+ valInitial: iniInitial,
1139
+ valFinal: iniFinal
1140
+ };
1141
+ }
1142
+ static makeFilterRangeNumber(iniInitial, iniFinal) {
1143
+ return {
1144
+ iniInitial,
1145
+ iniFinal,
1146
+ valInitial: iniInitial,
1147
+ valFinal: iniFinal
1148
+ };
1149
+ }
1150
+ static makeFilterRangeDate(iniInitial, iniFinal) {
1151
+ return {
1152
+ iniInitial,
1153
+ iniFinal,
1154
+ valInitial: iniInitial,
1155
+ valFinal: iniFinal
1156
+ };
1157
+ }
1158
1158
  }
1159
1159
 
1160
- /*
1161
- Versão: 1.003
1162
- Data Criação: 18/04/2019
1163
- */
1164
- class GenericFunctionsUtils {
1165
- constructor(literals) {
1166
- this.literals = {};
1167
- this.literals = literals;
1168
- }
1169
- /* Transforma uma Lista separada por "," em um Array */
1170
- static listToArrayCharacter(list) {
1171
- let returnArray = new Array();
1172
- if (list && list !== '') {
1173
- returnArray = list.split(',');
1174
- }
1175
- return returnArray;
1176
- }
1177
- /* Transforma um Array em uma Lista separada por "," */
1178
- static ArrayToListCharacter(array) {
1179
- let list = '';
1180
- if (array && array.length > 0) {
1181
- list = array.join(',');
1182
- }
1183
- return list;
1184
- }
1185
- static isEmpty(object) {
1186
- let isEmpty = true;
1187
- for (const content in object) {
1188
- if (object.hasOwnProperty(content)) {
1189
- isEmpty = false;
1190
- }
1191
- }
1192
- return isEmpty;
1193
- }
1194
- static getChartValues(chartData) {
1195
- let chartValues;
1196
- let maxValue, minValue;
1197
- maxValue = undefined;
1198
- minValue = undefined;
1199
- chartData.map(item => {
1200
- if (maxValue === undefined && minValue === undefined) {
1201
- maxValue = item.data[0];
1202
- minValue = item.data[0];
1203
- }
1204
- else {
1205
- if (item.data < minValue) {
1206
- minValue = item.data[0];
1207
- }
1208
- if (item.data > maxValue) {
1209
- maxValue = item.data[0];
1210
- }
1211
- }
1212
- });
1213
- if (maxValue > 0 && minValue > 0) {
1214
- chartValues = { maxValue: maxValue, minValue: 0 };
1215
- }
1216
- if (maxValue > 0 && minValue < 0) {
1217
- chartValues = { maxValue: maxValue, minValue: minValue };
1218
- }
1219
- if (maxValue < 0 && minValue < 0) {
1220
- const max = (minValue / 3) * (-1);
1221
- chartValues = { maxValue: max, minValue: minValue };
1222
- }
1223
- if (maxValue > 0 && minValue === 0) {
1224
- chartValues = { maxValue: maxValue, minValue: 0 };
1225
- }
1226
- if (maxValue === 0 && minValue < 0) {
1227
- const max = (minValue / 3) * (-1);
1228
- chartValues = { maxValue: max, minValue: minValue };
1229
- }
1230
- if (maxValue === 0 && minValue === 0) {
1231
- chartValues = { maxValue: undefined, minValue: undefined };
1232
- }
1233
- chartValues.maxValue = Math.round(chartValues.maxValue);
1234
- chartValues.minValue = Math.round(chartValues.minValue);
1235
- return chartValues;
1236
- }
1237
- /*Deixa no list apenas o itens que existem no options*/
1238
- static atzMultiSelectListByOptions(options, list) {
1239
- let idx;
1240
- let newList;
1241
- if (!list) {
1242
- return list;
1243
- }
1244
- newList = new Array();
1245
- list.map(item => {
1246
- if (item) {
1247
- idx = options.findIndex(itemOptions => itemOptions.value === item);
1248
- if (idx >= 0) {
1249
- newList.push(item);
1250
- }
1251
- }
1252
- });
1253
- return newList;
1254
- }
1255
- /*Carrega o Options com os valores defaults passados como parâmetro (list)*/
1256
- loadOptionsMultiSelect(options, list) {
1257
- let idx;
1258
- if (!list) {
1259
- return;
1260
- }
1261
- list.map(item => {
1262
- if (item) {
1263
- idx = options.findIndex(itemOptions => itemOptions.value === item);
1264
- if (idx === -1) {
1265
- options.push({ label: item === 'all' ? this.literals['all'] : item, value: item });
1266
- }
1267
- }
1268
- });
1269
- }
1270
- /*Carrega o Options com os valores defaults passados como parâmetro (list)*/
1271
- loadOptionsSelect(options, selectValue, tradValue = false) {
1272
- let idx;
1273
- if (!selectValue) {
1274
- return;
1275
- }
1276
- if (selectValue) {
1277
- idx = options.findIndex(itemOptions => itemOptions.value === selectValue);
1278
- if (idx === -1) {
1279
- options.push({ label: tradValue ? this.literals[selectValue] : selectValue, value: selectValue });
1280
- }
1281
- }
1282
- }
1283
- /*Método que compara 2 objetos e retorna se são iguais ou diferentes*/
1284
- compareObjects(firstObject, secondObject) {
1285
- if (!firstObject || !secondObject) {
1286
- return false;
1287
- }
1288
- /*Pega a lista de nomes dos campos do objetos e compara*/
1289
- if (Object.getOwnPropertyNames(firstObject).length !== Object.getOwnPropertyNames(secondObject).length) {
1290
- return false;
1291
- }
1292
- for (const content in firstObject) {
1293
- if (content.substr(0, 1) === '$' || content.substr(0, 1) === '_') {
1294
- continue;
1295
- }
1296
- if (firstObject[content] !== secondObject[content]) {
1297
- return false;
1298
- }
1299
- }
1300
- return true;
1301
- }
1302
- referenceGeneration(charInd, dateRef) {
1303
- let reference;
1304
- let random;
1305
- const iDay = dateRef.getDate();
1306
- const iMonth = dateRef.getMonth() + 1;
1307
- const iYear = dateRef.getFullYear();
1308
- reference = `${this.pad(iYear)}${this.pad(iMonth)}${this.pad(iDay)}${charInd}`;
1309
- random = btoa(`${(new Date()).getTime()}`);
1310
- random = random.replace(/[=]/g, '');
1311
- random = random.slice(random.length - 3, random.length);
1312
- return `${reference}${random}`;
1313
- }
1314
- pad(number) {
1315
- if (number < 10) {
1316
- return '0' + number;
1317
- }
1318
- if (number > 99) {
1319
- return (number + '').slice(2, 4);
1320
- }
1321
- return number;
1322
- }
1323
- focusInternalInput(idField) {
1324
- const fieldComponent = document.getElementById(idField);
1325
- const fieldInput = fieldComponent.getElementsByClassName('po-input')[0];
1326
- fieldInput.focus();
1327
- }
1160
+ /*
1161
+ Versão: 1.003
1162
+ Data Criação: 18/04/2019
1163
+ */
1164
+ class GenericFunctionsUtils {
1165
+ constructor(literals) {
1166
+ this.literals = {};
1167
+ this.literals = literals;
1168
+ }
1169
+ /* Transforma uma Lista separada por "," em um Array */
1170
+ static listToArrayCharacter(list) {
1171
+ let returnArray = new Array();
1172
+ if (list && list !== '') {
1173
+ returnArray = list.split(',');
1174
+ }
1175
+ return returnArray;
1176
+ }
1177
+ /* Transforma um Array em uma Lista separada por "," */
1178
+ static ArrayToListCharacter(array) {
1179
+ let list = '';
1180
+ if (array && array.length > 0) {
1181
+ list = array.join(',');
1182
+ }
1183
+ return list;
1184
+ }
1185
+ static isEmpty(object) {
1186
+ let isEmpty = true;
1187
+ for (const content in object) {
1188
+ if (object.hasOwnProperty(content)) {
1189
+ isEmpty = false;
1190
+ }
1191
+ }
1192
+ return isEmpty;
1193
+ }
1194
+ static getChartValues(chartData) {
1195
+ let chartValues;
1196
+ let maxValue, minValue;
1197
+ maxValue = undefined;
1198
+ minValue = undefined;
1199
+ chartData.map(item => {
1200
+ if (maxValue === undefined && minValue === undefined) {
1201
+ maxValue = item.data[0];
1202
+ minValue = item.data[0];
1203
+ }
1204
+ else {
1205
+ if (item.data < minValue) {
1206
+ minValue = item.data[0];
1207
+ }
1208
+ if (item.data > maxValue) {
1209
+ maxValue = item.data[0];
1210
+ }
1211
+ }
1212
+ });
1213
+ if (maxValue > 0 && minValue > 0) {
1214
+ chartValues = { maxValue: maxValue, minValue: 0 };
1215
+ }
1216
+ if (maxValue > 0 && minValue < 0) {
1217
+ chartValues = { maxValue: maxValue, minValue: minValue };
1218
+ }
1219
+ if (maxValue < 0 && minValue < 0) {
1220
+ const max = (minValue / 3) * (-1);
1221
+ chartValues = { maxValue: max, minValue: minValue };
1222
+ }
1223
+ if (maxValue > 0 && minValue === 0) {
1224
+ chartValues = { maxValue: maxValue, minValue: 0 };
1225
+ }
1226
+ if (maxValue === 0 && minValue < 0) {
1227
+ const max = (minValue / 3) * (-1);
1228
+ chartValues = { maxValue: max, minValue: minValue };
1229
+ }
1230
+ if (maxValue === 0 && minValue === 0) {
1231
+ chartValues = { maxValue: undefined, minValue: undefined };
1232
+ }
1233
+ chartValues.maxValue = Math.round(chartValues.maxValue);
1234
+ chartValues.minValue = Math.round(chartValues.minValue);
1235
+ return chartValues;
1236
+ }
1237
+ /*Deixa no list apenas o itens que existem no options*/
1238
+ static atzMultiSelectListByOptions(options, list) {
1239
+ let idx;
1240
+ let newList;
1241
+ if (!list) {
1242
+ return list;
1243
+ }
1244
+ newList = new Array();
1245
+ list.map(item => {
1246
+ if (item) {
1247
+ idx = options.findIndex(itemOptions => itemOptions.value === item);
1248
+ if (idx >= 0) {
1249
+ newList.push(item);
1250
+ }
1251
+ }
1252
+ });
1253
+ return newList;
1254
+ }
1255
+ /*Carrega o Options com os valores defaults passados como parâmetro (list)*/
1256
+ loadOptionsMultiSelect(options, list) {
1257
+ let idx;
1258
+ if (!list) {
1259
+ return;
1260
+ }
1261
+ list.map(item => {
1262
+ if (item) {
1263
+ idx = options.findIndex(itemOptions => itemOptions.value === item);
1264
+ if (idx === -1) {
1265
+ options.push({ label: item === 'all' ? this.literals['all'] : item, value: item });
1266
+ }
1267
+ }
1268
+ });
1269
+ }
1270
+ /*Carrega o Options com os valores defaults passados como parâmetro (list)*/
1271
+ loadOptionsSelect(options, selectValue, tradValue = false) {
1272
+ let idx;
1273
+ if (!selectValue) {
1274
+ return;
1275
+ }
1276
+ if (selectValue) {
1277
+ idx = options.findIndex(itemOptions => itemOptions.value === selectValue);
1278
+ if (idx === -1) {
1279
+ options.push({ label: tradValue ? this.literals[selectValue] : selectValue, value: selectValue });
1280
+ }
1281
+ }
1282
+ }
1283
+ /*Método que compara 2 objetos e retorna se são iguais ou diferentes*/
1284
+ compareObjects(firstObject, secondObject) {
1285
+ if (!firstObject || !secondObject) {
1286
+ return false;
1287
+ }
1288
+ /*Pega a lista de nomes dos campos do objetos e compara*/
1289
+ if (Object.getOwnPropertyNames(firstObject).length !== Object.getOwnPropertyNames(secondObject).length) {
1290
+ return false;
1291
+ }
1292
+ for (const content in firstObject) {
1293
+ if (content.substr(0, 1) === '$' || content.substr(0, 1) === '_') {
1294
+ continue;
1295
+ }
1296
+ if (firstObject[content] !== secondObject[content]) {
1297
+ return false;
1298
+ }
1299
+ }
1300
+ return true;
1301
+ }
1302
+ referenceGeneration(charInd, dateRef) {
1303
+ let reference;
1304
+ let random;
1305
+ const iDay = dateRef.getDate();
1306
+ const iMonth = dateRef.getMonth() + 1;
1307
+ const iYear = dateRef.getFullYear();
1308
+ reference = `${this.pad(iYear)}${this.pad(iMonth)}${this.pad(iDay)}${charInd}`;
1309
+ random = btoa(`${(new Date()).getTime()}`);
1310
+ random = random.replace(/[=]/g, '');
1311
+ random = random.slice(random.length - 3, random.length);
1312
+ return `${reference}${random}`;
1313
+ }
1314
+ pad(number) {
1315
+ if (number < 10) {
1316
+ return '0' + number;
1317
+ }
1318
+ if (number > 99) {
1319
+ return (number + '').slice(2, 4);
1320
+ }
1321
+ return number;
1322
+ }
1323
+ focusInternalInput(idField) {
1324
+ const fieldComponent = document.getElementById(idField);
1325
+ const fieldInput = fieldComponent.getElementsByClassName('po-input')[0];
1326
+ fieldInput.focus();
1327
+ }
1328
1328
  }
1329
1329
 
1330
- class FileUtil {
1331
- constructor() { }
1332
- static downloadFile(data, fileName, contentType, base64) {
1333
- base64 = (base64 === false) ? false : true;
1334
- const dataBlob = base64 ? this.b64toBlob(data, contentType) : data;
1335
- this.download(dataBlob, fileName);
1336
- }
1337
- static downloadData(data, dwldDataParam = null) {
1338
- if (!data) {
1339
- return;
1340
- }
1341
- if (!dwldDataParam) {
1342
- dwldDataParam = new DownloadDataParams();
1343
- }
1344
- if (!dwldDataParam.fileName) {
1345
- dwldDataParam.fileName = 'data.csv';
1346
- }
1347
- if (!dwldDataParam.literals) {
1348
- dwldDataParam.literals = {};
1349
- }
1350
- if (!dwldDataParam.columnDelimiter) {
1351
- dwldDataParam.columnDelimiter = ';';
1352
- }
1353
- if (!dwldDataParam.columnList) {
1354
- dwldDataParam.columnList = [];
1355
- }
1356
- if (!dwldDataParam.columnExclude) {
1357
- dwldDataParam.columnExclude = [];
1358
- }
1359
- const datab64 = btoa(this.jsonToString(data, dwldDataParam));
1360
- this.downloadFile(datab64, dwldDataParam.fileName, 'text/csv');
1361
- }
1362
- static download(file, fileName) {
1363
- const binaryData = [file];
1364
- const downloadLink = document.createElement('a');
1365
- const urlDownload = window.URL.createObjectURL(new Blob(binaryData, { type: file.type }));
1366
- /* Verifica se é ie ou edge, pois o mesmo tem tratamento próprio para arquivos blob */
1367
- const nav = window.navigator;
1368
- if (nav && nav.msSaveOrOpenBlob) {
1369
- nav.msSaveOrOpenBlob(file, fileName);
1370
- }
1371
- else {
1372
- downloadLink.href = urlDownload;
1373
- downloadLink.setAttribute('download', fileName);
1374
- document.body.appendChild(downloadLink);
1375
- downloadLink.click();
1376
- window.URL.revokeObjectURL(urlDownload);
1377
- downloadLink.remove();
1378
- }
1379
- }
1380
- static b64toBlob(b64Data, contentType, sliceSize) {
1381
- contentType = contentType || '';
1382
- sliceSize = sliceSize || 512;
1383
- const byteCharacters = atob(b64Data);
1384
- const byteArrays = [];
1385
- for (let offset = 0; offset < byteCharacters.length; offset += sliceSize) {
1386
- const slice = byteCharacters.slice(offset, offset + sliceSize);
1387
- const byteNumbers = new Array(slice.length);
1388
- for (let i = 0; i < slice.length; i++) {
1389
- byteNumbers[i] = slice.charCodeAt(i);
1390
- }
1391
- const byteArray = new Uint8Array(byteNumbers);
1392
- byteArrays.push(byteArray);
1393
- }
1394
- const blob = new Blob(byteArrays, { type: contentType });
1395
- return blob;
1396
- }
1397
- static jsonToString(jsonData, dwldDataParam) {
1398
- if (!jsonData || jsonData.length === 0) {
1399
- return '';
1400
- }
1401
- const lineDelimiter = '\n';
1402
- let columnOrig = null;
1403
- let columnHeader = null;
1404
- const keys = [];
1405
- let includeKey;
1406
- if (dwldDataParam.columnList &&
1407
- dwldDataParam.columnList.length > 0) {
1408
- columnOrig = dwldDataParam.columnList;
1409
- }
1410
- else {
1411
- columnOrig = Object.keys(jsonData[0]);
1412
- }
1413
- columnOrig.forEach(key => {
1414
- includeKey = true;
1415
- if (dwldDataParam.columnExclude &&
1416
- dwldDataParam.columnExclude.length > 0 &&
1417
- dwldDataParam.columnExclude.indexOf(key) !== -1) {
1418
- includeKey = false;
1419
- }
1420
- if (includeKey) {
1421
- keys.push(key);
1422
- columnHeader = (!columnHeader) ? '' : columnHeader + dwldDataParam.columnDelimiter;
1423
- columnHeader += (dwldDataParam.literals[key]) ? dwldDataParam.literals[key] : key;
1424
- }
1425
- });
1426
- const lineStr = jsonData.reduce((accLineStr, currentItem) => {
1427
- let first = true;
1428
- let columnValue = null;
1429
- keys.forEach(key => {
1430
- if (!first) {
1431
- accLineStr += dwldDataParam.columnDelimiter;
1432
- }
1433
- columnValue = currentItem[key];
1434
- if (columnValue === null || columnValue === undefined) {
1435
- columnValue = '';
1436
- }
1437
- switch (typeof (columnValue)) {
1438
- case 'number':
1439
- columnValue = columnValue.toLocaleString();
1440
- break;
1441
- case 'boolean':
1442
- columnValue = (dwldDataParam.literals[`${columnValue}`]) ?
1443
- dwldDataParam.literals[`${columnValue}`] : columnValue;
1444
- break;
1445
- case 'object':
1446
- columnValue = JSON.stringify(columnValue);
1447
- }
1448
- accLineStr += columnValue;
1449
- first = false;
1450
- });
1451
- return accLineStr + lineDelimiter;
1452
- }, columnHeader + lineDelimiter);
1453
- return lineStr;
1454
- }
1455
- static fileToB64(file) {
1456
- return new Promise((resolve, reject) => {
1457
- const reader = new FileReader();
1458
- reader.readAsDataURL(file);
1459
- reader.onload = () => {
1460
- let cntFile;
1461
- cntFile = reader.result;
1462
- if (!cntFile) {
1463
- reject('File not found or Empty');
1464
- return;
1465
- }
1466
- const aCnt = cntFile.split(',');
1467
- if (aCnt && aCnt.length >= 2) {
1468
- resolve(aCnt[1]);
1469
- }
1470
- else {
1471
- reject('File not found or Empty');
1472
- }
1473
- };
1474
- reader.onerror = error => reject(error);
1475
- });
1476
- }
1477
- }
1478
- class DownloadDataParams {
1330
+ class FileUtil {
1331
+ constructor() { }
1332
+ static downloadFile(data, fileName, contentType, base64) {
1333
+ base64 = (base64 === false) ? false : true;
1334
+ const dataBlob = base64 ? this.b64toBlob(data, contentType) : data;
1335
+ this.download(dataBlob, fileName);
1336
+ }
1337
+ static downloadData(data, dwldDataParam = null) {
1338
+ if (!data) {
1339
+ return;
1340
+ }
1341
+ if (!dwldDataParam) {
1342
+ dwldDataParam = new DownloadDataParams();
1343
+ }
1344
+ if (!dwldDataParam.fileName) {
1345
+ dwldDataParam.fileName = 'data.csv';
1346
+ }
1347
+ if (!dwldDataParam.literals) {
1348
+ dwldDataParam.literals = {};
1349
+ }
1350
+ if (!dwldDataParam.columnDelimiter) {
1351
+ dwldDataParam.columnDelimiter = ';';
1352
+ }
1353
+ if (!dwldDataParam.columnList) {
1354
+ dwldDataParam.columnList = [];
1355
+ }
1356
+ if (!dwldDataParam.columnExclude) {
1357
+ dwldDataParam.columnExclude = [];
1358
+ }
1359
+ const datab64 = btoa(this.jsonToString(data, dwldDataParam));
1360
+ this.downloadFile(datab64, dwldDataParam.fileName, 'text/csv');
1361
+ }
1362
+ static download(file, fileName) {
1363
+ const binaryData = [file];
1364
+ const downloadLink = document.createElement('a');
1365
+ const urlDownload = window.URL.createObjectURL(new Blob(binaryData, { type: file.type }));
1366
+ /* Verifica se é ie ou edge, pois o mesmo tem tratamento próprio para arquivos blob */
1367
+ const nav = window.navigator;
1368
+ if (nav && nav.msSaveOrOpenBlob) {
1369
+ nav.msSaveOrOpenBlob(file, fileName);
1370
+ }
1371
+ else {
1372
+ downloadLink.href = urlDownload;
1373
+ downloadLink.setAttribute('download', fileName);
1374
+ document.body.appendChild(downloadLink);
1375
+ downloadLink.click();
1376
+ window.URL.revokeObjectURL(urlDownload);
1377
+ downloadLink.remove();
1378
+ }
1379
+ }
1380
+ static b64toBlob(b64Data, contentType, sliceSize) {
1381
+ contentType = contentType || '';
1382
+ sliceSize = sliceSize || 512;
1383
+ const byteCharacters = atob(b64Data);
1384
+ const byteArrays = [];
1385
+ for (let offset = 0; offset < byteCharacters.length; offset += sliceSize) {
1386
+ const slice = byteCharacters.slice(offset, offset + sliceSize);
1387
+ const byteNumbers = new Array(slice.length);
1388
+ for (let i = 0; i < slice.length; i++) {
1389
+ byteNumbers[i] = slice.charCodeAt(i);
1390
+ }
1391
+ const byteArray = new Uint8Array(byteNumbers);
1392
+ byteArrays.push(byteArray);
1393
+ }
1394
+ const blob = new Blob(byteArrays, { type: contentType });
1395
+ return blob;
1396
+ }
1397
+ static jsonToString(jsonData, dwldDataParam) {
1398
+ if (!jsonData || jsonData.length === 0) {
1399
+ return '';
1400
+ }
1401
+ const lineDelimiter = '\n';
1402
+ let columnOrig = null;
1403
+ let columnHeader = null;
1404
+ const keys = [];
1405
+ let includeKey;
1406
+ if (dwldDataParam.columnList &&
1407
+ dwldDataParam.columnList.length > 0) {
1408
+ columnOrig = dwldDataParam.columnList;
1409
+ }
1410
+ else {
1411
+ columnOrig = Object.keys(jsonData[0]);
1412
+ }
1413
+ columnOrig.forEach(key => {
1414
+ includeKey = true;
1415
+ if (dwldDataParam.columnExclude &&
1416
+ dwldDataParam.columnExclude.length > 0 &&
1417
+ dwldDataParam.columnExclude.indexOf(key) !== -1) {
1418
+ includeKey = false;
1419
+ }
1420
+ if (includeKey) {
1421
+ keys.push(key);
1422
+ columnHeader = (!columnHeader) ? '' : columnHeader + dwldDataParam.columnDelimiter;
1423
+ columnHeader += (dwldDataParam.literals[key]) ? dwldDataParam.literals[key] : key;
1424
+ }
1425
+ });
1426
+ const lineStr = jsonData.reduce((accLineStr, currentItem) => {
1427
+ let first = true;
1428
+ let columnValue = null;
1429
+ keys.forEach(key => {
1430
+ if (!first) {
1431
+ accLineStr += dwldDataParam.columnDelimiter;
1432
+ }
1433
+ columnValue = currentItem[key];
1434
+ if (columnValue === null || columnValue === undefined) {
1435
+ columnValue = '';
1436
+ }
1437
+ switch (typeof (columnValue)) {
1438
+ case 'number':
1439
+ columnValue = columnValue.toLocaleString();
1440
+ break;
1441
+ case 'boolean':
1442
+ columnValue = (dwldDataParam.literals[`${columnValue}`]) ?
1443
+ dwldDataParam.literals[`${columnValue}`] : columnValue;
1444
+ break;
1445
+ case 'object':
1446
+ columnValue = JSON.stringify(columnValue);
1447
+ }
1448
+ accLineStr += columnValue;
1449
+ first = false;
1450
+ });
1451
+ return accLineStr + lineDelimiter;
1452
+ }, columnHeader + lineDelimiter);
1453
+ return lineStr;
1454
+ }
1455
+ static fileToB64(file) {
1456
+ return new Promise((resolve, reject) => {
1457
+ const reader = new FileReader();
1458
+ reader.readAsDataURL(file);
1459
+ reader.onload = () => {
1460
+ let cntFile;
1461
+ cntFile = reader.result;
1462
+ if (!cntFile) {
1463
+ reject('File not found or Empty');
1464
+ return;
1465
+ }
1466
+ const aCnt = cntFile.split(',');
1467
+ if (aCnt && aCnt.length >= 2) {
1468
+ resolve(aCnt[1]);
1469
+ }
1470
+ else {
1471
+ reject('File not found or Empty');
1472
+ }
1473
+ };
1474
+ reader.onerror = error => reject(error);
1475
+ });
1476
+ }
1477
+ }
1478
+ class DownloadDataParams {
1479
1479
  }
1480
1480
 
1481
- class ScheduleParameters {
1482
- }
1483
- class ExecutionStatus {
1484
- }
1485
- class ExecutionParameters {
1481
+ class ScheduleParameters {
1482
+ }
1483
+ class ExecutionStatus {
1484
+ }
1485
+ class ExecutionParameters {
1486
1486
  }
1487
1487
 
1488
- class TotvsScheduleExecutionService {
1489
- constructor(http) {
1490
- this.http = http;
1491
- this.headers = { headers: { 'X-PO-Screen-Lock': 'true' } };
1492
- this.urlCadServidor = '/dts/datasul-rest/resources/prg/btb/v1/servidoresExecucao';
1493
- this.urlJobScheduler = '/dts/datasul-rest/resources/prg/framework/v1/jobScheduler';
1494
- this.urlJobExecution = '/dts/datasul-rest/resources/prg/framework/v1/jobExecution';
1495
- }
1496
- getFilteredItems(params) {
1497
- const urlParams = new Array();
1498
- urlParams.push(`pageSize=${params.pageSize.toString()}`);
1499
- urlParams.push(`page=${params.page.toString()}`);
1500
- if (params.filter && params.filter.length > 0) {
1501
- urlParams.push(`quickSearch=${params.filter}`);
1502
- }
1503
- return this.http.get(`${this.urlCadServidor}?${urlParams.join('&')}`);
1504
- }
1505
- getObjectByValue(id) {
1506
- return this.http.get(`${this.urlCadServidor}/${id}`, this.headers);
1507
- }
1508
- createExecution(parameters, loading) {
1509
- const params = JSON.parse(JSON.stringify(parameters).replace(/\\\\/g, '*|'));
1510
- if (loading) {
1511
- return this.http.post(`${this.urlJobScheduler}`, params, this.headers);
1512
- }
1513
- else {
1514
- return this.http.post(`${this.urlJobScheduler}`, params);
1515
- }
1516
- }
1517
- createExecutionForNow(executionParams, loading) {
1518
- let jobScheduleParams;
1519
- const date = new Date();
1520
- const params = JSON.parse(JSON.stringify(executionParams).replace(/\\\\/g, '*|'));
1521
- if (!params.businessParams || params.businessParams.length === 0) {
1522
- params.businessParams = [{ chave: '', valor: '' }];
1523
- }
1524
- jobScheduleParams = {};
1525
- jobScheduleParams.status = 'active';
1526
- jobScheduleParams.processID = params.programName;
1527
- jobScheduleParams.firstExecution = `${date.getFullYear()}-${(date.getMonth() + 1)}-${date.getDate()}T${this.addZero(date.getHours())}:${this.addZero(date.getMinutes())}:00.000Z`;
1528
- jobScheduleParams.recurrent = false;
1529
- jobScheduleParams.executionParameter = {
1530
- parametros: [
1531
- { chave: 'rpwServer', valor: params.executionServer },
1532
- { chave: 'RPW_PROGRAM', valor: params.externalName },
1533
- { chave: 'RPW_PRG_EMS5', valor: params.programEMS5 ? 'yes' : 'no' },
1534
- { chave: 'RPW_PRG_VERS', valor: params.programVersion },
1535
- { parametros_negocio: params.businessParams }
1536
- ]
1537
- };
1538
- if (loading) {
1539
- return this.http.post(`${this.urlJobScheduler}`, jobScheduleParams, this.headers);
1540
- }
1541
- else {
1542
- return this.http.post(`${this.urlJobScheduler}`, jobScheduleParams);
1543
- }
1544
- }
1545
- getExecutionByJobScheduleID(jobScheduleID, loading = false) {
1546
- const url = `${this.urlJobExecution}?jobScheduleID=${jobScheduleID}`;
1547
- return this.getExecution(url, loading).pipe(map((response) => this.transformExecution('jobScheduleID', response)));
1548
- }
1549
- getExecutionByExecutionID(executionID, loading = false) {
1550
- const url = `${this.urlJobExecution}/${executionID}`;
1551
- return this.getExecution(url, loading).pipe(map((response) => this.transformExecution('executionID', response)));
1552
- }
1553
- getExecution(url, loading) {
1554
- if (loading) {
1555
- return this.http.get(url, this.headers);
1556
- }
1557
- else {
1558
- return this.http.get(url);
1559
- }
1560
- }
1561
- transformExecution(type, response) {
1562
- if (!response || !response.items || response.items.length === 0) {
1563
- return;
1564
- }
1565
- response = response.items[0];
1566
- const execStatus = new ExecutionStatus();
1567
- execStatus.jobScheduleID = response.jobScheduleID;
1568
- execStatus.executionID = response.executionID;
1569
- execStatus.startedDate = response.startedDate;
1570
- execStatus.error = response.error;
1571
- execStatus.status = response.status;
1572
- return execStatus;
1573
- }
1574
- followUpExcByJobScheduleID(jobScheduleID, intervalNum, fncCallBack, loading = false) {
1575
- this.followUpExecution('jobScheduleID', jobScheduleID, intervalNum, fncCallBack, loading);
1576
- }
1577
- followUpExcByExecutionID(executionID, intervalNum, fncCallBack, loading = false) {
1578
- this.followUpExecution('executionID', executionID, intervalNum, fncCallBack, loading);
1579
- }
1580
- followUpExecution(type, execID, intervalNum, fncCallBack, loading) {
1581
- this.jobExecutionSubscription$ = null;
1582
- const intervalID = setInterval(() => {
1583
- const execStatus = new ExecutionStatus();
1584
- execStatus.jobScheduleID = (type === 'jobScheduleID') ? execID : '';
1585
- execStatus.executionID = (type === 'executionID') ? execID : '';
1586
- execStatus.startedDate = null;
1587
- execStatus.error = '';
1588
- execStatus.status = 'PENDING'; // PENDING, RUNNING, SUCCESS, FAILURE
1589
- if (this.jobExecutionSubscription$) {
1590
- return;
1591
- }
1592
- if (type === 'jobScheduleID') {
1593
- this.jobExecutionSubscription$ = this.getExecutionByJobScheduleID(execID, loading)
1594
- .subscribe((response) => {
1595
- this.followUpExecReturnOk(execID, execStatus, response, intervalID, fncCallBack);
1596
- }, (error) => {
1597
- this.followUpExecReturnError(error, execStatus, intervalID, fncCallBack);
1598
- });
1599
- }
1600
- if (type === 'executionID') {
1601
- this.jobExecutionSubscription$ = this.getExecutionByExecutionID(execID, loading)
1602
- .subscribe((response) => {
1603
- this.followUpExecReturnOk(execID, execStatus, response, intervalID, fncCallBack);
1604
- }, (error) => {
1605
- this.followUpExecReturnError(error, execStatus, intervalID, fncCallBack);
1606
- });
1607
- }
1608
- }, intervalNum);
1609
- }
1610
- followUpExecReturnOk(execID, execStatus, response, intervalID, fncCallBack) {
1611
- if (response) {
1612
- execStatus = response;
1613
- }
1614
- else {
1615
- execStatus.error = `Agendamento não encontrado com ID: ${execID}`;
1616
- execStatus.status = 'FAILURE';
1617
- }
1618
- if (!fncCallBack(execStatus) ||
1619
- execStatus.status === 'SUCCESS' ||
1620
- execStatus.status === 'FAILURE') {
1621
- clearInterval(intervalID);
1622
- }
1623
- this.jobExecutionSubscription$ = null;
1624
- }
1625
- followUpExecReturnError(error, execStatus, intervalID, fncCallBack) {
1626
- let erroDesc = '';
1627
- if (error instanceof HttpErrorResponse) {
1628
- erroDesc = error.message;
1629
- if (error.error) {
1630
- erroDesc = '';
1631
- if (error.error.code) {
1632
- erroDesc = error.error.code;
1633
- }
1634
- if (error.error.message) {
1635
- erroDesc = `${erroDesc} - ${error.error.message}`;
1636
- }
1637
- if (error.error.detailedMessage) {
1638
- erroDesc = `${erroDesc} - ${error.error.detailedMessage}`;
1639
- }
1640
- }
1641
- }
1642
- else {
1643
- erroDesc = error;
1644
- }
1645
- execStatus.error = erroDesc;
1646
- execStatus.status = 'FAILURE';
1647
- fncCallBack(execStatus);
1648
- clearInterval(intervalID);
1649
- this.jobExecutionSubscription$ = null;
1650
- }
1651
- addZero(num) {
1652
- let str = `${num}`;
1653
- if (num < 10) {
1654
- str = `0${num}`;
1655
- }
1656
- return str;
1657
- }
1658
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TotvsScheduleExecutionService, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
1659
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TotvsScheduleExecutionService }); }
1660
- }
1661
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TotvsScheduleExecutionService, decorators: [{
1662
- type: Injectable
1663
- }], ctorParameters: function () { return [{ type: i1.HttpClient }]; } });
1488
+ class TotvsScheduleExecutionService {
1489
+ constructor(http) {
1490
+ this.http = http;
1491
+ this.headers = { headers: { 'X-PO-Screen-Lock': 'true' } };
1492
+ this.urlCadServidor = '/dts/datasul-rest/resources/prg/btb/v1/servidoresExecucao';
1493
+ this.urlJobScheduler = '/dts/datasul-rest/resources/prg/framework/v1/jobScheduler';
1494
+ this.urlJobExecution = '/dts/datasul-rest/resources/prg/framework/v1/jobExecution';
1495
+ }
1496
+ getFilteredItems(params) {
1497
+ const urlParams = new Array();
1498
+ urlParams.push(`pageSize=${params.pageSize.toString()}`);
1499
+ urlParams.push(`page=${params.page.toString()}`);
1500
+ if (params.filter && params.filter.length > 0) {
1501
+ urlParams.push(`quickSearch=${params.filter}`);
1502
+ }
1503
+ return this.http.get(`${this.urlCadServidor}?${urlParams.join('&')}`);
1504
+ }
1505
+ getObjectByValue(id) {
1506
+ return this.http.get(`${this.urlCadServidor}/${id}`, this.headers);
1507
+ }
1508
+ createExecution(parameters, loading) {
1509
+ const params = JSON.parse(JSON.stringify(parameters).replace(/\\\\/g, '*|'));
1510
+ if (loading) {
1511
+ return this.http.post(`${this.urlJobScheduler}`, params, this.headers);
1512
+ }
1513
+ else {
1514
+ return this.http.post(`${this.urlJobScheduler}`, params);
1515
+ }
1516
+ }
1517
+ createExecutionForNow(executionParams, loading) {
1518
+ let jobScheduleParams;
1519
+ const date = new Date();
1520
+ const params = JSON.parse(JSON.stringify(executionParams).replace(/\\\\/g, '*|'));
1521
+ if (!params.programEMS5) {
1522
+ params.programEMS5 = false;
1523
+ }
1524
+ if (!params.programStyle) {
1525
+ params.programStyle = 0;
1526
+ }
1527
+ if (!params.programVersion) {
1528
+ params.programVersion = '';
1529
+ }
1530
+ if (!params.businessParams || params.businessParams.length === 0) {
1531
+ params.businessParams = [{ chave: '', valor: '' }];
1532
+ }
1533
+ jobScheduleParams = {};
1534
+ jobScheduleParams.status = 'active';
1535
+ jobScheduleParams.processID = params.programName;
1536
+ jobScheduleParams.firstExecution = `${date.getFullYear()}-${(date.getMonth() + 1)}-${date.getDate()}T${this.addZero(date.getHours())}:${this.addZero(date.getMinutes())}:00.000Z`;
1537
+ jobScheduleParams.recurrent = false;
1538
+ jobScheduleParams.executionParameter = {
1539
+ parametros: [
1540
+ { chave: 'rpwServer', valor: params.executionServer },
1541
+ { chave: 'RPW_PROGRAM', valor: params.externalName },
1542
+ { chave: 'RPW_PRG_EMS5', valor: params.programEMS5 ? 'yes' : 'no' },
1543
+ { chave: 'RPW_PRG_ESTILO', valor: params.programStyle },
1544
+ { chave: 'RPW_PRG_VERS', valor: params.programVersion },
1545
+ { parametros_negocio: params.businessParams }
1546
+ ]
1547
+ };
1548
+ if (params.paramDigitDef && params.paramDigitDef.length > 0) {
1549
+ jobScheduleParams.executionParameter.parametros.push({
1550
+ param_digita_def: params.paramDigitDef
1551
+ });
1552
+ }
1553
+ if (params.paramDigitData && params.paramDigitData.length > 0) {
1554
+ jobScheduleParams.executionParameter.parametros.push({
1555
+ param_digita_dados: params.paramDigitData
1556
+ });
1557
+ }
1558
+ if (params.paramSelections && params.paramSelections.length > 0) {
1559
+ jobScheduleParams.executionParameter.parametros.push({
1560
+ selecoes: params.paramSelections
1561
+ });
1562
+ }
1563
+ if (loading) {
1564
+ return this.http.post(`${this.urlJobScheduler}`, jobScheduleParams, this.headers);
1565
+ }
1566
+ else {
1567
+ return this.http.post(`${this.urlJobScheduler}`, jobScheduleParams);
1568
+ }
1569
+ }
1570
+ getExecutionByJobScheduleID(jobScheduleID, loading = false) {
1571
+ const url = `${this.urlJobExecution}?jobScheduleID=${jobScheduleID}`;
1572
+ return this.getExecution(url, loading).pipe(map((response) => this.transformExecution('jobScheduleID', response)));
1573
+ }
1574
+ getExecutionByExecutionID(executionID, loading = false) {
1575
+ const url = `${this.urlJobExecution}/${executionID}`;
1576
+ return this.getExecution(url, loading).pipe(map((response) => this.transformExecution('executionID', response)));
1577
+ }
1578
+ getExecution(url, loading) {
1579
+ if (loading) {
1580
+ return this.http.get(url, this.headers);
1581
+ }
1582
+ else {
1583
+ return this.http.get(url);
1584
+ }
1585
+ }
1586
+ transformExecution(type, response) {
1587
+ if (!response || !response.items || response.items.length === 0) {
1588
+ return;
1589
+ }
1590
+ response = response.items[0];
1591
+ const execStatus = new ExecutionStatus();
1592
+ execStatus.jobScheduleID = response.jobScheduleID;
1593
+ execStatus.executionID = response.executionID;
1594
+ execStatus.startedDate = response.startedDate;
1595
+ execStatus.error = response.error;
1596
+ execStatus.status = response.status;
1597
+ return execStatus;
1598
+ }
1599
+ followUpExcByJobScheduleID(jobScheduleID, intervalNum, fncCallBack, loading = false) {
1600
+ this.followUpExecution('jobScheduleID', jobScheduleID, intervalNum, fncCallBack, loading);
1601
+ }
1602
+ followUpExcByExecutionID(executionID, intervalNum, fncCallBack, loading = false) {
1603
+ this.followUpExecution('executionID', executionID, intervalNum, fncCallBack, loading);
1604
+ }
1605
+ followUpExecution(type, execID, intervalNum, fncCallBack, loading) {
1606
+ this.jobExecutionSubscription$ = null;
1607
+ const intervalID = setInterval(() => {
1608
+ const execStatus = new ExecutionStatus();
1609
+ execStatus.jobScheduleID = (type === 'jobScheduleID') ? execID : '';
1610
+ execStatus.executionID = (type === 'executionID') ? execID : '';
1611
+ execStatus.startedDate = null;
1612
+ execStatus.error = '';
1613
+ execStatus.status = 'PENDING'; // PENDING, RUNNING, SUCCESS, FAILURE
1614
+ if (this.jobExecutionSubscription$) {
1615
+ return;
1616
+ }
1617
+ if (type === 'jobScheduleID') {
1618
+ this.jobExecutionSubscription$ = this.getExecutionByJobScheduleID(execID, loading)
1619
+ .subscribe((response) => {
1620
+ this.followUpExecReturnOk(execID, execStatus, response, intervalID, fncCallBack);
1621
+ }, (error) => {
1622
+ this.followUpExecReturnError(error, execStatus, intervalID, fncCallBack);
1623
+ });
1624
+ }
1625
+ if (type === 'executionID') {
1626
+ this.jobExecutionSubscription$ = this.getExecutionByExecutionID(execID, loading)
1627
+ .subscribe((response) => {
1628
+ this.followUpExecReturnOk(execID, execStatus, response, intervalID, fncCallBack);
1629
+ }, (error) => {
1630
+ this.followUpExecReturnError(error, execStatus, intervalID, fncCallBack);
1631
+ });
1632
+ }
1633
+ }, intervalNum);
1634
+ }
1635
+ followUpExecReturnOk(execID, execStatus, response, intervalID, fncCallBack) {
1636
+ if (response) {
1637
+ execStatus = response;
1638
+ }
1639
+ else {
1640
+ execStatus.error = `Agendamento não encontrado com ID: ${execID}`;
1641
+ execStatus.status = 'FAILURE';
1642
+ }
1643
+ if (!fncCallBack(execStatus) ||
1644
+ execStatus.status === 'SUCCESS' ||
1645
+ execStatus.status === 'FAILURE') {
1646
+ clearInterval(intervalID);
1647
+ }
1648
+ this.jobExecutionSubscription$ = null;
1649
+ }
1650
+ followUpExecReturnError(error, execStatus, intervalID, fncCallBack) {
1651
+ let erroDesc = '';
1652
+ if (error instanceof HttpErrorResponse) {
1653
+ erroDesc = error.message;
1654
+ if (error.error) {
1655
+ erroDesc = '';
1656
+ if (error.error.code) {
1657
+ erroDesc = error.error.code;
1658
+ }
1659
+ if (error.error.message) {
1660
+ erroDesc = `${erroDesc} - ${error.error.message}`;
1661
+ }
1662
+ if (error.error.detailedMessage) {
1663
+ erroDesc = `${erroDesc} - ${error.error.detailedMessage}`;
1664
+ }
1665
+ }
1666
+ }
1667
+ else {
1668
+ erroDesc = error;
1669
+ }
1670
+ execStatus.error = erroDesc;
1671
+ execStatus.status = 'FAILURE';
1672
+ fncCallBack(execStatus);
1673
+ clearInterval(intervalID);
1674
+ this.jobExecutionSubscription$ = null;
1675
+ }
1676
+ addZero(num) {
1677
+ let str = `${num}`;
1678
+ if (num < 10) {
1679
+ str = `0${num}`;
1680
+ }
1681
+ return str;
1682
+ }
1683
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: TotvsScheduleExecutionService, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
1684
+ /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: TotvsScheduleExecutionService }); }
1685
+ }
1686
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: TotvsScheduleExecutionService, decorators: [{
1687
+ type: Injectable
1688
+ }], ctorParameters: () => [{ type: i1.HttpClient }] });
1664
1689
 
1665
- class TotvsScheduleExecutionComponent {
1666
- constructor(poI18nService, rpwService, poNotification) {
1667
- this.poI18nService = poI18nService;
1668
- this.rpwService = rpwService;
1669
- this.poNotification = poNotification;
1670
- this.programEMS5 = false;
1671
- this.programVersion = '';
1672
- this.disabledParams = false;
1673
- this.loading = false;
1674
- this.endExecution = new EventEmitter();
1675
- this.jsonObject = {};
1676
- this.literals = {};
1677
- }
1678
- ngOnInit() {
1679
- /* VERIFICAR COMO FICARÁ A TRADUÇÃO
1680
- forkJoin(
1681
- this.poI18nService.getLiterals(),
1682
- this.poI18nService.getLiterals({ context: 'generalRpw' })
1683
- ).subscribe(literals => {
1684
- literals.map(item => Object.assign(this.literals, item) );
1685
- this.setupComponents();
1686
- });*/
1687
- this.setupComponents();
1688
- }
1689
- setupComponents() {
1690
- this.executionTypeOptions = [
1691
- { label: 'Executar Hoje', value: 1 },
1692
- { label: 'Agendar Execução', value: 2 }
1693
- ];
1694
- this.frequencyOptions = [
1695
- { label: 'Uma vez no dia', value: 'no' },
1696
- { label: 'Várias vezes no dia', value: 'yes' }
1697
- ];
1698
- this.frequencyTypeOptions = [
1699
- { label: 'Hora(s)', value: 'hour' },
1700
- { label: 'Minuto(s)', value: 'minute' }
1701
- ];
1702
- this.weeklyOptions = [
1703
- { label: 'Domingo', value: 'Sunday' },
1704
- { label: 'Segunda', value: 'Monday' },
1705
- { label: 'Terça', value: 'Tuesday' },
1706
- { label: 'Quarta', value: 'Wednesday' },
1707
- { label: 'Quinta', value: 'Thursday' },
1708
- { label: 'Sexta', value: 'Friday' },
1709
- { label: 'Sábado', value: 'Saturday' }
1710
- ];
1711
- this.zoomRpwServiceColumns = [
1712
- { property: 'code', label: 'Servidor', type: 'string', width: '20%' },
1713
- { property: 'name', label: 'Descrição', type: 'string', width: '80%' }
1714
- ];
1715
- this.model = new ScheduleParameters();
1716
- this.model.executionType = 1;
1717
- this.model.repeatType = 1;
1718
- this.model.repeatExecution = false;
1719
- }
1720
- setScheduleParameters(schParam) {
1721
- if (!schParam) {
1722
- return;
1723
- }
1724
- this.model = schParam;
1725
- }
1726
- getScheduleParameters() {
1727
- return this.model;
1728
- }
1729
- fieldRpwServiceFormat(value) {
1730
- return `${value.code} - ${value.name}`;
1731
- }
1732
- isExecutionSchedule() {
1733
- return (this.model.executionType === 2);
1734
- }
1735
- isRepeatExecution() {
1736
- return this.model.repeatExecution;
1737
- }
1738
- isFrenquency() {
1739
- return (this.model.frequency === 'yes');
1740
- }
1741
- changeRepeatExecution() {
1742
- const date = new Date();
1743
- if (!this.model.execAppointHourInit) {
1744
- this.model.execAppointHourInit = `${this.addZero(date.getHours())}:${this.addZero(date.getMinutes())}`;
1745
- }
1746
- if (!this.model.execAppointHourFinal) {
1747
- this.model.execAppointHourFinal = `${this.addZero(date.getHours())}:${this.addZero(date.getMinutes())}`;
1748
- }
1749
- this.model.selectWeeklys = [];
1750
- this.model.dayOfMonth = 0;
1751
- this.model.frequency = 'no';
1752
- this.model.frequencyType = 'hour';
1753
- this.model.frequencyValue = 0;
1754
- }
1755
- changeExecutionType() {
1756
- const date = new Date();
1757
- this.model.execAppointDate = date;
1758
- this.model.execAppointHour = `${this.addZero(date.getHours())}:${this.addZero(date.getMinutes())}`;
1759
- }
1760
- changeTypeFrequency() {
1761
- }
1762
- getActiveTab(codTab) {
1763
- return (this.model.repeatType === codTab);
1764
- }
1765
- setActiveTab(codTab) {
1766
- this.model.repeatType = codTab;
1767
- }
1768
- addZero(num) {
1769
- let str = `${num}`;
1770
- if (num < 10) {
1771
- str = `0${num}`;
1772
- }
1773
- return str;
1774
- }
1775
- executeSchedule() {
1776
- if (this.disabledParams) {
1777
- return;
1778
- }
1779
- if (!this.validate()) {
1780
- return;
1781
- }
1782
- this.jsonObject = {};
1783
- this.jsonObject.status = 'active';
1784
- this.jsonObject.processID = this.programName;
1785
- this.jsonObject.recurrent = this.model.repeatExecution;
1786
- this.jsonObject.executionParameter = {};
1787
- if (this.model.executionType === 1) {
1788
- const date = new Date();
1789
- this.jsonObject.firstExecution = `${date.getFullYear()}-${(date.getMonth() + 1)}-${date.getDate()}T${this.addZero(date.getHours())}:${this.addZero(date.getMinutes())}:00.000Z`;
1790
- }
1791
- if (this.model.executionType === 2) {
1792
- this.jsonObject.firstExecution = `${this.model.execAppointDate}T${this.model.execAppointHour}:00.000Z`;
1793
- }
1794
- this.jsonObject.executionParameter.parametros = [];
1795
- this.jsonObject.executionParameter.parametros[0] = { chave: 'rpwServer', valor: this.model.executionServer };
1796
- this.jsonObject.executionParameter.parametros[1] = { chave: 'RPW_PROGRAM', valor: this.externalName };
1797
- this.jsonObject.executionParameter.parametros[2] = { chave: 'RPW_PRG_EMS5', valor: this.programEMS5 ? 'yes' : 'no' };
1798
- this.jsonObject.executionParameter.parametros[3] = { chave: 'RPW_PRG_VERS', valor: this.programVersion };
1799
- this.jsonObject.executionParameter.parametros[4] = {};
1800
- this.jsonObject.executionParameter.parametros[4].parametros_negocio = this.parameters;
1801
- // Executa hoje ou agendada
1802
- this.rpwService.createExecution(this.jsonObject, this.loading).subscribe(() => {
1803
- this.poNotification.success('Agendamento realizado com sucesso !');
1804
- });
1805
- if (this.model.repeatExecution) {
1806
- if (this.model.repeatType === 1) {
1807
- this.jsonObject.daily = {
1808
- hour: this.getHourOrMinute(this.model.execAppointHourInit, 'h'),
1809
- minute: this.getHourOrMinute(this.model.execAppointHourInit, 'm')
1810
- };
1811
- }
1812
- if (this.model.repeatType === 2) {
1813
- this.jsonObject.weekly = {
1814
- hour: this.getHourOrMinute(this.model.execAppointHourInit, 'h'),
1815
- minute: this.getHourOrMinute(this.model.execAppointHourInit, 'm'),
1816
- daysOfWeek: this.model.selectWeeklys
1817
- };
1818
- }
1819
- if (this.model.repeatType === 3) {
1820
- this.jsonObject.monthly = {
1821
- hour: this.getHourOrMinute(this.model.execAppointHourInit, 'h'),
1822
- minute: this.getHourOrMinute(this.model.execAppointHourInit, 'm'),
1823
- day: this.model.dayOfMonth
1824
- };
1825
- }
1826
- if (this.isFrenquency()) {
1827
- this.jsonObject.rangeExecutions = {
1828
- frequency: {
1829
- type: this.model.frequencyType,
1830
- value: this.model.frequencyValue
1831
- },
1832
- rangeLimit: {
1833
- hour: this.getHourOrMinute(this.model.execAppointHourFinal, 'h'),
1834
- minute: this.getHourOrMinute(this.model.execAppointHourFinal, 'm')
1835
- }
1836
- };
1837
- }
1838
- // Executa a diária, semanal ou mensal
1839
- this.rpwService.createExecution(this.jsonObject, this.loading).subscribe(() => {
1840
- });
1841
- }
1842
- this.endExecution.emit(this.model);
1843
- }
1844
- getHourOrMinute(value, type) {
1845
- if (type === 'h') {
1846
- return +value.substring(0, 2);
1847
- }
1848
- if (type === 'm') {
1849
- return +value.substring(3, 6);
1850
- }
1851
- }
1852
- compareHour(hourInit, hourFinal) {
1853
- if (hourInit === hourFinal) {
1854
- return false;
1855
- }
1856
- if (this.getHourOrMinute(hourInit, 'h') < this.getHourOrMinute(hourFinal, 'h')) {
1857
- return true;
1858
- }
1859
- if (this.getHourOrMinute(hourInit, 'm') > this.getHourOrMinute(hourFinal, 'm')) {
1860
- return false;
1861
- }
1862
- return true;
1863
- }
1864
- validate() {
1865
- if (!this.scheduleExecutionForm.valid) {
1866
- this.poNotification.error('Verifique as inconsistências em tela.');
1867
- return false;
1868
- }
1869
- if (!this.model.executionServer) {
1870
- this.poNotification.error('Servidor de Execução não foi informado.');
1871
- return false;
1872
- }
1873
- if (this.isExecutionSchedule() && (!this.model.execAppointDate || !this.model.execAppointHour)) {
1874
- this.poNotification.error('Informar a data e a hora para agendamento da execução.');
1875
- return false;
1876
- }
1877
- if (this.model.repeatExecution) {
1878
- if (!this.model.execAppointHourInit) {
1879
- this.poNotification.error('Informar a hora de início para a execução.');
1880
- return false;
1881
- }
1882
- if (this.model.repeatType === 2 && (this.model.selectWeeklys.length === 0)) {
1883
- this.poNotification.error('Informar os dias da semana para a execução.');
1884
- return false;
1885
- }
1886
- if (this.model.repeatType === 3 && (!this.model.dayOfMonth)) {
1887
- this.poNotification.error('Informar o dia para a execução.');
1888
- return false;
1889
- }
1890
- if (this.isFrenquency()) {
1891
- if (!this.compareHour(this.model.execAppointHourInit, this.model.execAppointHourFinal)) {
1892
- this.poNotification.error('Hora Fim deve ser maior que Hora Início.');
1893
- return false;
1894
- }
1895
- if (this.model.frequencyValue === 0) {
1896
- this.poNotification.error('Informar a frequência de execução (A cada hora/minuto).');
1897
- return false;
1898
- }
1899
- }
1900
- }
1901
- return true;
1902
- }
1903
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TotvsScheduleExecutionComponent, deps: [{ token: i1$1.PoI18nService }, { token: TotvsScheduleExecutionService }, { token: i1$1.PoNotificationService }], target: i0.ɵɵFactoryTarget.Component }); }
1904
- /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: TotvsScheduleExecutionComponent, selector: "app-totvs-schedule-execution", inputs: { programName: "programName", externalName: "externalName", programEMS5: "programEMS5", programVersion: "programVersion", parameters: "parameters", disabledParams: "disabledParams", loading: "loading" }, outputs: { endExecution: "endExecution" }, viewQueries: [{ propertyName: "scheduleExecutionForm", first: true, predicate: ["scheduleExecutionForm"], descendants: true, static: true }], ngImport: i0, template: "<form #scheduleExecutionForm=\"ngForm\">\r\n <div class=\"po-row po-sm-12 po-md-12 po-lg-12 po-xl-12\">\r\n <po-radio-group \r\n class=\"po-sm-12 po-md-12 po-lg-12 po-xl-12\"\r\n name=\"executionType\"\r\n p-label=\"Data de Execu\u00E7\u00E3o\"\r\n [p-disabled]=\"disabledParams\"\r\n [(ngModel)]=\"model.executionType\"\r\n [p-options]=\"executionTypeOptions\"\r\n (p-change)=\"changeExecutionType()\">\r\n </po-radio-group>\r\n\r\n <po-datepicker *ngIf=isExecutionSchedule()\r\n class=\"po-sm-6 po-md-6 po-lg-6 po-xl-6\"\r\n name=\"model.execAppointDate\"\r\n p-label=\"Agendar para\"\r\n [p-disabled]=\"disabledParams\"\r\n [(ngModel)]=\"model.execAppointDate\">\r\n </po-datepicker>\r\n\r\n <po-input *ngIf=isExecutionSchedule()\r\n class=\"po-sm-6 po-md-6 po-lg-6 po-xl-6\"\r\n name=\"execAppointHour\"\r\n p-label=\"Hora\"\r\n p-mask=\"99:99\"\r\n p-mask-format-model=\"true\"\r\n p-pattern=\"^([0-9]|0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$\"\r\n p-error-pattern=\"Hora inv\u00E1lida\"\r\n [p-disabled]=\"disabledParams\"\r\n [(ngModel)]=\"model.execAppointHour\">\r\n </po-input>\r\n </div>\r\n\r\n <div class=\"po-row po-sm-12 po-md-12 po-lg-12 po-xl-12\">\r\n <po-lookup\r\n class=\"po-sm-12 po-md-12 po-lg-12 po-xl-12\"\r\n name=\"executionServer\"\r\n p-label=\"Servidor de Execu\u00E7\u00E3o\"\r\n p-placeholder=\"Servidor de Execu\u00E7\u00E3o\"\r\n [p-columns]=\"zoomRpwServiceColumns\"\r\n [p-field-format]=\"fieldRpwServiceFormat\"\r\n [p-filter-service]=\"rpwService\"\r\n p-field-label=\"name\"\r\n p-field-value=\"code\"\r\n [p-disabled]=\"disabledParams\"\r\n [(ngModel)]=\"model.executionServer\">\r\n </po-lookup>\r\n </div>\r\n\r\n <div class=\"po-row po-sm-12 po-md-12 po-lg-12 po-xl-12\">\r\n <po-switch\r\n class=\"po-sm-6 po-md-6 po-lg-6 po-xl-6\"\r\n name=\"repeatExecution\"\r\n p-label=\"Repetir ocorr\u00EAncia ?\"\r\n p-label-off=\"N\u00E3o\"\r\n p-label-on=\"Sim\"\r\n [(ngModel)]=\"model.repeatExecution\"\r\n [p-disabled]=\"disabledParams\"\r\n (click)=\"changeRepeatExecution()\">\r\n </po-switch>\r\n </div>\r\n\r\n <div class=\"po-row\" *ngIf=\"isRepeatExecution()\">\r\n \r\n <po-tabs>\r\n\r\n <po-tab \r\n p-label=\"Di\u00E1ria\" \r\n [p-active]=\"getActiveTab(1)\" \r\n (p-click)=\"setActiveTab(1)\">\r\n\r\n <div class=\"po-sm-6 po-md-6 po-lg-6 po-xl-6\">\r\n <po-radio-group \r\n class=\"po-sm-12 po-md-12 po-lg-12 po-xl-12\"\r\n name=\"frequencyDaily\"\r\n p-label=\"Frequ\u00EAncia\"\r\n p-columns=1\r\n [(ngModel)]=\"model.frequency\"\r\n [p-disabled]=\"disabledParams\"\r\n [p-options]=\"frequencyOptions\"\r\n (p-change)=\"changeTypeFrequency()\">\r\n </po-radio-group>\r\n </div>\r\n \r\n <div class=\"po-sm-6 po-md-6 po-lg-6 po-xl-6\"> \r\n <po-input\r\n class=\"po-sm-6 po-md-6 po-lg-6 po-xl-6\"\r\n name=\"execAppointHourInitDaily\"\r\n p-label=\"Hora In\u00EDcio\"\r\n p-mask=\"99:99\"\r\n p-mask-format-model=\"true\"\r\n p-pattern=\"^([0-9]|0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$\"\r\n p-error-pattern=\"Hora inv\u00E1lida\"\r\n [p-disabled]=\"disabledParams\"\r\n [(ngModel)]=\"model.execAppointHourInit\">\r\n </po-input>\r\n \r\n <po-input *ngIf=\"isFrenquency()\"\r\n class=\"po-sm-6 po-md-6 po-lg-6 po-xl-6\"\r\n name=\"execAppointHourFinalDaily\"\r\n p-label=\"Hora Fim\"\r\n p-mask=\"99:99\"\r\n p-mask-format-model=\"true\"\r\n p-pattern=\"^([0-9]|0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$\"\r\n p-error-pattern=\"Hora inv\u00E1lida\"\r\n [p-disabled]=\"disabledParams\"\r\n [(ngModel)]=\"model.execAppointHourFinal\">\r\n </po-input>\r\n \r\n <po-number *ngIf=\"isFrenquency()\"\r\n class=\"po-sm-5 po-md-5 po-lg-5 po-xl-5\"\r\n name=\"frequencyValueDaily\"\r\n p-label=\"A cada\"\r\n p-minlength=\"1\"\r\n p-maxlength=\"3\"\r\n p-min=\"0\"\r\n p-max=\"999\"\r\n [p-disabled]=\"disabledParams\"\r\n [(ngModel)]=\"model.frequencyValue\">\r\n </po-number>\r\n \r\n <po-select *ngIf=\"isFrenquency()\"\r\n class=\"po-mt-3 po-sm-7 po-md-7 po-lg-7 po-xl-7\"\r\n name=\"frequencyTypeDaily\"\r\n p-label=\"\"\r\n [p-options]=\"frequencyTypeOptions\"\r\n [p-disabled]=\"disabledParams\"\r\n [(ngModel)]=\"model.frequencyType\">\r\n </po-select>\r\n </div>\r\n </po-tab>\r\n\r\n <po-tab \r\n p-label=\"Semanal\"\r\n [p-active]=\"getActiveTab(2)\"\r\n (p-click)=\"setActiveTab(2)\">\r\n\r\n <div class=\"po-row po-sm-12 po-md-12 po-lg-12 po-xl-12\">\r\n <po-multiselect\r\n class=\"po-sm-12 po-md-12 po-lg-12 po-xl-12\"\r\n name=\"selectWeeklys\"\r\n p-label=\"Dias da Semana\"\r\n p-placeholder=\"Escolha os dias da semana\"\r\n [p-disabled]=\"disabledParams\"\r\n [(ngModel)]=\"model.selectWeeklys\"\r\n [p-options]=\"weeklyOptions\">\r\n </po-multiselect>\r\n </div>\r\n\r\n <div class=\"po-sm-6 po-md-6 po-lg-6 po-xl-6\">\r\n <po-radio-group \r\n class=\"po-sm-12 po-md-12 po-lg-12 po-xl-12\"\r\n name=\"frequencyWeekly\"\r\n p-label=\"Frequ\u00EAncia\"\r\n p-columns=1\r\n [(ngModel)]=\"model.frequency\"\r\n [p-disabled]=\"disabledParams\"\r\n [p-options]=\"frequencyOptions\"\r\n (p-change)=\"changeTypeFrequency()\">\r\n </po-radio-group>\r\n </div>\r\n\r\n <div class=\"po-sm-6 po-md-6 po-lg-6 po-xl-6\">\r\n <po-input\r\n class=\"po-sm-6 po-md-6 po-lg-6 po-xl-6\"\r\n name=\"execAppointHourInitWeekly\"\r\n p-label=\"Hora In\u00EDcio\"\r\n p-mask=\"99:99\"\r\n p-mask-format-model=\"true\"\r\n p-pattern=\"^([0-9]|0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$\"\r\n p-error-pattern=\"Hora inv\u00E1lida\"\r\n [p-disabled]=\"disabledParams\"\r\n [(ngModel)]=\"model.execAppointHourInit\">\r\n </po-input>\r\n\r\n <po-input *ngIf=\"isFrenquency()\"\r\n class=\"po-sm-6 po-md-6 po-lg-6 po-xl-6\"\r\n name=\"execAppointHourFinalWeekly\"\r\n p-label=\"Hora Fim\"\r\n p-mask=\"99:99\"\r\n p-mask-format-model=\"true\"\r\n p-pattern=\"^([0-9]|0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$\"\r\n p-error-pattern=\"Hora inv\u00E1lida\"\r\n [p-disabled]=\"disabledParams\"\r\n [(ngModel)]=\"model.execAppointHourFinal\">\r\n </po-input>\r\n\r\n <po-number *ngIf=\"isFrenquency()\"\r\n class=\"po-sm-5 po-md-5 po-lg-5 po-xl-5\"\r\n name=\"frequencyValueWeekly\"\r\n p-label=\"A cada\"\r\n p-minlength=\"1\"\r\n p-maxlength=\"3\"\r\n p-min=\"0\"\r\n p-max=\"999\"\r\n [p-disabled]=\"disabledParams\"\r\n [(ngModel)]=\"model.frequencyValue\">\r\n </po-number>\r\n\r\n <po-select *ngIf=\"isFrenquency()\"\r\n class=\"po-mt-3 po-sm-7 po-md-7 po-lg-7 po-xl-7\"\r\n name=\"frequencyTypeWeekly\"\r\n p-label=\"\"\r\n [p-options]=\"frequencyTypeOptions\"\r\n [p-disabled]=\"disabledParams\"\r\n [(ngModel)]=\"model.frequencyType\">\r\n </po-select>\r\n </div>\r\n </po-tab>\r\n\r\n <po-tab \r\n p-label=\"Mensal\" \r\n [p-active]=\"getActiveTab(3)\" \r\n (p-click)=\"setActiveTab(3)\">\r\n\r\n <div class=\"po-row po-sm-12 po-md-12 po-lg-12 po-xl-12\">\r\n <po-number\r\n class=\"po-sm-3 po-md-3 po-lg-3 po-xl-3\"\r\n name=\"dayOfMonth\"\r\n p-label=\"Dia do m\u00EAs\"\r\n p-minlength=\"1\"\r\n p-maxlength=\"2\"\r\n p-min=\"0\"\r\n p-max=\"31\"\r\n [p-disabled]=\"disabledParams\"\r\n [(ngModel)]=\"model.dayOfMonth\">\r\n </po-number>\r\n </div>\r\n\r\n <div class=\"po-row po-sm-6 po-md-6 po-lg-6 po-xl-6\">\r\n <po-radio-group \r\n class=\"po-sm-12 po-md-12 po-lg-12 po-xl-12\"\r\n name=\"frequencyMonthly\"\r\n p-label=\"Frequ\u00EAncia\"\r\n p-columns=1\r\n [(ngModel)]=\"model.frequency\"\r\n [p-disabled]=\"disabledParams\"\r\n [p-options]=\"frequencyOptions\"\r\n (p-change)=\"changeTypeFrequency()\">\r\n </po-radio-group>\r\n </div>\r\n\r\n <div class=\"po-row po-sm-6 po-md-6 po-lg-6 po-xl-6\">\r\n <po-input\r\n class=\"po-sm-6 po-md-6 po-lg-6 po-xl-6\"\r\n name=\"execAppointHourInitMonthly\"\r\n p-label=\"Hora In\u00EDcio\"\r\n p-mask=\"99:99\"\r\n p-mask-format-model=\"true\"\r\n p-pattern=\"^([0-9]|0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$\"\r\n p-error-pattern=\"Hora inv\u00E1lida\"\r\n [p-disabled]=\"disabledParams\"\r\n [(ngModel)]=\"model.execAppointHourInit\">\r\n </po-input>\r\n\r\n <po-input *ngIf=\"isFrenquency()\"\r\n class=\"po-sm-6 po-md-6 po-lg-6 po-xl-6\"\r\n name=\"execAppointHourFinalWeekly\"\r\n p-label=\"Hora Fim\"\r\n p-mask=\"99:99\"\r\n p-mask-format-model=\"true\"\r\n p-pattern=\"^([0-9]|0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$\"\r\n p-error-pattern=\"Hora inv\u00E1lida\"\r\n [p-disabled]=\"disabledParams\"\r\n [(ngModel)]=\"model.execAppointHourFinal\">\r\n </po-input>\r\n\r\n <po-number *ngIf=\"isFrenquency()\"\r\n class=\"po-sm-5 po-md-5 po-lg-5 po-xl-5\"\r\n name=\"frequencyValueWeekly\"\r\n p-label=\"A cada\"\r\n p-minlength=\"1\"\r\n p-maxlength=\"3\"\r\n p-min=\"0\"\r\n p-max=\"999\"\r\n [p-disabled]=\"disabledParams\"\r\n [(ngModel)]=\"model.frequencyValue\">\r\n </po-number>\r\n\r\n <po-select *ngIf=\"isFrenquency()\"\r\n class=\"po-mt-3 po-sm-7 po-md-7 po-lg-7 po-xl-7\"\r\n name=\"frequencyTypeWeekly\"\r\n p-label=\"\"\r\n [p-options]=\"frequencyTypeOptions\"\r\n [p-disabled]=\"disabledParams\"\r\n [(ngModel)]=\"model.frequencyType\">\r\n </po-select>\r\n </div>\r\n </po-tab>\r\n </po-tabs>\r\n </div>\r\n\r\n <div class=\"po-sm-12 po-md-12 po-lg-12 po-xl-12\" style=\"padding-top: 15px;\">\r\n <po-button\r\n style=\"float: right;\"\r\n p-label=\"Gerar Agendamento RPW\"\r\n [p-disabled]=\"disabledParams\"\r\n (click)=\"executeSchedule()\">\r\n </po-button>\r\n </div>\r\n</form>\r\n", styles: [""], dependencies: [{ kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i1$1.PoButtonComponent, selector: "po-button" }, { kind: "component", type: i1$1.PoRadioGroupComponent, selector: "po-radio-group", inputs: ["p-label", "p-help"] }, { kind: "component", type: i1$1.PoDatepickerComponent, selector: "po-datepicker", inputs: ["p-label", "p-help"] }, { kind: "component", type: i1$1.PoInputComponent, selector: "po-input" }, { kind: "component", type: i1$1.PoLookupComponent, selector: "po-lookup" }, { kind: "component", type: i1$1.PoMultiselectComponent, selector: "po-multiselect" }, { kind: "component", type: i1$1.PoNumberComponent, selector: "po-number", inputs: ["p-step", "p-min", "p-max"] }, { kind: "component", type: i1$1.PoSelectComponent, selector: "po-select", inputs: ["p-readonly", "p-placeholder", "p-options", "p-field-label", "p-field-value"], outputs: ["ngModelChange"] }, { kind: "component", type: i1$1.PoSwitchComponent, selector: "po-switch", inputs: ["p-value", "p-format-model", "p-label-position", "p-label-off", "p-label-on"] }, { kind: "component", type: i1$1.PoTabComponent, selector: "po-tab" }, { kind: "component", type: i1$1.PoTabsComponent, selector: "po-tabs" }, { kind: "directive", type: i4.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i4.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i4.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }] }); }
1905
- }
1906
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TotvsScheduleExecutionComponent, decorators: [{
1907
- type: Component,
1908
- args: [{ selector: 'app-totvs-schedule-execution', template: "<form #scheduleExecutionForm=\"ngForm\">\r\n <div class=\"po-row po-sm-12 po-md-12 po-lg-12 po-xl-12\">\r\n <po-radio-group \r\n class=\"po-sm-12 po-md-12 po-lg-12 po-xl-12\"\r\n name=\"executionType\"\r\n p-label=\"Data de Execu\u00E7\u00E3o\"\r\n [p-disabled]=\"disabledParams\"\r\n [(ngModel)]=\"model.executionType\"\r\n [p-options]=\"executionTypeOptions\"\r\n (p-change)=\"changeExecutionType()\">\r\n </po-radio-group>\r\n\r\n <po-datepicker *ngIf=isExecutionSchedule()\r\n class=\"po-sm-6 po-md-6 po-lg-6 po-xl-6\"\r\n name=\"model.execAppointDate\"\r\n p-label=\"Agendar para\"\r\n [p-disabled]=\"disabledParams\"\r\n [(ngModel)]=\"model.execAppointDate\">\r\n </po-datepicker>\r\n\r\n <po-input *ngIf=isExecutionSchedule()\r\n class=\"po-sm-6 po-md-6 po-lg-6 po-xl-6\"\r\n name=\"execAppointHour\"\r\n p-label=\"Hora\"\r\n p-mask=\"99:99\"\r\n p-mask-format-model=\"true\"\r\n p-pattern=\"^([0-9]|0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$\"\r\n p-error-pattern=\"Hora inv\u00E1lida\"\r\n [p-disabled]=\"disabledParams\"\r\n [(ngModel)]=\"model.execAppointHour\">\r\n </po-input>\r\n </div>\r\n\r\n <div class=\"po-row po-sm-12 po-md-12 po-lg-12 po-xl-12\">\r\n <po-lookup\r\n class=\"po-sm-12 po-md-12 po-lg-12 po-xl-12\"\r\n name=\"executionServer\"\r\n p-label=\"Servidor de Execu\u00E7\u00E3o\"\r\n p-placeholder=\"Servidor de Execu\u00E7\u00E3o\"\r\n [p-columns]=\"zoomRpwServiceColumns\"\r\n [p-field-format]=\"fieldRpwServiceFormat\"\r\n [p-filter-service]=\"rpwService\"\r\n p-field-label=\"name\"\r\n p-field-value=\"code\"\r\n [p-disabled]=\"disabledParams\"\r\n [(ngModel)]=\"model.executionServer\">\r\n </po-lookup>\r\n </div>\r\n\r\n <div class=\"po-row po-sm-12 po-md-12 po-lg-12 po-xl-12\">\r\n <po-switch\r\n class=\"po-sm-6 po-md-6 po-lg-6 po-xl-6\"\r\n name=\"repeatExecution\"\r\n p-label=\"Repetir ocorr\u00EAncia ?\"\r\n p-label-off=\"N\u00E3o\"\r\n p-label-on=\"Sim\"\r\n [(ngModel)]=\"model.repeatExecution\"\r\n [p-disabled]=\"disabledParams\"\r\n (click)=\"changeRepeatExecution()\">\r\n </po-switch>\r\n </div>\r\n\r\n <div class=\"po-row\" *ngIf=\"isRepeatExecution()\">\r\n \r\n <po-tabs>\r\n\r\n <po-tab \r\n p-label=\"Di\u00E1ria\" \r\n [p-active]=\"getActiveTab(1)\" \r\n (p-click)=\"setActiveTab(1)\">\r\n\r\n <div class=\"po-sm-6 po-md-6 po-lg-6 po-xl-6\">\r\n <po-radio-group \r\n class=\"po-sm-12 po-md-12 po-lg-12 po-xl-12\"\r\n name=\"frequencyDaily\"\r\n p-label=\"Frequ\u00EAncia\"\r\n p-columns=1\r\n [(ngModel)]=\"model.frequency\"\r\n [p-disabled]=\"disabledParams\"\r\n [p-options]=\"frequencyOptions\"\r\n (p-change)=\"changeTypeFrequency()\">\r\n </po-radio-group>\r\n </div>\r\n \r\n <div class=\"po-sm-6 po-md-6 po-lg-6 po-xl-6\"> \r\n <po-input\r\n class=\"po-sm-6 po-md-6 po-lg-6 po-xl-6\"\r\n name=\"execAppointHourInitDaily\"\r\n p-label=\"Hora In\u00EDcio\"\r\n p-mask=\"99:99\"\r\n p-mask-format-model=\"true\"\r\n p-pattern=\"^([0-9]|0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$\"\r\n p-error-pattern=\"Hora inv\u00E1lida\"\r\n [p-disabled]=\"disabledParams\"\r\n [(ngModel)]=\"model.execAppointHourInit\">\r\n </po-input>\r\n \r\n <po-input *ngIf=\"isFrenquency()\"\r\n class=\"po-sm-6 po-md-6 po-lg-6 po-xl-6\"\r\n name=\"execAppointHourFinalDaily\"\r\n p-label=\"Hora Fim\"\r\n p-mask=\"99:99\"\r\n p-mask-format-model=\"true\"\r\n p-pattern=\"^([0-9]|0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$\"\r\n p-error-pattern=\"Hora inv\u00E1lida\"\r\n [p-disabled]=\"disabledParams\"\r\n [(ngModel)]=\"model.execAppointHourFinal\">\r\n </po-input>\r\n \r\n <po-number *ngIf=\"isFrenquency()\"\r\n class=\"po-sm-5 po-md-5 po-lg-5 po-xl-5\"\r\n name=\"frequencyValueDaily\"\r\n p-label=\"A cada\"\r\n p-minlength=\"1\"\r\n p-maxlength=\"3\"\r\n p-min=\"0\"\r\n p-max=\"999\"\r\n [p-disabled]=\"disabledParams\"\r\n [(ngModel)]=\"model.frequencyValue\">\r\n </po-number>\r\n \r\n <po-select *ngIf=\"isFrenquency()\"\r\n class=\"po-mt-3 po-sm-7 po-md-7 po-lg-7 po-xl-7\"\r\n name=\"frequencyTypeDaily\"\r\n p-label=\"\"\r\n [p-options]=\"frequencyTypeOptions\"\r\n [p-disabled]=\"disabledParams\"\r\n [(ngModel)]=\"model.frequencyType\">\r\n </po-select>\r\n </div>\r\n </po-tab>\r\n\r\n <po-tab \r\n p-label=\"Semanal\"\r\n [p-active]=\"getActiveTab(2)\"\r\n (p-click)=\"setActiveTab(2)\">\r\n\r\n <div class=\"po-row po-sm-12 po-md-12 po-lg-12 po-xl-12\">\r\n <po-multiselect\r\n class=\"po-sm-12 po-md-12 po-lg-12 po-xl-12\"\r\n name=\"selectWeeklys\"\r\n p-label=\"Dias da Semana\"\r\n p-placeholder=\"Escolha os dias da semana\"\r\n [p-disabled]=\"disabledParams\"\r\n [(ngModel)]=\"model.selectWeeklys\"\r\n [p-options]=\"weeklyOptions\">\r\n </po-multiselect>\r\n </div>\r\n\r\n <div class=\"po-sm-6 po-md-6 po-lg-6 po-xl-6\">\r\n <po-radio-group \r\n class=\"po-sm-12 po-md-12 po-lg-12 po-xl-12\"\r\n name=\"frequencyWeekly\"\r\n p-label=\"Frequ\u00EAncia\"\r\n p-columns=1\r\n [(ngModel)]=\"model.frequency\"\r\n [p-disabled]=\"disabledParams\"\r\n [p-options]=\"frequencyOptions\"\r\n (p-change)=\"changeTypeFrequency()\">\r\n </po-radio-group>\r\n </div>\r\n\r\n <div class=\"po-sm-6 po-md-6 po-lg-6 po-xl-6\">\r\n <po-input\r\n class=\"po-sm-6 po-md-6 po-lg-6 po-xl-6\"\r\n name=\"execAppointHourInitWeekly\"\r\n p-label=\"Hora In\u00EDcio\"\r\n p-mask=\"99:99\"\r\n p-mask-format-model=\"true\"\r\n p-pattern=\"^([0-9]|0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$\"\r\n p-error-pattern=\"Hora inv\u00E1lida\"\r\n [p-disabled]=\"disabledParams\"\r\n [(ngModel)]=\"model.execAppointHourInit\">\r\n </po-input>\r\n\r\n <po-input *ngIf=\"isFrenquency()\"\r\n class=\"po-sm-6 po-md-6 po-lg-6 po-xl-6\"\r\n name=\"execAppointHourFinalWeekly\"\r\n p-label=\"Hora Fim\"\r\n p-mask=\"99:99\"\r\n p-mask-format-model=\"true\"\r\n p-pattern=\"^([0-9]|0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$\"\r\n p-error-pattern=\"Hora inv\u00E1lida\"\r\n [p-disabled]=\"disabledParams\"\r\n [(ngModel)]=\"model.execAppointHourFinal\">\r\n </po-input>\r\n\r\n <po-number *ngIf=\"isFrenquency()\"\r\n class=\"po-sm-5 po-md-5 po-lg-5 po-xl-5\"\r\n name=\"frequencyValueWeekly\"\r\n p-label=\"A cada\"\r\n p-minlength=\"1\"\r\n p-maxlength=\"3\"\r\n p-min=\"0\"\r\n p-max=\"999\"\r\n [p-disabled]=\"disabledParams\"\r\n [(ngModel)]=\"model.frequencyValue\">\r\n </po-number>\r\n\r\n <po-select *ngIf=\"isFrenquency()\"\r\n class=\"po-mt-3 po-sm-7 po-md-7 po-lg-7 po-xl-7\"\r\n name=\"frequencyTypeWeekly\"\r\n p-label=\"\"\r\n [p-options]=\"frequencyTypeOptions\"\r\n [p-disabled]=\"disabledParams\"\r\n [(ngModel)]=\"model.frequencyType\">\r\n </po-select>\r\n </div>\r\n </po-tab>\r\n\r\n <po-tab \r\n p-label=\"Mensal\" \r\n [p-active]=\"getActiveTab(3)\" \r\n (p-click)=\"setActiveTab(3)\">\r\n\r\n <div class=\"po-row po-sm-12 po-md-12 po-lg-12 po-xl-12\">\r\n <po-number\r\n class=\"po-sm-3 po-md-3 po-lg-3 po-xl-3\"\r\n name=\"dayOfMonth\"\r\n p-label=\"Dia do m\u00EAs\"\r\n p-minlength=\"1\"\r\n p-maxlength=\"2\"\r\n p-min=\"0\"\r\n p-max=\"31\"\r\n [p-disabled]=\"disabledParams\"\r\n [(ngModel)]=\"model.dayOfMonth\">\r\n </po-number>\r\n </div>\r\n\r\n <div class=\"po-row po-sm-6 po-md-6 po-lg-6 po-xl-6\">\r\n <po-radio-group \r\n class=\"po-sm-12 po-md-12 po-lg-12 po-xl-12\"\r\n name=\"frequencyMonthly\"\r\n p-label=\"Frequ\u00EAncia\"\r\n p-columns=1\r\n [(ngModel)]=\"model.frequency\"\r\n [p-disabled]=\"disabledParams\"\r\n [p-options]=\"frequencyOptions\"\r\n (p-change)=\"changeTypeFrequency()\">\r\n </po-radio-group>\r\n </div>\r\n\r\n <div class=\"po-row po-sm-6 po-md-6 po-lg-6 po-xl-6\">\r\n <po-input\r\n class=\"po-sm-6 po-md-6 po-lg-6 po-xl-6\"\r\n name=\"execAppointHourInitMonthly\"\r\n p-label=\"Hora In\u00EDcio\"\r\n p-mask=\"99:99\"\r\n p-mask-format-model=\"true\"\r\n p-pattern=\"^([0-9]|0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$\"\r\n p-error-pattern=\"Hora inv\u00E1lida\"\r\n [p-disabled]=\"disabledParams\"\r\n [(ngModel)]=\"model.execAppointHourInit\">\r\n </po-input>\r\n\r\n <po-input *ngIf=\"isFrenquency()\"\r\n class=\"po-sm-6 po-md-6 po-lg-6 po-xl-6\"\r\n name=\"execAppointHourFinalWeekly\"\r\n p-label=\"Hora Fim\"\r\n p-mask=\"99:99\"\r\n p-mask-format-model=\"true\"\r\n p-pattern=\"^([0-9]|0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$\"\r\n p-error-pattern=\"Hora inv\u00E1lida\"\r\n [p-disabled]=\"disabledParams\"\r\n [(ngModel)]=\"model.execAppointHourFinal\">\r\n </po-input>\r\n\r\n <po-number *ngIf=\"isFrenquency()\"\r\n class=\"po-sm-5 po-md-5 po-lg-5 po-xl-5\"\r\n name=\"frequencyValueWeekly\"\r\n p-label=\"A cada\"\r\n p-minlength=\"1\"\r\n p-maxlength=\"3\"\r\n p-min=\"0\"\r\n p-max=\"999\"\r\n [p-disabled]=\"disabledParams\"\r\n [(ngModel)]=\"model.frequencyValue\">\r\n </po-number>\r\n\r\n <po-select *ngIf=\"isFrenquency()\"\r\n class=\"po-mt-3 po-sm-7 po-md-7 po-lg-7 po-xl-7\"\r\n name=\"frequencyTypeWeekly\"\r\n p-label=\"\"\r\n [p-options]=\"frequencyTypeOptions\"\r\n [p-disabled]=\"disabledParams\"\r\n [(ngModel)]=\"model.frequencyType\">\r\n </po-select>\r\n </div>\r\n </po-tab>\r\n </po-tabs>\r\n </div>\r\n\r\n <div class=\"po-sm-12 po-md-12 po-lg-12 po-xl-12\" style=\"padding-top: 15px;\">\r\n <po-button\r\n style=\"float: right;\"\r\n p-label=\"Gerar Agendamento RPW\"\r\n [p-disabled]=\"disabledParams\"\r\n (click)=\"executeSchedule()\">\r\n </po-button>\r\n </div>\r\n</form>\r\n" }]
1909
- }], ctorParameters: function () { return [{ type: i1$1.PoI18nService }, { type: TotvsScheduleExecutionService }, { type: i1$1.PoNotificationService }]; }, propDecorators: { scheduleExecutionForm: [{
1910
- type: ViewChild,
1911
- args: ['scheduleExecutionForm', { static: true }]
1912
- }], programName: [{
1913
- type: Input
1914
- }], externalName: [{
1915
- type: Input
1916
- }], programEMS5: [{
1917
- type: Input
1918
- }], programVersion: [{
1919
- type: Input
1920
- }], parameters: [{
1921
- type: Input
1922
- }], disabledParams: [{
1923
- type: Input
1924
- }], loading: [{
1925
- type: Input
1926
- }], endExecution: [{
1927
- type: Output
1690
+ class TotvsScheduleExecutionComponent {
1691
+ constructor(poI18nService, rpwService, poNotification) {
1692
+ this.poI18nService = poI18nService;
1693
+ this.rpwService = rpwService;
1694
+ this.poNotification = poNotification;
1695
+ this.programEMS5 = false;
1696
+ this.programStyle = 0;
1697
+ this.programVersion = '';
1698
+ this.paramDigitDef = [];
1699
+ this.paramDigitData = [];
1700
+ this.paramSelections = [];
1701
+ this.disabledParams = false;
1702
+ this.loading = false;
1703
+ this.endExecution = new EventEmitter();
1704
+ this.jsonObject = {};
1705
+ this.literals = {};
1706
+ }
1707
+ ngOnInit() {
1708
+ /* VERIFICAR COMO FICARÁ A TRADUÇÃO
1709
+ forkJoin(
1710
+ this.poI18nService.getLiterals(),
1711
+ this.poI18nService.getLiterals({ context: 'generalRpw' })
1712
+ ).subscribe(literals => {
1713
+ literals.map(item => Object.assign(this.literals, item) );
1714
+ this.setupComponents();
1715
+ });*/
1716
+ this.setupComponents();
1717
+ }
1718
+ setupComponents() {
1719
+ this.executionTypeOptions = [
1720
+ { label: 'Executar Hoje', value: 1 },
1721
+ { label: 'Agendar Execução', value: 2 }
1722
+ ];
1723
+ this.frequencyOptions = [
1724
+ { label: 'Uma vez no dia', value: 'no' },
1725
+ { label: 'Várias vezes no dia', value: 'yes' }
1726
+ ];
1727
+ this.frequencyTypeOptions = [
1728
+ { label: 'Hora(s)', value: 'hour' },
1729
+ { label: 'Minuto(s)', value: 'minute' }
1730
+ ];
1731
+ this.weeklyOptions = [
1732
+ { label: 'Domingo', value: 'Sunday' },
1733
+ { label: 'Segunda', value: 'Monday' },
1734
+ { label: 'Terça', value: 'Tuesday' },
1735
+ { label: 'Quarta', value: 'Wednesday' },
1736
+ { label: 'Quinta', value: 'Thursday' },
1737
+ { label: 'Sexta', value: 'Friday' },
1738
+ { label: 'Sábado', value: 'Saturday' }
1739
+ ];
1740
+ this.zoomRpwServiceColumns = [
1741
+ { property: 'code', label: 'Servidor', type: 'string', width: '20%' },
1742
+ { property: 'name', label: 'Descrição', type: 'string', width: '80%' }
1743
+ ];
1744
+ this.model = new ScheduleParameters();
1745
+ this.model.executionType = 1;
1746
+ this.model.repeatType = 1;
1747
+ this.model.repeatExecution = false;
1748
+ }
1749
+ setScheduleParameters(schParam) {
1750
+ if (!schParam) {
1751
+ return;
1752
+ }
1753
+ this.model = schParam;
1754
+ }
1755
+ getScheduleParameters() {
1756
+ return this.model;
1757
+ }
1758
+ fieldRpwServiceFormat(value) {
1759
+ return `${value.code} - ${value.name}`;
1760
+ }
1761
+ isExecutionSchedule() {
1762
+ return (this.model.executionType === 2);
1763
+ }
1764
+ isRepeatExecution() {
1765
+ return this.model.repeatExecution;
1766
+ }
1767
+ isFrenquency() {
1768
+ return (this.model.frequency === 'yes');
1769
+ }
1770
+ changeRepeatExecution() {
1771
+ const date = new Date();
1772
+ if (!this.model.execAppointHourInit) {
1773
+ this.model.execAppointHourInit = `${this.addZero(date.getHours())}:${this.addZero(date.getMinutes())}`;
1774
+ }
1775
+ if (!this.model.execAppointHourFinal) {
1776
+ this.model.execAppointHourFinal = `${this.addZero(date.getHours())}:${this.addZero(date.getMinutes())}`;
1777
+ }
1778
+ this.model.selectWeeklys = [];
1779
+ this.model.dayOfMonth = 0;
1780
+ this.model.frequency = 'no';
1781
+ this.model.frequencyType = 'hour';
1782
+ this.model.frequencyValue = 0;
1783
+ }
1784
+ changeExecutionType() {
1785
+ const date = new Date();
1786
+ this.model.execAppointDate = date;
1787
+ this.model.execAppointHour = `${this.addZero(date.getHours())}:${this.addZero(date.getMinutes())}`;
1788
+ }
1789
+ changeTypeFrequency() {
1790
+ }
1791
+ getActiveTab(codTab) {
1792
+ return (this.model.repeatType === codTab);
1793
+ }
1794
+ setActiveTab(codTab) {
1795
+ this.model.repeatType = codTab;
1796
+ }
1797
+ addZero(num) {
1798
+ let str = `${num}`;
1799
+ if (num < 10) {
1800
+ str = `0${num}`;
1801
+ }
1802
+ return str;
1803
+ }
1804
+ executeSchedule() {
1805
+ if (this.disabledParams) {
1806
+ return;
1807
+ }
1808
+ if (!this.validate()) {
1809
+ return;
1810
+ }
1811
+ let idxParam;
1812
+ this.jsonObject = {};
1813
+ this.jsonObject.status = 'active';
1814
+ this.jsonObject.processID = this.programName;
1815
+ this.jsonObject.recurrent = this.model.repeatExecution;
1816
+ this.jsonObject.executionParameter = {};
1817
+ if (this.model.executionType === 1) {
1818
+ const date = new Date();
1819
+ this.jsonObject.firstExecution = `${date.getFullYear()}-${(date.getMonth() + 1)}-${date.getDate()}T${this.addZero(date.getHours())}:${this.addZero(date.getMinutes())}:00.000Z`;
1820
+ }
1821
+ if (this.model.executionType === 2) {
1822
+ this.jsonObject.firstExecution = `${this.model.execAppointDate}T${this.model.execAppointHour}:00.000Z`;
1823
+ }
1824
+ this.jsonObject.executionParameter.parametros = [];
1825
+ this.jsonObject.executionParameter.parametros[0] = { chave: 'rpwServer', valor: this.model.executionServer };
1826
+ this.jsonObject.executionParameter.parametros[1] = { chave: 'RPW_PROGRAM', valor: this.externalName };
1827
+ this.jsonObject.executionParameter.parametros[2] = { chave: 'RPW_PRG_EMS5', valor: this.programEMS5 ? 'yes' : 'no' };
1828
+ this.jsonObject.executionParameter.parametros[3] = { chave: 'RPW_PRG_ESTILO', valor: this.programStyle };
1829
+ this.jsonObject.executionParameter.parametros[4] = { chave: 'RPW_PRG_VERS', valor: this.programVersion };
1830
+ idxParam = 4;
1831
+ if (this.parameters && this.parameters.length > 0) {
1832
+ idxParam++;
1833
+ this.jsonObject.executionParameter.parametros[idxParam] = {};
1834
+ this.jsonObject.executionParameter.parametros[idxParam].parametros_negocio = this.parameters;
1835
+ }
1836
+ if (this.paramDigitDef && this.paramDigitDef.length > 0) {
1837
+ idxParam++;
1838
+ this.jsonObject.executionParameter.parametros[idxParam] = {};
1839
+ this.jsonObject.executionParameter.parametros[idxParam].param_digita_def = this.paramDigitDef;
1840
+ }
1841
+ if (this.paramDigitData && this.paramDigitData.length > 0) {
1842
+ idxParam++;
1843
+ this.jsonObject.executionParameter.parametros[idxParam] = {};
1844
+ this.jsonObject.executionParameter.parametros[idxParam].param_digita_dados = this.paramDigitData;
1845
+ }
1846
+ if (this.paramSelections && this.paramSelections.length > 0) {
1847
+ idxParam++;
1848
+ this.jsonObject.executionParameter.parametros[idxParam] = {};
1849
+ this.jsonObject.executionParameter.parametros[idxParam].selecoes = this.paramSelections;
1850
+ }
1851
+ // Executa hoje ou agendada
1852
+ this.rpwService.createExecution(this.jsonObject, this.loading).subscribe(() => {
1853
+ this.poNotification.success('Agendamento realizado com sucesso !');
1854
+ });
1855
+ if (this.model.repeatExecution) {
1856
+ if (this.model.repeatType === 1) {
1857
+ this.jsonObject.daily = {
1858
+ hour: this.getHourOrMinute(this.model.execAppointHourInit, 'h'),
1859
+ minute: this.getHourOrMinute(this.model.execAppointHourInit, 'm')
1860
+ };
1861
+ }
1862
+ if (this.model.repeatType === 2) {
1863
+ this.jsonObject.weekly = {
1864
+ hour: this.getHourOrMinute(this.model.execAppointHourInit, 'h'),
1865
+ minute: this.getHourOrMinute(this.model.execAppointHourInit, 'm'),
1866
+ daysOfWeek: this.model.selectWeeklys
1867
+ };
1868
+ }
1869
+ if (this.model.repeatType === 3) {
1870
+ this.jsonObject.monthly = {
1871
+ hour: this.getHourOrMinute(this.model.execAppointHourInit, 'h'),
1872
+ minute: this.getHourOrMinute(this.model.execAppointHourInit, 'm'),
1873
+ day: this.model.dayOfMonth
1874
+ };
1875
+ }
1876
+ if (this.isFrenquency()) {
1877
+ this.jsonObject.rangeExecutions = {
1878
+ frequency: {
1879
+ type: this.model.frequencyType,
1880
+ value: this.model.frequencyValue
1881
+ },
1882
+ rangeLimit: {
1883
+ hour: this.getHourOrMinute(this.model.execAppointHourFinal, 'h'),
1884
+ minute: this.getHourOrMinute(this.model.execAppointHourFinal, 'm')
1885
+ }
1886
+ };
1887
+ }
1888
+ // Executa a diária, semanal ou mensal
1889
+ this.rpwService.createExecution(this.jsonObject, this.loading).subscribe(() => {
1890
+ });
1891
+ }
1892
+ this.endExecution.emit(this.model);
1893
+ }
1894
+ getHourOrMinute(value, type) {
1895
+ if (type === 'h') {
1896
+ return +value.substring(0, 2);
1897
+ }
1898
+ if (type === 'm') {
1899
+ return +value.substring(3, 6);
1900
+ }
1901
+ }
1902
+ compareHour(hourInit, hourFinal) {
1903
+ if (hourInit === hourFinal) {
1904
+ return false;
1905
+ }
1906
+ if (this.getHourOrMinute(hourInit, 'h') < this.getHourOrMinute(hourFinal, 'h')) {
1907
+ return true;
1908
+ }
1909
+ if (this.getHourOrMinute(hourInit, 'm') > this.getHourOrMinute(hourFinal, 'm')) {
1910
+ return false;
1911
+ }
1912
+ return true;
1913
+ }
1914
+ validate() {
1915
+ if (!this.scheduleExecutionForm.valid) {
1916
+ this.poNotification.error('Verifique as inconsistências em tela.');
1917
+ return false;
1918
+ }
1919
+ if (!this.model.executionServer) {
1920
+ this.poNotification.error('Servidor de Execução não foi informado.');
1921
+ return false;
1922
+ }
1923
+ if (this.isExecutionSchedule() && (!this.model.execAppointDate || !this.model.execAppointHour)) {
1924
+ this.poNotification.error('Informar a data e a hora para agendamento da execução.');
1925
+ return false;
1926
+ }
1927
+ if (this.model.repeatExecution) {
1928
+ if (!this.model.execAppointHourInit) {
1929
+ this.poNotification.error('Informar a hora de início para a execução.');
1930
+ return false;
1931
+ }
1932
+ if (this.model.repeatType === 2 && (this.model.selectWeeklys.length === 0)) {
1933
+ this.poNotification.error('Informar os dias da semana para a execução.');
1934
+ return false;
1935
+ }
1936
+ if (this.model.repeatType === 3 && (!this.model.dayOfMonth)) {
1937
+ this.poNotification.error('Informar o dia para a execução.');
1938
+ return false;
1939
+ }
1940
+ if (this.isFrenquency()) {
1941
+ if (!this.compareHour(this.model.execAppointHourInit, this.model.execAppointHourFinal)) {
1942
+ this.poNotification.error('Hora Fim deve ser maior que Hora Início.');
1943
+ return false;
1944
+ }
1945
+ if (this.model.frequencyValue === 0) {
1946
+ this.poNotification.error('Informar a frequência de execução (A cada hora/minuto).');
1947
+ return false;
1948
+ }
1949
+ }
1950
+ }
1951
+ return true;
1952
+ }
1953
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: TotvsScheduleExecutionComponent, deps: [{ token: i1$1.PoI18nService }, { token: TotvsScheduleExecutionService }, { token: i1$1.PoNotificationService }], target: i0.ɵɵFactoryTarget.Component }); }
1954
+ /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.9", type: TotvsScheduleExecutionComponent, selector: "app-totvs-schedule-execution", inputs: { programName: "programName", externalName: "externalName", programEMS5: "programEMS5", programStyle: "programStyle", programVersion: "programVersion", parameters: "parameters", paramDigitDef: "paramDigitDef", paramDigitData: "paramDigitData", paramSelections: "paramSelections", disabledParams: "disabledParams", loading: "loading" }, outputs: { endExecution: "endExecution" }, viewQueries: [{ propertyName: "scheduleExecutionForm", first: true, predicate: ["scheduleExecutionForm"], descendants: true, static: true }], ngImport: i0, template: "<form #scheduleExecutionForm=\"ngForm\">\r\n <div class=\"po-row po-sm-12 po-md-12 po-lg-12 po-xl-12\">\r\n <po-radio-group \r\n class=\"po-sm-12 po-md-12 po-lg-12 po-xl-12\"\r\n name=\"executionType\"\r\n p-label=\"Data de Execu\u00E7\u00E3o\"\r\n [p-disabled]=\"disabledParams\"\r\n [(ngModel)]=\"model.executionType\"\r\n [p-options]=\"executionTypeOptions\"\r\n (p-change)=\"changeExecutionType()\">\r\n </po-radio-group>\r\n\r\n <po-datepicker *ngIf=isExecutionSchedule()\r\n class=\"po-sm-6 po-md-6 po-lg-6 po-xl-6\"\r\n name=\"model.execAppointDate\"\r\n p-label=\"Agendar para\"\r\n [p-disabled]=\"disabledParams\"\r\n [(ngModel)]=\"model.execAppointDate\">\r\n </po-datepicker>\r\n\r\n <po-input *ngIf=isExecutionSchedule()\r\n class=\"po-sm-6 po-md-6 po-lg-6 po-xl-6\"\r\n name=\"execAppointHour\"\r\n p-label=\"Hora\"\r\n p-mask=\"99:99\"\r\n p-mask-format-model=\"true\"\r\n p-pattern=\"^([0-9]|0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$\"\r\n p-error-pattern=\"Hora inv\u00E1lida\"\r\n [p-disabled]=\"disabledParams\"\r\n [(ngModel)]=\"model.execAppointHour\">\r\n </po-input>\r\n </div>\r\n\r\n <div class=\"po-row po-sm-12 po-md-12 po-lg-12 po-xl-12\">\r\n <po-lookup\r\n class=\"po-sm-12 po-md-12 po-lg-12 po-xl-12\"\r\n name=\"executionServer\"\r\n p-label=\"Servidor de Execu\u00E7\u00E3o\"\r\n p-placeholder=\"Servidor de Execu\u00E7\u00E3o\"\r\n [p-columns]=\"zoomRpwServiceColumns\"\r\n [p-field-format]=\"fieldRpwServiceFormat\"\r\n [p-filter-service]=\"rpwService\"\r\n p-field-label=\"name\"\r\n p-field-value=\"code\"\r\n [p-disabled]=\"disabledParams\"\r\n [(ngModel)]=\"model.executionServer\">\r\n </po-lookup>\r\n </div>\r\n\r\n <div class=\"po-row po-sm-12 po-md-12 po-lg-12 po-xl-12\">\r\n <po-switch\r\n class=\"po-sm-6 po-md-6 po-lg-6 po-xl-6\"\r\n name=\"repeatExecution\"\r\n p-label=\"Repetir ocorr\u00EAncia ?\"\r\n p-label-off=\"N\u00E3o\"\r\n p-label-on=\"Sim\"\r\n [(ngModel)]=\"model.repeatExecution\"\r\n [p-disabled]=\"disabledParams\"\r\n (click)=\"changeRepeatExecution()\">\r\n </po-switch>\r\n </div>\r\n\r\n <div class=\"po-row\" *ngIf=\"isRepeatExecution()\">\r\n \r\n <po-tabs>\r\n\r\n <po-tab \r\n p-label=\"Di\u00E1ria\" \r\n [p-active]=\"getActiveTab(1)\" \r\n (p-click)=\"setActiveTab(1)\">\r\n\r\n <div class=\"po-sm-6 po-md-6 po-lg-6 po-xl-6\">\r\n <po-radio-group \r\n class=\"po-sm-12 po-md-12 po-lg-12 po-xl-12\"\r\n name=\"frequencyDaily\"\r\n p-label=\"Frequ\u00EAncia\"\r\n p-columns=1\r\n [(ngModel)]=\"model.frequency\"\r\n [p-disabled]=\"disabledParams\"\r\n [p-options]=\"frequencyOptions\"\r\n (p-change)=\"changeTypeFrequency()\">\r\n </po-radio-group>\r\n </div>\r\n \r\n <div class=\"po-sm-6 po-md-6 po-lg-6 po-xl-6\"> \r\n <po-input\r\n class=\"po-sm-6 po-md-6 po-lg-6 po-xl-6\"\r\n name=\"execAppointHourInitDaily\"\r\n p-label=\"Hora In\u00EDcio\"\r\n p-mask=\"99:99\"\r\n p-mask-format-model=\"true\"\r\n p-pattern=\"^([0-9]|0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$\"\r\n p-error-pattern=\"Hora inv\u00E1lida\"\r\n [p-disabled]=\"disabledParams\"\r\n [(ngModel)]=\"model.execAppointHourInit\">\r\n </po-input>\r\n \r\n <po-input *ngIf=\"isFrenquency()\"\r\n class=\"po-sm-6 po-md-6 po-lg-6 po-xl-6\"\r\n name=\"execAppointHourFinalDaily\"\r\n p-label=\"Hora Fim\"\r\n p-mask=\"99:99\"\r\n p-mask-format-model=\"true\"\r\n p-pattern=\"^([0-9]|0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$\"\r\n p-error-pattern=\"Hora inv\u00E1lida\"\r\n [p-disabled]=\"disabledParams\"\r\n [(ngModel)]=\"model.execAppointHourFinal\">\r\n </po-input>\r\n \r\n <po-number *ngIf=\"isFrenquency()\"\r\n class=\"po-sm-5 po-md-5 po-lg-5 po-xl-5\"\r\n name=\"frequencyValueDaily\"\r\n p-label=\"A cada\"\r\n p-minlength=\"1\"\r\n p-maxlength=\"3\"\r\n p-min=\"0\"\r\n p-max=\"999\"\r\n [p-disabled]=\"disabledParams\"\r\n [(ngModel)]=\"model.frequencyValue\">\r\n </po-number>\r\n \r\n <po-select *ngIf=\"isFrenquency()\"\r\n class=\"po-mt-3 po-sm-7 po-md-7 po-lg-7 po-xl-7\"\r\n name=\"frequencyTypeDaily\"\r\n p-label=\"\"\r\n [p-options]=\"frequencyTypeOptions\"\r\n [p-disabled]=\"disabledParams\"\r\n [(ngModel)]=\"model.frequencyType\">\r\n </po-select>\r\n </div>\r\n </po-tab>\r\n\r\n <po-tab \r\n p-label=\"Semanal\"\r\n [p-active]=\"getActiveTab(2)\"\r\n (p-click)=\"setActiveTab(2)\">\r\n\r\n <div class=\"po-row po-sm-12 po-md-12 po-lg-12 po-xl-12\">\r\n <po-multiselect\r\n class=\"po-sm-12 po-md-12 po-lg-12 po-xl-12\"\r\n name=\"selectWeeklys\"\r\n p-label=\"Dias da Semana\"\r\n p-placeholder=\"Escolha os dias da semana\"\r\n [p-disabled]=\"disabledParams\"\r\n [(ngModel)]=\"model.selectWeeklys\"\r\n [p-options]=\"weeklyOptions\">\r\n </po-multiselect>\r\n </div>\r\n\r\n <div class=\"po-sm-6 po-md-6 po-lg-6 po-xl-6\">\r\n <po-radio-group \r\n class=\"po-sm-12 po-md-12 po-lg-12 po-xl-12\"\r\n name=\"frequencyWeekly\"\r\n p-label=\"Frequ\u00EAncia\"\r\n p-columns=1\r\n [(ngModel)]=\"model.frequency\"\r\n [p-disabled]=\"disabledParams\"\r\n [p-options]=\"frequencyOptions\"\r\n (p-change)=\"changeTypeFrequency()\">\r\n </po-radio-group>\r\n </div>\r\n\r\n <div class=\"po-sm-6 po-md-6 po-lg-6 po-xl-6\">\r\n <po-input\r\n class=\"po-sm-6 po-md-6 po-lg-6 po-xl-6\"\r\n name=\"execAppointHourInitWeekly\"\r\n p-label=\"Hora In\u00EDcio\"\r\n p-mask=\"99:99\"\r\n p-mask-format-model=\"true\"\r\n p-pattern=\"^([0-9]|0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$\"\r\n p-error-pattern=\"Hora inv\u00E1lida\"\r\n [p-disabled]=\"disabledParams\"\r\n [(ngModel)]=\"model.execAppointHourInit\">\r\n </po-input>\r\n\r\n <po-input *ngIf=\"isFrenquency()\"\r\n class=\"po-sm-6 po-md-6 po-lg-6 po-xl-6\"\r\n name=\"execAppointHourFinalWeekly\"\r\n p-label=\"Hora Fim\"\r\n p-mask=\"99:99\"\r\n p-mask-format-model=\"true\"\r\n p-pattern=\"^([0-9]|0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$\"\r\n p-error-pattern=\"Hora inv\u00E1lida\"\r\n [p-disabled]=\"disabledParams\"\r\n [(ngModel)]=\"model.execAppointHourFinal\">\r\n </po-input>\r\n\r\n <po-number *ngIf=\"isFrenquency()\"\r\n class=\"po-sm-5 po-md-5 po-lg-5 po-xl-5\"\r\n name=\"frequencyValueWeekly\"\r\n p-label=\"A cada\"\r\n p-minlength=\"1\"\r\n p-maxlength=\"3\"\r\n p-min=\"0\"\r\n p-max=\"999\"\r\n [p-disabled]=\"disabledParams\"\r\n [(ngModel)]=\"model.frequencyValue\">\r\n </po-number>\r\n\r\n <po-select *ngIf=\"isFrenquency()\"\r\n class=\"po-mt-3 po-sm-7 po-md-7 po-lg-7 po-xl-7\"\r\n name=\"frequencyTypeWeekly\"\r\n p-label=\"\"\r\n [p-options]=\"frequencyTypeOptions\"\r\n [p-disabled]=\"disabledParams\"\r\n [(ngModel)]=\"model.frequencyType\">\r\n </po-select>\r\n </div>\r\n </po-tab>\r\n\r\n <po-tab \r\n p-label=\"Mensal\" \r\n [p-active]=\"getActiveTab(3)\" \r\n (p-click)=\"setActiveTab(3)\">\r\n\r\n <div class=\"po-row po-sm-12 po-md-12 po-lg-12 po-xl-12\">\r\n <po-number\r\n class=\"po-sm-3 po-md-3 po-lg-3 po-xl-3\"\r\n name=\"dayOfMonth\"\r\n p-label=\"Dia do m\u00EAs\"\r\n p-minlength=\"1\"\r\n p-maxlength=\"2\"\r\n p-min=\"0\"\r\n p-max=\"31\"\r\n [p-disabled]=\"disabledParams\"\r\n [(ngModel)]=\"model.dayOfMonth\">\r\n </po-number>\r\n </div>\r\n\r\n <div class=\"po-row po-sm-6 po-md-6 po-lg-6 po-xl-6\">\r\n <po-radio-group \r\n class=\"po-sm-12 po-md-12 po-lg-12 po-xl-12\"\r\n name=\"frequencyMonthly\"\r\n p-label=\"Frequ\u00EAncia\"\r\n p-columns=1\r\n [(ngModel)]=\"model.frequency\"\r\n [p-disabled]=\"disabledParams\"\r\n [p-options]=\"frequencyOptions\"\r\n (p-change)=\"changeTypeFrequency()\">\r\n </po-radio-group>\r\n </div>\r\n\r\n <div class=\"po-row po-sm-6 po-md-6 po-lg-6 po-xl-6\">\r\n <po-input\r\n class=\"po-sm-6 po-md-6 po-lg-6 po-xl-6\"\r\n name=\"execAppointHourInitMonthly\"\r\n p-label=\"Hora In\u00EDcio\"\r\n p-mask=\"99:99\"\r\n p-mask-format-model=\"true\"\r\n p-pattern=\"^([0-9]|0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$\"\r\n p-error-pattern=\"Hora inv\u00E1lida\"\r\n [p-disabled]=\"disabledParams\"\r\n [(ngModel)]=\"model.execAppointHourInit\">\r\n </po-input>\r\n\r\n <po-input *ngIf=\"isFrenquency()\"\r\n class=\"po-sm-6 po-md-6 po-lg-6 po-xl-6\"\r\n name=\"execAppointHourFinalWeekly\"\r\n p-label=\"Hora Fim\"\r\n p-mask=\"99:99\"\r\n p-mask-format-model=\"true\"\r\n p-pattern=\"^([0-9]|0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$\"\r\n p-error-pattern=\"Hora inv\u00E1lida\"\r\n [p-disabled]=\"disabledParams\"\r\n [(ngModel)]=\"model.execAppointHourFinal\">\r\n </po-input>\r\n\r\n <po-number *ngIf=\"isFrenquency()\"\r\n class=\"po-sm-5 po-md-5 po-lg-5 po-xl-5\"\r\n name=\"frequencyValueWeekly\"\r\n p-label=\"A cada\"\r\n p-minlength=\"1\"\r\n p-maxlength=\"3\"\r\n p-min=\"0\"\r\n p-max=\"999\"\r\n [p-disabled]=\"disabledParams\"\r\n [(ngModel)]=\"model.frequencyValue\">\r\n </po-number>\r\n\r\n <po-select *ngIf=\"isFrenquency()\"\r\n class=\"po-mt-3 po-sm-7 po-md-7 po-lg-7 po-xl-7\"\r\n name=\"frequencyTypeWeekly\"\r\n p-label=\"\"\r\n [p-options]=\"frequencyTypeOptions\"\r\n [p-disabled]=\"disabledParams\"\r\n [(ngModel)]=\"model.frequencyType\">\r\n </po-select>\r\n </div>\r\n </po-tab>\r\n </po-tabs>\r\n </div>\r\n\r\n <div class=\"po-sm-12 po-md-12 po-lg-12 po-xl-12\" style=\"padding-top: 15px;\">\r\n <po-button\r\n style=\"float: right;\"\r\n p-label=\"Gerar Agendamento RPW\"\r\n [p-disabled]=\"disabledParams\"\r\n (click)=\"executeSchedule()\">\r\n </po-button>\r\n </div>\r\n</form>\r\n", styles: [""], dependencies: [{ kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i1$1.PoButtonComponent, selector: "po-button" }, { kind: "component", type: i1$1.PoRadioGroupComponent, selector: "po-radio-group", inputs: ["p-label", "p-help"] }, { kind: "component", type: i1$1.PoDatepickerComponent, selector: "po-datepicker", inputs: ["p-label", "p-help"] }, { kind: "component", type: i1$1.PoInputComponent, selector: "po-input" }, { kind: "component", type: i1$1.PoLookupComponent, selector: "po-lookup" }, { kind: "component", type: i1$1.PoMultiselectComponent, selector: "po-multiselect" }, { kind: "component", type: i1$1.PoNumberComponent, selector: "po-number", inputs: ["p-step", "p-min", "p-max"] }, { kind: "component", type: i1$1.PoSelectComponent, selector: "po-select", inputs: ["p-readonly", "p-placeholder", "p-options", "p-field-label", "p-field-value"], outputs: ["ngModelChange"] }, { kind: "component", type: i1$1.PoSwitchComponent, selector: "po-switch", inputs: ["p-value", "p-format-model", "p-label-position", "p-label-off", "p-label-on"] }, { kind: "component", type: i1$1.PoTabComponent, selector: "po-tab" }, { kind: "component", type: i1$1.PoTabsComponent, selector: "po-tabs" }, { kind: "directive", type: i4.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i4.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i4.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }] }); }
1955
+ }
1956
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: TotvsScheduleExecutionComponent, decorators: [{
1957
+ type: Component,
1958
+ args: [{ selector: 'app-totvs-schedule-execution', template: "<form #scheduleExecutionForm=\"ngForm\">\r\n <div class=\"po-row po-sm-12 po-md-12 po-lg-12 po-xl-12\">\r\n <po-radio-group \r\n class=\"po-sm-12 po-md-12 po-lg-12 po-xl-12\"\r\n name=\"executionType\"\r\n p-label=\"Data de Execu\u00E7\u00E3o\"\r\n [p-disabled]=\"disabledParams\"\r\n [(ngModel)]=\"model.executionType\"\r\n [p-options]=\"executionTypeOptions\"\r\n (p-change)=\"changeExecutionType()\">\r\n </po-radio-group>\r\n\r\n <po-datepicker *ngIf=isExecutionSchedule()\r\n class=\"po-sm-6 po-md-6 po-lg-6 po-xl-6\"\r\n name=\"model.execAppointDate\"\r\n p-label=\"Agendar para\"\r\n [p-disabled]=\"disabledParams\"\r\n [(ngModel)]=\"model.execAppointDate\">\r\n </po-datepicker>\r\n\r\n <po-input *ngIf=isExecutionSchedule()\r\n class=\"po-sm-6 po-md-6 po-lg-6 po-xl-6\"\r\n name=\"execAppointHour\"\r\n p-label=\"Hora\"\r\n p-mask=\"99:99\"\r\n p-mask-format-model=\"true\"\r\n p-pattern=\"^([0-9]|0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$\"\r\n p-error-pattern=\"Hora inv\u00E1lida\"\r\n [p-disabled]=\"disabledParams\"\r\n [(ngModel)]=\"model.execAppointHour\">\r\n </po-input>\r\n </div>\r\n\r\n <div class=\"po-row po-sm-12 po-md-12 po-lg-12 po-xl-12\">\r\n <po-lookup\r\n class=\"po-sm-12 po-md-12 po-lg-12 po-xl-12\"\r\n name=\"executionServer\"\r\n p-label=\"Servidor de Execu\u00E7\u00E3o\"\r\n p-placeholder=\"Servidor de Execu\u00E7\u00E3o\"\r\n [p-columns]=\"zoomRpwServiceColumns\"\r\n [p-field-format]=\"fieldRpwServiceFormat\"\r\n [p-filter-service]=\"rpwService\"\r\n p-field-label=\"name\"\r\n p-field-value=\"code\"\r\n [p-disabled]=\"disabledParams\"\r\n [(ngModel)]=\"model.executionServer\">\r\n </po-lookup>\r\n </div>\r\n\r\n <div class=\"po-row po-sm-12 po-md-12 po-lg-12 po-xl-12\">\r\n <po-switch\r\n class=\"po-sm-6 po-md-6 po-lg-6 po-xl-6\"\r\n name=\"repeatExecution\"\r\n p-label=\"Repetir ocorr\u00EAncia ?\"\r\n p-label-off=\"N\u00E3o\"\r\n p-label-on=\"Sim\"\r\n [(ngModel)]=\"model.repeatExecution\"\r\n [p-disabled]=\"disabledParams\"\r\n (click)=\"changeRepeatExecution()\">\r\n </po-switch>\r\n </div>\r\n\r\n <div class=\"po-row\" *ngIf=\"isRepeatExecution()\">\r\n \r\n <po-tabs>\r\n\r\n <po-tab \r\n p-label=\"Di\u00E1ria\" \r\n [p-active]=\"getActiveTab(1)\" \r\n (p-click)=\"setActiveTab(1)\">\r\n\r\n <div class=\"po-sm-6 po-md-6 po-lg-6 po-xl-6\">\r\n <po-radio-group \r\n class=\"po-sm-12 po-md-12 po-lg-12 po-xl-12\"\r\n name=\"frequencyDaily\"\r\n p-label=\"Frequ\u00EAncia\"\r\n p-columns=1\r\n [(ngModel)]=\"model.frequency\"\r\n [p-disabled]=\"disabledParams\"\r\n [p-options]=\"frequencyOptions\"\r\n (p-change)=\"changeTypeFrequency()\">\r\n </po-radio-group>\r\n </div>\r\n \r\n <div class=\"po-sm-6 po-md-6 po-lg-6 po-xl-6\"> \r\n <po-input\r\n class=\"po-sm-6 po-md-6 po-lg-6 po-xl-6\"\r\n name=\"execAppointHourInitDaily\"\r\n p-label=\"Hora In\u00EDcio\"\r\n p-mask=\"99:99\"\r\n p-mask-format-model=\"true\"\r\n p-pattern=\"^([0-9]|0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$\"\r\n p-error-pattern=\"Hora inv\u00E1lida\"\r\n [p-disabled]=\"disabledParams\"\r\n [(ngModel)]=\"model.execAppointHourInit\">\r\n </po-input>\r\n \r\n <po-input *ngIf=\"isFrenquency()\"\r\n class=\"po-sm-6 po-md-6 po-lg-6 po-xl-6\"\r\n name=\"execAppointHourFinalDaily\"\r\n p-label=\"Hora Fim\"\r\n p-mask=\"99:99\"\r\n p-mask-format-model=\"true\"\r\n p-pattern=\"^([0-9]|0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$\"\r\n p-error-pattern=\"Hora inv\u00E1lida\"\r\n [p-disabled]=\"disabledParams\"\r\n [(ngModel)]=\"model.execAppointHourFinal\">\r\n </po-input>\r\n \r\n <po-number *ngIf=\"isFrenquency()\"\r\n class=\"po-sm-5 po-md-5 po-lg-5 po-xl-5\"\r\n name=\"frequencyValueDaily\"\r\n p-label=\"A cada\"\r\n p-minlength=\"1\"\r\n p-maxlength=\"3\"\r\n p-min=\"0\"\r\n p-max=\"999\"\r\n [p-disabled]=\"disabledParams\"\r\n [(ngModel)]=\"model.frequencyValue\">\r\n </po-number>\r\n \r\n <po-select *ngIf=\"isFrenquency()\"\r\n class=\"po-mt-3 po-sm-7 po-md-7 po-lg-7 po-xl-7\"\r\n name=\"frequencyTypeDaily\"\r\n p-label=\"\"\r\n [p-options]=\"frequencyTypeOptions\"\r\n [p-disabled]=\"disabledParams\"\r\n [(ngModel)]=\"model.frequencyType\">\r\n </po-select>\r\n </div>\r\n </po-tab>\r\n\r\n <po-tab \r\n p-label=\"Semanal\"\r\n [p-active]=\"getActiveTab(2)\"\r\n (p-click)=\"setActiveTab(2)\">\r\n\r\n <div class=\"po-row po-sm-12 po-md-12 po-lg-12 po-xl-12\">\r\n <po-multiselect\r\n class=\"po-sm-12 po-md-12 po-lg-12 po-xl-12\"\r\n name=\"selectWeeklys\"\r\n p-label=\"Dias da Semana\"\r\n p-placeholder=\"Escolha os dias da semana\"\r\n [p-disabled]=\"disabledParams\"\r\n [(ngModel)]=\"model.selectWeeklys\"\r\n [p-options]=\"weeklyOptions\">\r\n </po-multiselect>\r\n </div>\r\n\r\n <div class=\"po-sm-6 po-md-6 po-lg-6 po-xl-6\">\r\n <po-radio-group \r\n class=\"po-sm-12 po-md-12 po-lg-12 po-xl-12\"\r\n name=\"frequencyWeekly\"\r\n p-label=\"Frequ\u00EAncia\"\r\n p-columns=1\r\n [(ngModel)]=\"model.frequency\"\r\n [p-disabled]=\"disabledParams\"\r\n [p-options]=\"frequencyOptions\"\r\n (p-change)=\"changeTypeFrequency()\">\r\n </po-radio-group>\r\n </div>\r\n\r\n <div class=\"po-sm-6 po-md-6 po-lg-6 po-xl-6\">\r\n <po-input\r\n class=\"po-sm-6 po-md-6 po-lg-6 po-xl-6\"\r\n name=\"execAppointHourInitWeekly\"\r\n p-label=\"Hora In\u00EDcio\"\r\n p-mask=\"99:99\"\r\n p-mask-format-model=\"true\"\r\n p-pattern=\"^([0-9]|0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$\"\r\n p-error-pattern=\"Hora inv\u00E1lida\"\r\n [p-disabled]=\"disabledParams\"\r\n [(ngModel)]=\"model.execAppointHourInit\">\r\n </po-input>\r\n\r\n <po-input *ngIf=\"isFrenquency()\"\r\n class=\"po-sm-6 po-md-6 po-lg-6 po-xl-6\"\r\n name=\"execAppointHourFinalWeekly\"\r\n p-label=\"Hora Fim\"\r\n p-mask=\"99:99\"\r\n p-mask-format-model=\"true\"\r\n p-pattern=\"^([0-9]|0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$\"\r\n p-error-pattern=\"Hora inv\u00E1lida\"\r\n [p-disabled]=\"disabledParams\"\r\n [(ngModel)]=\"model.execAppointHourFinal\">\r\n </po-input>\r\n\r\n <po-number *ngIf=\"isFrenquency()\"\r\n class=\"po-sm-5 po-md-5 po-lg-5 po-xl-5\"\r\n name=\"frequencyValueWeekly\"\r\n p-label=\"A cada\"\r\n p-minlength=\"1\"\r\n p-maxlength=\"3\"\r\n p-min=\"0\"\r\n p-max=\"999\"\r\n [p-disabled]=\"disabledParams\"\r\n [(ngModel)]=\"model.frequencyValue\">\r\n </po-number>\r\n\r\n <po-select *ngIf=\"isFrenquency()\"\r\n class=\"po-mt-3 po-sm-7 po-md-7 po-lg-7 po-xl-7\"\r\n name=\"frequencyTypeWeekly\"\r\n p-label=\"\"\r\n [p-options]=\"frequencyTypeOptions\"\r\n [p-disabled]=\"disabledParams\"\r\n [(ngModel)]=\"model.frequencyType\">\r\n </po-select>\r\n </div>\r\n </po-tab>\r\n\r\n <po-tab \r\n p-label=\"Mensal\" \r\n [p-active]=\"getActiveTab(3)\" \r\n (p-click)=\"setActiveTab(3)\">\r\n\r\n <div class=\"po-row po-sm-12 po-md-12 po-lg-12 po-xl-12\">\r\n <po-number\r\n class=\"po-sm-3 po-md-3 po-lg-3 po-xl-3\"\r\n name=\"dayOfMonth\"\r\n p-label=\"Dia do m\u00EAs\"\r\n p-minlength=\"1\"\r\n p-maxlength=\"2\"\r\n p-min=\"0\"\r\n p-max=\"31\"\r\n [p-disabled]=\"disabledParams\"\r\n [(ngModel)]=\"model.dayOfMonth\">\r\n </po-number>\r\n </div>\r\n\r\n <div class=\"po-row po-sm-6 po-md-6 po-lg-6 po-xl-6\">\r\n <po-radio-group \r\n class=\"po-sm-12 po-md-12 po-lg-12 po-xl-12\"\r\n name=\"frequencyMonthly\"\r\n p-label=\"Frequ\u00EAncia\"\r\n p-columns=1\r\n [(ngModel)]=\"model.frequency\"\r\n [p-disabled]=\"disabledParams\"\r\n [p-options]=\"frequencyOptions\"\r\n (p-change)=\"changeTypeFrequency()\">\r\n </po-radio-group>\r\n </div>\r\n\r\n <div class=\"po-row po-sm-6 po-md-6 po-lg-6 po-xl-6\">\r\n <po-input\r\n class=\"po-sm-6 po-md-6 po-lg-6 po-xl-6\"\r\n name=\"execAppointHourInitMonthly\"\r\n p-label=\"Hora In\u00EDcio\"\r\n p-mask=\"99:99\"\r\n p-mask-format-model=\"true\"\r\n p-pattern=\"^([0-9]|0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$\"\r\n p-error-pattern=\"Hora inv\u00E1lida\"\r\n [p-disabled]=\"disabledParams\"\r\n [(ngModel)]=\"model.execAppointHourInit\">\r\n </po-input>\r\n\r\n <po-input *ngIf=\"isFrenquency()\"\r\n class=\"po-sm-6 po-md-6 po-lg-6 po-xl-6\"\r\n name=\"execAppointHourFinalWeekly\"\r\n p-label=\"Hora Fim\"\r\n p-mask=\"99:99\"\r\n p-mask-format-model=\"true\"\r\n p-pattern=\"^([0-9]|0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$\"\r\n p-error-pattern=\"Hora inv\u00E1lida\"\r\n [p-disabled]=\"disabledParams\"\r\n [(ngModel)]=\"model.execAppointHourFinal\">\r\n </po-input>\r\n\r\n <po-number *ngIf=\"isFrenquency()\"\r\n class=\"po-sm-5 po-md-5 po-lg-5 po-xl-5\"\r\n name=\"frequencyValueWeekly\"\r\n p-label=\"A cada\"\r\n p-minlength=\"1\"\r\n p-maxlength=\"3\"\r\n p-min=\"0\"\r\n p-max=\"999\"\r\n [p-disabled]=\"disabledParams\"\r\n [(ngModel)]=\"model.frequencyValue\">\r\n </po-number>\r\n\r\n <po-select *ngIf=\"isFrenquency()\"\r\n class=\"po-mt-3 po-sm-7 po-md-7 po-lg-7 po-xl-7\"\r\n name=\"frequencyTypeWeekly\"\r\n p-label=\"\"\r\n [p-options]=\"frequencyTypeOptions\"\r\n [p-disabled]=\"disabledParams\"\r\n [(ngModel)]=\"model.frequencyType\">\r\n </po-select>\r\n </div>\r\n </po-tab>\r\n </po-tabs>\r\n </div>\r\n\r\n <div class=\"po-sm-12 po-md-12 po-lg-12 po-xl-12\" style=\"padding-top: 15px;\">\r\n <po-button\r\n style=\"float: right;\"\r\n p-label=\"Gerar Agendamento RPW\"\r\n [p-disabled]=\"disabledParams\"\r\n (click)=\"executeSchedule()\">\r\n </po-button>\r\n </div>\r\n</form>\r\n" }]
1959
+ }], ctorParameters: () => [{ type: i1$1.PoI18nService }, { type: TotvsScheduleExecutionService }, { type: i1$1.PoNotificationService }], propDecorators: { scheduleExecutionForm: [{
1960
+ type: ViewChild,
1961
+ args: ['scheduleExecutionForm', { static: true }]
1962
+ }], programName: [{
1963
+ type: Input
1964
+ }], externalName: [{
1965
+ type: Input
1966
+ }], programEMS5: [{
1967
+ type: Input
1968
+ }], programStyle: [{
1969
+ type: Input
1970
+ }], programVersion: [{
1971
+ type: Input
1972
+ }], parameters: [{
1973
+ type: Input
1974
+ }], paramDigitDef: [{
1975
+ type: Input
1976
+ }], paramDigitData: [{
1977
+ type: Input
1978
+ }], paramSelections: [{
1979
+ type: Input
1980
+ }], disabledParams: [{
1981
+ type: Input
1982
+ }], loading: [{
1983
+ type: Input
1984
+ }], endExecution: [{
1985
+ type: Output
1928
1986
  }] } });
1929
1987
 
1930
- class DtsDateFormatPipe {
1931
- transform(value, format = 'dd/MM/yyyy') {
1932
- const { 0: year, 1: month, 2: day } = value.split('-');
1933
- const formattedDate = format.replace('dd', day)
1934
- .replace('MM', month)
1935
- .replace('yyyy', year);
1936
- return formattedDate;
1937
- }
1938
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DtsDateFormatPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
1939
- /** @nocollapse */ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: DtsDateFormatPipe, name: "dtsDateFormat" }); }
1940
- }
1941
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DtsDateFormatPipe, decorators: [{
1942
- type: Pipe,
1943
- args: [{
1944
- name: 'dtsDateFormat'
1945
- }]
1988
+ class DtsDateFormatPipe {
1989
+ transform(value, format = 'dd/MM/yyyy') {
1990
+ const { 0: year, 1: month, 2: day } = value.split('-');
1991
+ const formattedDate = format.replace('dd', day)
1992
+ .replace('MM', month)
1993
+ .replace('yyyy', year);
1994
+ return formattedDate;
1995
+ }
1996
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: DtsDateFormatPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
1997
+ /** @nocollapse */ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "17.3.9", ngImport: i0, type: DtsDateFormatPipe, name: "dtsDateFormat" }); }
1998
+ }
1999
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: DtsDateFormatPipe, decorators: [{
2000
+ type: Pipe,
2001
+ args: [{
2002
+ name: 'dtsDateFormat'
2003
+ }]
1946
2004
  }] });
1947
2005
 
1948
- class DtsBackofficeUtilsModule {
1949
- static forRoot() {
1950
- return {
1951
- ngModule: DtsBackofficeUtilsModule,
1952
- providers: [TotvsScheduleExecutionService]
1953
- };
1954
- }
1955
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DtsBackofficeUtilsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1956
- /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: DtsBackofficeUtilsModule, declarations: [TotvsScheduleExecutionComponent,
1957
- DtsDateFormatPipe], imports: [CommonModule,
1958
- PoModule,
1959
- FormsModule,
1960
- HttpClientModule], exports: [TotvsScheduleExecutionComponent,
1961
- DtsDateFormatPipe] }); }
1962
- /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DtsBackofficeUtilsModule, providers: [
1963
- TotvsScheduleExecutionService
1964
- ], imports: [CommonModule,
1965
- PoModule,
1966
- FormsModule,
1967
- HttpClientModule] }); }
1968
- }
1969
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DtsBackofficeUtilsModule, decorators: [{
1970
- type: NgModule,
1971
- args: [{
1972
- declarations: [
1973
- TotvsScheduleExecutionComponent,
1974
- DtsDateFormatPipe
1975
- ],
1976
- imports: [
1977
- CommonModule,
1978
- PoModule,
1979
- FormsModule,
1980
- HttpClientModule
1981
- ],
1982
- exports: [
1983
- TotvsScheduleExecutionComponent,
1984
- DtsDateFormatPipe
1985
- ],
1986
- providers: [
1987
- TotvsScheduleExecutionService
1988
- ]
1989
- }]
2006
+ class DtsBackofficeUtilsModule {
2007
+ static forRoot() {
2008
+ return {
2009
+ ngModule: DtsBackofficeUtilsModule,
2010
+ providers: [TotvsScheduleExecutionService]
2011
+ };
2012
+ }
2013
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: DtsBackofficeUtilsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
2014
+ /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.9", ngImport: i0, type: DtsBackofficeUtilsModule, declarations: [TotvsScheduleExecutionComponent,
2015
+ DtsDateFormatPipe], imports: [CommonModule,
2016
+ PoModule,
2017
+ FormsModule,
2018
+ HttpClientModule], exports: [TotvsScheduleExecutionComponent,
2019
+ DtsDateFormatPipe] }); }
2020
+ /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: DtsBackofficeUtilsModule, providers: [
2021
+ TotvsScheduleExecutionService
2022
+ ], imports: [CommonModule,
2023
+ PoModule,
2024
+ FormsModule,
2025
+ HttpClientModule] }); }
2026
+ }
2027
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: DtsBackofficeUtilsModule, decorators: [{
2028
+ type: NgModule,
2029
+ args: [{
2030
+ declarations: [
2031
+ TotvsScheduleExecutionComponent,
2032
+ DtsDateFormatPipe
2033
+ ],
2034
+ imports: [
2035
+ CommonModule,
2036
+ PoModule,
2037
+ FormsModule,
2038
+ HttpClientModule
2039
+ ],
2040
+ exports: [
2041
+ TotvsScheduleExecutionComponent,
2042
+ DtsDateFormatPipe
2043
+ ],
2044
+ providers: [
2045
+ TotvsScheduleExecutionService
2046
+ ]
2047
+ }]
1990
2048
  }] });
1991
2049
 
1992
- /*
1993
- * Public API Surface of dts-backoffice-util
1994
- */
1995
- // Services
2050
+ /*
2051
+ * Public API Surface of dts-backoffice-util
2052
+ */
2053
+ // Services
1996
2054
  // Pipes
1997
2055
 
1998
- /**
1999
- * Generated bundle index. Do not edit.
2056
+ /**
2057
+ * Generated bundle index. Do not edit.
2000
2058
  */
2001
2059
 
2002
2060
  export { BreadcrumbControlService, CacheParamsService, DateUtil, DisclaimerUtil, DownloadDataParams, DtsBackofficeUtilsModule, DtsDateFormatPipe, ExecutionParameters, ExecutionStatus, FieldValidationUtil, FileUtil, FilterRangeUtil, GenericFunctionsUtils, MenuDatasulService, ProfileService, ReportFormats, ReportService, ScheduleParameters, TotvsScheduleExecutionComponent, TotvsScheduleExecutionService, TranslateService, UserLoginService };