@senior-gestao-empresarial/erpx-components 4.20.2 → 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,31 +36772,53 @@
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);
36783
36779
  },
36784
36780
  enumerable: true,
36785
36781
  configurable: true
36786
36782
  });
36787
- Object.defineProperty(ErpRateioEditorComponent.prototype, "numberFormatOptions", {
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;
36795
+ },
36796
+ enumerable: true,
36797
+ configurable: true
36798
+ });
36799
+ Object.defineProperty(ErpRateioEditorComponent.prototype, "numberFormatOptionsCurrency", {
36788
36800
  get: function () {
36789
- var _a, _b;
36790
- if (this.currencyCode) {
36791
- return {
36792
- numberFormatOptions: {
36793
- style: 'currency',
36794
- currency: this.currencyCode
36795
- }
36796
- };
36797
- }
36798
36801
  return {
36799
- numberFormatOptions: {
36802
+ numberFormatOptions: this.currencyCode ? {
36803
+ style: 'currency',
36804
+ currency: this.currencyCode,
36805
+ } : {
36800
36806
  style: 'decimal',
36801
- minimumFractionDigits: (_a = this.config.currencyScale) !== null && _a !== void 0 ? _a : 2,
36802
- maximumFractionDigits: (_b = this.config.currencyScale) !== null && _b !== void 0 ? _b : 2
36807
+ minimumFractionDigits: this.currencyScale,
36808
+ maximumFractionDigits: this.currencyScale,
36809
+ }
36810
+ };
36811
+ },
36812
+ enumerable: true,
36813
+ configurable: true
36814
+ });
36815
+ Object.defineProperty(ErpRateioEditorComponent.prototype, "numberFormatOptionsPercentage", {
36816
+ get: function () {
36817
+ return {
36818
+ numberFormatOptions: {
36819
+ style: 'percent',
36820
+ minimumFractionDigits: this.percentageScale,
36821
+ maximumFractionDigits: this.percentageScale,
36803
36822
  }
36804
36823
  };
36805
36824
  },
@@ -36991,7 +37010,6 @@
36991
37010
  // === MODAL CONTA FINANCEIRA ===
36992
37011
  ErpRateioEditorComponent.prototype.openContaDialog = function (editIndex) {
36993
37012
  var _this = this;
36994
- var _a;
36995
37013
  this.editingContaIndex = editIndex != null ? editIndex : null;
36996
37014
  var remainingPct = this.editingContaIndex != null
36997
37015
  ? this.percentualRestante + this.contasDataSource[this.editingContaIndex].percentual
@@ -36999,7 +37017,7 @@
36999
37017
  // Usa o valor restante real em vez de recalcular via percentual, evitando
37000
37018
  // diferenças de arredondamento acumuladas nas entradas anteriores.
37001
37019
  var remainingValor = this.editingContaIndex != null
37002
- ? +(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)
37003
37021
  : this.valorRestante;
37004
37022
  var contaValue = null;
37005
37023
  var percentualValue = remainingPct > 0 ? remainingPct : null;
@@ -37025,7 +37043,7 @@
37025
37043
  };
37026
37044
  ErpRateioEditorComponent.prototype.onSaveContaDialog = function () {
37027
37045
  var _this = this;
37028
- var _a, _b, _c, _d, _e;
37046
+ var _a, _b, _c;
37029
37047
  if (this.contaDialogFormGroup.invalid) {
37030
37048
  return;
37031
37049
  }
@@ -37033,10 +37051,10 @@
37033
37051
  var data = this.contaDialogFormGroup.getRawValue();
37034
37052
  var contaFinanceira = data.contaFinanceira;
37035
37053
  var percentual = Number(data.percentual) || 0;
37036
- var valor = +(Number(data.valor) || 0).toFixed((_a = this.config.currencyScale) !== null && _a !== void 0 ? _a : 2);
37037
- 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) || '';
37038
37056
  // Validação analítica: conta sintética não pode ser usada no rateio
37039
- 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) {
37040
37058
  contaControl.setErrors({ contaSintetica: true });
37041
37059
  return;
37042
37060
  }
@@ -37052,8 +37070,8 @@
37052
37070
  conta.valorRateadoConta = valor;
37053
37071
  // Recalcula os valores dos CCs proporcionalmente ao novo valor da conta,
37054
37072
  // mantendo os percentuais intactos.
37055
- if ((_d = conta.rateiosCCusto) === null || _d === void 0 ? void 0 : _d.length) {
37056
- 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;
37057
37075
  conta.rateiosCCusto = conta.rateiosCCusto.map(function (cc) { return (__assign(__assign({}, cc), { valor: +((cc.percentual / 100) * valor).toFixed(currencyScale_1) })); });
37058
37076
  }
37059
37077
  this.contasDataSource = __spread(this.contasDataSource);
@@ -37079,7 +37097,6 @@
37079
37097
  // === MODAL CENTRO DE CUSTO ===
37080
37098
  ErpRateioEditorComponent.prototype.openCCDialog = function (contaIndex, editCCIndex) {
37081
37099
  var _this = this;
37082
- var _a, _b;
37083
37100
  this.editingCCContaIndex = contaIndex;
37084
37101
  this.editingCCIndex = editCCIndex != null ? editCCIndex : null;
37085
37102
  var conta = this.contasDataSource[contaIndex];
@@ -37088,8 +37105,8 @@
37088
37105
  // Calcula o restante excluindo o item em edição (para que edição possa manter o próprio valor)
37089
37106
  var somaCCPct = ccList.reduce(function (acc, cc, i) { return acc + (i === _this.editingCCIndex ? 0 : (cc.percentual || 0)); }, 0);
37090
37107
  var somaCCValor = ccList.reduce(function (acc, cc, i) { return acc + (i === _this.editingCCIndex ? 0 : (cc.valor || 0)); }, 0);
37091
- var remainingPct = +(100 - somaCCPct).toFixed((_a = this.config.percentageScale) !== null && _a !== void 0 ? _a : 4);
37092
- 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);
37093
37110
  var ccValue = null;
37094
37111
  var percentualValue = remainingPct > 0 ? remainingPct : null;
37095
37112
  // Usa o valor restante real (já calculado acima) em vez de recalcular via percentual,
@@ -37120,7 +37137,7 @@
37120
37137
  };
37121
37138
  ErpRateioEditorComponent.prototype.onSaveCCDialog = function () {
37122
37139
  var _this = this;
37123
- var _a, _b, _c, _d;
37140
+ var _a, _b, _c;
37124
37141
  if (this.ccDialogFormGroup.invalid) {
37125
37142
  return;
37126
37143
  }
@@ -37128,12 +37145,12 @@
37128
37145
  var data = this.ccDialogFormGroup.getRawValue();
37129
37146
  var centroCusto = data.centroCusto;
37130
37147
  var percentual = Number(data.percentual) || 0;
37131
- 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);
37132
37149
  var conta = this.contasDataSource[this.editingCCContaIndex];
37133
- 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) || '';
37134
37151
  // Validação analítica: CC sintético ou que não aceita rateio é inválido
