@senior-gestao-empresarial/erpx-components 4.9.1 → 4.10.0
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.
- package/bundles/senior-gestao-empresarial-erpx-components.umd.js +201 -42
- package/bundles/senior-gestao-empresarial-erpx-components.umd.js.map +1 -1
- package/bundles/senior-gestao-empresarial-erpx-components.umd.min.js +2 -2
- package/bundles/senior-gestao-empresarial-erpx-components.umd.min.js.map +1 -1
- package/components/rateio-editor/erp-rateio-editor.component.d.ts +55 -3
- package/components/rateio-editor/erp-rateio-editor.types.d.ts +22 -0
- package/components/rateio-editor/index.d.ts +1 -1
- package/esm2015/components/rateio-editor/erp-rateio-editor.component.js +189 -35
- package/esm2015/components/rateio-editor/erp-rateio-editor.types.js +1 -1
- package/esm2015/components/rateio-editor/index.js +1 -1
- package/esm2015/components/tributos/erp-tributos.component.js +9 -9
- package/esm5/components/rateio-editor/erp-rateio-editor.component.js +195 -35
- package/esm5/components/rateio-editor/erp-rateio-editor.types.js +1 -1
- package/esm5/components/rateio-editor/index.js +1 -1
- package/esm5/components/tributos/erp-tributos.component.js +8 -9
- package/fesm2015/senior-gestao-empresarial-erpx-components.js +196 -42
- package/fesm2015/senior-gestao-empresarial-erpx-components.js.map +1 -1
- package/fesm5/senior-gestao-empresarial-erpx-components.js +201 -42
- package/fesm5/senior-gestao-empresarial-erpx-components.js.map +1 -1
- package/package.json +1 -1
- package/senior-gestao-empresarial-erpx-components.metadata.json +1 -1
|
@@ -29918,9 +29918,7 @@
|
|
|
29918
29918
|
tributo === exports.EnumTipoTributo.CBS_ESTORNO_CREDITO ||
|
|
29919
29919
|
tributo === exports.EnumTipoTributo.IBS_ESTORNO_CREDITO ||
|
|
29920
29920
|
tributo === exports.EnumTipoTributo.CBS_AJUSTE ||
|
|
29921
|
-
tributo === exports.EnumTipoTributo.IBS_AJUSTE
|
|
29922
|
-
tributo === exports.EnumTipoTributo.CBS_TRANSFERENCIA_CREDITO ||
|
|
29923
|
-
tributo === exports.EnumTipoTributo.IBS_TRANSFERENCIA_CREDITO)
|
|
29921
|
+
tributo === exports.EnumTipoTributo.IBS_AJUSTE)
|
|
29924
29922
|
defaultFilter = __spread(defaultFilter, [
|
|
29925
29923
|
{
|
|
29926
29924
|
field: 'classificacaoTributaria.indGEstornoCred',
|
|
@@ -29938,13 +29936,14 @@
|
|
|
29938
29936
|
? angularComponents.EnumLogicalOperator.Eq
|
|
29939
29937
|
: angularComponents.EnumLogicalOperator.Ne,
|
|
29940
29938
|
values: [EnumIndicativoPadrao.EXIGE]
|
|
29941
|
-
}
|
|
29939
|
+
}
|
|
29940
|
+
]);
|
|
29941
|
+
if (tributo === exports.EnumTipoTributo.CBS_TRANSFERENCIA_CREDITO ||
|
|
29942
|
+
tributo === exports.EnumTipoTributo.IBS_TRANSFERENCIA_CREDITO)
|
|
29943
|
+
defaultFilter = __spread(defaultFilter, [
|
|
29942
29944
|
{
|
|
29943
29945
|
field: 'indGTransfCred',
|
|
29944
|
-
operator:
|
|
29945
|
-
tributo === exports.EnumTipoTributo.IBS_TRANSFERENCIA_CREDITO
|
|
29946
|
-
? angularComponents.EnumLogicalOperator.Eq
|
|
29947
|
-
: angularComponents.EnumLogicalOperator.Ne,
|
|
29946
|
+
operator: angularComponents.EnumLogicalOperator.Eq,
|
|
29948
29947
|
values: [EnumIndicativoPadrao.EXIGE]
|
|
29949
29948
|
}
|
|
29950
29949
|
]);
|
|
@@ -33387,9 +33386,15 @@
|
|
|
33387
33386
|
this.ButtonSize = angularComponents$1.ButtonSize;
|
|
33388
33387
|
this.loading = false;
|
|
33389
33388
|
this.selection = [];
|
|
33389
|
+
/** Seleção de centros de custo por conta financeira (keyed por idContaFinanceira). */
|
|
33390
|
+
this.ccSelection = {};
|
|
33390
33391
|
this.contasDataSource = [];
|
|
33391
33392
|
this.editingRowBackup = null;
|
|
33392
33393
|
this.editingCCBackup = null;
|
|
33394
|
+
/** Último valor selecionado no lookup de conta (carrega anaSin para validação). */
|
|
33395
|
+
this.selectedConta = null;
|
|
33396
|
+
/** Último valor selecionado no lookup de centro de custo (carrega anaSin/aceRat). */
|
|
33397
|
+
this.selectedCC = null;
|
|
33393
33398
|
// === MODAL CONTA FINANCEIRA ===
|
|
33394
33399
|
this.displayContaDialog = false;
|
|
33395
33400
|
this.editingContaIndex = null;
|
|
@@ -33398,10 +33403,15 @@
|
|
|
33398
33403
|
this.editingCCContaIndex = null;
|
|
33399
33404
|
this.editingCCIndex = null;
|
|
33400
33405
|
this.ngUnsubscribe = new rxjs.Subject();
|
|
33406
|
+
/** Cache de opções de menu por conta (referência estável evita loop de change detection). */
|
|
33407
|
+
this.contaMenuOptionsCache = new Map();
|
|
33408
|
+
/** Cache de opções de menu por centro de custo (referência estável). */
|
|
33409
|
+
this.ccMenuOptionsCache = new Map();
|
|
33401
33410
|
this.formGroup = this.fb.group({
|
|
33402
33411
|
contas: this.fb.array([])
|
|
33403
33412
|
});
|
|
33404
33413
|
}
|
|
33414
|
+
ErpRateioEditorComponent_1 = ErpRateioEditorComponent;
|
|
33405
33415
|
Object.defineProperty(ErpRateioEditorComponent.prototype, "effectiveReadOnly", {
|
|
33406
33416
|
get: function () {
|
|
33407
33417
|
var _a;
|
|
@@ -33526,6 +33536,16 @@
|
|
|
33526
33536
|
if (this.effectiveReadOnly) {
|
|
33527
33537
|
return;
|
|
33528
33538
|
}
|
|
33539
|
+
if (!this.isDistribuicaoCompleta()) {
|
|
33540
|
+
var message = this.translate.instant('erpx.rateio_editor.erro_distribuicao_incompleta');
|
|
33541
|
+
this.messageService.add({
|
|
33542
|
+
severity: 'error',
|
|
33543
|
+
summary: this.translate.instant('erpx.rateio_editor.erro_titulo'),
|
|
33544
|
+
detail: message
|
|
33545
|
+
});
|
|
33546
|
+
this.error.emit({ operacao: 'save', message: message });
|
|
33547
|
+
return;
|
|
33548
|
+
}
|
|
33529
33549
|
var ctx = this.loadedContext;
|
|
33530
33550
|
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
33551
|
var message = this.translate.instant('erpx.rateio_editor.erro_contexto_incompleto');
|
|
@@ -33591,6 +33611,27 @@
|
|
|
33591
33611
|
if (this.idMovimento) {
|
|
33592
33612
|
parametro.idMovimento = this.idMovimento;
|
|
33593
33613
|
}
|
|
33614
|
+
if (this.e091plfId) {
|
|
33615
|
+
parametro.e091plf_id = this.e091plfId;
|
|
33616
|
+
}
|
|
33617
|
+
if (this.e044ccuId) {
|
|
33618
|
+
parametro.e044ccu_id = this.e044ccuId;
|
|
33619
|
+
}
|
|
33620
|
+
if (this.idTransacao) {
|
|
33621
|
+
parametro.idTransacao = this.idTransacao;
|
|
33622
|
+
}
|
|
33623
|
+
if (this.idFamilia) {
|
|
33624
|
+
parametro.idFamilia = this.idFamilia;
|
|
33625
|
+
}
|
|
33626
|
+
if (this.idDerivacao) {
|
|
33627
|
+
parametro.idDerivacao = this.idDerivacao;
|
|
33628
|
+
}
|
|
33629
|
+
if (this.idServico) {
|
|
33630
|
+
parametro.idServico = this.idServico;
|
|
33631
|
+
}
|
|
33632
|
+
if (this.valorExcedente != null) {
|
|
33633
|
+
parametro.valorExcedente = this.valorExcedente;
|
|
33634
|
+
}
|
|
33594
33635
|
var input = {
|
|
33595
33636
|
tipo: this.tipoMovimento,
|
|
33596
33637
|
parametros: [parametro]
|
|
@@ -33629,24 +33670,42 @@
|
|
|
33629
33670
|
percentualValue = conta.percentual;
|
|
33630
33671
|
valorValue = conta.valorRateadoConta;
|
|
33631
33672
|
}
|
|
33673
|
+
this.selectedConta = contaValue;
|
|
33632
33674
|
this.contaDialogFormGroup = this.fb.group({
|
|
33633
33675
|
contaFinanceira: [{ value: contaValue, disabled: this.editingContaIndex != null }, forms.Validators.required],
|
|
33634
33676
|
percentual: [{ value: percentualValue, disabled: false }, forms.Validators.required],
|
|
33635
|
-
valor: [{ value: valorValue, disabled: false }, forms.Validators.required]
|
|
33677
|
+
valor: [{ value: valorValue, disabled: false }, [forms.Validators.required, forms.Validators.max(this.valorBase)]]
|
|
33636
33678
|
});
|
|
33679
|
+
this.contaDialogFormGroup.get('contaFinanceira').valueChanges
|
|
33680
|
+
.pipe(operators.takeUntil(this.ngUnsubscribe))
|
|
33681
|
+
.subscribe(function (value) { return (_this.selectedConta = value || null); });
|
|
33637
33682
|
this.setupPercentualValorSync(this.contaDialogFormGroup, function () { return _this.valorBase; });
|
|
33638
33683
|
this.contaDialogFields = this.getContaDialogFields();
|
|
33639
33684
|
this.displayContaDialog = true;
|
|
33640
33685
|
};
|
|
33641
33686
|
ErpRateioEditorComponent.prototype.onSaveContaDialog = function () {
|
|
33642
|
-
var
|
|
33687
|
+
var _this = this;
|
|
33688
|
+
var _a, _b, _c;
|
|
33643
33689
|
if (this.contaDialogFormGroup.invalid) {
|
|
33644
33690
|
return;
|
|
33645
33691
|
}
|
|
33692
|
+
var contaControl = this.contaDialogFormGroup.get('contaFinanceira');
|
|
33646
33693
|
var data = this.contaDialogFormGroup.getRawValue();
|
|
33647
33694
|
var contaFinanceira = data.contaFinanceira;
|
|
33648
33695
|
var percentual = Number(data.percentual) || 0;
|
|
33649
33696
|
var valor = +(Number(data.valor) || 0).toFixed((_a = this.config.currencyScale) !== null && _a !== void 0 ? _a : 2);
|
|
33697
|
+
var idContaFinanceira = ((_b = this.selectedConta) === null || _b === void 0 ? void 0 : _b.id) || (contaFinanceira === null || contaFinanceira === void 0 ? void 0 : contaFinanceira.id) || '';
|
|
33698
|
+
// Validação analítica: conta sintética não pode ser usada no rateio
|
|
33699
|
+
if (((_c = this.selectedConta) === null || _c === void 0 ? void 0 : _c.anaSin) === ErpRateioEditorComponent_1.ANA_SIN_SINTETICO) {
|
|
33700
|
+
contaControl.setErrors({ contaSintetica: true });
|
|
33701
|
+
return;
|
|
33702
|
+
}
|
|
33703
|
+
// Validação de duplicidade (adição e edição, ignorando o item em edição)
|
|
33704
|
+
var duplicada = this.contasDataSource.some(function (c, i) { return i !== _this.editingContaIndex && c.idContaFinanceira === idContaFinanceira; });
|
|
33705
|
+
if (duplicada) {
|
|
33706
|
+
contaControl.setErrors({ duplicate: true });
|
|
33707
|
+
return;
|
|
33708
|
+
}
|
|
33650
33709
|
if (this.editingContaIndex != null) {
|
|
33651
33710
|
var conta = this.contasDataSource[this.editingContaIndex];
|
|
33652
33711
|
conta.percentual = percentual;
|
|
@@ -33654,22 +33713,16 @@
|
|
|
33654
33713
|
this.contasDataSource = __spread(this.contasDataSource);
|
|
33655
33714
|
}
|
|
33656
33715
|
else {
|
|
33657
|
-
var idContaFinanceira_1 = (contaFinanceira === null || contaFinanceira === void 0 ? void 0 : contaFinanceira.id) || '';
|
|
33658
33716
|
var labelConta = (contaFinanceira === null || contaFinanceira === void 0 ? void 0 : contaFinanceira.label) || '';
|
|
33659
|
-
// Validação extra: bloqueia duplicidade
|
|
33660
|
-
var jaExiste = this.contasDataSource.some(function (c) { return c.idContaFinanceira === idContaFinanceira_1; });
|
|
33661
|
-
if (jaExiste) {
|
|
33662
|
-
this.contaDialogFormGroup.get('contaFinanceira').setErrors({ duplicate: true });
|
|
33663
|
-
return;
|
|
33664
|
-
}
|
|
33665
33717
|
var novaConta = {
|
|
33666
|
-
idContaFinanceira:
|
|
33718
|
+
idContaFinanceira: idContaFinanceira,
|
|
33667
33719
|
contaFinanceira: labelConta,
|
|
33668
33720
|
percentual: percentual,
|
|
33669
33721
|
valorRateadoConta: valor,
|
|
33670
33722
|
rateiosCCusto: []
|
|
33671
33723
|
};
|
|
33672
33724
|
this.contasDataSource = __spread(this.contasDataSource, [novaConta]);
|
|
33725
|
+
this.ccSelection[novaConta.idContaFinanceira] = [];
|
|
33673
33726
|
}
|
|
33674
33727
|
this.displayContaDialog = false;
|
|
33675
33728
|
this.emitChange();
|
|
@@ -33699,41 +33752,54 @@
|
|
|
33699
33752
|
percentualValue = cc.percentual;
|
|
33700
33753
|
valorValue = cc.valor;
|
|
33701
33754
|
}
|
|
33755
|
+
this.selectedCC = ccValue;
|
|
33702
33756
|
this.ccDialogFormGroup = this.fb.group({
|
|
33703
33757
|
centroCusto: [{ value: ccValue, disabled: this.editingCCIndex != null }, forms.Validators.required],
|
|
33704
33758
|
percentual: [{ value: percentualValue, disabled: false }, forms.Validators.required],
|
|
33705
|
-
valor: [{ value: valorValue, disabled: false }, forms.Validators.required]
|
|
33759
|
+
valor: [{ value: valorValue, disabled: false }, [forms.Validators.required, forms.Validators.max(valorBaseCC)]]
|
|
33706
33760
|
});
|
|
33761
|
+
this.ccDialogFormGroup.get('centroCusto').valueChanges
|
|
33762
|
+
.pipe(operators.takeUntil(this.ngUnsubscribe))
|
|
33763
|
+
.subscribe(function (value) { return (_this.selectedCC = value || null); });
|
|
33707
33764
|
this.setupPercentualValorSync(this.ccDialogFormGroup, function () { return valorBaseCC; });
|
|
33708
33765
|
this.ccDialogFields = this.getCCDialogFields();
|
|
33709
33766
|
this.displayCCDialog = true;
|
|
33710
33767
|
};
|
|
33711
33768
|
ErpRateioEditorComponent.prototype.onSaveCCDialog = function () {
|
|
33712
|
-
var
|
|
33769
|
+
var _this = this;
|
|
33770
|
+
var _a, _b, _c, _d;
|
|
33713
33771
|
if (this.ccDialogFormGroup.invalid) {
|
|
33714
33772
|
return;
|
|
33715
33773
|
}
|
|
33774
|
+
var ccControl = this.ccDialogFormGroup.get('centroCusto');
|
|
33716
33775
|
var data = this.ccDialogFormGroup.getRawValue();
|
|
33717
33776
|
var centroCusto = data.centroCusto;
|
|
33718
33777
|
var percentual = Number(data.percentual) || 0;
|
|
33719
33778
|
var valor = +(Number(data.valor) || 0).toFixed((_a = this.config.currencyScale) !== null && _a !== void 0 ? _a : 2);
|
|
33720
33779
|
var conta = this.contasDataSource[this.editingCCContaIndex];
|
|
33780
|
+
var idCentroCusto = ((_b = this.selectedCC) === null || _b === void 0 ? void 0 : _b.id) || (centroCusto === null || centroCusto === void 0 ? void 0 : centroCusto.id) || '';
|
|
33781
|
+
// Validação analítica: CC sintético ou que não aceita rateio é inválido
|
|
33782
|
+
var ccInvalido = ((_c = this.selectedCC) === null || _c === void 0 ? void 0 : _c.aceRat) === false
|
|
33783
|
+
|| ((_d = this.selectedCC) === null || _d === void 0 ? void 0 : _d.anaSin) === ErpRateioEditorComponent_1.ANA_SIN_SINTETICO;
|
|
33784
|
+
if (ccInvalido) {
|
|
33785
|
+
ccControl.setErrors({ centroCustoInvalido: true });
|
|
33786
|
+
return;
|
|
33787
|
+
}
|
|
33788
|
+
// Validação de duplicidade na mesma conta (adição e edição, ignorando o item em edição)
|
|
33789
|
+
var ccList = conta.rateiosCCusto || [];
|
|
33790
|
+
var duplicado = ccList.some(function (cc, i) { return i !== _this.editingCCIndex && cc.idCentroCusto === idCentroCusto; });
|
|
33791
|
+
if (duplicado) {
|
|
33792
|
+
ccControl.setErrors({ duplicate: true });
|
|
33793
|
+
return;
|
|
33794
|
+
}
|
|
33721
33795
|
if (this.editingCCIndex != null) {
|
|
33722
33796
|
var cc = conta.rateiosCCusto[this.editingCCIndex];
|
|
33723
33797
|
cc.percentual = percentual;
|
|
33724
33798
|
cc.valor = valor;
|
|
33725
33799
|
}
|
|
33726
33800
|
else {
|
|
33727
|
-
var idCentroCusto_1 = (centroCusto === null || centroCusto === void 0 ? void 0 : centroCusto.id) || '';
|
|
33728
33801
|
var labelCCusto = (centroCusto === null || centroCusto === void 0 ? void 0 : centroCusto.label) || '';
|
|
33729
|
-
|
|
33730
|
-
var ccList = conta.rateiosCCusto || [];
|
|
33731
|
-
var jaExiste = ccList.some(function (cc) { return cc.idCentroCusto === idCentroCusto_1; });
|
|
33732
|
-
if (jaExiste) {
|
|
33733
|
-
this.ccDialogFormGroup.get('centroCusto').setErrors({ duplicate: true });
|
|
33734
|
-
return;
|
|
33735
|
-
}
|
|
33736
|
-
conta.rateiosCCusto = __spread(ccList, [{ idCentroCusto: idCentroCusto_1, descCCusto: labelCCusto, percentual: percentual, valor: valor }]);
|
|
33802
|
+
conta.rateiosCCusto = __spread(ccList, [{ idCentroCusto: idCentroCusto, descCCusto: labelCCusto, percentual: percentual, valor: valor }]);
|
|
33737
33803
|
}
|
|
33738
33804
|
this.contasDataSource = __spread(this.contasDataSource);
|
|
33739
33805
|
this.displayCCDialog = false;
|
|
@@ -33744,15 +33810,38 @@
|
|
|
33744
33810
|
};
|
|
33745
33811
|
// === AÇÕES DA TABELA ===
|
|
33746
33812
|
ErpRateioEditorComponent.prototype.onDeleteSelected = function () {
|
|
33813
|
+
var _this = this;
|
|
33747
33814
|
if (!this.selection.length) {
|
|
33748
33815
|
return;
|
|
33749
33816
|
}
|
|
33750
33817
|
var idsToRemove = new Set(this.selection.map(function (s) { return s.idContaFinanceira; }));
|
|
33751
33818
|
this.contasDataSource = this.contasDataSource.filter(function (c) { return !idsToRemove.has(c.idContaFinanceira); });
|
|
33819
|
+
idsToRemove.forEach(function (id) { return delete _this.ccSelection[id]; });
|
|
33752
33820
|
this.selection = [];
|
|
33753
33821
|
this.emitChange();
|
|
33754
33822
|
};
|
|
33823
|
+
/** Remove os centros de custo selecionados de uma conta financeira. */
|
|
33824
|
+
ErpRateioEditorComponent.prototype.onDeleteSelectedCC = function (conta) {
|
|
33825
|
+
var selecionados = this.ccSelection[conta.idContaFinanceira] || [];
|
|
33826
|
+
if (!selecionados.length) {
|
|
33827
|
+
this.messageService.add({
|
|
33828
|
+
severity: 'warn',
|
|
33829
|
+
summary: this.translate.instant('erpx.rateio_editor.erro_titulo'),
|
|
33830
|
+
detail: this.translate.instant('erpx.rateio_editor.nenhum_centro_custo_selecionado')
|
|
33831
|
+
});
|
|
33832
|
+
return;
|
|
33833
|
+
}
|
|
33834
|
+
var idsToRemove = new Set(selecionados.map(function (cc) { return cc.idCentroCusto; }));
|
|
33835
|
+
conta.rateiosCCusto = conta.rateiosCCusto.filter(function (cc) { return !idsToRemove.has(cc.idCentroCusto); });
|
|
33836
|
+
this.ccSelection[conta.idContaFinanceira] = [];
|
|
33837
|
+
this.contasDataSource = __spread(this.contasDataSource);
|
|
33838
|
+
this.emitChange();
|
|
33839
|
+
};
|
|
33755
33840
|
ErpRateioEditorComponent.prototype.removerConta = function (index) {
|
|
33841
|
+
var removida = this.contasDataSource[index];
|
|
33842
|
+
if (removida) {
|
|
33843
|
+
delete this.ccSelection[removida.idContaFinanceira];
|
|
33844
|
+
}
|
|
33756
33845
|
this.contasDataSource = this.contasDataSource.filter(function (_, i) { return i !== index; });
|
|
33757
33846
|
this.emitChange();
|
|
33758
33847
|
};
|
|
@@ -33762,24 +33851,40 @@
|
|
|
33762
33851
|
this.contasDataSource = __spread(this.contasDataSource);
|
|
33763
33852
|
this.emitChange();
|
|
33764
33853
|
};
|
|
33765
|
-
ErpRateioEditorComponent.prototype.getMenuOptionsPerRow = function (rowData
|
|
33854
|
+
ErpRateioEditorComponent.prototype.getMenuOptionsPerRow = function (rowData) {
|
|
33766
33855
|
var _this = this;
|
|
33767
|
-
|
|
33768
|
-
|
|
33769
|
-
|
|
33770
|
-
|
|
33771
|
-
|
|
33856
|
+
var id = rowData.idContaFinanceira;
|
|
33857
|
+
var options = this.contaMenuOptionsCache.get(id);
|
|
33858
|
+
if (!options) {
|
|
33859
|
+
options = [
|
|
33860
|
+
{ label: this.translate.instant('erpx.rateio_editor.editar'), command: function () { return _this.openContaDialog(_this.getContaIndex(rowData)); } },
|
|
33861
|
+
{ label: this.translate.instant('erpx.rateio_editor.adicionar_centro_custo'), command: function () { return _this.openCCDialog(_this.getContaIndex(rowData)); } },
|
|
33862
|
+
{ label: this.translate.instant('erpx.rateio_editor.remover_centro_custo'), command: function () { return _this.onDeleteSelectedCC(rowData); } },
|
|
33863
|
+
{ label: this.translate.instant('erpx.rateio_editor.excluir'), command: function () { return _this.removerConta(_this.getContaIndex(rowData)); } }
|
|
33864
|
+
];
|
|
33865
|
+
this.contaMenuOptionsCache.set(id, options);
|
|
33866
|
+
}
|
|
33867
|
+
return options;
|
|
33772
33868
|
};
|
|
33773
|
-
ErpRateioEditorComponent.prototype.getCCMenuOptions = function (
|
|
33869
|
+
ErpRateioEditorComponent.prototype.getCCMenuOptions = function (conta, cc) {
|
|
33774
33870
|
var _this = this;
|
|
33775
|
-
|
|
33776
|
-
|
|
33777
|
-
|
|
33778
|
-
|
|
33871
|
+
var key = conta.idContaFinanceira + "::" + cc.idCentroCusto;
|
|
33872
|
+
var options = this.ccMenuOptionsCache.get(key);
|
|
33873
|
+
if (!options) {
|
|
33874
|
+
options = [
|
|
33875
|
+
{ label: this.translate.instant('erpx.rateio_editor.editar'), command: function () { return _this.openCCDialog(_this.getContaIndex(conta), _this.getCCIndex(conta, cc)); } },
|
|
33876
|
+
{ label: this.translate.instant('erpx.rateio_editor.excluir'), command: function () { return _this.removerCentroCusto(_this.getContaIndex(conta), _this.getCCIndex(conta, cc)); } }
|
|
33877
|
+
];
|
|
33878
|
+
this.ccMenuOptionsCache.set(key, options);
|
|
33879
|
+
}
|
|
33880
|
+
return options;
|
|
33779
33881
|
};
|
|
33780
33882
|
ErpRateioEditorComponent.prototype.getContaIndex = function (rowData) {
|
|
33781
33883
|
return this.contasDataSource.indexOf(rowData);
|
|
33782
33884
|
};
|
|
33885
|
+
ErpRateioEditorComponent.prototype.getCCIndex = function (conta, cc) {
|
|
33886
|
+
return (conta.rateiosCCusto || []).indexOf(cc);
|
|
33887
|
+
};
|
|
33783
33888
|
// === PRIVADOS ===
|
|
33784
33889
|
/** Inicializa o componente a partir dos inputs (sem chamada à API de carga). */
|
|
33785
33890
|
ErpRateioEditorComponent.prototype.inicializarPorInputs = function () {
|
|
@@ -33807,7 +33912,35 @@
|
|
|
33807
33912
|
}, 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 }); });
|
|
33808
33913
|
};
|
|
33809
33914
|
ErpRateioEditorComponent.prototype.popularComRateios = function (rateios) {
|
|
33915
|
+
var _this = this;
|
|
33810
33916
|
this.contasDataSource = __spread(rateios);
|
|
33917
|
+
this.ccSelection = {};
|
|
33918
|
+
this.contaMenuOptionsCache.clear();
|
|
33919
|
+
this.ccMenuOptionsCache.clear();
|
|
33920
|
+
this.contasDataSource.forEach(function (conta) {
|
|
33921
|
+
_this.ccSelection[conta.idContaFinanceira] = [];
|
|
33922
|
+
});
|
|
33923
|
+
};
|
|
33924
|
+
/** Distribuição completa: restantes globais e de cada conta iguais a zero. */
|
|
33925
|
+
ErpRateioEditorComponent.prototype.isDistribuicaoCompleta = function () {
|
|
33926
|
+
var _this = this;
|
|
33927
|
+
if (this.percentualRestante !== 0 || this.valorRestante !== 0) {
|
|
33928
|
+
return false;
|
|
33929
|
+
}
|
|
33930
|
+
return this.contasDataSource.every(function (conta) { return _this.isContaCCCompleta(conta); });
|
|
33931
|
+
};
|
|
33932
|
+
/** Restante de % e de valor dos centros de custo de uma conta igual a zero. */
|
|
33933
|
+
ErpRateioEditorComponent.prototype.isContaCCCompleta = function (conta) {
|
|
33934
|
+
var _a, _b;
|
|
33935
|
+
var ccs = conta.rateiosCCusto || [];
|
|
33936
|
+
if (ccs.length === 0) {
|
|
33937
|
+
return true;
|
|
33938
|
+
}
|
|
33939
|
+
var somaPct = ccs.reduce(function (acc, cc) { return acc + (cc.percentual || 0); }, 0);
|
|
33940
|
+
var somaValor = ccs.reduce(function (acc, cc) { return acc + (cc.valor || 0); }, 0);
|
|
33941
|
+
var pctRestante = +(100 - somaPct).toFixed((_a = this.config.percentageScale) !== null && _a !== void 0 ? _a : 4);
|
|
33942
|
+
var valorRestante = +((conta.valorRateadoConta || 0) - somaValor).toFixed((_b = this.config.currencyScale) !== null && _b !== void 0 ? _b : 2);
|
|
33943
|
+
return pctRestante === 0 && valorRestante === 0;
|
|
33811
33944
|
};
|
|
33812
33945
|
ErpRateioEditorComponent.prototype.getContaDialogFields = function () {
|
|
33813
33946
|
var _this = this;
|
|
@@ -33816,6 +33949,7 @@
|
|
|
33816
33949
|
new angularComponents$1.FormField(__assign(__assign({}, this.e091PlfLookup.mountOptions({
|
|
33817
33950
|
multiple: false,
|
|
33818
33951
|
formGroup: 'contaFinanceira',
|
|
33952
|
+
queryFields: ['anaSin'],
|
|
33819
33953
|
defaultFilter: [
|
|
33820
33954
|
{ field: 'excluido', operator: angularComponents.EnumLogicalOperator.Eq, values: ['false'] },
|
|
33821
33955
|
{ field: 'sitFin', operator: angularComponents.EnumLogicalOperator.Eq, values: ['VA'] },
|
|
@@ -33851,6 +33985,7 @@
|
|
|
33851
33985
|
new angularComponents$1.FormField(__assign(__assign({}, this.e044CcuLookup.mountOptions({
|
|
33852
33986
|
multiple: false,
|
|
33853
33987
|
formGroup: 'centroCusto',
|
|
33988
|
+
queryFields: ['anaSin', 'aceRat'],
|
|
33854
33989
|
defaultFilter: [
|
|
33855
33990
|
{ field: 'excluido', operator: angularComponents.EnumLogicalOperator.Eq, values: ['false'] },
|
|
33856
33991
|
{ field: 'sitCcu', operator: angularComponents.EnumLogicalOperator.Eq, values: ['VA'] },
|
|
@@ -33928,6 +34063,9 @@
|
|
|
33928
34063
|
rateios: this.contasDataSource
|
|
33929
34064
|
});
|
|
33930
34065
|
};
|
|
34066
|
+
var ErpRateioEditorComponent_1;
|
|
34067
|
+
/** Valor de anaSin que indica registro sintético (não analítico). */
|
|
34068
|
+
ErpRateioEditorComponent.ANA_SIN_SINTETICO = 'VS';
|
|
33931
34069
|
ErpRateioEditorComponent.ctorParameters = function () { return [
|
|
33932
34070
|
{ type: forms.FormBuilder },
|
|
33933
34071
|
{ type: ErpRateioEditorService },
|
|
@@ -33969,6 +34107,27 @@
|
|
|
33969
34107
|
__decorate([
|
|
33970
34108
|
core.Input()
|
|
33971
34109
|
], ErpRateioEditorComponent.prototype, "criRat", void 0);
|
|
34110
|
+
__decorate([
|
|
34111
|
+
core.Input()
|
|
34112
|
+
], ErpRateioEditorComponent.prototype, "e091plfId", void 0);
|
|
34113
|
+
__decorate([
|
|
34114
|
+
core.Input()
|
|
34115
|
+
], ErpRateioEditorComponent.prototype, "e044ccuId", void 0);
|
|
34116
|
+
__decorate([
|
|
34117
|
+
core.Input()
|
|
34118
|
+
], ErpRateioEditorComponent.prototype, "idTransacao", void 0);
|
|
34119
|
+
__decorate([
|
|
34120
|
+
core.Input()
|
|
34121
|
+
], ErpRateioEditorComponent.prototype, "idFamilia", void 0);
|
|
34122
|
+
__decorate([
|
|
34123
|
+
core.Input()
|
|
34124
|
+
], ErpRateioEditorComponent.prototype, "idDerivacao", void 0);
|
|
34125
|
+
__decorate([
|
|
34126
|
+
core.Input()
|
|
34127
|
+
], ErpRateioEditorComponent.prototype, "idServico", void 0);
|
|
34128
|
+
__decorate([
|
|
34129
|
+
core.Input()
|
|
34130
|
+
], ErpRateioEditorComponent.prototype, "valorExcedente", void 0);
|
|
33972
34131
|
__decorate([
|
|
33973
34132
|
core.Input()
|
|
33974
34133
|
], ErpRateioEditorComponent.prototype, "currencyCode", void 0);
|
|
@@ -33987,10 +34146,10 @@
|
|
|
33987
34146
|
__decorate([
|
|
33988
34147
|
core.ViewChild('tableRateio')
|
|
33989
34148
|
], ErpRateioEditorComponent.prototype, "table", void 0);
|
|
33990
|
-
ErpRateioEditorComponent = __decorate([
|
|
34149
|
+
ErpRateioEditorComponent = ErpRateioEditorComponent_1 = __decorate([
|
|
33991
34150
|
core.Component({
|
|
33992
34151
|
selector: 'erp-rateio-editor',
|
|
33993
|
-
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]=\"percentualRestante + '%'\"\n ></s-stats-card>\n </div>\n <div class=\"ui-sm-12 ui-md-4\">\n <s-stats-card\n [animateNumbers]=\"true\"\n [color]=\"valorRestante === 0 ? '#0C9348' : '#C13018'\"\n [lightMode]=\"true\"\n [lightVersion]=\"true\"\n iconClass=\"far fa-dollar-sign\"\n [label]=\"'erpx.rateio_editor.valor_restante' | translate\"\n [value]=\"valorRestante | 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 ></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 <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 }}</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\" [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 [label]=\"'erpx.rateio_editor.acoes' | translate\"\n [menuOptions]=\"getMenuOptionsPerRow(rowData, rowIndex)\"\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 <p-table [value]=\"rowData.rateiosCCusto\" [responsive]=\"true\">\n <ng-template pTemplate=\"header\">\n <tr>\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>{{ 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 [label]=\"'erpx.rateio_editor.acoes' | translate\"\n [menuOptions]=\"getCCMenuOptions(getContaIndex(rowData), ccIndex)\"\n ></s-button>\n </td>\n </tr>\n </ng-template>\n <ng-template pTemplate=\"emptymessage\">\n <tr>\n <td [attr.colspan]=\"effectiveReadOnly ? 3 : 4\">\n {{ 'erpx.rateio_editor.sem_centros_custo' | translate }}\n </td>\n </tr>\n </ng-template>\n </p-table>\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 <div *ngIf=\"!effectiveReadOnly && contasDataSource?.length === 0\" style=\"margin-bottom: 8px\">\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 </div>\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 }\"\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 }\"\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"
|
|
34152
|
+
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]=\"percentualRestante + '%'\"\n ></s-stats-card>\n </div>\n <div class=\"ui-sm-12 ui-md-4\">\n <s-stats-card\n [animateNumbers]=\"true\"\n [color]=\"valorRestante === 0 ? '#0C9348' : '#C13018'\"\n [lightMode]=\"true\"\n [lightVersion]=\"true\"\n iconClass=\"far fa-dollar-sign\"\n [label]=\"'erpx.rateio_editor.valor_restante' | translate\"\n [value]=\"valorRestante | 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 ></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 <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 }}</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\" [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 [label]=\"'erpx.rateio_editor.acoes' | translate\"\n [menuOptions]=\"getMenuOptionsPerRow(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 <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 [label]=\"'erpx.rateio_editor.acoes' | translate\"\n [menuOptions]=\"getCCMenuOptions(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 </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 <div *ngIf=\"!effectiveReadOnly && contasDataSource?.length === 0\" style=\"margin-bottom: 8px\">\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 </div>\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_valor_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"
|
|
33994
34153
|
})
|
|
33995
34154
|
], ErpRateioEditorComponent);
|
|
33996
34155
|
return ErpRateioEditorComponent;
|