@senior-agronegocio/angular-components 0.0.9859 → 0.0.9860

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 (109) hide show
  1. package/bundles/senior-agronegocio-angular-components.umd.js +50 -797
  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 -3
  6. package/common/agro-string-utils.class.d.ts +0 -3
  7. package/components/index.d.ts +0 -1
  8. package/esm2015/common/agro-platform-utils.class.js +7 -8
  9. package/esm2015/common/agro-regex.constant.js +2 -5
  10. package/esm2015/common/agro-string-utils.class.js +11 -27
  11. package/esm2015/components/index.js +1 -2
  12. package/esm2015/lib-translation.module.js +1 -3
  13. package/esm2015/pipe/index.js +1 -5
  14. package/esm2015/public-api.js +3 -3
  15. package/esm2015/senior-agronegocio-angular-components.js +2 -3
  16. package/esm2015/services/i18n/en-US.js +2 -9
  17. package/esm2015/services/i18n/es-CO.js +3 -10
  18. package/esm2015/services/i18n/pt-BR.js +3 -11
  19. package/esm2015/services/lib-translation.service.js +3 -3
  20. package/esm5/common/agro-platform-utils.class.js +7 -8
  21. package/esm5/common/agro-regex.constant.js +2 -5
  22. package/esm5/common/agro-string-utils.class.js +11 -27
  23. package/esm5/components/index.js +1 -2
  24. package/esm5/lib-translation.module.js +1 -3
  25. package/esm5/pipe/index.js +1 -5
  26. package/esm5/public-api.js +3 -3
  27. package/esm5/senior-agronegocio-angular-components.js +2 -3
  28. package/esm5/services/i18n/en-US.js +2 -9
  29. package/esm5/services/i18n/es-CO.js +3 -10
  30. package/esm5/services/i18n/pt-BR.js +3 -11
  31. package/esm5/services/lib-translation.service.js +3 -3
  32. package/fesm2015/senior-agronegocio-angular-components.js +52 -723
  33. package/fesm2015/senior-agronegocio-angular-components.js.map +1 -1
  34. package/fesm5/senior-agronegocio-angular-components.js +57 -791
  35. package/fesm5/senior-agronegocio-angular-components.js.map +1 -1
  36. package/package.json +55 -7
  37. package/pipe/index.d.ts +0 -4
  38. package/public-api.d.ts +2 -2
  39. package/senior-agronegocio-angular-components.d.ts +1 -2
  40. package/senior-agronegocio-angular-components.metadata.json +1 -1
  41. package/services/i18n/en-US.d.ts +1 -8
  42. package/services/i18n/es-CO.d.ts +1 -8
  43. package/services/i18n/pt-BR.d.ts +1 -9
  44. package/common/agro-object-stringifier.class.d.ts +0 -16
  45. package/components/modal-invoice-pj-selector/index.d.ts +0 -4
  46. package/components/modal-invoice-pj-selector/modal-invoice-pj-selector-options.interface.d.ts +0 -10
  47. package/components/modal-invoice-pj-selector/modal-invoice-pj-selector.component.d.ts +0 -40
  48. package/components/modal-invoice-pj-selector/modal-invoice-pj-selector.module.d.ts +0 -2
  49. package/components/modal-invoice-pj-selector/services/agro-invoice/agro-invoice.module.d.ts +0 -2
  50. package/components/modal-invoice-pj-selector/services/agro-invoice/agro-invoice.service.d.ts +0 -16
  51. package/components/modal-invoice-pj-selector/services/agro-invoice/index.d.ts +0 -2
  52. package/components/modal-invoice-pj-selector/services/agro-invoice/interfaces.d.ts +0 -73
  53. package/esm2015/common/agro-object-stringifier.class.js +0 -31
  54. package/esm2015/components/modal-invoice-pj-selector/index.js +0 -4
  55. package/esm2015/components/modal-invoice-pj-selector/modal-invoice-pj-selector-options.interface.js +0 -1
  56. package/esm2015/components/modal-invoice-pj-selector/modal-invoice-pj-selector.component.js +0 -188
  57. package/esm2015/components/modal-invoice-pj-selector/modal-invoice-pj-selector.module.js +0 -42
  58. package/esm2015/components/modal-invoice-pj-selector/services/agro-invoice/agro-invoice.module.js +0 -28
  59. package/esm2015/components/modal-invoice-pj-selector/services/agro-invoice/agro-invoice.service.js +0 -49
  60. package/esm2015/components/modal-invoice-pj-selector/services/agro-invoice/index.js +0 -3
  61. package/esm2015/components/modal-invoice-pj-selector/services/agro-invoice/interfaces.js +0 -13
  62. package/esm2015/pipe/cnpj-cpf/cnpj-cpf.pipe.js +0 -28
  63. package/esm2015/pipe/cnpj-cpf/cnpj-cpf.pipe.module.js +0 -15
  64. package/esm2015/pipe/cnpj-cpf/index.js +0 -3
  65. package/esm2015/pipe/kilogram/index.js +0 -3
  66. package/esm2015/pipe/kilogram/kilogram.module.js +0 -17
  67. package/esm2015/pipe/kilogram/kilogram.pipe.js +0 -38
  68. package/esm2015/pipe/stringifier/index.js +0 -3
  69. package/esm2015/pipe/stringifier/stringifier.pipe.js +0 -13
  70. package/esm2015/pipe/stringifier/stringifier.pipe.module.js +0 -15
  71. package/esm2015/pipe/telephone/index.js +0 -3
  72. package/esm2015/pipe/telephone/telephone.pipe.js +0 -91
  73. package/esm2015/pipe/telephone/telephone.pipe.module.js +0 -15
  74. package/esm2015/services/entity-service.js +0 -124
  75. package/esm5/common/agro-object-stringifier.class.js +0 -35
  76. package/esm5/components/modal-invoice-pj-selector/index.js +0 -4
  77. package/esm5/components/modal-invoice-pj-selector/modal-invoice-pj-selector-options.interface.js +0 -1
  78. package/esm5/components/modal-invoice-pj-selector/modal-invoice-pj-selector.component.js +0 -197
  79. package/esm5/components/modal-invoice-pj-selector/modal-invoice-pj-selector.module.js +0 -45
  80. package/esm5/components/modal-invoice-pj-selector/services/agro-invoice/agro-invoice.module.js +0 -31
  81. package/esm5/components/modal-invoice-pj-selector/services/agro-invoice/agro-invoice.service.js +0 -56
  82. package/esm5/components/modal-invoice-pj-selector/services/agro-invoice/index.js +0 -3
  83. package/esm5/components/modal-invoice-pj-selector/services/agro-invoice/interfaces.js +0 -13
  84. package/esm5/pipe/cnpj-cpf/cnpj-cpf.pipe.js +0 -35
  85. package/esm5/pipe/cnpj-cpf/cnpj-cpf.pipe.module.js +0 -18
  86. package/esm5/pipe/cnpj-cpf/index.js +0 -3
  87. package/esm5/pipe/kilogram/index.js +0 -3
  88. package/esm5/pipe/kilogram/kilogram.module.js +0 -20
  89. package/esm5/pipe/kilogram/kilogram.pipe.js +0 -41
  90. package/esm5/pipe/stringifier/index.js +0 -3
  91. package/esm5/pipe/stringifier/stringifier.pipe.js +0 -16
  92. package/esm5/pipe/stringifier/stringifier.pipe.module.js +0 -18
  93. package/esm5/pipe/telephone/index.js +0 -3
  94. package/esm5/pipe/telephone/telephone.pipe.js +0 -95
  95. package/esm5/pipe/telephone/telephone.pipe.module.js +0 -18
  96. package/esm5/services/entity-service.js +0 -135
  97. package/pipe/cnpj-cpf/cnpj-cpf.pipe.d.ts +0 -4
  98. package/pipe/cnpj-cpf/cnpj-cpf.pipe.module.d.ts +0 -2
  99. package/pipe/cnpj-cpf/index.d.ts +0 -2
  100. package/pipe/kilogram/index.d.ts +0 -2
  101. package/pipe/kilogram/kilogram.module.d.ts +0 -2
  102. package/pipe/kilogram/kilogram.pipe.d.ts +0 -8
  103. package/pipe/stringifier/index.d.ts +0 -2
  104. package/pipe/stringifier/stringifier.pipe.d.ts +0 -9
  105. package/pipe/stringifier/stringifier.pipe.module.d.ts +0 -2
  106. package/pipe/telephone/index.d.ts +0 -2
  107. package/pipe/telephone/telephone.pipe.d.ts +0 -21
  108. package/pipe/telephone/telephone.pipe.module.d.ts +0 -2
  109. package/services/entity-service.d.ts +0 -72
