@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.
Files changed (111) hide show
  1. package/bundles/senior-agronegocio-angular-components.umd.js +817 -735
  2. package/bundles/senior-agronegocio-angular-components.umd.js.map +1 -1
  3. package/bundles/senior-agronegocio-angular-components.umd.min.js +2 -2
  4. package/bundles/senior-agronegocio-angular-components.umd.min.js.map +1 -1
  5. package/common/agro-regex.constant.d.ts +0 -8
  6. package/common/agro-string-utils.class.d.ts +0 -13
  7. package/components/event-control-board/common/event-operation.d.ts +7 -1
  8. package/components/event-control-board/common/event-origin.d.ts +2 -1
  9. package/components/event-control-board/event-control-board.component.d.ts +12 -12
  10. package/components/event-control-board/index.d.ts +1 -0
  11. package/components/event-control-board/service/event-control/event-control-dto.d.ts +3 -0
  12. package/components/event-control-board/service/event-control/event-control.d.ts +3 -0
  13. package/components/event-control-board/service/event-control-board.service.d.ts +3 -3
  14. package/components/event-control-board/service/fixation-entity/fixation-dto.d.ts +40 -0
  15. package/components/event-control-board/service/fixation-entity/fixation.module.d.ts +2 -0
  16. package/components/event-control-board/service/fixation-entity/fixation.service.d.ts +15 -0
  17. package/enums/agro-numbers.enum.d.ts +2 -1
  18. package/enums/fixation-status.d.ts +8 -0
  19. package/esm2015/common/agro-platform-utils.class.js +5 -6
  20. package/esm2015/common/agro-regex.constant.js +1 -9
  21. package/esm2015/common/agro-string-utils.class.js +58 -38
  22. package/esm2015/components/event-control-board/common/event-control-constants.js +8 -2
  23. package/esm2015/components/event-control-board/common/event-operation.js +7 -1
  24. package/esm2015/components/event-control-board/common/event-origin.js +2 -1
  25. package/esm2015/components/event-control-board/event-control-board.component.js +105 -132
  26. package/esm2015/components/event-control-board/event-control-board.module.js +7 -4
  27. package/esm2015/components/event-control-board/index.js +2 -1
  28. package/esm2015/components/event-control-board/service/event-control/event-control-dto.js +1 -1
  29. package/esm2015/components/event-control-board/service/event-control/event-control.js +1 -1
  30. package/esm2015/components/event-control-board/service/event-control-board.service.js +10 -10
  31. package/esm2015/components/event-control-board/service/fixation-entity/fixation-dto.js +1 -0
  32. package/esm2015/components/event-control-board/service/fixation-entity/fixation.module.js +24 -0
  33. package/esm2015/components/event-control-board/service/fixation-entity/fixation.service.js +29 -0
  34. package/esm2015/enums/agro-numbers.enum.js +2 -1
  35. package/esm2015/enums/fixation-status.js +10 -0
  36. package/esm2015/form-validator/agro-form-validator.js +30 -39
  37. package/esm2015/services/i18n/en-US.js +17 -3
  38. package/esm2015/services/i18n/es-CO.js +17 -3
  39. package/esm2015/services/i18n/pt-BR.js +16 -2
  40. package/esm5/common/agro-platform-utils.class.js +5 -6
  41. package/esm5/common/agro-regex.constant.js +1 -9
  42. package/esm5/common/agro-string-utils.class.js +58 -38
  43. package/esm5/components/event-control-board/common/event-control-constants.js +8 -2
  44. package/esm5/components/event-control-board/common/event-operation.js +7 -1
  45. package/esm5/components/event-control-board/common/event-origin.js +2 -1
  46. package/esm5/components/event-control-board/event-control-board.component.js +111 -138
  47. package/esm5/components/event-control-board/event-control-board.module.js +7 -4
  48. package/esm5/components/event-control-board/index.js +2 -1
  49. package/esm5/components/event-control-board/service/event-control/event-control-dto.js +1 -1
  50. package/esm5/components/event-control-board/service/event-control/event-control.js +1 -1
  51. package/esm5/components/event-control-board/service/event-control-board.service.js +10 -10
  52. package/esm5/components/event-control-board/service/fixation-entity/fixation-dto.js +1 -0
  53. package/esm5/components/event-control-board/service/fixation-entity/fixation.module.js +27 -0
  54. package/esm5/components/event-control-board/service/fixation-entity/fixation.service.js +32 -0
  55. package/esm5/enums/agro-numbers.enum.js +2 -1
  56. package/esm5/enums/fixation-status.js +10 -0
  57. package/esm5/form-validator/agro-form-validator.js +31 -39
  58. package/esm5/services/i18n/en-US.js +17 -3
  59. package/esm5/services/i18n/es-CO.js +17 -3
  60. package/esm5/services/i18n/pt-BR.js +16 -2
  61. package/fesm2015/senior-agronegocio-angular-components.js +774 -700
  62. package/fesm2015/senior-agronegocio-angular-components.js.map +1 -1
  63. package/fesm5/senior-agronegocio-angular-components.js +819 -738
  64. package/fesm5/senior-agronegocio-angular-components.js.map +1 -1
  65. package/form-validator/agro-form-validator.d.ts +15 -17
  66. package/package.json +1 -1
  67. package/services/i18n/en-US.d.ts +14 -0
  68. package/services/i18n/es-CO.d.ts +14 -0
  69. package/services/i18n/pt-BR.d.ts +14 -0
  70. package/components/event-control-board/common/invoice-status.d.ts +0 -12
  71. package/components/event-control-board/common/invoice-type.d.ts +0 -5
  72. package/components/event-control-board/service/e012fam/e012fam.d.ts +0 -14
  73. package/components/event-control-board/service/e075der/e075der.d.ts +0 -18
  74. package/components/event-control-board/service/e113saf/e113saf.d.ts +0 -14
  75. package/components/event-control-board/service/e205dep/e205dep-dto.d.ts +0 -15
  76. package/components/event-control-board/service/e205dep/e205dep.d.ts +0 -16
  77. package/components/event-control-board/service/external-invoice/external-invoice.d.ts +0 -13
  78. package/components/event-control-board/service/invoice/invoice.d.ts +0 -21
  79. package/components/event-control-board/service/origination/operationType.d.ts +0 -5
  80. package/components/event-control-board/service/origination/origination.d.ts +0 -51
  81. package/components/event-control-board/service/producer-invoice/producer-invoice.d.ts +0 -27
  82. package/components/event-control-board/service/rural-estate/rural-estate.d.ts +0 -34
  83. package/components/event-control-board/service/ticket/ticket.d.ts +0 -18
  84. package/esm2015/components/event-control-board/common/invoice-status.js +0 -14
  85. package/esm2015/components/event-control-board/common/invoice-type.js +0 -7
  86. package/esm2015/components/event-control-board/service/e012fam/e012fam.js +0 -20
  87. package/esm2015/components/event-control-board/service/e075der/e075der.js +0 -31
  88. package/esm2015/components/event-control-board/service/e113saf/e113saf.js +0 -20
  89. package/esm2015/components/event-control-board/service/e205dep/e205dep-dto.js +0 -1
  90. package/esm2015/components/event-control-board/service/e205dep/e205dep.js +0 -20
  91. package/esm2015/components/event-control-board/service/external-invoice/external-invoice.js +0 -20
  92. package/esm2015/components/event-control-board/service/invoice/invoice.js +0 -43
  93. package/esm2015/components/event-control-board/service/origination/operationType.js +0 -7
  94. package/esm2015/components/event-control-board/service/origination/origination.js +0 -59
  95. package/esm2015/components/event-control-board/service/producer-invoice/producer-invoice.js +0 -32
  96. package/esm2015/components/event-control-board/service/rural-estate/rural-estate.js +0 -78
  97. package/esm2015/components/event-control-board/service/ticket/ticket.js +0 -39
  98. package/esm5/components/event-control-board/common/invoice-status.js +0 -14
  99. package/esm5/components/event-control-board/common/invoice-type.js +0 -7
  100. package/esm5/components/event-control-board/service/e012fam/e012fam.js +0 -25
  101. package/esm5/components/event-control-board/service/e075der/e075der.js +0 -36
  102. package/esm5/components/event-control-board/service/e113saf/e113saf.js +0 -25
  103. package/esm5/components/event-control-board/service/e205dep/e205dep-dto.js +0 -1
  104. package/esm5/components/event-control-board/service/e205dep/e205dep.js +0 -25
  105. package/esm5/components/event-control-board/service/external-invoice/external-invoice.js +0 -25
  106. package/esm5/components/event-control-board/service/invoice/invoice.js +0 -48
  107. package/esm5/components/event-control-board/service/origination/operationType.js +0 -7
  108. package/esm5/components/event-control-board/service/origination/origination.js +0 -62
  109. package/esm5/components/event-control-board/service/producer-invoice/producer-invoice.js +0 -37
  110. package/esm5/components/event-control-board/service/rural-estate/rural-estate.js +0 -83
  111. package/esm5/components/event-control-board/service/ticket/ticket.js +0 -44
@@ -1,6 +1,6 @@
1
1
  import moment from 'moment';
2
2
  import { __awaiter, __decorate } from 'tslib';
3
- import { Subject, BehaviorSubject, of, throwError, forkJoin } from 'rxjs';
3
+ import { Subject, BehaviorSubject, of, throwError } from 'rxjs';
4
4
  import sockjsClient from 'sockjs-client';
5
5
  import { ɵɵdefineInjectable, Injectable, ɵɵinject, NgModule, Input, Component, LOCALE_ID, EventEmitter, Output, Pipe, InjectionToken } from '@angular/core';
6
6
  import { filter, take, finalize, switchMap, map, catchError, takeUntil } from 'rxjs/operators';
@@ -10,7 +10,7 @@ import { CommonModule, registerLocaleData } from '@angular/common';
10
10
  import { Validators, FormBuilder, FormsModule, ReactiveFormsModule } from '@angular/forms';
11
11
  import { ButtonPriority, BadgeColors, FormField, FieldType, StepState as StepState$1, ButtonModule, CustomFieldsModule, ControlErrorsModule, EmptyStateModule, DynamicFormModule, TokenListModule, SidebarModule, LoadingStateModule, NumberInputModule, TableModule as TableModule$1, ObjectCardModule, LocaleModule, BadgeModule } from '@seniorsistemas/angular-components';
12
12
  import localePt from '@angular/common/locales/pt';
13
- import { MessageService as MessageService$1, DialogModule, FieldsetModule } from 'primeng';
13
+ import { MessageService as MessageService$1, ConfirmationService, DialogModule, FieldsetModule } from 'primeng';
14
14
  import { user } from '@seniorsistemas/senior-platform-data';
15
15
  import { HttpParams, HttpClient } from '@angular/common/http';
16
16
  import { MessageService, SharedModule as SharedModule$1 } from 'primeng/api';
@@ -34,6 +34,149 @@ var DateComparisonType;
34
34
  DateComparisonType["lessThan"] = "lessThan";
35
35
  })(DateComparisonType || (DateComparisonType = {}));
36
36
 
