@senior-gestao-empresarial/erpx-components 4.7.0 → 4.8.0-develop-61c17d59

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 (34) hide show
  1. package/bundles/senior-gestao-empresarial-erpx-components.umd.js +118 -17
  2. package/bundles/senior-gestao-empresarial-erpx-components.umd.js.map +1 -1
  3. package/bundles/senior-gestao-empresarial-erpx-components.umd.min.js +1 -1
  4. package/bundles/senior-gestao-empresarial-erpx-components.umd.min.js.map +1 -1
  5. package/components/rateio-editor/erp-rateio-editor.component.d.ts +24 -7
  6. package/components/tributos/index.d.ts +1 -0
  7. package/components/tributos/rules/types/schemas/incoming-invoice.schema.d.ts +2 -0
  8. package/components/tributos/types/credit-invoice-type.d.ts +1 -0
  9. package/components/tributos/types/incoming-invoice.d.ts +6 -1
  10. package/esm2015/components/rateio-editor/erp-rateio-editor.component.js +48 -16
  11. package/esm2015/components/tributos/erp-tributos.component.js +6 -2
  12. package/esm2015/components/tributos/index.js +1 -1
  13. package/esm2015/components/tributos/rules/calculation/registries/calculation-rules-registries/incoming-invoice-calculation-rules.registry.js +29 -1
  14. package/esm2015/components/tributos/rules/types/schemas/incoming-invoice.schema.js +15 -1
  15. package/esm2015/components/tributos/rules/validation/registries/incoming-invoice-validation-rules.registry.js +29 -1
  16. package/esm2015/components/tributos/types/credit-invoice-type.js +1 -0
  17. package/esm2015/components/tributos/types/incoming-invoice.js +1 -1
  18. package/esm2015/locale/fallback.js +7 -2
  19. package/esm5/components/rateio-editor/erp-rateio-editor.component.js +52 -16
  20. package/esm5/components/tributos/erp-tributos.component.js +6 -2
  21. package/esm5/components/tributos/index.js +1 -1
  22. package/esm5/components/tributos/rules/calculation/registries/calculation-rules-registries/incoming-invoice-calculation-rules.registry.js +29 -1
  23. package/esm5/components/tributos/rules/types/schemas/incoming-invoice.schema.js +15 -1
  24. package/esm5/components/tributos/rules/validation/registries/incoming-invoice-validation-rules.registry.js +29 -1
  25. package/esm5/components/tributos/types/credit-invoice-type.js +1 -0
  26. package/esm5/components/tributos/types/incoming-invoice.js +1 -1
  27. package/esm5/locale/fallback.js +7 -2
  28. package/fesm2015/senior-gestao-empresarial-erpx-components.js +114 -17
  29. package/fesm2015/senior-gestao-empresarial-erpx-components.js.map +1 -1
  30. package/fesm5/senior-gestao-empresarial-erpx-components.js +118 -17
  31. package/fesm5/senior-gestao-empresarial-erpx-components.js.map +1 -1
  32. package/locale/fallback.d.ts +5 -0
  33. package/package.json +1 -1
  34. package/senior-gestao-empresarial-erpx-components.metadata.json +1 -1
@@ -4102,6 +4102,34 @@
4102
4102
  rule: this.taxClassificationCalculationRule
4103
4103
  }
4104
4104
  ],
4105
+ _f[exports.EnumTipoTributo.CBS_TRANSFERENCIA_CREDITO] = [
4106
+ {
4107
+ field: exports.EnumCampoTributo.SituacaoTributaria,
4108
+ rule: this.taxSituationCalculationRule
4109
+ },
4110
+ {
4111
+ field: exports.EnumCampoTributo.ClassificacaoTributaria,
4112
+ rule: this.taxClassificationCalculationRule
4113
+ },
4114
+ {
4115
+ field: exports.EnumCampoTributo.Valor,
4116
+ rule: this.taxAmountCalculationRule
4117
+ }
4118
+ ],
4119
+ _f[exports.EnumTipoTributo.IBS_TRANSFERENCIA_CREDITO] = [
4120
+ {
4121
+ field: exports.EnumCampoTributo.SituacaoTributaria,
4122
+ rule: this.taxSituationCalculationRule
4123
+ },
4124
+ {
4125
+ field: exports.EnumCampoTributo.ClassificacaoTributaria,
4126
+ rule: this.taxClassificationCalculationRule
4127
+ },
4128
+ {
4129
+ field: exports.EnumCampoTributo.Valor,
4130
+ rule: this.taxAmountCalculationRule
4131
+ }
4132
+ ],
4105
4133
  _f),
