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