37
+ const AGRO_REGEX = {
38
+ /**
39
+ * Validação de E-mail
40
+ */
41
+ isEmail: /^[^\s@]+@[^\s@]+\.[^\s@]+$/,
42
+ /**
43
+ * Validação de Números Inteiros Positivos
44
+ */
45
+ positiveInteger: /^[1-9]\d*$/,
46
+ /**
47
+ * Validação de Números Decimais Positivos
48
+ */
49
+ positiveDecimal: /^\d*\.?\d+$/,
50
+ /**
51
+ * Validação de string que consiste apenas em espaços em branco ou está vazia.
52
+ */
53
+ onlyBlankSpaces: /^\s*$/,
54
+ /**
55
+ * Validação de CEP (Código Postal)
56
+ */
57
+ zipCode: /^\d{8}$|^\d{5}-\d{3}$/,
58
+ /**
59
+ * Validação de String (qualquer caractere)
60
+ */
61
+ isString: /^[\s\S]*$/,
62
+ /**
63
+ * Validação de UUID
64
+ */
65
+ 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}$/,
66
+ /**
67
+ * Validação de Número
68
+ */
69
+ isNumber: /^-?\d+$/,
70
+ /**
71
+ * Validação de Número Decimal
72
+ */
73
+ isDecimal: /^\d*\.?\d+$/,
74
+ /**
75
+ * Validação de Placa de Veículo
76
+ */
77
+ isLicensePlate: /^[A-Za-z0-9]{1,7}-?[A-Za-z0-9]{1,7}$/,
78
+ /**
79
+ * Validação de Número de Telefone
80
+ */
81
+ isPhoneNumber: /^\+?\d{1,4}-?\d{6,11}$/,
82
+ /**
83
+ * Validação de Data (Formato YYYY-MM-DD)
84
+ */
85
+ isDate: /^\d{4}-\d{2}-\d{2}$/,
86
+ /**
87
+ * Validação de Hora (Formato HH:mm)
88
+ */
89
+ isTime: /^(0\d|1\d|2[0-3]):[0-5]\d$/,
90
+ /**
91
+ * Validação de Data e Hora (Formato YYYY-MM-DD HH:mm)
92
+ */
93
+ isDateTime: /^\d{4}-\d{2}-\d{2} (0\d|1\d|2[0-3]):[0-5]\d$/,
94
+ /**
95
+ * Validação de URL
96
+ */
97
+ isURL: /^(http|https):\/\/([\w-]+\.)+[\w-]+(\/[\w- ./?%&=]*)?$/,
98
+ /**
99
+ * Validação de Número Hexadecimal
100
+ */
101
+ isHexNumber: /^[0-9a-fA-F]+$/,
102
+ /**
103
+ * Validação de Base64
104
+ */
105
+ isBase64: /^[a-zA-Z0-9+/]+={0,2}$/,
106
+ /**
107
+ * Validação de Nome de Usuário (3 a 20 caracteres alfanuméricos)
108
+ */
109
+ isUsername: /^\w{3,20}$/,
110
+ /**
111
+ * Validação de Alfanumérico
112
+ */
113
+ isAlphanumeric: /^[a-zA-Z0-9]+$/,
114
+ /**
115
+ * Validação de Slug (letras minúsculas, números e traços)
116
+ */
117
+ isSlug: /^[a-z0-9-]+$/,
118
+ /**
119
+ * Validação de Número de Cartão de Crédito
120
+ */
121
+ isCreditCard: /^\d{4}-\d{4}-\d{4}-\d{4}$/,
122
+ /**
123
+ * Validação de Número Hexadecimal
124
+ */
125
+ isHexadecimal: /^[0-9a-fA-F]+$/,
126
+ /**
127
+ * Validação de Moeda
128
+ */
129
+ isCurrency: /^\d+(\.\d{1,2})?$/,
130
+ /**
131
+ * Validação de Porcentagem
132
+ */
133
+ isPercentage: /^(100(\.0{1,2})?|[1-9]?\d(\.\d{1,2})?)$/,
134
+ /**
135
+ * Validação de Tag HTML Simples
136
+ */
137
+ isHTMLTag: /^<([a-z]+)([^<]+)*(?:>(.*)<\/\1>|\s+\/>)$/,
138
+ /**
139
+ * Validação de Nome de Usuário com Espaços (3 a 20 caracteres alfanuméricos e espaços)
140
+ */
141
+ isUsernameWithSpaces: /^[a-zA-Z0-9_ ]{3,20}$/,
142
+ /**
143
+ * Validação de Senha Forte (mínimo 8 caracteres, uma letra minúscula, uma letra maiúscula, um número e um caractere especial)
144
+ */
145
+ isStrongPassword: /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$/,
146
+ /**
147
+ * Validação de String Alfabética
148
+ */
149
+ isAlphabetic: /^[a-zA-Z]+$/,
150
+ /**
151
+ * Validação de Hora no Formato de 12 Horas
152
+ */
153
+ isTime12Hour: /^(0?[1-9]|1[0-2]):\d{2} (AM|PM)$/i,
154
+ /**
155
+ * Validação de Latitude
156
+ */
157
+ isLatitude: /^[-+]?([1-8]?\d(\.\d+)?|90(\.0+)?)$/,
158
+ /**
159
+ * Validação de Longitude
160
+ */
161
+ isLongitude: /^[-+]?(180(\.0+)?|((1[0-7]\d)|([1-9]?\d))(\.\d+)?)$/,
162
+ /**
163
+ * Validação de Endereço MAC
164
+ */
165
+ isMACAddress: /^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$/,
166
+ /**
167
+ * Validação de Data de Expiração de Cartão de Crédito
168
+ */
169
+ isCreditCardExpiration: /^(0[1-9]|1[0-2])\/\d{2}$/,
170
+ /**
171
+ * Validação de Número de Seguro Social (SSN)
172
+ */
173
+ isSSN: /^\d{3}-\d{2}-\d{4}$/,
174
+ /**
175
+ * Validação se todos os dígitos são iguais
176
+ */
177
+ isAllDigitsEqual: /^(.)\1+$/,
178
+ };
179
+
37
180
  var NumberComparisonType;
38
181
  (function (NumberComparisonType) {
39
182
  NumberComparisonType["EQUALS"] = "EQUALS";
@@ -1055,6 +1198,7 @@ var AGRO_NUMBERS;
1055
1198
  AGRO_NUMBERS[AGRO_NUMBERS["TWO_HUNDRED_AND_TWENTY_ZERO"] = 220] = "TWO_HUNDRED_AND_TWENTY_ZERO";
1056
1199
  AGRO_NUMBERS[AGRO_NUMBERS["TWO_HUNDRED_AND_TWO"] = 202] = "TWO_HUNDRED_AND_TWO";
1057
1200
  AGRO_NUMBERS[AGRO_NUMBERS["ZERO"] = 0] = "ZERO";
1201
+ AGRO_NUMBERS[AGRO_NUMBERS["FIVE_SECONDS"] = 5000] = "FIVE_SECONDS";
1058
1202
  })(AGRO_NUMBERS || (AGRO_NUMBERS = {}));
1059
1203
 
1060
1204
  var AgroStringMasks;
@@ -1378,56 +1522,281 @@ class AgroObjectUtils {
1378
1522
  }
1379
1523
  }
1380
1524
 