37135
- var ccInvalido = ((_c = this.selectedCC) === null || _c === void 0 ? void 0 : _c.aceRat) === false
37136
- || ((_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;
37137
37154
  if (ccInvalido) {
37138
37155
  ccControl.setErrors({ centroCustoInvalido: true });
37139
37156
  return;
@@ -37275,7 +37292,6 @@
37275
37292
  };
37276
37293
  /** Restante de % e de valor dos centros de custo de uma conta igual a zero. */
37277
37294
  ErpRateioEditorComponent.prototype.isContaCCCompleta = function (conta) {
37278
- var _a, _b;
37279
37295
  var ccs = conta.rateiosCCusto || [];
37280
37296
  if (ccs.length === 0) {
37281
37297
  // Centro de custo é sempre obrigatório: conta sem nenhum CC nunca é completa.
@@ -37283,13 +37299,12 @@
37283
37299
  }
37284
37300
  var somaPct = ccs.reduce(function (acc, cc) { return acc + (cc.percentual || 0); }, 0);
37285
37301
  var somaValor = ccs.reduce(function (acc, cc) { return acc + (cc.valor || 0); }, 0);
37286
- var pctRestante = +(100 - somaPct).toFixed((_a = this.config.percentageScale) !== null && _a !== void 0 ? _a : 4);
37287
- 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);
37288
37304
  return pctRestante === 0 && valorRestante === 0;
37289
37305
  };
37290
37306
  ErpRateioEditorComponent.prototype.getContaDialogFields = function () {
37291
37307
  var _this = this;
37292
- var _a, _b;
37293
37308
  return [
37294
37309
  new angularComponents$1.FormField(__assign(__assign({}, this.e091PlfLookup.mountOptions({
37295
37310
  multiple: false,
@@ -37307,7 +37322,7 @@
37307
37322
  size: { sm: 12, md: 6, lg: 6, xl: 6 },
37308
37323
  type: angularComponents$1.FieldType.Double,
37309
37324
  precision: 7,
37310
- scale: (_a = this.config.percentageScale) !== null && _a !== void 0 ? _a : 4,
37325
+ scale: this.percentageScale,
37311
37326
  rightAddon: { label: '%' },
37312
37327
  required: function () { return true; }
37313
37328
  }),
@@ -37316,16 +37331,15 @@
37316
37331
  label: this.translate.instant('erpx.rateio_editor.valor'),
37317
37332
  size: { sm: 12, md: 6, lg: 6, xl: 6 },
37318
37333
  type: angularComponents$1.FieldType.Money,
37319
- currenncy: function () { return _this.currencyCode; },
37334
+ currency: function () { return _this.currencyCode; },
37320
37335
  precision: 18,
37321
- scale: (_b = this.config.currencyScale) !== null && _b !== void 0 ? _b : 2,
37336
+ scale: this.currencyScale,
37322
37337
  required: function () { return true; }
37323
37338
  })
37324
37339
  ];
37325
37340
  };
37326
37341
  ErpRateioEditorComponent.prototype.getCCDialogFields = function () {
37327
37342
  var _this = this;
37328
- var _a, _b;
37329
37343
  return [
37330
37344
  new angularComponents$1.FormField(__assign(__assign({}, this.e044CcuLookup.mountOptions({
37331
37345
  multiple: false,
@@ -37343,7 +37357,7 @@
37343
37357
  size: { sm: 12, md: 6, lg: 6, xl: 6 },
37344
37358
  type: angularComponents$1.FieldType.Double,
37345
37359
  precision: 7,
37346
- scale: (_a = this.config.percentageScale) !== null && _a !== void 0 ? _a : 4,
37360
+ scale: this.percentageScale,
37347
37361
  rightAddon: { label: '%' },
37348
37362
  required: function () { return true; }
37349
37363
  }),
@@ -37352,9 +37366,9 @@
37352
37366
  label: this.translate.instant('erpx.rateio_editor.valor'),
37353
37367
  size: { sm: 12, md: 6, lg: 6, xl: 6 },
37354
37368
  type: angularComponents$1.FieldType.Money,
37355
- currenncy: function () { return _this.currencyCode; },
37369
+ currency: function () { return _this.currencyCode; },
37356
37370
  precision: 18,
37357
- scale: (_b = this.config.currencyScale) !== null && _b !== void 0 ? _b : 2,
37371
+ scale: this.currencyScale,
37358
37372
  required: function () { return true; }
37359
37373
  })
37360
37374
  ];
@@ -37366,9 +37380,8 @@
37366
37380
  * O argumento getBase retorna a base usada no cálculo (valorBase global ou valorRateadoConta da conta pai).
37367
37381
  */
37368
37382
  ErpRateioEditorComponent.prototype.setupPercentualValorSync = function (form, getBase) {
37369
- var _a, _b;
37370
- var percentualScale = (_a = this.config.percentageScale) !== null && _a !== void 0 ? _a : 4;
37371
- var currencyScale = (_b = this.config.currencyScale) !== null && _b !== void 0 ? _b : 2;
37383
+ var percentualScale = this.percentageScale;
37384
+ var currencyScale = this.currencyScale;
37372
37385
  form.get('percentual').valueChanges
37373
37386
  .pipe(operators.takeUntil(this.ngUnsubscribe))
37374
37387
  .subscribe(function (pct) {
@@ -37495,7 +37508,7 @@
37495
37508
  ErpRateioEditorComponent = ErpRateioEditorComponent_1 = __decorate([
37496
37509
  core.Component({
37497
37510
  selector: 'erp-rateio-editor',
37498
- 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:numberFormatOptions | 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:numberFormatOptions | 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 }}</td>\n <td style=\"text-align: right\">{{ rowData.valorRateadoConta | numeric:numberFormatOptions | 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 }}</td>\n <td style=\"text-align: right\">{{ cc.valor | numeric:numberFormatOptions | 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",
37499
37512
  styles: [":host ::ng-deep .rateio-cc-toolbar .s-button-text{overflow:visible;-ms-flex-pack:start;justify-content:flex-start}"]
37500
37513
  })
37501
37514
  ], ErpRateioEditorComponent);