@senior-gestao-empresarial/erpx-components 4.20.3 → 4.20.4

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.
@@ -36738,18 +36738,16 @@
36738
36738
  });
36739
36739
  Object.defineProperty(ErpRateioEditorComponent.prototype, "percentualRestante", {
36740
36740
  get: function () {
36741
- var _a;
36742
36741
  var soma = this.contasDataSource.reduce(function (acc, conta) { return acc + (conta.percentual || 0); }, 0);
36743
- return +(100 - soma).toFixed((_a = this.config.percentageScale) !== null && _a !== void 0 ? _a : 4);
36742
+ return +(100 - soma).toFixed(this.percentageScale);
36744
36743
  },
36745
36744
  enumerable: true,
36746
36745
  configurable: true
36747
36746
  });
36748
36747
  Object.defineProperty(ErpRateioEditorComponent.prototype, "valorRestante", {
36749
36748
  get: function () {
36750
- var _a;
36751
36749
  var soma = this.contasDataSource.reduce(function (acc, conta) { return acc + (conta.valorRateadoConta || 0); }, 0);
36752
- return +(this.valorBase - soma).toFixed((_a = this.config.currencyScale) !== null && _a !== void 0 ? _a : 2);
36750
+ return +(this.valorBase - soma).toFixed(this.currencyScale);
36753
36751
  },
36754
36752
  enumerable: true,
36755
36753
  configurable: true
@@ -36762,9 +36760,8 @@
36762
36760
  * ponta-a-ponta — centro de custo é sempre obrigatório.
36763
36761
  */
36764
36762
  get: function () {
36765
- var _a;
36766
36763
  var totalCC = this.contasDataSource.reduce(function (acc, conta) { return acc + (conta.rateiosCCusto || []).reduce(function (ccAcc, cc) { return ccAcc + (cc.valor || 0); }, 0); }, 0);
36767
- return +(this.valorBase - totalCC).toFixed((_a = this.config.currencyScale) !== null && _a !== void 0 ? _a : 2);
36764
+ return +(this.valorBase - totalCC).toFixed(this.currencyScale);
36768
36765
  },
36769
36766
  enumerable: true,
36770
36767
  configurable: true
@@ -36775,26 +36772,40 @@
36775
36772
  * Derivado de `valorRestanteDisplay` para manter consistência com o valor.
36776
36773
  */
36777
36774
  get: function () {
36778
- var _a;
36779
36775
  if (!this.valorBase) {
36780
36776
  return 0;
36781
36777
  }
36782
- return +(this.valorRestanteDisplay / this.valorBase * 100).toFixed((_a = this.config.percentageScale) !== null && _a !== void 0 ? _a : 4);
36778
+ return +(this.valorRestanteDisplay / this.valorBase * 100).toFixed(this.percentageScale);
36779
+ },
36780
+ enumerable: true,
36781
+ configurable: true
36782
+ });
36783
+ Object.defineProperty(ErpRateioEditorComponent.prototype, "currencyScale", {
36784
+ get: function () {
36785
+ var _a;
36786
+ return (_a = this.config.currencyScale) !== null && _a !== void 0 ? _a : 2;
36787
+ },
36788
+ enumerable: true,
36789
+ configurable: true
36790
+ });
36791
+ Object.defineProperty(ErpRateioEditorComponent.prototype, "percentageScale", {
36792
+ get: function () {
36793
+ var _a;
36794
+ return (_a = this.config.percentageScale) !== null && _a !== void 0 ? _a : 4;
36783
36795
  },
36784
36796
  enumerable: true,
36785
36797
  configurable: true
36786
36798
  });
36787
36799
  Object.defineProperty(ErpRateioEditorComponent.prototype, "numberFormatOptionsCurrency", {
36788
36800
  get: function () {
36789
- var _a, _b;
36790
36801
  return {
36791
36802
  numberFormatOptions: this.currencyCode ? {
36792
36803
  style: 'currency',
36793
36804
  currency: this.currencyCode,
36794
36805
  } : {
36795
36806
  style: 'decimal',
36796
- minimumFractionDigits: (_a = this.config.currencyScale) !== null && _a !== void 0 ? _a : 2,
36797
- maximumFractionDigits: (_b = this.config.currencyScale) !== null && _b !== void 0 ? _b : 2,
36807
+ minimumFractionDigits: this.currencyScale,
36808
+ maximumFractionDigits: this.currencyScale,
36798
36809
  }
36799
36810
  };
36800
36811
  },
@@ -36803,12 +36814,11 @@
36803
36814
  });
