@granto-umbrella/umbrella-components 3.0.28 → 3.0.29
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/umbrella-components.es.js +24998 -24126
- package/dist/umbrella-components.umd.js +1062 -803
- package/package.json +1 -1
- package/src/components/atoms/{Tapbar/Tapbar.tsx → TabBar/TabBar.tsx} +5 -5
- package/src/components/atoms/TabBar/index.tsx +2 -0
- package/src/components/molecules/InsuranceCard/InsuranceCard.styles.tsx +112 -49
- package/src/components/molecules/InsuranceCard/InsuranceCard.tsx +136 -183
- package/src/components/molecules/InsuranceCard/InsuranceCard.types.ts +38 -15
- package/src/index.ts +1 -1
- package/src/components/atoms/Tapbar/index.tsx +0 -2
- /package/src/components/atoms/{Tapbar/Tapbar.styles.tsx → TabBar/TabBar.styles.tsx} +0 -0
- /package/src/components/atoms/{Tapbar/Tapbar.types.ts → TabBar/TabBar.types.ts} +0 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
2
3
|
import {
|
|
3
4
|
FileText,
|
|
4
5
|
CreditCard,
|
|
@@ -7,112 +8,33 @@ import {
|
|
|
7
8
|
ChevronDown,
|
|
8
9
|
ChevronUp,
|
|
9
10
|
Loader2,
|
|
10
|
-
} from
|
|
11
|
+
} from 'lucide-react';
|
|
11
12
|
import {
|
|
12
13
|
CardContainer,
|
|
13
14
|
HeaderRow,
|
|
14
15
|
InfoRow,
|
|
15
16
|
InfoLabel,
|
|
16
|
-
|
|
17
|
+
InfoValue,
|
|
17
18
|
Actions,
|
|
18
19
|
DropdownWrapper,
|
|
19
20
|
DropdownMenu,
|
|
21
|
+
MenuItemProps,
|
|
20
22
|
StyledMenuItem,
|
|
21
23
|
Text,
|
|
22
24
|
BodyRow,
|
|
23
25
|
InfoSubValue,
|
|
26
|
+
TruncatedValue,
|
|
24
27
|
ProdValue,
|
|
25
28
|
ProcessValue,
|
|
26
29
|
ActionButton,
|
|
27
|
-
} from
|
|
28
|
-
import {
|
|
29
|
-
|
|
30
|
-
import Pill from "../../atoms/Pill/Pill";
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
const applyMask = (value: string, mask: string): string => {
|
|
36
|
-
let result = "";
|
|
37
|
-
let valueIndex = 0;
|
|
38
|
-
|
|
39
|
-
for (let i = 0; i < mask.length && valueIndex < value.length; i++) {
|
|
40
|
-
if (mask[i] === "0") {
|
|
41
|
-
result += value[valueIndex];
|
|
42
|
-
valueIndex++;
|
|
43
|
-
} else {
|
|
44
|
-
result += mask[i];
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
return result;
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
const isValidCNPJ = (value: string): boolean => {
|
|
53
|
-
const cleanValue = value.replace(/\D/g, "");
|
|
54
|
-
return cleanValue.length === 14;
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
const formatDate = (isoDate: string): string => {
|
|
59
|
-
const date = new Date(isoDate);
|
|
60
|
-
const day = String(date.getDate()).padStart(2, "0");
|
|
61
|
-
const month = String(date.getMonth() + 1).padStart(2, "0");
|
|
62
|
-
const year = date.getFullYear();
|
|
63
|
-
return `${day}/${month}/${year}`;
|
|
64
|
-
};
|
|
65
|
-
|
|
30
|
+
} from './InsuranceCard.styles';
|
|
31
|
+
import { ArrowCircleUpRight, Cube, XCircle, FlowArrow } from 'phosphor-react';
|
|
32
|
+
import { ExcludeModal } from '../ExcludeModal';
|
|
66
33
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
];
|
|
72
|
-
|
|
73
|
-
const formatProduct = (modality: string) => {
|
|
74
|
-
const type = modality.at(2);
|
|
75
|
-
const result = [];
|
|
76
|
-
|
|
77
|
-
switch (type) {
|
|
78
|
-
case "1":
|
|
79
|
-
result.push("Tradicional");
|
|
80
|
-
break;
|
|
81
|
-
case "2":
|
|
82
|
-
result.push("Judicial");
|
|
83
|
-
break;
|
|
84
|
-
default:
|
|
85
|
-
result.push("Desconhecido");
|
|
86
|
-
break;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
result.push(
|
|
90
|
-
product_list.find((item) => item.value === modality)?.label ??
|
|
91
|
-
"Desconhecido"
|
|
92
|
-
);
|
|
93
|
-
return result;
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
// Ícones do phosphor-react substituídos por componentes inline
|
|
97
|
-
const ArrowCircleUpRight = ({ size = 16 }: { size?: number }) => (
|
|
98
|
-
<svg width={size} height={size} viewBox="0 0 256 256" fill="currentColor">
|
|
99
|
-
<path d="M221.66,133.66l-72,72a8,8,0,0,1-11.32-11.32L196.69,136H40a8,8,0,0,1,0-16H196.69L138.34,61.66a8,8,0,0,1,11.32-11.32l72,72A8,8,0,0,1,221.66,133.66Z" />
|
|
100
|
-
</svg>
|
|
101
|
-
);
|
|
102
|
-
|
|
103
|
-
const Cube = ({ size = 16 }: { size?: number }) => (
|
|
104
|
-
<svg width={size} height={size} viewBox="0 0 256 256" fill="currentColor">
|
|
105
|
-
<path d="M223.68,66.15,135.68,18a15.88,15.88,0,0,0-15.36,0l-88,48.17a16,16,0,0,0-8.32,14v95.64a16,16,0,0,0,8.32,14l88,48.17a15.88,15.88,0,0,0,15.36,0l88-48.17a16,16,0,0,0,8.32-14V80.18A16,16,0,0,0,223.68,66.15ZM128,32l80.34,44L128,120,47.66,76ZM40,90l80,43.78v85.79L40,175.82Zm176,85.78h0l-80,43.79V133.82l80-43.78Z" />
|
|
106
|
-
</svg>
|
|
107
|
-
);
|
|
108
|
-
|
|
109
|
-
const XCircle = ({ size = 16 }: { size?: number }) => (
|
|
110
|
-
<svg width={size} height={size} viewBox="0 0 256 256" fill="currentColor">
|
|
111
|
-
<path d="M165.66,101.66,139.31,128l26.35,26.34a8,8,0,0,1-11.32,11.32L128,139.31l-26.34,26.35a8,8,0,0,1-11.32-11.32L116.69,128,90.34,101.66a8,8,0,0,1,11.32-11.32L128,116.69l26.34-26.35a8,8,0,0,1,11.32,11.32ZM232,128A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z" />
|
|
112
|
-
</svg>
|
|
113
|
-
);
|
|
114
|
-
|
|
115
|
-
// ===== COMPONENTE PRINCIPAL =====
|
|
34
|
+
import { InsuranceCardProps, StatusVariant } from './InsuranceCard.types';
|
|
35
|
+
import { RefuseModal } from '../RefuseModal';
|
|
36
|
+
import Pill from '../../atoms/Pill/Pill';
|
|
37
|
+
import { TimelineModal } from '../../organisms/TimelineModal/TimelineModal';
|
|
116
38
|
|
|
117
39
|
export const InsuranceCard: React.FC<InsuranceCardProps> = ({
|
|
118
40
|
idGranto,
|
|
@@ -125,93 +47,87 @@ export const InsuranceCard: React.FC<InsuranceCardProps> = ({
|
|
|
125
47
|
statusVariant,
|
|
126
48
|
seguradoName,
|
|
127
49
|
seguradoCnpj,
|
|
128
|
-
product,
|
|
129
50
|
issuedDate,
|
|
130
51
|
totalValue,
|
|
131
52
|
processId,
|
|
132
53
|
activeIndex,
|
|
133
54
|
testId,
|
|
134
55
|
openCardId,
|
|
135
|
-
|
|
136
|
-
|
|
56
|
+
loadingItem,
|
|
57
|
+
showRefuseModal,
|
|
58
|
+
setShowRefuseModal,
|
|
59
|
+
showExcludeModal,
|
|
60
|
+
setShowExcludeModal,
|
|
61
|
+
showTimeline,
|
|
62
|
+
setShowTimeline,
|
|
63
|
+
timelineItems,
|
|
64
|
+
isTimelineLoading,
|
|
65
|
+
fetchTimeline,
|
|
66
|
+
showTimelineToggle,
|
|
67
|
+
toggleOpen,
|
|
68
|
+
handleClick,
|
|
69
|
+
isAllowedByRoles,
|
|
70
|
+
productTitle,
|
|
71
|
+
productDescription,
|
|
72
|
+
downloadFile,
|
|
73
|
+
searchCerts,
|
|
74
|
+
onEndorsementClick,
|
|
75
|
+
irParaContinuarEmissao,
|
|
76
|
+
abrirModalExcluirProposta,
|
|
77
|
+
fecharModalExclusao,
|
|
78
|
+
confirmarExclusao,
|
|
79
|
+
abrirModalRecusarProposta,
|
|
80
|
+
fecharModalRecusa,
|
|
81
|
+
confirmarRecusa,
|
|
137
82
|
}) => {
|
|
138
|
-
const [loadingItem, setLoadingItem] = useState<string | null>(null);
|
|
139
83
|
const isOpen = openCardId === idOrder;
|
|
140
84
|
|
|
141
|
-
const toggleOpen = () => {
|
|
142
|
-
setOpenCardId(isOpen ? null : idOrder);
|
|
143
|
-
};
|
|
144
|
-
|
|
145
|
-
const handleClick = async (
|
|
146
|
-
key: string,
|
|
147
|
-
callback: () => Promise<void> | void
|
|
148
|
-
) => {
|
|
149
|
-
setLoadingItem(key);
|
|
150
|
-
await Promise.resolve(callback());
|
|
151
|
-
setLoadingItem(null);
|
|
152
|
-
};
|
|
153
|
-
|
|
154
|
-
const [productTitle, productDescription] = formatProduct(product);
|
|
155
|
-
|
|
156
|
-
// Mock das funções (você ajustará quando os hooks existirem)
|
|
157
|
-
const downloadFile = (type: string, flag: boolean) => {
|
|
158
|
-
console.log(`Download ${type}:`, flag);
|
|
159
|
-
};
|
|
160
|
-
|
|
161
|
-
const searchCerts = (insurance: string, order: string) => {
|
|
162
|
-
console.log(`Search certs for ${insurance}, ${order}`);
|
|
163
|
-
};
|
|
164
|
-
|
|
165
|
-
const onEndorsementClick = (company: string, insurance: string) => {
|
|
166
|
-
console.log(`Endorsement for ${company}, ${insurance}`);
|
|
167
|
-
};
|
|
168
|
-
|
|
169
|
-
const irParaContinuarEmissao = () => {
|
|
170
|
-
console.log("Continuar emissão");
|
|
171
|
-
// Implementar navegação quando disponível
|
|
172
|
-
};
|
|
173
|
-
|
|
174
|
-
const abrirModalExcluirProposta = () => {
|
|
175
|
-
console.log("Abrir modal excluir");
|
|
176
|
-
// Modal será implementado depois
|
|
177
|
-
};
|
|
178
|
-
|
|
179
|
-
const abrirModalRecusarProposta = () => {
|
|
180
|
-
console.log("Abrir modal recusar");
|
|
181
|
-
// Modal será implementado depois
|
|
182
|
-
};
|
|
183
|
-
|
|
184
85
|
return (
|
|
185
86
|
<CardContainer
|
|
186
87
|
data-testid={testId}
|
|
187
88
|
id={testId}
|
|
188
89
|
$variant={statusVariant as StatusVariant}
|
|
189
90
|
>
|
|
91
|
+
<ExcludeModal
|
|
92
|
+
open={showExcludeModal}
|
|
93
|
+
onOpenChange={setShowExcludeModal}
|
|
94
|
+
onConfirm={confirmarExclusao}
|
|
95
|
+
onClose={fecharModalExclusao}
|
|
96
|
+
orderId={idGranto}
|
|
97
|
+
/>
|
|
98
|
+
<RefuseModal
|
|
99
|
+
open={showRefuseModal}
|
|
100
|
+
onOpenChange={setShowRefuseModal}
|
|
101
|
+
onConfirm={confirmarRecusa}
|
|
102
|
+
onClose={fecharModalRecusa}
|
|
103
|
+
orderId={idGranto}
|
|
104
|
+
/>
|
|
105
|
+
<TimelineModal
|
|
106
|
+
open={showTimeline}
|
|
107
|
+
onOpenChange={setShowTimeline}
|
|
108
|
+
onClose={() => setShowTimeline(false)}
|
|
109
|
+
data={timelineItems}
|
|
110
|
+
loading={isTimelineLoading}
|
|
111
|
+
onRetry={() => fetchTimeline(idOrder)}
|
|
112
|
+
/>
|
|
190
113
|
<HeaderRow>
|
|
191
114
|
{isSupply && (
|
|
192
|
-
<Pill size={
|
|
115
|
+
<Pill size={'sm'} variant="supply">
|
|
193
116
|
<Cube />
|
|
194
|
-
|
|
117
|
+
Suppliers
|
|
195
118
|
</Pill>
|
|
196
119
|
)}
|
|
197
120
|
<Text>ID Granto: {idGranto}</Text>
|
|
198
121
|
<Text>ID interno: {idInterno}</Text>
|
|
199
122
|
<Text $variant={statusVariant as StatusVariant}>
|
|
200
|
-
{activeIndex === 0 ?
|
|
123
|
+
{activeIndex === 0 ? 'Etapa' : 'Status'}: {statusLabel}
|
|
201
124
|
</Text>
|
|
202
125
|
</HeaderRow>
|
|
203
126
|
<BodyRow>
|
|
204
127
|
<InfoRow>
|
|
205
128
|
<InfoLabel>Segurado</InfoLabel>
|
|
206
129
|
<TruncatedValue>{seguradoName}</TruncatedValue>
|
|
207
|
-
<InfoSubValue>
|
|
208
|
-
{applyMask(
|
|
209
|
-
seguradoCnpj,
|
|
210
|
-
isValidCNPJ(seguradoCnpj)
|
|
211
|
-
? "00.000.000/0000-00"
|
|
212
|
-
: "000.000.000-00"
|
|
213
|
-
)}
|
|
214
|
-
</InfoSubValue>
|
|
130
|
+
<InfoSubValue>{seguradoCnpj}</InfoSubValue>
|
|
215
131
|
</InfoRow>
|
|
216
132
|
<InfoRow>
|
|
217
133
|
<InfoLabel>Produto</InfoLabel>
|
|
@@ -220,103 +136,124 @@ export const InsuranceCard: React.FC<InsuranceCardProps> = ({
|
|
|
220
136
|
</InfoRow>
|
|
221
137
|
<InfoRow>
|
|
222
138
|
<InfoLabel>
|
|
223
|
-
{activeIndex === 0 ?
|
|
139
|
+
{activeIndex === 0 ? 'Iniciado em' : 'Emitido em'}
|
|
224
140
|
</InfoLabel>
|
|
225
|
-
<
|
|
141
|
+
<InfoValue>{issuedDate}</InfoValue>
|
|
226
142
|
</InfoRow>
|
|
227
143
|
<InfoRow>
|
|
228
144
|
<InfoLabel>
|
|
229
|
-
{
|
|
145
|
+
{' '}
|
|
146
|
+
{activeIndex === 0 ? 'Valor a ser pago' : 'Valor pago'}
|
|
230
147
|
</InfoLabel>
|
|
231
|
-
<
|
|
148
|
+
<InfoValue>{totalValue}</InfoValue>
|
|
232
149
|
</InfoRow>
|
|
233
150
|
<InfoRow>
|
|
234
151
|
<InfoLabel>Processo</InfoLabel>
|
|
235
|
-
<ProcessValue>
|
|
236
|
-
{processId
|
|
237
|
-
? applyMask(processId || "", "0000000-00.0000.0.00.0000")
|
|
238
|
-
: "-"}
|
|
239
|
-
</ProcessValue>
|
|
152
|
+
<ProcessValue>{processId}</ProcessValue>
|
|
240
153
|
</InfoRow>
|
|
241
154
|
<Actions>
|
|
242
155
|
<DropdownWrapper>
|
|
243
156
|
<ActionButton
|
|
244
157
|
data-testid={`btn_minhas_emissoes_mais_informacoes_${processId}`}
|
|
245
158
|
id={`btn_minhas_emissoes_mais_informacoes_${processId}`}
|
|
246
|
-
onClick={toggleOpen}
|
|
159
|
+
onClick={() => toggleOpen?.(idOrder)}
|
|
247
160
|
>
|
|
248
|
-
Mais informações{
|
|
161
|
+
Mais informações{' '}
|
|
249
162
|
{isOpen ? <ChevronUp size={16} /> : <ChevronDown size={16} />}
|
|
250
163
|
</ActionButton>
|
|
251
164
|
{isOpen && activeIndex === 0 && (
|
|
252
165
|
<DropdownMenu>
|
|
166
|
+
<MenuItem
|
|
167
|
+
data-testid={`btn_minhas_linha_do_tempo_${processId}`}
|
|
168
|
+
id={`btn_minhas_linha_do_tempo_${processId}`}
|
|
169
|
+
icon={
|
|
170
|
+
loadingItem === 'linha_do_tempo' || isTimelineLoading ? (
|
|
171
|
+
<Loader2 className="mr-2 h-5 w-5 animate-spin" />
|
|
172
|
+
) : (
|
|
173
|
+
<FlowArrow size={16} />
|
|
174
|
+
)
|
|
175
|
+
}
|
|
176
|
+
onClick={() =>
|
|
177
|
+
handleClick?.('linha_do_tempo', showTimelineToggle)
|
|
178
|
+
}
|
|
179
|
+
>
|
|
180
|
+
Linha do tempo
|
|
181
|
+
</MenuItem>
|
|
253
182
|
<MenuItem
|
|
254
183
|
data-testid={`btn_minhas_emissoes_continuar_emissao_${processId}`}
|
|
255
184
|
id={`btn_minhas_emissoes_continuar_emissao_${processId}`}
|
|
256
185
|
icon={
|
|
257
|
-
loadingItem ===
|
|
186
|
+
loadingItem === 'continuar_emissao' ? (
|
|
258
187
|
<Loader2 className="mr-2 h-5 w-5 animate-spin" />
|
|
259
188
|
) : (
|
|
260
189
|
<ArrowCircleUpRight size={16} />
|
|
261
190
|
)
|
|
262
191
|
}
|
|
263
192
|
onClick={() =>
|
|
264
|
-
handleClick(
|
|
193
|
+
handleClick?.('continuar_emissao', () =>
|
|
194
|
+
irParaContinuarEmissao(idOrder)
|
|
195
|
+
)
|
|
265
196
|
}
|
|
266
197
|
>
|
|
267
198
|
Continuar emissão
|
|
268
199
|
</MenuItem>
|
|
269
|
-
{hasMinute && (
|
|
200
|
+
{hasMinute && isAllowedByRoles('user') && (
|
|
270
201
|
<MenuItem
|
|
271
202
|
data-testid={`btn_minhas_emissoes_baixar_minuta_${processId}`}
|
|
272
203
|
id={`btn_minhas_emissoes_baixar_minuta_${processId}`}
|
|
273
204
|
icon={
|
|
274
|
-
loadingItem ===
|
|
205
|
+
loadingItem === 'minuta' ? (
|
|
275
206
|
<Loader2 className="mr-2 h-5 w-5 animate-spin" />
|
|
276
207
|
) : (
|
|
277
208
|
<Download size={16} />
|
|
278
209
|
)
|
|
279
210
|
}
|
|
280
211
|
onClick={() =>
|
|
281
|
-
handleClick(
|
|
212
|
+
handleClick?.('minuta', () =>
|
|
213
|
+
downloadFile('MINUTE', 'true')
|
|
214
|
+
)
|
|
282
215
|
}
|
|
283
216
|
>
|
|
284
217
|
Baixar minuta
|
|
285
218
|
</MenuItem>
|
|
286
219
|
)}
|
|
287
|
-
{statusLabel ===
|
|
220
|
+
{statusLabel === 'Aguardando aprovação' && (
|
|
288
221
|
<MenuItem
|
|
289
222
|
danger
|
|
290
223
|
data-testid={`btn_minhas_emissoes_recusar_proposta_${processId}`}
|
|
291
224
|
id={`btn_minhas_emissoes_recusar_proposta_${processId}`}
|
|
292
225
|
icon={
|
|
293
|
-
loadingItem ===
|
|
226
|
+
loadingItem === 'recusar_proposta' ? (
|
|
294
227
|
<Loader2 className="mr-2 h-5 w-5 animate-spin" />
|
|
295
228
|
) : (
|
|
296
229
|
<XCircle size={16} />
|
|
297
230
|
)
|
|
298
231
|
}
|
|
299
232
|
onClick={() =>
|
|
300
|
-
handleClick(
|
|
233
|
+
handleClick?.('recusar_proposta', () =>
|
|
234
|
+
abrirModalRecusarProposta(idOrder)
|
|
235
|
+
)
|
|
301
236
|
}
|
|
302
237
|
>
|
|
303
238
|
Recusar proposta
|
|
304
239
|
</MenuItem>
|
|
305
240
|
)}
|
|
306
|
-
{statusLabel ===
|
|
241
|
+
{statusLabel === 'Proposta recusada' && (
|
|
307
242
|
<MenuItem
|
|
308
243
|
danger
|
|
309
244
|
data-testid={`btn_minhas_emissoes_excluir_proposta_${processId}`}
|
|
310
245
|
id={`btn_minhas_emissoes_excluir_proposta_${processId}`}
|
|
311
246
|
icon={
|
|
312
|
-
loadingItem ===
|
|
247
|
+
loadingItem === 'excluir_proposta' ? (
|
|
313
248
|
<Loader2 className="mr-2 h-5 w-5 animate-spin" />
|
|
314
249
|
) : (
|
|
315
250
|
<XCircle size={16} />
|
|
316
251
|
)
|
|
317
252
|
}
|
|
318
253
|
onClick={() =>
|
|
319
|
-
handleClick(
|
|
254
|
+
handleClick?.('excluir_proposta', () =>
|
|
255
|
+
abrirModalExcluirProposta(idOrder)
|
|
256
|
+
)
|
|
320
257
|
}
|
|
321
258
|
>
|
|
322
259
|
Excluir proposta
|
|
@@ -326,18 +263,36 @@ export const InsuranceCard: React.FC<InsuranceCardProps> = ({
|
|
|
326
263
|
)}
|
|
327
264
|
{isOpen && activeIndex === 1 && (
|
|
328
265
|
<DropdownMenu>
|
|
266
|
+
<MenuItem
|
|
267
|
+
data-testid={`btn_minhas_linha_do_tempo_${processId}`}
|
|
268
|
+
id={`btn_minhas_linha_do_tempo_${processId}`}
|
|
269
|
+
icon={
|
|
270
|
+
loadingItem === 'linha_do_tempo' || isTimelineLoading ? (
|
|
271
|
+
<Loader2 className="mr-2 h-5 w-5 animate-spin" />
|
|
272
|
+
) : (
|
|
273
|
+
<FlowArrow size={16} />
|
|
274
|
+
)
|
|
275
|
+
}
|
|
276
|
+
onClick={() =>
|
|
277
|
+
handleClick?.('linha_do_tempo', showTimelineToggle)
|
|
278
|
+
}
|
|
279
|
+
>
|
|
280
|
+
Linha do tempo
|
|
281
|
+
</MenuItem>
|
|
329
282
|
<MenuItem
|
|
330
283
|
data-testid={`btn_minhas_emissoes_baixar_apolice_${processId}`}
|
|
331
284
|
id={`btn_minhas_emissoes_baixar_apolice_${processId}`}
|
|
332
285
|
icon={
|
|
333
|
-
loadingItem ===
|
|
286
|
+
loadingItem === 'apolice' ? (
|
|
334
287
|
<Loader2 className="mr-2 h-5 w-5 animate-spin" />
|
|
335
288
|
) : (
|
|
336
289
|
<FileText size={16} />
|
|
337
290
|
)
|
|
338
291
|
}
|
|
339
292
|
onClick={() =>
|
|
340
|
-
handleClick(
|
|
293
|
+
handleClick?.('apolice', () =>
|
|
294
|
+
downloadFile('POLICY', 'true')
|
|
295
|
+
)
|
|
341
296
|
}
|
|
342
297
|
>
|
|
343
298
|
Baixar apólice
|
|
@@ -346,14 +301,14 @@ export const InsuranceCard: React.FC<InsuranceCardProps> = ({
|
|
|
346
301
|
data-testid={`btn_minhas_emissoes_baixar_boleto_${processId}`}
|
|
347
302
|
id={`btn_minhas_emissoes_baixar_boleto_${processId}`}
|
|
348
303
|
icon={
|
|
349
|
-
loadingItem ===
|
|
304
|
+
loadingItem === 'boleto' ? (
|
|
350
305
|
<Loader2 className="mr-2 h-5 w-5 animate-spin" />
|
|
351
306
|
) : (
|
|
352
307
|
<CreditCard size={16} />
|
|
353
308
|
)
|
|
354
309
|
}
|
|
355
310
|
onClick={() =>
|
|
356
|
-
handleClick(
|
|
311
|
+
handleClick?.('boleto', () => downloadFile('SLIP', 'true'))
|
|
357
312
|
}
|
|
358
313
|
>
|
|
359
314
|
Baixar boleto
|
|
@@ -362,16 +317,14 @@ export const InsuranceCard: React.FC<InsuranceCardProps> = ({
|
|
|
362
317
|
data-testid={`btn_minhas_emissoes_baixar_certidoes_${processId}`}
|
|
363
318
|
id={`btn_minhas_emissoes_baixar_certidoes_${processId}`}
|
|
364
319
|
icon={
|
|
365
|
-
loadingItem ===
|
|
320
|
+
loadingItem === 'certidoes' ? (
|
|
366
321
|
<Loader2 className="mr-2 h-5 w-5 animate-spin" />
|
|
367
322
|
) : (
|
|
368
323
|
<Download size={16} />
|
|
369
324
|
)
|
|
370
325
|
}
|
|
371
326
|
onClick={() =>
|
|
372
|
-
handleClick(
|
|
373
|
-
searchCerts(idInsurance!, idOrder)
|
|
374
|
-
)
|
|
327
|
+
handleClick?.('certidoes', () => searchCerts(idInsurance!))
|
|
375
328
|
}
|
|
376
329
|
>
|
|
377
330
|
Baixar certidões
|
|
@@ -380,15 +333,15 @@ export const InsuranceCard: React.FC<InsuranceCardProps> = ({
|
|
|
380
333
|
data-testid={`btn_minhas_emissoes_solicitar_endosso_${processId}`}
|
|
381
334
|
id={`btn_minhas_emissoes_solicitar_endosso_${processId}`}
|
|
382
335
|
icon={
|
|
383
|
-
loadingItem ===
|
|
336
|
+
loadingItem === 'endosso' ? (
|
|
384
337
|
<Loader2 className="mr-2 h-5 w-5 animate-spin" />
|
|
385
338
|
) : (
|
|
386
339
|
<PlusCircle size={16} />
|
|
387
340
|
)
|
|
388
341
|
}
|
|
389
342
|
onClick={() =>
|
|
390
|
-
handleClick(
|
|
391
|
-
onEndorsementClick(
|
|
343
|
+
handleClick?.('endosso', () =>
|
|
344
|
+
onEndorsementClick(idInsurance!)
|
|
392
345
|
)
|
|
393
346
|
}
|
|
394
347
|
>
|
|
@@ -415,4 +368,4 @@ const MenuItem: React.FC<MenuItemProps> = ({
|
|
|
415
368
|
{children}
|
|
416
369
|
</StyledMenuItem>
|
|
417
370
|
);
|
|
418
|
-
};
|
|
371
|
+
};
|
|
@@ -1,32 +1,55 @@
|
|
|
1
|
-
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
export type StatusVariant = 'primary' | 'success' | 'warning' | 'danger';
|
|
2
3
|
|
|
3
4
|
export interface InsuranceCardProps {
|
|
4
5
|
idGranto: string;
|
|
6
|
+
idInterno: string;
|
|
5
7
|
idOrder: string;
|
|
6
8
|
idInsurance?: string;
|
|
7
|
-
idInterno: string;
|
|
8
9
|
isSupply: boolean;
|
|
9
|
-
hasMinute
|
|
10
|
+
hasMinute?: boolean;
|
|
10
11
|
statusLabel: string;
|
|
11
|
-
statusVariant:
|
|
12
|
+
statusVariant: string;
|
|
12
13
|
seguradoName: string;
|
|
13
14
|
seguradoCnpj: string;
|
|
14
15
|
product: string;
|
|
15
16
|
issuedDate: string;
|
|
16
17
|
totalValue: string;
|
|
17
|
-
processId
|
|
18
|
-
activeIndex
|
|
18
|
+
processId: string;
|
|
19
|
+
activeIndex?: number;
|
|
19
20
|
testId?: string;
|
|
20
21
|
openCardId: string | null;
|
|
21
22
|
setOpenCardId: (id: string | null) => void;
|
|
22
23
|
runQuery: () => void;
|
|
24
|
+
loadingItem: string | null;
|
|
25
|
+
setLoadingItem: (id: string | null) => void;
|
|
26
|
+
showRefuseModal: boolean;
|
|
27
|
+
setShowRefuseModal: (value: boolean) => void;
|
|
28
|
+
showExcludeModal: boolean;
|
|
29
|
+
setShowExcludeModal: (value: boolean) => void;
|
|
30
|
+
showTimeline: boolean;
|
|
31
|
+
setShowTimeline: (value: boolean) => void;
|
|
32
|
+
timelineItems: any[];
|
|
33
|
+
setTimelineItems: (items: any[]) => void;
|
|
34
|
+
isTimelineLoading: boolean;
|
|
35
|
+
fetchTimeline: (idOrder: string) => Promise<void>;
|
|
36
|
+
showTimelineToggle: () => void;
|
|
37
|
+
toggleOpen: (idOrder: string) => void;
|
|
38
|
+
productTitle?: string;
|
|
39
|
+
productDescription?: string;
|
|
40
|
+
downloadFile: (fileUrl: string, fileName: string) => void;
|
|
41
|
+
searchCerts: (idOrder: string) => void;
|
|
42
|
+
onEndorsementClick: (idOrder: string) => void;
|
|
43
|
+
mutateStageOrder: (idOrder: string, stage: string) => Promise<void>;
|
|
44
|
+
setData: (data: any) => void;
|
|
45
|
+
queryClient: any;
|
|
46
|
+
irParaContinuarEmissao: (idOrder: string) => void;
|
|
47
|
+
abrirModalExcluirProposta: (idOrder: string) => void;
|
|
48
|
+
fecharModalExclusao: () => void;
|
|
49
|
+
confirmarExclusao: () => Promise<void>;
|
|
50
|
+
abrirModalRecusarProposta: (idOrder: string) => void;
|
|
51
|
+
fecharModalRecusa: () => void;
|
|
52
|
+
confirmarRecusa: () => Promise<void>;
|
|
53
|
+
handleClick?: (value: string, callback: () => void) => void;
|
|
54
|
+
isAllowedByRoles?: any;
|
|
23
55
|
}
|
|
24
|
-
|
|
25
|
-
export interface MenuItemProps {
|
|
26
|
-
icon: React.ReactNode;
|
|
27
|
-
danger?: boolean;
|
|
28
|
-
children: React.ReactNode;
|
|
29
|
-
onClick?: () => void;
|
|
30
|
-
id?: string;
|
|
31
|
-
"data-testid"?: string;
|
|
32
|
-
}
|
package/src/index.ts
CHANGED
|
@@ -33,7 +33,7 @@ import { ResendLink } from './components/atoms/ResendLink';
|
|
|
33
33
|
import Select from './components/atoms/Select';
|
|
34
34
|
import { Subtitle } from './components/atoms/Subtitle';
|
|
35
35
|
import Switch from './components/atoms/Switch/Switch';
|
|
36
|
-
import { Tapbar } from './components/atoms/
|
|
36
|
+
import { Tapbar } from './components/atoms/TabBar';
|
|
37
37
|
import Text from './components/atoms/Text';
|
|
38
38
|
import Textarea from './components/atoms/Textarea/Textarea';
|
|
39
39
|
import { Title } from './components/atoms/Title';
|
|
File without changes
|
|
File without changes
|