@@ -1,17 +1,17 @@
1
1
  import moment from 'moment';
2
2
  import { __awaiter, __decorate } from 'tslib';
3
- import { Subject, BehaviorSubject, of, throwError, scheduled, asyncScheduler, timer } from 'rxjs';
3
+ import { Subject, BehaviorSubject, of, throwError } from 'rxjs';
4
4
  import sockjsClient from 'sockjs-client';
5
- import { ɵɵdefineInjectable, Injectable, ɵɵinject, NgModule, Pipe, Input, Component, EventEmitter, Output, LOCALE_ID, InjectionToken } from '@angular/core';
6
- import { filter, take, finalize, switchMap, map, catchError, takeUntil, concatMap, tap, scan, defaultIfEmpty, debounceTime } from 'rxjs/operators';
5
+ import { ɵɵdefineInjectable, Injectable, ɵɵinject, NgModule, Input, Component, EventEmitter, Output, LOCALE_ID, Pipe, InjectionToken } from '@angular/core';
6
+ import { filter, take, finalize, switchMap, map, catchError, takeUntil } from 'rxjs/operators';
7
7
  import { Client, FrameImpl } from '@stomp/stompjs';
8
8
  import { get } from 'js-cookie';
9
- import { CommonModule, DecimalPipe, registerLocaleData, DatePipe } from '@angular/common';
9
+ import { CommonModule, registerLocaleData } from '@angular/common';
10
10
  import localePt from '@angular/common/locales/pt';
11
11
  import { Validators, FormControl, FormGroup, FormBuilder, FormsModule, ReactiveFormsModule } from '@angular/forms';
12
- import { ButtonPriority, FormField, FieldType, BadgeColors, StepState as StepState$1, ButtonModule, CustomFieldsModule, ControlErrorsModule, EmptyStateModule, DynamicFormModule, TokenListModule, SidebarModule, LoadingStateModule, NumberInputModule, TableModule as TableModule$1, ObjectCardModule, LocaleModule, BadgeModule, BignumberInputModule, TableHeaderCheckboxModule } from '@seniorsistemas/angular-components';
13
- import { DynamicDialogConfig, DynamicDialogRef, MessageService as MessageService$1, DialogService, DialogModule, FieldsetModule, InputTextModule as InputTextModule$1, SharedModule as SharedModule$2, ConfirmDialogModule as ConfirmDialogModule$1 } from 'primeng';
14
- import { HttpParams, HttpClient, HttpClientModule } from '@angular/common/http';
12
+ import { ButtonPriority, FormField, FieldType, BadgeColors, StepState as StepState$1, ButtonModule, CustomFieldsModule, ControlErrorsModule, EmptyStateModule, DynamicFormModule, TokenListModule, SidebarModule, LoadingStateModule, NumberInputModule, TableModule as TableModule$1, ObjectCardModule, LocaleModule, BadgeModule } from '@seniorsistemas/angular-components';
13
+ import { DynamicDialogConfig, DynamicDialogRef, MessageService as MessageService$1, DialogService, DialogModule, FieldsetModule } from 'primeng';
14
+ import { HttpParams, HttpClient } from '@angular/common/http';
15
15
  import { MessageService, SharedModule as SharedModule$1 } from 'primeng/api';
16
16
  import { user } from '@seniorsistemas/senior-platform-data';
17
17
  import { ConfirmDialogModule } from 'primeng/confirmdialog';
@@ -184,10 +184,7 @@ const AGRO_REGEX = {
184
184
  * Validação de Placa de Veículo Antiga
185
185
  * Formato: AAA-0000
186
186
  */
187
- isOldLicensePlate: /^[A-Z]{3}\d{4}$/,
188
- isISODate: /^\d{4}-\d{2}-\d{2}$/,
189
- isISOTime: /^\d{2}:\d{2}:\d{2}$/,
190
- isISODateTime: /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z$/,
187
+ isOldLicensePlate: /^[A-Z]{3}[0-9]{4}$/
191
188
  };
192
189
 
193
190
  var NumberComparisonType;