36804
36815
  Object.defineProperty(ErpRateioEditorComponent.prototype, "numberFormatOptionsPercentage", {
36805
36816
  get: function () {
36806
- var _a, _b;
36807
36817
  return {
36808
36818
  numberFormatOptions: {
36809
- style: 'decimal',
36810
- minimumFractionDigits: (_a = this.config.percentageScale) !== null && _a !== void 0 ? _a : 4,
36811
- maximumFractionDigits: (_b = this.config.percentageScale) !== null && _b !== void 0 ? _b : 4,
36819
+ style: 'percent',
36820
+ minimumFractionDigits: this.percentageScale,
36821
+ maximumFractionDigits: this.percentageScale,
36812
36822
  }
36813
36823
  };
36814
36824
  },
@@ -37000,7 +37010,6 @@
37000
37010
  // === MODAL CONTA FINANCEIRA ===
37001
37011
  ErpRateioEditorComponent.prototype.openContaDialog = function (editIndex) {
37002
37012
  var _this = this;
37003
- var _a;
37004
37013
  this.editingContaIndex = editIndex != null ? editIndex : null;
37005
37014
  var remainingPct = this.editingContaIndex != null
37006
37015
  ? this.percentualRestante + this.contasDataSource[this.editingContaIndex].percentual
@@ -37008,7 +37017,7 @@
37008
37017
  // Usa o valor restante real em vez de recalcular via percentual, evitando
37009
37018
  // diferenças de arredondamento acumuladas nas entradas anteriores.
37010
37019
  var remainingValor = this.editingContaIndex != null
37011
- ? +(this.valorRestante + this.contasDataSource[this.editingContaIndex].valorRateadoConta).toFixed((_a = this.config.currencyScale) !== null && _a !== void 0 ? _a : 2)
37020
+ ? +(this.valorRestante + this.contasDataSource[this.editingContaIndex].valorRateadoConta).toFixed(this.currencyScale)
37012
37021
  : this.valorRestante;
37013
37022
  var contaValue = null;
37014
37023
  var percentualValue = remainingPct > 0 ? remainingPct : null;
@@ -37034,7 +37043,7 @@
37034
37043
  };
37035
37044
  ErpRateioEditorComponent.prototype.onSaveContaDialog = function () {
37036
37045
  var _this = this;
37037
- var _a, _b, _c, _d, _e;
37046
+ var _a, _b, _c;
37038
37047
  if (this.contaDialogFormGroup.invalid) {
37039
37048
  return;
37040
37049
  }
@@ -37042,10 +37051,10 @@
37042
37051
  var data = this.contaDialogFormGroup.getRawValue();
37043
37052
  var contaFinanceira = data.contaFinanceira;
37044
37053
  var percentual = Number(data.percentual) || 0;
37045
- var valor = +(Number(data.valor) || 0).toFixed((_a = this.config.currencyScale) !== null && _a !== void 0 ? _a : 2);
37046
- var idContaFinanceira = ((_b = this.selectedConta) === null || _b === void 0 ? void 0 : _b.id) || (contaFinanceira === null || contaFinanceira === void 0 ? void 0 : contaFinanceira.id) || '';
37054
+ var valor = +(Number(data.valor) || 0).toFixed(this.currencyScale);
37055
+ var idContaFinanceira = ((_a = this.selectedConta) === null || _a === void 0 ? void 0 : _a.id) || (contaFinanceira === null || contaFinanceira === void 0 ? void 0 : contaFinanceira.id) || '';
37047
37056
  // Validação analítica: conta sintética não pode ser usada no rateio
37048
- if (((_c = this.selectedConta) === null || _c === void 0 ? void 0 : _c.anaSin) === ErpRateioEditorComponent_1.ANA_SIN_SINTETICO) {
37057
+ if (((_b = this.selectedConta) === null || _b === void 0 ? void 0 : _b.anaSin) === ErpRateioEditorComponent_1.ANA_SIN_SINTETICO) {
37049
37058
  contaControl.setErrors({ contaSintetica: true });
37050
37059
  return;
37051
37060
  }
@@ -37061,8 +37070,8 @@
37061
37070
  conta.valorRateadoConta = valor;
37062
37071
  // Recalcula os valores dos CCs proporcionalmente ao novo valor da conta,
37063
37072
  // mantendo os percentuais intactos.
37064
- if ((_d = conta.rateiosCCusto) === null || _d === void 0 ? void 0 : _d.length) {
37065
- var currencyScale_1 = (_e = this.config.currencyScale) !== null && _e !== void 0 ? _e : 2;
37073
+ if ((_c = conta.rateiosCCusto) === null || _c === void 0 ? void 0 : _c.length) {
37074
+ var currencyScale_1 = this.currencyScale;
37066
37075
  conta.rateiosCCusto = conta.rateiosCCusto.map(function (cc) { return (__assign(__assign({}, cc), { valor: +((cc.percentual / 100) * valor).toFixed(currencyScale_1) })); });
37067
37076
  }
37068
37077
  this.contasDataSource = __spread(this.contasDataSource);
@@ -37088,7 +37097,6 @@
37088
37097
  // === MODAL CENTRO DE CUSTO ===
37089
37098
  ErpRateioEditorComponent.prototype.openCCDialog = function (contaIndex, editCCIndex) {
37090
37099
  var _this = this;
37091
- var _a, _b;
37092
37100
  this.editingCCContaIndex = contaIndex;
37093
37101
  this.editingCCIndex = editCCIndex != null ? editCCIndex : null;
37094
37102
  var conta = this.contasDataSource[contaIndex];
@@ -37097,8 +37105,8 @@
37097
37105
  // Calcula o restante excluindo o item em edição (para que edição possa manter o próprio valor)
37098
37106
  var somaCCPct = ccList.reduce(function (acc, cc, i) { return acc + (i === _this.editingCCIndex ? 0 : (cc.percentual || 0)); }, 0);
37099
37107
  var somaCCValor = ccList.reduce(function (acc, cc, i) { return acc + (i === _this.editingCCIndex ? 0 : (cc.valor || 0)); }, 0);
37100
- var remainingPct = +(100 - somaCCPct).toFixed((_a = this.config.percentageScale) !== null && _a !== void 0 ? _a : 4);
37101
- var remainingValor = +(valorBaseCC - somaCCValor).toFixed((_b = this.config.currencyScale) !== null && _b !== void 0 ? _b : 2);
37108
+ var remainingPct = +(100 - somaCCPct).toFixed(this.percentageScale);
37109
+ var remainingValor = +(valorBaseCC - somaCCValor).toFixed(this.currencyScale);
37102
37110
  var ccValue = null;
37103
37111
  var percentualValue = remainingPct > 0 ? remainingPct : null;
37104
37112
  // Usa o valor restante real (já calculado acima) em vez de recalcular via percentual,
@@ -37129,7 +37137,7 @@
37129
37137
  };
37130
37138
  ErpRateioEditorComponent.prototype.onSaveCCDialog = function () {
37131
37139
  var _this = this;
37132
- var _a, _b, _c, _d;
37140
+ var _a, _b, _c;
37133
37141
  if (this.ccDialogFormGroup.invalid) {
37134
37142
  return;
37135
37143
  }
@@ -37137,12 +37145,12 @@
37137
37145
  var data = this.ccDialogFormGroup.getRawValue();
37138
37146
  var centroCusto = data.centroCusto;
37139
37147
  var percentual = Number(data.percentual) || 0;
37140
- var valor = +(Number(data.valor) || 0).toFixed((_a = this.config.currencyScale) !== null && _a !== void 0 ? _a : 2);
37148
+ var valor = +(Number(data.valor) || 0).toFixed(this.currencyScale);
37141
37149
  var conta = this.contasDataSource[this.editingCCContaIndex];
37142
- var idCentroCusto = ((_b = this.selectedCC) === null || _b === void 0 ? void 0 : _b.id) || (centroCusto === null || centroCusto === void 0 ? void 0 : centroCusto.id) || '';
37150
+ var idCentroCusto = ((_a = this.selectedCC) === null || _a === void 0 ? void 0 : _a.id) || (centroCusto === null || centroCusto === void 0 ? void 0 : centroCusto.id) || '';
37143
37151
  // Validação analítica: CC sintético ou que não aceita rateio é inválido
37144
- var ccInvalido = ((_c = this.selectedCC) === null || _c === void 0 ? void 0 : _c.aceRat) === false
37145
- || ((_d = this.selectedCC) === null || _d === void 0 ? void 0 : _d.anaSin) === ErpRateioEditorComponent_1.ANA_SIN_SINTETICO;
37152
+ var ccInvalido = ((_b = this.selectedCC) === null || _b === void 0 ? void 0 : _b.aceRat) === false
37153
+ || ((_c = this.selectedCC) === null || _c === void 0 ? void 0 : _c.anaSin) === ErpRateioEditorComponent_1.ANA_SIN_SINTETICO;
37146
37154
  if (ccInvalido) {
37147
37155
  ccControl.setErrors({ centroCustoInvalido: true });
37148
37156
  return;
@@ -37284,7 +37292,6 @@
37284
37292
  };
37285
37293
  /** Restante de % e de valor dos centros de custo de uma conta igual a zero. */
37286
37294
  ErpRateioEditorComponent.prototype.isContaCCCompleta = function (conta) {
37287
- var _a, _b;
37288
37295
  var ccs = conta.rateiosCCusto || [];
37289
37296
  if (ccs.length === 0) {
37290
37297
  // Centro de custo é sempre obrigatório: conta sem nenhum CC nunca é completa.
@@ -37292,13 +37299,12 @@
37292
37299
  }
37293
37300
  var somaPct = ccs.reduce(function (acc, cc) { return acc + (cc.percentual || 0); }, 0);
37294
37301
  var somaValor = ccs.reduce(function (acc, cc) { return acc + (cc.valor || 0); }, 0);
37295
- var pctRestante = +(100 - somaPct).toFixed((_a = this.config.percentageScale) !== null && _a !== void 0 ? _a : 4);
37296
- var valorRestante = +((conta.valorRateadoConta || 0) - somaValor).toFixed((_b = this.config.currencyScale) !== null && _b !== void 0 ? _b : 2);
37302
+ var pctRestante = +(100 - somaPct).toFixed(this.percentageScale);
37303
+ var valorRestante = +((conta.valorRateadoConta || 0) - somaValor).toFixed(this.currencyScale);
37297
37304
  return pctRestante === 0 && valorRestante === 0;
37298
37305
  };
37299
37306
  ErpRateioEditorComponent.prototype.getContaDialogFields = function () {
37300
37307
  var _this = this;
37301
- var _a, _b;
37302
37308
  return [
37303
37309
  new angularComponents$1.FormField(__assign(__assign({}, this.e091PlfLookup.mountOptions({
37304
37310
  multiple: false,
@@ -37316,7 +37322,7 @@
37316
37322
  size: { sm: 12, md: 6, lg: 6, xl: 6 },
37317
37323
  type: angularComponents$1.FieldType.Double,
37318
37324
  precision: 7,
37319
- scale: (_a = this.config.percentageScale) !== null && _a !== void 0 ? _a : 4,
37325
+ scale: this.percentageScale,
37320
37326
  rightAddon: { label: '%' },
37321
37327
  required: function () { return true; }
37322
37328
  }),
@@ -37327,14 +37333,13 @@
37327
37333
  type: angularComponents$1.FieldType.Money,
37328
37334
  currency: function () { return _this.currencyCode; },
37329
37335
  precision: 18,
37330
- scale: (_b = this.config.currencyScale) !== null && _b !== void 0 ? _b : 2,
37336
+ scale: this.currencyScale,
37331
37337
  required: function () { return true; }
37332
37338
  })
37333
37339
  ];
37334
37340
  };
37335
37341
  ErpRateioEditorComponent.prototype.getCCDialogFields = function () {
37336
37342
  var _this = this;
37337
- var _a, _b;
37338
37343
  return [
37339
37344
  new angularComponents$1.FormField(__assign(__assign({}, this.e044CcuLookup.mountOptions({
37340
37345
  multiple: false,
@@ -37352,7 +37357,7 @@
37352
37357
  size: { sm: 12, md: 6, lg: 6, xl: 6 },
37353
37358
  type: angularComponents$1.FieldType.Double,
37354
37359
  precision: 7,
37355
- scale: (_a = this.config.percentageScale) !== null && _a !== void 0 ? _a : 4,
37360
+ scale: this.percentageScale,
37356
37361
  rightAddon: { label: '%' },
37357
37362
  required: function () { return true; }
37358
37363
  }),
@@ -37363,7 +37368,7 @@
37363
37368
  type: angularComponents$1.FieldType.Money,
37364
37369
  currency: function () { return _this.currencyCode; },
37365
37370
  precision: 18,
37366
- scale: (_b = this.config.currencyScale) !== null && _b !== void 0 ? _b : 2,
37371
+ scale: this.currencyScale,
37367
37372
  required: function () { return true; }
37368
37373
  })
37369
37374
  ];
@@ -37375,9 +37380,8 @@
37375
37380
  * O argumento getBase retorna a base usada no cálculo (valorBase global ou valorRateadoConta da conta pai).
37376
37381
  */
37377
37382
  ErpRateioEditorComponent.prototype.setupPercentualValorSync = function (form, getBase) {
37378
- var _a, _b;
37379
- var percentualScale = (_a = this.config.percentageScale) !== null && _a !== void 0 ? _a : 4;
37380
- var currencyScale = (_b = this.config.currencyScale) !== null && _b !== void 0 ? _b : 2;
37383
+ var percentualScale = this.percentageScale;
37384
+ var currencyScale = this.currencyScale;
37381
37385
  form.get('percentual').valueChanges
37382
37386
  .pipe(operators.takeUntil(this.ngUnsubscribe))
37383
37387
  .subscribe(function (pct) {
@@ -37504,7 +37508,7 @@
37504
37508
  ErpRateioEditorComponent = ErpRateioEditorComponent_1 = __decorate([
37505
37509
  core.Component({
37506
37510
  selector: 'erp-rateio-editor',
37507
- template: "<s-loading-state [loading]=\"loading\" [blockWindow]=\"true\">\n <!-- Se\u00E7\u00E3o 1: Informa\u00E7\u00F5es do movimento -->\n <div class=\"sds-section-title\" *ngIf=\"isReady\">\n {{ 'erpx.rateio_editor.titulo' | translate }}\n </div>\n\n <div class=\"ui-g custom-stats\" *ngIf=\"isReady\">\n <div class=\"ui-sm-12 ui-md-4\">\n <s-stats-card\n [animateNumbers]=\"true\"\n color=\"#0C9348\"\n [lightMode]=\"true\"\n [lightVersion]=\"true\"\n iconClass=\"far fa-dollar-sign\"\n [label]=\"'erpx.rateio_editor.valor_base' | translate\"\n [value]=\"valorBase | numeric:numberFormatOptionsCurrency | async\"\n ></s-stats-card>\n </div>\n <div class=\"ui-sm-12 ui-md-4\">\n <s-stats-card\n [animateNumbers]=\"true\"\n color=\"#428BCA\"\n [lightMode]=\"true\"\n [lightVersion]=\"true\"\n iconClass=\"far fa-percent\"\n [label]=\"'erpx.rateio_editor.percentual_restante' | translate\"\n [value]=\"percentualRestanteDisplay + '%'\"\n ></s-stats-card>\n </div>\n <div class=\"ui-sm-12 ui-md-4\">\n <s-stats-card\n [animateNumbers]=\"true\"\n [color]=\"distribuicaoCompleta ? '#0C9348' : '#C13018'\"\n [lightMode]=\"true\"\n [lightVersion]=\"true\"\n iconClass=\"far fa-dollar-sign\"\n [label]=\"'erpx.rateio_editor.valor_restante' | translate\"\n [value]=\"valorRestanteDisplay | numeric:numberFormatOptionsCurrency | async\"\n ></s-stats-card>\n </div>\n </div>\n\n <!-- Se\u00E7\u00E3o 2: Tabela de rateios -->\n <div class=\"sds-section-title\" *ngIf=\"isReady\">\n {{ 'erpx.rateio_editor.lista_rateios' | translate }}\n </div>\n\n <s-empty-state\n *ngIf=\"isReady && contasDataSource?.length === 0\"\n iconClass=\"far fa-dollar-sign\"\n [title]=\"'erpx.rateio_editor.sem_rateios_titulo' | translate\"\n [description]=\"'erpx.rateio_editor.sem_rateios_descricao' | translate\"\n [showPrimaryAction]=\"!effectiveReadOnly\"\n [primaryActionLabel]=\"'erpx.rateio_editor.adicionar_conta' | translate\"\n (primaryAction)=\"openContaDialog()\"\n [showSecondaryAction]=\"!effectiveReadOnly && showSugestaoButton\"\n [secondaryActionLabel]=\"'erpx.rateio_editor.sugerir_rateio' | translate\"\n (secondaryAction)=\"onSugerir()\"\n ></s-empty-state>\n\n <div class=\"ui-g\" *ngIf=\"isReady && contasDataSource?.length > 0\">\n <div class=\"ui-g-12\" *ngIf=\"!effectiveReadOnly\">\n <s-button\n [label]=\"'erpx.rateio_editor.adicionar_conta' | translate\"\n iconClass=\"fa fa-plus\"\n (onClick)=\"openContaDialog()\"\n ></s-button>\n <s-button\n *ngIf=\"showSugestaoButton\"\n [label]=\"'erpx.rateio_editor.sugerir_rateio' | translate\"\n [priority]=\"ButtonPriority.Secondary\"\n iconClass=\"fa fa-magic\"\n (onClick)=\"onSugerir()\"\n ></s-button>\n <s-button\n [label]=\"'erpx.rateio_editor.remover_conta' | translate\"\n [priority]=\"ButtonPriority.Secondary\"\n (onClick)=\"onDeleteSelected()\"\n [disabled]=\"!selection.length\"\n ></s-button>\n </div>\n\n <div class=\"ui-g-12\">\n <p-table\n #tableRateio\n [value]=\"contasDataSource\"\n [columns]=\"gridColumns\"\n dataKey=\"idContaFinanceira\"\n [resizableColumns]=\"true\"\n [totalRecords]=\"contasDataSource.length\"\n [(selection)]=\"selection\"\n [paginator]=\"false\"\n [rows]=\"10\"\n >\n <ng-template pTemplate=\"header\" let-columns>\n <tr>\n <th scope=\"col\" style=\"width: 3em\"></th>\n <th scope=\"col\" class=\"col-checkbox\" style=\"width: 50px\">\n <p-tableHeaderCheckbox *ngIf=\"!effectiveReadOnly\"></p-tableHeaderCheckbox>\n </th>\n <th *ngFor=\"let col of columns\" scope=\"col\" pResizableColumn>\n <div class=\"senior-header\">\n <span class=\"senior-header-title\">{{ col.header | translate }}</span>\n </div>\n </th>\n <th scope=\"col\" *ngIf=\"!effectiveReadOnly\">\n <div class=\"senior-header\">\n <span class=\"senior-header-title\">{{ 'erpx.rateio_editor.acoes' | translate }}</span>\n </div>\n </th>\n </tr>\n </ng-template>\n\n <ng-template pTemplate=\"body\" let-rowData let-rowIndex=\"rowIndex\" let-expanded=\"expanded\">\n <tr>\n <td style=\"width: 3em; text-align: center\">\n <a *ngIf=\"rowData.rateiosCCusto?.length || !effectiveReadOnly\" [pRowToggler]=\"rowData\" role=\"button\" tabindex=\"0\">\n <i [class]=\"expanded ? 'fa fa-minus' : 'fa fa-plus'\"></i>\n </a>\n </td>\n <td class=\"col-checkbox\" style=\"width: 50px\">\n <p-tableCheckbox *ngIf=\"!effectiveReadOnly\" [value]=\"rowData\"></p-tableCheckbox>\n </td>\n <td>{{ rowData.contaFinanceira || rowData.idContaFinanceira }}</td>\n <td style=\"text-align: right\">{{ rowData.percentual | numeric:numberFormatOptionsPercentage | async }}</td>\n <td style=\"text-align: right\">{{ rowData.valorRateadoConta | numeric:numberFormatOptionsCurrency | async }}</td>\n <td *ngIf=\"!effectiveReadOnly\">\n <s-button\n [auxiliary]=\"true\"\n [priority]=\"ButtonPriority.Default\"\n [size]=\"ButtonSize.Small\"\n iconClass=\"fa fa-pencil\"\n [label]=\"'erpx.rateio_editor.editar' | translate\"\n (onClick)=\"openContaDialog(getContaIndex(rowData))\"\n ></s-button>\n </td>\n </tr>\n </ng-template>\n\n <ng-template pTemplate=\"rowexpansion\" let-rowData let-rowIndex=\"rowIndex\">\n <tr>\n <td [attr.colspan]=\"effectiveReadOnly ? gridColumns.length + 2 : gridColumns.length + 3\">\n <div class=\"ui-g\" style=\"padding: 8px 16px\">\n <div class=\"ui-g-12 rateio-cc-toolbar\" *ngIf=\"!effectiveReadOnly\">\n <s-button\n [label]=\"'erpx.rateio_editor.adicionar_centro_custo' | translate\"\n iconClass=\"fa fa-plus\"\n (onClick)=\"openCCDialog(getContaIndex(rowData))\"\n ></s-button>\n <s-button\n [label]=\"'erpx.rateio_editor.remover_centro_custo' | translate\"\n [priority]=\"ButtonPriority.Secondary\"\n (onClick)=\"onDeleteSelectedCC(rowData)\"\n [disabled]=\"!(ccSelection[rowData.idContaFinanceira]?.length)\"\n ></s-button>\n </div>\n <div class=\"ui-g-12\">\n <p-table\n [value]=\"rowData.rateiosCCusto\"\n dataKey=\"idCentroCusto\"\n [(selection)]=\"ccSelection[rowData.idContaFinanceira]\"\n [responsive]=\"true\"\n >\n <ng-template pTemplate=\"header\">\n <tr>\n <th scope=\"col\" class=\"col-checkbox\" style=\"width: 50px\">\n <p-tableHeaderCheckbox *ngIf=\"!effectiveReadOnly\"></p-tableHeaderCheckbox>\n </th>\n <th scope=\"col\">{{ 'erpx.rateio_editor.centro_custo' | translate }}</th>\n <th scope=\"col\">{{ 'erpx.rateio_editor.percentual' | translate }}</th>\n <th scope=\"col\">{{ 'erpx.rateio_editor.valor' | translate }}</th>\n <th scope=\"col\" *ngIf=\"!effectiveReadOnly\">{{ 'erpx.rateio_editor.acoes' | translate }}</th>\n </tr>\n </ng-template>\n <ng-template pTemplate=\"body\" let-cc let-ccIndex=\"rowIndex\">\n <tr>\n <td class=\"col-checkbox\" style=\"width: 50px\">\n <p-tableCheckbox *ngIf=\"!effectiveReadOnly\" [value]=\"cc\"></p-tableCheckbox>\n </td>\n <td>{{ cc.descCCusto || cc.idCentroCusto }}</td>\n <td style=\"text-align: right\">{{ cc.percentual | numeric:numberFormatOptionsPercentage | async }}</td>\n <td style=\"text-align: right\">{{ cc.valor | numeric:numberFormatOptionsCurrency | async }}</td>\n <td *ngIf=\"!effectiveReadOnly\">\n <s-button\n [auxiliary]=\"true\"\n [priority]=\"ButtonPriority.Default\"\n [size]=\"ButtonSize.Small\"\n iconClass=\"fa fa-pencil\"\n [label]=\"'erpx.rateio_editor.editar' | translate\"\n (onClick)=\"openCCDialog(getContaIndex(rowData), getCCIndex(rowData, cc))\"\n ></s-button>\n </td>\n </tr>\n </ng-template>\n <ng-template pTemplate=\"emptymessage\">\n <tr>\n <td [attr.colspan]=\"effectiveReadOnly ? 3 : 5\">\n {{ 'erpx.rateio_editor.sem_centros_custo' | translate }}\n </td>\n </tr>\n </ng-template>\n </p-table>\n </div>\n </div>\n </td>\n </tr>\n </ng-template>\n </p-table>\n </div>\n </div>\n\n <!-- Bot\u00F5es de a\u00E7\u00E3o -->\n <div *ngIf=\"isReady\" class=\"ui-g rateio-editor-actions\">\n <div class=\"ui-g-12\">\n <s-button\n *ngIf=\"!effectiveReadOnly && !isStandalone\"\n priority=\"primary\"\n iconClass=\"fa fa-check\"\n [label]=\"'erpx.rateio_editor.salvar' | translate\"\n (onClick)=\"onSalvar()\"\n ></s-button>\n </div>\n </div>\n</s-loading-state>\n\n<!-- Modal: Adicionar/Editar Conta Financeira -->\n<p-dialog\n [header]=\"'erpx.rateio_editor.adicionar_conta' | translate\"\n appendTo=\"body\"\n [modal]=\"true\"\n [(visible)]=\"displayContaDialog\"\n (onHide)=\"onHideContaDialog()\"\n [blockScroll]=\"true\"\n [focusOnShow]=\"false\"\n styleClass=\"custom-dialog\"\n [draggable]=\"false\"\n [resizable]=\"false\"\n [style]=\"{width: '40%'}\"\n>\n <form *ngIf=\"contaDialogFormGroup\" [formGroup]=\"contaDialogFormGroup\" (ngSubmit)=\"onSaveContaDialog()\">\n <div class=\"ui-fluid\">\n <s-dynamic-form\n [fields]=\"contaDialogFields\"\n [form]=\"contaDialogFormGroup\"\n [errorMessages]=\"{\n required: ('erpx.rateio_editor.erro_obrigatorio' | translate),\n duplicate: ('erpx.rateio_editor.conta_duplicada' | translate),\n contaSintetica: ('erpx.rateio_editor.erro_conta_sintetica' | translate),\n max: ('erpx.rateio_editor.erro_valor_maximo_conta' | translate)\n }\"\n ></s-dynamic-form>\n </div>\n </form>\n <p-footer>\n <s-button\n id=\"dialog-conta-save\"\n type=\"button\"\n priority=\"primary\"\n [label]=\"'erpx.rateio_editor.salvar' | translate\"\n (onClick)=\"onSaveContaDialog()\"\n ></s-button>\n <s-button\n id=\"dialog-conta-cancel\"\n type=\"button\"\n priority=\"secondary\"\n [label]=\"'erpx.rateio_editor.cancelar' | translate\"\n (onClick)=\"onHideContaDialog()\"\n ></s-button>\n </p-footer>\n</p-dialog>\n\n<!-- Modal: Adicionar/Editar Centro de Custo -->\n<p-dialog\n [header]=\"'erpx.rateio_editor.adicionar_centro_custo' | translate\"\n appendTo=\"body\"\n [modal]=\"true\"\n [(visible)]=\"displayCCDialog\"\n (onHide)=\"onHideCCDialog()\"\n [blockScroll]=\"true\"\n [focusOnShow]=\"false\"\n styleClass=\"custom-dialog\"\n [draggable]=\"false\"\n [resizable]=\"false\"\n [style]=\"{width: '40%'}\"\n>\n <form *ngIf=\"ccDialogFormGroup\" [formGroup]=\"ccDialogFormGroup\" (ngSubmit)=\"onSaveCCDialog()\">\n <div class=\"ui-fluid\">\n <s-dynamic-form\n [fields]=\"ccDialogFields\"\n [form]=\"ccDialogFormGroup\"\n [errorMessages]=\"{\n required: ('erpx.rateio_editor.erro_obrigatorio' | translate),\n duplicate: ('erpx.rateio_editor.centro_custo_duplicado' | translate),\n centroCustoInvalido: ('erpx.rateio_editor.erro_centro_custo_invalido' | translate),\n max: ('erpx.rateio_editor.erro_maximo_centro_custo' | translate)\n }\"\n ></s-dynamic-form>\n </div>\n </form>\n <p-footer>\n <s-button\n id=\"dialog-cc-save\"\n type=\"button\"\n priority=\"primary\"\n [label]=\"'erpx.rateio_editor.salvar' | translate\"\n (onClick)=\"onSaveCCDialog()\"\n ></s-button>\n <s-button\n id=\"dialog-cc-cancel\"\n type=\"button\"\n priority=\"secondary\"\n [label]=\"'erpx.rateio_editor.cancelar' | translate\"\n (onClick)=\"onHideCCDialog()\"\n ></s-button>\n </p-footer>\n</p-dialog>\n",
37511
+ template: "<s-loading-state [loading]=\"loading\" [blockWindow]=\"true\">\n <!-- Se\u00E7\u00E3o 1: Informa\u00E7\u00F5es do movimento -->\n <div class=\"sds-section-title\" *ngIf=\"isReady\">\n {{ 'erpx.rateio_editor.titulo' | translate }}\n </div>\n\n <div class=\"ui-g custom-stats\" *ngIf=\"isReady\">\n <div class=\"ui-sm-12 ui-md-4\">\n <s-stats-card\n [animateNumbers]=\"true\"\n color=\"#0C9348\"\n [lightMode]=\"true\"\n [lightVersion]=\"true\"\n iconClass=\"far fa-dollar-sign\"\n [label]=\"'erpx.rateio_editor.valor_base' | translate\"\n [value]=\"valorBase | numeric:numberFormatOptionsCurrency | async\"\n ></s-stats-card>\n </div>\n <div class=\"ui-sm-12 ui-md-4\">\n <s-stats-card\n [animateNumbers]=\"true\"\n color=\"#428BCA\"\n [lightMode]=\"true\"\n [lightVersion]=\"true\"\n iconClass=\"far fa-percent\"\n [label]=\"'erpx.rateio_editor.percentual_restante' | translate\"\n [value]=\"percentualRestanteDisplay * 0.01 | numeric:numberFormatOptionsPercentage | async\"\n ></s-stats-card>\n </div>\n <div class=\"ui-sm-12 ui-md-4\">\n <s-stats-card\n [animateNumbers]=\"true\"\n [color]=\"distribuicaoCompleta ? '#0C9348' : '#C13018'\"\n [lightMode]=\"true\"\n [lightVersion]=\"true\"\n iconClass=\"far fa-dollar-sign\"\n [label]=\"'erpx.rateio_editor.valor_restante' | translate\"\n [value]=\"valorRestanteDisplay | numeric:numberFormatOptionsCurrency | async\"\n ></s-stats-card>\n </div>\n </div>\n\n <!-- Se\u00E7\u00E3o 2: Tabela de rateios -->\n <div class=\"sds-section-title\" *ngIf=\"isReady\">\n {{ 'erpx.rateio_editor.lista_rateios' | translate }}\n </div>\n\n <s-empty-state\n *ngIf=\"isReady && contasDataSource?.length === 0\"\n iconClass=\"far fa-dollar-sign\"\n [title]=\"'erpx.rateio_editor.sem_rateios_titulo' | translate\"\n [description]=\"'erpx.rateio_editor.sem_rateios_descricao' | translate\"\n [showPrimaryAction]=\"!effectiveReadOnly\"\n [primaryActionLabel]=\"'erpx.rateio_editor.adicionar_conta' | translate\"\n (primaryAction)=\"openContaDialog()\"\n [showSecondaryAction]=\"!effectiveReadOnly && showSugestaoButton\"\n [secondaryActionLabel]=\"'erpx.rateio_editor.sugerir_rateio' | translate\"\n (secondaryAction)=\"onSugerir()\"\n ></s-empty-state>\n\n <div class=\"ui-g\" *ngIf=\"isReady && contasDataSource?.length > 0\">\n <div class=\"ui-g-12\" *ngIf=\"!effectiveReadOnly\">\n <s-button\n [label]=\"'erpx.rateio_editor.adicionar_conta' | translate\"\n iconClass=\"fa fa-plus\"\n (onClick)=\"openContaDialog()\"\n ></s-button>\n <s-button\n *ngIf=\"showSugestaoButton\"\n [label]=\"'erpx.rateio_editor.sugerir_rateio' | translate\"\n [priority]=\"ButtonPriority.Secondary\"\n iconClass=\"fa fa-magic\"\n (onClick)=\"onSugerir()\"\n ></s-button>\n <s-button\n [label]=\"'erpx.rateio_editor.remover_conta' | translate\"\n [priority]=\"ButtonPriority.Secondary\"\n (onClick)=\"onDeleteSelected()\"\n [disabled]=\"!selection.length\"\n ></s-button>\n </div>\n\n <div class=\"ui-g-12\">\n <p-table\n #tableRateio\n [value]=\"contasDataSource\"\n [columns]=\"gridColumns\"\n dataKey=\"idContaFinanceira\"\n [resizableColumns]=\"true\"\n [totalRecords]=\"contasDataSource.length\"\n [(selection)]=\"selection\"\n [paginator]=\"false\"\n [rows]=\"10\"\n >\n <ng-template pTemplate=\"header\" let-columns>\n <tr>\n <th scope=\"col\" style=\"width: 3em\"></th>\n <th scope=\"col\" class=\"col-checkbox\" style=\"width: 50px\">\n <p-tableHeaderCheckbox *ngIf=\"!effectiveReadOnly\"></p-tableHeaderCheckbox>\n </th>\n <th *ngFor=\"let col of columns\" scope=\"col\" pResizableColumn>\n <div class=\"senior-header\">\n <span class=\"senior-header-title\">{{ col.header | translate }}</span>\n </div>\n </th>\n <th scope=\"col\" *ngIf=\"!effectiveReadOnly\">\n <div class=\"senior-header\">\n <span class=\"senior-header-title\">{{ 'erpx.rateio_editor.acoes' | translate }}</span>\n </div>\n </th>\n </tr>\n </ng-template>\n\n <ng-template pTemplate=\"body\" let-rowData let-rowIndex=\"rowIndex\" let-expanded=\"expanded\">\n <tr>\n <td style=\"width: 3em; text-align: center\">\n <a *ngIf=\"rowData.rateiosCCusto?.length || !effectiveReadOnly\" [pRowToggler]=\"rowData\" role=\"button\" tabindex=\"0\">\n <i [class]=\"expanded ? 'fa fa-minus' : 'fa fa-plus'\"></i>\n </a>\n </td>\n <td class=\"col-checkbox\" style=\"width: 50px\">\n <p-tableCheckbox *ngIf=\"!effectiveReadOnly\" [value]=\"rowData\"></p-tableCheckbox>\n </td>\n <td>{{ rowData.contaFinanceira || rowData.idContaFinanceira }}</td>\n <td style=\"text-align: right\">{{ rowData.percentual * 0.01 | numeric:numberFormatOptionsPercentage | async }}</td>\n <td style=\"text-align: right\">{{ rowData.valorRateadoConta | numeric:numberFormatOptionsCurrency | async }}</td>\n <td *ngIf=\"!effectiveReadOnly\">\n <s-button\n [auxiliary]=\"true\"\n [priority]=\"ButtonPriority.Default\"\n [size]=\"ButtonSize.Small\"\n iconClass=\"fa fa-pencil\"\n [label]=\"'erpx.rateio_editor.editar' | translate\"\n (onClick)=\"openContaDialog(getContaIndex(rowData))\"\n ></s-button>\n </td>\n </tr>\n </ng-template>\n\n <ng-template pTemplate=\"rowexpansion\" let-rowData let-rowIndex=\"rowIndex\">\n <tr>\n <td [attr.colspan]=\"effectiveReadOnly ? gridColumns.length + 2 : gridColumns.length + 3\">\n <div class=\"ui-g\" style=\"padding: 8px 16px\">\n <div class=\"ui-g-12 rateio-cc-toolbar\" *ngIf=\"!effectiveReadOnly\">\n <s-button\n [label]=\"'erpx.rateio_editor.adicionar_centro_custo' | translate\"\n iconClass=\"fa fa-plus\"\n (onClick)=\"openCCDialog(getContaIndex(rowData))\"\n ></s-button>\n <s-button\n [label]=\"'erpx.rateio_editor.remover_centro_custo' | translate\"\n [priority]=\"ButtonPriority.Secondary\"\n (onClick)=\"onDeleteSelectedCC(rowData)\"\n [disabled]=\"!(ccSelection[rowData.idContaFinanceira]?.length)\"\n ></s-button>\n </div>\n <div class=\"ui-g-12\">\n <p-table\n [value]=\"rowData.rateiosCCusto\"\n dataKey=\"idCentroCusto\"\n [(selection)]=\"ccSelection[rowData.idContaFinanceira]\"\n [responsive]=\"true\"\n >\n <ng-template pTemplate=\"header\">\n <tr>\n <th scope=\"col\" class=\"col-checkbox\" style=\"width: 50px\">\n <p-tableHeaderCheckbox *ngIf=\"!effectiveReadOnly\"></p-tableHeaderCheckbox>\n </th>\n <th scope=\"col\">{{ 'erpx.rateio_editor.centro_custo' | translate }}</th>\n <th scope=\"col\">{{ 'erpx.rateio_editor.percentual' | translate }}</th>\n <th scope=\"col\">{{ 'erpx.rateio_editor.valor' | translate }}</th>\n <th scope=\"col\" *ngIf=\"!effectiveReadOnly\">{{ 'erpx.rateio_editor.acoes' | translate }}</th>\n </tr>\n </ng-template>\n <ng-template pTemplate=\"body\" let-cc let-ccIndex=\"rowIndex\">\n <tr>\n <td class=\"col-checkbox\" style=\"width: 50px\">\n <p-tableCheckbox *ngIf=\"!effectiveReadOnly\" [value]=\"cc\"></p-tableCheckbox>\n </td>\n <td>{{ cc.descCCusto || cc.idCentroCusto }}</td>\n <td style=\"text-align: right\">{{ cc.percentual * 0.01 | numeric:numberFormatOptionsPercentage | async }}</td>\n <td style=\"text-align: right\">{{ cc.valor | numeric:numberFormatOptionsCurrency | async }}</td>\n <td *ngIf=\"!effectiveReadOnly\">\n <s-button\n [auxiliary]=\"true\"\n [priority]=\"ButtonPriority.Default\"\n [size]=\"ButtonSize.Small\"\n iconClass=\"fa fa-pencil\"\n [label]=\"'erpx.rateio_editor.editar' | translate\"\n (onClick)=\"openCCDialog(getContaIndex(rowData), getCCIndex(rowData, cc))\"\n ></s-button>\n </td>\n </tr>\n </ng-template>\n <ng-template pTemplate=\"emptymessage\">\n <tr>\n <td [attr.colspan]=\"effectiveReadOnly ? 3 : 5\">\n {{ 'erpx.rateio_editor.sem_centros_custo' | translate }}\n </td>\n </tr>\n </ng-template>\n </p-table>\n </div>\n </div>\n </td>\n </tr>\n </ng-template>\n </p-table>\n </div>\n </div>\n\n <!-- Bot\u00F5es de a\u00E7\u00E3o -->\n <div *ngIf=\"isReady\" class=\"ui-g rateio-editor-actions\">\n <div class=\"ui-g-12\">\n <s-button\n *ngIf=\"!effectiveReadOnly && !isStandalone\"\n priority=\"primary\"\n iconClass=\"fa fa-check\"\n [label]=\"'erpx.rateio_editor.salvar' | translate\"\n (onClick)=\"onSalvar()\"\n ></s-button>\n </div>\n </div>\n</s-loading-state>\n\n<!-- Modal: Adicionar/Editar Conta Financeira -->\n<p-dialog\n [header]=\"'erpx.rateio_editor.adicionar_conta' | translate\"\n appendTo=\"body\"\n [modal]=\"true\"\n [(visible)]=\"displayContaDialog\"\n (onHide)=\"onHideContaDialog()\"\n [blockScroll]=\"true\"\n [focusOnShow]=\"false\"\n styleClass=\"custom-dialog\"\n [draggable]=\"false\"\n [resizable]=\"false\"\n [style]=\"{width: '40%'}\"\n>\n <form *ngIf=\"contaDialogFormGroup\" [formGroup]=\"contaDialogFormGroup\" (ngSubmit)=\"onSaveContaDialog()\">\n <div class=\"ui-fluid\">\n <s-dynamic-form\n [fields]=\"contaDialogFields\"\n [form]=\"contaDialogFormGroup\"\n [errorMessages]=\"{\n required: ('erpx.rateio_editor.erro_obrigatorio' | translate),\n duplicate: ('erpx.rateio_editor.conta_duplicada' | translate),\n contaSintetica: ('erpx.rateio_editor.erro_conta_sintetica' | translate),\n max: ('erpx.rateio_editor.erro_valor_maximo_conta' | translate)\n }\"\n ></s-dynamic-form>\n </div>\n </form>\n <p-footer>\n <s-button\n id=\"dialog-conta-save\"\n type=\"button\"\n priority=\"primary\"\n [label]=\"'erpx.rateio_editor.salvar' | translate\"\n (onClick)=\"onSaveContaDialog()\"\n ></s-button>\n <s-button\n id=\"dialog-conta-cancel\"\n type=\"button\"\n priority=\"secondary\"\n [label]=\"'erpx.rateio_editor.cancelar' | translate\"\n (onClick)=\"onHideContaDialog()\"\n ></s-button>\n </p-footer>\n</p-dialog>\n\n<!-- Modal: Adicionar/Editar Centro de Custo -->\n<p-dialog\n [header]=\"'erpx.rateio_editor.adicionar_centro_custo' | translate\"\n appendTo=\"body\"\n [modal]=\"true\"\n [(visible)]=\"displayCCDialog\"\n (onHide)=\"onHideCCDialog()\"\n [blockScroll]=\"true\"\n [focusOnShow]=\"false\"\n styleClass=\"custom-dialog\"\n [draggable]=\"false\"\n [resizable]=\"false\"\n [style]=\"{width: '40%'}\"\n>\n <form *ngIf=\"ccDialogFormGroup\" [formGroup]=\"ccDialogFormGroup\" (ngSubmit)=\"onSaveCCDialog()\">\n <div class=\"ui-fluid\">\n <s-dynamic-form\n [fields]=\"ccDialogFields\"\n [form]=\"ccDialogFormGroup\"\n [errorMessages]=\"{\n required: ('erpx.rateio_editor.erro_obrigatorio' | translate),\n duplicate: ('erpx.rateio_editor.centro_custo_duplicado' | translate),\n centroCustoInvalido: ('erpx.rateio_editor.erro_centro_custo_invalido' | translate),\n max: ('erpx.rateio_editor.erro_maximo_centro_custo' | translate)\n }\"\n ></s-dynamic-form>\n </div>\n </form>\n <p-footer>\n <s-button\n id=\"dialog-cc-save\"\n type=\"button\"\n priority=\"primary\"\n [label]=\"'erpx.rateio_editor.salvar' | translate\"\n (onClick)=\"onSaveCCDialog()\"\n ></s-button>\n <s-button\n id=\"dialog-cc-cancel\"\n type=\"button\"\n priority=\"secondary\"\n [label]=\"'erpx.rateio_editor.cancelar' | translate\"\n (onClick)=\"onHideCCDialog()\"\n ></s-button>\n </p-footer>\n</p-dialog>\n",
37508
37512
  styles: [":host ::ng-deep .rateio-cc-toolbar .s-button-text{overflow:visible;-ms-flex-pack:start;justify-content:flex-start}"]
37509
37513
  })
37510
37514
  ], ErpRateioEditorComponent);