@credithub/harlan-components 1.27.7 → 1.27.9
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.
|
@@ -21,7 +21,7 @@ var ProcessosJuridicos = function (_a) {
|
|
|
21
21
|
var Section = ctx.Section;
|
|
22
22
|
var setData = useGlobalData().setData;
|
|
23
23
|
var _b = useState(false), dataUpdated = _b[0], setDataUpdated = _b[1];
|
|
24
|
-
return (React.createElement(Section, { ctx: ctx, title: "Processos Jur\u00EDdicos", subtitle: "Veja os processos jur\u00EDdicos para este documento.", icon: ProcessosJuridicosIcon, onSuccess: function (data) {
|
|
24
|
+
return (React.createElement(Section, { ctx: ctx, title: "Processos Jur\u00EDdicos", subtitle: "Veja os processos jur\u00EDdicos para este documento.", icon: ProcessosJuridicosIcon, minimized: false, onSuccess: function (data) {
|
|
25
25
|
var _a, _b;
|
|
26
26
|
var qtyProcessos = (_a = data === null || data === void 0 ? void 0 : data.empresa) === null || _a === void 0 ? void 0 : _a.length;
|
|
27
27
|
if (!dataUpdated && qtyProcessos) {
|
|
@@ -2,21 +2,4 @@ import React from 'react';
|
|
|
2
2
|
declare function RefinBoaVista({ documento }: {
|
|
3
3
|
documento: string;
|
|
4
4
|
}): React.JSX.Element | null;
|
|
5
|
-
export type PendenciaBoaVista = {
|
|
6
|
-
ocorrencia: string;
|
|
7
|
-
credor: string;
|
|
8
|
-
entrada: string;
|
|
9
|
-
vencimento: string;
|
|
10
|
-
valor: string;
|
|
11
|
-
informante: string;
|
|
12
|
-
contrato: string;
|
|
13
|
-
avalista: string;
|
|
14
|
-
cidade: string;
|
|
15
|
-
uf: string;
|
|
16
|
-
situacao: string;
|
|
17
|
-
orgaoemissor: string;
|
|
18
|
-
totalpendencias: string;
|
|
19
|
-
totalvalor: string;
|
|
20
|
-
categoria: string;
|
|
21
|
-
};
|
|
22
5
|
export default RefinBoaVista;
|
|
@@ -20,54 +20,65 @@ import Header from '../interface/header';
|
|
|
20
20
|
import { Result, ResultContent } from '../interface/result';
|
|
21
21
|
import StatusMessage from '../interface/statusMessage';
|
|
22
22
|
import { useQuery } from '../webservice';
|
|
23
|
-
function
|
|
24
|
-
var
|
|
25
|
-
var documento = _a.documento;
|
|
23
|
+
function useRefinBoaVista(documento) {
|
|
24
|
+
var _a;
|
|
26
25
|
var consultasComplementaresContext = useContext(ConsultasComplementaresContext);
|
|
27
26
|
var setData = useGlobalData().setData;
|
|
28
|
-
var
|
|
29
|
-
var
|
|
30
|
-
var
|
|
27
|
+
var _b = useState(false), dataUpdated = _b[0], setDataUpdated = _b[1];
|
|
28
|
+
var _c = consultasComplementaresContext !== null && consultasComplementaresContext !== void 0 ? consultasComplementaresContext : {}, consultasComplementares = _c.consultasComplementares, setConsultasComplementares = _c.setConsultasComplementares;
|
|
29
|
+
var _d = useQuery("SELECT FROM 'PROTESTOS'.'REFIN'", { documento: documento }, !!((_a = consultasComplementares === null || consultasComplementares === void 0 ? void 0 : consultasComplementares.refinBoaVista) === null || _a === void 0 ? void 0 : _a.consultaRealizada)), response = _d.response, isLoading = _d.isLoading, error = _d.error;
|
|
31
30
|
var pendencias = useMemo(function () {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
31
|
+
var _a;
|
|
32
|
+
if ((_a = response === null || response === void 0 ? void 0 : response.document) === null || _a === void 0 ? void 0 : _a.spc) {
|
|
33
|
+
var spcData = response.document.spc;
|
|
34
|
+
if (Array.isArray(spcData) &&
|
|
35
|
+
spcData.length === 1 &&
|
|
36
|
+
Array.isArray(spcData[0]) &&
|
|
37
|
+
spcData[0].length === 0) {
|
|
38
|
+
return [];
|
|
39
|
+
}
|
|
40
|
+
return spcData.flat().map(addNoValueContent);
|
|
37
41
|
}
|
|
42
|
+
return [];
|
|
38
43
|
}, [response]);
|
|
39
|
-
var refinBoaVistaRef = useRef(null);
|
|
40
|
-
var description = pendencias.length
|
|
41
|
-
? "Foram encontrados ".concat(pendencias.length, " ocorr\u00EAncias")
|
|
42
|
-
: 'Nenhuma ocorrência encontrada';
|
|
43
|
-
var consultaRefinRealizada = useMemo(function () { var _a; return (_a = consultasComplementares === null || consultasComplementares === void 0 ? void 0 : consultasComplementares.refinBoaVista) === null || _a === void 0 ? void 0 : _a.consultaRealizada; }, [(_c = consultasComplementares === null || consultasComplementares === void 0 ? void 0 : consultasComplementares.refinBoaVista) === null || _c === void 0 ? void 0 : _c.consultaRealizada]);
|
|
44
|
-
useEffect(function () {
|
|
45
|
-
var _a;
|
|
46
|
-
(_a = refinBoaVistaRef.current) === null || _a === void 0 ? void 0 : _a.scrollIntoView();
|
|
47
|
-
}, [consultaRefinRealizada]);
|
|
48
44
|
useEffect(function () {
|
|
49
|
-
response &&
|
|
50
|
-
setConsultasComplementares &&
|
|
51
|
-
setConsultasComplementares(function (prev) { return (__assign(__assign({}, prev), { refinBoaVista: __assign(__assign({}, prev.refinBoaVista), { data: response }) })); });
|
|
52
|
-
if (response && response.document && !dataUpdated) {
|
|
45
|
+
if ((response === null || response === void 0 ? void 0 : response.document) && !dataUpdated) {
|
|
53
46
|
var refinBoaVistaData_1 = {
|
|
54
47
|
refinBoaVistaData: response.document
|
|
55
48
|
};
|
|
49
|
+
setConsultasComplementares === null || setConsultasComplementares === void 0 ? void 0 : setConsultasComplementares(function (prev) { return (__assign(__assign({}, prev), { refinBoaVista: __assign(__assign({}, prev.refinBoaVista), { data: response }) })); });
|
|
56
50
|
setData(function (prevState) { return (__assign(__assign({}, prevState), { refinBoaVista: refinBoaVistaData_1 })); });
|
|
57
51
|
setDataUpdated(true);
|
|
58
52
|
}
|
|
59
|
-
}, [response, dataUpdated, setData]);
|
|
60
|
-
|
|
53
|
+
}, [response, dataUpdated, setData, setConsultasComplementares]);
|
|
54
|
+
return { isLoading: isLoading, error: error, pendencias: pendencias, consultaRealizada: !!response };
|
|
55
|
+
}
|
|
56
|
+
function RefinBoaVista(_a) {
|
|
57
|
+
var documento = _a.documento;
|
|
58
|
+
var refinBoaVistaRef = useRef(null);
|
|
59
|
+
var _b = useRefinBoaVista(documento), isLoading = _b.isLoading, error = _b.error, pendencias = _b.pendencias, consultaRealizada = _b.consultaRealizada;
|
|
60
|
+
useEffect(function () {
|
|
61
|
+
var _a;
|
|
62
|
+
(_a = refinBoaVistaRef.current) === null || _a === void 0 ? void 0 : _a.scrollIntoView();
|
|
63
|
+
}, [consultaRealizada]);
|
|
64
|
+
var statusType = pendencias.length > 0 ? 'success' : 'default';
|
|
65
|
+
var variant = isLoading
|
|
66
|
+
? 'loading'
|
|
67
|
+
: error
|
|
68
|
+
? 'error'
|
|
69
|
+
: 'default';
|
|
70
|
+
var description = pendencias.length
|
|
71
|
+
? "Foram encontrados ".concat(pendencias.length, " ocorr\u00EAncias")
|
|
72
|
+
: 'Nenhuma ocorrência encontrada';
|
|
73
|
+
if (!consultaRealizada)
|
|
61
74
|
return null;
|
|
62
75
|
return (React.createElement("div", null,
|
|
63
|
-
React.createElement(Header, { innerRef: refinBoaVistaRef, title: "Restri\u00E7\u00F5es Pefin/Refin Boa Vista", subtitle: "Apontamentos e Restri\u00E7\u00F5es Financeiras e Comerciais", variant:
|
|
64
|
-
|
|
65
|
-
: error || pendencias.length
|
|
66
|
-
? 'error'
|
|
67
|
-
: 'default', description: React.createElement(StatusMessage, { type: (pendencias === null || pendencias === void 0 ? void 0 : pendencias.length) ? 'success' : 'default' }, error ? error.message : description), icon: PefinRefinBoaVistaIcon }),
|
|
68
|
-
React.createElement(Result, null, pendencias.map(function (pendencia, i) { return (React.createElement(ResultContent, { key: i, desktop: "repeat(5, 1fr)", tablet: "repeat(3, 1fr)", mobile: "1fr 1fr" },
|
|
76
|
+
React.createElement(Header, { innerRef: refinBoaVistaRef, title: "Restri\u00E7\u00F5es Pefin/Refin Boa Vista", subtitle: "Apontamentos e Restri\u00E7\u00F5es Financeiras e Comerciais", variant: variant, description: React.createElement(StatusMessage, { type: statusType }, error ? error.message : description), icon: PefinRefinBoaVistaIcon }),
|
|
77
|
+
pendencias.length > 0 && (React.createElement(Result, null, pendencias.map(function (pendencia, i) { return (React.createElement(ResultContent, { key: i, desktop: "repeat(5, 1fr)", tablet: "repeat(3, 1fr)", mobile: "1fr 1fr" },
|
|
69
78
|
React.createElement(AddItemField, { name: "Associado", value: pendencia.NomeAssociado }),
|
|
70
|
-
React.createElement(AddItemField, { name: "Valor", value:
|
|
79
|
+
React.createElement(AddItemField, { name: "Valor", value: pendencia.Valor && !isNaN(parseFloat(pendencia.Valor))
|
|
80
|
+
? "".concat(formatMoney(parseFloat(pendencia.Valor)))
|
|
81
|
+
: 'Sem Valor' }),
|
|
71
82
|
React.createElement(AddItemField, { name: "Data da Inclus\u00E3o", value: pendencia.DataDeInclusao }),
|
|
72
83
|
React.createElement(AddItemField, { name: "Data do Vencimento", value: pendencia.DataDoVencimento }),
|
|
73
84
|
React.createElement(AddItemField, { name: "Entidade", value: pendencia.Entidade }),
|
|
@@ -75,6 +86,6 @@ function RefinBoaVista(_a) {
|
|
|
75
86
|
React.createElement(AddItemField, { name: "Comprador, Fiador ou Avalista", value: pendencia.CompradorFiadorAvalista }),
|
|
76
87
|
React.createElement(AddItemField, { name: "Telefone Associado", value: pendencia.TelefoneAssociado }),
|
|
77
88
|
React.createElement(AddItemField, { name: "Cidade Associado", value: pendencia.CidadeAssociado }),
|
|
78
|
-
React.createElement(AddItemField, { name: "UF Associado", value: pendencia.UfAssociado }))); }))));
|
|
89
|
+
React.createElement(AddItemField, { name: "UF Associado", value: pendencia.UfAssociado }))); })))));
|
|
79
90
|
}
|
|
80
91
|
export default RefinBoaVista;
|