4106
4134
  Freight: (_g = {},
4107
4135
  _g[exports.EnumTipoTributo.CBS] = [
@@ -17671,6 +17699,34 @@
17671
17699
  rules: [this.taxAmountRequiredValidationRule]
17672
17700
  }
17673
17701
  ],
17702
+ _f[exports.EnumTipoTributo.CBS_TRANSFERENCIA_CREDITO] = [
17703
+ {
17704
+ field: exports.EnumCampoTributo.SituacaoTributaria,
17705
+ rules: [this.taxSituationRequiredValidationRule]
17706
+ },
17707
+ {
17708
+ field: exports.EnumCampoTributo.ClassificacaoTributaria,
17709
+ rules: [this.taxClassificationRequiredValidationRule]
17710
+ },
17711
+ {
17712
+ field: exports.EnumCampoTributo.Valor,
17713
+ rules: [this.taxAmountRequiredValidationRule]
17714
+ }
17715
+ ],
17716
+ _f[exports.EnumTipoTributo.IBS_TRANSFERENCIA_CREDITO] = [
17717
+ {
17718
+ field: exports.EnumCampoTributo.SituacaoTributaria,
17719
+ rules: [this.taxSituationRequiredValidationRule]
17720
+ },
17721
+ {
17722
+ field: exports.EnumCampoTributo.ClassificacaoTributaria,
17723
+ rules: [this.taxClassificationRequiredValidationRule]
17724
+ },
17725
+ {
17726
+ field: exports.EnumCampoTributo.Valor,
17727
+ rules: [this.taxAmountRequiredValidationRule]
17728
+ }
17729
+ ],
17674
17730
  _f),
17675
17731
  Freight: (_g = {},
17676
17732
  _g[exports.EnumTipoTributo.CBS] = [
@@ -26985,11 +27041,15 @@
26985
27041
  });
26986
27042
  _this.changeDetector.detectChanges();
26987
27043
  },
26988
- visible: this.context.document === 'Outgoing Invoice' &&
27044
+ visible: (this.context.document === 'Outgoing Invoice' &&
26989
27045
  this.context.invoice.type === 'Debit' &&
26990
27046
  (this.context.invoice.debitInvoiceType ===
26991
27047
  'Credit Transfer Cooperatives' ||
26992
27048
  this.context.invoice.debitInvoiceType ===
27049
+ 'Credit Transfer Succession')) ||
27050
+ (this.context.document === 'Incoming Invoice' &&
27051
+ this.context.invoice.type === 'Credit' &&
27052
+ this.context.invoice.creditInvoiceType ===
26993
27053
  'Credit Transfer Succession')
