@credithub/harlan-components 1.16.2 → 1.16.3
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/lib/cjs/index.js +128 -122
- package/lib/esm/components/scr/getResumoDeCreditos.d.ts +1 -4
- package/lib/esm/components/scr/getResumoDeCreditos.js +33 -45
- package/lib/esm/components/scr/getResumoDeModalidades.js +78 -62
- package/lib/esm/components/scr/scr.d.ts +1 -1
- package/lib/esm/components/scr/scr.js +28 -26
- package/lib/esm/components/scr/types.d.ts +5 -4
- package/package.json +1 -1
package/lib/cjs/index.js
CHANGED
|
@@ -64804,7 +64804,11 @@ var __spreadArray$2 = (undefined && undefined.__spreadArray) || function (to, fr
|
|
|
64804
64804
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
64805
64805
|
};
|
|
64806
64806
|
var agruparPorCategoriaDeVencimento = function (detalhamento) {
|
|
64807
|
-
|
|
64807
|
+
if (!Array.isArray(detalhamento) || detalhamento.length === 0) {
|
|
64808
|
+
return { avencer: [], vencido: [] };
|
|
64809
|
+
}
|
|
64810
|
+
var flatVencimentos = detalhamento.flatMap(function (item) { return item.vencimentos || []; });
|
|
64811
|
+
var _a = groupBy(flatVencimentos, function (_a) {
|
|
64808
64812
|
var categoria = _a.categoria;
|
|
64809
64813
|
return categoria;
|
|
64810
64814
|
}), _b = _a.avencer, avencer = _b === void 0 ? [] : _b, _c = _a.vencido, vencido = _c === void 0 ? [] : _c;
|
|
@@ -64820,67 +64824,51 @@ var agruparPorDescricao = function (_a) {
|
|
|
64820
64824
|
vencido: groupBy(vencido, function (_a) {
|
|
64821
64825
|
var descricao = _a.descricao;
|
|
64822
64826
|
return descricao;
|
|
64823
|
-
})
|
|
64827
|
+
}),
|
|
64824
64828
|
});
|
|
64825
64829
|
};
|
|
64826
64830
|
var adicionarCreditosADescricao = function (description, valor) {
|
|
64827
64831
|
var isAvencerVencido = /(A Vencer|Vencido)$/i.test(description.trim());
|
|
64828
|
-
return
|
|
64829
|
-
!isAvencerVencido
|
|
64832
|
+
return {
|
|
64833
|
+
descricao: !isAvencerVencido
|
|
64830
64834
|
? "Cr\u00E9ditos ".concat(description.toLowerCase())
|
|
64831
64835
|
: description,
|
|
64832
|
-
valor ? formatMoney(valor) :
|
|
64833
|
-
|
|
64836
|
+
valor: valor ? formatMoney(valor) : "",
|
|
64837
|
+
};
|
|
64834
64838
|
};
|
|
64835
64839
|
var somarDadosAgrupadosPorDescricao = function (_a) {
|
|
64836
64840
|
var avencer = _a.avencer, vencido = _a.vencido;
|
|
64837
|
-
|
|
64838
|
-
|
|
64841
|
+
var avencerEntries = avencer ? Object.entries(avencer) : [];
|
|
64842
|
+
var vencidoEntries = vencido ? Object.entries(vencido) : [];
|
|
64843
|
+
return {
|
|
64844
|
+
avencer: avencerEntries.map(function (_a) {
|
|
64839
64845
|
var descricao = _a[0], values = _a[1];
|
|
64840
|
-
return ({
|
|
64841
|
-
descricao: descricao,
|
|
64842
|
-
valor: values.reduce(function (a, b) { return a + Number(b.valor); }, 0)
|
|
64843
|
-
});
|
|
64844
|
-
}).filter(function (_a) {
|
|
64845
|
-
var descricao = _a.descricao;
|
|
64846
|
-
return !/Limite/.test(descricao.trim());
|
|
64847
|
-
})
|
|
64848
|
-
.map(function (_a) {
|
|
64849
|
-
var descricao = _a.descricao, valor = _a.valor;
|
|
64850
|
-
return adicionarCreditosADescricao(descricao, valor);
|
|
64846
|
+
return adicionarCreditosADescricao(descricao, values.map(function (v) { return Number(v.valor); }).reduce(function (a, b) { return a + b; }, 0));
|
|
64851
64847
|
}),
|
|
64852
|
-
vencido:
|
|
64848
|
+
vencido: vencidoEntries.map(function (_a) {
|
|
64853
64849
|
var descricao = _a[0], values = _a[1];
|
|
64854
|
-
return ({
|
|
64855
|
-
descricao: descricao,
|
|
64856
|
-
valor: values.reduce(function (a, b) { return a + Number(b.valor); }, 0)
|
|
64857
|
-
});
|
|
64858
|
-
}).filter(function (_a) {
|
|
64859
|
-
var descricao = _a.descricao;
|
|
64860
|
-
return !/Limite/.test(descricao.trim());
|
|
64861
|
-
})
|
|
64862
|
-
.map(function (_a) {
|
|
64863
|
-
var descricao = _a.descricao, valor = _a.valor;
|
|
64864
|
-
return adicionarCreditosADescricao(descricao, valor);
|
|
64850
|
+
return adicionarCreditosADescricao(descricao, values.map(function (v) { return Number(v.valor); }).reduce(function (a, b) { return a + b; }, 0));
|
|
64865
64851
|
}),
|
|
64866
|
-
}
|
|
64852
|
+
};
|
|
64867
64853
|
};
|
|
64868
|
-
var getVencidosEAvencer = compose
|
|
64869
|
-
agruparPorCategoriaDeVencimento,
|
|
64870
|
-
agruparPorDescricao,
|
|
64871
|
-
somarDadosAgrupadosPorDescricao
|
|
64872
|
-
].reverse());
|
|
64854
|
+
var getVencidosEAvencer = compose(agruparPorCategoriaDeVencimento, agruparPorDescricao, somarDadosAgrupadosPorDescricao);
|
|
64873
64855
|
var getResumoDeCreditos = function (scr) {
|
|
64874
|
-
var _a, _b, _c
|
|
64875
|
-
|
|
64856
|
+
var _a, _b, _c;
|
|
64857
|
+
if (!((_a = scr === null || scr === void 0 ? void 0 : scr.analise) === null || _a === void 0 ? void 0 : _a.detalhamento)) {
|
|
64858
|
+
return [];
|
|
64859
|
+
}
|
|
64860
|
+
var _d = getVencidosEAvencer(scr.analise.detalhamento), avencer = _d.avencer, vencido = _d.vencido;
|
|
64876
64861
|
return __spreadArray$2(__spreadArray$2(__spreadArray$2([
|
|
64877
|
-
|
|
64862
|
+
{
|
|
64863
|
+
descricao: "A Vencer",
|
|
64864
|
+
valor: formatMoney(((_b = scr.analise.total) === null || _b === void 0 ? void 0 : _b.aVencer) || 0),
|
|
64865
|
+
}
|
|
64878
64866
|
], avencer, true), [
|
|
64879
|
-
|
|
64880
|
-
|
|
64881
|
-
|
|
64882
|
-
|
|
64883
|
-
|
|
64867
|
+
{
|
|
64868
|
+
descricao: "Vencido",
|
|
64869
|
+
valor: formatMoney(((_c = scr.analise.total) === null || _c === void 0 ? void 0 : _c.vencido) || 0),
|
|
64870
|
+
}
|
|
64871
|
+
], false), vencido, true);
|
|
64884
64872
|
};
|
|
64885
64873
|
|
|
64886
64874
|
var __spreadArray$1 = (undefined && undefined.__spreadArray) || function (to, from, pack) {
|
|
@@ -64893,85 +64881,101 @@ var __spreadArray$1 = (undefined && undefined.__spreadArray) || function (to, fr
|
|
|
64893
64881
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
64894
64882
|
};
|
|
64895
64883
|
function getResumoDeModalidades(scr) {
|
|
64896
|
-
var _a;
|
|
64897
|
-
|
|
64898
|
-
|
|
64899
|
-
|
|
64900
|
-
|
|
64901
|
-
|
|
64902
|
-
|
|
64903
|
-
|
|
64904
|
-
|
|
64905
|
-
|
|
64906
|
-
|
|
64907
|
-
|
|
64908
|
-
|
|
64909
|
-
|
|
64910
|
-
|
|
64911
|
-
|
|
64912
|
-
|
|
64913
|
-
|
|
64914
|
-
|
|
64915
|
-
|
|
64916
|
-
|
|
64917
|
-
|
|
64918
|
-
|
|
64919
|
-
|
|
64920
|
-
|
|
64884
|
+
var _a, _b;
|
|
64885
|
+
if (!((_a = scr === null || scr === void 0 ? void 0 : scr.analise) === null || _a === void 0 ? void 0 : _a.detalhamento)) {
|
|
64886
|
+
return [];
|
|
64887
|
+
}
|
|
64888
|
+
var agruparPorTitulo = function (detalhamento) {
|
|
64889
|
+
return groupBy(detalhamento, function (_a) {
|
|
64890
|
+
var modalidade = _a.modalidade;
|
|
64891
|
+
return (modalidade === null || modalidade === void 0 ? void 0 : modalidade.titulo) || "Indefinido";
|
|
64892
|
+
});
|
|
64893
|
+
};
|
|
64894
|
+
var agruparPorTituloESubtitulo = function (detalhamento) {
|
|
64895
|
+
return Object.fromEntries(Object.entries(detalhamento).map(function (_a) {
|
|
64896
|
+
var key = _a[0], values = _a[1];
|
|
64897
|
+
return [
|
|
64898
|
+
key,
|
|
64899
|
+
Object.entries(groupBy(values, function (_a) {
|
|
64900
|
+
var modalidade = _a.modalidade;
|
|
64901
|
+
return modalidade.subtitulo;
|
|
64902
|
+
})).map(function (_a) {
|
|
64903
|
+
var _b;
|
|
64904
|
+
var subtitulo = _a[0], detalhes = _a[1];
|
|
64905
|
+
return ({
|
|
64906
|
+
subtitulo: subtitulo,
|
|
64907
|
+
variacaoCambial: (_b = detalhes.find(function (e) { return e.variacaoCambial; })) === null || _b === void 0 ? void 0 : _b.variacaoCambial,
|
|
64908
|
+
valor: detalhes
|
|
64909
|
+
.map(function (detalhe) { return detalhe.vencimentos; })
|
|
64910
|
+
.flat()
|
|
64911
|
+
.reduce(function (a, b) { return a + Number(b.valor); }, 0),
|
|
64912
|
+
vencimentos: detalhes.map(function (detalhe) { return detalhe.vencimentos; }).flat(),
|
|
64913
|
+
});
|
|
64914
|
+
}),
|
|
64915
|
+
];
|
|
64916
|
+
}));
|
|
64917
|
+
};
|
|
64918
|
+
var getModalidades = compose(agruparPorTitulo, agruparPorTituloESubtitulo);
|
|
64921
64919
|
var modalidades = getModalidades(scr.analise.detalhamento);
|
|
64922
|
-
var resumoDeOperacoes = (
|
|
64920
|
+
var resumoDeOperacoes = ((_b = scr.listaDeResumoDasOperacoes) === null || _b === void 0 ? void 0 : _b.filter(function (_a) {
|
|
64923
64921
|
var modalidade = _a.modalidade;
|
|
64924
64922
|
return /^(19)/.test(modalidade);
|
|
64925
|
-
});
|
|
64923
|
+
})) || [];
|
|
64926
64924
|
var COD_LIMIT = {
|
|
64927
|
-
1901:
|
|
64928
|
-
1902:
|
|
64929
|
-
1903:
|
|
64930
|
-
1904:
|
|
64931
|
-
1905:
|
|
64932
|
-
1906:
|
|
64933
|
-
1907:
|
|
64934
|
-
1908:
|
|
64935
|
-
1909:
|
|
64936
|
-
1910:
|
|
64937
|
-
1999:
|
|
64925
|
+
1901: "Limite global",
|
|
64926
|
+
1902: "Cheque especial",
|
|
64927
|
+
1903: "Conta garantida",
|
|
64928
|
+
1904: "Cartão de Crédito",
|
|
64929
|
+
1905: "Capital de giro",
|
|
64930
|
+
1906: "Crédito pessoal",
|
|
64931
|
+
1907: "Vendor",
|
|
64932
|
+
1908: "Compror",
|
|
64933
|
+
1909: "Descontos",
|
|
64934
|
+
1910: "Aquisição de bens",
|
|
64935
|
+
1999: "Outros",
|
|
64938
64936
|
};
|
|
64939
|
-
var limite = resumoDeOperacoes.
|
|
64940
|
-
var
|
|
64937
|
+
var limite = resumoDeOperacoes.flatMap(function (_a) {
|
|
64938
|
+
var _b;
|
|
64939
|
+
var modalidade = _a.modalidade, listaDeVencimentos = _a.listaDeVencimentos, variacaoCambial = _a.variacaoCambial;
|
|
64941
64940
|
var sumSalaries = sum(listaDeVencimentos.map(function (e) { return Number(e.valorVencimento); }));
|
|
64942
|
-
return modalidades.Limite.filter(function (r) { return sumSalaries === r.valor; })
|
|
64943
|
-
.map(function (r) {
|
|
64941
|
+
return (((_b = modalidades.Limite) === null || _b === void 0 ? void 0 : _b.filter(function (r) { return sumSalaries === r.valor; }).map(function (r) {
|
|
64944
64942
|
var _a;
|
|
64945
64943
|
return ({
|
|
64946
|
-
subtitulo: r.subtitulo
|
|
64944
|
+
subtitulo: r.subtitulo || COD_LIMIT[modalidade] || "Indefinido",
|
|
64947
64945
|
vencimentos: r.vencimentos,
|
|
64948
64946
|
variacaoCambial: (_a = r.variacaoCambial) !== null && _a !== void 0 ? _a : variacaoCambial,
|
|
64949
64947
|
valor: r.valor,
|
|
64950
64948
|
});
|
|
64951
|
-
});
|
|
64952
|
-
})
|
|
64949
|
+
})) || []);
|
|
64950
|
+
});
|
|
64953
64951
|
modalidades.Limite = limite;
|
|
64954
|
-
var sumVencimentos = function (vencimentos, tipo) {
|
|
64955
|
-
|
|
64956
|
-
|
|
64952
|
+
var sumVencimentos = function (vencimentos, tipo) {
|
|
64953
|
+
return sum(vencimentos
|
|
64954
|
+
.filter(function (e) { return (e === null || e === void 0 ? void 0 : e.categoria) === tipo; })
|
|
64955
|
+
.map(function (e) { return Number(e.valor); }));
|
|
64956
|
+
};
|
|
64957
|
+
return Object.entries(modalidades).flatMap(function (_a) {
|
|
64957
64958
|
var _b;
|
|
64958
64959
|
var modalidade = _a[0], subcategorias = _a[1];
|
|
64959
|
-
return __spreadArray$1([
|
|
64960
|
-
|
|
64961
|
-
|
|
64962
|
-
|
|
64963
|
-
|
|
64964
|
-
|
|
64960
|
+
return __spreadArray$1([
|
|
64961
|
+
{
|
|
64962
|
+
modalidade: "".concat(modalidade, " (Cambial: ").concat(((_b = subcategorias[0]) === null || _b === void 0 ? void 0 : _b.variacaoCambial) || "Não", ")"),
|
|
64963
|
+
vencido: sumVencimentos(subcategorias.flatMap(function (s) { return s.vencimentos; }), "vencido"),
|
|
64964
|
+
aVencer: sumVencimentos(subcategorias.flatMap(function (s) { return s.vencimentos; }), "avencer"),
|
|
64965
|
+
valor: sum(subcategorias.map(function (s) { return s.valor; })),
|
|
64966
|
+
}
|
|
64967
|
+
], subcategorias.flatMap(function (subcategoria) { return __spreadArray$1([
|
|
64968
|
+
{
|
|
64965
64969
|
modalidade: subcategoria.subtitulo,
|
|
64966
64970
|
valor: subcategoria.valor,
|
|
64967
|
-
}
|
|
64968
|
-
|
|
64969
|
-
|
|
64970
|
-
|
|
64971
|
-
|
|
64972
|
-
|
|
64973
|
-
}), true); })
|
|
64974
|
-
})
|
|
64971
|
+
}
|
|
64972
|
+
], subcategoria.vencimentos.map(function (vencimento) { return ({
|
|
64973
|
+
modalidade: !/^Limite/.test(modalidade)
|
|
64974
|
+
? "Cr\u00E9ditos ".concat(vencimento.descricao.toLowerCase())
|
|
64975
|
+
: vencimento.descricao,
|
|
64976
|
+
valor: vencimento.valor,
|
|
64977
|
+
}); }), true); }), true);
|
|
64978
|
+
});
|
|
64975
64979
|
}
|
|
64976
64980
|
|
|
64977
64981
|
var ScrIcon = function (_a) {
|
|
@@ -65018,19 +65022,23 @@ function ConsultaSCR(_a) {
|
|
|
65018
65022
|
(_a = scrRef.current) === null || _a === void 0 ? void 0 : _a.scrollIntoView();
|
|
65019
65023
|
}, [consultaSCRRealizada]);
|
|
65020
65024
|
React.useEffect(function () {
|
|
65021
|
-
response && setConsultasComplementares
|
|
65025
|
+
if (response && setConsultasComplementares) {
|
|
65026
|
+
setConsultasComplementares(function (prev) { return (__assign$4(__assign$4({}, prev), { scr: __assign$4(__assign$4({}, prev.scr), { data: response }) })); });
|
|
65027
|
+
}
|
|
65022
65028
|
}, [response]);
|
|
65023
65029
|
return consultaSCRRealizada ? (React.createElement(React.Fragment, null,
|
|
65024
65030
|
React.createElement(ResumoDoCliente, { scrRef: scrRef, isLoading: isLoading, scr: scr, error: error }),
|
|
65025
|
-
!error
|
|
65031
|
+
!error && (React.createElement(React.Fragment, null,
|
|
65026
65032
|
React.createElement(FluxosDeVencimentosConsolidados, { isLoading: isLoading, scr: scr, error: error }),
|
|
65027
|
-
React.createElement(ResumoList, { title: "SCR",
|
|
65028
|
-
|
|
65033
|
+
React.createElement(ResumoList, { title: "SCR",
|
|
65034
|
+
subtitle: "Crédito",
|
|
65035
|
+
resumos: resumoDeCreditos, isLoading: isLoading, error: error }),
|
|
65036
|
+
React.createElement(ResumoModalidades, { isLoading: isLoading, scr: scr, error: error }))))) : null;
|
|
65029
65037
|
}
|
|
65030
65038
|
var ResumoDoCliente = function (_a) {
|
|
65031
65039
|
var scr = _a.scr, scrRef = _a.scrRef, isLoading = _a.isLoading, error = _a.error;
|
|
65032
65040
|
return (React.createElement("div", null,
|
|
65033
|
-
React.createElement(Header$1, { innerRef: scrRef, title:
|
|
65041
|
+
React.createElement(Header$1, { innerRef: scrRef, title: "SCR", variant: isLoading ? "loading" : error ? "error" : "default", subtitle: "Resumo do Cliente", description: error ? (React.createElement(StatusMessage, { type: "error" }, error.message)) : null, icon: ScrIcon }),
|
|
65034
65042
|
scr && !isLoading && (React.createElement(Result, null,
|
|
65035
65043
|
React.createElement(ResultContent, { desktop: "repeat(4, 1fr)", tablet: "repeat(3, 1fr)", mobile: "1fr 1fr" },
|
|
65036
65044
|
React.createElement(AddItemField, { name: "CNPJ da IF Solicitante", value: scr === null || scr === void 0 ? void 0 : scr.cnpjDaIFSolicitante }),
|
|
@@ -65042,7 +65050,7 @@ var FluxosDeVencimentosConsolidados = function (_a) {
|
|
|
65042
65050
|
var _b;
|
|
65043
65051
|
var scr = _a.scr, isLoading = _a.isLoading, error = _a.error;
|
|
65044
65052
|
return (React.createElement("div", null,
|
|
65045
|
-
React.createElement(Header$1, { title:
|
|
65053
|
+
React.createElement(Header$1, { title: "SCR", subtitle: "Fluxo De Vencimentos Consolidados", variant: isLoading ? "loading" : error ? "error" : "default", icon: ScrIcon }),
|
|
65046
65054
|
scr && !isLoading && (React.createElement(Result, null,
|
|
65047
65055
|
React.createElement(ResultContent, { desktop: "repeat(4, 1fr)", tablet: "repeat(3, 1fr)", mobile: "1fr 1fr" },
|
|
65048
65056
|
React.createElement(AddItemField, { name: "Data-base", value: scr.dataBaseConsultada }),
|
|
@@ -65055,25 +65063,23 @@ var FluxosDeVencimentosConsolidados = function (_a) {
|
|
|
65055
65063
|
React.createElement(AddItemField, { name: "Opera\u00E7\u00F5es com manifesta\u00E7\u00E3o de discord\u00E2ncia", value: scr.responsabilidadeTotalDiscordancia }),
|
|
65056
65064
|
React.createElement(AddItemField, { name: "Opera\u00E7\u00F5es amparadas por sub-judice", value: scr.responsabilidadeTotalSubJudice }),
|
|
65057
65065
|
React.createElement(AddItemField, { name: "Risco indireto fornecedor", value: scr.riscoIndiretoVendor }),
|
|
65058
|
-
React.createElement(AddItemField, { name: "Data de in\u00EDcio do relacionamento com a IF", value: scr.dataInicioRelacionamento &&
|
|
65066
|
+
React.createElement(AddItemField, { name: "Data de in\u00EDcio do relacionamento com a IF", value: scr.dataInicioRelacionamento &&
|
|
65067
|
+
((_b = new Date(scr.dataInicioRelacionamento)) === null || _b === void 0 ? void 0 : _b.toLocaleDateString()) }),
|
|
65059
65068
|
React.createElement(AddItemField, { name: "Tipo cliente", value: scr.tipoDoCliente }))))));
|
|
65060
65069
|
};
|
|
65061
65070
|
var ResumoList = function (_a) {
|
|
65062
65071
|
var isLoading = _a.isLoading; _a.className; var error = _a.error, resumos = _a.resumos, props = __rest$2(_a, ["isLoading", "className", "error", "resumos"]);
|
|
65063
65072
|
return (React.createElement("div", null,
|
|
65064
|
-
React.createElement(Header$1, __assign$4({}, props, { variant: isLoading ?
|
|
65073
|
+
React.createElement(Header$1, __assign$4({}, props, { variant: isLoading ? "loading" : error ? "error" : "default", icon: ScrIcon })),
|
|
65065
65074
|
!isLoading && (React.createElement(Result, null,
|
|
65066
|
-
React.createElement(ResultContent, { desktop: "repeat(4, 1fr)", tablet: "repeat(3, 1fr)", mobile: "1fr 1fr" }, resumos.map(function (
|
|
65067
|
-
var descricao = _a.descricao, valor = _a.valor;
|
|
65068
|
-
return React.createElement(AddItemField, { key: key, name: descricao, value: valor });
|
|
65069
|
-
}))))));
|
|
65075
|
+
React.createElement(ResultContent, { desktop: "repeat(4, 1fr)", tablet: "repeat(3, 1fr)", mobile: "1fr 1fr" }, resumos.map(function (item, index) { return (React.createElement(AddItemField, { key: "".concat(item.descricao, "-").concat(index), name: item.descricao, value: item.valor })); }))))));
|
|
65070
65076
|
};
|
|
65071
65077
|
var ResumoModalidades = function (_a) {
|
|
65072
65078
|
var scr = _a.scr, isLoading = _a.isLoading, error = _a.error;
|
|
65073
|
-
var resumoModalidades = scr && getResumoDeModalidades(scr) || [];
|
|
65079
|
+
var resumoModalidades = (scr && getResumoDeModalidades(scr)) || [];
|
|
65074
65080
|
return (React.createElement("div", null,
|
|
65075
|
-
React.createElement(Header$1, { title: "SCR", subtitle: "Modalidade x Data Base", variant: isLoading ?
|
|
65076
|
-
!isLoading && (React.createElement(Result, null, resumoModalidades.map(function (resumo,
|
|
65081
|
+
React.createElement(Header$1, { title: "SCR", subtitle: "Modalidade x Data Base", variant: isLoading ? "loading" : error ? "error" : "default", icon: ScrIcon }),
|
|
65082
|
+
!isLoading && (React.createElement(Result, null, resumoModalidades.map(function (resumo, index) { return (React.createElement(ResultContent, { key: "".concat(resumo.modalidade, "-").concat(index), desktop: "repeat(4, 1fr)", tablet: "repeat(3, 1fr)", mobile: "1fr 1fr" },
|
|
65077
65083
|
React.createElement(AddItemField, { name: "Modalidade", value: resumo.modalidade }),
|
|
65078
65084
|
React.createElement(AddItemField, { name: "Vencido", value: resumo.vencido && formatMoney(resumo.vencido) }),
|
|
65079
65085
|
React.createElement(AddItemField, { name: "A Vencer", value: resumo.aVencer && formatMoney(resumo.aVencer) }),
|
|
@@ -10,7 +10,11 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
10
10
|
import { compose, groupBy } from "underscore";
|
|
11
11
|
import { formatMoney } from "../../utils/number";
|
|
12
12
|
var agruparPorCategoriaDeVencimento = function (detalhamento) {
|
|
13
|
-
|
|
13
|
+
if (!Array.isArray(detalhamento) || detalhamento.length === 0) {
|
|
14
|
+
return { avencer: [], vencido: [] };
|
|
15
|
+
}
|
|
16
|
+
var flatVencimentos = detalhamento.flatMap(function (item) { return item.vencimentos || []; });
|
|
17
|
+
var _a = groupBy(flatVencimentos, function (_a) {
|
|
14
18
|
var categoria = _a.categoria;
|
|
15
19
|
return categoria;
|
|
16
20
|
}), _b = _a.avencer, avencer = _b === void 0 ? [] : _b, _c = _a.vencido, vencido = _c === void 0 ? [] : _c;
|
|
@@ -26,66 +30,50 @@ var agruparPorDescricao = function (_a) {
|
|
|
26
30
|
vencido: groupBy(vencido, function (_a) {
|
|
27
31
|
var descricao = _a.descricao;
|
|
28
32
|
return descricao;
|
|
29
|
-
})
|
|
33
|
+
}),
|
|
30
34
|
});
|
|
31
35
|
};
|
|
32
36
|
var adicionarCreditosADescricao = function (description, valor) {
|
|
33
37
|
var isAvencerVencido = /(A Vencer|Vencido)$/i.test(description.trim());
|
|
34
|
-
return
|
|
35
|
-
!isAvencerVencido
|
|
38
|
+
return {
|
|
39
|
+
descricao: !isAvencerVencido
|
|
36
40
|
? "Cr\u00E9ditos ".concat(description.toLowerCase())
|
|
37
41
|
: description,
|
|
38
|
-
valor ? formatMoney(valor) :
|
|
39
|
-
|
|
42
|
+
valor: valor ? formatMoney(valor) : "",
|
|
43
|
+
};
|
|
40
44
|
};
|
|
41
45
|
var somarDadosAgrupadosPorDescricao = function (_a) {
|
|
42
46
|
var avencer = _a.avencer, vencido = _a.vencido;
|
|
43
|
-
|
|
44
|
-
|
|
47
|
+
var avencerEntries = avencer ? Object.entries(avencer) : [];
|
|
48
|
+
var vencidoEntries = vencido ? Object.entries(vencido) : [];
|
|
49
|
+
return {
|
|
50
|
+
avencer: avencerEntries.map(function (_a) {
|
|
45
51
|
var descricao = _a[0], values = _a[1];
|
|
46
|
-
return ({
|
|
47
|
-
descricao: descricao,
|
|
48
|
-
valor: values.reduce(function (a, b) { return a + Number(b.valor); }, 0)
|
|
49
|
-
});
|
|
50
|
-
}).filter(function (_a) {
|
|
51
|
-
var descricao = _a.descricao;
|
|
52
|
-
return !/Limite/.test(descricao.trim());
|
|
53
|
-
})
|
|
54
|
-
.map(function (_a) {
|
|
55
|
-
var descricao = _a.descricao, valor = _a.valor;
|
|
56
|
-
return adicionarCreditosADescricao(descricao, valor);
|
|
52
|
+
return adicionarCreditosADescricao(descricao, values.map(function (v) { return Number(v.valor); }).reduce(function (a, b) { return a + b; }, 0));
|
|
57
53
|
}),
|
|
58
|
-
vencido:
|
|
54
|
+
vencido: vencidoEntries.map(function (_a) {
|
|
59
55
|
var descricao = _a[0], values = _a[1];
|
|
60
|
-
return ({
|
|
61
|
-
descricao: descricao,
|
|
62
|
-
valor: values.reduce(function (a, b) { return a + Number(b.valor); }, 0)
|
|
63
|
-
});
|
|
64
|
-
}).filter(function (_a) {
|
|
65
|
-
var descricao = _a.descricao;
|
|
66
|
-
return !/Limite/.test(descricao.trim());
|
|
67
|
-
})
|
|
68
|
-
.map(function (_a) {
|
|
69
|
-
var descricao = _a.descricao, valor = _a.valor;
|
|
70
|
-
return adicionarCreditosADescricao(descricao, valor);
|
|
56
|
+
return adicionarCreditosADescricao(descricao, values.map(function (v) { return Number(v.valor); }).reduce(function (a, b) { return a + b; }, 0));
|
|
71
57
|
}),
|
|
72
|
-
}
|
|
58
|
+
};
|
|
73
59
|
};
|
|
74
|
-
var getVencidosEAvencer = compose
|
|
75
|
-
agruparPorCategoriaDeVencimento,
|
|
76
|
-
agruparPorDescricao,
|
|
77
|
-
somarDadosAgrupadosPorDescricao
|
|
78
|
-
].reverse());
|
|
60
|
+
var getVencidosEAvencer = compose(agruparPorCategoriaDeVencimento, agruparPorDescricao, somarDadosAgrupadosPorDescricao);
|
|
79
61
|
var getResumoDeCreditos = function (scr) {
|
|
80
|
-
var _a, _b, _c
|
|
81
|
-
|
|
62
|
+
var _a, _b, _c;
|
|
63
|
+
if (!((_a = scr === null || scr === void 0 ? void 0 : scr.analise) === null || _a === void 0 ? void 0 : _a.detalhamento)) {
|
|
64
|
+
return [];
|
|
65
|
+
}
|
|
66
|
+
var _d = getVencidosEAvencer(scr.analise.detalhamento), avencer = _d.avencer, vencido = _d.vencido;
|
|
82
67
|
return __spreadArray(__spreadArray(__spreadArray([
|
|
83
|
-
|
|
68
|
+
{
|
|
69
|
+
descricao: "A Vencer",
|
|
70
|
+
valor: formatMoney(((_b = scr.analise.total) === null || _b === void 0 ? void 0 : _b.aVencer) || 0),
|
|
71
|
+
}
|
|
84
72
|
], avencer, true), [
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
73
|
+
{
|
|
74
|
+
descricao: "Vencido",
|
|
75
|
+
valor: formatMoney(((_c = scr.analise.total) === null || _c === void 0 ? void 0 : _c.vencido) || 0),
|
|
76
|
+
}
|
|
77
|
+
], false), vencido, true);
|
|
90
78
|
};
|
|
91
79
|
export default getResumoDeCreditos;
|
|
@@ -10,84 +10,100 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
10
10
|
import { compose, groupBy } from "underscore";
|
|
11
11
|
import { sum } from "../../utils/number";
|
|
12
12
|
function getResumoDeModalidades(scr) {
|
|
13
|
-
var _a;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
13
|
+
var _a, _b;
|
|
14
|
+
if (!((_a = scr === null || scr === void 0 ? void 0 : scr.analise) === null || _a === void 0 ? void 0 : _a.detalhamento)) {
|
|
15
|
+
return [];
|
|
16
|
+
}
|
|
17
|
+
var agruparPorTitulo = function (detalhamento) {
|
|
18
|
+
return groupBy(detalhamento, function (_a) {
|
|
19
|
+
var modalidade = _a.modalidade;
|
|
20
|
+
return (modalidade === null || modalidade === void 0 ? void 0 : modalidade.titulo) || "Indefinido";
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
var agruparPorTituloESubtitulo = function (detalhamento) {
|
|
24
|
+
return Object.fromEntries(Object.entries(detalhamento).map(function (_a) {
|
|
25
|
+
var key = _a[0], values = _a[1];
|
|
26
|
+
return [
|
|
27
|
+
key,
|
|
28
|
+
Object.entries(groupBy(values, function (_a) {
|
|
29
|
+
var modalidade = _a.modalidade;
|
|
30
|
+
return modalidade.subtitulo;
|
|
31
|
+
})).map(function (_a) {
|
|
32
|
+
var _b;
|
|
33
|
+
var subtitulo = _a[0], detalhes = _a[1];
|
|
34
|
+
return ({
|
|
35
|
+
subtitulo: subtitulo,
|
|
36
|
+
variacaoCambial: (_b = detalhes.find(function (e) { return e.variacaoCambial; })) === null || _b === void 0 ? void 0 : _b.variacaoCambial,
|
|
37
|
+
valor: detalhes
|
|
38
|
+
.map(function (detalhe) { return detalhe.vencimentos; })
|
|
39
|
+
.flat()
|
|
40
|
+
.reduce(function (a, b) { return a + Number(b.valor); }, 0),
|
|
41
|
+
vencimentos: detalhes.map(function (detalhe) { return detalhe.vencimentos; }).flat(),
|
|
42
|
+
});
|
|
43
|
+
}),
|
|
44
|
+
];
|
|
45
|
+
}));
|
|
46
|
+
};
|
|
47
|
+
var getModalidades = compose(agruparPorTitulo, agruparPorTituloESubtitulo);
|
|
38
48
|
var modalidades = getModalidades(scr.analise.detalhamento);
|
|
39
|
-
var resumoDeOperacoes = (
|
|
49
|
+
var resumoDeOperacoes = ((_b = scr.listaDeResumoDasOperacoes) === null || _b === void 0 ? void 0 : _b.filter(function (_a) {
|
|
40
50
|
var modalidade = _a.modalidade;
|
|
41
51
|
return /^(19)/.test(modalidade);
|
|
42
|
-
});
|
|
52
|
+
})) || [];
|
|
43
53
|
var COD_LIMIT = {
|
|
44
|
-
1901:
|
|
45
|
-
1902:
|
|
46
|
-
1903:
|
|
47
|
-
1904:
|
|
48
|
-
1905:
|
|
49
|
-
1906:
|
|
50
|
-
1907:
|
|
51
|
-
1908:
|
|
52
|
-
1909:
|
|
53
|
-
1910:
|
|
54
|
-
1999:
|
|
54
|
+
1901: "Limite global",
|
|
55
|
+
1902: "Cheque especial",
|
|
56
|
+
1903: "Conta garantida",
|
|
57
|
+
1904: "Cartão de Crédito",
|
|
58
|
+
1905: "Capital de giro",
|
|
59
|
+
1906: "Crédito pessoal",
|
|
60
|
+
1907: "Vendor",
|
|
61
|
+
1908: "Compror",
|
|
62
|
+
1909: "Descontos",
|
|
63
|
+
1910: "Aquisição de bens",
|
|
64
|
+
1999: "Outros",
|
|
55
65
|
};
|
|
56
|
-
var limite = resumoDeOperacoes.
|
|
57
|
-
var
|
|
66
|
+
var limite = resumoDeOperacoes.flatMap(function (_a) {
|
|
67
|
+
var _b;
|
|
68
|
+
var modalidade = _a.modalidade, listaDeVencimentos = _a.listaDeVencimentos, variacaoCambial = _a.variacaoCambial;
|
|
58
69
|
var sumSalaries = sum(listaDeVencimentos.map(function (e) { return Number(e.valorVencimento); }));
|
|
59
|
-
return modalidades.Limite.filter(function (r) { return sumSalaries === r.valor; })
|
|
60
|
-
.map(function (r) {
|
|
70
|
+
return (((_b = modalidades.Limite) === null || _b === void 0 ? void 0 : _b.filter(function (r) { return sumSalaries === r.valor; }).map(function (r) {
|
|
61
71
|
var _a;
|
|
62
72
|
return ({
|
|
63
|
-
subtitulo: r.subtitulo
|
|
73
|
+
subtitulo: r.subtitulo || COD_LIMIT[modalidade] || "Indefinido",
|
|
64
74
|
vencimentos: r.vencimentos,
|
|
65
75
|
variacaoCambial: (_a = r.variacaoCambial) !== null && _a !== void 0 ? _a : variacaoCambial,
|
|
66
76
|
valor: r.valor,
|
|
67
77
|
});
|
|
68
|
-
});
|
|
69
|
-
})
|
|
78
|
+
})) || []);
|
|
79
|
+
});
|
|
70
80
|
modalidades.Limite = limite;
|
|
71
|
-
var sumVencimentos = function (vencimentos, tipo) {
|
|
72
|
-
|
|
73
|
-
|
|
81
|
+
var sumVencimentos = function (vencimentos, tipo) {
|
|
82
|
+
return sum(vencimentos
|
|
83
|
+
.filter(function (e) { return (e === null || e === void 0 ? void 0 : e.categoria) === tipo; })
|
|
84
|
+
.map(function (e) { return Number(e.valor); }));
|
|
85
|
+
};
|
|
86
|
+
return Object.entries(modalidades).flatMap(function (_a) {
|
|
74
87
|
var _b;
|
|
75
88
|
var modalidade = _a[0], subcategorias = _a[1];
|
|
76
|
-
return __spreadArray([
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
89
|
+
return __spreadArray([
|
|
90
|
+
{
|
|
91
|
+
modalidade: "".concat(modalidade, " (Cambial: ").concat(((_b = subcategorias[0]) === null || _b === void 0 ? void 0 : _b.variacaoCambial) || "Não", ")"),
|
|
92
|
+
vencido: sumVencimentos(subcategorias.flatMap(function (s) { return s.vencimentos; }), "vencido"),
|
|
93
|
+
aVencer: sumVencimentos(subcategorias.flatMap(function (s) { return s.vencimentos; }), "avencer"),
|
|
94
|
+
valor: sum(subcategorias.map(function (s) { return s.valor; })),
|
|
95
|
+
}
|
|
96
|
+
], subcategorias.flatMap(function (subcategoria) { return __spreadArray([
|
|
97
|
+
{
|
|
82
98
|
modalidade: subcategoria.subtitulo,
|
|
83
99
|
valor: subcategoria.valor,
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}), true); })
|
|
91
|
-
})
|
|
100
|
+
}
|
|
101
|
+
], subcategoria.vencimentos.map(function (vencimento) { return ({
|
|
102
|
+
modalidade: !/^Limite/.test(modalidade)
|
|
103
|
+
? "Cr\u00E9ditos ".concat(vencimento.descricao.toLowerCase())
|
|
104
|
+
: vencimento.descricao,
|
|
105
|
+
valor: vencimento.valor,
|
|
106
|
+
}); }), true); }), true);
|
|
107
|
+
});
|
|
92
108
|
}
|
|
93
109
|
export default getResumoDeModalidades;
|
|
@@ -22,17 +22,17 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
22
22
|
};
|
|
23
23
|
/* eslint-disable react-hooks/exhaustive-deps */
|
|
24
24
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
25
|
-
import React, { useContext, useEffect, useMemo, useRef } from
|
|
26
|
-
import Header from
|
|
27
|
-
import AddItemField from
|
|
28
|
-
import { Result, ResultContent } from
|
|
29
|
-
import { ConsultasComplementaresContext } from
|
|
30
|
-
import { useQuery } from
|
|
31
|
-
import getResumoDeCreditos from
|
|
32
|
-
import getResumoDeModalidades from
|
|
33
|
-
import { formatMoney } from
|
|
34
|
-
import StatusMessage from
|
|
35
|
-
import ScrIcon from
|
|
25
|
+
import React, { useContext, useEffect, useMemo, useRef } from "react";
|
|
26
|
+
import Header from "../interface/header";
|
|
27
|
+
import AddItemField from "../common/addItem";
|
|
28
|
+
import { Result, ResultContent } from "../interface/result";
|
|
29
|
+
import { ConsultasComplementaresContext } from "../consultasComplementares";
|
|
30
|
+
import { useQuery } from "../webservice";
|
|
31
|
+
import getResumoDeCreditos from "./getResumoDeCreditos";
|
|
32
|
+
import getResumoDeModalidades from "./getResumoDeModalidades";
|
|
33
|
+
import { formatMoney } from "../../utils/number";
|
|
34
|
+
import StatusMessage from "../interface/statusMessage";
|
|
35
|
+
import ScrIcon from "../../assets/icones/scr";
|
|
36
36
|
function ConsultaSCR(_a) {
|
|
37
37
|
var _b, _c, _d, _e;
|
|
38
38
|
var documento = _a.documento;
|
|
@@ -48,19 +48,23 @@ function ConsultaSCR(_a) {
|
|
|
48
48
|
(_a = scrRef.current) === null || _a === void 0 ? void 0 : _a.scrollIntoView();
|
|
49
49
|
}, [consultaSCRRealizada]);
|
|
50
50
|
useEffect(function () {
|
|
51
|
-
response && setConsultasComplementares
|
|
51
|
+
if (response && setConsultasComplementares) {
|
|
52
|
+
setConsultasComplementares(function (prev) { return (__assign(__assign({}, prev), { scr: __assign(__assign({}, prev.scr), { data: response }) })); });
|
|
53
|
+
}
|
|
52
54
|
}, [response]);
|
|
53
55
|
return consultaSCRRealizada ? (React.createElement(React.Fragment, null,
|
|
54
56
|
React.createElement(ResumoDoCliente, { scrRef: scrRef, isLoading: isLoading, scr: scr, error: error }),
|
|
55
|
-
!error
|
|
57
|
+
!error && (React.createElement(React.Fragment, null,
|
|
56
58
|
React.createElement(FluxosDeVencimentosConsolidados, { isLoading: isLoading, scr: scr, error: error }),
|
|
57
|
-
React.createElement(ResumoList, { title: "SCR",
|
|
58
|
-
|
|
59
|
+
React.createElement(ResumoList, { title: "SCR",
|
|
60
|
+
subtitle: "Crédito",
|
|
61
|
+
resumos: resumoDeCreditos, isLoading: isLoading, error: error }),
|
|
62
|
+
React.createElement(ResumoModalidades, { isLoading: isLoading, scr: scr, error: error }))))) : null;
|
|
59
63
|
}
|
|
60
64
|
var ResumoDoCliente = function (_a) {
|
|
61
65
|
var scr = _a.scr, scrRef = _a.scrRef, isLoading = _a.isLoading, error = _a.error;
|
|
62
66
|
return (React.createElement("div", null,
|
|
63
|
-
React.createElement(Header, { innerRef: scrRef, title:
|
|
67
|
+
React.createElement(Header, { innerRef: scrRef, title: "SCR", variant: isLoading ? "loading" : error ? "error" : "default", subtitle: "Resumo do Cliente", description: error ? (React.createElement(StatusMessage, { type: "error" }, error.message)) : null, icon: ScrIcon }),
|
|
64
68
|
scr && !isLoading && (React.createElement(Result, null,
|
|
65
69
|
React.createElement(ResultContent, { desktop: "repeat(4, 1fr)", tablet: "repeat(3, 1fr)", mobile: "1fr 1fr" },
|
|
66
70
|
React.createElement(AddItemField, { name: "CNPJ da IF Solicitante", value: scr === null || scr === void 0 ? void 0 : scr.cnpjDaIFSolicitante }),
|
|
@@ -72,7 +76,7 @@ var FluxosDeVencimentosConsolidados = function (_a) {
|
|
|
72
76
|
var _b;
|
|
73
77
|
var scr = _a.scr, isLoading = _a.isLoading, error = _a.error;
|
|
74
78
|
return (React.createElement("div", null,
|
|
75
|
-
React.createElement(Header, { title:
|
|
79
|
+
React.createElement(Header, { title: "SCR", subtitle: "Fluxo De Vencimentos Consolidados", variant: isLoading ? "loading" : error ? "error" : "default", icon: ScrIcon }),
|
|
76
80
|
scr && !isLoading && (React.createElement(Result, null,
|
|
77
81
|
React.createElement(ResultContent, { desktop: "repeat(4, 1fr)", tablet: "repeat(3, 1fr)", mobile: "1fr 1fr" },
|
|
78
82
|
React.createElement(AddItemField, { name: "Data-base", value: scr.dataBaseConsultada }),
|
|
@@ -85,25 +89,23 @@ var FluxosDeVencimentosConsolidados = function (_a) {
|
|
|
85
89
|
React.createElement(AddItemField, { name: "Opera\u00E7\u00F5es com manifesta\u00E7\u00E3o de discord\u00E2ncia", value: scr.responsabilidadeTotalDiscordancia }),
|
|
86
90
|
React.createElement(AddItemField, { name: "Opera\u00E7\u00F5es amparadas por sub-judice", value: scr.responsabilidadeTotalSubJudice }),
|
|
87
91
|
React.createElement(AddItemField, { name: "Risco indireto fornecedor", value: scr.riscoIndiretoVendor }),
|
|
88
|
-
React.createElement(AddItemField, { name: "Data de in\u00EDcio do relacionamento com a IF", value: scr.dataInicioRelacionamento &&
|
|
92
|
+
React.createElement(AddItemField, { name: "Data de in\u00EDcio do relacionamento com a IF", value: scr.dataInicioRelacionamento &&
|
|
93
|
+
((_b = new Date(scr.dataInicioRelacionamento)) === null || _b === void 0 ? void 0 : _b.toLocaleDateString()) }),
|
|
89
94
|
React.createElement(AddItemField, { name: "Tipo cliente", value: scr.tipoDoCliente }))))));
|
|
90
95
|
};
|
|
91
96
|
var ResumoList = function (_a) {
|
|
92
97
|
var isLoading = _a.isLoading, className = _a.className, error = _a.error, resumos = _a.resumos, props = __rest(_a, ["isLoading", "className", "error", "resumos"]);
|
|
93
98
|
return (React.createElement("div", null,
|
|
94
|
-
React.createElement(Header, __assign({}, props, { variant: isLoading ?
|
|
99
|
+
React.createElement(Header, __assign({}, props, { variant: isLoading ? "loading" : error ? "error" : "default", icon: ScrIcon })),
|
|
95
100
|
!isLoading && (React.createElement(Result, null,
|
|
96
|
-
React.createElement(ResultContent, { desktop: "repeat(4, 1fr)", tablet: "repeat(3, 1fr)", mobile: "1fr 1fr" }, resumos.map(function (
|
|
97
|
-
var descricao = _a.descricao, valor = _a.valor;
|
|
98
|
-
return React.createElement(AddItemField, { key: key, name: descricao, value: valor });
|
|
99
|
-
}))))));
|
|
101
|
+
React.createElement(ResultContent, { desktop: "repeat(4, 1fr)", tablet: "repeat(3, 1fr)", mobile: "1fr 1fr" }, resumos.map(function (item, index) { return (React.createElement(AddItemField, { key: "".concat(item.descricao, "-").concat(index), name: item.descricao, value: item.valor })); }))))));
|
|
100
102
|
};
|
|
101
103
|
var ResumoModalidades = function (_a) {
|
|
102
104
|
var scr = _a.scr, isLoading = _a.isLoading, error = _a.error;
|
|
103
|
-
var resumoModalidades = scr && getResumoDeModalidades(scr) || [];
|
|
105
|
+
var resumoModalidades = (scr && getResumoDeModalidades(scr)) || [];
|
|
104
106
|
return (React.createElement("div", null,
|
|
105
|
-
React.createElement(Header, { title: "SCR", subtitle: "Modalidade x Data Base", variant: isLoading ?
|
|
106
|
-
!isLoading && (React.createElement(Result, null, resumoModalidades.map(function (resumo,
|
|
107
|
+
React.createElement(Header, { title: "SCR", subtitle: "Modalidade x Data Base", variant: isLoading ? "loading" : error ? "error" : "default", icon: ScrIcon }),
|
|
108
|
+
!isLoading && (React.createElement(Result, null, resumoModalidades.map(function (resumo, index) { return (React.createElement(ResultContent, { key: "".concat(resumo.modalidade, "-").concat(index), desktop: "repeat(4, 1fr)", tablet: "repeat(3, 1fr)", mobile: "1fr 1fr" },
|
|
107
109
|
React.createElement(AddItemField, { name: "Modalidade", value: resumo.modalidade }),
|
|
108
110
|
React.createElement(AddItemField, { name: "Vencido", value: resumo.vencido && formatMoney(resumo.vencido) }),
|
|
109
111
|
React.createElement(AddItemField, { name: "A Vencer", value: resumo.aVencer && formatMoney(resumo.aVencer) }),
|
|
@@ -68,9 +68,10 @@ export interface Detalhamento {
|
|
|
68
68
|
export interface Modalidade {
|
|
69
69
|
titulo: string;
|
|
70
70
|
subtitulo: string;
|
|
71
|
+
variacaoCambial?: string;
|
|
71
72
|
}
|
|
72
73
|
export interface Vencimento {
|
|
73
|
-
categoria:
|
|
74
|
+
categoria: "avencer" | "vencido";
|
|
74
75
|
descricao: string;
|
|
75
76
|
valor: string;
|
|
76
77
|
}
|
|
@@ -80,7 +81,7 @@ export type SCRListProps = {
|
|
|
80
81
|
isLoading: boolean;
|
|
81
82
|
error: Error | null;
|
|
82
83
|
};
|
|
83
|
-
export type GrupoDeVencimentos = Record<
|
|
84
|
-
export type ResumoListProps = Omit<SCRListProps,
|
|
85
|
-
resumos: Record<
|
|
84
|
+
export type GrupoDeVencimentos = Record<"avencer" | "vencido", Record<string, Vencimento[]>>;
|
|
85
|
+
export type ResumoListProps = Omit<SCRListProps, "scr"> & HeaderProps & {
|
|
86
|
+
resumos: Record<"descricao" | "valor", string | number>[];
|
|
86
87
|
};
|