1381
- class AgroCookieUtils {
1382
- static getCookie(name, parseURIValue = false) {
1383
- const cookieValue = document.cookie.split(';')
1384
- .map(cookie => cookie.trim())
1385
- .find(cookie => cookie.startsWith(name));
1386
- let result = cookieValue === null || cookieValue === void 0 ? void 0 : cookieValue.split('=')[1];
1387
- if (parseURIValue && result) {
1388
- result = decodeURIComponent(result);
1389
- }
1390
- return result;
1391
- }
1392
- static parseCookieToObject(cookieString, parseURIString = false) {
1393
- const cookieObject = {};
1394
- if (parseURIString) {
1395
- cookieString = decodeURIComponent(cookieString);
1525
+ class AgroFormValidator {
1526
+ /**
1527
+ * Validator para checar se o campo é um e-mail
1528
+ *
1529
+ * @example
1530
+ * this.myForm = this.fb.group({
1531
+ * EMAIL_FIELD: ['', [Validators.required, AgroFormValidator.emailValidator]]
1532
+ * });
1533
+ * @param control
1534
+ * @returns
1535
+ */
1536
+ static emailValidator(control) {
1537
+ if (control.value && !AGRO_REGEX.isEmail.test(control.value)) {
1538
+ control.setErrors({ emailValidator: true });
1539
+ return { emailValidator: true };
1396
1540
  }
1397
- cookieString.split(';').forEach(cookie => {
1398
- const [key, value] = cookie.split('=').map(c => c.trim());
1399
- cookieObject[key] = value;
1400
- });
1401
- return cookieObject;
1402
- }
1403
- setCookie(name, value, days) {
1404
- const date = new Date();
1405
- date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
1406
- const expires = 'expires=' + date.toUTCString();
1407
- document.cookie = name + '=' + value + ';' + expires + ';path=/';
1541
+ control.setErrors(null);
1542
+ return null;
1408
1543
  }
1409
- }
1410
-
1411
- class AgroDateUtils {
1412
1544
  /**
1413
- * Verifica se uma data é nula ou indefinida.
1414
- * @param date - A data a ser verificada.
1415
- * @returns True se a data for nula ou indefinida, false caso contrário.
1545
+ * Aplique esse validador em um campo do tipo Date, para verificar se a data selecionada é maior ou menor que a data atual.
1546
+ *
1547
+ * Utilize o parâmetro comparisonType para definir se a data selecionada deve ser maior ou menor que a data atual.
1548
+ * A validação será através do enum DateComparisonType.
1549
+ *
1550
+ * @example
1551
+ * this.myForm = this.fb.group({
1552
+ * NOME_CAMPO: ['', [Validators.required, AgroFormValidator.compareDateWithToday(DateComparisonType.greatherThan)]]
1553
+ * });
1554
+ * @param comparisonType
1555
+ * @returns
1416
1556
  */
1417
- static isNullOrUndefined(date) {
1418
- return date === null || date === undefined;
1557
+ static compareDateWithToday(comparisonType) {
1558
+ const compareDate = (control) => {
1559
+ const methodName = 'dateComparisonToday';
1560
+ const selectedDate = new Date(control.value);
1561
+ const currentDate = new Date();
1562
+ const conditions = {
1563
+ [DateComparisonType.greatherThan]: selectedDate <= currentDate,
1564
+ [DateComparisonType.lessThan]: selectedDate >= currentDate
1565
+ };
1566
+ if (conditions[comparisonType]) {
1567
+ return { [methodName]: { value: control.value } };
1568
+ }
1569
+ return null;
1570
+ };
1571
+ return compareDate;
1419
1572
  }
1420
1573
  /**
1421
- * Verifica se uma data não é nula e não é indefinida.
1422
- * @param date - A data a ser verificada.
1423
- * @returns True se a data não for nula e não for indefinida, false caso contrário.
1574
+ * Compara dois campos do tipo Date, verificando se o campo A é maior que o campo B. Se A for maior que B, então
1575
+ * o campo A é invalidado. Caso contrário, o campo A é validado.
1576
+ *
1577
+ * Aplique esse campo no FormGroup, passando os nomes dos campos que deseja comparar.
1578
+ * @example
1579
+ * this.myForm = this.fb.group({
1580
+ NOME_CAMPO_dateA: ['', Validators.required],
1581
+ NOME_CAMPO_dateB: ['', Validators.required]
1582
+ }, { validator: AgroFormValidator.dateComparisonValidator('NOME_CAMPO_dateA', 'NOME_CAMPO_dateB') });
1583
+ * @param controlNameA
1584
+ * @param controlNameB
1585
+ * @returns
1424
1586
  */
1425
- static isNotNullOrUndefined(date) {
1426
- return !AgroDateUtils.isNullOrUndefined(date);
1587
+ static compareDateWithOtherDateField(controlNameA, controlNameB) {
1588
+ const compareDate = (control) => {
1589
+ var _a, _b, _c, _d, _e;
1590
+ const formGroup = control;
1591
+ const dateA = (_a = formGroup.get(controlNameA)) === null || _a === void 0 ? void 0 : _a.value;
1592
+ const dateB = (_b = formGroup.get(controlNameB)) === null || _b === void 0 ? void 0 : _b.value;
1593
+ const methodName = 'compareDateWithOtherDateField';
1594
+ if (dateA && dateB) {
1595
+ const dateAObj = new Date(dateA);
1596
+ const dateBObj = new Date(dateB);
1597
+ if (dateAObj < dateBObj) {
1598
+ (_c = formGroup.get(controlNameA)) === null || _c === void 0 ? void 0 : _c.setErrors({ [methodName]: true });
1599
+ return { [methodName]: true };
1600
+ }
1601
+ else if ((_d = formGroup.get(controlNameA)) === null || _d === void 0 ? void 0 : _d.hasError(methodName)) {
1602
+ (_e = formGroup.get(controlNameA)) === null || _e === void 0 ? void 0 : _e.setErrors(null);
1603
+ }
1604
+ }
1605
+ return null;
1606
+ };
1607
+ return compareDate;
1427
1608
  }
1428
1609
  /**
1429
- * Verifica se uma data é válida.
1430
- * @param date - A data a ser verificada.
1610
+ * Validator para checar se o campo é um número de telefone de acordo com uma máscara informada.
1611
+ *
1612
+ * @example
1613
+ * this.myForm = this.fb.group({
1614
+ * TELEFONE_FIELD: ['', [Validators.required, AgroFormValidator.phoneValidator('(99) 9999-9999')]]
1615
+ * });
1616
+ * @param mask
1617
+ * @returns
1618
+ */
1619
+ static phoneValidator(mask) {
1620
+ const phoneControlValidation = (control) => {
1621
+ const methodName = 'phoneValidator';
1622
+ const regex = new RegExp(`^${mask.replace(/9/g, '\\d').replace(/\(/g, '\\(').replace(/\)/g, '\\)').replace(/-/g, '\\-')}$`);
1623
+ if (control.value && !regex.test(control.value)) {
1624
+ control.setErrors({ [methodName]: true });
1625
+ return { [methodName]: true };
1626
+ }
1627
+ control.setErrors(null);
1628
+ return null;
1629
+ };
1630
+ return phoneControlValidation;
1631
+ }
1632
+ /**
1633
+ * Validator para checar se um campo de números é maior ou menor que outro campo.
1634
+ *
1635
+ * Aplique esse validator no FormGroup, passando os nomes dos campos que deseja comparar.
1636
+ * @example
1637
+ * this.myForm = this.fb.group({
1638
+ * NUMERO_A: ['', Validators.required],
1639
+ * NUMERO_B: ['', Validators.required]
1640
+ * }, { validator: AgroFormValidator.compareNumberFields('NUMERO_A', 'NUMERO_B', NumberComparisonType.EQUALS) });
1641
+ *
1642
+ * Neste caso, a verificação será se o NUMERO_A é igual ao NUMERB_B.
1643
+ * @param controlNameA
1644
+ * @param controlNameB
1645
+ * @returns
1646
+ */
1647
+ static compareNumberFields(controlNameA, controlNameB, comparisonMethod) {
1648
+ const compareNumber = (control) => {
1649
+ var _a, _b, _c;
1650
+ const formGroup = control;
1651
+ const numberA = (_a = formGroup.get(controlNameA)) === null || _a === void 0 ? void 0 : _a.value;
1652
+ const numberB = (_b = formGroup.get(controlNameB)) === null || _b === void 0 ? void 0 : _b.value;
1653
+ const methodName = 'compareNumberFields';
1654
+ if (numberA && numberB) {
1655
+ const errorType = NumberComparisonType[comparisonMethod];
1656
+ const errorCondition = {
1657
+ [NumberComparisonType.EQUALS]: numberA !== numberB,
1658
+ [NumberComparisonType.GREATER_THAN]: numberA <= numberB,
1659
+ [NumberComparisonType.LESS_THAN]: numberA >= numberB,
1660
+ [NumberComparisonType.GREATER_THAN_OR_EQUAL]: numberA < numberB,
1661
+ [NumberComparisonType.LESS_THAN_OR_EQUAL]: numberA > numberB,
1662
+ [NumberComparisonType.NOT_EQUALS]: numberA === numberB
1663
+ };
1664
+ if (errorCondition[comparisonMethod]) {
1665
+ const controlA = formGroup.get(controlNameA);
1666
+ if (controlA) {
1667
+ controlA.setErrors({ [methodName]: comparisonMethod });
1668
+ }
1669
+ return { [methodName]: errorType };
1670
+ }
1671
+ else if ((_c = formGroup.get(controlNameA)) === null || _c === void 0 ? void 0 : _c.hasError(methodName)) {
1672
+ const controlA = formGroup.get(controlNameA);
1673
+ if (controlA) {
1674
+ controlA.setErrors(null);
1675
+ }
1676
+ }
1677
+ }
1678
+ return null;
1679
+ };
1680
+ return compareNumber;
1681
+ }
1682
+ /**
1683
+ * Validator para checar se um valor está entre os demais valores de três formControls.
1684
+ *
1685
+ * Aplique esse validator no FormGroup, passando os nomes dos três formControls que deseja comparar.
1686
+ * @example
1687
+ * this.myForm = this.fb.group({
1688
+ * minorFormControl: ['', Validators.required],
1689
+ * targetFormControl: ['', Validators.required],
1690
+ * majorFormControl: ['', Validators.required]
1691
+ * }, { validator: AgroFormValidator.checkValueBetween('minorFormControl', 'targetFormControl', 'majorFormControl') });
1692
+ *
1693
+ * Neste caso, a verificação será se o targetFormControl está entre o minorFormControl e o majorFormControl.
1694
+ * @param minorFormControl
1695
+ * @param targetFormControl
1696
+ * @param majorFormControl
1697
+ * @returns
1698
+ */
1699
+ static checkValueBetween(minorFormControl, targetFormControl, majorFormControl) {
1700
+ const checkValue = (control) => {
1701
+ var _a, _b, _c, _d;
1702
+ const formGroup = control;
1703
+ const valueA = (_a = formGroup.get(minorFormControl)) === null || _a === void 0 ? void 0 : _a.value;
1704
+ const valueB = (_b = formGroup.get(targetFormControl)) === null || _b === void 0 ? void 0 : _b.value;
1705
+ const valueC = (_c = formGroup.get(majorFormControl)) === null || _c === void 0 ? void 0 : _c.value;
1706
+ const methodName = 'checkValueBetween';
1707
+ if (valueA && valueB && valueC) {
1708
+ if (valueB < valueA || valueB > valueC) {
1709
+ const targetControl = formGroup.get(targetFormControl);
1710
+ if (targetControl) {
1711
+ targetControl.setErrors({ [methodName]: true });
1712
+ }
1713
+ return { [methodName]: true };
1714
+ }
1715
+ else if ((_d = formGroup.get(targetFormControl)) === null || _d === void 0 ? void 0 : _d.hasError(methodName)) {
1716
+ const targetControl = formGroup.get(targetFormControl);
1717
+ if (targetControl) {
1718
+ targetControl.setErrors(null);
1719
+ }
1720
+ }
1721
+ }
1722
+ return null;
1723
+ };
1724
+ return checkValue;
1725
+ }
1726
+ /**
1727
+ * Validator para checar se o campo é um objeto e se possui uma propriedade específica.
1728
+ *
1729
+ * @example
1730
+ * this.myForm = this.fb.group({
1731
+ * OBJETO_FIELD: ['', [Validators.required, AgroFormValidator.objectPropertyValidator('propriedade')]]
1732
+ * });
1733
+ * @param propertyName
1734
+ * @returns
1735
+ */
1736
+ static objectPropertyValidator(propertyName) {
1737
+ const objectProperty = (control) => {
1738
+ const methodName = 'objectProperty';
1739
+ if (AgroObjectUtils.isObject(control.value) && AgroObjectUtils.containsProperty(control.value, propertyName)) {
1740
+ control.setErrors(null);
1741
+ return null;
1742
+ }
1743
+ control.setErrors({ [methodName]: true });
1744
+ return { [methodName]: true };
1745
+ };
1746
+ return objectProperty;
1747
+ }
1748
+ }
1749
+
1750
+ class AgroCookieUtils {
1751
+ static getCookie(name, parseURIValue = false) {
1752
+ const cookieValue = document.cookie.split(';')
1753
+ .map(cookie => cookie.trim())
1754
+ .find(cookie => cookie.startsWith(name));
1755
+ let result = cookieValue === null || cookieValue === void 0 ? void 0 : cookieValue.split('=')[1];
1756
+ if (parseURIValue && result) {
1757
+ result = decodeURIComponent(result);
1758
+ }
1759
+ return result;
1760
+ }
1761
+ static parseCookieToObject(cookieString, parseURIString = false) {
1762
+ const cookieObject = {};
1763
+ if (parseURIString) {
1764
+ cookieString = decodeURIComponent(cookieString);
1765
+ }
1766
+ cookieString.split(';').forEach(cookie => {
1767
+ const [key, value] = cookie.split('=').map(c => c.trim());
1768
+ cookieObject[key] = value;
1769
+ });
1770
+ return cookieObject;
1771
+ }
1772
+ setCookie(name, value, days) {
1773
+ const date = new Date();
1774
+ date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
1775
+ const expires = 'expires=' + date.toUTCString();
1776
+ document.cookie = name + '=' + value + ';' + expires + ';path=/';
1777
+ }
1778
+ }
1779
+
1780
+ class AgroDateUtils {
1781
+ /**
1782
+ * Verifica se uma data é nula ou indefinida.
1783
+ * @param date - A data a ser verificada.
1784
+ * @returns True se a data for nula ou indefinida, false caso contrário.
1785
+ */
1786
+ static isNullOrUndefined(date) {
1787
+ return date === null || date === undefined;
1788
+ }
1789
+ /**
1790
+ * Verifica se uma data não é nula e não é indefinida.
1791
+ * @param date - A data a ser verificada.
1792
+ * @returns True se a data não for nula e não for indefinida, false caso contrário.
1793
+ */
1794
+ static isNotNullOrUndefined(date) {
1795
+ return !AgroDateUtils.isNullOrUndefined(date);
1796
+ }
1797
+ /**
1798
+ * Verifica se uma data é válida.
1799
+ * @param date - A data a ser verificada.
1431
1800
  * @returns True se a data for válida, false caso contrário.
1432
1801
  */
1433
1802
  static isValid(date) {
@@ -1508,172 +1877,21 @@ class AgroDateUtils {
1508
1877
  * Retorna a data formatada conforme o formato especificado.
1509
1878
  * @param date
1510
1879
  * @param format
1511
- * @returns
1512
- */
1513
- static formatDate(date, format = 'DD/MM/YYYY') {
1514
- const moment$1 = moment;
1515
- return moment$1(date).utc().format(format);
1516
- }
1517
- /**
1518
- * Retorna uma string com o número informado adicionando um 0 à esquerda, caso o número seja menor que 10.
1519
- * @param value
1520
- * @returns
1521
- */
1522
- static padZero(value) {
1523
- return value < AGRO_NUMBERS.TEN ? '0' + value : value.toString();
1524
- }
1525
- }
1526
-
1527
- const AGRO_REGEX = {
1528
- /**
1529
- * Validação de E-mail
1530
- */
1531
- isEmail: /^[^\s@]+@[^\s@]+\.[^\s@]+$/,
1532
- /**
1533
- * Validação de Números Inteiros Positivos
1534
- */
1535
- positiveInteger: /^[1-9]\d*$/,
1536
- /**
1537
- * Validação de Números Decimais Positivos
1538
- */
1539
- positiveDecimal: /^\d*\.?\d+$/,
1540
- /**
1541
- * Validação de string que consiste apenas em espaços em branco ou está vazia.
1542
- */
1543
- onlyBlankSpaces: /^\s*$/,
1544
- /**
1545
- * Validação de CEP (Código Postal)
1546
- */
1547
- zipCode: /^\d{8}$|^\d{5}-\d{3}$/,
1548
- /**
1549
- * Validação de String (qualquer caractere)
1550
- */
1551
- isString: /^[\s\S]*$/,
1552
- /**
1553
- * Validação de UUID
1554
- */
1555
- 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}$/,
1556
- /**
1557
- * Validação de Número
1558
- */
1559
- isNumber: /^-?\d+$/,
1560
- /**
1561
- * Validação de Número Decimal
1562
- */
1563
- isDecimal: /^\d*\.?\d+$/,
1564
- /**
1565
- * Validação de Placa de Veículo
1566
- */
1567
- isLicensePlate: /^[A-Za-z0-9]{1,7}-?[A-Za-z0-9]{1,7}$/,
1568
- /**
1569
- * Validação de Placa de veículo padrão mercosul
1570
- */
1571
- isMercosulLicensePlate: /^[A-Z]{3}\d[A-Z]\d{2}$/,
1572
- /**
1573
- * Validação de Placa de veículo padrão antigo AAA-1234
1574
- */
1575
- isOldLicensePlate: /^[A-Z]{3}-?\d{4}$/,
1576
- /**
1577
- * Validação de Número de Telefone
1578
- */
1579
- isPhoneNumber: /^\+?\d{1,4}-?\d{6,11}$/,
1580
- /**
1581
- * Validação de Data (Formato YYYY-MM-DD)
1582
- */
1583
- isDate: /^\d{4}-\d{2}-\d{2}$/,
1584
- /**
1585
- * Validação de Hora (Formato HH:mm)
1586
- */
1587
- isTime: /^(0\d|1\d|2[0-3]):[0-5]\d$/,
1588
- /**
1589
- * Validação de Data e Hora (Formato YYYY-MM-DD HH:mm)
1590
- */
1591
- isDateTime: /^\d{4}-\d{2}-\d{2} (0\d|1\d|2[0-3]):[0-5]\d$/,
1592
- /**
1593
- * Validação de URL
1594
- */
1595
- isURL: /^(http|https):\/\/([\w-]+\.)+[\w-]+(\/[\w- ./?%&=]*)?$/,
1596
- /**
1597
- * Validação de Número Hexadecimal
1598
- */
1599
- isHexNumber: /^[0-9a-fA-F]+$/,
1600
- /**
1601
- * Validação de Base64
1602
- */
1603
- isBase64: /^[a-zA-Z0-9+/]+={0,2}$/,
1604
- /**
1605
- * Validação de Nome de Usuário (3 a 20 caracteres alfanuméricos)
1606
- */
1607
- isUsername: /^\w{3,20}$/,
1608
- /**
1609
- * Validação de Alfanumérico
1610
- */
1611
- isAlphanumeric: /^[a-zA-Z0-9]+$/,
1612
- /**
1613
- * Validação de Slug (letras minúsculas, números e traços)
1614
- */
1615
- isSlug: /^[a-z0-9-]+$/,
1616
- /**
1617
- * Validação de Número de Cartão de Crédito
1618
- */
1619
- isCreditCard: /^\d{4}-\d{4}-\d{4}-\d{4}$/,
1620
- /**
1621
- * Validação de Número Hexadecimal
1622
- */
1623
- isHexadecimal: /^[0-9a-fA-F]+$/,
1624
- /**
1625
- * Validação de Moeda
1626
- */
1627
- isCurrency: /^\d+(\.\d{1,2})?$/,
1628
- /**
1629
- * Validação de Porcentagem
1630
- */
1631
- isPercentage: /^(100(\.0{1,2})?|[1-9]?\d(\.\d{1,2})?)$/,
1632
- /**
1633
- * Validação de Tag HTML Simples
1634
- */
1635
- isHTMLTag: /^<([a-z]+)([^<]+)*(?:>(.*)<\/\1>|\s+\/>)$/,
1636
- /**
1637
- * Validação de Nome de Usuário com Espaços (3 a 20 caracteres alfanuméricos e espaços)
1638
- */
1639
- isUsernameWithSpaces: /^[a-zA-Z0-9_ ]{3,20}$/,
1640
- /**
1641
- * Validação de Senha Forte (mínimo 8 caracteres, uma letra minúscula, uma letra maiúscula, um número e um caractere especial)
1642
- */
1643
- isStrongPassword: /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$/,
1644
- /**
1645
- * Validação de String Alfabética
1646
- */
1647
- isAlphabetic: /^[a-zA-Z]+$/,
1648
- /**
1649
- * Validação de Hora no Formato de 12 Horas
1650
- */
1651
- isTime12Hour: /^(0?[1-9]|1[0-2]):\d{2} (AM|PM)$/i,
1652
- /**
1653
- * Validação de Latitude
1654
- */
1655
- isLatitude: /^[-+]?([1-8]?\d(\.\d+)?|90(\.0+)?)$/,
1656
- /**
1657
- * Validação de Longitude
1658
- */
1659
- isLongitude: /^[-+]?(180(\.0+)?|((1[0-7]\d)|([1-9]?\d))(\.\d+)?)$/,
1660
- /**
1661
- * Validação de Endereço MAC
1662
- */
1663
- isMACAddress: /^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$/,
1664
- /**
1665
- * Validação de Data de Expiração de Cartão de Crédito
1666
- */
1667
- isCreditCardExpiration: /^(0[1-9]|1[0-2])\/\d{2}$/,
1668
- /**
1669
- * Validação de Número de Seguro Social (SSN)
1880
+ * @returns
1670
1881
  */
1671
- isSSN: /^\d{3}-\d{2}-\d{4}$/,
1882
+ static formatDate(date, format = 'DD/MM/YYYY') {
1883
+ const moment$1 = moment;
1884
+ return moment$1(date).utc().format(format);
1885
+ }
1672
1886
  /**
1673
- * Validação se todos os dígitos são iguais
1887
+ * Retorna uma string com o número informado adicionando um 0 à esquerda, caso o número seja menor que 10.
1888
+ * @param value
1889
+ * @returns
1674
1890
  */
1675
- isAllDigitsEqual: /^(.)\1+$/,
1676
- };
1891
+ static padZero(value) {
1892
+ return value < AGRO_NUMBERS.TEN ? '0' + value : value.toString();
1893
+ }
1894
+ }
1677
1895
 
1678
1896
  /**
1679
1897
  * Classe utilitária para operações de string.
@@ -1925,31 +2143,70 @@ class AgroStringUtils {
1925
2143
  return matches ? matches.length : AGRO_NUMBERS.ZERO;
1926
2144
  }
1927
2145
  static validateCPF(cpf) {
2146
+ // Remover caracteres não numéricos
1928
2147
  cpf = cpf.replace(/\D/g, "");
1929
- if (cpf.length !== 11 || /^(\d)\1{10}$/.test(cpf)) {
2148
+ // Verificar se o CPF tem 11 dígitos
2149
+ if (cpf.length !== AGRO_NUMBERS.ELEVEN) {
1930
2150
  return false;
1931
2151
  }
1932
- const calcCheckDigit = (length) => {
1933
- let sum = 0;
1934
- for (let i = 0; i < length; i++) {
1935
- sum += Number(cpf[i]) * (length + 1 - i);
1936
- }
1937
- let remainder = sum % 11;
1938
- return remainder < 2 ? 0 : 11 - remainder;
1939
- };
1940
- return calcCheckDigit(9) === Number(cpf[9]) && calcCheckDigit(10) === Number(cpf[10]);
2152
+ // Verificar se todos os dígitos são iguais (caso contrário, é um sinal de CPF inválido)
2153
+ if (/^(\d)\1{10}$/.test(cpf)) {
2154
+ return false;
2155
+ }
2156
+ // Calcular o primeiro dígito verificador
2157
+ let sum = AGRO_NUMBERS.ZERO;
2158
+ let remainder;
2159
+ for (let i = AGRO_NUMBERS.ONE; i <= AGRO_NUMBERS.NINE; i++) {
2160
+ sum += parseInt(cpf[i - AGRO_NUMBERS.ONE]) * (AGRO_NUMBERS.ELEVEN - i);
2161
+ }
2162
+ remainder = sum % AGRO_NUMBERS.ELEVEN;
2163
+ if (remainder === AGRO_NUMBERS.TEN || remainder === AGRO_NUMBERS.ELEVEN) {
2164
+ remainder = AGRO_NUMBERS.ZERO;
2165
+ }
2166
+ if (remainder !== parseInt(cpf[AGRO_NUMBERS.NINE])) {
2167
+ return false;
2168
+ }
2169
+ // Calcular o segundo dígito verificador
2170
+ sum = AGRO_NUMBERS.ZERO;
2171
+ for (let i = AGRO_NUMBERS.ONE; i <= AGRO_NUMBERS.TEN; i++) {
2172
+ sum += parseInt(cpf[i - AGRO_NUMBERS.ONE]) * (AGRO_NUMBERS.TWELVE - i);
2173
+ }
2174
+ remainder = sum % AGRO_NUMBERS.ELEVEN;
2175
+ if (remainder === AGRO_NUMBERS.TEN || remainder === AGRO_NUMBERS.ELEVEN) {
2176
+ remainder = AGRO_NUMBERS.ZERO;
2177
+ }
2178
+ if (remainder !== parseInt(cpf[AGRO_NUMBERS.TEN])) {
2179
+ return false;
2180
+ }
2181
+ return true;
1941
2182
  }
1942
2183
  static validateCNPJ(cnpj) {
2184
+ // Remove todos os caracteres não numéricos
1943
2185
  cnpj = cnpj.replace(/\D/g, "");
1944
- if (cnpj.length !== 14 || /^(\d)\1{13}$/.test(cnpj))
2186
+ // Verifica se tem 14 dígitos
2187
+ if (cnpj.length !== 14)
1945
2188
  return false;
1946
- const calcularDigito = (length) => {
1947
- const pesos = length === 12 ? [5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2] : [6, 5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2];
1948
- const soma = pesos.reduce((acc, peso, i) => acc + Number(cnpj[i]) * peso, 0);
1949
- const resto = soma % 11;
1950
- return resto < 2 ? 0 : 11 - resto;
1951
- };
1952
- return calcularDigito(12) === Number(cnpj[12]) && calcularDigito(13) === Number(cnpj[13]);
2189
+ // Verifica se o CNPJ é uma sequência repetida (ex: 11111111111111, 22222222222222, etc.)
2190
+ if (/^(\d)\1{13}$/.test(cnpj))
2191
+ return false;
2192
+ // Cálculo do primeiro dígito verificador
2193
+ let soma = 0;
2194
+ let pesos1 = [5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2];
2195
+ for (let i = 0; i < 12; i++) {
2196
+ soma += parseInt(cnpj.charAt(i)) * pesos1[i];
2197
+ }
2198
+ let resto = soma % 11;
2199
+ let digito1 = resto < 2 ? 0 : 11 - resto;
2200
+ // Cálculo do segundo dígito verificador
2201
+ soma = 0;
2202
+ let pesos2 = [6, 5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2];
2203
+ for (let i = 0; i < 13; i++) {
2204
+ soma += parseInt(cnpj.charAt(i)) * pesos2[i];
2205
+ }
2206
+ resto = soma % 11;
2207
+ let digito2 = resto < 2 ? 0 : 11 - resto;
2208
+ // Verifica se os dígitos verificadores são válidos
2209
+ return parseInt(cnpj.charAt(12)) === digito1 && parseInt(cnpj.charAt(13)) === digito2;
1953
2210
  }
1954
2211
  /**
1955
2212
  * Método para aplicar uma máscara em uma string. Considere a máscara com valores 9 para aplicação
@@ -1998,25 +2255,6 @@ class AgroStringUtils {
1998
2255
  static isInvalid(str) {
1999
2256
  return !AgroStringUtils.isValid(str);
2000
2257
  }
2001
- /**
2002
- * Valida se uma string é um e-mail válido ou não
2003
- * Retorna um booleano para indicar se é um e-mail válido ou não
2004
- * @param email - A string a ser verificada
2005
- * @returns True se a string for um e-mail válido, false caso contrário
2006
- */
2007
- static isValidEmail(email) {
2008
- return AGRO_REGEX.isEmail.test(email);
2009
- }
2010
- /**
2011
- * Valida se uma string é uma placa de veículo BR válida ou não.
2012
- * Retorna um booleano para indicar se é uma placa válida ou não.
2013
- * @param plate - A string a ser verificada
2014
- */
2015
- static isValidLicensePlate(plate) {
2016
- const oldFormat = /^[A-Z]{3}-?\d{4}$/;
2017
- const mercosulFormat = /^[A-Z]{3}\d[A-Z]\d{2}$/;
2018
- return oldFormat.test(plate) || mercosulFormat.test(plate);
2019
- }
2020
2258
  }
2021
2259
 
2022
2260
  class AgroPlatformUtils {
@@ -2059,11 +2297,10 @@ class AgroPlatformUtils {
2059
2297
  */
2060
2298
  static getCurrentUserName() {
2061
2299
  var _a;
2062
- const cookie = AgroCookieUtils.getCookie('com.senior.token', true);
2300
+ const cookie = AgroCookieUtils.getCookie('com.senior.token');
2063
2301
  if (cookie) {
2064
- let str = (_a = AgroObjectUtils.fromString(cookie)) === null || _a === void 0 ? void 0 : _a.fullName;
2302
+ const str = (_a = AgroCookieUtils.parseCookieToObject(cookie)) === null || _a === void 0 ? void 0 : _a.fullName;
2065
2303
  if (str) {
2066
- str = str.replace(/\+/g, ' ');
2067
2304
  return str;
2068
2305
  }
2069
2306
  }
@@ -2076,9 +2313,9 @@ class AgroPlatformUtils {
2076
2313
  */
2077
2314
  static getCurrentUserEmail() {
2078
2315
  var _a;
2079
- const cookie = AgroCookieUtils.getCookie('com.senior.token', true);
2316
+ const cookie = AgroCookieUtils.getCookie('com.senior.token');
2080
2317
  if (cookie) {
2081
- const str = (_a = AgroObjectUtils.fromString(cookie)) === null || _a === void 0 ? void 0 : _a.email;
2318
+ const str = (_a = AgroCookieUtils.parseCookieToObject(cookie)) === null || _a === void 0 ? void 0 : _a.email;
2082
2319
  if (str) {
2083
2320
  return str;
2084
2321
  }
@@ -2381,277 +2618,43 @@ class AgroArrayUtils {
2381
2618
  * @param item Item a ser removido.
2382
2619
  */
2383
2620
  static removeItem(array, item) {
2384
- const index = array.indexOf(item);
2385
- if (index !== -1) {
2386
- array.splice(index, 1);
2387
- }
2388
- }
2389
- /**
2390
- * Remove um item de um array por índice.
2391
- * @param array Array de onde o item será removido.
2392
- * @param index Índice do item a ser removido.
2393
- */
2394
- static removeItemByIndex(array, index) {
2395
- array.splice(index, 1);
2396
- }
2397
- /**
2398
- * Remove todos os itens de um array.
2399
- * @param array Array de onde os itens serão removidos.
2400
- */
2401
- static removeAllItems(array) {
2402
- array.splice(0, array.length);
2403
- }
2404
- /**
2405
- * Verifica se um array é vazio.
2406
- * @param array Array a ser verificado.
2407
- */
2408
- static isEmpty(array) {
2409
- return AgroArrayUtils.isArray(array) && array.length === 0;
2410
- }
2411
- /**
2412
- * Localiza um item em um array de objetos de acordo com a propriedade e valor informados.
2413
- */
2414
- static findItemByProperty(array, property, value) {
2415
- for (const item of array) {
2416
- if (item[property] === value) {
2417
- return item;
2418
- }
2419
- }
2420
- return null;
2421
- }
2422
- }
2423
-
2424
- class AgroFormValidator {
2425
- /**
2426
- * Validator para checar se o campo é um e-mail
2427
- *
2428
- * @example
2429
- * this.myForm = this.fb.group({
2430
- * EMAIL_FIELD: ['', [Validators.required, AgroFormValidator.emailValidator]]
2431
- * });
2432
- * @param control
2433
- * @returns
2434
- */
2435
- static emailValidator(control) {
2436
- const email = control.value;
2437
- if (!email) {
2438
- return null;
2439
- }
2440
- return AgroStringUtils.isValidEmail(email) ? null : { emailValidator: true };
2441
- }
2442
- /**
2443
- * Aplique esse validador em um campo do tipo Date, para verificar se a data selecionada é maior ou menor que a data atual.
2444
- *
2445
- * Utilize o parâmetro comparisonType para definir se a data selecionada deve ser maior ou menor que a data atual.
2446
- * A validação será através do enum DateComparisonType.
2447
- *
2448
- * @example
2449
- * this.myForm = this.fb.group({
2450
- * NOME_CAMPO: ['', [Validators.required, AgroFormValidator.compareDateWithToday(DateComparisonType.greatherThan)]]
2451
- * });
2452
- * @param comparisonType
2453
- * @returns
2454
- */
2455
- static compareDateWithToday(comparisonType) {
2456
- const compareDate = (control) => {
2457
- const methodName = 'dateComparisonToday';
2458
- const selectedDate = new Date(control.value);
2459
- const currentDate = new Date();
2460
- const conditions = {
2461
- [DateComparisonType.greatherThan]: selectedDate <= currentDate,
2462
- [DateComparisonType.lessThan]: selectedDate >= currentDate
2463
- };
2464
- if (conditions[comparisonType]) {
2465
- return { [methodName]: { value: control.value } };
2466
- }
2467
- return null;
2468
- };
2469
- return compareDate;
2470
- }
2471
- /**
2472
- * Compara dois campos do tipo Date, verificando se o campo A é maior que o campo B. Se A for maior que B, então
2473
- * o campo A é invalidado. Caso contrário, o campo A é validado.
2474
- *
2475
- * Aplique esse campo no FormGroup, passando os nomes dos campos que deseja comparar.
2476
- * @example
2477
- * this.myForm = this.fb.group({
2478
- NOME_CAMPO_dateA: ['', Validators.required],
2479
- NOME_CAMPO_dateB: ['', Validators.required]
2480
- }, { validator: AgroFormValidator.dateComparisonValidator('NOME_CAMPO_dateA', 'NOME_CAMPO_dateB') });
2481
- * @param controlNameA
2482
- * @param controlNameB
2483
- * @returns
2484
- */
2485
- static compareDateWithOtherDateField(controlNameA, controlNameB) {
2486
- const compareDate = (control) => {
2487
- var _a, _b, _c, _d, _e;
2488
- const formGroup = control;
2489
- const dateA = (_a = formGroup.get(controlNameA)) === null || _a === void 0 ? void 0 : _a.value;
2490
- const dateB = (_b = formGroup.get(controlNameB)) === null || _b === void 0 ? void 0 : _b.value;
2491
- const methodName = 'compareDateWithOtherDateField';
2492
- if (dateA && dateB) {
2493
- const dateAObj = new Date(dateA);
2494
- const dateBObj = new Date(dateB);
2495
- if (dateAObj < dateBObj) {
2496
- (_c = formGroup.get(controlNameA)) === null || _c === void 0 ? void 0 : _c.setErrors({ [methodName]: true });
2497
- return { [methodName]: true };
2498
- }
2499
- else if ((_d = formGroup.get(controlNameA)) === null || _d === void 0 ? void 0 : _d.hasError(methodName)) {
2500
- (_e = formGroup.get(controlNameA)) === null || _e === void 0 ? void 0 : _e.setErrors(null);
2501
- }
2502
- }
2503
- return null;
2504
- };
2505
- return compareDate;
2506
- }
2507
- /**
2508
- * Validator para checar se um campo de números é maior ou menor que outro campo.
2509
- *
2510
- * Aplique esse validator no FormGroup, passando os nomes dos campos que deseja comparar.
2511
- * @example
2512
- * this.myForm = this.fb.group({
2513
- * NUMERO_A: ['', Validators.required],
2514
- * NUMERO_B: ['', Validators.required]
2515
- * }, { validator: AgroFormValidator.compareNumberFields('NUMERO_A', 'NUMERO_B', NumberComparisonType.EQUALS) });
2516
- *
2517
- * Neste caso, a verificação será se o NUMERO_A é igual ao NUMERB_B.
2518
- * @param controlNameA
2519
- * @param controlNameB
2520
- * @returns
2521
- */
2522
- static compareNumberFields(controlNameA, controlNameB, comparisonMethod) {
2523
- const compareNumber = (control) => {
2524
- var _a, _b, _c;
2525
- const formGroup = control;
2526
- const numberA = (_a = formGroup.get(controlNameA)) === null || _a === void 0 ? void 0 : _a.value;
2527
- const numberB = (_b = formGroup.get(controlNameB)) === null || _b === void 0 ? void 0 : _b.value;
2528
- const methodName = 'compareNumberFields';
2529
- if (numberA && numberB) {
2530
- const errorType = NumberComparisonType[comparisonMethod];
2531
- const errorCondition = {
2532
- [NumberComparisonType.EQUALS]: numberA !== numberB,
2533
- [NumberComparisonType.GREATER_THAN]: numberA <= numberB,
2534
- [NumberComparisonType.LESS_THAN]: numberA >= numberB,
2535
- [NumberComparisonType.GREATER_THAN_OR_EQUAL]: numberA < numberB,
2536
- [NumberComparisonType.LESS_THAN_OR_EQUAL]: numberA > numberB,
2537
- [NumberComparisonType.NOT_EQUALS]: numberA === numberB
2538
- };
2539
- if (errorCondition[comparisonMethod]) {
2540
- const controlA = formGroup.get(controlNameA);
2541
- if (controlA) {
2542
- controlA.setErrors({ [methodName]: comparisonMethod });
2543
- }
2544
- return { [methodName]: errorType };
2545
- }
2546
- else if ((_c = formGroup.get(controlNameA)) === null || _c === void 0 ? void 0 : _c.hasError(methodName)) {
2547
- const controlA = formGroup.get(controlNameA);
2548
- if (controlA) {
2549
- controlA.setErrors(null);
2550
- }
2551
- }
2552
- }
2553
- return null;
2554
- };
2555
- return compareNumber;
2556
- }
2557
- /**
2558
- * Validator para checar se um valor está entre os demais valores de três formControls.
2559
- *
2560
- * Aplique esse validator no FormGroup, passando os nomes dos três formControls que deseja comparar.
2561
- * @example
2562
- * this.myForm = this.fb.group({
2563
- * minorFormControl: ['', Validators.required],
2564
- * targetFormControl: ['', Validators.required],
2565
- * majorFormControl: ['', Validators.required]
2566
- * }, { validator: AgroFormValidator.checkValueBetween('minorFormControl', 'targetFormControl', 'majorFormControl') });
2567
- *
2568
- * Neste caso, a verificação será se o targetFormControl está entre o minorFormControl e o majorFormControl.
2569
- * @param minorFormControl
2570
- * @param targetFormControl
2571
- * @param majorFormControl
2572
- * @returns
2573
- */
2574
- static checkValueBetween(minorFormControl, targetFormControl, majorFormControl) {
2575
- const checkValue = (control) => {
2576
- var _a, _b, _c, _d;
2577
- const formGroup = control;
2578
- const valueA = (_a = formGroup.get(minorFormControl)) === null || _a === void 0 ? void 0 : _a.value;
2579
- const valueB = (_b = formGroup.get(targetFormControl)) === null || _b === void 0 ? void 0 : _b.value;
2580
- const valueC = (_c = formGroup.get(majorFormControl)) === null || _c === void 0 ? void 0 : _c.value;
2581
- const methodName = 'checkValueBetween';
2582
- if (valueA && valueB && valueC) {
2583
- if (valueB < valueA || valueB > valueC) {
2584
- const targetControl = formGroup.get(targetFormControl);
2585
- if (targetControl) {
2586
- targetControl.setErrors({ [methodName]: true });
2587
- }
2588
- return { [methodName]: true };
2589
- }
2590
- else if ((_d = formGroup.get(targetFormControl)) === null || _d === void 0 ? void 0 : _d.hasError(methodName)) {
2591
- const targetControl = formGroup.get(targetFormControl);
2592
- if (targetControl) {
2593
- targetControl.setErrors(null);
2594
- }
2595
- }
2596
- }
2597
- return null;
2598
- };
2599
- return checkValue;
2621
+ const index = array.indexOf(item);
2622
+ if (index !== -1) {
2623
+ array.splice(index, 1);
2624
+ }
2600
2625
  }
2601
2626
  /**
2602
- * Validator para checar se o campo é um objeto e se possui uma propriedade específica.
2603
- *
2604
- * @example
2605
- * this.myForm = this.fb.group({
2606
- * OBJETO_FIELD: ['', [Validators.required, AgroFormValidator.objectPropertyValidator('propriedade')]]
2607
- * });
2608
- * @param propertyName
2609
- * @returns
2627
+ * Remove um item de um array por índice.
2628
+ * @param array Array de onde o item será removido.
2629
+ * @param index Índice do item a ser removido.
2610
2630
  */
2611
- static objectPropertyValidator(propertyName) {
2612
- const objectProperty = (control) => {
2613
- const methodName = 'objectProperty';
2614
- if (AgroObjectUtils.isObject(control.value) && AgroObjectUtils.containsProperty(control.value, propertyName)) {
2615
- control.setErrors(null);
2616
- return null;
2617
- }
2618
- control.setErrors({ [methodName]: true });
2619
- return { [methodName]: true };
2620
- };
2621
- return objectProperty;
2631
+ static removeItemByIndex(array, index) {
2632
+ array.splice(index, 1);
2622
2633
  }
2623
2634
  /**
2624
- * Verifica se a string informada é um CPF válido.
2625
- * Se a validação for false, retorna um objeto com a chave cpfValidator.
2635
+ * Remove todos os itens de um array.
2636
+ * @param array Array de onde os itens serão removidos.
2626
2637
  */
2627
- static CPFValidator(control) {
2628
- const cpf = control.value;
2629
- if (!cpf) {
2630
- return null;
2631
- }
2632
- return AgroStringUtils.validateCPF(cpf) ? null : { cpfValidator: true };
2638
+ static removeAllItems(array) {
2639
+ array.splice(0, array.length);
2633
2640
  }
2634
2641
  /**
2635
- * Verifica se a string informada é um CNPJ válido.
2636
- * Se a validação for false, retorna um objeto com a chave cnpjValidator.
2642
+ * Verifica se um array é vazio.
2643
+ * @param array Array a ser verificado.
2637
2644
  */
2638
- static CNPJValidator(control) {
2639
- const cnpj = control.value;
2640
- if (!cnpj) {
2641
- return null;
2642
- }
2643
- return AgroStringUtils.validateCNPJ(cnpj) ? null : { cnpjValidator: true };
2645
+ static isEmpty(array) {
2646
+ return AgroArrayUtils.isArray(array) && array.length === 0;
2644
2647
  }
2645
2648
  /**
2646
- * Verifica se a string informada é uma placa de veículo válido.
2647
- * Se a validação for false, retorna um objeto com a chave licensePlate.
2649
+ * Localiza um item em um array de objetos de acordo com a propriedade e valor informados.
2648
2650
  */
2649
- static licensePlateValidator(control) {
2650
- const plate = control.value;
2651
- if (!plate) {
2652
- return null;
2651
+ static findItemByProperty(array, property, value) {
2652
+ for (const item of array) {
2653
+ if (item[property] === value) {
2654
+ return item;
2655
+ }
2653
2656
  }
2654
- return AgroStringUtils.isValidLicensePlate(plate) ? null : { licensePlate: true };
2657
+ return null;
2655
2658
  }
2656
2659
  }
2657
2660
 
@@ -3131,7 +3134,7 @@ const ptBR = {
3131
3134
  "agro.angular_components.ticket": "Ticket",
3132
3135
  "agro.angular_components.company": "Empresa",
3133
3136
  "agro.angular_components.label_branch": "Filial",
3134
- "agro.angular_components.event_sidebar_title": "Evento - {{event}}",
3137
+ "agro.angular_components.event_sidebar_title": "Evento - {event}",
3135
3138
  "agro.angular_components.reprocessing_event_message_title": "Reprocessando Evento",
3136
3139
  "agro.angular_components.reprocessing_event_message_description": "O evento selecionado está sendo reprocessado.",
3137
3140
  "agro.angular_components.error_reprocessing_event_message_title": "Erro ao reprocessar evento",
@@ -3300,6 +3303,20 @@ const ptBR = {
3300
3303
  "agro.angular_components.TRANSFER_CREATE_INCOMING_INVOICE": "Criação da nota fiscal de entrada da transferencia",
3301
3304
  "agro.angular_components.TRANSFER_CREATE_OUTGOING_INVOICE": "Criação da nota fiscal de saida da transferencia",
3302
3305
  "agro.angular_components.TRANSFER_PRODUCER_BALANCE": "Transferência de saldo entre produtores",
3306
+ "agro.angular_components.control_code": "Identificador",
3307
+ "agro.angular_components.fixation_event": "Fixação",
3308
+ "agro.angular_components.FINISH_FINANCIAL_FIXATION": "Baixa de títulos",
3309
+ "agro.angular_components.FINISH_PRODUCER_NET_VALUE_FIXATION": "Atualização de saldos",
3310
+ "agro.angular_components.CONCLUDE_FIXATION": "Conclusão da fixação",
3311
+ "agro.angular_components.CANCEL_FINANCIAL_FIXATION": "Cancela baixa de títulos",
3312
+ "agro.angular_components.CANCEL_PRODUCER_NET_VALUE_FIXATION": "Reverte atualização de saldos",
3313
+ "agro.angular_components.CANCEL_FIXATION": "Cancela fixação",
3314
+ "agro.angular_components.cancel_fixation_title": "Cancelar fixação",
3315
+ "agro.angular_components.cancel_fixation_description": "Tem certeza que deseja cancelar a fixação?",
3316
+ "agro.angular_components.error_cancel_fixation_message_title": "Erro ao cancelar fixação",
3317
+ "agro.angular_components.error_cancel_fixation_message_description": "Houve um erro ao cancelar a fixação. Tente novamente mais tarde.",
3318
+ "agro.angular_components.cancel_fixation_message_title": "Cancelamento de fixação",
3319
+ "agro.angular_components.cancel_fixation_message_description": "O processo de cancelamento da fixação foi iniciado com sucesso."
3303
3320
  };
3304
3321
 
3305
3322
  const enUS = {
@@ -3328,7 +3345,7 @@ const enUS = {
3328
3345
  "agro.angular_components.balance_entry_control_event": "Balance Entry/Exit",
3329
3346
  "agro.angular_components.event_origin_label": "Event origin",
3330
3347
  "agro.angular_components.event_details_header": "Event Details",
3331
- "agro.angular_components.registers_found": "{{total}} record(s) found",
3348
+ "agro.angular_components.registers_found": "{total} record(s) found",
3332
3349
  "agro.angular_components.change_request_event": "Weight Change",
3333
3350
  "agro.angular_components.status_label": "Status",
3334
3351
  "agro.angular_components.panel_title_events_completed_successfully": "Success",
@@ -3336,7 +3353,7 @@ const enUS = {
3336
3353
  "agro.angular_components.ticket": "Ticket",
3337
3354
  "agro.angular_components.company": "Company",
3338
3355
  "agro.angular_components.label_branch": "Branch",
3339
- "agro.angular_components.event_sidebar_title": "Event - {{event}}",
3356
+ "agro.angular_components.event_sidebar_title": "Event - {event}",
3340
3357
  "agro.angular_components.reprocessing_event_message_title": "Reprocessing Event",
3341
3358
  "agro.angular_components.reprocessing_event_message_description": "The selected event is being reprocessed.",
3342
3359
  "agro.angular_components.error_reprocessing_event_message_title": "Error reprocessing event",
@@ -3505,6 +3522,20 @@ const enUS = {
3505
3522
  "agro.angular_components.TRANSFER_CREATE_INCOMING_INVOICE": "Creation of invoice transfer input",
3506
3523
  "agro.angular_components.TRANSFER_CREATE_OUTGOING_INVOICE": "Creation of the outgoing transfer invoice",
3507
3524
  "agro.angular_components.TRANSFER_PRODUCER_BALANCE": "Balance transfer between producers",
3525
+ "agro.angular_components.control_code": "Identifier",
3526
+ "agro.angular_components.fixation_event": "Fixation",
3527
+ "agro.angular_components.FINISH_FINANCIAL_FIXATION": "Financial settlement",
3528
+ "agro.angular_components.FINISH_PRODUCER_NET_VALUE_FIXATION": "Balance update",
3529
+ "agro.angular_components.CONCLUDE_FIXATION": "Fixation conclusion",
3530
+ "agro.angular_components.CANCEL_FINANCIAL_FIXATION": "Cancel financial fixation",
3531
+ "agro.angular_components.CANCEL_PRODUCER_NET_VALUE_FIXATION": "Cancel producer net value fixation",
3532
+ "agro.angular_components.CANCEL_FIXATION": "Cancel fixation",
3533
+ "agro.angular_components.cancel_fixation_title": "Cancel fixation",
3534
+ "agro.angular_components.cancel_fixation_description": "Are you sure you want to cancel the fixation?",
3535
+ "agro.angular_components.error_cancel_fixation_message_title": "Error canceling fixation",
3536
+ "agro.angular_components.error_cancel_fixation_message_description": "An error occurred while canceling the fixation. Please try again later.",
3537
+ "agro.angular_components.cancel_fixation_message_title": "Fixation cancellation",
3538
+ "agro.angular_components.cancel_fixation_message_description": "The fixation cancellation process has been successfully initiated."
3508
3539
  };
3509
3540
 
3510
3541
  const esCO = {
@@ -3533,7 +3564,7 @@ const esCO = {
3533
3564
  "agro.angular_components.balance_entry_control_event": "Entrada/salida balanza",
3534
3565
  "agro.angular_components.event_origin_label": "Origen del evento",
3535
3566
  "agro.angular_components.event_details_header": "Detalles del Evento",
3536
- "agro.angular_components.registers_found": "{{total}} registro(s) encontrado(s)",
3567
+ "agro.angular_components.registers_found": "{total} registro(s) encontrado(s)",
3537
3568
  "agro.angular_components.change_request_event": "Cambio de Pesaje",
3538
3569
  "agro.angular_components.status_label": "Estado",
3539
3570
  "agro.angular_components.panel_title_events_completed_successfully": "Éxito",
@@ -3541,7 +3572,7 @@ const esCO = {
3541
3572
  "agro.angular_components.ticket": "Ticket",
3542
3573
  "agro.angular_components.company": "Empresa",
3543
3574
  "agro.angular_components.label_branch": "Sucursal",
3544
- "agro.angular_components.event_sidebar_title": "Evento - {{event}}",
3575
+ "agro.angular_components.event_sidebar_title": "Evento - {event}",
3545
3576
  "agro.angular_components.reprocessing_event_message_title": "Reprocesando Evento",
3546
3577
  "agro.angular_components.reprocessing_event_message_description": "El evento seleccionado está siendo reprocesado.",
3547
3578
  "agro.angular_components.error_reprocessing_event_message_title": "Error al reprocesar evento",
@@ -3710,6 +3741,20 @@ const esCO = {
3710
3741
  "agro.angular_components.TRANSFER_CREATE_INCOMING_INVOICE": "Creación de la factura entrante de transferencia",
3711
3742
  "agro.angular_components.TRANSFER_CREATE_OUTGOING_INVOICE": "Creación de la factura de transferencia saliente",
3712
3743
  "agro.angular_components.TRANSFER_PRODUCER_BALANCE": "Transferir saldo entre productores",
3744
+ "agro.angular_components.control_code": "Identificador",
3745
+ "agro.angular_components.fixation_event": "Fijación",
3746
+ "agro.angular_components.FINISH_FINANCIAL_FIXATION": "Liquidación financiera",
3747
+ "agro.angular_components.FINISH_PRODUCER_NET_VALUE_FIXATION": "Actualización de saldos",
3748
+ "agro.angular_components.CONCLUDE_FIXATION": "Conclusión de la fijación",
3749
+ "agro.angular_components.CANCEL_FINANCIAL_FIXATION": "Cancelar fijación financiera",
3750
+ "agro.angular_components.CANCEL_PRODUCER_NET_VALUE_FIXATION": "Cancelar fijación de valor neto del productor",
3751
+ "agro.angular_components.CANCEL_FIXATION": "Cancelar fijación",
3752
+ "agro.angular_components.cancel_fixation_title": "Cancelar fijación",
3753
+ "agro.angular_components.cancel_fixation_description": "¿Está seguro de que desea cancelar la fijación?",
3754
+ "agro.angular_components.error_cancel_fixation_message_title": "Error al cancelar la fijación",
3755
+ "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.",
3756
+ "agro.angular_components.cancel_fixation_message_title": "Cancelación de fijación",
3757
+ "agro.angular_components.cancel_fixation_message_description": "El proceso de cancelación de la fijación se ha iniciado con éxito."
3713
3758
  };
3714
3759
 
3715
3760
  let LibTranslationService = class LibTranslationService {
@@ -3827,6 +3872,12 @@ var EventOperation;
3827
3872
  EventOperation["TRANSFER_CREATE_INCOMING_INVOICE"] = "TRANSFER_CREATE_INCOMING_INVOICE";
3828
3873
  EventOperation["TRANSFER_CREATE_OUTGOING_INVOICE"] = "TRANSFER_CREATE_OUTGOING_INVOICE";
3829
3874
  EventOperation["TRANSFER_PRODUCER_BALANCE"] = "TRANSFER_PRODUCER_BALANCE";
3875
+ EventOperation["FINISH_FINANCIAL_FIXATION"] = "FINISH_FINANCIAL_FIXATION";
3876
+ EventOperation["FINISH_PRODUCER_NET_VALUE_FIXATION"] = "FINISH_PRODUCER_NET_VALUE_FIXATION";
3877
+ EventOperation["CONCLUDE_FIXATION"] = "CONCLUDE_FIXATION";
3878
+ EventOperation["CANCEL_FINANCIAL_FIXATION"] = "CANCEL_FINANCIAL_FIXATION";
3879
+ EventOperation["CANCEL_PRODUCER_NET_VALUE_FIXATION"] = "CANCEL_PRODUCER_NET_VALUE_FIXATION";
3880
+ EventOperation["CANCEL_FIXATION"] = "CANCEL_FIXATION";
3830
3881
  })(EventOperation || (EventOperation = {}));
3831
3882
 
3832
3883
  var EventOrigin;
@@ -3837,6 +3888,7 @@ var EventOrigin;
3837
3888
  EventOrigin["TRANSFER"] = "TRANSFER";
3838
3889
  EventOrigin["CHANGE_REQUEST"] = "CHANGE_REQUEST";
3839
3890
  EventOrigin["CREATE_INVOICE"] = "CREATE_INVOICE";
3891
+ EventOrigin["FIXATION"] = "FIXATION";
3840
3892
  })(EventOrigin || (EventOrigin = {}));
3841
3893
 
3842
3894
  const eventOrigin = [
@@ -3854,7 +3906,7 @@ const eventItem = [
3854
3906
  { label: "agro.angular_components.effective_confirmation_event", value: EventOperation.EFFECTIVE_CONFIRMATION },
3855
3907
  { label: "agro.angular_components.change_request_event_summary", value: EventOperation.CHANGE_REQUEST },
3856
3908
  { label: "agro.angular_components.change_response_event", value: EventOperation.CHANGE_RESPONSE },
3857
- { label: "agro.angular_components.process_fixation_event", value: EventOperation.PROCESS_FIXATION },
3909
+ { label: "agro.angular_components.fixation_event", value: EventOperation.PROCESS_FIXATION },
3858
3910
  { label: `agro.angular_components.${EventOperation.CANCEL_INVOICE}`, value: EventOperation.CANCEL_INVOICE },
3859
3911
  { label: `agro.angular_components.${EventOperation.REPROCESS_INVOICE}`, value: EventOperation.REPROCESS_INVOICE },
3860
3912
  { label: `agro.angular_components.${EventOperation.EFFECTIVE_CONFIRMATION}`, value: EventOperation.EFFECTIVE_CONFIRMATION },
@@ -3864,6 +3916,12 @@ const eventItem = [
3864
3916
  { label: `agro.angular_components.${EventOperation.TRANSFER_CREATE_INCOMING_INVOICE}`, value: EventOperation.TRANSFER_CREATE_INCOMING_INVOICE },
3865
3917
  { label: `agro.angular_components.${EventOperation.TRANSFER_CREATE_OUTGOING_INVOICE}`, value: EventOperation.TRANSFER_CREATE_OUTGOING_INVOICE },
3866
3918
  { label: `agro.angular_components.${EventOperation.TRANSFER_PRODUCER_BALANCE}`, value: EventOperation.TRANSFER_PRODUCER_BALANCE },
3919
+ { label: `agro.angular_components.${EventOperation.FINISH_FINANCIAL_FIXATION}`, value: EventOperation.FINISH_FINANCIAL_FIXATION },
3920
+ { label: `agro.angular_components.${EventOperation.FINISH_PRODUCER_NET_VALUE_FIXATION}`, value: EventOperation.FINISH_PRODUCER_NET_VALUE_FIXATION },
3921
+ { label: `agro.angular_components.${EventOperation.CONCLUDE_FIXATION}`, value: EventOperation.CONCLUDE_FIXATION },
3922
+ { label: `agro.angular_components.${EventOperation.CANCEL_FINANCIAL_FIXATION}`, value: EventOperation.CANCEL_FINANCIAL_FIXATION },
3923
+ { label: `agro.angular_components.${EventOperation.CANCEL_PRODUCER_NET_VALUE_FIXATION}`, value: EventOperation.CANCEL_PRODUCER_NET_VALUE_FIXATION },
3924
+ { label: `agro.angular_components.${EventOperation.CANCEL_FIXATION}`, value: EventOperation.CANCEL_FIXATION },
3867
3925
  ];
3868
3926
  const eventStatus = [
3869
3927
  { label: "agro.angular_components.panel_title_events_completed_successfully", value: EventStatus.SUCCESS },
@@ -4055,58 +4113,6 @@ ProducerInvoiceService = __decorate([
4055
4113
  Injectable()
4056
4114
  ], ProducerInvoiceService);
4057
4115
 
4058
- let TicketService = class TicketService extends EntityService {
4059
- constructor(http, messageService, translate) {
4060
- super(http, messageService, `agro/origination/entities/ticket`, `agro/origination/actions`, `agro/origination/queries`, translate);
4061
- this.http = http;
4062
- this.messageService = messageService;
4063
- this.translate = translate;
4064
- }
4065
- getTicketSummaryByParent(parent) {
4066
- return this.http
4067
- .post(`${this.queriesUrl}/getTicketSummaryByParent/`, { parent })
4068
- .pipe(this.defaultCatch());
4069
- }
4070
- listMainteinerTickets(filter) {
4071
- return this.http
4072
- .post(`${this.queriesUrl}/listMainteinerTickets/`, filter)
4073
- .pipe(this.defaultCatch());
4074
- }
4075
- searchTotalWeightResultFromTickets(body) {
4076
- return this.http
4077
- .post(`${this.queriesUrl}/searchTotalWeightResultFromTickets/`, body)
4078
- .pipe(this.defaultCatch());
4079
- }
4080
- cancelTicket(body) {
4081
- return this.http
4082
- .post(`${this.actionsUrl}/cancelTicket/`, body);
4083
- }
4084
- mergeTickets(body) {
4085
- return this.http.post(`${this.actionsUrl}/mergeTickets/`, body).pipe(this.defaultCatch());
4086
- }
4087
- unMergeTickets(body) {
4088
- return this.http.post(`${this.actionsUrl}/unMergeTickets/`, body).pipe(this.defaultCatch());
4089
- }
4090
- checkGroupInvoicePermission(body) {
4091
- return this.http
4092
- .post(`${this.queriesUrl}/checkGroupInvoicePermission/`, body)
4093
- .pipe(this.defaultCatch());
4094
- }
4095
- getContractTickets(tickets) {
4096
- return this.http
4097
- .post(`${this.queriesUrl}/getContractTickets/`, { tickets })
4098
- .pipe(this.defaultCatch());
4099
- }
4100
- };
4101
- TicketService.ctorParameters = () => [
4102
- { type: HttpClient },
4103
- { type: MessageService },
4104
- { type: LibTranslationService }
4105
- ];
4106
- TicketService = __decorate([
4107
- Injectable()
4108
- ], TicketService);
4109
-
4110
4116
  let TransferService = class TransferService extends EntityService {
4111
4117
  constructor(http, messageService, translate) {
4112
4118
  super(http, messageService, `agro/transfer/entities/transfer`, `agro/transfer/actions`, `agro/transfer/queries`, translate);
@@ -4134,23 +4140,45 @@ TransferService = __decorate([
4134
4140
  Injectable()
4135
4141
  ], TransferService);
4136
4142
 
4143
+ let FixationService = class FixationService extends EntityService {
4144
+ constructor(http, messageService, translate) {
4145
+ super(http, messageService, `agro/fixation/entities/fixation`, `agro/fixation/actions`, `agro/fixation/queries`, translate);
4146
+ this.http = http;
4147
+ this.messageService = messageService;
4148
+ this.translate = translate;
4149
+ }
4150
+ cancelFixation(body) {
4151
+ return this.http
4152
+ .post(`${this.actionsUrl}/cancelFixationEvent`, body)
4153
+ .pipe(this.defaultCatch());
4154
+ }
4155
+ };
4156
+ FixationService.ctorParameters = () => [
4157
+ { type: HttpClient },
4158
+ { type: MessageService },
4159
+ { type: LibTranslationService }
4160
+ ];
4161
+ FixationService = __decorate([
4162
+ Injectable()
4163
+ ], FixationService);
4164
+
4137
4165
  let EventControlBoardService = class EventControlBoardService {
4138
- constructor(eventControlService, eventControlItemService, ticketService, transferService, producerInvoiceService) {
4166
+ constructor(eventControlService, eventControlItemService, transferService, producerInvoiceService, fixationService) {
4139
4167
  this.eventControlService = eventControlService;
4140
4168
  this.eventControlItemService = eventControlItemService;
4141
- this.ticketService = ticketService;
4142
4169
  this.transferService = transferService;
4143
4170
  this.producerInvoiceService = producerInvoiceService;
4171
+ this.fixationService = fixationService;
4144
4172
  }
4145
4173
  };
4146
4174
  EventControlBoardService.ctorParameters = () => [
4147
4175
  { type: EventControlService },
4148
4176
  { type: EventControlItemService },
4149
- { type: TicketService },
4150
4177
  { type: TransferService },
4151
- { type: ProducerInvoiceService }
4178
+ { type: ProducerInvoiceService },
4179
+ { type: FixationService }
4152
4180
  ];
4153
- EventControlBoardService.ɵprov = ɵɵdefineInjectable({ factory: function EventControlBoardService_Factory() { return new EventControlBoardService(ɵɵinject(EventControlService), ɵɵinject(EventControlItemService), ɵɵinject(TicketService), ɵɵinject(TransferService), ɵɵinject(ProducerInvoiceService)); }, token: EventControlBoardService, providedIn: "root" });
4181
+ EventControlBoardService.ɵprov = ɵɵdefineInjectable({ factory: function EventControlBoardService_Factory() { return new EventControlBoardService(ɵɵinject(EventControlService), ɵɵinject(EventControlItemService), ɵɵinject(TransferService), ɵɵinject(ProducerInvoiceService), ɵɵinject(FixationService)); }, token: EventControlBoardService, providedIn: "root" });
4154
4182
  EventControlBoardService = __decorate([
4155
4183
  Injectable({
4156
4184
  providedIn: "root",
@@ -4158,13 +4186,14 @@ EventControlBoardService = __decorate([
4158
4186
  ], EventControlBoardService);
4159
4187
 
4160
4188
  let EventControlBoardComponent = class EventControlBoardComponent {
4161
- constructor(translate, formBuilder, websocketService, eventControlBoardService, paginatorStorageService, messageService) {
4189
+ constructor(translate, formBuilder, websocketService, eventControlBoardService, paginatorStorageService, messageService, confirmationService) {
4162
4190
  this.translate = translate;
4163
4191
  this.formBuilder = formBuilder;
4164
4192
  this.websocketService = websocketService;
4165
4193
  this.eventControlBoardService = eventControlBoardService;
4166
4194
  this.paginatorStorageService = paginatorStorageService;
4167
4195
  this.messageService = messageService;
4196
+ this.confirmationService = confirmationService;
4168
4197
  this.steps = [];
4169
4198
  this.showSidebar = false;
4170
4199
  this.showReprocessButton = false;
@@ -4183,7 +4212,6 @@ let EventControlBoardComponent = class EventControlBoardComponent {
4183
4212
  ngOnInit() {
4184
4213
  return __awaiter(this, void 0, void 0, function* () {
4185
4214
  this.gridColumns = this.setGridColumns();
4186
- this.socketConnection = this.websocketService.onConnect();
4187
4215
  this.callWebsocket();
4188
4216
  });
4189
4217
  }
@@ -4193,7 +4221,7 @@ let EventControlBoardComponent = class EventControlBoardComponent {
4193
4221
  this.setFormFields();
4194
4222
  }
4195
4223
  this.updateCompanyAndBranchFormFields(changes);
4196
- this.updateEventOriginAndTicketFormFields(changes);
4224
+ this.updateEventOriginAndControlCodeFormFields(changes);
4197
4225
  this.updateEventStatusAndCreatedDateFormFields(changes);
4198
4226
  this.onSearch();
4199
4227
  }
@@ -4206,13 +4234,13 @@ let EventControlBoardComponent = class EventControlBoardComponent {
4206
4234
  (_c = this.filterFormGroup.get('e070fil')) === null || _c === void 0 ? void 0 : _c.setValue((_d = changes.e070fil.currentValue) !== null && _d !== void 0 ? _d : null);
4207
4235
  }
4208
4236
  }
4209
- updateEventOriginAndTicketFormFields(changes) {
4237
+ updateEventOriginAndControlCodeFormFields(changes) {
4210
4238
  var _a, _b, _c, _d;
4211
4239
  if (changes.eventOrigin && changes.eventOrigin.currentValue !== changes.eventOrigin.previousValue) {
4212
4240
  (_a = this.filterFormGroup.get('eventOrigin')) === null || _a === void 0 ? void 0 : _a.setValue((_b = changes.eventOrigin.currentValue) !== null && _b !== void 0 ? _b : null);
4213
4241
  }
4214
- if (changes.ticket && changes.ticket.currentValue !== changes.ticket.previousValue) {
4215
- (_c = this.filterFormGroup.get('number')) === null || _c === void 0 ? void 0 : _c.setValue((_d = changes.ticket.currentValue) !== null && _d !== void 0 ? _d : null);
4242
+ if (changes.controlCode && changes.controlCode.currentValue !== changes.controlCode.previousValue) {
4243
+ (_c = this.filterFormGroup.get('controlCode')) === null || _c === void 0 ? void 0 : _c.setValue((_d = changes.controlCode.currentValue) !== null && _d !== void 0 ? _d : null);
4216
4244
  }
4217
4245
  }
4218
4246
  updateEventStatusAndCreatedDateFormFields(changes) {
@@ -4229,7 +4257,7 @@ let EventControlBoardComponent = class EventControlBoardComponent {
4229
4257
  this.filterFormGroup = this.formBuilder.group({
4230
4258
  e070emp: [{ value: (_a = this.e070emp) !== null && _a !== void 0 ? _a : null, disabled: false }, Validators.compose([])],
4231
4259
  e070fil: [{ value: (_b = this.e070fil) !== null && _b !== void 0 ? _b : null, disabled: false }, Validators.compose([])],
4232
- number: [{ value: (_c = this.ticket) !== null && _c !== void 0 ? _c : null, disabled: false }, Validators.compose([])],
4260
+ controlCode: [{ value: (_c = this.controlCode) !== null && _c !== void 0 ? _c : null, disabled: false }, Validators.compose([])],
4233
4261
  externalId: [{ value: (_d = this.externalId) !== null && _d !== void 0 ? _d : null, disabled: false }, Validators.compose([])],
4234
4262
  eventOrigin: [{ value: (_e = this.eventOrigin) !== null && _e !== void 0 ? _e : null, disabled: false }, Validators.compose([])],
4235
4263
  status: [{ value: (_f = this.eventStatus) !== null && _f !== void 0 ? _f : null, disabled: false }, Validators.compose([])],
@@ -4247,7 +4275,7 @@ let EventControlBoardComponent = class EventControlBoardComponent {
4247
4275
  type: FieldType.Chips,
4248
4276
  }),
4249
4277
  new FormField({
4250
- name: "number",
4278
+ name: "controlCode",
4251
4279
  type: FieldType.Chips,
4252
4280
  }),
4253
4281
  new FormField({
@@ -4273,14 +4301,13 @@ let EventControlBoardComponent = class EventControlBoardComponent {
4273
4301
  { field: 'e070emp', header: this.translate.instant("agro.angular_components.company") },
4274
4302
  { field: 'e070fil', header: this.translate.instant("agro.angular_components.label_branch") },
4275
4303
  { field: 'eventOrigin', header: this.translate.instant("agro.angular_components.event_origin_label") },
4276
- { field: 'number', header: this.translate.instant("agro.angular_components.ticket") },
4304
+ { field: 'controlCode', header: this.translate.instant("agro.angular_components.control_code") },
4277
4305
  ];
4278
4306
  }
4279
4307
  ngOnDestroy() {
4280
4308
  this.ngUnsubscribe.next();
4281
4309
  this.ngUnsubscribe.complete();
4282
4310
  this.websocketService.disconnect();
4283
- this.socketConnection = false;
4284
4311
  }
4285
4312
  callWebsocket() {
4286
4313
  this.websocketService
@@ -4323,14 +4350,67 @@ let EventControlBoardComponent = class EventControlBoardComponent {
4323
4350
  const { page, size } = this.currentListParams;
4324
4351
  const nSort = this.getSortedFields();
4325
4352
  const filterQuery = this.getFilterQuery();
4326
- const displayFields = [""];
4353
+ const displayFields = ["*", "eventControlItem"];
4327
4354
  this.eventControlBoardService.eventControlService
4328
4355
  .list({ sort: nSort, page, size, filterQuery, displayFields })
4329
4356
  .pipe(takeUntil(this.ngUnsubscribe), catchError((err) => {
4330
4357
  this.gridLoading = false;
4331
4358
  throw err;
4332
4359
  }))
4333
- .subscribe((list) => this.handleListResponse(list));
4360
+ .subscribe((list) => {
4361
+ this.gridData = list.contents;
4362
+ this.gridTotalRecords = list.totalElements;
4363
+ if (!this.gridData || this.gridData.length <= AGRO_NUMBERS.ZERO) {
4364
+ this.gridLoading = false;
4365
+ return;
4366
+ }
4367
+ this.processEventControlItems();
4368
+ });
4369
+ }
4370
+ processEventControlItems() {
4371
+ this.gridData.forEach(item => {
4372
+ const sortedItems = item.eventControlItem.sort((a, b) => {
4373
+ return a.sequence - b.sequence;
4374
+ });
4375
+ const steps = sortedItems.map((detail, index) => this.createStep(detail, item, index));
4376
+ const activeIndex = this.calculateActiveIndex(sortedItems);
4377
+ item.groups = [{ steps, activeIndex }];
4378
+ item.activeIndex = activeIndex;
4379
+ });
4380
+ this.gridDataResolved = this.gridData;
4381
+ this.gridLoading = false;
4382
+ }
4383
+ calculateActiveIndex(details) {
4384
+ const lastActive = details.reduce((lastIndex, detail, currentIndex) => detail.status !== EventStatus.PENDING ? currentIndex : lastIndex, -1);
4385
+ if (lastActive !== -1 && details[lastActive].status === EventStatus.SUCCESS) {
4386
+ return lastActive + 1;
4387
+ }
4388
+ return lastActive;
4389
+ }
4390
+ createStep(detail, item, detailIndex) {
4391
+ return {
4392
+ item: detail,
4393
+ controlCode: item.controlCode,
4394
+ eventType: item.eventOrigin,
4395
+ label: this.getEventLabel(detail),
4396
+ disabled: detail.status === EventStatus.PENDING && detailIndex !== this.calculateActiveIndex(item.eventControlItem),
4397
+ tooltip: this.getEventLabel(detail),
4398
+ state: this.determineStepState(detail)
4399
+ };
4400
+ }
4401
+ determineStepState(detail) {
4402
+ if (detail.status === EventStatus.SUCCESS) {
4403
+ return StepState$1.Success;
4404
+ }
4405
+ if (detail.status === EventStatus.FAILED) {
4406
+ return StepState$1.Warning;
4407
+ }
4408
+ return StepState$1.Default;
4409
+ }
4410
+ getEventLabel(detail) {
4411
+ var _a;
4412
+ const eventLabel = (_a = this.eventItem.find(e => e.value === detail.eventOperation)) === null || _a === void 0 ? void 0 : _a.label;
4413
+ return eventLabel ? this.translate.instant(eventLabel) : detail.eventOperation;
4334
4414
  }
4335
4415
  getSortedFields() {
4336
4416
  var _a;
@@ -4361,127 +4441,20 @@ let EventControlBoardComponent = class EventControlBoardComponent {
4361
4441
  .filter((filter) => filter !== null && filter !== '' && filter !== undefined)
4362
4442
  .join(' and ');
4363
4443
  }
4364
- handleListResponse(list) {
4365
- this.gridData = list.contents;
4366
- this.gridTotalRecords = list.totalElements;
4367
- if (!this.gridData || this.gridData.length <= AGRO_NUMBERS.ZERO) {
4368
- this.gridLoading = false;
4369
- return;
4370
- }
4371
- this.processDetailCalls();
4372
- }
4373
- processDetailCalls() {
4374
- const detailCalls$ = this.gridData.map((item) => this.eventControlBoardService.eventControlItemService.list({
4375
- filterQuery: `eventControl eq '${item.id}'`,
4376
- sort: [{ field: 'sequence', order: AGRO_NUMBERS.ONE }],
4377
- size: AGRO_NUMBERS.ONE_HUNDRED
4378
- })
4379
- .pipe(takeUntil(this.ngUnsubscribe), catchError((err) => {
4380
- this.gridLoading = false;
4381
- throw err;
4382
- }), switchMap(detailsResponse => {
4383
- return this.eventControlBoardService.ticketService.list({
4384
- filterQuery: `id eq '${item.externalId}' or balanceEntryControl.id eq '${item.externalId}'`,
4385
- displayFields: ['number']
4386
- })
4387
- .pipe(map((ticketResponse) => ({ detailsResponse, ticketResponse })), catchError((err) => {
4388
- this.gridLoading = false;
4389
- throw err;
4390
- }));
4391
- })));
4392
- forkJoin(detailCalls$).subscribe((responses) => {
4393
- this.processDetailsResponses(responses);
4394
- });
4395
- }
4396
- processDetailsResponses(detailsResponses) {
4397
- this.gridData.forEach((item, index) => {
4398
- var _a, _b;
4399
- const { detailsResponse, ticketResponse } = detailsResponses[index];
4400
- const tickets = (_a = ticketResponse === null || ticketResponse === void 0 ? void 0 : ticketResponse.contents) !== null && _a !== void 0 ? _a : [];
4401
- item.details = (_b = detailsResponse === null || detailsResponse === void 0 ? void 0 : detailsResponse.contents) !== null && _b !== void 0 ? _b : [];
4402
- item.tickets = tickets.map((ticket) => ticket.number).join(', ');
4403
- const groupedDetails = this.groupByEventGroup(item.details);
4404
- item.groups = Object.keys(groupedDetails).map(eventGroupId => {
4405
- const groupDetails = groupedDetails[eventGroupId];
4406
- const lastActiveIndex = groupDetails.map((detail) => detail.status !== EventStatus.PENDING).lastIndexOf(true);
4407
- let activeIndex = lastActiveIndex;
4408
- if (lastActiveIndex !== -1 && groupDetails[lastActiveIndex].status === EventStatus.SUCCESS) {
4409
- activeIndex = lastActiveIndex + 1;
4410
- }
4411
- const steps = groupDetails.map((detail, detailIndex) => {
4412
- return {
4413
- item: detail,
4414
- ticket: item.tickets,
4415
- eventType: detail.eventControl.eventOrigin,
4416
- label: this.getEventLabel(detail),
4417
- disabled: detail.status === EventStatus.PENDING && detailIndex !== activeIndex,
4418
- tooltip: this.getEventLabel(detail),
4419
- state: this.determineStepState(detail),
4420
- };
4421
- });
4422
- return {
4423
- eventGroupId,
4424
- steps,
4425
- activeIndex
4426
- };
4427
- });
4428
- item.activeIndex = item.groups.length > 0 ? item.groups[0].activeIndex : -1;
4429
- });
4430
- this.gridDataResolved = this.gridData;
4431
- this.gridLoading = false;
4432
- }
4433
- groupByEventGroup(details) {
4434
- return details.reduce((acc, detail) => {
4435
- const eventGroupId = detail.eventGroup;
4436
- if (!acc[eventGroupId]) {
4437
- acc[eventGroupId] = [];
4438
- }
4439
- acc[eventGroupId].push(detail);
4440
- return acc;
4441
- }, {});
4442
- }
4443
- determineStepState(detail) {
4444
- let state;
4445
- if (detail.status === EventStatus.SUCCESS) {
4446
- state = StepState$1.Success;
4447
- }
4448
- else if (detail.status === EventStatus.FAILED) {
4449
- state = StepState$1.Warning;
4450
- }
4451
- else {
4452
- state = StepState$1.Default;
4453
- }
4454
- return state;
4455
- }
4456
- getEventLabel(detail) {
4457
- var _a;
4458
- const eventLabel = (_a = this.eventItem.find(e => e.value === detail.eventOperation)) === null || _a === void 0 ? void 0 : _a.label;
4459
- return eventLabel ? this.translate.instant(eventLabel) : detail.eventOperation;
4460
- }
4461
4444
  getFieldNameForSortRequest(name) {
4462
4445
  switch (name) {
4463
4446
  case 'e070emp':
4464
4447
  return 'e070emp.nomEmp';
4465
4448
  case 'e070fil':
4466
4449
  return 'e070fil.nomFil';
4467
- case 'number':
4468
- return 'createdDate';
4469
4450
  default:
4470
4451
  return name;
4471
4452
  }
4472
4453
  }
4473
4454
  createFilterString(name, type, value, lookupFieldName = 'id') {
4474
- if (name === 'number') {
4455
+ if (name === 'controlCode') {
4475
4456
  const filterParts = [];
4476
- value.forEach(item => {
4477
- filterParts.push(`externalId eq '${item.id}'`);
4478
- if (item.invoice) {
4479
- filterParts.push(`externalId eq '${item.invoice.id}'`);
4480
- }
4481
- if (item.balanceEntryControl) {
4482
- filterParts.push(`externalId eq '${item.balanceEntryControl.id}'`);
4483
- }
4484
- });
4457
+ value.forEach((val) => filterParts.push(`controlCode eq '${val}'`));
4485
4458
  return `(${filterParts.join(' or ')})`;
4486
4459
  }
4487
4460
  return this.createFilterStringFromType(name, type, value, lookupFieldName);
@@ -4538,7 +4511,6 @@ let EventControlBoardComponent = class EventControlBoardComponent {
4538
4511
  }
4539
4512
  stepSelected(event) {
4540
4513
  this.selectedStep = event.step;
4541
- console.log(event);
4542
4514
  switch (this.selectedStep.eventType) {
4543
4515
  case EventOrigin.BALANCE_ENTRY_CONTROL:
4544
4516
  case EventOrigin.TICKET:
@@ -4557,8 +4529,8 @@ let EventControlBoardComponent = class EventControlBoardComponent {
4557
4529
  this.sidebarLoading = false;
4558
4530
  });
4559
4531
  break;
4532
+ case EventOrigin.FIXATION:
4560
4533
  case EventOrigin.CHANGE_REQUEST:
4561
- break;
4562
4534
  case EventOrigin.TRANSFER:
4563
4535
  break;
4564
4536
  }
@@ -4578,16 +4550,44 @@ let EventControlBoardComponent = class EventControlBoardComponent {
4578
4550
  this.addMessage('error', 'agro.angular_components.error_reprocessing_event_message_title', 'agro.angular_components.error_reprocessing_event_message_description');
4579
4551
  });
4580
4552
  }
4581
- addMessage(severity, summary, detail) {
4553
+ addMessage(severity, summary, detail, life = AGRO_NUMBERS.FIVE_SECONDS) {
4582
4554
  this.messageService.add({
4583
4555
  severity,
4584
4556
  summary: this.translate.instant(summary),
4585
4557
  detail: this.translate.instant(detail),
4558
+ life
4586
4559
  });
4587
4560
  }
4588
4561
  openModal() {
4589
4562
  this.displayModal = true;
4590
4563
  }
4564
+ openCancelModal() {
4565
+ this.confirmationService.confirm({
4566
+ header: this.translate.instant("agro.angular_components.cancel_fixation_title"),
4567
+ message: this.translate.instant("agro.angular_components.cancel_fixation_description"),
4568
+ acceptLabel: this.translate.instant("agro.angular_components.yes"),
4569
+ rejectLabel: this.translate.instant("agro.angular_components.no"),
4570
+ accept: () => {
4571
+ this.gridLoading = true;
4572
+ this.cancelFixation();
4573
+ },
4574
+ reject: () => {
4575
+ this.gridLoading = false;
4576
+ }
4577
+ });
4578
+ }
4579
+ cancelFixation() {
4580
+ this.eventControlBoardService.fixationService.cancelFixation({ fixationId: this.gridData[AGRO_NUMBERS.ZERO].externalId })
4581
+ .pipe(takeUntil(this.ngUnsubscribe), catchError((err) => {
4582
+ this.addMessage('error', 'agro.angular_components.error_cancel_fixation_message_title', 'agro.angular_components.error_cancel_fixation_message_description');
4583
+ this.gridLoading = false;
4584
+ throw err;
4585
+ }))
4586
+ .subscribe(() => {
4587
+ this.addMessage('info', 'agro.angular_components.cancel_fixation_message_title', 'agro.angular_components.cancel_fixation_message_description');
4588
+ this.gridLoading = false;
4589
+ });
4590
+ }
4591
4591
  confirmModal() {
4592
4592
  this.reprocessEvent();
4593
4593
  this.displayModal = false;
@@ -4606,7 +4606,8 @@ EventControlBoardComponent.ctorParameters = () => [
4606
4606
  { type: WebsocketService },
4607
4607
  { type: EventControlBoardService },
4608
4608
  { type: PaginatorStorageService },
4609
- { type: MessageService$1 }
4609
+ { type: MessageService$1 },
4610
+ { type: ConfirmationService }
4610
4611
  ];
4611
4612
  __decorate([
4612
4613
  Input()
@@ -4616,7 +4617,7 @@ __decorate([
4616
4617
  ], EventControlBoardComponent.prototype, "e070fil", void 0);
4617
4618
  __decorate([
4618
4619
  Input()
4619
- ], EventControlBoardComponent.prototype, "ticket", void 0);
4620
+ ], EventControlBoardComponent.prototype, "controlCode", void 0);
4620
4621
  __decorate([
4621
4622
  Input()
4622
4623
  ], EventControlBoardComponent.prototype, "eventOrigin", void 0);
@@ -4635,11 +4636,11 @@ __decorate([
4635
4636
  EventControlBoardComponent = __decorate([
4636
4637
  Component({
4637
4638
  selector: 'event-control-board',
4638
- 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",
4639
+ 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",
4639
4640
  providers: [
4640
4641
  { provide: LOCALE_ID, useValue: 'pt-BR' }
4641
4642
  ],
4642
- styles: [".frozen{border-left:2px solid #ddd}.dialog{width:\"600px\";height:\"300px\";z-index:100000}"]
4643
+ 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}"]
4643
4644
  })
4644
4645
  ], EventControlBoardComponent);
4645
4646
 
@@ -5253,6 +5254,58 @@ RuralEstateModule = __decorate([
5253
5254
  })
5254
5255
  ], RuralEstateModule);
5255
5256
 
5257
+ let TicketService = class TicketService extends EntityService {
5258
+ constructor(http, messageService, translate) {
5259
+ super(http, messageService, `agro/origination/entities/ticket`, `agro/origination/actions`, `agro/origination/queries`, translate);
5260
+ this.http = http;
5261
+ this.messageService = messageService;
5262
+ this.translate = translate;
5263
+ }
5264
+ getTicketSummaryByParent(parent) {
5265
+ return this.http
5266
+ .post(`${this.queriesUrl}/getTicketSummaryByParent/`, { parent })
5267
+ .pipe(this.defaultCatch());
5268
+ }
5269
+ listMainteinerTickets(filter) {
5270
+ return this.http
5271
+ .post(`${this.queriesUrl}/listMainteinerTickets/`, filter)
5272
+ .pipe(this.defaultCatch());
5273
+ }
5274
+ searchTotalWeightResultFromTickets(body) {
5275
+ return this.http
5276
+ .post(`${this.queriesUrl}/searchTotalWeightResultFromTickets/`, body)
5277
+ .pipe(this.defaultCatch());
5278
+ }
5279
+ cancelTicket(body) {
5280
+ return this.http
5281
+ .post(`${this.actionsUrl}/cancelTicket/`, body);
5282
+ }
5283
+ mergeTickets(body) {
5284
+ return this.http.post(`${this.actionsUrl}/mergeTickets/`, body).pipe(this.defaultCatch());
5285
+ }
5286
+ unMergeTickets(body) {
5287
+ return this.http.post(`${this.actionsUrl}/unMergeTickets/`, body).pipe(this.defaultCatch());
5288
+ }
5289
+ checkGroupInvoicePermission(body) {
5290
+ return this.http
5291
+ .post(`${this.queriesUrl}/checkGroupInvoicePermission/`, body)
5292
+ .pipe(this.defaultCatch());
5293
+ }
5294
+ getContractTickets(tickets) {
5295
+ return this.http
5296
+ .post(`${this.queriesUrl}/getContractTickets/`, { tickets })
5297
+ .pipe(this.defaultCatch());
5298
+ }
5299
+ };
5300
+ TicketService.ctorParameters = () => [
5301
+ { type: HttpClient },
5302
+ { type: MessageService },
5303
+ { type: LibTranslationService }
5304
+ ];
5305
+ TicketService = __decorate([
5306
+ Injectable()
5307
+ ], TicketService);
5308
+
5256
5309
  let TicketModule = class TicketModule {
5257
5310
  };
5258
5311
  TicketModule = __decorate([
@@ -5331,6 +5384,25 @@ TransferModule = __decorate([
5331
5384
  })
5332
5385
  ], TransferModule);
5333
5386
 
5387
+ let FixationModule = class FixationModule {
5388
+ };
5389
+ FixationModule = __decorate([
5390
+ NgModule({
5391
+ imports: [
5392
+ PermissionsModule.forChild([
5393
+ {
5394
+ name: 'fixation',
5395
+ actions: ['Visualizar', 'Incluir', 'Editar', 'Excluir'],
5396
+ uri: `res://senior.com.br/agro/fixation/entities/fixation`,
5397
+ },
5398
+ ]),
5399
+ ],
5400
+ providers: [FixationService],
5401
+ declarations: [],
5402
+ exports: [],
5403
+ })
5404
+ ], FixationModule);
5405
+
5334
5406
  let EventControlBoardModule = class EventControlBoardModule {
5335
5407
  };
5336
5408
  EventControlBoardModule = __decorate([
@@ -5358,11 +5430,13 @@ EventControlBoardModule = __decorate([
5358
5430
  RuralEstateModule,
5359
5431
  TicketModule,
5360
5432
  WebsocketModule,
5361
- LibTranslationModule
5433
+ LibTranslationModule,
5434
+ FixationModule
5362
5435
  ],
5363
5436
  declarations: [EventControlBoardComponent],
5364
5437
  exports: [EventControlBoardComponent],
5365
- providers: [E012famService, E205depService, PaginatorStorageService, EventControlService, EventControlBoardService],
5438
+ providers: [E012famService, E205depService, PaginatorStorageService,
5439
+ EventControlService, EventControlBoardService, ConfirmationService],
5366
5440
  })
5367
5441
  ], EventControlBoardModule);
5368
5442
 
@@ -5389,5 +5463,5 @@ AgroAngularComponentsModule = AgroAngularComponentsModule_1 = __decorate([
5389
5463
  * Generated bundle index. Do not edit.
5390
5464
  */
5391
5465
 
5392
- export { AGRO_NUMBERS, AGRO_REGEX, AgroAngularComponentsModule, AgroArrayUtils, AgroCookieUtils, AgroDateUtils, AgroEntityStatus, AgroFormValidator, AgroNameUtils, AgroNumberUtils, AgroObjectUtils, AgroPlatformUtils, AgroStringMasks, AgroStringUtils, AsyncLock, Colors, DateComparisonType, E001TnsModule, E001pesModule, E070EmpModule, E070FilModule, E075DerModule, E205depService, EventControlBoardComponent, EventControlBoardModule, EventControlBoardService, EventControlItemModule, EventControlModule, EventStepsComponent, EventStepsModule, ExternalInvoiceModule, HostProjectConfigsInjectionToken, HttpCodes, InvoiceModule, LibTranslatePipe, LibTranslationModule, LibTranslationService, NumberComparisonType, OriginationModule, PaginatorStorageService, PrimitiveManager, ProducerInvoiceModule, RuralEstateModule, SharedModule, TicketModule, TransferModule, UserInformationService, WebsocketModule, WebsocketService, LibTranslationService as ɵa };
5466
+ export { AGRO_NUMBERS, AGRO_REGEX, AgroAngularComponentsModule, AgroArrayUtils, AgroCookieUtils, AgroDateUtils, AgroEntityStatus, AgroFormValidator, AgroNameUtils, AgroNumberUtils, AgroObjectUtils, AgroPlatformUtils, AgroStringMasks, AgroStringUtils, AsyncLock, Colors, DateComparisonType, E001TnsModule, E001pesModule, E070EmpModule, E070FilModule, E075DerModule, E205depService, EventControlBoardComponent, EventControlBoardModule, EventControlBoardService, EventControlItemModule, EventControlModule, EventStepsComponent, EventStepsModule, ExternalInvoiceModule, FixationModule, HostProjectConfigsInjectionToken, HttpCodes, InvoiceModule, LibTranslatePipe, LibTranslationModule, LibTranslationService, NumberComparisonType, OriginationModule, PaginatorStorageService, PrimitiveManager, ProducerInvoiceModule, RuralEstateModule, SharedModule, TicketModule, TransferModule, UserInformationService, WebsocketModule, WebsocketService, LibTranslationService as ɵa };
5393
5467
  //# sourceMappingURL=senior-agronegocio-angular-components.js.map