26994
27054
  }, {
26995
27055
  id: 'retencaoFunrural',
@@ -33302,6 +33362,16 @@
33302
33362
  this.messageService = messageService;
33303
33363
  this.readOnly = false;
33304
33364
  this.showSugestaoButton = true;
33365
+ /**
33366
+ * Controla se o rateio deve ser carregado automaticamente via API quando
33367
+ * idMovimento está presente (modo conectado). Default: true.
33368
+ *
33369
+ * Defina como false para restaurar um rateio que o usuário já distribuiu e que
33370
+ * ainda não foi persistido no backend de rateio: o componente popula a grid a
33371
+ * partir de initialContext/initialRateios e mantém o botão Salvar e a gravação
33372
+ * vinculada ao movimento.
33373
+ */
33374
+ this.loadFromApi = true;
33305
33375
  /**
33306
33376
  * Critério de rateio padrão usado pela API de sugestão.
33307
33377
  * Default: 'V3' (Despesas — Conta X C. Custos).
@@ -33401,13 +33471,13 @@
33401
33471
  });
33402
33472
  ErpRateioEditorComponent.prototype.ngOnChanges = function (changes) {
33403
33473
  var movimentoChanged = changes.idMovimento || changes.tipoMovimento;
33404
- if (movimentoChanged && this.idMovimento && this.tipoMovimento) {
33405
- // Modo conectado: carrega via API
33474
+ if (movimentoChanged && this.idMovimento && this.tipoMovimento && this.loadFromApi) {
33475
+ // Modo conectado com carga via API
33406
33476
  this.carregarRateio();
33407
33477
  }
33408
- else if (this.isStandalone && (changes.initialContext || changes.initialRateios || movimentoChanged)) {
33409
- // Modo standalone: usa inputs diretos (mesmo que vazios)
33410
- this.inicializarStandalone();
33478
+ else if (this.isInputDriven && (changes.initialContext || changes.initialRateios || changes.loadFromApi || movimentoChanged)) {
33479
+ // Alimentado por inputs: modo standalone OU conectado sem carga via API
33480
+ this.inicializarPorInputs();
33411
33481
  }
33412
33482
  };
33413
33483
  Object.defineProperty(ErpRateioEditorComponent.prototype, "rateios", {
@@ -33426,10 +33496,21 @@
33426
33496
  enumerable: true,
33427
33497
  configurable: true
33428
33498
  });
33499
+ Object.defineProperty(ErpRateioEditorComponent.prototype, "isInputDriven", {
33500
+ /**
33501
+ * Indica se o componente é alimentado por inputs em vez da API:
33502
+ * modo standalone (sem idMovimento) OU modo conectado com loadFromApi = false.
33503
+ */
33504
+ get: function () {
33505
+ return this.isStandalone || !this.loadFromApi;
33506
+ },
33507
+ enumerable: true,
33508
+ configurable: true
33509
+ });
33429
33510
  Object.defineProperty(ErpRateioEditorComponent.prototype, "isReady", {
33430
- /** Indica se o componente está pronto para exibir UI (modo conectado carregou OU modo standalone inicializado). */
33511
+ /** Indica se o componente está pronto para exibir UI (carregou via API OU foi inicializado por inputs). */
33431
33512
  get: function () {
33432
- return !!this.loadedContext || this.isStandalone;
33513
+ return !!this.loadedContext || this.isInputDriven;
33433
33514
  },
33434
33515
  enumerable: true,
33435
33516
  configurable: true
@@ -33441,10 +33522,21 @@
33441
33522
  // === AÇÕES PÚBLICAS ===
33442
33523
  ErpRateioEditorComponent.prototype.onSalvar = function () {
33443
33524
  var _this = this;
33525
+ var _a;
33444
33526
  if (this.effectiveReadOnly) {
33445
33527
  return;
33446
33528
  }
33447
33529
  var ctx = this.loadedContext;
33530
+ if (!((_a = ctx === null || ctx === void 0 ? void 0 : ctx.e070fil) === null || _a === void 0 ? void 0 : _a.id) || !(ctx === null || ctx === void 0 ? void 0 : ctx.criRat)) {
33531
+ var message = this.translate.instant('erpx.rateio_editor.erro_contexto_incompleto');
33532
+ this.messageService.add({
33533
+ severity: 'error',
33534
+ summary: this.translate.instant('erpx.rateio_editor.erro_titulo'),
33535
+ detail: message
33536
+ });
33537
+ this.error.emit({ operacao: 'save', message: message });
33538
+ return;
33539
+ }
33448
33540
  var input = {
33449
33541
  idMovimento: this.idMovimento,
33450
33542
  tipoMovimento: this.tipoMovimento,
@@ -33466,13 +33558,14 @@
33466
33558
  });
33467
33559
  _this.save.emit({ idMovimento: _this.idMovimento, tipoMovimento: _this.tipoMovimento, rateios: _this.contasDataSource });
33468
33560
  }, function (err) {
33469
- var _a, _b;
33561
+ var _a;
33562
+ var detail = ((_a = err === null || err === void 0 ? void 0 : err.error) === null || _a === void 0 ? void 0 : _a.message) || (err === null || err === void 0 ? void 0 : err.message) || _this.translate.instant('erpx.rateio_editor.erro_salvar');
33470
33563
  _this.messageService.add({
33471
33564
  severity: 'error',
33472
- summary: _this.translate.instant('erpx.rateio_editor.erro_titulo') || 'Erro',
33473
- detail: ((_a = err === null || err === void 0 ? void 0 : err.error) === null || _a === void 0 ? void 0 : _a.message) || (err === null || err === void 0 ? void 0 : err.message) || 'Erro ao salvar rateio'
33565
+ summary: _this.translate.instant('erpx.rateio_editor.erro_titulo'),
33566
+ detail: detail
33474
33567
  });
33475
- _this.error.emit({ operacao: 'save', message: ((_b = err === null || err === void 0 ? void 0 : err.error) === null || _b === void 0 ? void 0 : _b.message) || (err === null || err === void 0 ? void 0 : err.message) || 'Erro ao salvar rateio', originalError: err });
33568
+ _this.error.emit({ operacao: 'save', message: detail, originalError: err });
33476
33569
  });
33477
33570
  };
33478
33571
  ErpRateioEditorComponent.prototype.onSugerir = function () {
@@ -33515,7 +33608,7 @@
33515
33608
  }
33516
33609
  _this.popularComRateios(rateio);
