@credithub/harlan-components 1.24.2 → 1.24.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/dist/components/refinSerasa/refinSerasa.js +19 -22
- package/lib/cjs/index.js +14 -16
- package/lib/esm/index.js +14 -16
- package/package.json +1 -1
|
@@ -21,17 +21,16 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
21
21
|
return t;
|
|
22
22
|
};
|
|
23
23
|
/* eslint-disable react-hooks/exhaustive-deps */
|
|
24
|
+
import PefinRefinSerasaIcon from '../../assets/icones/pefinRefinSerasa';
|
|
25
|
+
import { formatMoney } from '../../utils/number';
|
|
26
|
+
import { addNoValueContent } from '../../utils/string';
|
|
24
27
|
import React, { useContext, useEffect, useMemo, useRef } from 'react';
|
|
25
|
-
import Header from '../interface/header';
|
|
26
28
|
import AddItemField from '../common/addItem';
|
|
27
|
-
import { Result, ResultContent } from '../interface/result';
|
|
28
29
|
import { ConsultasComplementaresContext } from '../consultasComplementares';
|
|
29
|
-
import
|
|
30
|
-
import {
|
|
31
|
-
import { formatMoney } from '../../utils/number';
|
|
30
|
+
import Header from '../interface/header';
|
|
31
|
+
import { Result, ResultContent } from '../interface/result';
|
|
32
32
|
import StatusMessage from '../interface/statusMessage';
|
|
33
|
-
import
|
|
34
|
-
import DividasVencidasSerasaIcon from '../../assets/icones/dividasVencidasSerasa';
|
|
33
|
+
import { useQuery } from '../webservice';
|
|
35
34
|
var RefinSerasa = function (_a) {
|
|
36
35
|
var _b, _c, _d, _e;
|
|
37
36
|
var documento = _a.documento;
|
|
@@ -39,27 +38,26 @@ var RefinSerasa = function (_a) {
|
|
|
39
38
|
var consultasComplementaresContext = useContext(ConsultasComplementaresContext);
|
|
40
39
|
var _f = consultasComplementaresContext !== null && consultasComplementaresContext !== void 0 ? consultasComplementaresContext : {}, consultasComplementares = _f.consultasComplementares, setConsultasComplementares = _f.setConsultasComplementares;
|
|
41
40
|
var _g = useQuery("SELECT FROM 'PROTESTOS'.'SERASA'", { documento: documento }, !!((_b = consultasComplementares === null || consultasComplementares === void 0 ? void 0 : consultasComplementares.refinSerasa) === null || _b === void 0 ? void 0 : _b.consultaRealizada)), response = _g.response, isLoading = _g.isLoading, error = _g.error;
|
|
42
|
-
var clearValue = function (value) {
|
|
41
|
+
var clearValue = function (value) {
|
|
42
|
+
var semPontos = value === null || value === void 0 ? void 0 : value.replace(/\./g, '');
|
|
43
|
+
return semPontos === null || semPontos === void 0 ? void 0 : semPontos.replace(',', '.');
|
|
44
|
+
};
|
|
43
45
|
var pendenciasData = useMemo(function () {
|
|
44
46
|
var _a, _b, _c;
|
|
45
47
|
return ((response && ((_c = (_b = (_a = response === null || response === void 0 ? void 0 : response.document) === null || _a === void 0 ? void 0 : _a.informacoes) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.bello)) || [])
|
|
46
48
|
.map(addNoValueContent)
|
|
47
49
|
.map(function (pendencia) {
|
|
48
50
|
var _a;
|
|
49
|
-
|
|
51
|
+
var valorLimpo = clearValue(pendencia.valor);
|
|
52
|
+
var totalvalorLimpo = clearValue(pendencia.totalvalor);
|
|
53
|
+
return __assign(__assign({}, pendencia), { valor: formatMoney(valorLimpo), totalvalor: formatMoney(totalvalorLimpo), vencimento: (_a = pendencia === null || pendencia === void 0 ? void 0 : pendencia.vencimento) === null || _a === void 0 ? void 0 : _a.slice(0, 10) });
|
|
50
54
|
});
|
|
51
55
|
}, [response]);
|
|
52
56
|
var pendencias = pendenciasData.filter(function (_a) {
|
|
53
57
|
var categoria = _a.categoria;
|
|
54
|
-
return categoria === 'PENDÊNCIAS FINANCEIRAS'
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
var categoria = _a.categoria;
|
|
58
|
-
return categoria === 'RESTRIÇÕES FINANCEIRAS';
|
|
59
|
-
});
|
|
60
|
-
var dividasVencidas = pendenciasData.filter(function (_a) {
|
|
61
|
-
var categoria = _a.categoria;
|
|
62
|
-
return categoria === 'DÍVIDAS VENCIDAS';
|
|
58
|
+
return categoria === 'PENDÊNCIAS FINANCEIRAS' ||
|
|
59
|
+
categoria === 'RESTRIÇÕES FINANCEIRAS' ||
|
|
60
|
+
categoria === 'DÍVIDAS VENCIDAS';
|
|
63
61
|
});
|
|
64
62
|
var consultaRefinRealizada = useMemo(function () { var _a; return (_a = consultasComplementares === null || consultasComplementares === void 0 ? void 0 : consultasComplementares.refinSerasa) === null || _a === void 0 ? void 0 : _a.consultaRealizada; }, [(_c = consultasComplementares === null || consultasComplementares === void 0 ? void 0 : consultasComplementares.refinSerasa) === null || _c === void 0 ? void 0 : _c.consultaRealizada]);
|
|
65
63
|
useEffect(function () {
|
|
@@ -71,11 +69,9 @@ var RefinSerasa = function (_a) {
|
|
|
71
69
|
setConsultasComplementares &&
|
|
72
70
|
setConsultasComplementares(function (prev) { return (__assign(__assign({}, prev), { refinSerasa: __assign(__assign({}, prev.refinSerasa), { data: response }) })); });
|
|
73
71
|
}, [response]);
|
|
74
|
-
var
|
|
72
|
+
var valorTotalPendenciasFinanceiras = (((_e = (_d = response === null || response === void 0 ? void 0 : response.document) === null || _d === void 0 ? void 0 : _d.informacoes) === null || _e === void 0 ? void 0 : _e[0]) || {}).valorTotalPendenciasFinanceiras;
|
|
75
73
|
return consultaRefinRealizada ? (React.createElement(React.Fragment, null,
|
|
76
|
-
React.createElement(PendenciasList, { title: "
|
|
77
|
-
React.createElement(PendenciasList, { title: "Pend\u00EAncias Refin Serasa", subtitle: "Confira as Restri\u00E7\u00F5es Financeiras deste documento", pendencias: restricoes, valorTotal: valorTotalPendenciasRefin, isLoading: isLoading, error: error }),
|
|
78
|
-
React.createElement(PendenciasList, { title: "D\u00EDvidas Vencidas Serasa", subtitle: "Confira as D\u00EDvidas Vencidas deste documento", pendencias: dividasVencidas, valorTotal: valorTotalPendenciasVencidas, isLoading: isLoading, error: error, icon: DividasVencidasSerasaIcon }))) : null;
|
|
74
|
+
React.createElement(PendenciasList, { title: "Pefin/Refin e Contratos Vencidos Serasa", subtitle: "Confira as Pend\u00EAncias Financeiras deste documento", pendencias: pendencias, valorTotal: valorTotalPendenciasFinanceiras, innerRef: refinSerasaRef, isLoading: isLoading, error: error }))) : null;
|
|
79
75
|
};
|
|
80
76
|
var PendenciasList = function (_a) {
|
|
81
77
|
var isLoading = _a.isLoading, error = _a.error, pendencias = _a.pendencias, valorTotal = _a.valorTotal, headerProps = __rest(_a, ["isLoading", "error", "pendencias", "valorTotal"]);
|
|
@@ -93,6 +89,7 @@ var PendenciasList = function (_a) {
|
|
|
93
89
|
: pendencias.length === 0
|
|
94
90
|
? 'success'
|
|
95
91
|
: 'error';
|
|
92
|
+
pendencias.map(function (pendencia, i) { });
|
|
96
93
|
return (React.createElement("div", null,
|
|
97
94
|
React.createElement(Header, __assign({ variant: isLoading
|
|
98
95
|
? 'loading'
|