@granto-umbrella/umbrella-components 3.0.28 → 3.0.30
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 +35845 -34808
- package/dist/umbrella-components.umd.js +1234 -971
- package/package.json +3 -2
- 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 +199 -161
- package/src/components/molecules/InsuranceCard/InsuranceCard.types.ts +12 -4
- 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,118 +1,45 @@
|
|
|
1
|
-
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
import { cnpj } from 'cpf-cnpj-validator';
|
|
3
|
+
import { format, parseISO } from 'date-fns';
|
|
2
4
|
import {
|
|
3
|
-
FileText,
|
|
4
|
-
CreditCard,
|
|
5
|
-
Download,
|
|
6
|
-
PlusCircle,
|
|
7
5
|
ChevronDown,
|
|
8
6
|
ChevronUp,
|
|
7
|
+
CreditCard,
|
|
8
|
+
Download,
|
|
9
|
+
FileText,
|
|
9
10
|
Loader2,
|
|
10
|
-
|
|
11
|
+
PlusCircle,
|
|
12
|
+
} from 'lucide-react';
|
|
13
|
+
import mask from 'make-mask';
|
|
14
|
+
import { ArrowCircleUpRight, Cube, FlowArrow, XCircle } from 'phosphor-react';
|
|
15
|
+
import React, { useState } from 'react';
|
|
16
|
+
import { useNavigate } from 'react-router-dom';
|
|
17
|
+
|
|
18
|
+
import Pill from '../../atoms/Pill/Pill';
|
|
19
|
+
import { mapRemoteToTimeline } from '../../molecules/TimeLine/TimeLine.mapper';
|
|
20
|
+
import { TimelineModal } from '../../organisms/TimelineModal/TimelineModal';
|
|
21
|
+
import { ExcludeModal } from '../ExcludeModal';
|
|
22
|
+
import { RefuseModal } from '../RefuseModal';
|
|
11
23
|
import {
|
|
24
|
+
ActionButton,
|
|
25
|
+
Actions,
|
|
26
|
+
BodyRow,
|
|
12
27
|
CardContainer,
|
|
28
|
+
DropdownMenu,
|
|
29
|
+
DropdownWrapper,
|
|
13
30
|
HeaderRow,
|
|
14
|
-
InfoRow,
|
|
15
31
|
InfoLabel,
|
|
16
|
-
|
|
17
|
-
Actions,
|
|
18
|
-
DropdownWrapper,
|
|
19
|
-
DropdownMenu,
|
|
20
|
-
StyledMenuItem,
|
|
21
|
-
Text,
|
|
22
|
-
BodyRow,
|
|
32
|
+
InfoRow,
|
|
23
33
|
InfoSubValue,
|
|
24
|
-
|
|
34
|
+
InfoValue,
|
|
35
|
+
MenuItemProps,
|
|
25
36
|
ProcessValue,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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
|
-
|
|
66
|
-
|
|
67
|
-
const product_list = [
|
|
68
|
-
{ value: "001", label: "Seguro Garantia" },
|
|
69
|
-
{ value: "002", label: "Seguro Fiança" },
|
|
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 =====
|
|
37
|
+
ProdValue,
|
|
38
|
+
StyledMenuItem,
|
|
39
|
+
Text,
|
|
40
|
+
TruncatedValue,
|
|
41
|
+
} from './InsuranceCard.styles';
|
|
42
|
+
import { InsuranceCardProps, StatusVariant } from './InsuranceCard.types';
|
|
116
43
|
|
|
117
44
|
export const InsuranceCard: React.FC<InsuranceCardProps> = ({
|
|
118
45
|
idGranto,
|
|
@@ -133,9 +60,46 @@ export const InsuranceCard: React.FC<InsuranceCardProps> = ({
|
|
|
133
60
|
testId,
|
|
134
61
|
openCardId,
|
|
135
62
|
setOpenCardId,
|
|
136
|
-
|
|
63
|
+
runQuery,
|
|
64
|
+
useDownloadAndSupport,
|
|
65
|
+
useDownloadFile,
|
|
66
|
+
useChangeOrderStageAsync,
|
|
67
|
+
useMyStore,
|
|
68
|
+
useQueryClient,
|
|
69
|
+
useGetTimeline,
|
|
70
|
+
useAuthStoreV2,
|
|
137
71
|
}) => {
|
|
72
|
+
const navigate = useNavigate();
|
|
138
73
|
const [loadingItem, setLoadingItem] = useState<string | null>(null);
|
|
74
|
+
const [showRefuseModal, setShowRefuseModal] = useState(false);
|
|
75
|
+
const [showExcludeModal, setShowExcludeModal] = useState(false);
|
|
76
|
+
const [showTimeline, setShowTimeline] = useState(false);
|
|
77
|
+
const [timelineItems, setTimelineItems] = useState<
|
|
78
|
+
ReturnType<typeof mapRemoteToTimeline>
|
|
79
|
+
>([]);
|
|
80
|
+
const { isLoading: isTimelineLoading, refetch: fetchTimeline } =
|
|
81
|
+
useGetTimeline({ orderId: idOrder, insuranceId: idInsurance });
|
|
82
|
+
|
|
83
|
+
const showTimelineToggle = async () => {
|
|
84
|
+
const willOpen = !showTimeline;
|
|
85
|
+
|
|
86
|
+
if (willOpen && (!timelineItems || timelineItems.length === 0)) {
|
|
87
|
+
setLoadingItem('linha_do_tempo');
|
|
88
|
+
setShowTimeline(true);
|
|
89
|
+
try {
|
|
90
|
+
const { data: remote } = await fetchTimeline();
|
|
91
|
+
setTimelineItems(mapRemoteToTimeline(remote ?? []));
|
|
92
|
+
} catch (err) {
|
|
93
|
+
console.error('Falha ao carregar timeline', err);
|
|
94
|
+
} finally {
|
|
95
|
+
setLoadingItem(null);
|
|
96
|
+
}
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
setShowTimeline(willOpen);
|
|
101
|
+
};
|
|
102
|
+
|
|
139
103
|
const isOpen = openCardId === idOrder;
|
|
140
104
|
|
|
141
105
|
const toggleOpen = () => {
|
|
@@ -151,34 +115,53 @@ export const InsuranceCard: React.FC<InsuranceCardProps> = ({
|
|
|
151
115
|
setLoadingItem(null);
|
|
152
116
|
};
|
|
153
117
|
|
|
154
|
-
const
|
|
118
|
+
const { isAllowedByRoles } = useAuthStoreV2();
|
|
155
119
|
|
|
156
|
-
|
|
157
|
-
const downloadFile = (type: string, flag: boolean) => {
|
|
158
|
-
console.log(`Download ${type}:`, flag);
|
|
159
|
-
};
|
|
120
|
+
const [productTitle, productDescription] = product;
|
|
160
121
|
|
|
161
|
-
const searchCerts = (
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
const
|
|
166
|
-
console.log(`Endorsement for ${company}, ${insurance}`);
|
|
167
|
-
};
|
|
122
|
+
const { downloadFile, searchCerts } = useDownloadFile(idOrder);
|
|
123
|
+
const { onEndorsementClick } = useDownloadAndSupport();
|
|
124
|
+
const mutateStageOrder = useChangeOrderStageAsync();
|
|
125
|
+
const { setData } = useMyStore();
|
|
126
|
+
const queryClient = useQueryClient();
|
|
168
127
|
|
|
169
128
|
const irParaContinuarEmissao = () => {
|
|
170
|
-
|
|
171
|
-
|
|
129
|
+
const stateData = idInsurance
|
|
130
|
+
? { idInsurance, isSupply }
|
|
131
|
+
: { idOrder, isSupply };
|
|
132
|
+
if (
|
|
133
|
+
statusLabel === 'Proposta recusada' ||
|
|
134
|
+
statusLabel === 'Proposta excluída'
|
|
135
|
+
) {
|
|
136
|
+
mutateStageOrder.mutateAsync(
|
|
137
|
+
{
|
|
138
|
+
id: idGranto,
|
|
139
|
+
newStage: 'IDLE',
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
onSuccess: () => {
|
|
143
|
+
queryClient.invalidateQueries({ queryKey: ['orders'] });
|
|
144
|
+
},
|
|
145
|
+
}
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
navigate('/issue', { state: stateData });
|
|
149
|
+
|
|
150
|
+
setData({});
|
|
172
151
|
};
|
|
152
|
+
const abrirModalExcluirProposta = () => setShowExcludeModal(true);
|
|
153
|
+
const fecharModalExclusao = () => setShowExcludeModal(false);
|
|
173
154
|
|
|
174
|
-
const
|
|
175
|
-
|
|
176
|
-
|
|
155
|
+
const confirmarExclusao = () => {
|
|
156
|
+
runQuery();
|
|
157
|
+
fecharModalExclusao();
|
|
177
158
|
};
|
|
159
|
+
const abrirModalRecusarProposta = () => setShowRefuseModal(true);
|
|
160
|
+
const fecharModalRecusa = () => setShowRefuseModal(false);
|
|
178
161
|
|
|
179
|
-
const
|
|
180
|
-
|
|
181
|
-
|
|
162
|
+
const confirmarRecusa = () => {
|
|
163
|
+
runQuery();
|
|
164
|
+
fecharModalRecusa();
|
|
182
165
|
};
|
|
183
166
|
|
|
184
167
|
return (
|
|
@@ -187,17 +170,39 @@ export const InsuranceCard: React.FC<InsuranceCardProps> = ({
|
|
|
187
170
|
id={testId}
|
|
188
171
|
$variant={statusVariant as StatusVariant}
|
|
189
172
|
>
|
|
173
|
+
<ExcludeModal
|
|
174
|
+
open={showExcludeModal}
|
|
175
|
+
onOpenChange={setShowExcludeModal}
|
|
176
|
+
onConfirm={confirmarExclusao}
|
|
177
|
+
onClose={fecharModalExclusao}
|
|
178
|
+
orderId={idGranto}
|
|
179
|
+
/>
|
|
180
|
+
<RefuseModal
|
|
181
|
+
open={showRefuseModal}
|
|
182
|
+
onOpenChange={setShowRefuseModal}
|
|
183
|
+
onConfirm={confirmarRecusa}
|
|
184
|
+
onClose={fecharModalRecusa}
|
|
185
|
+
orderId={idGranto}
|
|
186
|
+
/>
|
|
187
|
+
<TimelineModal
|
|
188
|
+
open={showTimeline}
|
|
189
|
+
onOpenChange={setShowTimeline}
|
|
190
|
+
onClose={() => setShowTimeline(false)}
|
|
191
|
+
data={timelineItems}
|
|
192
|
+
loading={isTimelineLoading}
|
|
193
|
+
onRetry={fetchTimeline}
|
|
194
|
+
/>
|
|
190
195
|
<HeaderRow>
|
|
191
196
|
{isSupply && (
|
|
192
|
-
<Pill size={
|
|
197
|
+
<Pill size={'sm'} variant="supply">
|
|
193
198
|
<Cube />
|
|
194
|
-
|
|
199
|
+
Suppliers
|
|
195
200
|
</Pill>
|
|
196
201
|
)}
|
|
197
202
|
<Text>ID Granto: {idGranto}</Text>
|
|
198
203
|
<Text>ID interno: {idInterno}</Text>
|
|
199
204
|
<Text $variant={statusVariant as StatusVariant}>
|
|
200
|
-
{activeIndex === 0 ?
|
|
205
|
+
{activeIndex === 0 ? 'Etapa' : 'Status'}: {statusLabel}
|
|
201
206
|
</Text>
|
|
202
207
|
</HeaderRow>
|
|
203
208
|
<BodyRow>
|
|
@@ -205,11 +210,11 @@ export const InsuranceCard: React.FC<InsuranceCardProps> = ({
|
|
|
205
210
|
<InfoLabel>Segurado</InfoLabel>
|
|
206
211
|
<TruncatedValue>{seguradoName}</TruncatedValue>
|
|
207
212
|
<InfoSubValue>
|
|
208
|
-
{
|
|
213
|
+
{mask(
|
|
209
214
|
seguradoCnpj,
|
|
210
|
-
|
|
211
|
-
?
|
|
212
|
-
:
|
|
215
|
+
cnpj.isValid(seguradoCnpj)
|
|
216
|
+
? '00.000.000/0000-00'
|
|
217
|
+
: '000.000.000-00'
|
|
213
218
|
)}
|
|
214
219
|
</InfoSubValue>
|
|
215
220
|
</InfoRow>
|
|
@@ -220,22 +225,23 @@ export const InsuranceCard: React.FC<InsuranceCardProps> = ({
|
|
|
220
225
|
</InfoRow>
|
|
221
226
|
<InfoRow>
|
|
222
227
|
<InfoLabel>
|
|
223
|
-
{activeIndex === 0 ?
|
|
228
|
+
{activeIndex === 0 ? 'Iniciado em' : 'Emitido em'}
|
|
224
229
|
</InfoLabel>
|
|
225
|
-
<
|
|
230
|
+
<InfoValue>{format(parseISO(issuedDate), 'dd/MM/yyyy')}</InfoValue>
|
|
226
231
|
</InfoRow>
|
|
227
232
|
<InfoRow>
|
|
228
233
|
<InfoLabel>
|
|
229
|
-
{
|
|
234
|
+
{' '}
|
|
235
|
+
{activeIndex === 0 ? 'Valor a ser pago' : 'Valor pago'}
|
|
230
236
|
</InfoLabel>
|
|
231
|
-
<
|
|
237
|
+
<InfoValue>{totalValue}</InfoValue>
|
|
232
238
|
</InfoRow>
|
|
233
239
|
<InfoRow>
|
|
234
240
|
<InfoLabel>Processo</InfoLabel>
|
|
235
241
|
<ProcessValue>
|
|
236
242
|
{processId
|
|
237
|
-
?
|
|
238
|
-
:
|
|
243
|
+
? mask(processId || '', '0000000-00.0000.0.00.0000')
|
|
244
|
+
: '-'}
|
|
239
245
|
</ProcessValue>
|
|
240
246
|
</InfoRow>
|
|
241
247
|
<Actions>
|
|
@@ -245,78 +251,94 @@ export const InsuranceCard: React.FC<InsuranceCardProps> = ({
|
|
|
245
251
|
id={`btn_minhas_emissoes_mais_informacoes_${processId}`}
|
|
246
252
|
onClick={toggleOpen}
|
|
247
253
|
>
|
|
248
|
-
Mais informações{
|
|
254
|
+
Mais informações{' '}
|
|
249
255
|
{isOpen ? <ChevronUp size={16} /> : <ChevronDown size={16} />}
|
|
250
256
|
</ActionButton>
|
|
251
257
|
{isOpen && activeIndex === 0 && (
|
|
252
258
|
<DropdownMenu>
|
|
259
|
+
<MenuItem
|
|
260
|
+
data-testid={`btn_minhas_linha_do_tempo_${processId}`}
|
|
261
|
+
id={`btn_minhas_linha_do_tempo_${processId}`}
|
|
262
|
+
icon={
|
|
263
|
+
loadingItem === 'linha_do_tempo' || isTimelineLoading ? (
|
|
264
|
+
<Loader2 className="mr-2 h-5 w-5 animate-spin" />
|
|
265
|
+
) : (
|
|
266
|
+
<FlowArrow size={16} />
|
|
267
|
+
)
|
|
268
|
+
}
|
|
269
|
+
onClick={() =>
|
|
270
|
+
handleClick('linha_do_tempo', showTimelineToggle)
|
|
271
|
+
}
|
|
272
|
+
>
|
|
273
|
+
Linha do tempo
|
|
274
|
+
</MenuItem>
|
|
253
275
|
<MenuItem
|
|
254
276
|
data-testid={`btn_minhas_emissoes_continuar_emissao_${processId}`}
|
|
255
277
|
id={`btn_minhas_emissoes_continuar_emissao_${processId}`}
|
|
256
278
|
icon={
|
|
257
|
-
loadingItem ===
|
|
279
|
+
loadingItem === 'continuar_emissao' ? (
|
|
258
280
|
<Loader2 className="mr-2 h-5 w-5 animate-spin" />
|
|
259
281
|
) : (
|
|
260
282
|
<ArrowCircleUpRight size={16} />
|
|
261
283
|
)
|
|
262
284
|
}
|
|
263
285
|
onClick={() =>
|
|
264
|
-
handleClick(
|
|
286
|
+
handleClick('continuar_emissao', irParaContinuarEmissao)
|
|
265
287
|
}
|
|
266
288
|
>
|
|
267
289
|
Continuar emissão
|
|
268
290
|
</MenuItem>
|
|
269
|
-
{hasMinute && (
|
|
291
|
+
{hasMinute && isAllowedByRoles('user') && (
|
|
270
292
|
<MenuItem
|
|
271
293
|
data-testid={`btn_minhas_emissoes_baixar_minuta_${processId}`}
|
|
272
294
|
id={`btn_minhas_emissoes_baixar_minuta_${processId}`}
|
|
273
295
|
icon={
|
|
274
|
-
loadingItem ===
|
|
296
|
+
loadingItem === 'minuta' ? (
|
|
275
297
|
<Loader2 className="mr-2 h-5 w-5 animate-spin" />
|
|
276
298
|
) : (
|
|
277
299
|
<Download size={16} />
|
|
278
300
|
)
|
|
279
301
|
}
|
|
280
302
|
onClick={() =>
|
|
281
|
-
handleClick(
|
|
303
|
+
handleClick('minuta', () => downloadFile('MINUTE', true))
|
|
282
304
|
}
|
|
283
305
|
>
|
|
284
306
|
Baixar minuta
|
|
285
307
|
</MenuItem>
|
|
286
308
|
)}
|
|
287
|
-
{statusLabel ===
|
|
309
|
+
{statusLabel === 'Aguardando aprovação' && (
|
|
288
310
|
<MenuItem
|
|
289
311
|
danger
|
|
290
312
|
data-testid={`btn_minhas_emissoes_recusar_proposta_${processId}`}
|
|
291
313
|
id={`btn_minhas_emissoes_recusar_proposta_${processId}`}
|
|
292
314
|
icon={
|
|
293
|
-
loadingItem ===
|
|
315
|
+
loadingItem === 'recusar_proposta' ? (
|
|
294
316
|
<Loader2 className="mr-2 h-5 w-5 animate-spin" />
|
|
295
317
|
) : (
|
|
296
318
|
<XCircle size={16} />
|
|
297
319
|
)
|
|
298
320
|
}
|
|
299
321
|
onClick={() =>
|
|
300
|
-
handleClick(
|
|
322
|
+
handleClick('recusar_proposta', abrirModalRecusarProposta)
|
|
301
323
|
}
|
|
302
324
|
>
|
|
303
325
|
Recusar proposta
|
|
304
326
|
</MenuItem>
|
|
305
327
|
)}
|
|
306
|
-
{statusLabel ===
|
|
328
|
+
{statusLabel === 'Proposta recusada' && (
|
|
307
329
|
<MenuItem
|
|
308
330
|
danger
|
|
309
331
|
data-testid={`btn_minhas_emissoes_excluir_proposta_${processId}`}
|
|
310
332
|
id={`btn_minhas_emissoes_excluir_proposta_${processId}`}
|
|
311
333
|
icon={
|
|
312
|
-
loadingItem ===
|
|
334
|
+
loadingItem === 'excluir_proposta' ? (
|
|
313
335
|
<Loader2 className="mr-2 h-5 w-5 animate-spin" />
|
|
314
336
|
) : (
|
|
315
337
|
<XCircle size={16} />
|
|
316
338
|
)
|
|
317
339
|
}
|
|
318
340
|
onClick={() =>
|
|
319
|
-
handleClick(
|
|
341
|
+
handleClick('excluir_proposta', abrirModalExcluirProposta)
|
|
320
342
|
}
|
|
321
343
|
>
|
|
322
344
|
Excluir proposta
|
|
@@ -326,18 +348,34 @@ export const InsuranceCard: React.FC<InsuranceCardProps> = ({
|
|
|
326
348
|
)}
|
|
327
349
|
{isOpen && activeIndex === 1 && (
|
|
328
350
|
<DropdownMenu>
|
|
351
|
+
<MenuItem
|
|
352
|
+
data-testid={`btn_minhas_linha_do_tempo_${processId}`}
|
|
353
|
+
id={`btn_minhas_linha_do_tempo_${processId}`}
|
|
354
|
+
icon={
|
|
355
|
+
loadingItem === 'linha_do_tempo' || isTimelineLoading ? (
|
|
356
|
+
<Loader2 className="mr-2 h-5 w-5 animate-spin" />
|
|
357
|
+
) : (
|
|
358
|
+
<FlowArrow size={16} />
|
|
359
|
+
)
|
|
360
|
+
}
|
|
361
|
+
onClick={() =>
|
|
362
|
+
handleClick('linha_do_tempo', showTimelineToggle)
|
|
363
|
+
}
|
|
364
|
+
>
|
|
365
|
+
Linha do tempo
|
|
366
|
+
</MenuItem>
|
|
329
367
|
<MenuItem
|
|
330
368
|
data-testid={`btn_minhas_emissoes_baixar_apolice_${processId}`}
|
|
331
369
|
id={`btn_minhas_emissoes_baixar_apolice_${processId}`}
|
|
332
370
|
icon={
|
|
333
|
-
loadingItem ===
|
|
371
|
+
loadingItem === 'apolice' ? (
|
|
334
372
|
<Loader2 className="mr-2 h-5 w-5 animate-spin" />
|
|
335
373
|
) : (
|
|
336
374
|
<FileText size={16} />
|
|
337
375
|
)
|
|
338
376
|
}
|
|
339
377
|
onClick={() =>
|
|
340
|
-
handleClick(
|
|
378
|
+
handleClick('apolice', () => downloadFile('POLICY', true))
|
|
341
379
|
}
|
|
342
380
|
>
|
|
343
381
|
Baixar apólice
|
|
@@ -346,14 +384,14 @@ export const InsuranceCard: React.FC<InsuranceCardProps> = ({
|
|
|
346
384
|
data-testid={`btn_minhas_emissoes_baixar_boleto_${processId}`}
|
|
347
385
|
id={`btn_minhas_emissoes_baixar_boleto_${processId}`}
|
|
348
386
|
icon={
|
|
349
|
-
loadingItem ===
|
|
387
|
+
loadingItem === 'boleto' ? (
|
|
350
388
|
<Loader2 className="mr-2 h-5 w-5 animate-spin" />
|
|
351
389
|
) : (
|
|
352
390
|
<CreditCard size={16} />
|
|
353
391
|
)
|
|
354
392
|
}
|
|
355
393
|
onClick={() =>
|
|
356
|
-
handleClick(
|
|
394
|
+
handleClick('boleto', () => downloadFile('SLIP', true))
|
|
357
395
|
}
|
|
358
396
|
>
|
|
359
397
|
Baixar boleto
|
|
@@ -362,14 +400,14 @@ export const InsuranceCard: React.FC<InsuranceCardProps> = ({
|
|
|
362
400
|
data-testid={`btn_minhas_emissoes_baixar_certidoes_${processId}`}
|
|
363
401
|
id={`btn_minhas_emissoes_baixar_certidoes_${processId}`}
|
|
364
402
|
icon={
|
|
365
|
-
loadingItem ===
|
|
403
|
+
loadingItem === 'certidoes' ? (
|
|
366
404
|
<Loader2 className="mr-2 h-5 w-5 animate-spin" />
|
|
367
405
|
) : (
|
|
368
406
|
<Download size={16} />
|
|
369
407
|
)
|
|
370
408
|
}
|
|
371
409
|
onClick={() =>
|
|
372
|
-
handleClick(
|
|
410
|
+
handleClick('certidoes', () =>
|
|
373
411
|
searchCerts(idInsurance!, idOrder)
|
|
374
412
|
)
|
|
375
413
|
}
|
|
@@ -380,15 +418,15 @@ export const InsuranceCard: React.FC<InsuranceCardProps> = ({
|
|
|
380
418
|
data-testid={`btn_minhas_emissoes_solicitar_endosso_${processId}`}
|
|
381
419
|
id={`btn_minhas_emissoes_solicitar_endosso_${processId}`}
|
|
382
420
|
icon={
|
|
383
|
-
loadingItem ===
|
|
421
|
+
loadingItem === 'endosso' ? (
|
|
384
422
|
<Loader2 className="mr-2 h-5 w-5 animate-spin" />
|
|
385
423
|
) : (
|
|
386
424
|
<PlusCircle size={16} />
|
|
387
425
|
)
|
|
388
426
|
}
|
|
389
427
|
onClick={() =>
|
|
390
|
-
handleClick(
|
|
391
|
-
onEndorsementClick(
|
|
428
|
+
handleClick('endosso', () =>
|
|
429
|
+
onEndorsementClick('Umbrela Corp', idInsurance!)
|
|
392
430
|
)
|
|
393
431
|
}
|
|
394
432
|
>
|
|
@@ -415,4 +453,4 @@ const MenuItem: React.FC<MenuItemProps> = ({
|
|
|
415
453
|
{children}
|
|
416
454
|
</StyledMenuItem>
|
|
417
455
|
);
|
|
418
|
-
};
|
|
456
|
+
};
|
|
@@ -1,4 +1,5 @@
|
|
|
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;
|
|
@@ -11,7 +12,7 @@ export interface InsuranceCardProps {
|
|
|
11
12
|
statusVariant: StatusVariant;
|
|
12
13
|
seguradoName: string;
|
|
13
14
|
seguradoCnpj: string;
|
|
14
|
-
product:
|
|
15
|
+
product: any;
|
|
15
16
|
issuedDate: string;
|
|
16
17
|
totalValue: string;
|
|
17
18
|
processId?: string;
|
|
@@ -20,6 +21,13 @@ export interface InsuranceCardProps {
|
|
|
20
21
|
openCardId: string | null;
|
|
21
22
|
setOpenCardId: (id: string | null) => void;
|
|
22
23
|
runQuery: () => void;
|
|
24
|
+
useDownloadAndSupport: any;
|
|
25
|
+
useDownloadFile: any;
|
|
26
|
+
useChangeOrderStageAsync: any;
|
|
27
|
+
useMyStore: any;
|
|
28
|
+
useQueryClient: any;
|
|
29
|
+
useGetTimeline: any;
|
|
30
|
+
useAuthStoreV2: any;
|
|
23
31
|
}
|
|
24
32
|
|
|
25
33
|
export interface MenuItemProps {
|
|
@@ -28,5 +36,5 @@ export interface MenuItemProps {
|
|
|
28
36
|
children: React.ReactNode;
|
|
29
37
|
onClick?: () => void;
|
|
30
38
|
id?: string;
|
|
31
|
-
|
|
32
|
-
}
|
|
39
|
+
'data-testid'?: string;
|
|
40
|
+
}
|
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
|