@senior-agronegocio/angular-components 0.0.58 → 0.0.60
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/senior-agronegocio-angular-components.umd.js +817 -735
- package/bundles/senior-agronegocio-angular-components.umd.js.map +1 -1
- package/bundles/senior-agronegocio-angular-components.umd.min.js +2 -2
- package/bundles/senior-agronegocio-angular-components.umd.min.js.map +1 -1
- package/common/agro-regex.constant.d.ts +0 -8
- package/common/agro-string-utils.class.d.ts +0 -13
- package/components/event-control-board/common/event-operation.d.ts +7 -1
- package/components/event-control-board/common/event-origin.d.ts +2 -1
- package/components/event-control-board/event-control-board.component.d.ts +12 -12
- package/components/event-control-board/index.d.ts +1 -0
- package/components/event-control-board/service/event-control/event-control-dto.d.ts +3 -0
- package/components/event-control-board/service/event-control/event-control.d.ts +3 -0
- package/components/event-control-board/service/event-control-board.service.d.ts +3 -3
- package/components/event-control-board/service/fixation-entity/fixation-dto.d.ts +40 -0
- package/components/event-control-board/service/fixation-entity/fixation.module.d.ts +2 -0
- package/components/event-control-board/service/fixation-entity/fixation.service.d.ts +15 -0
- package/enums/agro-numbers.enum.d.ts +2 -1
- package/enums/fixation-status.d.ts +8 -0
- package/esm2015/common/agro-platform-utils.class.js +5 -6
- package/esm2015/common/agro-regex.constant.js +1 -9
- package/esm2015/common/agro-string-utils.class.js +58 -38
- package/esm2015/components/event-control-board/common/event-control-constants.js +8 -2
- package/esm2015/components/event-control-board/common/event-operation.js +7 -1
- package/esm2015/components/event-control-board/common/event-origin.js +2 -1
- package/esm2015/components/event-control-board/event-control-board.component.js +105 -132
- package/esm2015/components/event-control-board/event-control-board.module.js +7 -4
- package/esm2015/components/event-control-board/index.js +2 -1
- package/esm2015/components/event-control-board/service/event-control/event-control-dto.js +1 -1
- package/esm2015/components/event-control-board/service/event-control/event-control.js +1 -1
- package/esm2015/components/event-control-board/service/event-control-board.service.js +10 -10
- package/esm2015/components/event-control-board/service/fixation-entity/fixation-dto.js +1 -0
- package/esm2015/components/event-control-board/service/fixation-entity/fixation.module.js +24 -0
- package/esm2015/components/event-control-board/service/fixation-entity/fixation.service.js +29 -0
- package/esm2015/enums/agro-numbers.enum.js +2 -1
- package/esm2015/enums/fixation-status.js +10 -0
- package/esm2015/form-validator/agro-form-validator.js +30 -39
- package/esm2015/services/i18n/en-US.js +17 -3
- package/esm2015/services/i18n/es-CO.js +17 -3
- package/esm2015/services/i18n/pt-BR.js +16 -2
- package/esm5/common/agro-platform-utils.class.js +5 -6
- package/esm5/common/agro-regex.constant.js +1 -9
- package/esm5/common/agro-string-utils.class.js +58 -38
- package/esm5/components/event-control-board/common/event-control-constants.js +8 -2
- package/esm5/components/event-control-board/common/event-operation.js +7 -1
- package/esm5/components/event-control-board/common/event-origin.js +2 -1
- package/esm5/components/event-control-board/event-control-board.component.js +111 -138
- package/esm5/components/event-control-board/event-control-board.module.js +7 -4
- package/esm5/components/event-control-board/index.js +2 -1
- package/esm5/components/event-control-board/service/event-control/event-control-dto.js +1 -1
- package/esm5/components/event-control-board/service/event-control/event-control.js +1 -1
- package/esm5/components/event-control-board/service/event-control-board.service.js +10 -10
- package/esm5/components/event-control-board/service/fixation-entity/fixation-dto.js +1 -0
- package/esm5/components/event-control-board/service/fixation-entity/fixation.module.js +27 -0
- package/esm5/components/event-control-board/service/fixation-entity/fixation.service.js +32 -0
- package/esm5/enums/agro-numbers.enum.js +2 -1
- package/esm5/enums/fixation-status.js +10 -0
- package/esm5/form-validator/agro-form-validator.js +31 -39
- package/esm5/services/i18n/en-US.js +17 -3
- package/esm5/services/i18n/es-CO.js +17 -3
- package/esm5/services/i18n/pt-BR.js +16 -2
- package/fesm2015/senior-agronegocio-angular-components.js +774 -700
- package/fesm2015/senior-agronegocio-angular-components.js.map +1 -1
- package/fesm5/senior-agronegocio-angular-components.js +819 -738
- package/fesm5/senior-agronegocio-angular-components.js.map +1 -1
- package/form-validator/agro-form-validator.d.ts +15 -17
- package/package.json +1 -1
- package/services/i18n/en-US.d.ts +14 -0
- package/services/i18n/es-CO.d.ts +14 -0
- package/services/i18n/pt-BR.d.ts +14 -0
- package/components/event-control-board/common/invoice-status.d.ts +0 -12
- package/components/event-control-board/common/invoice-type.d.ts +0 -5
- package/components/event-control-board/service/e012fam/e012fam.d.ts +0 -14
- package/components/event-control-board/service/e075der/e075der.d.ts +0 -18
- package/components/event-control-board/service/e113saf/e113saf.d.ts +0 -14
- package/components/event-control-board/service/e205dep/e205dep-dto.d.ts +0 -15
- package/components/event-control-board/service/e205dep/e205dep.d.ts +0 -16
- package/components/event-control-board/service/external-invoice/external-invoice.d.ts +0 -13
- package/components/event-control-board/service/invoice/invoice.d.ts +0 -21
- package/components/event-control-board/service/origination/operationType.d.ts +0 -5
- package/components/event-control-board/service/origination/origination.d.ts +0 -51
- package/components/event-control-board/service/producer-invoice/producer-invoice.d.ts +0 -27
- package/components/event-control-board/service/rural-estate/rural-estate.d.ts +0 -34
- package/components/event-control-board/service/ticket/ticket.d.ts +0 -18
- package/esm2015/components/event-control-board/common/invoice-status.js +0 -14
- package/esm2015/components/event-control-board/common/invoice-type.js +0 -7
- package/esm2015/components/event-control-board/service/e012fam/e012fam.js +0 -20
- package/esm2015/components/event-control-board/service/e075der/e075der.js +0 -31
- package/esm2015/components/event-control-board/service/e113saf/e113saf.js +0 -20
- package/esm2015/components/event-control-board/service/e205dep/e205dep-dto.js +0 -1
- package/esm2015/components/event-control-board/service/e205dep/e205dep.js +0 -20
- package/esm2015/components/event-control-board/service/external-invoice/external-invoice.js +0 -20
- package/esm2015/components/event-control-board/service/invoice/invoice.js +0 -43
- package/esm2015/components/event-control-board/service/origination/operationType.js +0 -7
- package/esm2015/components/event-control-board/service/origination/origination.js +0 -59
- package/esm2015/components/event-control-board/service/producer-invoice/producer-invoice.js +0 -32
- package/esm2015/components/event-control-board/service/rural-estate/rural-estate.js +0 -78
- package/esm2015/components/event-control-board/service/ticket/ticket.js +0 -39
- package/esm5/components/event-control-board/common/invoice-status.js +0 -14
- package/esm5/components/event-control-board/common/invoice-type.js +0 -7
- package/esm5/components/event-control-board/service/e012fam/e012fam.js +0 -25
- package/esm5/components/event-control-board/service/e075der/e075der.js +0 -36
- package/esm5/components/event-control-board/service/e113saf/e113saf.js +0 -25
- package/esm5/components/event-control-board/service/e205dep/e205dep-dto.js +0 -1
- package/esm5/components/event-control-board/service/e205dep/e205dep.js +0 -25
- package/esm5/components/event-control-board/service/external-invoice/external-invoice.js +0 -25
- package/esm5/components/event-control-board/service/invoice/invoice.js +0 -48
- package/esm5/components/event-control-board/service/origination/operationType.js +0 -7
- package/esm5/components/event-control-board/service/origination/origination.js +0 -62
- package/esm5/components/event-control-board/service/producer-invoice/producer-invoice.js +0 -37
- package/esm5/components/event-control-board/service/rural-estate/rural-estate.js +0 -83
- package/esm5/components/event-control-board/service/ticket/ticket.js +0 -44
|
@@ -210,6 +210,149 @@
|
|
|
210
210
|
DateComparisonType["lessThan"] = "lessThan";
|
|
211
211
|
})(exports.DateComparisonType || (exports.DateComparisonType = {}));
|
|
212
212
|
|
|
213
|
+
var AGRO_REGEX = {
|
|
214
|
+
/**
|
|
215
|
+
* Validação de E-mail
|
|
216
|
+
*/
|
|
217
|
+
isEmail: /^[^\s@]+@[^\s@]+\.[^\s@]+$/,
|
|
218
|
+
/**
|
|
219
|
+
* Validação de Números Inteiros Positivos
|
|
220
|
+
*/
|
|
221
|
+
positiveInteger: /^[1-9]\d*$/,
|
|
222
|
+
/**
|
|
223
|
+
* Validação de Números Decimais Positivos
|
|
224
|
+
*/
|
|
225
|
+
positiveDecimal: /^\d*\.?\d+$/,
|
|
226
|
+
/**
|
|
227
|
+
* Validação de string que consiste apenas em espaços em branco ou está vazia.
|
|
228
|
+
*/
|
|
229
|
+
onlyBlankSpaces: /^\s*$/,
|
|
230
|
+
/**
|
|
231
|
+
* Validação de CEP (Código Postal)
|
|
232
|
+
*/
|
|
233
|
+
zipCode: /^\d{8}$|^\d{5}-\d{3}$/,
|
|
234
|
+
/**
|
|
235
|
+
* Validação de String (qualquer caractere)
|
|
236
|
+
*/
|
|
237
|
+
isString: /^[\s\S]*$/,
|
|
238
|
+
/**
|
|
239
|
+
* Validação de UUID
|
|
240
|
+
*/
|
|
241
|
+
isUUID: /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$/,
|
|
242
|
+
/**
|
|
243
|
+
* Validação de Número
|
|
244
|
+
*/
|
|
245
|
+
isNumber: /^-?\d+$/,
|
|
246
|
+
/**
|
|
247
|
+
* Validação de Número Decimal
|
|
248
|
+
*/
|
|
249
|
+
isDecimal: /^\d*\.?\d+$/,
|
|
250
|
+
/**
|
|
251
|
+
* Validação de Placa de Veículo
|
|
252
|
+
*/
|
|
253
|
+
isLicensePlate: /^[A-Za-z0-9]{1,7}-?[A-Za-z0-9]{1,7}$/,
|
|
254
|
+
/**
|
|
255
|
+
* Validação de Número de Telefone
|
|
256
|
+
*/
|
|
257
|
+
isPhoneNumber: /^\+?\d{1,4}-?\d{6,11}$/,
|
|
258
|
+
/**
|
|
259
|
+
* Validação de Data (Formato YYYY-MM-DD)
|
|
260
|
+
*/
|
|
261
|
+
isDate: /^\d{4}-\d{2}-\d{2}$/,
|
|
262
|
+
/**
|
|
263
|
+
* Validação de Hora (Formato HH:mm)
|
|
264
|
+
*/
|
|
265
|
+
isTime: /^(0\d|1\d|2[0-3]):[0-5]\d$/,
|
|
266
|
+
/**
|
|
267
|
+
* Validação de Data e Hora (Formato YYYY-MM-DD HH:mm)
|
|
268
|
+
*/
|
|
269
|
+
isDateTime: /^\d{4}-\d{2}-\d{2} (0\d|1\d|2[0-3]):[0-5]\d$/,
|
|
270
|
+
/**
|
|
271
|
+
* Validação de URL
|
|
272
|
+
*/
|
|
273
|
+
isURL: /^(http|https):\/\/([\w-]+\.)+[\w-]+(\/[\w- ./?%&=]*)?$/,
|
|
274
|
+
/**
|
|
275
|
+
* Validação de Número Hexadecimal
|
|
276
|
+
*/
|
|
277
|
+
isHexNumber: /^[0-9a-fA-F]+$/,
|
|
278
|
+
/**
|
|
279
|
+
* Validação de Base64
|
|
280
|
+
*/
|
|
281
|
+
isBase64: /^[a-zA-Z0-9+/]+={0,2}$/,
|
|
282
|
+
/**
|
|
283
|
+
* Validação de Nome de Usuário (3 a 20 caracteres alfanuméricos)
|
|
284
|
+
*/
|
|
285
|
+
isUsername: /^\w{3,20}$/,
|
|
286
|
+
/**
|
|
287
|
+
* Validação de Alfanumérico
|
|
288
|
+
*/
|
|
289
|
+
isAlphanumeric: /^[a-zA-Z0-9]+$/,
|
|
290
|
+
/**
|
|
291
|
+
* Validação de Slug (letras minúsculas, números e traços)
|
|
292
|
+
*/
|
|
293
|
+
isSlug: /^[a-z0-9-]+$/,
|
|
294
|
+
/**
|
|
295
|
+
* Validação de Número de Cartão de Crédito
|
|
296
|
+
*/
|
|
297
|
+
isCreditCard: /^\d{4}-\d{4}-\d{4}-\d{4}$/,
|
|
298
|
+
/**
|
|
299
|
+
* Validação de Número Hexadecimal
|
|
300
|
+
*/
|
|
301
|
+
isHexadecimal: /^[0-9a-fA-F]+$/,
|
|
302
|
+
/**
|
|
303
|
+
* Validação de Moeda
|
|
304
|
+
*/
|
|
305
|
+
isCurrency: /^\d+(\.\d{1,2})?$/,
|
|
306
|
+
/**
|
|
307
|
+
* Validação de Porcentagem
|
|
308
|
+
*/
|
|
309
|
+
isPercentage: /^(100(\.0{1,2})?|[1-9]?\d(\.\d{1,2})?)$/,
|
|
310
|
+
/**
|
|
311
|
+
* Validação de Tag HTML Simples
|
|
312
|
+
*/
|
|
313
|
+
isHTMLTag: /^<([a-z]+)([^<]+)*(?:>(.*)<\/\1>|\s+\/>)$/,
|
|
314
|
+
/**
|
|
315
|
+
* Validação de Nome de Usuário com Espaços (3 a 20 caracteres alfanuméricos e espaços)
|
|
316
|
+
*/
|
|
317
|
+
isUsernameWithSpaces: /^[a-zA-Z0-9_ ]{3,20}$/,
|
|
318
|
+
/**
|
|
319
|
+
* Validação de Senha Forte (mínimo 8 caracteres, uma letra minúscula, uma letra maiúscula, um número e um caractere especial)
|
|
320
|
+
*/
|
|
321
|
+
isStrongPassword: /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$/,
|
|
322
|
+
/**
|
|
323
|
+
* Validação de String Alfabética
|
|
324
|
+
*/
|
|
325
|
+
isAlphabetic: /^[a-zA-Z]+$/,
|
|
326
|
+
/**
|
|
327
|
+
* Validação de Hora no Formato de 12 Horas
|
|
328
|
+
*/
|
|
329
|
+
isTime12Hour: /^(0?[1-9]|1[0-2]):\d{2} (AM|PM)$/i,
|
|
330
|
+
/**
|
|
331
|
+
* Validação de Latitude
|
|
332
|
+
*/
|
|
333
|
+
isLatitude: /^[-+]?([1-8]?\d(\.\d+)?|90(\.0+)?)$/,
|
|
334
|
+
/**
|
|
335
|
+
* Validação de Longitude
|
|
336
|
+
*/
|
|
337
|
+
isLongitude: /^[-+]?(180(\.0+)?|((1[0-7]\d)|([1-9]?\d))(\.\d+)?)$/,
|
|
338
|
+
/**
|
|
339
|
+
* Validação de Endereço MAC
|
|
340
|
+
*/
|
|
341
|
+
isMACAddress: /^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$/,
|
|
342
|
+
/**
|
|
343
|
+
* Validação de Data de Expiração de Cartão de Crédito
|
|
344
|
+
*/
|
|
345
|
+
isCreditCardExpiration: /^(0[1-9]|1[0-2])\/\d{2}$/,
|
|
346
|
+
/**
|
|
347
|
+
* Validação de Número de Seguro Social (SSN)
|
|
348
|
+
*/
|
|
349
|
+
isSSN: /^\d{3}-\d{2}-\d{4}$/,
|
|
350
|
+
/**
|
|
351
|
+
* Validação se todos os dígitos são iguais
|
|
352
|
+
*/
|
|
353
|
+
isAllDigitsEqual: /^(.)\1+$/,
|
|
354
|
+
};
|
|
355
|
+
|
|
213
356
|
|
|
214
357
|
(function (NumberComparisonType) {
|
|
215
358
|
NumberComparisonType["EQUALS"] = "EQUALS";
|
|
@@ -1231,6 +1374,7 @@
|
|
|
1231
1374
|
AGRO_NUMBERS[AGRO_NUMBERS["TWO_HUNDRED_AND_TWENTY_ZERO"] = 220] = "TWO_HUNDRED_AND_TWENTY_ZERO";
|
|
1232
1375
|
AGRO_NUMBERS[AGRO_NUMBERS["TWO_HUNDRED_AND_TWO"] = 202] = "TWO_HUNDRED_AND_TWO";
|
|
1233
1376
|
AGRO_NUMBERS[AGRO_NUMBERS["ZERO"] = 0] = "ZERO";
|
|
1377
|
+
AGRO_NUMBERS[AGRO_NUMBERS["FIVE_SECONDS"] = 5000] = "FIVE_SECONDS";
|
|
1234
1378
|
})(exports.AGRO_NUMBERS || (exports.AGRO_NUMBERS = {}));
|
|
1235
1379
|
|
|
1236
1380
|
|
|
@@ -1558,76 +1702,310 @@
|
|
|
1558
1702
|
return AgroObjectUtils;
|
|
1559
1703
|
}());
|
|
1560
1704
|
|
|
1561
|
-
var
|
|
1562
|
-
function
|
|
1563
|
-
}
|
|
1564
|
-
AgroCookieUtils.getCookie = function (name, parseURIValue) {
|
|
1565
|
-
if (parseURIValue === void 0) { parseURIValue = false; }
|
|
1566
|
-
var cookieValue = document.cookie.split(';')
|
|
1567
|
-
.map(function (cookie) { return cookie.trim(); })
|
|
1568
|
-
.find(function (cookie) { return cookie.startsWith(name); });
|
|
1569
|
-
var result = cookieValue === null || cookieValue === void 0 ? void 0 : cookieValue.split('=')[1];
|
|
1570
|
-
if (parseURIValue && result) {
|
|
1571
|
-
result = decodeURIComponent(result);
|
|
1572
|
-
}
|
|
1573
|
-
return result;
|
|
1574
|
-
};
|
|
1575
|
-
AgroCookieUtils.parseCookieToObject = function (cookieString, parseURIString) {
|
|
1576
|
-
if (parseURIString === void 0) { parseURIString = false; }
|
|
1577
|
-
var cookieObject = {};
|
|
1578
|
-
if (parseURIString) {
|
|
1579
|
-
cookieString = decodeURIComponent(cookieString);
|
|
1580
|
-
}
|
|
1581
|
-
cookieString.split(';').forEach(function (cookie) {
|
|
1582
|
-
var _a = __read(cookie.split('=').map(function (c) { return c.trim(); }), 2), key = _a[0], value = _a[1];
|
|
1583
|
-
cookieObject[key] = value;
|
|
1584
|
-
});
|
|
1585
|
-
return cookieObject;
|
|
1586
|
-
};
|
|
1587
|
-
AgroCookieUtils.prototype.setCookie = function (name, value, days) {
|
|
1588
|
-
var date = new Date();
|
|
1589
|
-
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
|
|
1590
|
-
var expires = 'expires=' + date.toUTCString();
|
|
1591
|
-
document.cookie = name + '=' + value + ';' + expires + ';path=/';
|
|
1592
|
-
};
|
|
1593
|
-
return AgroCookieUtils;
|
|
1594
|
-
}());
|
|
1595
|
-
|
|
1596
|
-
var AgroDateUtils = /** @class */ (function () {
|
|
1597
|
-
function AgroDateUtils() {
|
|
1705
|
+
var AgroFormValidator = /** @class */ (function () {
|
|
1706
|
+
function AgroFormValidator() {
|
|
1598
1707
|
}
|
|
1599
1708
|
/**
|
|
1600
|
-
*
|
|
1601
|
-
*
|
|
1602
|
-
* @
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
* Verifica se uma data não é nula e não é indefinida.
|
|
1609
|
-
* @param date - A data a ser verificada.
|
|
1610
|
-
* @returns True se a data não for nula e não for indefinida, false caso contrário.
|
|
1709
|
+
* Validator para checar se o campo é um e-mail
|
|
1710
|
+
*
|
|
1711
|
+
* @example
|
|
1712
|
+
* this.myForm = this.fb.group({
|
|
1713
|
+
* EMAIL_FIELD: ['', [Validators.required, AgroFormValidator.emailValidator]]
|
|
1714
|
+
* });
|
|
1715
|
+
* @param control
|
|
1716
|
+
* @returns
|
|
1611
1717
|
*/
|
|
1612
|
-
|
|
1613
|
-
|
|
1718
|
+
AgroFormValidator.emailValidator = function (control) {
|
|
1719
|
+
if (control.value && !AGRO_REGEX.isEmail.test(control.value)) {
|
|
1720
|
+
control.setErrors({ emailValidator: true });
|
|
1721
|
+
return { emailValidator: true };
|
|
1722
|
+
}
|
|
1723
|
+
control.setErrors(null);
|
|
1724
|
+
return null;
|
|
1614
1725
|
};
|
|
1615
1726
|
/**
|
|
1616
|
-
*
|
|
1617
|
-
*
|
|
1618
|
-
*
|
|
1727
|
+
* Aplique esse validador em um campo do tipo Date, para verificar se a data selecionada é maior ou menor que a data atual.
|
|
1728
|
+
*
|
|
1729
|
+
* Utilize o parâmetro comparisonType para definir se a data selecionada deve ser maior ou menor que a data atual.
|
|
1730
|
+
* A validação será através do enum DateComparisonType.
|
|
1731
|
+
*
|
|
1732
|
+
* @example
|
|
1733
|
+
* this.myForm = this.fb.group({
|
|
1734
|
+
* NOME_CAMPO: ['', [Validators.required, AgroFormValidator.compareDateWithToday(DateComparisonType.greatherThan)]]
|
|
1735
|
+
* });
|
|
1736
|
+
* @param comparisonType
|
|
1737
|
+
* @returns
|
|
1619
1738
|
*/
|
|
1620
|
-
|
|
1621
|
-
|
|
1739
|
+
AgroFormValidator.compareDateWithToday = function (comparisonType) {
|
|
1740
|
+
var compareDate = function (control) {
|
|
1741
|
+
var _a, _b;
|
|
1742
|
+
var methodName = 'dateComparisonToday';
|
|
1743
|
+
var selectedDate = new Date(control.value);
|
|
1744
|
+
var currentDate = new Date();
|
|
1745
|
+
var conditions = (_a = {},
|
|
1746
|
+
_a[exports.DateComparisonType.greatherThan] = selectedDate <= currentDate,
|
|
1747
|
+
_a[exports.DateComparisonType.lessThan] = selectedDate >= currentDate,
|
|
1748
|
+
_a);
|
|
1749
|
+
if (conditions[comparisonType]) {
|
|
1750
|
+
return _b = {}, _b[methodName] = { value: control.value }, _b;
|
|
1751
|
+
}
|
|
1752
|
+
return null;
|
|
1753
|
+
};
|
|
1754
|
+
return compareDate;
|
|
1622
1755
|
};
|
|
1623
1756
|
/**
|
|
1624
|
-
*
|
|
1625
|
-
*
|
|
1626
|
-
*
|
|
1757
|
+
* Compara dois campos do tipo Date, verificando se o campo A é maior que o campo B. Se A for maior que B, então
|
|
1758
|
+
* o campo A é invalidado. Caso contrário, o campo A é validado.
|
|
1759
|
+
*
|
|
1760
|
+
* Aplique esse campo no FormGroup, passando os nomes dos campos que deseja comparar.
|
|
1761
|
+
* @example
|
|
1762
|
+
* this.myForm = this.fb.group({
|
|
1763
|
+
NOME_CAMPO_dateA: ['', Validators.required],
|
|
1764
|
+
NOME_CAMPO_dateB: ['', Validators.required]
|
|
1765
|
+
}, { validator: AgroFormValidator.dateComparisonValidator('NOME_CAMPO_dateA', 'NOME_CAMPO_dateB') });
|
|
1766
|
+
* @param controlNameA
|
|
1767
|
+
* @param controlNameB
|
|
1768
|
+
* @returns
|
|
1627
1769
|
*/
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1770
|
+
AgroFormValidator.compareDateWithOtherDateField = function (controlNameA, controlNameB) {
|
|
1771
|
+
var compareDate = function (control) {
|
|
1772
|
+
var _a, _b;
|
|
1773
|
+
var _c, _d, _e, _f, _g;
|
|
1774
|
+
var formGroup = control;
|
|
1775
|
+
var dateA = (_c = formGroup.get(controlNameA)) === null || _c === void 0 ? void 0 : _c.value;
|
|
1776
|
+
var dateB = (_d = formGroup.get(controlNameB)) === null || _d === void 0 ? void 0 : _d.value;
|
|
1777
|
+
var methodName = 'compareDateWithOtherDateField';
|
|
1778
|
+
if (dateA && dateB) {
|
|
1779
|
+
var dateAObj = new Date(dateA);
|
|
1780
|
+
var dateBObj = new Date(dateB);
|
|
1781
|
+
if (dateAObj < dateBObj) {
|
|
1782
|
+
(_e = formGroup.get(controlNameA)) === null || _e === void 0 ? void 0 : _e.setErrors((_a = {}, _a[methodName] = true, _a));
|
|
1783
|
+
return _b = {}, _b[methodName] = true, _b;
|
|
1784
|
+
}
|
|
1785
|
+
else if ((_f = formGroup.get(controlNameA)) === null || _f === void 0 ? void 0 : _f.hasError(methodName)) {
|
|
1786
|
+
(_g = formGroup.get(controlNameA)) === null || _g === void 0 ? void 0 : _g.setErrors(null);
|
|
1787
|
+
}
|
|
1788
|
+
}
|
|
1789
|
+
return null;
|
|
1790
|
+
};
|
|
1791
|
+
return compareDate;
|
|
1792
|
+
};
|
|
1793
|
+
/**
|
|
1794
|
+
* Validator para checar se o campo é um número de telefone de acordo com uma máscara informada.
|
|
1795
|
+
*
|
|
1796
|
+
* @example
|
|
1797
|
+
* this.myForm = this.fb.group({
|
|
1798
|
+
* TELEFONE_FIELD: ['', [Validators.required, AgroFormValidator.phoneValidator('(99) 9999-9999')]]
|
|
1799
|
+
* });
|
|
1800
|
+
* @param mask
|
|
1801
|
+
* @returns
|
|
1802
|
+
*/
|
|
1803
|
+
AgroFormValidator.phoneValidator = function (mask) {
|
|
1804
|
+
var phoneControlValidation = function (control) {
|
|
1805
|
+
var _a, _b;
|
|
1806
|
+
var methodName = 'phoneValidator';
|
|
1807
|
+
var regex = new RegExp("^" + mask.replace(/9/g, '\\d').replace(/\(/g, '\\(').replace(/\)/g, '\\)').replace(/-/g, '\\-') + "$");
|
|
1808
|
+
if (control.value && !regex.test(control.value)) {
|
|
1809
|
+
control.setErrors((_a = {}, _a[methodName] = true, _a));
|
|
1810
|
+
return _b = {}, _b[methodName] = true, _b;
|
|
1811
|
+
}
|
|
1812
|
+
control.setErrors(null);
|
|
1813
|
+
return null;
|
|
1814
|
+
};
|
|
1815
|
+
return phoneControlValidation;
|
|
1816
|
+
};
|
|
1817
|
+
/**
|
|
1818
|
+
* Validator para checar se um campo de números é maior ou menor que outro campo.
|
|
1819
|
+
*
|
|
1820
|
+
* Aplique esse validator no FormGroup, passando os nomes dos campos que deseja comparar.
|
|
1821
|
+
* @example
|
|
1822
|
+
* this.myForm = this.fb.group({
|
|
1823
|
+
* NUMERO_A: ['', Validators.required],
|
|
1824
|
+
* NUMERO_B: ['', Validators.required]
|
|
1825
|
+
* }, { validator: AgroFormValidator.compareNumberFields('NUMERO_A', 'NUMERO_B', NumberComparisonType.EQUALS) });
|
|
1826
|
+
*
|
|
1827
|
+
* Neste caso, a verificação será se o NUMERO_A é igual ao NUMERB_B.
|
|
1828
|
+
* @param controlNameA
|
|
1829
|
+
* @param controlNameB
|
|
1830
|
+
* @returns
|
|
1831
|
+
*/
|
|
1832
|
+
AgroFormValidator.compareNumberFields = function (controlNameA, controlNameB, comparisonMethod) {
|
|
1833
|
+
var compareNumber = function (control) {
|
|
1834
|
+
var _a, _b, _c;
|
|
1835
|
+
var _d, _e, _f;
|
|
1836
|
+
var formGroup = control;
|
|
1837
|
+
var numberA = (_d = formGroup.get(controlNameA)) === null || _d === void 0 ? void 0 : _d.value;
|
|
1838
|
+
var numberB = (_e = formGroup.get(controlNameB)) === null || _e === void 0 ? void 0 : _e.value;
|
|
1839
|
+
var methodName = 'compareNumberFields';
|
|
1840
|
+
if (numberA && numberB) {
|
|
1841
|
+
var errorType = exports.NumberComparisonType[comparisonMethod];
|
|
1842
|
+
var errorCondition = (_a = {},
|
|
1843
|
+
_a[exports.NumberComparisonType.EQUALS] = numberA !== numberB,
|
|
1844
|
+
_a[exports.NumberComparisonType.GREATER_THAN] = numberA <= numberB,
|
|
1845
|
+
_a[exports.NumberComparisonType.LESS_THAN] = numberA >= numberB,
|
|
1846
|
+
_a[exports.NumberComparisonType.GREATER_THAN_OR_EQUAL] = numberA < numberB,
|
|
1847
|
+
_a[exports.NumberComparisonType.LESS_THAN_OR_EQUAL] = numberA > numberB,
|
|
1848
|
+
_a[exports.NumberComparisonType.NOT_EQUALS] = numberA === numberB,
|
|
1849
|
+
_a);
|
|
1850
|
+
if (errorCondition[comparisonMethod]) {
|
|
1851
|
+
var controlA = formGroup.get(controlNameA);
|
|
1852
|
+
if (controlA) {
|
|
1853
|
+
controlA.setErrors((_b = {}, _b[methodName] = comparisonMethod, _b));
|
|
1854
|
+
}
|
|
1855
|
+
return _c = {}, _c[methodName] = errorType, _c;
|
|
1856
|
+
}
|
|
1857
|
+
else if ((_f = formGroup.get(controlNameA)) === null || _f === void 0 ? void 0 : _f.hasError(methodName)) {
|
|
1858
|
+
var controlA = formGroup.get(controlNameA);
|
|
1859
|
+
if (controlA) {
|
|
1860
|
+
controlA.setErrors(null);
|
|
1861
|
+
}
|
|
1862
|
+
}
|
|
1863
|
+
}
|
|
1864
|
+
return null;
|
|
1865
|
+
};
|
|
1866
|
+
return compareNumber;
|
|
1867
|
+
};
|
|
1868
|
+
/**
|
|
1869
|
+
* Validator para checar se um valor está entre os demais valores de três formControls.
|
|
1870
|
+
*
|
|
1871
|
+
* Aplique esse validator no FormGroup, passando os nomes dos três formControls que deseja comparar.
|
|
1872
|
+
* @example
|
|
1873
|
+
* this.myForm = this.fb.group({
|
|
1874
|
+
* minorFormControl: ['', Validators.required],
|
|
1875
|
+
* targetFormControl: ['', Validators.required],
|
|
1876
|
+
* majorFormControl: ['', Validators.required]
|
|
1877
|
+
* }, { validator: AgroFormValidator.checkValueBetween('minorFormControl', 'targetFormControl', 'majorFormControl') });
|
|
1878
|
+
*
|
|
1879
|
+
* Neste caso, a verificação será se o targetFormControl está entre o minorFormControl e o majorFormControl.
|
|
1880
|
+
* @param minorFormControl
|
|
1881
|
+
* @param targetFormControl
|
|
1882
|
+
* @param majorFormControl
|
|
1883
|
+
* @returns
|
|
1884
|
+
*/
|
|
1885
|
+
AgroFormValidator.checkValueBetween = function (minorFormControl, targetFormControl, majorFormControl) {
|
|
1886
|
+
var checkValue = function (control) {
|
|
1887
|
+
var _a, _b;
|
|
1888
|
+
var _c, _d, _e, _f;
|
|
1889
|
+
var formGroup = control;
|
|
1890
|
+
var valueA = (_c = formGroup.get(minorFormControl)) === null || _c === void 0 ? void 0 : _c.value;
|
|
1891
|
+
var valueB = (_d = formGroup.get(targetFormControl)) === null || _d === void 0 ? void 0 : _d.value;
|
|
1892
|
+
var valueC = (_e = formGroup.get(majorFormControl)) === null || _e === void 0 ? void 0 : _e.value;
|
|
1893
|
+
var methodName = 'checkValueBetween';
|
|
1894
|
+
if (valueA && valueB && valueC) {
|
|
1895
|
+
if (valueB < valueA || valueB > valueC) {
|
|
1896
|
+
var targetControl = formGroup.get(targetFormControl);
|
|
1897
|
+
if (targetControl) {
|
|
1898
|
+
targetControl.setErrors((_a = {}, _a[methodName] = true, _a));
|
|
1899
|
+
}
|
|
1900
|
+
return _b = {}, _b[methodName] = true, _b;
|
|
1901
|
+
}
|
|
1902
|
+
else if ((_f = formGroup.get(targetFormControl)) === null || _f === void 0 ? void 0 : _f.hasError(methodName)) {
|
|
1903
|
+
var targetControl = formGroup.get(targetFormControl);
|
|
1904
|
+
if (targetControl) {
|
|
1905
|
+
targetControl.setErrors(null);
|
|
1906
|
+
}
|
|
1907
|
+
}
|
|
1908
|
+
}
|
|
1909
|
+
return null;
|
|
1910
|
+
};
|
|
1911
|
+
return checkValue;
|
|
1912
|
+
};
|
|
1913
|
+
/**
|
|
1914
|
+
* Validator para checar se o campo é um objeto e se possui uma propriedade específica.
|
|
1915
|
+
*
|
|
1916
|
+
* @example
|
|
1917
|
+
* this.myForm = this.fb.group({
|
|
1918
|
+
* OBJETO_FIELD: ['', [Validators.required, AgroFormValidator.objectPropertyValidator('propriedade')]]
|
|
1919
|
+
* });
|
|
1920
|
+
* @param propertyName
|
|
1921
|
+
* @returns
|
|
1922
|
+
*/
|
|
1923
|
+
AgroFormValidator.objectPropertyValidator = function (propertyName) {
|
|
1924
|
+
var objectProperty = function (control) {
|
|
1925
|
+
var _a, _b;
|
|
1926
|
+
var methodName = 'objectProperty';
|
|
1927
|
+
if (AgroObjectUtils.isObject(control.value) && AgroObjectUtils.containsProperty(control.value, propertyName)) {
|
|
1928
|
+
control.setErrors(null);
|
|
1929
|
+
return null;
|
|
1930
|
+
}
|
|
1931
|
+
control.setErrors((_a = {}, _a[methodName] = true, _a));
|
|
1932
|
+
return _b = {}, _b[methodName] = true, _b;
|
|
1933
|
+
};
|
|
1934
|
+
return objectProperty;
|
|
1935
|
+
};
|
|
1936
|
+
return AgroFormValidator;
|
|
1937
|
+
}());
|
|
1938
|
+
|
|
1939
|
+
var AgroCookieUtils = /** @class */ (function () {
|
|
1940
|
+
function AgroCookieUtils() {
|
|
1941
|
+
}
|
|
1942
|
+
AgroCookieUtils.getCookie = function (name, parseURIValue) {
|
|
1943
|
+
if (parseURIValue === void 0) { parseURIValue = false; }
|
|
1944
|
+
var cookieValue = document.cookie.split(';')
|
|
1945
|
+
.map(function (cookie) { return cookie.trim(); })
|
|
1946
|
+
.find(function (cookie) { return cookie.startsWith(name); });
|
|
1947
|
+
var result = cookieValue === null || cookieValue === void 0 ? void 0 : cookieValue.split('=')[1];
|
|
1948
|
+
if (parseURIValue && result) {
|
|
1949
|
+
result = decodeURIComponent(result);
|
|
1950
|
+
}
|
|
1951
|
+
return result;
|
|
1952
|
+
};
|
|
1953
|
+
AgroCookieUtils.parseCookieToObject = function (cookieString, parseURIString) {
|
|
1954
|
+
if (parseURIString === void 0) { parseURIString = false; }
|
|
1955
|
+
var cookieObject = {};
|
|
1956
|
+
if (parseURIString) {
|
|
1957
|
+
cookieString = decodeURIComponent(cookieString);
|
|
1958
|
+
}
|
|
1959
|
+
cookieString.split(';').forEach(function (cookie) {
|
|
1960
|
+
var _a = __read(cookie.split('=').map(function (c) { return c.trim(); }), 2), key = _a[0], value = _a[1];
|
|
1961
|
+
cookieObject[key] = value;
|
|
1962
|
+
});
|
|
1963
|
+
return cookieObject;
|
|
1964
|
+
};
|
|
1965
|
+
AgroCookieUtils.prototype.setCookie = function (name, value, days) {
|
|
1966
|
+
var date = new Date();
|
|
1967
|
+
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
|
|
1968
|
+
var expires = 'expires=' + date.toUTCString();
|
|
1969
|
+
document.cookie = name + '=' + value + ';' + expires + ';path=/';
|
|
1970
|
+
};
|
|
1971
|
+
return AgroCookieUtils;
|
|
1972
|
+
}());
|
|
1973
|
+
|
|
1974
|
+
var AgroDateUtils = /** @class */ (function () {
|
|
1975
|
+
function AgroDateUtils() {
|
|
1976
|
+
}
|
|
1977
|
+
/**
|
|
1978
|
+
* Verifica se uma data é nula ou indefinida.
|
|
1979
|
+
* @param date - A data a ser verificada.
|
|
1980
|
+
* @returns True se a data for nula ou indefinida, false caso contrário.
|
|
1981
|
+
*/
|
|
1982
|
+
AgroDateUtils.isNullOrUndefined = function (date) {
|
|
1983
|
+
return date === null || date === undefined;
|
|
1984
|
+
};
|
|
1985
|
+
/**
|
|
1986
|
+
* Verifica se uma data não é nula e não é indefinida.
|
|
1987
|
+
* @param date - A data a ser verificada.
|
|
1988
|
+
* @returns True se a data não for nula e não for indefinida, false caso contrário.
|
|
1989
|
+
*/
|
|
1990
|
+
AgroDateUtils.isNotNullOrUndefined = function (date) {
|
|
1991
|
+
return !AgroDateUtils.isNullOrUndefined(date);
|
|
1992
|
+
};
|
|
1993
|
+
/**
|
|
1994
|
+
* Verifica se uma data é válida.
|
|
1995
|
+
* @param date - A data a ser verificada.
|
|
1996
|
+
* @returns True se a data for válida, false caso contrário.
|
|
1997
|
+
*/
|
|
1998
|
+
AgroDateUtils.isValid = function (date) {
|
|
1999
|
+
return !isNaN(Date.parse(date));
|
|
2000
|
+
};
|
|
2001
|
+
/**
|
|
2002
|
+
* Verifica se uma data é inválida.
|
|
2003
|
+
* @param date - A data a ser verificada.
|
|
2004
|
+
* @returns True se a data for inválida, false caso contrário.
|
|
2005
|
+
*/
|
|
2006
|
+
AgroDateUtils.isInvalid = function (date) {
|
|
2007
|
+
return !AgroDateUtils.isValid(date);
|
|
2008
|
+
};
|
|
1631
2009
|
/**
|
|
1632
2010
|
* Verifica se uma data é antes de outra data.
|
|
1633
2011
|
* @param date - A data a ser verificada.
|
|
@@ -1713,157 +2091,6 @@
|
|
|
1713
2091
|
return AgroDateUtils;
|
|
1714
2092
|
}());
|
|
1715
2093
|
|
|
1716
|
-
var AGRO_REGEX = {
|
|
1717
|
-
/**
|
|
1718
|
-
* Validação de E-mail
|
|
1719
|
-
*/
|
|
1720
|
-
isEmail: /^[^\s@]+@[^\s@]+\.[^\s@]+$/,
|
|
1721
|
-
/**
|
|
1722
|
-
* Validação de Números Inteiros Positivos
|
|
1723
|
-
*/
|
|
1724
|
-
positiveInteger: /^[1-9]\d*$/,
|
|
1725
|
-
/**
|
|
1726
|
-
* Validação de Números Decimais Positivos
|
|
1727
|
-
*/
|
|
1728
|
-
positiveDecimal: /^\d*\.?\d+$/,
|
|
1729
|
-
/**
|
|
1730
|
-
* Validação de string que consiste apenas em espaços em branco ou está vazia.
|
|
1731
|
-
*/
|
|
1732
|
-
onlyBlankSpaces: /^\s*$/,
|
|
1733
|
-
/**
|
|
1734
|
-
* Validação de CEP (Código Postal)
|
|
1735
|
-
*/
|
|
1736
|
-
zipCode: /^\d{8}$|^\d{5}-\d{3}$/,
|
|
1737
|
-
/**
|
|
1738
|
-
* Validação de String (qualquer caractere)
|
|
1739
|
-
*/
|
|
1740
|
-
isString: /^[\s\S]*$/,
|
|
1741
|
-
/**
|
|
1742
|
-
* Validação de UUID
|
|
1743
|
-
*/
|
|
1744
|
-
isUUID: /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$/,
|
|
1745
|
-
/**
|
|
1746
|
-
* Validação de Número
|
|
1747
|
-
*/
|
|
1748
|
-
isNumber: /^-?\d+$/,
|
|
1749
|
-
/**
|
|
1750
|
-
* Validação de Número Decimal
|
|
1751
|
-
*/
|
|
1752
|
-
isDecimal: /^\d*\.?\d+$/,
|
|
1753
|
-
/**
|
|
1754
|
-
* Validação de Placa de Veículo
|
|
1755
|
-
*/
|
|
1756
|
-
isLicensePlate: /^[A-Za-z0-9]{1,7}-?[A-Za-z0-9]{1,7}$/,
|
|
1757
|
-
/**
|
|
1758
|
-
* Validação de Placa de veículo padrão mercosul
|
|
1759
|
-
*/
|
|
1760
|
-
isMercosulLicensePlate: /^[A-Z]{3}\d[A-Z]\d{2}$/,
|
|
1761
|
-
/**
|
|
1762
|
-
* Validação de Placa de veículo padrão antigo AAA-1234
|
|
1763
|
-
*/
|
|
1764
|
-
isOldLicensePlate: /^[A-Z]{3}-?\d{4}$/,
|
|
1765
|
-
/**
|
|
1766
|
-
* Validação de Número de Telefone
|
|
1767
|
-
*/
|
|
1768
|
-
isPhoneNumber: /^\+?\d{1,4}-?\d{6,11}$/,
|
|
1769
|
-
/**
|
|
1770
|
-
* Validação de Data (Formato YYYY-MM-DD)
|
|
1771
|
-
*/
|
|
1772
|
-
isDate: /^\d{4}-\d{2}-\d{2}$/,
|
|
1773
|
-
/**
|
|
1774
|
-
* Validação de Hora (Formato HH:mm)
|
|
1775
|
-
*/
|
|
1776
|
-
isTime: /^(0\d|1\d|2[0-3]):[0-5]\d$/,
|
|
1777
|
-
/**
|
|
1778
|
-
* Validação de Data e Hora (Formato YYYY-MM-DD HH:mm)
|
|
1779
|
-
*/
|
|
1780
|
-
isDateTime: /^\d{4}-\d{2}-\d{2} (0\d|1\d|2[0-3]):[0-5]\d$/,
|
|
1781
|
-
/**
|
|
1782
|
-
* Validação de URL
|
|
1783
|
-
*/
|
|
1784
|
-
isURL: /^(http|https):\/\/([\w-]+\.)+[\w-]+(\/[\w- ./?%&=]*)?$/,
|
|
1785
|
-
/**
|
|
1786
|
-
* Validação de Número Hexadecimal
|
|
1787
|
-
*/
|
|
1788
|
-
isHexNumber: /^[0-9a-fA-F]+$/,
|
|
1789
|
-
/**
|
|
1790
|
-
* Validação de Base64
|
|
1791
|
-
*/
|
|
1792
|
-
isBase64: /^[a-zA-Z0-9+/]+={0,2}$/,
|
|
1793
|
-
/**
|
|
1794
|
-
* Validação de Nome de Usuário (3 a 20 caracteres alfanuméricos)
|
|
1795
|
-
*/
|
|
1796
|
-
isUsername: /^\w{3,20}$/,
|
|
1797
|
-
/**
|
|
1798
|
-
* Validação de Alfanumérico
|
|
1799
|
-
*/
|
|
1800
|
-
isAlphanumeric: /^[a-zA-Z0-9]+$/,
|
|
1801
|
-
/**
|
|
1802
|
-
* Validação de Slug (letras minúsculas, números e traços)
|
|
1803
|
-
*/
|
|
1804
|
-
isSlug: /^[a-z0-9-]+$/,
|
|
1805
|
-
/**
|
|
1806
|
-
* Validação de Número de Cartão de Crédito
|
|
1807
|
-
*/
|
|
1808
|
-
isCreditCard: /^\d{4}-\d{4}-\d{4}-\d{4}$/,
|
|
1809
|
-
/**
|
|
1810
|
-
* Validação de Número Hexadecimal
|
|
1811
|
-
*/
|
|
1812
|
-
isHexadecimal: /^[0-9a-fA-F]+$/,
|
|
1813
|
-
/**
|
|
1814
|
-
* Validação de Moeda
|
|
1815
|
-
*/
|
|
1816
|
-
isCurrency: /^\d+(\.\d{1,2})?$/,
|
|
1817
|
-
/**
|
|
1818
|
-
* Validação de Porcentagem
|
|
1819
|
-
*/
|
|
1820
|
-
isPercentage: /^(100(\.0{1,2})?|[1-9]?\d(\.\d{1,2})?)$/,
|
|
1821
|
-
/**
|
|
1822
|
-
* Validação de Tag HTML Simples
|
|
1823
|
-
*/
|
|
1824
|
-
isHTMLTag: /^<([a-z]+)([^<]+)*(?:>(.*)<\/\1>|\s+\/>)$/,
|
|
1825
|
-
/**
|
|
1826
|
-
* Validação de Nome de Usuário com Espaços (3 a 20 caracteres alfanuméricos e espaços)
|
|
1827
|
-
*/
|
|
1828
|
-
isUsernameWithSpaces: /^[a-zA-Z0-9_ ]{3,20}$/,
|
|
1829
|
-
/**
|
|
1830
|
-
* Validação de Senha Forte (mínimo 8 caracteres, uma letra minúscula, uma letra maiúscula, um número e um caractere especial)
|
|
1831
|
-
*/
|
|
1832
|
-
isStrongPassword: /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$/,
|
|
1833
|
-
/**
|
|
1834
|
-
* Validação de String Alfabética
|
|
1835
|
-
*/
|
|
1836
|
-
isAlphabetic: /^[a-zA-Z]+$/,
|
|
1837
|
-
/**
|
|
1838
|
-
* Validação de Hora no Formato de 12 Horas
|
|
1839
|
-
*/
|
|
1840
|
-
isTime12Hour: /^(0?[1-9]|1[0-2]):\d{2} (AM|PM)$/i,
|
|
1841
|
-
/**
|
|
1842
|
-
* Validação de Latitude
|
|
1843
|
-
*/
|
|
1844
|
-
isLatitude: /^[-+]?([1-8]?\d(\.\d+)?|90(\.0+)?)$/,
|
|
1845
|
-
/**
|
|
1846
|
-
* Validação de Longitude
|
|
1847
|
-
*/
|
|
1848
|
-
isLongitude: /^[-+]?(180(\.0+)?|((1[0-7]\d)|([1-9]?\d))(\.\d+)?)$/,
|
|
1849
|
-
/**
|
|
1850
|
-
* Validação de Endereço MAC
|
|
1851
|
-
*/
|
|
1852
|
-
isMACAddress: /^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$/,
|
|
1853
|
-
/**
|
|
1854
|
-
* Validação de Data de Expiração de Cartão de Crédito
|
|
1855
|
-
*/
|
|
1856
|
-
isCreditCardExpiration: /^(0[1-9]|1[0-2])\/\d{2}$/,
|
|
1857
|
-
/**
|
|
1858
|
-
* Validação de Número de Seguro Social (SSN)
|
|
1859
|
-
*/
|
|
1860
|
-
isSSN: /^\d{3}-\d{2}-\d{4}$/,
|
|
1861
|
-
/**
|
|
1862
|
-
* Validação se todos os dígitos são iguais
|
|
1863
|
-
*/
|
|
1864
|
-
isAllDigitsEqual: /^(.)\1+$/,
|
|
1865
|
-
};
|
|
1866
|
-
|
|
1867
2094
|
/**
|
|
1868
2095
|
* Classe utilitária para operações de string.
|
|
1869
2096
|
*/
|
|
@@ -2116,31 +2343,70 @@
|
|
|
2116
2343
|
return matches ? matches.length : exports.AGRO_NUMBERS.ZERO;
|
|
2117
2344
|
};
|
|
2118
2345
|
AgroStringUtils.validateCPF = function (cpf) {
|
|
2346
|
+
// Remover caracteres não numéricos
|
|
2119
2347
|
cpf = cpf.replace(/\D/g, "");
|
|
2120
|
-
|
|
2348
|
+
// Verificar se o CPF tem 11 dígitos
|
|
2349
|
+
if (cpf.length !== exports.AGRO_NUMBERS.ELEVEN) {
|
|
2121
2350
|
return false;
|
|
2122
2351
|
}
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2352
|
+
// Verificar se todos os dígitos são iguais (caso contrário, é um sinal de CPF inválido)
|
|
2353
|
+
if (/^(\d)\1{10}$/.test(cpf)) {
|
|
2354
|
+
return false;
|
|
2355
|
+
}
|
|
2356
|
+
// Calcular o primeiro dígito verificador
|
|
2357
|
+
var sum = exports.AGRO_NUMBERS.ZERO;
|
|
2358
|
+
var remainder;
|
|
2359
|
+
for (var i = exports.AGRO_NUMBERS.ONE; i <= exports.AGRO_NUMBERS.NINE; i++) {
|
|
2360
|
+
sum += parseInt(cpf[i - exports.AGRO_NUMBERS.ONE]) * (exports.AGRO_NUMBERS.ELEVEN - i);
|
|
2361
|
+
}
|
|
2362
|
+
remainder = sum % exports.AGRO_NUMBERS.ELEVEN;
|
|
2363
|
+
if (remainder === exports.AGRO_NUMBERS.TEN || remainder === exports.AGRO_NUMBERS.ELEVEN) {
|
|
2364
|
+
remainder = exports.AGRO_NUMBERS.ZERO;
|
|
2365
|
+
}
|
|
2366
|
+
if (remainder !== parseInt(cpf[exports.AGRO_NUMBERS.NINE])) {
|
|
2367
|
+
return false;
|
|
2368
|
+
}
|
|
2369
|
+
// Calcular o segundo dígito verificador
|
|
2370
|
+
sum = exports.AGRO_NUMBERS.ZERO;
|
|
2371
|
+
for (var i = exports.AGRO_NUMBERS.ONE; i <= exports.AGRO_NUMBERS.TEN; i++) {
|
|
2372
|
+
sum += parseInt(cpf[i - exports.AGRO_NUMBERS.ONE]) * (exports.AGRO_NUMBERS.TWELVE - i);
|
|
2373
|
+
}
|
|
2374
|
+
remainder = sum % exports.AGRO_NUMBERS.ELEVEN;
|
|
2375
|
+
if (remainder === exports.AGRO_NUMBERS.TEN || remainder === exports.AGRO_NUMBERS.ELEVEN) {
|
|
2376
|
+
remainder = exports.AGRO_NUMBERS.ZERO;
|
|
2377
|
+
}
|
|
2378
|
+
if (remainder !== parseInt(cpf[exports.AGRO_NUMBERS.TEN])) {
|
|
2379
|
+
return false;
|
|
2380
|
+
}
|
|
2381
|
+
return true;
|
|
2132
2382
|
};
|
|
2133
2383
|
AgroStringUtils.validateCNPJ = function (cnpj) {
|
|
2384
|
+
// Remove todos os caracteres não numéricos
|
|
2134
2385
|
cnpj = cnpj.replace(/\D/g, "");
|
|
2135
|
-
|
|
2386
|
+
// Verifica se tem 14 dígitos
|
|
2387
|
+
if (cnpj.length !== 14)
|
|
2136
2388
|
return false;
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2389
|
+
// Verifica se o CNPJ é uma sequência repetida (ex: 11111111111111, 22222222222222, etc.)
|
|
2390
|
+
if (/^(\d)\1{13}$/.test(cnpj))
|
|
2391
|
+
return false;
|
|
2392
|
+
// Cálculo do primeiro dígito verificador
|
|
2393
|
+
var soma = 0;
|
|
2394
|
+
var pesos1 = [5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2];
|
|
2395
|
+
for (var i = 0; i < 12; i++) {
|
|
2396
|
+
soma += parseInt(cnpj.charAt(i)) * pesos1[i];
|
|
2397
|
+
}
|
|
2398
|
+
var resto = soma % 11;
|
|
2399
|
+
var digito1 = resto < 2 ? 0 : 11 - resto;
|
|
2400
|
+
// Cálculo do segundo dígito verificador
|
|
2401
|
+
soma = 0;
|
|
2402
|
+
var pesos2 = [6, 5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2];
|
|
2403
|
+
for (var i = 0; i < 13; i++) {
|
|
2404
|
+
soma += parseInt(cnpj.charAt(i)) * pesos2[i];
|
|
2405
|
+
}
|
|
2406
|
+
resto = soma % 11;
|
|
2407
|
+
var digito2 = resto < 2 ? 0 : 11 - resto;
|
|
2408
|
+
// Verifica se os dígitos verificadores são válidos
|
|
2409
|
+
return parseInt(cnpj.charAt(12)) === digito1 && parseInt(cnpj.charAt(13)) === digito2;
|
|
2144
2410
|
};
|
|
2145
2411
|
/**
|
|
2146
2412
|
* Método para aplicar uma máscara em uma string. Considere a máscara com valores 9 para aplicação
|
|
@@ -2195,29 +2461,10 @@
|
|
|
2195
2461
|
/**
|
|
2196
2462
|
* Verifica se uma string é inválida.
|
|
2197
2463
|
* @param str - A string a ser verificada.
|
|
2198
|
-
* @returns True se a string for inválida, false caso contrário.
|
|
2199
|
-
*/
|
|
2200
|
-
AgroStringUtils.isInvalid = function (str) {
|
|
2201
|
-
return !AgroStringUtils.isValid(str);
|
|
2202
|
-
};
|
|
2203
|
-
/**
|
|
2204
|
-
* Valida se uma string é um e-mail válido ou não
|
|
2205
|
-
* Retorna um booleano para indicar se é um e-mail válido ou não
|
|
2206
|
-
* @param email - A string a ser verificada
|
|
2207
|
-
* @returns True se a string for um e-mail válido, false caso contrário
|
|
2208
|
-
*/
|
|
2209
|
-
AgroStringUtils.isValidEmail = function (email) {
|
|
2210
|
-
return AGRO_REGEX.isEmail.test(email);
|
|
2211
|
-
};
|
|
2212
|
-
/**
|
|
2213
|
-
* Valida se uma string é uma placa de veículo BR válida ou não.
|
|
2214
|
-
* Retorna um booleano para indicar se é uma placa válida ou não.
|
|
2215
|
-
* @param plate - A string a ser verificada
|
|
2464
|
+
* @returns True se a string for inválida, false caso contrário.
|
|
2216
2465
|
*/
|
|
2217
|
-
AgroStringUtils.
|
|
2218
|
-
|
|
2219
|
-
var mercosulFormat = /^[A-Z]{3}\d[A-Z]\d{2}$/;
|
|
2220
|
-
return oldFormat.test(plate) || mercosulFormat.test(plate);
|
|
2466
|
+
AgroStringUtils.isInvalid = function (str) {
|
|
2467
|
+
return !AgroStringUtils.isValid(str);
|
|
2221
2468
|
};
|
|
2222
2469
|
return AgroStringUtils;
|
|
2223
2470
|
}());
|
|
@@ -2264,11 +2511,10 @@
|
|
|
2264
2511
|
*/
|
|
2265
2512
|
AgroPlatformUtils.getCurrentUserName = function () {
|
|
2266
2513
|
var _a;
|
|
2267
|
-
var cookie = AgroCookieUtils.getCookie('com.senior.token'
|
|
2514
|
+
var cookie = AgroCookieUtils.getCookie('com.senior.token');
|
|
2268
2515
|
if (cookie) {
|
|
2269
|
-
var str = (_a =
|
|
2516
|
+
var str = (_a = AgroCookieUtils.parseCookieToObject(cookie)) === null || _a === void 0 ? void 0 : _a.fullName;
|
|
2270
2517
|
if (str) {
|
|
2271
|
-
str = str.replace(/\+/g, ' ');
|
|
2272
2518
|
return str;
|
|
2273
2519
|
}
|
|
2274
2520
|
}
|
|
@@ -2281,9 +2527,9 @@
|
|
|
2281
2527
|
*/
|
|
2282
2528
|
AgroPlatformUtils.getCurrentUserEmail = function () {
|
|
2283
2529
|
var _a;
|
|
2284
|
-
var cookie = AgroCookieUtils.getCookie('com.senior.token'
|
|
2530
|
+
var cookie = AgroCookieUtils.getCookie('com.senior.token');
|
|
2285
2531
|
if (cookie) {
|
|
2286
|
-
var str = (_a =
|
|
2532
|
+
var str = (_a = AgroCookieUtils.parseCookieToObject(cookie)) === null || _a === void 0 ? void 0 : _a.email;
|
|
2287
2533
|
if (str) {
|
|
2288
2534
|
return str;
|
|
2289
2535
|
}
|
|
@@ -2606,293 +2852,51 @@
|
|
|
2606
2852
|
array.splice(index, 1);
|
|
2607
2853
|
}
|
|
2608
2854
|
};
|
|
2609
|
-
/**
|
|
2610
|
-
* Remove um item de um array por índice.
|
|
2611
|
-
* @param array Array de onde o item será removido.
|
|
2612
|
-
* @param index Índice do item a ser removido.
|
|
2613
|
-
*/
|
|
2614
|
-
AgroArrayUtils.removeItemByIndex = function (array, index) {
|
|
2615
|
-
array.splice(index, 1);
|
|
2616
|
-
};
|
|
2617
|
-
/**
|
|
2618
|
-
* Remove todos os itens de um array.
|
|
2619
|
-
* @param array Array de onde os itens serão removidos.
|
|
2620
|
-
*/
|
|
2621
|
-
AgroArrayUtils.removeAllItems = function (array) {
|
|
2622
|
-
array.splice(0, array.length);
|
|
2623
|
-
};
|
|
2624
|
-
/**
|
|
2625
|
-
* Verifica se um array é vazio.
|
|
2626
|
-
* @param array Array a ser verificado.
|
|
2627
|
-
*/
|
|
2628
|
-
AgroArrayUtils.isEmpty = function (array) {
|
|
2629
|
-
return AgroArrayUtils.isArray(array) && array.length === 0;
|
|
2630
|
-
};
|
|
2631
|
-
/**
|
|
2632
|
-
* Localiza um item em um array de objetos de acordo com a propriedade e valor informados.
|
|
2633
|
-
*/
|
|
2634
|
-
AgroArrayUtils.findItemByProperty = function (array, property, value) {
|
|
2635
|
-
var e_1, _a;
|
|
2636
|
-
try {
|
|
2637
|
-
for (var array_1 = __values(array), array_1_1 = array_1.next(); !array_1_1.done; array_1_1 = array_1.next()) {
|
|
2638
|
-
var item = array_1_1.value;
|
|
2639
|
-
if (item[property] === value) {
|
|
2640
|
-
return item;
|
|
2641
|
-
}
|
|
2642
|
-
}
|
|
2643
|
-
}
|
|
2644
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
2645
|
-
finally {
|
|
2646
|
-
try {
|
|
2647
|
-
if (array_1_1 && !array_1_1.done && (_a = array_1.return)) _a.call(array_1);
|
|
2648
|
-
}
|
|
2649
|
-
finally { if (e_1) throw e_1.error; }
|
|
2650
|
-
}
|
|
2651
|
-
return null;
|
|
2652
|
-
};
|
|
2653
|
-
return AgroArrayUtils;
|
|
2654
|
-
}());
|
|
2655
|
-
|
|
2656
|
-
var AgroFormValidator = /** @class */ (function () {
|
|
2657
|
-
function AgroFormValidator() {
|
|
2658
|
-
}
|
|
2659
|
-
/**
|
|
2660
|
-
* Validator para checar se o campo é um e-mail
|
|
2661
|
-
*
|
|
2662
|
-
* @example
|
|
2663
|
-
* this.myForm = this.fb.group({
|
|
2664
|
-
* EMAIL_FIELD: ['', [Validators.required, AgroFormValidator.emailValidator]]
|
|
2665
|
-
* });
|
|
2666
|
-
* @param control
|
|
2667
|
-
* @returns
|
|
2668
|
-
*/
|
|
2669
|
-
AgroFormValidator.emailValidator = function (control) {
|
|
2670
|
-
var email = control.value;
|
|
2671
|
-
if (!email) {
|
|
2672
|
-
return null;
|
|
2673
|
-
}
|
|
2674
|
-
return AgroStringUtils.isValidEmail(email) ? null : { emailValidator: true };
|
|
2675
|
-
};
|
|
2676
|
-
/**
|
|
2677
|
-
* Aplique esse validador em um campo do tipo Date, para verificar se a data selecionada é maior ou menor que a data atual.
|
|
2678
|
-
*
|
|
2679
|
-
* Utilize o parâmetro comparisonType para definir se a data selecionada deve ser maior ou menor que a data atual.
|
|
2680
|
-
* A validação será através do enum DateComparisonType.
|
|
2681
|
-
*
|
|
2682
|
-
* @example
|
|
2683
|
-
* this.myForm = this.fb.group({
|
|
2684
|
-
* NOME_CAMPO: ['', [Validators.required, AgroFormValidator.compareDateWithToday(DateComparisonType.greatherThan)]]
|
|
2685
|
-
* });
|
|
2686
|
-
* @param comparisonType
|
|
2687
|
-
* @returns
|
|
2688
|
-
*/
|
|
2689
|
-
AgroFormValidator.compareDateWithToday = function (comparisonType) {
|
|
2690
|
-
var compareDate = function (control) {
|
|
2691
|
-
var _a, _b;
|
|
2692
|
-
var methodName = 'dateComparisonToday';
|
|
2693
|
-
var selectedDate = new Date(control.value);
|
|
2694
|
-
var currentDate = new Date();
|
|
2695
|
-
var conditions = (_a = {},
|
|
2696
|
-
_a[exports.DateComparisonType.greatherThan] = selectedDate <= currentDate,
|
|
2697
|
-
_a[exports.DateComparisonType.lessThan] = selectedDate >= currentDate,
|
|
2698
|
-
_a);
|
|
2699
|
-
if (conditions[comparisonType]) {
|
|
2700
|
-
return _b = {}, _b[methodName] = { value: control.value }, _b;
|
|
2701
|
-
}
|
|
2702
|
-
return null;
|
|
2703
|
-
};
|
|
2704
|
-
return compareDate;
|
|
2705
|
-
};
|
|
2706
|
-
/**
|
|
2707
|
-
* Compara dois campos do tipo Date, verificando se o campo A é maior que o campo B. Se A for maior que B, então
|
|
2708
|
-
* o campo A é invalidado. Caso contrário, o campo A é validado.
|
|
2709
|
-
*
|
|
2710
|
-
* Aplique esse campo no FormGroup, passando os nomes dos campos que deseja comparar.
|
|
2711
|
-
* @example
|
|
2712
|
-
* this.myForm = this.fb.group({
|
|
2713
|
-
NOME_CAMPO_dateA: ['', Validators.required],
|
|
2714
|
-
NOME_CAMPO_dateB: ['', Validators.required]
|
|
2715
|
-
}, { validator: AgroFormValidator.dateComparisonValidator('NOME_CAMPO_dateA', 'NOME_CAMPO_dateB') });
|
|
2716
|
-
* @param controlNameA
|
|
2717
|
-
* @param controlNameB
|
|
2718
|
-
* @returns
|
|
2719
|
-
*/
|
|
2720
|
-
AgroFormValidator.compareDateWithOtherDateField = function (controlNameA, controlNameB) {
|
|
2721
|
-
var compareDate = function (control) {
|
|
2722
|
-
var _a, _b;
|
|
2723
|
-
var _c, _d, _e, _f, _g;
|
|
2724
|
-
var formGroup = control;
|
|
2725
|
-
var dateA = (_c = formGroup.get(controlNameA)) === null || _c === void 0 ? void 0 : _c.value;
|
|
2726
|
-
var dateB = (_d = formGroup.get(controlNameB)) === null || _d === void 0 ? void 0 : _d.value;
|
|
2727
|
-
var methodName = 'compareDateWithOtherDateField';
|
|
2728
|
-
if (dateA && dateB) {
|
|
2729
|
-
var dateAObj = new Date(dateA);
|
|
2730
|
-
var dateBObj = new Date(dateB);
|
|
2731
|
-
if (dateAObj < dateBObj) {
|
|
2732
|
-
(_e = formGroup.get(controlNameA)) === null || _e === void 0 ? void 0 : _e.setErrors((_a = {}, _a[methodName] = true, _a));
|
|
2733
|
-
return _b = {}, _b[methodName] = true, _b;
|
|
2734
|
-
}
|
|
2735
|
-
else if ((_f = formGroup.get(controlNameA)) === null || _f === void 0 ? void 0 : _f.hasError(methodName)) {
|
|
2736
|
-
(_g = formGroup.get(controlNameA)) === null || _g === void 0 ? void 0 : _g.setErrors(null);
|
|
2737
|
-
}
|
|
2738
|
-
}
|
|
2739
|
-
return null;
|
|
2740
|
-
};
|
|
2741
|
-
return compareDate;
|
|
2742
|
-
};
|
|
2743
|
-
/**
|
|
2744
|
-
* Validator para checar se um campo de números é maior ou menor que outro campo.
|
|
2745
|
-
*
|
|
2746
|
-
* Aplique esse validator no FormGroup, passando os nomes dos campos que deseja comparar.
|
|
2747
|
-
* @example
|
|
2748
|
-
* this.myForm = this.fb.group({
|
|
2749
|
-
* NUMERO_A: ['', Validators.required],
|
|
2750
|
-
* NUMERO_B: ['', Validators.required]
|
|
2751
|
-
* }, { validator: AgroFormValidator.compareNumberFields('NUMERO_A', 'NUMERO_B', NumberComparisonType.EQUALS) });
|
|
2752
|
-
*
|
|
2753
|
-
* Neste caso, a verificação será se o NUMERO_A é igual ao NUMERB_B.
|
|
2754
|
-
* @param controlNameA
|
|
2755
|
-
* @param controlNameB
|
|
2756
|
-
* @returns
|
|
2757
|
-
*/
|
|
2758
|
-
AgroFormValidator.compareNumberFields = function (controlNameA, controlNameB, comparisonMethod) {
|
|
2759
|
-
var compareNumber = function (control) {
|
|
2760
|
-
var _a, _b, _c;
|
|
2761
|
-
var _d, _e, _f;
|
|
2762
|
-
var formGroup = control;
|
|
2763
|
-
var numberA = (_d = formGroup.get(controlNameA)) === null || _d === void 0 ? void 0 : _d.value;
|
|
2764
|
-
var numberB = (_e = formGroup.get(controlNameB)) === null || _e === void 0 ? void 0 : _e.value;
|
|
2765
|
-
var methodName = 'compareNumberFields';
|
|
2766
|
-
if (numberA && numberB) {
|
|
2767
|
-
var errorType = exports.NumberComparisonType[comparisonMethod];
|
|
2768
|
-
var errorCondition = (_a = {},
|
|
2769
|
-
_a[exports.NumberComparisonType.EQUALS] = numberA !== numberB,
|
|
2770
|
-
_a[exports.NumberComparisonType.GREATER_THAN] = numberA <= numberB,
|
|
2771
|
-
_a[exports.NumberComparisonType.LESS_THAN] = numberA >= numberB,
|
|
2772
|
-
_a[exports.NumberComparisonType.GREATER_THAN_OR_EQUAL] = numberA < numberB,
|
|
2773
|
-
_a[exports.NumberComparisonType.LESS_THAN_OR_EQUAL] = numberA > numberB,
|
|
2774
|
-
_a[exports.NumberComparisonType.NOT_EQUALS] = numberA === numberB,
|
|
2775
|
-
_a);
|
|
2776
|
-
if (errorCondition[comparisonMethod]) {
|
|
2777
|
-
var controlA = formGroup.get(controlNameA);
|
|
2778
|
-
if (controlA) {
|
|
2779
|
-
controlA.setErrors((_b = {}, _b[methodName] = comparisonMethod, _b));
|
|
2780
|
-
}
|
|
2781
|
-
return _c = {}, _c[methodName] = errorType, _c;
|
|
2782
|
-
}
|
|
2783
|
-
else if ((_f = formGroup.get(controlNameA)) === null || _f === void 0 ? void 0 : _f.hasError(methodName)) {
|
|
2784
|
-
var controlA = formGroup.get(controlNameA);
|
|
2785
|
-
if (controlA) {
|
|
2786
|
-
controlA.setErrors(null);
|
|
2787
|
-
}
|
|
2788
|
-
}
|
|
2789
|
-
}
|
|
2790
|
-
return null;
|
|
2791
|
-
};
|
|
2792
|
-
return compareNumber;
|
|
2793
|
-
};
|
|
2794
|
-
/**
|
|
2795
|
-
* Validator para checar se um valor está entre os demais valores de três formControls.
|
|
2796
|
-
*
|
|
2797
|
-
* Aplique esse validator no FormGroup, passando os nomes dos três formControls que deseja comparar.
|
|
2798
|
-
* @example
|
|
2799
|
-
* this.myForm = this.fb.group({
|
|
2800
|
-
* minorFormControl: ['', Validators.required],
|
|
2801
|
-
* targetFormControl: ['', Validators.required],
|
|
2802
|
-
* majorFormControl: ['', Validators.required]
|
|
2803
|
-
* }, { validator: AgroFormValidator.checkValueBetween('minorFormControl', 'targetFormControl', 'majorFormControl') });
|
|
2804
|
-
*
|
|
2805
|
-
* Neste caso, a verificação será se o targetFormControl está entre o minorFormControl e o majorFormControl.
|
|
2806
|
-
* @param minorFormControl
|
|
2807
|
-
* @param targetFormControl
|
|
2808
|
-
* @param majorFormControl
|
|
2809
|
-
* @returns
|
|
2810
|
-
*/
|
|
2811
|
-
AgroFormValidator.checkValueBetween = function (minorFormControl, targetFormControl, majorFormControl) {
|
|
2812
|
-
var checkValue = function (control) {
|
|
2813
|
-
var _a, _b;
|
|
2814
|
-
var _c, _d, _e, _f;
|
|
2815
|
-
var formGroup = control;
|
|
2816
|
-
var valueA = (_c = formGroup.get(minorFormControl)) === null || _c === void 0 ? void 0 : _c.value;
|
|
2817
|
-
var valueB = (_d = formGroup.get(targetFormControl)) === null || _d === void 0 ? void 0 : _d.value;
|
|
2818
|
-
var valueC = (_e = formGroup.get(majorFormControl)) === null || _e === void 0 ? void 0 : _e.value;
|
|
2819
|
-
var methodName = 'checkValueBetween';
|
|
2820
|
-
if (valueA && valueB && valueC) {
|
|
2821
|
-
if (valueB < valueA || valueB > valueC) {
|
|
2822
|
-
var targetControl = formGroup.get(targetFormControl);
|
|
2823
|
-
if (targetControl) {
|
|
2824
|
-
targetControl.setErrors((_a = {}, _a[methodName] = true, _a));
|
|
2825
|
-
}
|
|
2826
|
-
return _b = {}, _b[methodName] = true, _b;
|
|
2827
|
-
}
|
|
2828
|
-
else if ((_f = formGroup.get(targetFormControl)) === null || _f === void 0 ? void 0 : _f.hasError(methodName)) {
|
|
2829
|
-
var targetControl = formGroup.get(targetFormControl);
|
|
2830
|
-
if (targetControl) {
|
|
2831
|
-
targetControl.setErrors(null);
|
|
2832
|
-
}
|
|
2833
|
-
}
|
|
2834
|
-
}
|
|
2835
|
-
return null;
|
|
2836
|
-
};
|
|
2837
|
-
return checkValue;
|
|
2838
|
-
};
|
|
2839
|
-
/**
|
|
2840
|
-
* Validator para checar se o campo é um objeto e se possui uma propriedade específica.
|
|
2841
|
-
*
|
|
2842
|
-
* @example
|
|
2843
|
-
* this.myForm = this.fb.group({
|
|
2844
|
-
* OBJETO_FIELD: ['', [Validators.required, AgroFormValidator.objectPropertyValidator('propriedade')]]
|
|
2845
|
-
* });
|
|
2846
|
-
* @param propertyName
|
|
2847
|
-
* @returns
|
|
2848
|
-
*/
|
|
2849
|
-
AgroFormValidator.objectPropertyValidator = function (propertyName) {
|
|
2850
|
-
var objectProperty = function (control) {
|
|
2851
|
-
var _a, _b;
|
|
2852
|
-
var methodName = 'objectProperty';
|
|
2853
|
-
if (AgroObjectUtils.isObject(control.value) && AgroObjectUtils.containsProperty(control.value, propertyName)) {
|
|
2854
|
-
control.setErrors(null);
|
|
2855
|
-
return null;
|
|
2856
|
-
}
|
|
2857
|
-
control.setErrors((_a = {}, _a[methodName] = true, _a));
|
|
2858
|
-
return _b = {}, _b[methodName] = true, _b;
|
|
2859
|
-
};
|
|
2860
|
-
return objectProperty;
|
|
2855
|
+
/**
|
|
2856
|
+
* Remove um item de um array por índice.
|
|
2857
|
+
* @param array Array de onde o item será removido.
|
|
2858
|
+
* @param index Índice do item a ser removido.
|
|
2859
|
+
*/
|
|
2860
|
+
AgroArrayUtils.removeItemByIndex = function (array, index) {
|
|
2861
|
+
array.splice(index, 1);
|
|
2861
2862
|
};
|
|
2862
2863
|
/**
|
|
2863
|
-
*
|
|
2864
|
-
*
|
|
2864
|
+
* Remove todos os itens de um array.
|
|
2865
|
+
* @param array Array de onde os itens serão removidos.
|
|
2865
2866
|
*/
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
if (!cpf) {
|
|
2869
|
-
return null;
|
|
2870
|
-
}
|
|
2871
|
-
return AgroStringUtils.validateCPF(cpf) ? null : { cpfValidator: true };
|
|
2867
|
+
AgroArrayUtils.removeAllItems = function (array) {
|
|
2868
|
+
array.splice(0, array.length);
|
|
2872
2869
|
};
|
|
2873
2870
|
/**
|
|
2874
|
-
* Verifica se
|
|
2875
|
-
*
|
|
2871
|
+
* Verifica se um array é vazio.
|
|
2872
|
+
* @param array Array a ser verificado.
|
|
2876
2873
|
*/
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
if (!cnpj) {
|
|
2880
|
-
return null;
|
|
2881
|
-
}
|
|
2882
|
-
return AgroStringUtils.validateCNPJ(cnpj) ? null : { cnpjValidator: true };
|
|
2874
|
+
AgroArrayUtils.isEmpty = function (array) {
|
|
2875
|
+
return AgroArrayUtils.isArray(array) && array.length === 0;
|
|
2883
2876
|
};
|
|
2884
2877
|
/**
|
|
2885
|
-
*
|
|
2886
|
-
* Se a validação for false, retorna um objeto com a chave licensePlate.
|
|
2878
|
+
* Localiza um item em um array de objetos de acordo com a propriedade e valor informados.
|
|
2887
2879
|
*/
|
|
2888
|
-
|
|
2889
|
-
var
|
|
2890
|
-
|
|
2891
|
-
|
|
2880
|
+
AgroArrayUtils.findItemByProperty = function (array, property, value) {
|
|
2881
|
+
var e_1, _a;
|
|
2882
|
+
try {
|
|
2883
|
+
for (var array_1 = __values(array), array_1_1 = array_1.next(); !array_1_1.done; array_1_1 = array_1.next()) {
|
|
2884
|
+
var item = array_1_1.value;
|
|
2885
|
+
if (item[property] === value) {
|
|
2886
|
+
return item;
|
|
2887
|
+
}
|
|
2888
|
+
}
|
|
2889
|
+
}
|
|
2890
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
2891
|
+
finally {
|
|
2892
|
+
try {
|
|
2893
|
+
if (array_1_1 && !array_1_1.done && (_a = array_1.return)) _a.call(array_1);
|
|
2894
|
+
}
|
|
2895
|
+
finally { if (e_1) throw e_1.error; }
|
|
2892
2896
|
}
|
|
2893
|
-
return
|
|
2897
|
+
return null;
|
|
2894
2898
|
};
|
|
2895
|
-
return
|
|
2899
|
+
return AgroArrayUtils;
|
|
2896
2900
|
}());
|
|
2897
2901
|
|
|
2898
2902
|
var AsyncLock = /** @class */ (function () {
|
|
@@ -3475,7 +3479,7 @@
|
|
|
3475
3479
|
"agro.angular_components.ticket": "Ticket",
|
|
3476
3480
|
"agro.angular_components.company": "Empresa",
|
|
3477
3481
|
"agro.angular_components.label_branch": "Filial",
|
|
3478
|
-
"agro.angular_components.event_sidebar_title": "Evento - {
|
|
3482
|
+
"agro.angular_components.event_sidebar_title": "Evento - {event}",
|
|
3479
3483
|
"agro.angular_components.reprocessing_event_message_title": "Reprocessando Evento",
|
|
3480
3484
|
"agro.angular_components.reprocessing_event_message_description": "O evento selecionado está sendo reprocessado.",
|
|
3481
3485
|
"agro.angular_components.error_reprocessing_event_message_title": "Erro ao reprocessar evento",
|
|
@@ -3644,6 +3648,20 @@
|
|
|
3644
3648
|
"agro.angular_components.TRANSFER_CREATE_INCOMING_INVOICE": "Criação da nota fiscal de entrada da transferencia",
|
|
3645
3649
|
"agro.angular_components.TRANSFER_CREATE_OUTGOING_INVOICE": "Criação da nota fiscal de saida da transferencia",
|
|
3646
3650
|
"agro.angular_components.TRANSFER_PRODUCER_BALANCE": "Transferência de saldo entre produtores",
|
|
3651
|
+
"agro.angular_components.control_code": "Identificador",
|
|
3652
|
+
"agro.angular_components.fixation_event": "Fixação",
|
|
3653
|
+
"agro.angular_components.FINISH_FINANCIAL_FIXATION": "Baixa de títulos",
|
|
3654
|
+
"agro.angular_components.FINISH_PRODUCER_NET_VALUE_FIXATION": "Atualização de saldos",
|
|
3655
|
+
"agro.angular_components.CONCLUDE_FIXATION": "Conclusão da fixação",
|
|
3656
|
+
"agro.angular_components.CANCEL_FINANCIAL_FIXATION": "Cancela baixa de títulos",
|
|
3657
|
+
"agro.angular_components.CANCEL_PRODUCER_NET_VALUE_FIXATION": "Reverte atualização de saldos",
|
|
3658
|
+
"agro.angular_components.CANCEL_FIXATION": "Cancela fixação",
|
|
3659
|
+
"agro.angular_components.cancel_fixation_title": "Cancelar fixação",
|
|
3660
|
+
"agro.angular_components.cancel_fixation_description": "Tem certeza que deseja cancelar a fixação?",
|
|
3661
|
+
"agro.angular_components.error_cancel_fixation_message_title": "Erro ao cancelar fixação",
|
|
3662
|
+
"agro.angular_components.error_cancel_fixation_message_description": "Houve um erro ao cancelar a fixação. Tente novamente mais tarde.",
|
|
3663
|
+
"agro.angular_components.cancel_fixation_message_title": "Cancelamento de fixação",
|
|
3664
|
+
"agro.angular_components.cancel_fixation_message_description": "O processo de cancelamento da fixação foi iniciado com sucesso."
|
|
3647
3665
|
};
|
|
3648
3666
|
|
|
3649
3667
|
var enUS = {
|
|
@@ -3672,7 +3690,7 @@
|
|
|
3672
3690
|
"agro.angular_components.balance_entry_control_event": "Balance Entry/Exit",
|
|
3673
3691
|
"agro.angular_components.event_origin_label": "Event origin",
|
|
3674
3692
|
"agro.angular_components.event_details_header": "Event Details",
|
|
3675
|
-
"agro.angular_components.registers_found": "{
|
|
3693
|
+
"agro.angular_components.registers_found": "{total} record(s) found",
|
|
3676
3694
|
"agro.angular_components.change_request_event": "Weight Change",
|
|
3677
3695
|
"agro.angular_components.status_label": "Status",
|
|
3678
3696
|
"agro.angular_components.panel_title_events_completed_successfully": "Success",
|
|
@@ -3680,7 +3698,7 @@
|
|
|
3680
3698
|
"agro.angular_components.ticket": "Ticket",
|
|
3681
3699
|
"agro.angular_components.company": "Company",
|
|
3682
3700
|
"agro.angular_components.label_branch": "Branch",
|
|
3683
|
-
"agro.angular_components.event_sidebar_title": "Event - {
|
|
3701
|
+
"agro.angular_components.event_sidebar_title": "Event - {event}",
|
|
3684
3702
|
"agro.angular_components.reprocessing_event_message_title": "Reprocessing Event",
|
|
3685
3703
|
"agro.angular_components.reprocessing_event_message_description": "The selected event is being reprocessed.",
|
|
3686
3704
|
"agro.angular_components.error_reprocessing_event_message_title": "Error reprocessing event",
|
|
@@ -3849,6 +3867,20 @@
|
|
|
3849
3867
|
"agro.angular_components.TRANSFER_CREATE_INCOMING_INVOICE": "Creation of invoice transfer input",
|
|
3850
3868
|
"agro.angular_components.TRANSFER_CREATE_OUTGOING_INVOICE": "Creation of the outgoing transfer invoice",
|
|
3851
3869
|
"agro.angular_components.TRANSFER_PRODUCER_BALANCE": "Balance transfer between producers",
|
|
3870
|
+
"agro.angular_components.control_code": "Identifier",
|
|
3871
|
+
"agro.angular_components.fixation_event": "Fixation",
|
|
3872
|
+
"agro.angular_components.FINISH_FINANCIAL_FIXATION": "Financial settlement",
|
|
3873
|
+
"agro.angular_components.FINISH_PRODUCER_NET_VALUE_FIXATION": "Balance update",
|
|
3874
|
+
"agro.angular_components.CONCLUDE_FIXATION": "Fixation conclusion",
|
|
3875
|
+
"agro.angular_components.CANCEL_FINANCIAL_FIXATION": "Cancel financial fixation",
|
|
3876
|
+
"agro.angular_components.CANCEL_PRODUCER_NET_VALUE_FIXATION": "Cancel producer net value fixation",
|
|
3877
|
+
"agro.angular_components.CANCEL_FIXATION": "Cancel fixation",
|
|
3878
|
+
"agro.angular_components.cancel_fixation_title": "Cancel fixation",
|
|
3879
|
+
"agro.angular_components.cancel_fixation_description": "Are you sure you want to cancel the fixation?",
|
|
3880
|
+
"agro.angular_components.error_cancel_fixation_message_title": "Error canceling fixation",
|
|
3881
|
+
"agro.angular_components.error_cancel_fixation_message_description": "An error occurred while canceling the fixation. Please try again later.",
|
|
3882
|
+
"agro.angular_components.cancel_fixation_message_title": "Fixation cancellation",
|
|
3883
|
+
"agro.angular_components.cancel_fixation_message_description": "The fixation cancellation process has been successfully initiated."
|
|
3852
3884
|
};
|
|
3853
3885
|
|
|
3854
3886
|
var esCO = {
|
|
@@ -3877,7 +3909,7 @@
|
|
|
3877
3909
|
"agro.angular_components.balance_entry_control_event": "Entrada/salida balanza",
|
|
3878
3910
|
"agro.angular_components.event_origin_label": "Origen del evento",
|
|
3879
3911
|
"agro.angular_components.event_details_header": "Detalles del Evento",
|
|
3880
|
-
"agro.angular_components.registers_found": "{
|
|
3912
|
+
"agro.angular_components.registers_found": "{total} registro(s) encontrado(s)",
|
|
3881
3913
|
"agro.angular_components.change_request_event": "Cambio de Pesaje",
|
|
3882
3914
|
"agro.angular_components.status_label": "Estado",
|
|
3883
3915
|
"agro.angular_components.panel_title_events_completed_successfully": "Éxito",
|
|
@@ -3885,7 +3917,7 @@
|
|
|
3885
3917
|
"agro.angular_components.ticket": "Ticket",
|
|
3886
3918
|
"agro.angular_components.company": "Empresa",
|
|
3887
3919
|
"agro.angular_components.label_branch": "Sucursal",
|
|
3888
|
-
"agro.angular_components.event_sidebar_title": "Evento - {
|
|
3920
|
+
"agro.angular_components.event_sidebar_title": "Evento - {event}",
|
|
3889
3921
|
"agro.angular_components.reprocessing_event_message_title": "Reprocesando Evento",
|
|
3890
3922
|
"agro.angular_components.reprocessing_event_message_description": "El evento seleccionado está siendo reprocesado.",
|
|
3891
3923
|
"agro.angular_components.error_reprocessing_event_message_title": "Error al reprocesar evento",
|
|
@@ -4054,6 +4086,20 @@
|
|
|
4054
4086
|
"agro.angular_components.TRANSFER_CREATE_INCOMING_INVOICE": "Creación de la factura entrante de transferencia",
|
|
4055
4087
|
"agro.angular_components.TRANSFER_CREATE_OUTGOING_INVOICE": "Creación de la factura de transferencia saliente",
|
|
4056
4088
|
"agro.angular_components.TRANSFER_PRODUCER_BALANCE": "Transferir saldo entre productores",
|
|
4089
|
+
"agro.angular_components.control_code": "Identificador",
|
|
4090
|
+
"agro.angular_components.fixation_event": "Fijación",
|
|
4091
|
+
"agro.angular_components.FINISH_FINANCIAL_FIXATION": "Liquidación financiera",
|
|
4092
|
+
"agro.angular_components.FINISH_PRODUCER_NET_VALUE_FIXATION": "Actualización de saldos",
|
|
4093
|
+
"agro.angular_components.CONCLUDE_FIXATION": "Conclusión de la fijación",
|
|
4094
|
+
"agro.angular_components.CANCEL_FINANCIAL_FIXATION": "Cancelar fijación financiera",
|
|
4095
|
+
"agro.angular_components.CANCEL_PRODUCER_NET_VALUE_FIXATION": "Cancelar fijación de valor neto del productor",
|
|
4096
|
+
"agro.angular_components.CANCEL_FIXATION": "Cancelar fijación",
|
|
4097
|
+
"agro.angular_components.cancel_fixation_title": "Cancelar fijación",
|
|
4098
|
+
"agro.angular_components.cancel_fixation_description": "¿Está seguro de que desea cancelar la fijación?",
|
|
4099
|
+
"agro.angular_components.error_cancel_fixation_message_title": "Error al cancelar la fijación",
|
|
4100
|
+
"agro.angular_components.error_cancel_fixation_message_description": "Ocurrió un error al cancelar la fijación. Por favor, inténtelo de nuevo más tarde.",
|
|
4101
|
+
"agro.angular_components.cancel_fixation_message_title": "Cancelación de fijación",
|
|
4102
|
+
"agro.angular_components.cancel_fixation_message_description": "El proceso de cancelación de la fijación se ha iniciado con éxito."
|
|
4057
4103
|
};
|
|
4058
4104
|
|
|
4059
4105
|
var LibTranslationService = /** @class */ (function () {
|
|
@@ -4211,6 +4257,12 @@
|
|
|
4211
4257
|
EventOperation["TRANSFER_CREATE_INCOMING_INVOICE"] = "TRANSFER_CREATE_INCOMING_INVOICE";
|
|
4212
4258
|
EventOperation["TRANSFER_CREATE_OUTGOING_INVOICE"] = "TRANSFER_CREATE_OUTGOING_INVOICE";
|
|
4213
4259
|
EventOperation["TRANSFER_PRODUCER_BALANCE"] = "TRANSFER_PRODUCER_BALANCE";
|
|
4260
|
+
EventOperation["FINISH_FINANCIAL_FIXATION"] = "FINISH_FINANCIAL_FIXATION";
|
|
4261
|
+
EventOperation["FINISH_PRODUCER_NET_VALUE_FIXATION"] = "FINISH_PRODUCER_NET_VALUE_FIXATION";
|
|
4262
|
+
EventOperation["CONCLUDE_FIXATION"] = "CONCLUDE_FIXATION";
|
|
4263
|
+
EventOperation["CANCEL_FINANCIAL_FIXATION"] = "CANCEL_FINANCIAL_FIXATION";
|
|
4264
|
+
EventOperation["CANCEL_PRODUCER_NET_VALUE_FIXATION"] = "CANCEL_PRODUCER_NET_VALUE_FIXATION";
|
|
4265
|
+
EventOperation["CANCEL_FIXATION"] = "CANCEL_FIXATION";
|
|
4214
4266
|
})(EventOperation || (EventOperation = {}));
|
|
4215
4267
|
|
|
4216
4268
|
var EventOrigin;
|
|
@@ -4221,6 +4273,7 @@
|
|
|
4221
4273
|
EventOrigin["TRANSFER"] = "TRANSFER";
|
|
4222
4274
|
EventOrigin["CHANGE_REQUEST"] = "CHANGE_REQUEST";
|
|
4223
4275
|
EventOrigin["CREATE_INVOICE"] = "CREATE_INVOICE";
|
|
4276
|
+
EventOrigin["FIXATION"] = "FIXATION";
|
|
4224
4277
|
})(EventOrigin || (EventOrigin = {}));
|
|
4225
4278
|
|
|
4226
4279
|
var eventOrigin = [
|
|
@@ -4238,7 +4291,7 @@
|
|
|
4238
4291
|
{ label: "agro.angular_components.effective_confirmation_event", value: EventOperation.EFFECTIVE_CONFIRMATION },
|
|
4239
4292
|
{ label: "agro.angular_components.change_request_event_summary", value: EventOperation.CHANGE_REQUEST },
|
|
4240
4293
|
{ label: "agro.angular_components.change_response_event", value: EventOperation.CHANGE_RESPONSE },
|
|
4241
|
-
{ label: "agro.angular_components.
|
|
4294
|
+
{ label: "agro.angular_components.fixation_event", value: EventOperation.PROCESS_FIXATION },
|
|
4242
4295
|
{ label: "agro.angular_components." + EventOperation.CANCEL_INVOICE, value: EventOperation.CANCEL_INVOICE },
|
|
4243
4296
|
{ label: "agro.angular_components." + EventOperation.REPROCESS_INVOICE, value: EventOperation.REPROCESS_INVOICE },
|
|
4244
4297
|
{ label: "agro.angular_components." + EventOperation.EFFECTIVE_CONFIRMATION, value: EventOperation.EFFECTIVE_CONFIRMATION },
|
|
@@ -4248,6 +4301,12 @@
|
|
|
4248
4301
|
{ label: "agro.angular_components." + EventOperation.TRANSFER_CREATE_INCOMING_INVOICE, value: EventOperation.TRANSFER_CREATE_INCOMING_INVOICE },
|
|
4249
4302
|
{ label: "agro.angular_components." + EventOperation.TRANSFER_CREATE_OUTGOING_INVOICE, value: EventOperation.TRANSFER_CREATE_OUTGOING_INVOICE },
|
|
4250
4303
|
{ label: "agro.angular_components." + EventOperation.TRANSFER_PRODUCER_BALANCE, value: EventOperation.TRANSFER_PRODUCER_BALANCE },
|
|
4304
|
+
{ label: "agro.angular_components." + EventOperation.FINISH_FINANCIAL_FIXATION, value: EventOperation.FINISH_FINANCIAL_FIXATION },
|
|
4305
|
+
{ label: "agro.angular_components." + EventOperation.FINISH_PRODUCER_NET_VALUE_FIXATION, value: EventOperation.FINISH_PRODUCER_NET_VALUE_FIXATION },
|
|
4306
|
+
{ label: "agro.angular_components." + EventOperation.CONCLUDE_FIXATION, value: EventOperation.CONCLUDE_FIXATION },
|
|
4307
|
+
{ label: "agro.angular_components." + EventOperation.CANCEL_FINANCIAL_FIXATION, value: EventOperation.CANCEL_FINANCIAL_FIXATION },
|
|
4308
|
+
{ label: "agro.angular_components." + EventOperation.CANCEL_PRODUCER_NET_VALUE_FIXATION, value: EventOperation.CANCEL_PRODUCER_NET_VALUE_FIXATION },
|
|
4309
|
+
{ label: "agro.angular_components." + EventOperation.CANCEL_FIXATION, value: EventOperation.CANCEL_FIXATION },
|
|
4251
4310
|
];
|
|
4252
4311
|
var eventStatus = [
|
|
4253
4312
|
{ label: "agro.angular_components.panel_title_events_completed_successfully", value: EventStatus.SUCCESS },
|
|
@@ -4457,61 +4516,6 @@
|
|
|
4457
4516
|
return ProducerInvoiceService;
|
|
4458
4517
|
}(EntityService));
|
|
4459
4518
|
|
|
4460
|
-
var TicketService = /** @class */ (function (_super) {
|
|
4461
|
-
__extends(TicketService, _super);
|
|
4462
|
-
function TicketService(http, messageService, translate) {
|
|
4463
|
-
var _this = _super.call(this, http, messageService, "agro/origination/entities/ticket", "agro/origination/actions", "agro/origination/queries", translate) || this;
|
|
4464
|
-
_this.http = http;
|
|
4465
|
-
_this.messageService = messageService;
|
|
4466
|
-
_this.translate = translate;
|
|
4467
|
-
return _this;
|
|
4468
|
-
}
|
|
4469
|
-
TicketService.prototype.getTicketSummaryByParent = function (parent) {
|
|
4470
|
-
return this.http
|
|
4471
|
-
.post(this.queriesUrl + "/getTicketSummaryByParent/", { parent: parent })
|
|
4472
|
-
.pipe(this.defaultCatch());
|
|
4473
|
-
};
|
|
4474
|
-
TicketService.prototype.listMainteinerTickets = function (filter) {
|
|
4475
|
-
return this.http
|
|
4476
|
-
.post(this.queriesUrl + "/listMainteinerTickets/", filter)
|
|
4477
|
-
.pipe(this.defaultCatch());
|
|
4478
|
-
};
|
|
4479
|
-
TicketService.prototype.searchTotalWeightResultFromTickets = function (body) {
|
|
4480
|
-
return this.http
|
|
4481
|
-
.post(this.queriesUrl + "/searchTotalWeightResultFromTickets/", body)
|
|
4482
|
-
.pipe(this.defaultCatch());
|
|
4483
|
-
};
|
|
4484
|
-
TicketService.prototype.cancelTicket = function (body) {
|
|
4485
|
-
return this.http
|
|
4486
|
-
.post(this.actionsUrl + "/cancelTicket/", body);
|
|
4487
|
-
};
|
|
4488
|
-
TicketService.prototype.mergeTickets = function (body) {
|
|
4489
|
-
return this.http.post(this.actionsUrl + "/mergeTickets/", body).pipe(this.defaultCatch());
|
|
4490
|
-
};
|
|
4491
|
-
TicketService.prototype.unMergeTickets = function (body) {
|
|
4492
|
-
return this.http.post(this.actionsUrl + "/unMergeTickets/", body).pipe(this.defaultCatch());
|
|
4493
|
-
};
|
|
4494
|
-
TicketService.prototype.checkGroupInvoicePermission = function (body) {
|
|
4495
|
-
return this.http
|
|
4496
|
-
.post(this.queriesUrl + "/checkGroupInvoicePermission/", body)
|
|
4497
|
-
.pipe(this.defaultCatch());
|
|
4498
|
-
};
|
|
4499
|
-
TicketService.prototype.getContractTickets = function (tickets) {
|
|
4500
|
-
return this.http
|
|
4501
|
-
.post(this.queriesUrl + "/getContractTickets/", { tickets: tickets })
|
|
4502
|
-
.pipe(this.defaultCatch());
|
|
4503
|
-
};
|
|
4504
|
-
TicketService.ctorParameters = function () { return [
|
|
4505
|
-
{ type: http.HttpClient },
|
|
4506
|
-
{ type: api.MessageService },
|
|
4507
|
-
{ type: LibTranslationService }
|
|
4508
|
-
]; };
|
|
4509
|
-
TicketService = __decorate([
|
|
4510
|
-
core.Injectable()
|
|
4511
|
-
], TicketService);
|
|
4512
|
-
return TicketService;
|
|
4513
|
-
}(EntityService));
|
|
4514
|
-
|
|
4515
4519
|
var TransferService = /** @class */ (function (_super) {
|
|
4516
4520
|
__extends(TransferService, _super);
|
|
4517
4521
|
function TransferService(http, messageService, translate) {
|
|
@@ -4542,22 +4546,47 @@
|
|
|
4542
4546
|
return TransferService;
|
|
4543
4547
|
}(EntityService));
|
|
4544
4548
|
|
|
4549
|
+
var FixationService = /** @class */ (function (_super) {
|
|
4550
|
+
__extends(FixationService, _super);
|
|
4551
|
+
function FixationService(http, messageService, translate) {
|
|
4552
|
+
var _this = _super.call(this, http, messageService, "agro/fixation/entities/fixation", "agro/fixation/actions", "agro/fixation/queries", translate) || this;
|
|
4553
|
+
_this.http = http;
|
|
4554
|
+
_this.messageService = messageService;
|
|
4555
|
+
_this.translate = translate;
|
|
4556
|
+
return _this;
|
|
4557
|
+
}
|
|
4558
|
+
FixationService.prototype.cancelFixation = function (body) {
|
|
4559
|
+
return this.http
|
|
4560
|
+
.post(this.actionsUrl + "/cancelFixationEvent", body)
|
|
4561
|
+
.pipe(this.defaultCatch());
|
|
4562
|
+
};
|
|
4563
|
+
FixationService.ctorParameters = function () { return [
|
|
4564
|
+
{ type: http.HttpClient },
|
|
4565
|
+
{ type: api.MessageService },
|
|
4566
|
+
{ type: LibTranslationService }
|
|
4567
|
+
]; };
|
|
4568
|
+
FixationService = __decorate([
|
|
4569
|
+
core.Injectable()
|
|
4570
|
+
], FixationService);
|
|
4571
|
+
return FixationService;
|
|
4572
|
+
}(EntityService));
|
|
4573
|
+
|
|
4545
4574
|
var EventControlBoardService = /** @class */ (function () {
|
|
4546
|
-
function EventControlBoardService(eventControlService, eventControlItemService,
|
|
4575
|
+
function EventControlBoardService(eventControlService, eventControlItemService, transferService, producerInvoiceService, fixationService) {
|
|
4547
4576
|
this.eventControlService = eventControlService;
|
|
4548
4577
|
this.eventControlItemService = eventControlItemService;
|
|
4549
|
-
this.ticketService = ticketService;
|
|
4550
4578
|
this.transferService = transferService;
|
|
4551
4579
|
this.producerInvoiceService = producerInvoiceService;
|
|
4580
|
+
this.fixationService = fixationService;
|
|
4552
4581
|
}
|
|
4553
4582
|
EventControlBoardService.ctorParameters = function () { return [
|
|
4554
4583
|
{ type: EventControlService },
|
|
4555
4584
|
{ type: EventControlItemService },
|
|
4556
|
-
{ type: TicketService },
|
|
4557
4585
|
{ type: TransferService },
|
|
4558
|
-
{ type: ProducerInvoiceService }
|
|
4586
|
+
{ type: ProducerInvoiceService },
|
|
4587
|
+
{ type: FixationService }
|
|
4559
4588
|
]; };
|
|
4560
|
-
EventControlBoardService.ɵprov = core["ɵɵdefineInjectable"]({ factory: function EventControlBoardService_Factory() { return new EventControlBoardService(core["ɵɵinject"](EventControlService), core["ɵɵinject"](EventControlItemService), core["ɵɵinject"](
|
|
4589
|
+
EventControlBoardService.ɵprov = core["ɵɵdefineInjectable"]({ factory: function EventControlBoardService_Factory() { return new EventControlBoardService(core["ɵɵinject"](EventControlService), core["ɵɵinject"](EventControlItemService), core["ɵɵinject"](TransferService), core["ɵɵinject"](ProducerInvoiceService), core["ɵɵinject"](FixationService)); }, token: EventControlBoardService, providedIn: "root" });
|
|
4561
4590
|
EventControlBoardService = __decorate([
|
|
4562
4591
|
core.Injectable({
|
|
4563
4592
|
providedIn: "root",
|
|
@@ -4567,13 +4596,14 @@
|
|
|
4567
4596
|
}());
|
|
4568
4597
|
|
|
4569
4598
|
var EventControlBoardComponent = /** @class */ (function () {
|
|
4570
|
-
function EventControlBoardComponent(translate, formBuilder, websocketService, eventControlBoardService, paginatorStorageService, messageService) {
|
|
4599
|
+
function EventControlBoardComponent(translate, formBuilder, websocketService, eventControlBoardService, paginatorStorageService, messageService, confirmationService) {
|
|
4571
4600
|
this.translate = translate;
|
|
4572
4601
|
this.formBuilder = formBuilder;
|
|
4573
4602
|
this.websocketService = websocketService;
|
|
4574
4603
|
this.eventControlBoardService = eventControlBoardService;
|
|
4575
4604
|
this.paginatorStorageService = paginatorStorageService;
|
|
4576
4605
|
this.messageService = messageService;
|
|
4606
|
+
this.confirmationService = confirmationService;
|
|
4577
4607
|
this.steps = [];
|
|
4578
4608
|
this.showSidebar = false;
|
|
4579
4609
|
this.showReprocessButton = false;
|
|
@@ -4593,7 +4623,6 @@
|
|
|
4593
4623
|
return __awaiter(this, void 0, void 0, function () {
|
|
4594
4624
|
return __generator(this, function (_a) {
|
|
4595
4625
|
this.gridColumns = this.setGridColumns();
|
|
4596
|
-
this.socketConnection = this.websocketService.onConnect();
|
|
4597
4626
|
this.callWebsocket();
|
|
4598
4627
|
return [2 /*return*/];
|
|
4599
4628
|
});
|
|
@@ -4605,7 +4634,7 @@
|
|
|
4605
4634
|
this.setFormFields();
|
|
4606
4635
|
}
|
|
4607
4636
|
this.updateCompanyAndBranchFormFields(changes);
|
|
4608
|
-
this.
|
|
4637
|
+
this.updateEventOriginAndControlCodeFormFields(changes);
|
|
4609
4638
|
this.updateEventStatusAndCreatedDateFormFields(changes);
|
|
4610
4639
|
this.onSearch();
|
|
4611
4640
|
};
|
|
@@ -4618,13 +4647,13 @@
|
|
|
4618
4647
|
(_c = this.filterFormGroup.get('e070fil')) === null || _c === void 0 ? void 0 : _c.setValue((_d = changes.e070fil.currentValue) !== null && _d !== void 0 ? _d : null);
|
|
4619
4648
|
}
|
|
4620
4649
|
};
|
|
4621
|
-
EventControlBoardComponent.prototype.
|
|
4650
|
+
EventControlBoardComponent.prototype.updateEventOriginAndControlCodeFormFields = function (changes) {
|
|
4622
4651
|
var _a, _b, _c, _d;
|
|
4623
4652
|
if (changes.eventOrigin && changes.eventOrigin.currentValue !== changes.eventOrigin.previousValue) {
|
|
4624
4653
|
(_a = this.filterFormGroup.get('eventOrigin')) === null || _a === void 0 ? void 0 : _a.setValue((_b = changes.eventOrigin.currentValue) !== null && _b !== void 0 ? _b : null);
|
|
4625
4654
|
}
|
|
4626
|
-
if (changes.
|
|
4627
|
-
(_c = this.filterFormGroup.get('
|
|
4655
|
+
if (changes.controlCode && changes.controlCode.currentValue !== changes.controlCode.previousValue) {
|
|
4656
|
+
(_c = this.filterFormGroup.get('controlCode')) === null || _c === void 0 ? void 0 : _c.setValue((_d = changes.controlCode.currentValue) !== null && _d !== void 0 ? _d : null);
|
|
4628
4657
|
}
|
|
4629
4658
|
};
|
|
4630
4659
|
EventControlBoardComponent.prototype.updateEventStatusAndCreatedDateFormFields = function (changes) {
|
|
@@ -4641,7 +4670,7 @@
|
|
|
4641
4670
|
this.filterFormGroup = this.formBuilder.group({
|
|
4642
4671
|
e070emp: [{ value: (_a = this.e070emp) !== null && _a !== void 0 ? _a : null, disabled: false }, forms.Validators.compose([])],
|
|
4643
4672
|
e070fil: [{ value: (_b = this.e070fil) !== null && _b !== void 0 ? _b : null, disabled: false }, forms.Validators.compose([])],
|
|
4644
|
-
|
|
4673
|
+
controlCode: [{ value: (_c = this.controlCode) !== null && _c !== void 0 ? _c : null, disabled: false }, forms.Validators.compose([])],
|
|
4645
4674
|
externalId: [{ value: (_d = this.externalId) !== null && _d !== void 0 ? _d : null, disabled: false }, forms.Validators.compose([])],
|
|
4646
4675
|
eventOrigin: [{ value: (_e = this.eventOrigin) !== null && _e !== void 0 ? _e : null, disabled: false }, forms.Validators.compose([])],
|
|
4647
4676
|
status: [{ value: (_f = this.eventStatus) !== null && _f !== void 0 ? _f : null, disabled: false }, forms.Validators.compose([])],
|
|
@@ -4659,7 +4688,7 @@
|
|
|
4659
4688
|
type: angularComponents.FieldType.Chips,
|
|
4660
4689
|
}),
|
|
4661
4690
|
new angularComponents.FormField({
|
|
4662
|
-
name: "
|
|
4691
|
+
name: "controlCode",
|
|
4663
4692
|
type: angularComponents.FieldType.Chips,
|
|
4664
4693
|
}),
|
|
4665
4694
|
new angularComponents.FormField({
|
|
@@ -4685,14 +4714,13 @@
|
|
|
4685
4714
|
{ field: 'e070emp', header: this.translate.instant("agro.angular_components.company") },
|
|
4686
4715
|
{ field: 'e070fil', header: this.translate.instant("agro.angular_components.label_branch") },
|
|
4687
4716
|
{ field: 'eventOrigin', header: this.translate.instant("agro.angular_components.event_origin_label") },
|
|
4688
|
-
{ field: '
|
|
4717
|
+
{ field: 'controlCode', header: this.translate.instant("agro.angular_components.control_code") },
|
|
4689
4718
|
];
|
|
4690
4719
|
};
|
|
4691
4720
|
EventControlBoardComponent.prototype.ngOnDestroy = function () {
|
|
4692
4721
|
this.ngUnsubscribe.next();
|
|
4693
4722
|
this.ngUnsubscribe.complete();
|
|
4694
4723
|
this.websocketService.disconnect();
|
|
4695
|
-
this.socketConnection = false;
|
|
4696
4724
|
};
|
|
4697
4725
|
EventControlBoardComponent.prototype.callWebsocket = function () {
|
|
4698
4726
|
var _this = this;
|
|
@@ -4738,14 +4766,70 @@
|
|
|
4738
4766
|
var _a = this.currentListParams, page = _a.page, size = _a.size;
|
|
4739
4767
|
var nSort = this.getSortedFields();
|
|
4740
4768
|
var filterQuery = this.getFilterQuery();
|
|
4741
|
-
var displayFields = [""];
|
|
4769
|
+
var displayFields = ["*", "eventControlItem"];
|
|
4742
4770
|
this.eventControlBoardService.eventControlService
|
|
4743
4771
|
.list({ sort: nSort, page: page, size: size, filterQuery: filterQuery, displayFields: displayFields })
|
|
4744
4772
|
.pipe(operators.takeUntil(this.ngUnsubscribe), operators.catchError(function (err) {
|
|
4745
4773
|
_this.gridLoading = false;
|
|
4746
4774
|
throw err;
|
|
4747
4775
|
}))
|
|
4748
|
-
.subscribe(function (list) {
|
|
4776
|
+
.subscribe(function (list) {
|
|
4777
|
+
_this.gridData = list.contents;
|
|
4778
|
+
_this.gridTotalRecords = list.totalElements;
|
|
4779
|
+
if (!_this.gridData || _this.gridData.length <= exports.AGRO_NUMBERS.ZERO) {
|
|
4780
|
+
_this.gridLoading = false;
|
|
4781
|
+
return;
|
|
4782
|
+
}
|
|
4783
|
+
_this.processEventControlItems();
|
|
4784
|
+
});
|
|
4785
|
+
};
|
|
4786
|
+
EventControlBoardComponent.prototype.processEventControlItems = function () {
|
|
4787
|
+
var _this = this;
|
|
4788
|
+
this.gridData.forEach(function (item) {
|
|
4789
|
+
var sortedItems = item.eventControlItem.sort(function (a, b) {
|
|
4790
|
+
return a.sequence - b.sequence;
|
|
4791
|
+
});
|
|
4792
|
+
var steps = sortedItems.map(function (detail, index) { return _this.createStep(detail, item, index); });
|
|
4793
|
+
var activeIndex = _this.calculateActiveIndex(sortedItems);
|
|
4794
|
+
item.groups = [{ steps: steps, activeIndex: activeIndex }];
|
|
4795
|
+
item.activeIndex = activeIndex;
|
|
4796
|
+
});
|
|
4797
|
+
this.gridDataResolved = this.gridData;
|
|
4798
|
+
this.gridLoading = false;
|
|
4799
|
+
};
|
|
4800
|
+
EventControlBoardComponent.prototype.calculateActiveIndex = function (details) {
|
|
4801
|
+
var lastActive = details.reduce(function (lastIndex, detail, currentIndex) {
|
|
4802
|
+
return detail.status !== EventStatus.PENDING ? currentIndex : lastIndex;
|
|
4803
|
+
}, -1);
|
|
4804
|
+
if (lastActive !== -1 && details[lastActive].status === EventStatus.SUCCESS) {
|
|
4805
|
+
return lastActive + 1;
|
|
4806
|
+
}
|
|
4807
|
+
return lastActive;
|
|
4808
|
+
};
|
|
4809
|
+
EventControlBoardComponent.prototype.createStep = function (detail, item, detailIndex) {
|
|
4810
|
+
return {
|
|
4811
|
+
item: detail,
|
|
4812
|
+
controlCode: item.controlCode,
|
|
4813
|
+
eventType: item.eventOrigin,
|
|
4814
|
+
label: this.getEventLabel(detail),
|
|
4815
|
+
disabled: detail.status === EventStatus.PENDING && detailIndex !== this.calculateActiveIndex(item.eventControlItem),
|
|
4816
|
+
tooltip: this.getEventLabel(detail),
|
|
4817
|
+
state: this.determineStepState(detail)
|
|
4818
|
+
};
|
|
4819
|
+
};
|
|
4820
|
+
EventControlBoardComponent.prototype.determineStepState = function (detail) {
|
|
4821
|
+
if (detail.status === EventStatus.SUCCESS) {
|
|
4822
|
+
return angularComponents.StepState.Success;
|
|
4823
|
+
}
|
|
4824
|
+
if (detail.status === EventStatus.FAILED) {
|
|
4825
|
+
return angularComponents.StepState.Warning;
|
|
4826
|
+
}
|
|
4827
|
+
return angularComponents.StepState.Default;
|
|
4828
|
+
};
|
|
4829
|
+
EventControlBoardComponent.prototype.getEventLabel = function (detail) {
|
|
4830
|
+
var _a;
|
|
4831
|
+
var eventLabel = (_a = this.eventItem.find(function (e) { return e.value === detail.eventOperation; })) === null || _a === void 0 ? void 0 : _a.label;
|
|
4832
|
+
return eventLabel ? this.translate.instant(eventLabel) : detail.eventOperation;
|
|
4749
4833
|
};
|
|
4750
4834
|
EventControlBoardComponent.prototype.getSortedFields = function () {
|
|
4751
4835
|
var _this = this;
|
|
@@ -4780,134 +4864,21 @@
|
|
|
4780
4864
|
.filter(function (filter) { return filter !== null && filter !== '' && filter !== undefined; })
|
|
4781
4865
|
.join(' and ');
|
|
4782
4866
|
};
|
|
4783
|
-
EventControlBoardComponent.prototype.handleListResponse = function (list) {
|
|
4784
|
-
this.gridData = list.contents;
|
|
4785
|
-
this.gridTotalRecords = list.totalElements;
|
|
4786
|
-
if (!this.gridData || this.gridData.length <= exports.AGRO_NUMBERS.ZERO) {
|
|
4787
|
-
this.gridLoading = false;
|
|
4788
|
-
return;
|
|
4789
|
-
}
|
|
4790
|
-
this.processDetailCalls();
|
|
4791
|
-
};
|
|
4792
|
-
EventControlBoardComponent.prototype.processDetailCalls = function () {
|
|
4793
|
-
var _this = this;
|
|
4794
|
-
var detailCalls$ = this.gridData.map(function (item) {
|
|
4795
|
-
return _this.eventControlBoardService.eventControlItemService.list({
|
|
4796
|
-
filterQuery: "eventControl eq '" + item.id + "'",
|
|
4797
|
-
sort: [{ field: 'sequence', order: exports.AGRO_NUMBERS.ONE }],
|
|
4798
|
-
size: exports.AGRO_NUMBERS.ONE_HUNDRED
|
|
4799
|
-
})
|
|
4800
|
-
.pipe(operators.takeUntil(_this.ngUnsubscribe), operators.catchError(function (err) {
|
|
4801
|
-
_this.gridLoading = false;
|
|
4802
|
-
throw err;
|
|
4803
|
-
}), operators.switchMap(function (detailsResponse) {
|
|
4804
|
-
return _this.eventControlBoardService.ticketService.list({
|
|
4805
|
-
filterQuery: "id eq '" + item.externalId + "' or balanceEntryControl.id eq '" + item.externalId + "'",
|
|
4806
|
-
displayFields: ['number']
|
|
4807
|
-
})
|
|
4808
|
-
.pipe(operators.map(function (ticketResponse) { return ({ detailsResponse: detailsResponse, ticketResponse: ticketResponse }); }), operators.catchError(function (err) {
|
|
4809
|
-
_this.gridLoading = false;
|
|
4810
|
-
throw err;
|
|
4811
|
-
}));
|
|
4812
|
-
}));
|
|
4813
|
-
});
|
|
4814
|
-
rxjs.forkJoin(detailCalls$).subscribe(function (responses) {
|
|
4815
|
-
_this.processDetailsResponses(responses);
|
|
4816
|
-
});
|
|
4817
|
-
};
|
|
4818
|
-
EventControlBoardComponent.prototype.processDetailsResponses = function (detailsResponses) {
|
|
4819
|
-
var _this = this;
|
|
4820
|
-
this.gridData.forEach(function (item, index) {
|
|
4821
|
-
var _a, _b;
|
|
4822
|
-
var _c = detailsResponses[index], detailsResponse = _c.detailsResponse, ticketResponse = _c.ticketResponse;
|
|
4823
|
-
var tickets = (_a = ticketResponse === null || ticketResponse === void 0 ? void 0 : ticketResponse.contents) !== null && _a !== void 0 ? _a : [];
|
|
4824
|
-
item.details = (_b = detailsResponse === null || detailsResponse === void 0 ? void 0 : detailsResponse.contents) !== null && _b !== void 0 ? _b : [];
|
|
4825
|
-
item.tickets = tickets.map(function (ticket) { return ticket.number; }).join(', ');
|
|
4826
|
-
var groupedDetails = _this.groupByEventGroup(item.details);
|
|
4827
|
-
item.groups = Object.keys(groupedDetails).map(function (eventGroupId) {
|
|
4828
|
-
var groupDetails = groupedDetails[eventGroupId];
|
|
4829
|
-
var lastActiveIndex = groupDetails.map(function (detail) {
|
|
4830
|
-
return detail.status !== EventStatus.PENDING;
|
|
4831
|
-
}).lastIndexOf(true);
|
|
4832
|
-
var activeIndex = lastActiveIndex;
|
|
4833
|
-
if (lastActiveIndex !== -1 && groupDetails[lastActiveIndex].status === EventStatus.SUCCESS) {
|
|
4834
|
-
activeIndex = lastActiveIndex + 1;
|
|
4835
|
-
}
|
|
4836
|
-
var steps = groupDetails.map(function (detail, detailIndex) {
|
|
4837
|
-
return {
|
|
4838
|
-
item: detail,
|
|
4839
|
-
ticket: item.tickets,
|
|
4840
|
-
eventType: detail.eventControl.eventOrigin,
|
|
4841
|
-
label: _this.getEventLabel(detail),
|
|
4842
|
-
disabled: detail.status === EventStatus.PENDING && detailIndex !== activeIndex,
|
|
4843
|
-
tooltip: _this.getEventLabel(detail),
|
|
4844
|
-
state: _this.determineStepState(detail),
|
|
4845
|
-
};
|
|
4846
|
-
});
|
|
4847
|
-
return {
|
|
4848
|
-
eventGroupId: eventGroupId,
|
|
4849
|
-
steps: steps,
|
|
4850
|
-
activeIndex: activeIndex
|
|
4851
|
-
};
|
|
4852
|
-
});
|
|
4853
|
-
item.activeIndex = item.groups.length > 0 ? item.groups[0].activeIndex : -1;
|
|
4854
|
-
});
|
|
4855
|
-
this.gridDataResolved = this.gridData;
|
|
4856
|
-
this.gridLoading = false;
|
|
4857
|
-
};
|
|
4858
|
-
EventControlBoardComponent.prototype.groupByEventGroup = function (details) {
|
|
4859
|
-
return details.reduce(function (acc, detail) {
|
|
4860
|
-
var eventGroupId = detail.eventGroup;
|
|
4861
|
-
if (!acc[eventGroupId]) {
|
|
4862
|
-
acc[eventGroupId] = [];
|
|
4863
|
-
}
|
|
4864
|
-
acc[eventGroupId].push(detail);
|
|
4865
|
-
return acc;
|
|
4866
|
-
}, {});
|
|
4867
|
-
};
|
|
4868
|
-
EventControlBoardComponent.prototype.determineStepState = function (detail) {
|
|
4869
|
-
var state;
|
|
4870
|
-
if (detail.status === EventStatus.SUCCESS) {
|
|
4871
|
-
state = angularComponents.StepState.Success;
|
|
4872
|
-
}
|
|
4873
|
-
else if (detail.status === EventStatus.FAILED) {
|
|
4874
|
-
state = angularComponents.StepState.Warning;
|
|
4875
|
-
}
|
|
4876
|
-
else {
|
|
4877
|
-
state = angularComponents.StepState.Default;
|
|
4878
|
-
}
|
|
4879
|
-
return state;
|
|
4880
|
-
};
|
|
4881
|
-
EventControlBoardComponent.prototype.getEventLabel = function (detail) {
|
|
4882
|
-
var _a;
|
|
4883
|
-
var eventLabel = (_a = this.eventItem.find(function (e) { return e.value === detail.eventOperation; })) === null || _a === void 0 ? void 0 : _a.label;
|
|
4884
|
-
return eventLabel ? this.translate.instant(eventLabel) : detail.eventOperation;
|
|
4885
|
-
};
|
|
4886
4867
|
EventControlBoardComponent.prototype.getFieldNameForSortRequest = function (name) {
|
|
4887
4868
|
switch (name) {
|
|
4888
4869
|
case 'e070emp':
|
|
4889
4870
|
return 'e070emp.nomEmp';
|
|
4890
4871
|
case 'e070fil':
|
|
4891
4872
|
return 'e070fil.nomFil';
|
|
4892
|
-
case 'number':
|
|
4893
|
-
return 'createdDate';
|
|
4894
4873
|
default:
|
|
4895
4874
|
return name;
|
|
4896
4875
|
}
|
|
4897
4876
|
};
|
|
4898
4877
|
EventControlBoardComponent.prototype.createFilterString = function (name, type, value, lookupFieldName) {
|
|
4899
4878
|
if (lookupFieldName === void 0) { lookupFieldName = 'id'; }
|
|
4900
|
-
if (name === '
|
|
4879
|
+
if (name === 'controlCode') {
|
|
4901
4880
|
var filterParts_1 = [];
|
|
4902
|
-
value.forEach(function (
|
|
4903
|
-
filterParts_1.push("externalId eq '" + item.id + "'");
|
|
4904
|
-
if (item.invoice) {
|
|
4905
|
-
filterParts_1.push("externalId eq '" + item.invoice.id + "'");
|
|
4906
|
-
}
|
|
4907
|
-
if (item.balanceEntryControl) {
|
|
4908
|
-
filterParts_1.push("externalId eq '" + item.balanceEntryControl.id + "'");
|
|
4909
|
-
}
|
|
4910
|
-
});
|
|
4881
|
+
value.forEach(function (val) { return filterParts_1.push("controlCode eq '" + val + "'"); });
|
|
4911
4882
|
return "(" + filterParts_1.join(' or ') + ")";
|
|
4912
4883
|
}
|
|
4913
4884
|
return this.createFilterStringFromType(name, type, value, lookupFieldName);
|
|
@@ -4969,7 +4940,6 @@
|
|
|
4969
4940
|
EventControlBoardComponent.prototype.stepSelected = function (event) {
|
|
4970
4941
|
var _this = this;
|
|
4971
4942
|
this.selectedStep = event.step;
|
|
4972
|
-
console.log(event);
|
|
4973
4943
|
switch (this.selectedStep.eventType) {
|
|
4974
4944
|
case EventOrigin.BALANCE_ENTRY_CONTROL:
|
|
4975
4945
|
case EventOrigin.TICKET:
|
|
@@ -4988,8 +4958,8 @@
|
|
|
4988
4958
|
_this.sidebarLoading = false;
|
|
4989
4959
|
});
|
|
4990
4960
|
break;
|
|
4961
|
+
case EventOrigin.FIXATION:
|
|
4991
4962
|
case EventOrigin.CHANGE_REQUEST:
|
|
4992
|
-
break;
|
|
4993
4963
|
case EventOrigin.TRANSFER:
|
|
4994
4964
|
break;
|
|
4995
4965
|
}
|
|
@@ -5010,16 +4980,47 @@
|
|
|
5010
4980
|
_this.addMessage('error', 'agro.angular_components.error_reprocessing_event_message_title', 'agro.angular_components.error_reprocessing_event_message_description');
|
|
5011
4981
|
});
|
|
5012
4982
|
};
|
|
5013
|
-
EventControlBoardComponent.prototype.addMessage = function (severity, summary, detail) {
|
|
4983
|
+
EventControlBoardComponent.prototype.addMessage = function (severity, summary, detail, life) {
|
|
4984
|
+
if (life === void 0) { life = exports.AGRO_NUMBERS.FIVE_SECONDS; }
|
|
5014
4985
|
this.messageService.add({
|
|
5015
4986
|
severity: severity,
|
|
5016
4987
|
summary: this.translate.instant(summary),
|
|
5017
4988
|
detail: this.translate.instant(detail),
|
|
4989
|
+
life: life
|
|
5018
4990
|
});
|
|
5019
4991
|
};
|
|
5020
4992
|
EventControlBoardComponent.prototype.openModal = function () {
|
|
5021
4993
|
this.displayModal = true;
|
|
5022
4994
|
};
|
|
4995
|
+
EventControlBoardComponent.prototype.openCancelModal = function () {
|
|
4996
|
+
var _this = this;
|
|
4997
|
+
this.confirmationService.confirm({
|
|
4998
|
+
header: this.translate.instant("agro.angular_components.cancel_fixation_title"),
|
|
4999
|
+
message: this.translate.instant("agro.angular_components.cancel_fixation_description"),
|
|
5000
|
+
acceptLabel: this.translate.instant("agro.angular_components.yes"),
|
|
5001
|
+
rejectLabel: this.translate.instant("agro.angular_components.no"),
|
|
5002
|
+
accept: function () {
|
|
5003
|
+
_this.gridLoading = true;
|
|
5004
|
+
_this.cancelFixation();
|
|
5005
|
+
},
|
|
5006
|
+
reject: function () {
|
|
5007
|
+
_this.gridLoading = false;
|
|
5008
|
+
}
|
|
5009
|
+
});
|
|
5010
|
+
};
|
|
5011
|
+
EventControlBoardComponent.prototype.cancelFixation = function () {
|
|
5012
|
+
var _this = this;
|
|
5013
|
+
this.eventControlBoardService.fixationService.cancelFixation({ fixationId: this.gridData[exports.AGRO_NUMBERS.ZERO].externalId })
|
|
5014
|
+
.pipe(operators.takeUntil(this.ngUnsubscribe), operators.catchError(function (err) {
|
|
5015
|
+
_this.addMessage('error', 'agro.angular_components.error_cancel_fixation_message_title', 'agro.angular_components.error_cancel_fixation_message_description');
|
|
5016
|
+
_this.gridLoading = false;
|
|
5017
|
+
throw err;
|
|
5018
|
+
}))
|
|
5019
|
+
.subscribe(function () {
|
|
5020
|
+
_this.addMessage('info', 'agro.angular_components.cancel_fixation_message_title', 'agro.angular_components.cancel_fixation_message_description');
|
|
5021
|
+
_this.gridLoading = false;
|
|
5022
|
+
});
|
|
5023
|
+
};
|
|
5023
5024
|
EventControlBoardComponent.prototype.confirmModal = function () {
|
|
5024
5025
|
this.reprocessEvent();
|
|
5025
5026
|
this.displayModal = false;
|
|
@@ -5037,7 +5038,8 @@
|
|
|
5037
5038
|
{ type: WebsocketService },
|
|
5038
5039
|
{ type: EventControlBoardService },
|
|
5039
5040
|
{ type: PaginatorStorageService },
|
|
5040
|
-
{ type: primeng.MessageService }
|
|
5041
|
+
{ type: primeng.MessageService },
|
|
5042
|
+
{ type: primeng.ConfirmationService }
|
|
5041
5043
|
]; };
|
|
5042
5044
|
__decorate([
|
|
5043
5045
|
core.Input()
|
|
@@ -5047,7 +5049,7 @@
|
|
|
5047
5049
|
], EventControlBoardComponent.prototype, "e070fil", void 0);
|
|
5048
5050
|
__decorate([
|
|
5049
5051
|
core.Input()
|
|
5050
|
-
], EventControlBoardComponent.prototype, "
|
|
5052
|
+
], EventControlBoardComponent.prototype, "controlCode", void 0);
|
|
5051
5053
|
__decorate([
|
|
5052
5054
|
core.Input()
|
|
5053
5055
|
], EventControlBoardComponent.prototype, "eventOrigin", void 0);
|
|
@@ -5066,11 +5068,11 @@
|
|
|
5066
5068
|
EventControlBoardComponent = __decorate([
|
|
5067
5069
|
core.Component({
|
|
5068
5070
|
selector: 'event-control-board',
|
|
5069
|
-
template: "<div class=\"ui-g\" *sLoadingState=\"gridLoading\">\r\n <div class=\"ui-g-12\">\r\n <p-panel>\r\n <p-header>\r\n {{ \"agro.angular_components.event_control_header\" | libTranslate }}\r\n </p-header>\r\n <div class=\"ui-g\">\r\n <div class=\"ui-g-12\">\r\n <s-button\r\n id=\"refresh-button\"\r\n [priority]=\"ButtonPriority.Primary\"\r\n iconClass=\"fa fa-refresh\"\r\n [label]=\"'agro.angular_components.refresh' | libTranslate\"\r\n (click)=\"onSearch()\"\r\n >\r\n </s-button>\r\n </div>\r\n </div>\r\n <div class=\"ui-g\">\r\n <div class=\"ui-g-12 ui-md-12\" *ngIf=\"!gridData || gridData?.length === 0\">\r\n <s-empty-state\r\n iconClass=\"fa fa-exclamation-triangle\"\r\n title=\"{{ 'agro.angular_components.nothing_found' | libTranslate }}\"\r\n [showPrimaryAction]=\"false\"\r\n description=\"{{ 'agro.angular_components.table_empty_description' | libTranslate }}\"\r\n >\r\n </s-empty-state>\r\n </div>\r\n <ng-container *ngIf=\"gridData?.length > 0\">\r\n <p-table\r\n stylelass=\"custom-table\"\r\n #eventControlTable\r\n [value]=\"gridDataResolved\"\r\n [columns]=\"gridColumns\"\r\n dataKey=\"id\"\r\n [lazy]=\"true\"\r\n [scrollable]=\"true\"\r\n [resizableColumns]=\"true\"\r\n [paginator]=\"!standalone\"\r\n [totalRecords]=\"gridTotalRecords\"\r\n [rows]=\"10\"\r\n [responsive]=\"true\"\r\n (onLazyLoad)=\"onGridChange($event)\"\r\n [sortOrder]=\"getSortOrder()\"\r\n [first]=\"getRowIndex()\"\r\n [lazyLoadOnInit]=\"false\"\r\n sortMode=\"multiple\"\r\n [rows]=\"getPageSize()\"\r\n [rowsPerPageOptions]=\"[10, 20, 50, 100]\"\r\n >\r\n <ng-template pTemplate=\"header\" let-columns>\r\n <tr>\r\n <ng-container *ngIf=\"!standalone\">\r\n <th\r\n *ngFor=\"let col of columns\"\r\n class=\"ui-lg-1 ui-md-1\"\r\n [pSortableColumn]=\"col.field\"\r\n scope=\"col\"\r\n >\r\n <div class=\"senior-header\">\r\n <span class=\"senior-header-title\">{{\r\n col.header\r\n }}</span>\r\n <p-sortIcon [field]=\"col.field\"></p-sortIcon>\r\n </div>\r\n </th>\r\n </ng-container>\r\n <th class=\"ui-lg-8 ui-md-7\" scope=\"col\">\r\n {{ \"agro.angular_components.panel_title_events_events\" | libTranslate }}\r\n </th>\r\n </tr>\r\n </ng-template>\r\n <ng-template pTemplate=\"body\" let-rowData>\r\n <tr>\r\n <ng-container *ngIf=\"!standalone\">\r\n <td class=\"ui-lg-1 ui-md-1\">\r\n {{ rowData.e070emp?.nomEmp }}\r\n </td>\r\n <td class=\"ui-lg-1 ui-md-1\">\r\n {{ rowData.e070fil?.nomFil }}\r\n </td>\r\n <td class=\"ui-lg-1 ui-md-1\">\r\n <ng-container [ngSwitch]=\"rowData.eventOrigin\">\r\n <span *ngSwitchCase=\"'BALANCE_ENTRY_CONTROL'\">\r\n {{\r\n \"agro.angular_components.balance_entry_control_event\"\r\n | libTranslate\r\n }}\r\n </span>\r\n <span *ngSwitchCase=\"'TICKET'\">\r\n {{\r\n \"agro.angular_components.ticket_maintenance_header\"\r\n | libTranslate\r\n }}\r\n </span>\r\n <span *ngSwitchCase=\"'TRANSFER'\">\r\n {{\r\n \"agro.angular_components.transfer_origin_event\"\r\n | libTranslate\r\n }}\r\n </span>\r\n <span *ngSwitchCase=\"'INVOICE'\">\r\n {{\r\n \"agro.angular_components.invoice_creating_event\"\r\n | libTranslate\r\n }}\r\n </span>\r\n <span *ngSwitchCase=\"'CHANGE_REQUEST'\">\r\n {{\r\n \"agro.angular_components.change_request_event\"\r\n | libTranslate\r\n }}\r\n </span>\r\n </ng-container>\r\n </td>\r\n <td class=\"ui-lg-1 ui ui-md-1\">\r\n {{ rowData.tickets || \"\" }}\r\n </td>\r\n </ng-container>\r\n <td class=\"ui-lg-8 ui-md-7\">\r\n <ng-container *ngFor=\"let group of rowData.groups\">\r\n <s-event-steps\r\n [steps]=\"group.steps || []\"\r\n [activeIndex]=\"group.activeIndex\"\r\n (stepSelected)=\"stepSelected($event)\"\r\n >\r\n </s-event-steps>\r\n </ng-container>\r\n </td>\r\n </tr>\r\n </ng-template>\r\n <ng-template\r\n *ngIf=\"!standalone\"\r\n pTemplate=\"paginatorright\"\r\n class=\"custom-table\"\r\n >\r\n <span>\r\n {{\r\n \"agro.angular_components.registers_found\"\r\n | libTranslate : { total: gridTotalRecords }\r\n }}\r\n </span>\r\n </ng-template>\r\n </p-table>\r\n </ng-container>\r\n </div>\r\n </p-panel>\r\n </div>\r\n</div>\r\n<s-sidebar [visible]=\"showSidebar\" (visibleChange)=\"closeSidebar()\" header=\"{{ 'agro.angular_components.event_details_header' | libTranslate }}\">\r\n <div class=\"ui-fluid\">\r\n <p-fieldset legend=\"{{ sidebarTitle }}\" [toggleable]=\"false\">\r\n <div class=\"ui-g\">\r\n <div class=\"ui-g-4\">\r\n <span\r\n ><strong>{{\r\n \"agro.angular_components.event_origin_label\" | libTranslate\r\n }}</strong></span\r\n >\r\n <ng-container [ngSwitch]=\"selectedStep?.item.eventControl.eventOrigin\">\r\n <p *ngSwitchCase=\"'BALANCE_ENTRY_CONTROL'\">\r\n {{ \"agro.angular_components.balance_entry_control_event\" | libTranslate }}\r\n </p>\r\n <p *ngSwitchCase=\"'TICKET'\">\r\n {{ \"agro.angular_components.ticket_maintenance_header\" | libTranslate }}\r\n </p>\r\n <p *ngSwitchCase=\"'TRANSFER'\">\r\n {{ \"agro.angular_components.transfer_origin_event\" | libTranslate }}\r\n </p>\r\n <p *ngSwitchCase=\"'INVOICE'\">\r\n {{ \"agro.angular_components.invoice_creating_event\" | libTranslate }}\r\n </p>\r\n <p *ngSwitchCase=\"'CHANGE_REQUEST'\">\r\n {{ \"agro.angular_components.change_request_event\" | libTranslate }}\r\n </p>\r\n </ng-container>\r\n </div>\r\n <div class=\"ui-g-4\" *ngIf=\"producerInvoice?.e001pes.nomPes\">\r\n <span\r\n ><strong>{{ \"agro.angular_components.supplier\" | libTranslate }}</strong></span\r\n >\r\n <p>{{ producerInvoice?.e001pes.nomPes }}</p>\r\n </div>\r\n <div class=\"ui-g-4\" *ngIf=\"producerInvoice?.ruralEstate.name\">\r\n <span\r\n ><strong>{{ \"agro.angular_components.rural_estate\" | libTranslate }}</strong></span\r\n >\r\n <p>{{ producerInvoice?.ruralEstate.name }}</p>\r\n </div>\r\n <div class=\"ui-g-4\" *ngIf=\"selectedStep?.ticket\">\r\n <span\r\n ><strong>{{ \"agro.angular_components.ticket\" | libTranslate }}</strong></span\r\n >\r\n <p>{{ selectedStep?.ticket }}</p>\r\n </div>\r\n <div class=\"ui-g-4\">\r\n <span\r\n ><strong>{{ \"agro.angular_components.status_label\" | libTranslate }}</strong></span\r\n >\r\n <ng-container [ngSwitch]=\"selectedStep?.item.status\">\r\n <p *ngSwitchCase=\"'SUCCESS'\">\r\n <s-badge\r\n [color]=\"BadgeColors.Green\"\r\n text=\"{{\r\n 'agro.angular_components.panel_title_events_completed_successfully'\r\n | libTranslate\r\n }}\"\r\n [selectable]=\"false\"\r\n >\r\n </s-badge>\r\n </p>\r\n <p *ngSwitchCase=\"'PROCESSING'\">\r\n <s-badge\r\n [color]=\"BadgeColors.Orange\"\r\n text=\"{{ 'agro.angular_components.processing' | libTranslate }}\"\r\n [selectable]=\"false\"\r\n >\r\n </s-badge>\r\n </p>\r\n <p *ngSwitchCase=\"'FAILED'\">\r\n <s-badge\r\n [color]=\"BadgeColors.Red\"\r\n text=\"{{\r\n 'agro.angular_components.panel_title_events_ended_with_error'\r\n | libTranslate\r\n }}\"\r\n [selectable]=\"false\"\r\n >\r\n </s-badge>\r\n </p>\r\n <p *ngSwitchCase=\"'PENDING'\">\r\n <s-badge\r\n [color]=\"BadgeColors.Gray\"\r\n text=\"{{ 'agro.angular_components.pending' | libTranslate }}\"\r\n [selectable]=\"false\"\r\n >\r\n </s-badge>\r\n </p>\r\n </ng-container>\r\n </div>\r\n <div class=\"ui-g-4\">\r\n <span\r\n ><strong>{{\r\n \"agro.angular_components.last_update_date\" | libTranslate\r\n }}</strong></span\r\n >\r\n <p>{{ selectedStep?.item.lastModifiedDate | date : \"dd/MM/yyyy HH:mm:ss\" }}</p>\r\n </div>\r\n <div class=\"ui-g-4\" *ngIf=\"selectedStep?.item.status === 'FAILED'\">\r\n <span\r\n ><strong>{{\r\n \"agro.angular_components.event_error_message\" | libTranslate\r\n }}</strong></span\r\n >\r\n <p>{{ selectedStep?.item.message || \"-\" }}</p>\r\n </div>\r\n </div>\r\n </p-fieldset>\r\n </div>\r\n <s-footer>\r\n <div class=\"ui-g\">\r\n <div class=\"ui-g-12 width-fit\">\r\n <s-button\r\n id=\"sidebar-close-button\"\r\n [priority]=\"ButtonPriority.Primary\"\r\n [label]=\"'agro.angular_components.events_close' | libTranslate\"\r\n [auxiliary]=\"false\"\r\n (click)=\"closeSidebar()\"\r\n >\r\n </s-button>\r\n <s-button\r\n *ngIf=\"showReprocessButton\"\r\n id=\"sidebar-reprocess-button\"\r\n [priority]=\"ButtonPriority.Secondary\"\r\n iconClass=\"fa fa-refresh\"\r\n [label]=\"'agro.angular_components.reprocess_event' | libTranslate\"\r\n [auxiliary]=\"false\"\r\n (click)=\"openModal()\"\r\n >\r\n </s-button>\r\n </div>\r\n </div>\r\n </s-footer>\r\n</s-sidebar>\r\n\r\n<p-dialog [header]=\"'agro.angular_components.event_modal_title' | libTranslate\" [(visible)]=\"displayModal\" [modal]=\"true\" class=\"dialog\">\r\n <div class=\"event-modal-text\">{{ \"agro.angular_components.event_modal\" | libTranslate }}</div>\r\n <p-footer>\r\n <div class=\"ui-dialog-buttonpane ui-widget-content ui-helper-clearfix\">\r\n <button\r\n id=\"modal-yes\"\r\n type=\"button\"\r\n pButton\r\n icon=\"fa fa-check\"\r\n (click)=\"confirmModal()\"\r\n label=\"{{ 'agro.angular_components.yes' | libTranslate }}\"\r\n class=\"ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only\"\r\n ></button>\r\n <button\r\n id=\"modal-no\"\r\n type=\"button\"\r\n pButton\r\n icon=\"fa fa-close\"\r\n (click)=\"cancelModal()\"\r\n label=\"{{ 'agro.angular_components.no' | libTranslate }}\"\r\n class=\"ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only\"\r\n ></button>\r\n </div>\r\n </p-footer>\r\n</p-dialog>\r\n",
|
|
5071
|
+
template: "<div class=\"ui-g\" *sLoadingState=\"gridLoading\">\r\n <div class=\"ui-g-12\">\r\n <p-panel>\r\n <p-header>\r\n {{ \"agro.angular_components.event_control_header\" | libTranslate }}\r\n </p-header>\r\n <div class=\"ui-g\">\r\n <div class=\"ui-g-12\">\r\n <s-button\r\n id=\"refresh-button\"\r\n [priority]=\"ButtonPriority.Primary\"\r\n iconClass=\"fa fa-refresh\"\r\n [label]=\"'agro.angular_components.refresh' | libTranslate\"\r\n (click)=\"onSearch()\"\r\n >\r\n </s-button>\r\n <s-button\r\n *ngIf=\"standalone && eventOrigin === 'FIXATION'\"\r\n id=\"cancel-button-agro-events-lib\"\r\n iconClass=\"fa fa-times\"\r\n [label]=\"'agro.angular_components.cancel' | libTranslate\"\r\n (click)=\"openCancelModal()\"\r\n >\r\n </s-button>\r\n </div>\r\n </div>\r\n <div class=\"ui-g\">\r\n <div class=\"ui-g-12 ui-md-12\" *ngIf=\"!gridData || gridData?.length === 0\">\r\n <s-empty-state\r\n iconClass=\"fa fa-exclamation-triangle\"\r\n title=\"{{ 'agro.angular_components.nothing_found' | libTranslate }}\"\r\n [showPrimaryAction]=\"false\"\r\n description=\"{{ 'agro.angular_components.table_empty_description' | libTranslate }}\"\r\n >\r\n </s-empty-state>\r\n </div>\r\n <ng-container *ngIf=\"gridData?.length > 0\">\r\n <p-table\r\n stylelass=\"custom-table\"\r\n #eventControlTable\r\n [value]=\"gridDataResolved\"\r\n [columns]=\"gridColumns\"\r\n dataKey=\"id\"\r\n [lazy]=\"true\"\r\n [scrollable]=\"true\"\r\n [resizableColumns]=\"true\"\r\n [paginator]=\"!standalone\"\r\n [totalRecords]=\"gridTotalRecords\"\r\n [rows]=\"10\"\r\n [responsive]=\"true\"\r\n (onLazyLoad)=\"onGridChange($event)\"\r\n [sortOrder]=\"getSortOrder()\"\r\n [first]=\"getRowIndex()\"\r\n [lazyLoadOnInit]=\"false\"\r\n sortMode=\"multiple\"\r\n [rows]=\"getPageSize()\"\r\n [rowsPerPageOptions]=\"[10, 20, 50, 100]\"\r\n >\r\n <ng-template pTemplate=\"header\" let-columns>\r\n <tr>\r\n <ng-container *ngIf=\"!standalone\">\r\n <th\r\n *ngFor=\"let col of columns\"\r\n class=\"ui-lg-1 ui-md-1\"\r\n [pSortableColumn]=\"col.field\"\r\n scope=\"col\"\r\n >\r\n <div class=\"senior-header\">\r\n <span class=\"senior-header-title\">{{\r\n col.header\r\n }}</span>\r\n <p-sortIcon [field]=\"col.field\"></p-sortIcon>\r\n </div>\r\n </th>\r\n </ng-container>\r\n <th class=\"ui-lg-8 ui-md-7\" scope=\"col\">\r\n {{ \"agro.angular_components.panel_title_events_events\" | libTranslate }}\r\n </th>\r\n </tr>\r\n </ng-template>\r\n <ng-template pTemplate=\"body\" let-rowData>\r\n <tr>\r\n <ng-container *ngIf=\"!standalone\">\r\n <td class=\"ui-lg-1 ui-md-1\">\r\n {{ rowData.e070emp?.nomEmp }}\r\n </td>\r\n <td class=\"ui-lg-1 ui-md-1\">\r\n {{ rowData.e070fil?.nomFil }}\r\n </td>\r\n <td class=\"ui-lg-1 ui-md-1\">\r\n <ng-container [ngSwitch]=\"rowData.eventOrigin\">\r\n <span *ngSwitchCase=\"'BALANCE_ENTRY_CONTROL'\">\r\n {{\r\n \"agro.angular_components.balance_entry_control_event\"\r\n | libTranslate\r\n }}\r\n </span>\r\n <span *ngSwitchCase=\"'TICKET'\">\r\n {{\r\n \"agro.angular_components.ticket_maintenance_header\"\r\n | libTranslate\r\n }}\r\n </span>\r\n <span *ngSwitchCase=\"'TRANSFER'\">\r\n {{\r\n \"agro.angular_components.transfer_origin_event\"\r\n | libTranslate\r\n }}\r\n </span>\r\n <span *ngSwitchCase=\"'INVOICE'\">\r\n {{\r\n \"agro.angular_components.invoice_creating_event\"\r\n | libTranslate\r\n }}\r\n </span>\r\n <span *ngSwitchCase=\"'CHANGE_REQUEST'\">\r\n {{\r\n \"agro.angular_components.change_request_event\"\r\n | libTranslate\r\n }}\r\n </span>\r\n <span *ngSwitchCase=\"'FIXATION'\">\r\n {{\r\n \"agro.angular_components.fixation_event\"\r\n | libTranslate\r\n }}\r\n </span>\r\n </ng-container>\r\n </td>\r\n <td class=\"ui-lg-1 ui ui-md-1\">\r\n {{ rowData.controlCode || \"\" }}\r\n </td>\r\n </ng-container>\r\n <td class=\"ui-lg-8 ui-md-7\">\r\n <ng-container *ngFor=\"let group of rowData.groups\">\r\n <s-event-steps\r\n [steps]=\"group.steps || []\"\r\n [activeIndex]=\"group.activeIndex\"\r\n (stepSelected)=\"stepSelected($event)\"\r\n >\r\n </s-event-steps>\r\n </ng-container>\r\n </td>\r\n </tr>\r\n </ng-template>\r\n <ng-template\r\n *ngIf=\"!standalone\"\r\n pTemplate=\"paginatorright\"\r\n class=\"custom-table\"\r\n >\r\n <span>\r\n {{\r\n \"agro.angular_components.registers_found\"\r\n | libTranslate : { total: gridTotalRecords }\r\n }}\r\n </span>\r\n </ng-template>\r\n </p-table>\r\n </ng-container>\r\n </div>\r\n </p-panel>\r\n </div>\r\n</div>\r\n<s-sidebar [visible]=\"showSidebar\" (visibleChange)=\"closeSidebar()\" header=\"{{ 'agro.angular_components.event_details_header' | libTranslate }}\">\r\n <div class=\"ui-fluid\">\r\n <p-fieldset [legend]=\"sidebarTitle\" [toggleable]=\"false\">\r\n <div class=\"ui-g\">\r\n <div class=\"ui-g-4\">\r\n <span\r\n ><strong>{{\r\n \"agro.angular_components.event_origin_label\" | libTranslate\r\n }}</strong></span\r\n >\r\n <ng-container [ngSwitch]=\"selectedStep?.eventType\">\r\n <p *ngSwitchCase=\"'BALANCE_ENTRY_CONTROL'\">\r\n {{ \"agro.angular_components.balance_entry_control_event\" | libTranslate }}\r\n </p>\r\n <p *ngSwitchCase=\"'TICKET'\">\r\n {{ \"agro.angular_components.ticket_maintenance_header\" | libTranslate }}\r\n </p>\r\n <p *ngSwitchCase=\"'TRANSFER'\">\r\n {{ \"agro.angular_components.transfer_origin_event\" | libTranslate }}\r\n </p>\r\n <p *ngSwitchCase=\"'INVOICE'\">\r\n {{ \"agro.angular_components.invoice_creating_event\" | libTranslate }}\r\n </p>\r\n <p *ngSwitchCase=\"'CHANGE_REQUEST'\">\r\n {{ \"agro.angular_components.change_request_event\" | libTranslate }}\r\n </p>\r\n <p *ngSwitchCase=\"'FIXATION'\">\r\n {{ \"agro.angular_components.fixation_event\" | libTranslate }}\r\n </p>\r\n </ng-container>\r\n </div>\r\n <div class=\"ui-g-4\" *ngIf=\"producerInvoice?.e001pes.nomPes\">\r\n <span\r\n ><strong>{{ \"agro.angular_components.supplier\" | libTranslate }}</strong></span\r\n >\r\n <p>{{ producerInvoice?.e001pes.nomPes }}</p>\r\n </div>\r\n <div class=\"ui-g-4\" *ngIf=\"producerInvoice?.ruralEstate.name\">\r\n <span\r\n ><strong>{{ \"agro.angular_components.rural_estate\" | libTranslate }}</strong></span\r\n >\r\n <p>{{ producerInvoice?.ruralEstate.name }}</p>\r\n </div>\r\n <div class=\"ui-g-4\" *ngIf=\"selectedStep?.controlCode\">\r\n <span\r\n ><strong>{{ \"agro.angular_components.control_code\" | libTranslate }}</strong></span\r\n >\r\n <p>{{ selectedStep?.controlCode }}</p>\r\n </div>\r\n <div class=\"ui-g-4\">\r\n <span\r\n ><strong>{{ \"agro.angular_components.status_label\" | libTranslate }}</strong></span\r\n >\r\n <ng-container [ngSwitch]=\"selectedStep?.item.status\">\r\n <p *ngSwitchCase=\"'SUCCESS'\">\r\n <s-badge\r\n [color]=\"BadgeColors.Green\"\r\n text=\"{{\r\n 'agro.angular_components.panel_title_events_completed_successfully'\r\n | libTranslate\r\n }}\"\r\n [selectable]=\"false\"\r\n >\r\n </s-badge>\r\n </p>\r\n <p *ngSwitchCase=\"'PROCESSING'\">\r\n <s-badge\r\n [color]=\"BadgeColors.Orange\"\r\n text=\"{{ 'agro.angular_components.processing' | libTranslate }}\"\r\n [selectable]=\"false\"\r\n >\r\n </s-badge>\r\n </p>\r\n <p *ngSwitchCase=\"'FAILED'\">\r\n <s-badge\r\n [color]=\"BadgeColors.Red\"\r\n text=\"{{\r\n 'agro.angular_components.panel_title_events_ended_with_error'\r\n | libTranslate\r\n }}\"\r\n [selectable]=\"false\"\r\n >\r\n </s-badge>\r\n </p>\r\n <p *ngSwitchCase=\"'PENDING'\">\r\n <s-badge\r\n [color]=\"BadgeColors.Gray\"\r\n text=\"{{ 'agro.angular_components.pending' | libTranslate }}\"\r\n [selectable]=\"false\"\r\n >\r\n </s-badge>\r\n </p>\r\n </ng-container>\r\n </div>\r\n <div class=\"ui-g-4\">\r\n <span\r\n ><strong>{{\r\n \"agro.angular_components.last_update_date\" | libTranslate\r\n }}</strong></span\r\n >\r\n <p>{{ selectedStep?.item.lastModifiedDate | date : \"dd/MM/yyyy HH:mm:ss\" }}</p>\r\n </div>\r\n <div class=\"ui-g-4\" *ngIf=\"selectedStep?.item.status === 'FAILED'\">\r\n <span\r\n ><strong>{{\r\n \"agro.angular_components.event_error_message\" | libTranslate\r\n }}</strong></span\r\n >\r\n <p>{{ selectedStep?.item.message || \"-\" }}</p>\r\n </div>\r\n </div>\r\n </p-fieldset>\r\n </div>\r\n <s-footer>\r\n <div class=\"ui-g\">\r\n <div class=\"ui-g-12 width-fit\">\r\n <s-button\r\n id=\"sidebar-close-button\"\r\n [priority]=\"ButtonPriority.Primary\"\r\n [label]=\"'agro.angular_components.events_close' | libTranslate\"\r\n [auxiliary]=\"false\"\r\n (click)=\"closeSidebar()\"\r\n >\r\n </s-button>\r\n <s-button\r\n *ngIf=\"showReprocessButton\"\r\n id=\"sidebar-reprocess-button\"\r\n [priority]=\"ButtonPriority.Secondary\"\r\n iconClass=\"fa fa-refresh\"\r\n [label]=\"'agro.angular_components.reprocess_event' | libTranslate\"\r\n [auxiliary]=\"false\"\r\n (click)=\"openModal()\"\r\n >\r\n </s-button>\r\n </div>\r\n </div>\r\n </s-footer>\r\n</s-sidebar>\r\n\r\n<p-dialog [header]=\"'agro.angular_components.event_modal_title' | libTranslate\" [(visible)]=\"displayModal\" [modal]=\"true\" class=\"dialog\">\r\n <div class=\"event-modal-text\">{{ \"agro.angular_components.event_modal\" | libTranslate }}</div>\r\n <p-footer>\r\n <div class=\"ui-dialog-buttonpane ui-widget-content ui-helper-clearfix\">\r\n <button\r\n id=\"modal-yes\"\r\n type=\"button\"\r\n pButton\r\n icon=\"fa fa-check\"\r\n (click)=\"confirmModal()\"\r\n label=\"{{ 'agro.angular_components.yes' | libTranslate }}\"\r\n class=\"ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only\"\r\n ></button>\r\n <button\r\n id=\"modal-no\"\r\n type=\"button\"\r\n pButton\r\n icon=\"fa fa-close\"\r\n (click)=\"cancelModal()\"\r\n label=\"{{ 'agro.angular_components.no' | libTranslate }}\"\r\n class=\"ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only\"\r\n ></button>\r\n </div>\r\n </p-footer>\r\n</p-dialog>\r\n\r\n<p-confirmDialog\r\n [acceptLabel]=\"'agro.angular_components.yes' | libTranslate\"\r\n acceptIcon=\"\"\r\n acceptButtonStyleClass=\"ui-button\"\r\n [rejectLabel]=\"'agro.angular_components.no' | libTranslate\"\r\n rejectIcon=\"\"\r\n rejectButtonStyleClass=\"ui-button-secondary\">\r\n</p-confirmDialog>\r\n",
|
|
5070
5072
|
providers: [
|
|
5071
5073
|
{ provide: core.LOCALE_ID, useValue: 'pt-BR' }
|
|
5072
5074
|
],
|
|
5073
|
-
styles: [".frozen{border-left:2px solid #ddd}.dialog{width:\"600px\";height:\"300px\";z-index:100000}"]
|
|
5075
|
+
styles: [".frozen{border-left:2px solid #ddd}.dialog{width:\"600px\";height:\"300px\";z-index:100000}:host ::ng-deep #cancel-button-agro-events-lib{background-color:#9c3a3a!important;border-color:#9c3a3a!important}:host ::ng-deep #cancel-button-agro-events-lib:hover{background-color:#642525!important}"]
|
|
5074
5076
|
})
|
|
5075
5077
|
], EventControlBoardComponent);
|
|
5076
5078
|
return EventControlBoardComponent;
|
|
@@ -5771,6 +5773,61 @@
|
|
|
5771
5773
|
return RuralEstateModule;
|
|
5772
5774
|
}());
|
|
5773
5775
|
|
|
5776
|
+
var TicketService = /** @class */ (function (_super) {
|
|
5777
|
+
__extends(TicketService, _super);
|
|
5778
|
+
function TicketService(http, messageService, translate) {
|
|
5779
|
+
var _this = _super.call(this, http, messageService, "agro/origination/entities/ticket", "agro/origination/actions", "agro/origination/queries", translate) || this;
|
|
5780
|
+
_this.http = http;
|
|
5781
|
+
_this.messageService = messageService;
|
|
5782
|
+
_this.translate = translate;
|
|
5783
|
+
return _this;
|
|
5784
|
+
}
|
|
5785
|
+
TicketService.prototype.getTicketSummaryByParent = function (parent) {
|
|
5786
|
+
return this.http
|
|
5787
|
+
.post(this.queriesUrl + "/getTicketSummaryByParent/", { parent: parent })
|
|
5788
|
+
.pipe(this.defaultCatch());
|
|
5789
|
+
};
|
|
5790
|
+
TicketService.prototype.listMainteinerTickets = function (filter) {
|
|
5791
|
+
return this.http
|
|
5792
|
+
.post(this.queriesUrl + "/listMainteinerTickets/", filter)
|
|
5793
|
+
.pipe(this.defaultCatch());
|
|
5794
|
+
};
|
|
5795
|
+
TicketService.prototype.searchTotalWeightResultFromTickets = function (body) {
|
|
5796
|
+
return this.http
|
|
5797
|
+
.post(this.queriesUrl + "/searchTotalWeightResultFromTickets/", body)
|
|
5798
|
+
.pipe(this.defaultCatch());
|
|
5799
|
+
};
|
|
5800
|
+
TicketService.prototype.cancelTicket = function (body) {
|
|
5801
|
+
return this.http
|
|
5802
|
+
.post(this.actionsUrl + "/cancelTicket/", body);
|
|
5803
|
+
};
|
|
5804
|
+
TicketService.prototype.mergeTickets = function (body) {
|
|
5805
|
+
return this.http.post(this.actionsUrl + "/mergeTickets/", body).pipe(this.defaultCatch());
|
|
5806
|
+
};
|
|
5807
|
+
TicketService.prototype.unMergeTickets = function (body) {
|
|
5808
|
+
return this.http.post(this.actionsUrl + "/unMergeTickets/", body).pipe(this.defaultCatch());
|
|
5809
|
+
};
|
|
5810
|
+
TicketService.prototype.checkGroupInvoicePermission = function (body) {
|
|
5811
|
+
return this.http
|
|
5812
|
+
.post(this.queriesUrl + "/checkGroupInvoicePermission/", body)
|
|
5813
|
+
.pipe(this.defaultCatch());
|
|
5814
|
+
};
|
|
5815
|
+
TicketService.prototype.getContractTickets = function (tickets) {
|
|
5816
|
+
return this.http
|
|
5817
|
+
.post(this.queriesUrl + "/getContractTickets/", { tickets: tickets })
|
|
5818
|
+
.pipe(this.defaultCatch());
|
|
5819
|
+
};
|
|
5820
|
+
TicketService.ctorParameters = function () { return [
|
|
5821
|
+
{ type: http.HttpClient },
|
|
5822
|
+
{ type: api.MessageService },
|
|
5823
|
+
{ type: LibTranslationService }
|
|
5824
|
+
]; };
|
|
5825
|
+
TicketService = __decorate([
|
|
5826
|
+
core.Injectable()
|
|
5827
|
+
], TicketService);
|
|
5828
|
+
return TicketService;
|
|
5829
|
+
}(EntityService));
|
|
5830
|
+
|
|
5774
5831
|
var TicketModule = /** @class */ (function () {
|
|
5775
5832
|
function TicketModule() {
|
|
5776
5833
|
}
|
|
@@ -5863,6 +5920,28 @@
|
|
|
5863
5920
|
return TransferModule;
|
|
5864
5921
|
}());
|
|
5865
5922
|
|
|
5923
|
+
var FixationModule = /** @class */ (function () {
|
|
5924
|
+
function FixationModule() {
|
|
5925
|
+
}
|
|
5926
|
+
FixationModule = __decorate([
|
|
5927
|
+
core.NgModule({
|
|
5928
|
+
imports: [
|
|
5929
|
+
platformComponents.PermissionsModule.forChild([
|
|
5930
|
+
{
|
|
5931
|
+
name: 'fixation',
|
|
5932
|
+
actions: ['Visualizar', 'Incluir', 'Editar', 'Excluir'],
|
|
5933
|
+
uri: "res://senior.com.br/agro/fixation/entities/fixation",
|
|
5934
|
+
},
|
|
5935
|
+
]),
|
|
5936
|
+
],
|
|
5937
|
+
providers: [FixationService],
|
|
5938
|
+
declarations: [],
|
|
5939
|
+
exports: [],
|
|
5940
|
+
})
|
|
5941
|
+
], FixationModule);
|
|
5942
|
+
return FixationModule;
|
|
5943
|
+
}());
|
|
5944
|
+
|
|
5866
5945
|
var EventControlBoardModule = /** @class */ (function () {
|
|
5867
5946
|
function EventControlBoardModule() {
|
|
5868
5947
|
}
|
|
@@ -5891,11 +5970,13 @@
|
|
|
5891
5970
|
RuralEstateModule,
|
|
5892
5971
|
TicketModule,
|
|
5893
5972
|
WebsocketModule,
|
|
5894
|
-
LibTranslationModule
|
|
5973
|
+
LibTranslationModule,
|
|
5974
|
+
FixationModule
|
|
5895
5975
|
],
|
|
5896
5976
|
declarations: [EventControlBoardComponent],
|
|
5897
5977
|
exports: [EventControlBoardComponent],
|
|
5898
|
-
providers: [E012famService, E205depService, PaginatorStorageService,
|
|
5978
|
+
providers: [E012famService, E205depService, PaginatorStorageService,
|
|
5979
|
+
EventControlService, EventControlBoardService, primeng.ConfirmationService],
|
|
5899
5980
|
})
|
|
5900
5981
|
], EventControlBoardModule);
|
|
5901
5982
|
return EventControlBoardModule;
|
|
@@ -5951,6 +6032,7 @@
|
|
|
5951
6032
|
exports.EventStepsComponent = EventStepsComponent;
|
|
5952
6033
|
exports.EventStepsModule = EventStepsModule;
|
|
5953
6034
|
exports.ExternalInvoiceModule = ExternalInvoiceModule;
|
|
6035
|
+
exports.FixationModule = FixationModule;
|
|
5954
6036
|
exports.HostProjectConfigsInjectionToken = HostProjectConfigsInjectionToken;
|
|
5955
6037
|
exports.InvoiceModule = InvoiceModule;
|
|
5956
6038
|
exports.LibTranslatePipe = LibTranslatePipe;
|