@@ -2055,19 +2052,13 @@ class AgroStringUtils {
2055
2052
  */
2056
2053
  static isEmpty(str) {
2057
2054
  var _a;
2058
- if (str && AgroStringUtils.isString(str)) {
2059
- return ((_a = str === null || str === void 0 ? void 0 : str.trim()) === null || _a === void 0 ? void 0 : _a.length) === AGRO_NUMBERS.ZERO;
2060
- }
2061
- return true;
2055
+ return !str || ((_a = str.trim()) === null || _a === void 0 ? void 0 : _a.length) === AGRO_NUMBERS.ZERO;
2062
2056
  }
2063
2057
  /**
2064
2058
  * Verifica se a string não está vazia.
2065
2059
  */
2066
2060
  static isNotEmpty(str) {
2067
- if (str && AgroStringUtils.isString(str)) {
2068
- return !AgroStringUtils.isEmpty(str);
2069
- }
2070
- return false;
2061
+ return !AgroStringUtils.isEmpty(str);
2071
2062
  }
2072
2063
  /** Verifica se a string é nula, indefinida ou contém apenas espaços em branco */
2073
2064
  static isBlank(str) {
@@ -2122,7 +2113,7 @@ class AgroStringUtils {
2122
2113
  return AGRO_REGEX.isUUID.test(str);
2123
2114
  }
2124
2115
  static isNumber(str) {
2125
- return [AGRO_REGEX.isNumber.test(str), AGRO_REGEX.isDecimal.test(str)].includes(true);
2116
+ return AGRO_REGEX.isNumber.test(str);
2126
2117
  }
2127
2118
  static validateCPF(cpf) {
2128
2119
  cpf = cpf.replace(/\D/g, "");
@@ -2139,7 +2130,7 @@ class AgroStringUtils {
2139
2130
  };
2140
2131
  const digit1 = calcVerifier(cpf, AGRO_NUMBERS.NINE);
2141
2132
  const digit2 = calcVerifier(cpf, AGRO_NUMBERS.TEN);
2142
- return (digit1 === parseInt(cpf[AGRO_NUMBERS.NINE], AGRO_NUMBERS.TEN) && digit2 === parseInt(cpf[AGRO_NUMBERS.TEN], AGRO_NUMBERS.TEN));
2133
+ return digit1 === parseInt(cpf[AGRO_NUMBERS.NINE], AGRO_NUMBERS.TEN) && digit2 === parseInt(cpf[AGRO_NUMBERS.TEN], AGRO_NUMBERS.TEN);
2143
2134
  }
2144
2135
  /**
2145
2136
  * Detecta automaticamente se é CNPJ antigo ou novo formato.
@@ -2182,8 +2173,7 @@ class AgroStringUtils {
2182
2173
  }
2183
2174
  resto = soma % AGRO_NUMBERS.ELEVEN;
2184
2175
  const digito2 = resto < AGRO_NUMBERS.TWO ? AGRO_NUMBERS.ZERO : AGRO_NUMBERS.ELEVEN - resto;
2185
- return (parseInt(cnpj.charAt(AGRO_NUMBERS.TWELVE), AGRO_NUMBERS.TEN) === digito1 &&
2186
- parseInt(cnpj.charAt(AGRO_NUMBERS.THIRTEEN), AGRO_NUMBERS.TEN) === digito2);
2176
+ return parseInt(cnpj.charAt(AGRO_NUMBERS.TWELVE), AGRO_NUMBERS.TEN) === digito1 && parseInt(cnpj.charAt(AGRO_NUMBERS.THIRTEEN), AGRO_NUMBERS.TEN) === digito2;
2187
2177
  }
2188
2178
  /**
2189
2179
  * Valida o CNPJ em formato alfanumérico (padrão 2026)
@@ -2285,7 +2275,7 @@ class AgroStringUtils {
2285
2275
  * da string.
2286
2276
  */
2287
2277
  static applyMask(value, mask) {
2288
- const valueChars = value.replace(/[^A-Za-z0-9]/g, "");
2278
+ const valueChars = value.toString().split("");
2289
2279
  const maskChars = mask.split("");
2290
2280
  let maskedValue = "";
2291
2281
  let j = AGRO_NUMBERS.ZERO;
@@ -2309,15 +2299,6 @@ class AgroStringUtils {
2309
2299
  static isInvalid(str) {
2310
2300
  return !AgroStringUtils.isValid(str);
2311
2301
  }
2312
- static isISODate(value) {
2313
- return AGRO_REGEX.isISODate.test(value);
2314
- }
2315
- static isISOTime(value) {
2316
- return AGRO_REGEX.isISOTime.test(value);
2317
- }
2318
- static isISODatetime(value) {
2319
- return AGRO_REGEX.isISODateTime.test(value);
2320
- }
2321
2302
  }
2322
2303
  AgroStringUtils.CNPJ_TRADICIONAL_PESOS_1 = [
2323
2304
  AGRO_NUMBERS.FIVE,
@@ -2331,7 +2312,7 @@ AgroStringUtils.CNPJ_TRADICIONAL_PESOS_1 = [
2331
2312
  AGRO_NUMBERS.FIVE,
2332
2313
  AGRO_NUMBERS.FOUR,
2333
2314
  AGRO_NUMBERS.THREE,
2334
- AGRO_NUMBERS.TWO,
2315
+ AGRO_NUMBERS.TWO
2335
2316
  ];
2336
2317
  AgroStringUtils.CNPJ_TRADICIONAL_PESOS_2 = [
2337
2318
  AGRO_NUMBERS.SIX,
@@ -2346,7 +2327,7 @@ AgroStringUtils.CNPJ_TRADICIONAL_PESOS_2 = [
2346
2327
  AGRO_NUMBERS.FIVE,
2347
2328
  AGRO_NUMBERS.FOUR,
2348
2329
  AGRO_NUMBERS.THREE,
2349
- AGRO_NUMBERS.TWO,
2330
+ AGRO_NUMBERS.TWO
2350
2331
  ];
2351
2332
  // Pesos utilizados para cálculo de dígitos verificadores do CNPJ alfanumérico (2026)
2352
2333
  AgroStringUtils.CNPJ_ALFANUMERICO_PESOS_1 = [
@@ -2361,7 +2342,7 @@ AgroStringUtils.CNPJ_ALFANUMERICO_PESOS_1 = [
2361
2342
  AGRO_NUMBERS.FIVE,
2362
2343
  AGRO_NUMBERS.FOUR,
2363
2344
  AGRO_NUMBERS.THREE,
2364
- AGRO_NUMBERS.TWO,
2345
+ AGRO_NUMBERS.TWO
2365
2346
  ];
2366
2347
  AgroStringUtils.CNPJ_ALFANUMERICO_PESOS_2 = [
2367
2348
  AGRO_NUMBERS.SIX,
@@ -2376,7 +2357,7 @@ AgroStringUtils.CNPJ_ALFANUMERICO_PESOS_2 = [
2376
2357
  AGRO_NUMBERS.FIVE,
2377
2358
  AGRO_NUMBERS.FOUR,
2378
2359
  AGRO_NUMBERS.THREE,
2379
- AGRO_NUMBERS.TWO,
2360
+ AGRO_NUMBERS.TWO
2380
2361
  ];
2381
2362
 
2382
2363
  // Cookie name constants
@@ -2390,7 +2371,7 @@ class AgroPlatformUtils {
2390
2371
  * @returns
2391
2372
  */
2392
2373
  static getCurrentTenant() {
2393
- const tenant = AgroPlatformUtils.getTokenField("tenantName");
2374
+ const tenant = AgroPlatformUtils.getTokenField('tenantName');
2394
2375
  if (tenant) {
2395
2376
  return tenant;
2396
2377
  }
@@ -2402,18 +2383,17 @@ class AgroPlatformUtils {
2402
2383
  * @returns
2403
2384
  */
2404
2385
  static getCurrentTenantLocale() {
2405
- const locale = AgroPlatformUtils.getTokenField("locale");
2386
+ const locale = AgroPlatformUtils.getTokenField('locale');
2406
2387
  if (locale) {
2407
2388
  return locale;
2408
2389
  }
2409
- throw new Error(`'locale' não encontrado para o tenant atual.`);
2390
+ throw new Error(`Cookie: "${COOKIE_TOKEN}" não encontrado.`);
2410
2391
  }
2411
2392
  /**
2412
2393
  * @deprecated Use getCurrentTenantLocale()
2413
2394
  * Mantido por compatibilidade retroativa.
2414
2395
  */
2415
2396
  static getCurrenTenantLocale() {
2416
- // legacy typo retained
2417
2397
  return AgroPlatformUtils.getCurrentTenantLocale();
2418
2398
  }
2419
2399
  /**
@@ -2422,7 +2402,7 @@ class AgroPlatformUtils {
2422
2402
  * @returns string || null
2423
2403
  */
2424
2404
  static getCurrentUserName() {
2425
- const name = AgroPlatformUtils.getTokenField("fullName");
2405
+ const name = AgroPlatformUtils.getTokenField('fullName');
2426
2406
  return name || null;
2427
2407
  }
2428
2408
  /**
@@ -2431,7 +2411,7 @@ class AgroPlatformUtils {
2431
2411
  * @returns string
2432
2412
  */
2433
2413
  static getCurrentUserEmail() {
2434
- const email = AgroPlatformUtils.getTokenField("email");
2414
+ const email = AgroPlatformUtils.getTokenField('email');
2435
2415
  if (!email) {
2436
2416
  console.info(`Cookie: "${COOKIE_TOKEN}" não encontrado.`);
2437
2417
  }
@@ -2466,7 +2446,7 @@ class AgroPlatformUtils {
2466
2446
  * Caso contrário, retorna uma instância de Error
2467
2447
  */
2468
2448
  static getCurrentAccessToken() {
2469
- const token = AgroPlatformUtils.getTokenField("access_token");
2449
+ const token = AgroPlatformUtils.getTokenField('access_token');
2470
2450
  if (!token) {
2471
2451
  console.info(`Cookie: "${COOKIE_TOKEN}" não encontrado.`);
2472
2452
  }
@@ -3432,7 +3412,7 @@ const ptBR = {
3432
3412
  "agro.angular_components.save": "Salvar",
3433
3413
  "agro.angular_components.select": "Selecione",
3434
3414
  "agro.angular_components.updated_by": "Atualizado por",
3435
- error_invalid: "Valor inválido",
3415
+ "error_invalid": "Valor inválido",
3436
3416
  "agro.angular_components.choose_label": "Escolha",
3437
3417
  "agro.angular_components.remove_label": "Remover",
3438
3418
  "agro.angular_components.cancel_label": "Cancelar",
@@ -3536,16 +3516,8 @@ const ptBR = {
3536
3516
  "agro.angular_components.CIDASC_DATA_LOAD_PRODUCT": "Carga Cidasc - Produto",
3537
3517
  "agro.angular_components.CIDASC_DATA_LOAD_MEASURE_UNIT": "Carga Cidasc - Unidade de medida",
3538
3518
  "agro.angular_components.CIDASC_DATA_LOAD_COMPOSED_MEASURE_UNIT": "Carga Cidasc - Medida por hectare",
3519
+ "agro.angular_components.PRESCRIPTION_DATA_LOAD": "Carga de dados do NovoReceituário",
3539
3520
  "agro.angular_components.agronomic_prescription_origin_event": "Receituário Agronômico",
3540
- "agro.angular_components.number_or_series": "Número ou série",
3541
- "agro.angular_components.panel_title_external_invoice_add_external_invoice": "Adicionar nota fiscal",
3542
- "agro.angular_components.add_pj_invoice_modal_no_invoices_found": "Nenhuma nota fiscal disponível para este produtor",
3543
- "agro.angular_components.number": "Número",
3544
- "agro.angular_components.series": "Série",
3545
- "agro.angular_components.itens": "Itens",
3546
- "agro.angular_components.quantity": "Quantidade",
3547
- "agro.angular_components.issuance_date": "Data de emissão",
3548
- "agro.angular_components.no_register_found_for_external_invoices_summary": "Nenhuma nota encontrada",
3549
3521
  };
3550
3522
 
3551
3523
  const enUS = {
@@ -3801,15 +3773,8 @@ const enUS = {
3801
3773
  "agro.angular_components.CIDASC_DATA_LOAD_PRODUCT": "Cidasc Load - Product",
3802
3774
  "agro.angular_components.CIDASC_DATA_LOAD_MEASURE_UNIT": "Cidasc Load - Unit of measure",
3803
3775
  "agro.angular_components.CIDASC_DATA_LOAD_COMPOSED_MEASURE_UNIT": "Cidasc Load - Measure per hectare",
3776
+ "agro.angular_components.PRESCRIPTION_DATA_LOAD": "Prescription data load",
3804
3777
  "agro.angular_components.agronomic_prescription_origin_event": "Agronomic Prescription",
3805
- "agro.angular_components.number_or_series": "Número ou série",
3806
- "agro.angular_components.panel_title_external_invoice_add_external_invoice": "Adicionar nota fiscal",
3807
- "agro.angular_components.add_pj_invoice_modal_no_invoices_found": "Nenhuma nota fiscal disponível para este produtor",
3808
- "agro.angular_components.number": "Número",
3809
- "agro.angular_components.series": "Série",
3810
- "agro.angular_components.itens": "Itens",
3811
- "agro.angular_components.quantity": "Quantidade",
3812
- "agro.angular_components.issuance_date": "Data de emissão",
3813
3778
  };
3814
3779
 
3815
3780
  const esCO = {
@@ -3967,7 +3932,7 @@ const esCO = {
3967
3932
  "agro.angular_components.save": "Guardar",
3968
3933
  "agro.angular_components.select": "Seleccione",
3969
3934
  "agro.angular_components.updated_by": "Actualizado por",
3970
- error_invalid: "Valor inválido",
3935
+ "error_invalid": "Valor inválido",
3971
3936
  "agro.angular_components.choose_label": "Elegir",
3972
3937
  "agro.angular_components.remove_label": "Eliminar",
3973
3938
  "agro.angular_components.cancel_label": "Cancelar",
@@ -4065,15 +4030,8 @@ const esCO = {
4065
4030
  "agro.angular_components.CIDASC_DATA_LOAD_PRODUCT": "Carga Cidasc - Producto",
4066
4031
  "agro.angular_components.CIDASC_DATA_LOAD_MEASURE_UNIT": "Carga Cidasc - Unidad de medida",
4067
4032
  "agro.angular_components.CIDASC_DATA_LOAD_COMPOSED_MEASURE_UNIT": "Carga Cidasc - Medida por hectárea",
4033
+ "agro.angular_components.PRESCRIPTION_DATA_LOAD": "Carga de datos de la Nueva Receta",
4068
4034
  "agro.angular_components.agronomic_prescription_origin_event": "Recetario Agronómico",
4069
- "agro.angular_components.number_or_series": "Número ou série",
4070
- "agro.angular_components.panel_title_external_invoice_add_external_invoice": "Adicionar nota fiscal",
4071
- "agro.angular_components.add_pj_invoice_modal_no_invoices_found": "Nenhuma nota fiscal disponível para este produtor",
4072
- "agro.angular_components.number": "Número",
4073
- "agro.angular_components.series": "Série",
4074
- "agro.angular_components.itens": "Itens",
4075
- "agro.angular_components.quantity": "Quantidade",
4076
- "agro.angular_components.issuance_date": "Data de emissão",
4077
4035
  };
4078
4036
 
4079
4037
  let LibTranslationService = class LibTranslationService {
@@ -4084,10 +4042,10 @@ let LibTranslationService = class LibTranslationService {
4084
4042
  "es-CO": esCO,
4085
4043
  };
4086
4044
  this.currentTranslation = {};
4087
- this.setLang("pt-BR");
4045
+ this.setLang(this.getLangOfUser());
4088
4046
  }
4089
4047
  getLangOfUser() {
4090
- return AgroPlatformUtils.getCurrentTenantLocale() || "pt-BR";
4048
+ return AgroPlatformUtils.getCurrenTenantLocale() || "pt-BR";
4091
4049
  }
4092
4050
  setLang(lang) {
4093
4051
  this.currentTranslation = this.availableTranslations[lang] || {};
@@ -4125,251 +4083,6 @@ LibTranslationService = __decorate([
4125
4083
  })
4126
4084
  ], LibTranslationService);
4127
4085
 
4128
- let KilogramPipe = class KilogramPipe {
4129
- constructor(decimalPipe) {
4130
- this.decimalPipe = decimalPipe;
4131
- }
4132
- transform(value, format = "1.3-3", kgCaseInsensitive = "UPPER") {
4133
- if (value == null || isNaN(value)) {
4134
- return "";
4135
- }
4136
- let str = this.decimalPipe.transform(value, format);
4137
- const kgStr = "kg";
4138
- if (!str) {
4139
- console.info("Formato do peso inválido para transformação");
4140
- return "";
4141
- }
4142
- str = str.replace(/,/g, ".");
4143
- return `${this.replaceLastDotWithComma(str)} ${kgCaseInsensitive === "UPPER" ? kgStr.toUpperCase() : kgStr.toLowerCase()}`;
4144
- }
4145
- replaceLastDotWithComma(value) {
4146
- const lastDotIndex = value.lastIndexOf(".");
4147
- if (lastDotIndex === -1) {
4148
- return value;
4149
- }
4150
- return `${value.substring(0, lastDotIndex)},${value.substring(lastDotIndex + 1)}`;
4151
- }
4152
- };
4153
- KilogramPipe.ctorParameters = () => [
4154
- { type: DecimalPipe }
4155
- ];
4156
- KilogramPipe = __decorate([
4157
- Pipe({
4158
- name: "kilogram",
4159
- })
4160
- ], KilogramPipe);
4161
-
4162
- let KilogramModule = class KilogramModule {
4163
- };
4164
- KilogramModule = __decorate([
4165
- NgModule({
4166
- declarations: [KilogramPipe],
4167
- imports: [
4168
- CommonModule
4169
- ],
4170
- exports: [KilogramPipe]
4171
- })
4172
- ], KilogramModule);
4173
-
4174
- let CnpjCpfPipe = class CnpjCpfPipe {
4175
- transform(value, ...args) {
4176
- if (typeof value !== "string" && typeof value === "number") {
4177
- value = value === null || value === void 0 ? void 0 : value.toString();
4178
- }
4179
- if (typeof value !== "string") {
4180
- return value;
4181
- }
4182
- if (AgroStringUtils.validateCNPJ(value)) {
4183
- return AgroStringUtils.applyMask(value, AgroStringMasks.CNPJ);
4184
- }
4185
- if (AgroStringUtils.validateCPF(value)) {
4186
- return AgroStringUtils.applyMask(value, AgroStringMasks.CPF);
4187
- }
4188
- return value;
4189
- }
4190
- };
4191
- CnpjCpfPipe = __decorate([
4192
- Pipe({
4193
- name: "cnpjCpf",
4194
- })
4195
- ], CnpjCpfPipe);
4196
-
4197
- let CnpjCpfPipeModule = class CnpjCpfPipeModule {
4198
- };
4199
- CnpjCpfPipeModule = __decorate([
4200
- NgModule({
4201
- declarations: [CnpjCpfPipe],
4202
- imports: [CommonModule],
4203
- exports: [CnpjCpfPipe],
4204
- })
4205
- ], CnpjCpfPipeModule);
4206
-
4207
- class AgroObjectStringifier {
4208
- /**
4209
- * Formata um objeto concatenando valores segundo as chaves e pipes informados.
4210
- *
4211
- * @param separator Separador entre os valores (ex: "-")
4212
- * @param fields Campos a extrair. Podem conter subpropriedades ("propriedade.subPropriedade") e pipes ("propriedade|nomeDaPipe:arg1:arg2")
4213
- * @param obj Objeto origem
4214
- */
4215
- static formatObject(separator, fields, obj, usePipes) {
4216
- function mapField(field) {
4217
- const value = AgroObjectStringifier.resolvePath(obj, field);
4218
- if (usePipes === null || usePipes === void 0 ? void 0 : usePipes.hasOwnProperty(field)) {
4219
- return usePipes[field].transform(value);
4220
- }
4221
- return value !== null && value !== void 0 ? value : "";
4222
- }
4223
- function filterValid(v) {
4224
- return typeof v === "number" || AgroStringUtils.isValid(v);
4225
- }
4226
- return fields.map(mapField).filter(filterValid).join(` ${separator} `);
4227
- }
4228
- /** Resolve um caminho tipo "empresa.cargo" dentro de um objeto */
4229
- static resolvePath(obj, path) {
4230
- function reducer(acc, key) {
4231
- return acc === null || acc === void 0 ? void 0 : acc[key];
4232
- }
4233
- return path.split(".").reduce(reducer, obj);
4234
- }
4235
- }
4236
-
4237
- let StringifierPipe = class StringifierPipe {
4238
- transform(value, separator, paths, pipes) {
4239
- return AgroObjectStringifier.formatObject(separator, paths, value, pipes);
4240
- }
4241
- };
4242
- StringifierPipe = __decorate([
4243
- Pipe({ name: "stringifier" })
4244
- ], StringifierPipe);
4245
-
4246
- let StringifierPipeModule = class StringifierPipeModule {
4247
- };
4248
- StringifierPipeModule = __decorate([
4249
- NgModule({
4250
- declarations: [StringifierPipe],
4251
- imports: [CommonModule],
4252
- exports: [StringifierPipe],
4253
- })
4254
- ], StringifierPipeModule);
4255
-
4256
- let TelephonePipe = class TelephonePipe {
4257
- /**
4258
- * Transforma um número de telefone aplicando máscara automaticamente.
4259
- * @param value Valor do telefone.
4260
- * @param withDDI Define se deve forçar formatação com DDI (mesmo que não exista).
4261
- */
4262
- transform(value, withDDI = false) {
4263
- if (!value) {
4264
- return "";
4265
- }
4266
- const digits = this.cleanDigits(value);
4267
- if (!digits) {
4268
- return value.toString();
4269
- }
4270
- const { ddi, ddd, number } = this.extractParts(digits, withDDI);
4271
- return this.formatPhone(ddi, ddd, number, value.toString(), withDDI);
4272
- }
4273
- /** Remove todos os caracteres não numéricos */
4274
- cleanDigits(value) {
4275
- return value.toString().replace(/\D+/g, "");
4276
- }
4277
- /** Extrai DDI, DDD e número, considerando se deve aplicar DDI forçado */
4278
- extractParts(digits, withDDI) {
4279
- const len = digits.length;
4280
- if (withDDI) {
4281
- return this.extractWithDDI(digits);
4282
- }
4283
- if (len <= AGRO_NUMBERS.NINE) {
4284
- return { ddi: "", ddd: "", number: digits };
4285
- }
4286
- if (len <= AGRO_NUMBERS.ELEVEN) {
4287
- return this.extractWithDDD(digits);
4288
- }
4289
- return this.extractWithDDI(digits);
4290
- }
4291
- /** Extrai DDD e número (sem DDI) */
4292
- extractWithDDD(digits) {
4293
- const ddd = digits.slice(0, 2);
4294
- const number = digits.slice(2);
4295
- return { ddi: "", ddd, number };
4296
- }
4297
- /** Extrai DDI, DDD e número */
4298
- extractWithDDI(digits) {
4299
- const len = digits.length;
4300
- let ddiLen = AGRO_NUMBERS.ONE;
4301
- if (len >= AGRO_NUMBERS.FOURTEEN) {
4302
- ddiLen = AGRO_NUMBERS.THREE;
4303
- }
4304
- if (len >= AGRO_NUMBERS.TWELVE) {
4305
- ddiLen = AGRO_NUMBERS.TWO;
4306
- }
4307
- const ddi = digits.slice(AGRO_NUMBERS.ZERO, ddiLen);
4308
- const ddd = digits.slice(ddiLen, ddiLen + AGRO_NUMBERS.TWO);
4309
- const number = digits.slice(ddiLen + AGRO_NUMBERS.TWO);
4310
- return { ddi, ddd, number };
4311
- }
4312
- /** Monta o número formatado */
4313
- formatPhone(ddi, ddd, number, fallback, withDDI) {
4314
- if (!number) {
4315
- return fallback;
4316
- }
4317
- let formatted = "";
4318
- if (withDDI || ddi) {
4319
- formatted += `+${ddi || "55"} `;
4320
- }
4321
- if (ddd) {
4322
- formatted += `(${ddd}) `;
4323
- }
4324
- formatted += this.formatNumber(number);
4325
- return formatted;
4326
- }
4327
- /** Aplica máscara de 8 ou 9 dígitos */
4328
- formatNumber(number) {
4329
- const len = number.length;
4330
- if (len === AGRO_NUMBERS.NINE) {
4331
- return `${number.slice(AGRO_NUMBERS.ZERO, AGRO_NUMBERS.FIVE)}-${number.slice(AGRO_NUMBERS.FIVE)}`;
4332
- }
4333
- if (len === AGRO_NUMBERS.EIGHT) {
4334
- return `${number.slice(AGRO_NUMBERS.ZERO, AGRO_NUMBERS.FOUR)}-${number.slice(AGRO_NUMBERS.FOUR)}`;
4335
- }
4336
- return number;
4337
- }
4338
- };
4339
- TelephonePipe = __decorate([
4340
- Pipe({ name: "telephone" })
4341
- ], TelephonePipe);
4342
-
4343
- let TelephonePipeModule = class TelephonePipeModule {
4344
- };
4345
- TelephonePipeModule = __decorate([
4346
- NgModule({
4347
- declarations: [TelephonePipe],
4348
- imports: [CommonModule],
4349
- exports: [TelephonePipe],
4350
- })
4351
- ], TelephonePipeModule);
4352
-
4353
- let LibTranslatePipe = class LibTranslatePipe {
4354
- constructor(translateService) {
4355
- this.translateService = translateService;
4356
- }
4357
- transform(value, ...args) {
4358
- if (args.length > 0) {
4359
- return this.translateService.instant(value, args[0]);
4360
- }
4361
- return this.translateService.instant(value);
4362
- }
4363
- };
4364
- LibTranslatePipe.ctorParameters = () => [
4365
- { type: LibTranslationService }
4366
- ];
4367
- LibTranslatePipe = __decorate([
4368
- Pipe({
4369
- name: 'libTranslate'
4370
- })
4371
- ], LibTranslatePipe);
4372
-
4373
4086
  let CancelEventDialogComponent = class CancelEventDialogComponent {
4374
4087
  constructor(formBuilder, config, ref, translate) {
4375
4088
  this.formBuilder = formBuilder;
@@ -6214,6 +5927,26 @@ TicketModule = __decorate([
6214
5927
  })
6215
5928
  ], TicketModule);
6216
5929
 
5930
+ let LibTranslatePipe = class LibTranslatePipe {
5931
+ constructor(translateService) {
5932
+ this.translateService = translateService;
5933
+ }
5934
+ transform(value, ...args) {
5935
+ if (args.length > 0) {
5936
+ return this.translateService.instant(value, args[0]);
5937
+ }
5938
+ return this.translateService.instant(value);
5939
+ }
5940
+ };
5941
+ LibTranslatePipe.ctorParameters = () => [
5942
+ { type: LibTranslationService }
5943
+ ];
5944
+ LibTranslatePipe = __decorate([
5945
+ Pipe({
5946
+ name: 'libTranslate'
5947
+ })
5948
+ ], LibTranslatePipe);
5949
+
6217
5950
  let LibTranslationModule = class LibTranslationModule {
6218
5951
  };
6219
5952
  LibTranslationModule = __decorate([
@@ -6224,7 +5957,6 @@ LibTranslationModule = __decorate([
6224
5957
  imports: [
6225
5958
  CommonModule
6226
5959
  ],
6227
- providers: [LibTranslationService],
6228
5960
  exports: [
6229
5961
  LibTranslatePipe
6230
5962
  ]
@@ -6319,409 +6051,6 @@ EventControlBoardModule = __decorate([
6319
6051
  })
6320
6052
  ], EventControlBoardModule);
6321
6053
 
6322
- class AgroEntityService {
6323
- constructor(http, messageService, entityUrl, actionsUrl, queriesUrl, translate) {
6324
- this.http = http;
6325
- this.messageService = messageService;
6326
- this.entityUrl = entityUrl;
6327
- this.actionsUrl = actionsUrl;
6328
- this.queriesUrl = queriesUrl;
6329
- this.translate = translate;
6330
- this.http = http;
6331
- this.messageService = messageService;
6332
- this.entityUrl = entityUrl;
6333
- this.actionsUrl = actionsUrl;
6334
- this.queriesUrl = queriesUrl;
6335
- this.translate = translate;
6336
- this.defaultCatch = this.defaultCatch.bind(this);
6337
- }
6338
- getListQueryParams(listParams) {
6339
- const ten = 10;
6340
- const { page = 0, size = ten, sort = [], filterQuery = "", displayFields = [] } = listParams;
6341
- let params = new HttpParams();
6342
- params = params.append("size", String(size));
6343
- params = params.append("offset", String(page));
6344
- if (sort && sort.length) {
6345
- params = params.append("orderby", sort.map(this.getBodyFilters()).join(", "));
6346
- }
6347
- if (filterQuery) {
6348
- params = params.append("filter", filterQuery);
6349
- }
6350
- if (displayFields && displayFields.length) {
6351
- params = params.append("displayfields", displayFields.join());
6352
- }
6353
- return params;
6354
- }
6355
- getBodyParams(listParams) {
6356
- const ten = 10;
6357
- const { page = 0, size = ten, sort = [], filterQuery = "", displayFields = [] } = listParams;
6358
- const bodyParams = {};
6359
- bodyParams.size = size;
6360
- bodyParams.offset = page;
6361
- if (sort && sort.length) {
6362
- bodyParams.orderBy = sort.map(this.getBodyFilters()).join(", ");
6363
- }
6364
- if (filterQuery) {
6365
- bodyParams.filter = filterQuery;
6366
- }
6367
- if (displayFields && displayFields.length) {
6368
- bodyParams.displayfields = displayFields.join();
6369
- }
6370
- return bodyParams;
6371
- }
6372
- getBodyFilters() {
6373
- return (s) => {
6374
- let order = "";
6375
- if (s.order === 1) {
6376
- order = " asc";
6377
- }
6378
- if (s.order === -1) {
6379
- order = " desc";
6380
- }
6381
- return `${s.field}${order}`;
6382
- };
6383
- }
6384
- defaultCatch(errorMsgs = []) {
6385
- const unauthorized_401 = 401;
6386
- // errorMsgs = [...errorMsgs, ...DefaultErrorMessages];
6387
- errorMsgs = [...errorMsgs];
6388
- const zero = 0;
6389
- return catchError((err) => {
6390
- if (err) {
6391
- const errorMessage = errorMsgs.find((eMsg) => eMsg.status === (err === null || err === void 0 ? void 0 : err.status) || zero);
6392
- let summary = err.status ? String(err.status) : "Error";
6393
- let detail = this.getErrorMessage(err);
6394
- if (err.status === unauthorized_401) {
6395
- summary = this.translate.instant("agro.angular_components.error_unauthorized_title");
6396
- detail = this.translate.instant("agro.angular_components.error_unauthorized_description");
6397
- }
6398
- if (errorMessage) {
6399
- summary = errorMessage.summary ? this.translate.instant(errorMessage.summary) : summary;
6400
- detail = errorMessage.detail ? this.translate.instant(errorMessage.detail) : detail;
6401
- }
6402
- this.messageService.add({
6403
- severity: "error",
6404
- summary,
6405
- detail,
6406
- });
6407
- }
6408
- return throwError(err);
6409
- });
6410
- }
6411
- getErrorMessage(err) {
6412
- if (err.error && err.error.message) {
6413
- return err.error.message;
6414
- }
6415
- if (err.statusText) {
6416
- return err.statusText;
6417
- }
6418
- if (err.message) {
6419
- return err.message;
6420
- }
6421
- return "Error";
6422
- }
6423
- list(listParams, errorMessage = []) {
6424
- return this.http.get(this.entityUrl, { params: this.getListQueryParams(listParams) }).pipe(this.defaultCatch(errorMessage));
6425
- }
6426
- get(id, errorMessage = []) {
6427
- return this.http.get(`${this.entityUrl}/${id}`).pipe(this.defaultCatch(errorMessage));
6428
- }
6429
- insert(entity, errorMessage = []) {
6430
- return this.http.post(`${this.entityUrl}`, entity).pipe(this.defaultCatch(errorMessage));
6431
- }
6432
- update(id, entity, errorMessage = []) {
6433
- return this.http.put(`${this.entityUrl}/${id}`, entity).pipe(this.defaultCatch(errorMessage));
6434
- }
6435
- delete(id, errorMessage = []) {
6436
- return this.http.delete(`${this.entityUrl}/${id}`).pipe(this.defaultCatch(errorMessage));
6437
- }
6438
- listCustomFilter(listParams, action, errorMessage = []) {
6439
- return this.http.post(`${this.actionsUrl}/${action}`, this.getBodyParams(listParams)).pipe(this.defaultCatch(errorMessage));
6440
- }
6441
- }
6442
-
6443
- var statusLookup;
6444
- (function (statusLookup) {
6445
- statusLookup["PENDING"] = "PENDING";
6446
- statusLookup["FINISHED"] = "FINISHED";
6447
- statusLookup["ERROR"] = "ERROR";
6448
- })(statusLookup || (statusLookup = {}));
6449
- var statusIntegration;
6450
- (function (statusIntegration) {
6451
- statusIntegration["SUCCESS"] = "SUCCESS";
6452
- statusIntegration["IN_PROGRESS"] = "IN_PROGRESS";
6453
- statusIntegration["ERROR"] = "ERROR";
6454
- })(statusIntegration || (statusIntegration = {}));
6455
-
6456
- let AgroInvoiceService = class AgroInvoiceService extends AgroEntityService {
6457
- constructor(http, messageService, translate) {
6458
- super(http, messageService, `agro/invoice/entities/invoice`, `agro/invoice/actions`, `agro/invoice/queries`, translate);
6459
- this.http = http;
6460
- this.messageService = messageService;
6461
- this.translate = translate;
6462
- this.pooling = new Subject();
6463
- }
6464
- invoiceLookupFilter(data) {
6465
- return this.http
6466
- .post(`${this.queriesUrl}/invoiceLookup`, data)
6467
- .pipe(switchMap((res) => this.pollInvoiceResult(res.requestId)));
6468
- }
6469
- cancelActivePooling() {
6470
- this.pooling.next();
6471
- }
6472
- pollInvoiceResult(requestId) {
6473
- const delays = Array.from({ length: 10 }, (_, index) => {
6474
- if (index === 0) {
6475
- return 1000;
6476
- }
6477
- return (index + 1) * 1000;
6478
- });
6479
- return scheduled(delays, asyncScheduler).pipe(concatMap((delay) => timer(delay).pipe(switchMap(() => this.http.post(`${this.queriesUrl}/getInvoiceLookup`, { requestId })), tap((res) => {
6480
- if (res.status === statusLookup.ERROR) {
6481
- throw new Error(res.message);
6482
- }
6483
- }))), scan((_, curr) => curr, null), filter((res) => (res === null || res === void 0 ? void 0 : res.status) === statusLookup.FINISHED), take(1), defaultIfEmpty(null), takeUntil(this.pooling));
6484
- }
6485
- };
6486
- AgroInvoiceService.ctorParameters = () => [
6487
- { type: HttpClient },
6488
- { type: MessageService },
6489
- { type: LibTranslationService }
6490
- ];
6491
- AgroInvoiceService = __decorate([
6492
- Injectable()
6493
- ], AgroInvoiceService);
6494
-
6495
- const INVOICE_ITEMS = "invoiceItems.*";
6496
- let ModalInvoicePjSelectorComponent = class ModalInvoicePjSelectorComponent {
6497
- constructor(translate, invoiceService) {
6498
- this.translate = translate;
6499
- this.invoiceService = invoiceService;
6500
- this.whenSelectInvoices = new EventEmitter();
6501
- this.buttonPriority = ButtonPriority;
6502
- this.gridColumns = [
6503
- { field: "number", header: this.translate.instant("agro.angular_components.number") },
6504
- { field: "series", header: this.translate.instant("agro.angular_components.series") },
6505
- { field: "invoiceItems", header: this.translate.instant("agro.angular_components.itens") },
6506
- { field: "quantity", header: this.translate.instant("agro.angular_components.quantity") },
6507
- { field: "issuanceDate", header: this.translate.instant("agro.angular_components.issuance_date") },
6508
- ];
6509
- this.dontHaveAnyInvoice = false;
6510
- this.gridLoading = true;
6511
- this.gridTotalRecords = AGRO_NUMBERS.ZERO;
6512
- this.selected = [];
6513
- this.unselectedIds = new Set();
6514
- this.visible = false;
6515
- this.searchValue = new FormControl("", []);
6516
- this.ngUnsubscribe = new Subject();
6517
- this.currentParams = {
6518
- page: 0,
6519
- size: 10,
6520
- sort: [{ field: "issuanceDate", order: 1 }],
6521
- displayFields: ["*", INVOICE_ITEMS, "issuanceDate"],
6522
- filterQuery: "",
6523
- };
6524
- }
6525
- ngOnDestroy() {
6526
- this.ngUnsubscribe.next();
6527
- this.ngUnsubscribe.complete();
6528
- }
6529
- ngOnInit() {
6530
- this.whenSearchValueChanges();
6531
- }
6532
- whenSearchValueChanges() {
6533
- this.searchValue.valueChanges
6534
- .pipe(takeUntil(this.ngUnsubscribe))
6535
- .pipe(debounceTime(AGRO_NUMBERS.THREE_HUNDRED))
6536
- .subscribe((value) => {
6537
- if (value) {
6538
- this.updateGridData({ first: 0, rows: 10, multiSortMeta: [{ field: "issuanceDate", order: 1 }] }, value);
6539
- }
6540
- else {
6541
- this.updateGridData({ first: 0, rows: 10, multiSortMeta: [{ field: "issuanceDate", order: 1 }] });
6542
- }
6543
- });
6544
- }
6545
- tryToSearchAgain() {
6546
- this.gridLoading = true;
6547
- this.updateGridData({ first: 0, rows: 10, multiSortMeta: [{ field: "issuanceDate", order: 1 }] });
6548
- }
6549
- open() {
6550
- if (this.checkIfOptionsIsValid()) {
6551
- this.visible = true;
6552
- this.gridData = [];
6553
- this.gridLoading = true;
6554
- this.gridTotalRecords = 0;
6555
- this.selected = [];
6556
- this.unselectedIds.clear();
6557
- this.currentParams = {
6558
- page: 0,
6559
- size: 10,
6560
- sort: [],
6561
- filterQuery: "",
6562
- displayFields: ["*", INVOICE_ITEMS],
6563
- };
6564
- this.updateGridData({ first: 0, rows: 10, multiSortMeta: [{ field: "issuanceDate", order: 1 }] });
6565
- this.selected = [];
6566
- }
6567
- }
6568
- checkIfOptionsIsValid() {
6569
- if (!this.options) {
6570
- return false;
6571
- }
6572
- if (!this.options.companyId || !this.options.branchId) {
6573
- return false;
6574
- }
6575
- return true;
6576
- }
6577
- updateGridData(event, searchValue) {
6578
- var _a;
6579
- this.cancelPooling();
6580
- const { companyId, branchId } = this.options;
6581
- const producerId = this.options.producersIds[0];
6582
- const ruralEstateId = this.options.ruralEstateIds[0];
6583
- const size = event.rows;
6584
- const page = event.first / size;
6585
- const sizePage = event.rows;
6586
- this.currentParams = {
6587
- page,
6588
- size,
6589
- sort: ((_a = event.multiSortMeta) === null || _a === void 0 ? void 0 : _a.length) ? event.multiSortMeta : [{ field: "issuanceDate", order: 1 }],
6590
- displayFields: ["*", INVOICE_ITEMS, "issuanceDate"],
6591
- };
6592
- this.gridLoading = true;
6593
- this.dontHaveAnyInvoice = false;
6594
- const filterBody = {
6595
- filter: {
6596
- companyId,
6597
- branchId,
6598
- producerIds: [producerId],
6599
- ruralEstateIds: [ruralEstateId],
6600
- multiProducts: false,
6601
- productId: this.options.productId,
6602
- },
6603
- pageRequest: {
6604
- offset: page,
6605
- size: sizePage,
6606
- orderBy: this.currentParams.sort.map((sort) => ({ field: sort.field, order: sort.order === 1 ? "asc" : "desc" })),
6607
- },
6608
- };
6609
- this.invoiceService
6610
- .invoiceLookupFilter(filterBody)
6611
- .pipe(takeUntil(this.ngUnsubscribe), finalize(() => {
6612
- this.gridLoading = false;
6613
- }))
6614
- .subscribe((result) => {
6615
- var _a;
6616
- this.gridData = ((_a = result === null || result === void 0 ? void 0 : result.result) === null || _a === void 0 ? void 0 : _a.invoices) || [];
6617
- if (this.gridData.length === 0 && !searchValue) {
6618
- this.dontHaveAnyInvoice = true;
6619
- }
6620
- this.gridTotalRecords = result.result.totalElements;
6621
- }, (error) => {
6622
- console.info("Erro ao buscar notas fiscais: ", error);
6623
- }, () => {
6624
- this.gridLoading = false;
6625
- });
6626
- }
6627
- cancelPooling() {
6628
- this.invoiceService.cancelActivePooling();
6629
- }
6630
- add() {
6631
- return __awaiter(this, void 0, void 0, function* () {
6632
- try {
6633
- this.whenSelectInvoices.emit(this.selected);
6634
- this.resetSpecs();
6635
- }
6636
- catch (error) {
6637
- console.info("Erro ao selecionar notas fiscais: ", error);
6638
- }
6639
- });
6640
- }
6641
- resetSpecs() {
6642
- this.selected = [];
6643
- this.dontHaveAnyInvoice = false;
6644
- this.visible = false;
6645
- this.gridData = [];
6646
- this.gridLoading = false;
6647
- this.gridTotalRecords = 0;
6648
- }
6649
- cancel() {
6650
- return __awaiter(this, void 0, void 0, function* () {
6651
- this.resetSpecs();
6652
- });
6653
- }
6654
- };
6655
- ModalInvoicePjSelectorComponent.ctorParameters = () => [
6656
- { type: LibTranslationService },
6657
- { type: AgroInvoiceService }
6658
- ];
6659
- __decorate([
6660
- Input()
6661
- ], ModalInvoicePjSelectorComponent.prototype, "options", void 0);
6662
- __decorate([
6663
- Output()
6664
- ], ModalInvoicePjSelectorComponent.prototype, "whenSelectInvoices", void 0);
6665
- ModalInvoicePjSelectorComponent = __decorate([
6666
- Component({
6667
- selector: "s-modal-invoice-pj-selector",
6668
- template: "<p-dialog\r\n header=\"{{ 'agro.angular_components.panel_title_external_invoice_add_external_invoice' | libTranslate }}\"\r\n [(visible)]=\"visible\"\r\n [modal]=\"true\"\r\n class=\"add-invoice-modal\"\r\n [closeOnEscape]=\"false\"\r\n (onHide)=\"cancelPooling()\"\r\n [dismissableMask]=\"false\"\r\n>\r\n <ng-container *ngIf=\"!dontHaveAnyInvoice\">\r\n <div class=\"ui-g\">\r\n <label for=\"invoiceSearchInput\">{{ 'agro.angular_components.number_or_series' | libTranslate }}</label>\r\n <input\r\n type=\"text\"\r\n id=\"invoiceSearchInput\"\r\n pInputText\r\n [formControl]=\"searchValue\"\r\n [placeholder]=\"'' | libTranslate\"\r\n [required]=\"false\"\r\n />\r\n <div class=\"ui-g-12\">\r\n <p-table\r\n [(selection)]=\"selected\"\r\n [value]=\"gridData\"\r\n [columns]=\"gridColumns\"\r\n [scrollable]=\"true\"\r\n dataKey=\"externalInvoiceId\"\r\n [rows]=\"10\"\r\n [paginator]=\"true\"\r\n [lazyLoadOnInit]=\"false\"\r\n [totalRecords]=\"gridTotalRecords\"\r\n [lazy]=\"true\"\r\n (onLazyLoad)=\"updateGridData($event)\"\r\n [resizableColumns]=\"true\"\r\n *sLoadingState=\"gridLoading\"\r\n sortMode=\"multiple\"\r\n [selectionMode]=\"'multiple'\"\r\n >\r\n <ng-template pTemplate=\"header\" let-columns>\r\n <tr>\r\n <th class=\"checkbox\" scope=\"col\">\r\n <p-tableHeaderCheckbox></p-tableHeaderCheckbox>\r\n </th>\r\n <ng-container *ngFor=\"let col of columns\">\r\n <th class=\"column\" scope=\"col\" *ngIf=\"['invoiceItems', 'quantity'].includes(col.field)\">\r\n {{ col.header }}\r\n </th>\r\n <th\r\n class=\"column\"\r\n [pSortableColumn]=\"col.field\"\r\n scope=\"col\"\r\n *ngIf=\"!['invoiceItems', 'quantity'].includes(col.field)\"\r\n >\r\n {{ col.header }}\r\n <p-sortIcon [field]=\"col.field\"></p-sortIcon>\r\n </th>\r\n </ng-container>\r\n </tr>\r\n </ng-template>\r\n\r\n <ng-template pTemplate=\"body\" let-rowData let-columns=\"columns\" let-rowIndex=\"rowIndex\">\r\n <tr>\r\n <td class=\"checkbox\" tabindex=\"0\">\r\n <p-tableCheckbox [value]=\"rowData\"></p-tableCheckbox>\r\n </td>\r\n <td\r\n [pSelectableRow]=\"rowData\"\r\n [pSelectableRowIndex]=\"rowIndex\"\r\n *ngFor=\"let col of columns\"\r\n class=\"column\"\r\n tabindex=\"0\"\r\n >\r\n <ng-container [ngSwitch]=\"col.field\">\r\n <ng-container *ngSwitchCase=\"'issuanceDate'\">\r\n {{ rowData[col.field] | localizedDate: 'L' | async }}\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'invoiceItems'\">\r\n {{ rowData?.totalItems || 0 }}\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'quantity'\">\r\n {{ rowData?.totalItemsQuantity || 0 | kilogram }}\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'series'\">\r\n {{ rowData?.seriesLegal || rowData?.series || rowData[col.field] }}\r\n </ng-container>\r\n <ng-container *ngSwitchDefault> {{ rowData[col.field] }} </ng-container>\r\n </ng-container>\r\n </td>\r\n </tr>\r\n </ng-template>\r\n\r\n <ng-template pTemplate=\"paginatorright\">\r\n <span>{{ gridTotalRecords }} registros encontrados</span>\r\n </ng-template>\r\n </p-table>\r\n </div>\r\n </div>\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"dontHaveAnyInvoice\">\r\n <s-empty-state\r\n iconClass=\"fa fa-exclamation-triangle\"\r\n title=\"{{ 'agro.angular_components.add_pj_invoice_modal_no_invoices_found' | libTranslate }}\"\r\n primaryActionLabel=\"{{ 'agro.angular_components.error_server_try_again' | libTranslate }}\"\r\n (primaryAction)=\"tryToSearchAgain()\"\r\n description=\"{{ 'agro.angular_components.no_register_found_for_external_invoices_summary' | libTranslate }}\"\r\n >\r\n </s-empty-state>\r\n </ng-container>\r\n\r\n <p-footer class=\"footer\" *ngIf=\"!dontHaveAnyInvoice\">\r\n <s-button\r\n [priority]=\"buttonPriority.Primary\"\r\n label=\"{{ 'agro.angular_components.panel_title_external_invoice_add_external_invoice' | libTranslate }}\"\r\n [disabled]=\"!selected?.length\"\r\n (click)=\"add()\"\r\n (keydown.enter)=\"add()\"\r\n ></s-button>\r\n <s-button\r\n [priority]=\"buttonPriority.Link\"\r\n label=\"{{ 'agro.angular_components.cancel' | libTranslate }}\"\r\n (click)=\"cancel()\"\r\n (keydown.enter)=\"cancel()\"\r\n ></s-button>\r\n </p-footer>\r\n</p-dialog>\r\n",
6669
- styles: [".footer{width:100%;display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:center;align-items:center}.add-invoice-modal{width:480px;max-width:480px}.add-invoice-modal input[type=text]{width:100%}.add-invoice-modal .ui-dialog{width:480px!important}.add-invoice-modal .ui-dialog .ui-dialog-content{min-height:175px}td.checkbox,th.checkbox{width:50px}td.column,th.column{min-width:150px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}"]
6670
- })
6671
- ], ModalInvoicePjSelectorComponent);
6672
-
6673
- let AgroInvoiceModule = class AgroInvoiceModule {
6674
- };
6675
- AgroInvoiceModule = __decorate([
6676
- NgModule({
6677
- imports: [
6678
- HttpClientModule,
6679
- PermissionsModule.forChild([
6680
- {
6681
- name: 'invoice',
6682
- actions: ['Visualizar', 'Incluir', 'Editar', 'Excluir'],
6683
- uri: `res://senior.com.br/agro/origination/entities/invoice`,
6684
- },
6685
- ]),
6686
- ],
6687
- providers: [
6688
- AgroInvoiceService,
6689
- ],
6690
- declarations: [],
6691
- exports: [],
6692
- })
6693
- ], AgroInvoiceModule);
6694
-
6695
- let ModalInvoicePjSelectorModule = class ModalInvoicePjSelectorModule {
6696
- };
6697
- ModalInvoicePjSelectorModule = __decorate([
6698
- NgModule({
6699
- declarations: [ModalInvoicePjSelectorComponent],
6700
- providers: [DecimalPipe, DatePipe],
6701
- imports: [
6702
- CommonModule,
6703
- ReactiveFormsModule,
6704
- LocaleModule.forChild(),
6705
- EmptyStateModule,
6706
- BignumberInputModule,
6707
- InputTextModule$1,
6708
- ButtonModule,
6709
- TableModule$1,
6710
- SharedModule$2,
6711
- TableModule,
6712
- AgroInvoiceModule,
6713
- DialogModule,
6714
- KilogramModule,
6715
- LoadingStateModule,
6716
- ConfirmDialogModule$1,
6717
- LibTranslationModule,
6718
- KilogramModule,
6719
- TableHeaderCheckboxModule,
6720
- ],
6721
- exports: [ModalInvoicePjSelectorComponent],
6722
- })
6723
- ], ModalInvoicePjSelectorModule);
6724
-
6725
6054
  var AgroAngularComponentsModule_1;
6726
6055
  const HostProjectConfigsInjectionToken = new InjectionToken("hostProjectConfigs");
6727
6056
  let AgroAngularComponentsModule = AgroAngularComponentsModule_1 = class AgroAngularComponentsModule {
@@ -6745,5 +6074,5 @@ AgroAngularComponentsModule = AgroAngularComponentsModule_1 = __decorate([
6745
6074
  * Generated bundle index. Do not edit.
6746
6075
  */
6747
6076
 
6748
- export { AGRO_NUMBERS, AGRO_REGEX, AgroAngularComponentsModule, AgroArrayUtils, AgroCookieUtils, AgroDateUtils, AgroEntityStatus, AgroFormValidator, AgroInvoiceModule, AgroInvoiceService, AgroLogics, AgroNameUtils, AgroNumberUtils, AgroObjectUtils, AgroPlatformUtils, AgroStringMasks, AgroStringUtils, AsyncLock, CancelEventDialogComponent, CancelEventDialogModule, CnpjCpfPipe, CnpjCpfPipeModule, Colors, DateComparisonType, E001TnsModule, E001pesModule, E070EmpModule, E070FilModule, E075DerModule, E205depService, EventControlBoardComponent, EventControlBoardModule, EventControlBoardService, EventControlItemModule, EventControlModule, EventStepsComponent, EventStepsModule, ExternalInvoiceModule, FixationModule, HostProjectConfigsInjectionToken, HttpCodes, InvoiceModule, KilogramModule, KilogramPipe, LibTranslatePipe, LibTranslationModule, LibTranslationService, ModalInvoicePjSelectorComponent, ModalInvoicePjSelectorModule, NumberComparisonType, OriginationModule, PaginatorStorageService, PrimitiveManager, ProducerInvoiceModule, RuralEstateModule, SharedModule, StringifierPipe, StringifierPipeModule, TelephonePipe, TelephonePipeModule, TicketModule, TransferModule, UserInformationService, WebsocketModule, WebsocketService, LibTranslatePipe as ɵa, LibTranslationService as ɵb };
6077
+ export { AGRO_NUMBERS, AGRO_REGEX, AgroAngularComponentsModule, AgroArrayUtils, AgroCookieUtils, AgroDateUtils, AgroEntityStatus, AgroFormValidator, AgroLogics, AgroNameUtils, AgroNumberUtils, AgroObjectUtils, AgroPlatformUtils, AgroStringMasks, AgroStringUtils, AsyncLock, CancelEventDialogComponent, CancelEventDialogModule, 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 };
6749
6078
  //# sourceMappingURL=senior-agronegocio-angular-components.js.map