33517
33610
  _this.emitChange();
33518
- }, function (err) { var _a; return _this.error.emit({ operacao: 'suggest', message: ((_a = err === null || err === void 0 ? void 0 : err.error) === null || _a === void 0 ? void 0 : _a.message) || (err === null || err === void 0 ? void 0 : err.message) || 'Erro ao sugerir rateio', originalError: err }); });
33611
+ }, function (err) { var _a; return _this.error.emit({ operacao: 'suggest', message: ((_a = err === null || err === void 0 ? void 0 : err.error) === null || _a === void 0 ? void 0 : _a.message) || (err === null || err === void 0 ? void 0 : err.message) || _this.translate.instant('erpx.rateio_editor.erro_sugerir'), originalError: err }); });
33519
33612
  };
33520
33613
  // === MODAL CONTA FINANCEIRA ===
33521
33614
  ErpRateioEditorComponent.prototype.openContaDialog = function (editIndex) {
@@ -33688,8 +33781,8 @@
33688
33781
  return this.contasDataSource.indexOf(rowData);
33689
33782
  };
33690
33783
  // === PRIVADOS ===
33691
- /** Inicializa o componente em modo standalone (sem chamada à API). */
33692
- ErpRateioEditorComponent.prototype.inicializarStandalone = function () {
33784
+ /** Inicializa o componente a partir dos inputs (sem chamada à API de carga). */
33785
+ ErpRateioEditorComponent.prototype.inicializarPorInputs = function () {
33693
33786
  var _a, _b, _c;
33694
33787
  this.loadedContext = (this.initialContext || {});
33695
33788
  this.popularComRateios(this.initialRateios || []);
@@ -33711,7 +33804,7 @@
33711
33804
  _this.empresaId = output.e070fil.e070emp.id;
33712
33805
  }
33713
33806
  _this.gridColumns = _this.getGridColumns();
33714
- }, function (err) { var _a; return _this.error.emit({ operacao: 'load', message: ((_a = err === null || err === void 0 ? void 0 : err.error) === null || _a === void 0 ? void 0 : _a.message) || (err === null || err === void 0 ? void 0 : err.message) || 'Erro ao carregar rateio', originalError: err }); });
33807
+ }, function (err) { var _a; return _this.error.emit({ operacao: 'load', message: ((_a = err === null || err === void 0 ? void 0 : err.error) === null || _a === void 0 ? void 0 : _a.message) || (err === null || err === void 0 ? void 0 : err.message) || _this.translate.instant('erpx.rateio_editor.erro_carregar'), originalError: err }); });
33715
33808
  };
33716
33809
  ErpRateioEditorComponent.prototype.popularComRateios = function (rateios) {
33717
33810
  this.contasDataSource = __spread(rateios);
@@ -33862,6 +33955,9 @@
33862
33955
  __decorate([
33863
33956
  core.Input()
33864
33957
  ], ErpRateioEditorComponent.prototype, "initialRateios", void 0);
33958
+ __decorate([
33959
+ core.Input()
33960
+ ], ErpRateioEditorComponent.prototype, "loadFromApi", void 0);
33865
33961
  __decorate([
33866
33962
  core.Input()
33867
33963
  ], ErpRateioEditorComponent.prototype, "empresaId", void 0);
@@ -34016,7 +34112,12 @@
34016
34112
  "erpx.rateio_editor.error_soma_valor_invalida": "A soma dos valores deve ser igual ao valor base",
34017
34113
  "erpx.rateio_editor.sem_parametrizacao": "Não há parametrização de rateio cadastrada para este movimento",
34018
34114
  "erpx.rateio_editor.salvo_com_sucesso_titulo": "Rateio salvo",
34019
- "erpx.rateio_editor.salvo_com_sucesso_detalhe": "A distribuição foi gravada com sucesso"
34115
+ "erpx.rateio_editor.salvo_com_sucesso_detalhe": "A distribuição foi gravada com sucesso",
34116
+ "erpx.rateio_editor.erro_titulo": "Erro",
34117
+ "erpx.rateio_editor.erro_salvar": "Erro ao salvar rateio",
34118
+ "erpx.rateio_editor.erro_contexto_incompleto": "Não foi possível salvar: o contexto do rateio (filial e critério) não foi informado.",
34119
+ "erpx.rateio_editor.erro_sugerir": "Erro ao sugerir rateio",
34120
+ "erpx.rateio_editor.erro_carregar": "Erro ao carregar rateio"
34020
34121
  };
34021
34122
 
34022
34123
  exports.BreadcrumbComponent = BreadcrumbComponent;