jornada-ui 0.4.16 → 0.4.17
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/commonjs/components/modals/modal-change-activitie-history/helpers/index.js +35 -0
- package/lib/commonjs/components/modals/modal-change-activitie-history/helpers/index.js.map +1 -0
- package/lib/commonjs/components/modals/modal-change-activitie-history/index.js +203 -0
- package/lib/commonjs/components/modals/modal-change-activitie-history/index.js.map +1 -0
- package/lib/commonjs/components/modals/modal-change-activitie-history/interface.js +6 -0
- package/lib/commonjs/components/modals/modal-change-activitie-history/interface.js.map +1 -0
- package/lib/commonjs/components/step-indicator/index.js +131 -68
- package/lib/commonjs/components/step-indicator/index.js.map +1 -1
- package/lib/module/components/modals/modal-change-activitie-history/helpers/index.js +32 -0
- package/lib/module/components/modals/modal-change-activitie-history/helpers/index.js.map +1 -0
- package/lib/module/components/modals/modal-change-activitie-history/index.js +196 -0
- package/lib/module/components/modals/modal-change-activitie-history/index.js.map +1 -0
- package/lib/module/components/modals/modal-change-activitie-history/interface.js +4 -0
- package/lib/module/components/modals/modal-change-activitie-history/interface.js.map +1 -0
- package/lib/module/components/step-indicator/index.js +129 -65
- package/lib/module/components/step-indicator/index.js.map +1 -1
- package/lib/typescript/commonjs/src/components/modals/modal-change-activitie-history/helpers/index.d.ts +13 -0
- package/lib/typescript/commonjs/src/components/modals/modal-change-activitie-history/helpers/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/modals/modal-change-activitie-history/index.d.ts +10 -0
- package/lib/typescript/commonjs/src/components/modals/modal-change-activitie-history/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/modals/modal-change-activitie-history/interface.d.ts +18 -0
- package/lib/typescript/commonjs/src/components/modals/modal-change-activitie-history/interface.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/step-indicator/index.d.ts +3 -9
- package/lib/typescript/commonjs/src/components/step-indicator/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/modals/modal-change-activitie-history/helpers/index.d.ts +13 -0
- package/lib/typescript/module/src/components/modals/modal-change-activitie-history/helpers/index.d.ts.map +1 -0
- package/lib/typescript/module/src/components/modals/modal-change-activitie-history/index.d.ts +10 -0
- package/lib/typescript/module/src/components/modals/modal-change-activitie-history/index.d.ts.map +1 -0
- package/lib/typescript/module/src/components/modals/modal-change-activitie-history/interface.d.ts +18 -0
- package/lib/typescript/module/src/components/modals/modal-change-activitie-history/interface.d.ts.map +1 -0
- package/lib/typescript/module/src/components/step-indicator/index.d.ts +3 -9
- package/lib/typescript/module/src/components/step-indicator/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/modals/modal-change-activitie-history/helpers/index.ts +15 -0
- package/src/components/modals/modal-change-activitie-history/index.tsx +189 -0
- package/src/components/modals/modal-change-activitie-history/interface.ts +16 -0
- package/src/components/step-indicator/index.tsx +226 -155
- package/src/components/step-indicator/interface.d.ts +3 -2
|
@@ -1,14 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* IMPORTS
|
|
3
|
-
*/
|
|
4
1
|
import React from "react";
|
|
5
2
|
import type { IStepIndicator } from "./interface";
|
|
6
3
|
/**
|
|
7
|
-
* Componente StepIndicator para a interação da
|
|
8
|
-
*/
|
|
9
|
-
declare const StepIndicator: React.FC<IStepIndicator>;
|
|
10
|
-
/**
|
|
11
|
-
* EXPORTS
|
|
4
|
+
* Componente StepIndicator para a interação da ui.
|
|
12
5
|
*/
|
|
13
|
-
|
|
6
|
+
declare const _default: React.ComponentType<IStepIndicator & React.RefAttributes<any>>;
|
|
7
|
+
export default _default;
|
|
14
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/step-indicator/index.tsx"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/step-indicator/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4D,MAAM,OAAO,CAAC;AAajF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAqPlD;;GAEG;;AACH,wBAA8C"}
|
package/package.json
CHANGED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CONSTANTS
|
|
3
|
+
*/
|
|
4
|
+
const optionsActivities = [
|
|
5
|
+
{ label: "Selecione atividade", value: "none", key: 0 },
|
|
6
|
+
{ label: "Descanso", value: "descanso", key: 9 },
|
|
7
|
+
{ label: "Repouso Noturno", value: "repouso_noturno", key: 6 },
|
|
8
|
+
{ label: "Refeição", value: "refeição", key: 7 },
|
|
9
|
+
{ label: "Repouso Semanal", value: "repouso_semanal", key: 5 },
|
|
10
|
+
];
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* EXPORTS
|
|
14
|
+
*/
|
|
15
|
+
export { optionsActivities };
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IMPORTS
|
|
3
|
+
*/
|
|
4
|
+
import React from "react";
|
|
5
|
+
// libs RN
|
|
6
|
+
import { Modal, View } from "react-native";
|
|
7
|
+
|
|
8
|
+
// componentes
|
|
9
|
+
import Box from "../../box";
|
|
10
|
+
import Button from "../../button";
|
|
11
|
+
import Typography from "../../typography";
|
|
12
|
+
import SelectOption from "../../selects/select-option";
|
|
13
|
+
|
|
14
|
+
// assets / icons
|
|
15
|
+
import { Icons } from "../../../common/icons-svg";
|
|
16
|
+
|
|
17
|
+
// helpers / data
|
|
18
|
+
import { optionsActivities } from "./helpers";
|
|
19
|
+
|
|
20
|
+
// typings
|
|
21
|
+
import type { IModalChangeActivityProps } from "./interface";
|
|
22
|
+
|
|
23
|
+
// styles / theme
|
|
24
|
+
import { theme } from "../../../styles/theme/theme";
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Componente Modal para alteração de atividade.
|
|
28
|
+
*/
|
|
29
|
+
export const ModalChangeActivity: React.FC<IModalChangeActivityProps> = ({
|
|
30
|
+
visible,
|
|
31
|
+
onClose,
|
|
32
|
+
modalConfirm,
|
|
33
|
+
descricao,
|
|
34
|
+
}) => {
|
|
35
|
+
const [isLoading] = React.useState(false);
|
|
36
|
+
|
|
37
|
+
const initial = (descricao ?? "").toLowerCase().replace(/\s+/g, "_");
|
|
38
|
+
const [selectedOption, setSelectedOption] = React.useState(initial || "none");
|
|
39
|
+
|
|
40
|
+
const handleConfirm = () => {
|
|
41
|
+
const selected = optionsActivities?.find((activity) => activity.value === selectedOption);
|
|
42
|
+
|
|
43
|
+
if (selected && selected.value !== "none") {
|
|
44
|
+
modalConfirm({
|
|
45
|
+
label: selected.label,
|
|
46
|
+
value: selected.value,
|
|
47
|
+
key: selected.key,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// sempre fechar o modal
|
|
52
|
+
onClose();
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const handleSelectDown = (activity: string) => {
|
|
56
|
+
const option = optionsActivities.find((o) => o.label === activity || o.value === activity);
|
|
57
|
+
|
|
58
|
+
if (option) setSelectedOption(option.value);
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
return (
|
|
62
|
+
<Modal animationType="fade" transparent visible={visible}>
|
|
63
|
+
<View
|
|
64
|
+
style={{
|
|
65
|
+
flex: 1,
|
|
66
|
+
justifyContent: "center",
|
|
67
|
+
alignItems: "center",
|
|
68
|
+
backgroundColor: "rgba(0,0,0,0.6)",
|
|
69
|
+
}}
|
|
70
|
+
>
|
|
71
|
+
<Box
|
|
72
|
+
width={346}
|
|
73
|
+
backgroundColor={theme.colors.orange[500]}
|
|
74
|
+
borderStyled={{
|
|
75
|
+
borderRadius: theme.borderWidths.thick_medium,
|
|
76
|
+
}}
|
|
77
|
+
paddingStyle={{
|
|
78
|
+
paddingLeft: theme.paddings["2xs"],
|
|
79
|
+
paddingRight: theme.paddings["2xs"],
|
|
80
|
+
paddingTop: theme.paddings.sm,
|
|
81
|
+
paddingBottom: theme.paddings.sm,
|
|
82
|
+
}}
|
|
83
|
+
>
|
|
84
|
+
<Box
|
|
85
|
+
marginStyle={{ marginBottom: theme.margins["2xs"], marginLeft: theme.margins["1xs"] }}
|
|
86
|
+
flexStyle={{ flexDirection: "row", alignItems: "center" }}
|
|
87
|
+
>
|
|
88
|
+
<Icons
|
|
89
|
+
icon="EXCLAMATION_TRIANGLE"
|
|
90
|
+
color={theme.colors.black[10]}
|
|
91
|
+
background={theme.colors.yellow[50]}
|
|
92
|
+
size={theme.fontSizes["2xl"]}
|
|
93
|
+
/>
|
|
94
|
+
|
|
95
|
+
<Typography
|
|
96
|
+
text="Alterar Atividade"
|
|
97
|
+
color="#fff"
|
|
98
|
+
marginLeft={theme.margins["2xs"]}
|
|
99
|
+
fontFamily={theme.fonts.inter_bold_700}
|
|
100
|
+
size={theme.fontSizes.md}
|
|
101
|
+
/>
|
|
102
|
+
</Box>
|
|
103
|
+
|
|
104
|
+
<Box
|
|
105
|
+
backgroundColor={theme.colors.neutral[300]}
|
|
106
|
+
paddingStyle={{ padding: theme.paddings.xs }}
|
|
107
|
+
borderStyled={{ borderRadius: theme.borderWidths.thick_medium }}
|
|
108
|
+
>
|
|
109
|
+
<Box flexStyle={{ flexDirection: "row", justifyContent: "flex-start" }} width={"100%"}>
|
|
110
|
+
<Typography
|
|
111
|
+
text={`Deseja realmente alterar sua atividade?`}
|
|
112
|
+
color={theme.colors.black[25]}
|
|
113
|
+
fontFamily={theme.fonts.inter_medium_500}
|
|
114
|
+
size={theme.fontSizes.xs}
|
|
115
|
+
style={{ flexWrap: "wrap", maxWidth: "100%" }}
|
|
116
|
+
/>
|
|
117
|
+
</Box>
|
|
118
|
+
|
|
119
|
+
<SelectOption
|
|
120
|
+
titleLabel="Selecione atividade"
|
|
121
|
+
sizeTitleLabel={theme.fontSizes.xs}
|
|
122
|
+
dataOption={optionsActivities}
|
|
123
|
+
handleSelectDown={handleSelectDown}
|
|
124
|
+
backgroundColor={theme.colors.neutral[300]}
|
|
125
|
+
/>
|
|
126
|
+
|
|
127
|
+
<Box
|
|
128
|
+
marginStyle={{ marginTop: theme.margins["1xs"] }}
|
|
129
|
+
flexStyle={{ flexDirection: "row", justifyContent: "space-between" }}
|
|
130
|
+
>
|
|
131
|
+
<Button
|
|
132
|
+
title="CANCELAR"
|
|
133
|
+
onPress={onClose}
|
|
134
|
+
width={"48%"}
|
|
135
|
+
height={36}
|
|
136
|
+
isLoading={isLoading}
|
|
137
|
+
disabled={isLoading}
|
|
138
|
+
backgroundColor={theme.colors.neutral[300]}
|
|
139
|
+
buttonTextStyle={{
|
|
140
|
+
color: theme.colors.blue[100],
|
|
141
|
+
fontFamily: "Inter-Medium",
|
|
142
|
+
fontSize: theme.fontSizes.xs,
|
|
143
|
+
fontWeight: "500",
|
|
144
|
+
}}
|
|
145
|
+
flexStyle={{
|
|
146
|
+
flexDirection: "row",
|
|
147
|
+
alignItems: "center",
|
|
148
|
+
justifyContent: "center",
|
|
149
|
+
textAlign: "center",
|
|
150
|
+
}}
|
|
151
|
+
borderStyled={{
|
|
152
|
+
borderWidth: theme.borderWidths.thin,
|
|
153
|
+
borderColor: theme.colors.blue[100],
|
|
154
|
+
borderRadius: theme.borderWidths.thick_medium,
|
|
155
|
+
}}
|
|
156
|
+
/>
|
|
157
|
+
<Button
|
|
158
|
+
title="CONFIRMAR"
|
|
159
|
+
onPress={handleConfirm}
|
|
160
|
+
width={"48%"}
|
|
161
|
+
height={36}
|
|
162
|
+
isLoading={isLoading}
|
|
163
|
+
disabled={isLoading}
|
|
164
|
+
backgroundColor={theme.colors.blue[100]}
|
|
165
|
+
buttonTextStyle={{
|
|
166
|
+
color: "#fff",
|
|
167
|
+
fontFamily: "Inter-Medium",
|
|
168
|
+
fontSize: theme.fontSizes.xs,
|
|
169
|
+
fontWeight: "500",
|
|
170
|
+
}}
|
|
171
|
+
flexStyle={{
|
|
172
|
+
flexDirection: "row",
|
|
173
|
+
alignItems: "center",
|
|
174
|
+
justifyContent: "center",
|
|
175
|
+
textAlign: "center",
|
|
176
|
+
}}
|
|
177
|
+
borderStyled={{
|
|
178
|
+
borderWidth: theme.borderWidths.thin,
|
|
179
|
+
borderColor: theme.colors.blue[100],
|
|
180
|
+
borderRadius: theme.borderWidths.thick_medium,
|
|
181
|
+
}}
|
|
182
|
+
/>
|
|
183
|
+
</Box>
|
|
184
|
+
</Box>
|
|
185
|
+
</Box>
|
|
186
|
+
</View>
|
|
187
|
+
</Modal>
|
|
188
|
+
);
|
|
189
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IMPROTS
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
interface IModalChangeActivityProps {
|
|
6
|
+
visible: boolean;
|
|
7
|
+
onClose: () => void;
|
|
8
|
+
// eslint-disable-next-line no-unused-vars
|
|
9
|
+
modalConfirm: (newData: { label: string; value: string; key: number }) => void;
|
|
10
|
+
descricao: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* EXPORTS
|
|
15
|
+
*/
|
|
16
|
+
export { type IModalChangeActivityProps };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import {
|
|
1
|
+
import React, { useState, forwardRef, useImperativeHandle, useRef } from "react";
|
|
2
|
+
import { View, Text, TouchableOpacity, FlatList, FlatList as FlatListType } from "react-native";
|
|
3
|
+
|
|
4
|
+
// components
|
|
5
|
+
import { ModalChangeActivity } from "../modals/modal-change-activitie-history";
|
|
6
6
|
|
|
7
7
|
// commons / svg
|
|
8
8
|
import { Icons } from "../../common/icons-svg";
|
|
@@ -10,182 +10,253 @@ import { Icons } from "../../common/icons-svg";
|
|
|
10
10
|
// helpers
|
|
11
11
|
import { getIconKeyByValue } from "./helpers/get-icon-by-status";
|
|
12
12
|
|
|
13
|
-
// utils
|
|
14
|
-
import { formHoursMinute } from "../../utils/format-date";
|
|
15
|
-
|
|
16
13
|
// typings
|
|
17
14
|
import type { IStepIndicator } from "./interface";
|
|
18
15
|
|
|
16
|
+
// utils
|
|
17
|
+
import { formHoursMinute } from "../../utils/format-date";
|
|
18
|
+
|
|
19
19
|
// styles
|
|
20
20
|
import { styles } from "./styles";
|
|
21
21
|
import { theme } from "../../styles/theme/theme";
|
|
22
|
+
import { asBaseComponent } from "../../@types/as-base-component";
|
|
22
23
|
|
|
23
24
|
/**
|
|
24
25
|
* Componente StepIndicator para a interação da ui.
|
|
25
26
|
*/
|
|
27
|
+
const StepIndicator = forwardRef<any, IStepIndicator>(
|
|
28
|
+
(
|
|
29
|
+
{ data = [], type, textColorDescription, titleColor, titleNumberColor, onChangeActivity },
|
|
30
|
+
ref
|
|
31
|
+
) => {
|
|
32
|
+
const StepDefault = () => {
|
|
33
|
+
const [isModalVisible, setIsModalVisible] = useState(false);
|
|
34
|
+
const [currentStepIndex, setCurrentStepIndex] = useState<number | null>(null);
|
|
35
|
+
const [stepData, setStepData] = useState(data);
|
|
26
36
|
|
|
27
|
-
const
|
|
28
|
-
data = [],
|
|
29
|
-
type,
|
|
30
|
-
textColorDescription,
|
|
31
|
-
titleColor,
|
|
32
|
-
titleNumberColor,
|
|
33
|
-
handleOnPressActivitie,
|
|
34
|
-
}) => {
|
|
35
|
-
const StepDefault = () => {
|
|
36
|
-
return (
|
|
37
|
-
<>
|
|
38
|
-
{data!.length > 0 &&
|
|
39
|
-
data!.map((history, index) => {
|
|
40
|
-
// pegando primeira atividade pelo index
|
|
41
|
-
const isFirst = index === 0;
|
|
42
|
-
//pegando o tipo de atividade
|
|
43
|
-
const isEditableType = history.tipo === "descanso";
|
|
44
|
-
|
|
45
|
-
// pegando o valor para saber se atividade ta ou não sincronizada
|
|
46
|
-
const isSynced = history?.sincronizado === true;
|
|
47
|
-
|
|
48
|
-
const canEdit = isFirst && isEditableType && isSynced;
|
|
37
|
+
const flatListRef = useRef<FlatListType<any>>(null);
|
|
49
38
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
activeOpacity={0.7}
|
|
54
|
-
key={history.id}
|
|
55
|
-
style={styles({}).containerIndicator}
|
|
56
|
-
disabled={!canEdit}
|
|
57
|
-
onPress={() => handleOnPressActivitie(history as any)}
|
|
58
|
-
>
|
|
59
|
-
<View style={styles({ sincronizado: history.sincronizado }).containerBall}>
|
|
60
|
-
{data!?.length > 1 && index < data!?.length - 1 && (
|
|
61
|
-
<View
|
|
62
|
-
style={{
|
|
63
|
-
width: 2,
|
|
64
|
-
height: 84,
|
|
65
|
-
marginTop: 116,
|
|
66
|
-
position: "relative",
|
|
67
|
-
backgroundColor: history.sincronizado
|
|
68
|
-
? theme.colors.blue[500]
|
|
69
|
-
: theme.colors.orange[150],
|
|
70
|
-
}}
|
|
71
|
-
/>
|
|
72
|
-
)}
|
|
73
|
-
<Text style={styles({ titleNumberColor }).titleNumber}>
|
|
74
|
-
{data!?.length - index}
|
|
75
|
-
</Text>
|
|
76
|
-
</View>
|
|
39
|
+
const handleOnPressActivitie = (stepItem: any, index: number) => {
|
|
40
|
+
const desc = stepItem?.descricao?.toLowerCase?.();
|
|
41
|
+
if (!desc) return;
|
|
77
42
|
|
|
78
|
-
|
|
79
|
-
|
|
43
|
+
const isDescanso = ["descanso", "refeição", "repouso_noturno", "repouso_semanal"].includes(
|
|
44
|
+
desc.replace(/\s+/g, "_")
|
|
45
|
+
);
|
|
80
46
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
47
|
+
if (isDescanso && stepItem?.sincronizado === true) {
|
|
48
|
+
setCurrentStepIndex(index);
|
|
49
|
+
setIsModalVisible(true);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
86
52
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
>
|
|
53
|
+
const handleConfirmModal = (newData: { label: string; value: string; key: number }) => {
|
|
54
|
+
if (currentStepIndex !== null) {
|
|
55
|
+
const updatedStep = {
|
|
56
|
+
...stepData[currentStepIndex],
|
|
57
|
+
descricao: newData.label,
|
|
58
|
+
referencia: newData.value,
|
|
59
|
+
jr_tipo_atividade_id: newData.key,
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const newSteps = stepData.map((item, index) =>
|
|
63
|
+
index === currentStepIndex ? updatedStep : item
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
setStepData(newSteps as any);
|
|
67
|
+
|
|
68
|
+
if (onChangeActivity) {
|
|
69
|
+
onChangeActivity(updatedStep);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
setIsModalVisible(false);
|
|
74
|
+
setCurrentStepIndex(null);
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
// render item padrão do step indicator
|
|
78
|
+
const renderItem = ({ item: history, index }: { item: any; index: number }) => {
|
|
79
|
+
const isFirst = index === 0;
|
|
80
|
+
const isEditableType = history.tipo === "descanso";
|
|
81
|
+
const isSynced = history?.sincronizado === true;
|
|
82
|
+
const canEdit = isFirst && isEditableType && isSynced;
|
|
83
|
+
|
|
84
|
+
return (
|
|
85
|
+
<TouchableOpacity
|
|
86
|
+
testID="step-indicator"
|
|
87
|
+
activeOpacity={0.7}
|
|
88
|
+
style={styles({}).containerIndicator}
|
|
89
|
+
disabled={!canEdit}
|
|
90
|
+
onPress={() => handleOnPressActivitie(history, index)}
|
|
91
|
+
>
|
|
92
|
+
<View style={styles({ sincronizado: history.sincronizado }).containerBall}>
|
|
93
|
+
{stepData.length > 1 && index < stepData.length - 1 && (
|
|
94
|
+
<View
|
|
95
|
+
style={{
|
|
96
|
+
width: 2,
|
|
97
|
+
height: 84,
|
|
98
|
+
marginTop: 116,
|
|
99
|
+
position: "relative",
|
|
100
|
+
backgroundColor: history.sincronizado
|
|
101
|
+
? theme.colors.blue[500]
|
|
102
|
+
: theme.colors.orange[150],
|
|
103
|
+
}}
|
|
104
|
+
/>
|
|
105
|
+
)}
|
|
106
|
+
<Text style={styles({ titleNumberColor }).titleNumber}>
|
|
107
|
+
{stepData.length - index}
|
|
108
|
+
</Text>
|
|
109
|
+
</View>
|
|
110
|
+
|
|
111
|
+
<View style={styles({}).containerMain}>
|
|
112
|
+
<Text style={styles({ titleColor }).title}>{history?.descricao}</Text>
|
|
113
|
+
|
|
114
|
+
{history?.data_inicio && (
|
|
115
|
+
<Text style={styles({ textColorDescription }).titleDescription}>
|
|
116
|
+
{`Inicio: ${history.data_inicio} ás ${history.data_fim}`}
|
|
117
|
+
</Text>
|
|
118
|
+
)}
|
|
119
|
+
|
|
120
|
+
{history.duracao_segundos && (
|
|
121
|
+
<Text style={styles({ textColorDescription }).titleDescription}>
|
|
122
|
+
Duração: {formHoursMinute(history?.duracao_segundos as string)}
|
|
123
|
+
</Text>
|
|
124
|
+
)}
|
|
125
|
+
</View>
|
|
126
|
+
</TouchableOpacity>
|
|
127
|
+
);
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
// Expor funções para o pai via forwardRef
|
|
131
|
+
useImperativeHandle(ref, () => ({
|
|
132
|
+
scrollToIndex: (index: number) => {
|
|
133
|
+
flatListRef.current?.scrollToIndex({ index, animated: true });
|
|
134
|
+
},
|
|
135
|
+
openModalAt: (index: number) => {
|
|
136
|
+
if (stepData[index]) {
|
|
137
|
+
setCurrentStepIndex(index);
|
|
138
|
+
setIsModalVisible(true);
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
resetSteps: (newData: any[]) => {
|
|
142
|
+
setStepData(newData);
|
|
143
|
+
},
|
|
144
|
+
}));
|
|
145
|
+
|
|
146
|
+
return (
|
|
147
|
+
<>
|
|
148
|
+
<FlatList
|
|
149
|
+
ref={flatListRef}
|
|
150
|
+
data={stepData}
|
|
151
|
+
renderItem={renderItem}
|
|
152
|
+
keyExtractor={(item, index) => String(item?.id ?? String(index))}
|
|
153
|
+
showsVerticalScrollIndicator={false}
|
|
154
|
+
/>
|
|
155
|
+
|
|
156
|
+
{isModalVisible && (
|
|
157
|
+
<ModalChangeActivity
|
|
158
|
+
visible={isModalVisible}
|
|
159
|
+
modalConfirm={handleConfirmModal}
|
|
160
|
+
descricao=""
|
|
161
|
+
onClose={() => setIsModalVisible(false)}
|
|
162
|
+
/>
|
|
163
|
+
)}
|
|
164
|
+
</>
|
|
165
|
+
);
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
const StepCustom = () => {
|
|
169
|
+
return (
|
|
170
|
+
<View
|
|
171
|
+
style={{
|
|
172
|
+
width: "100%",
|
|
173
|
+
height: 84,
|
|
174
|
+
paddingHorizontal: 24,
|
|
175
|
+
display: "flex",
|
|
176
|
+
flexDirection: "row",
|
|
177
|
+
}}
|
|
178
|
+
>
|
|
179
|
+
{data.map((step, indexCustom) => {
|
|
180
|
+
const descricao = getIconKeyByValue(step.descricao);
|
|
181
|
+
|
|
182
|
+
return (
|
|
183
|
+
<React.Fragment key={`step-${indexCustom}`}>
|
|
128
184
|
<View
|
|
129
185
|
style={{
|
|
130
186
|
width: 45,
|
|
131
187
|
height: 45,
|
|
132
|
-
backgroundColor: "transparent",
|
|
188
|
+
backgroundColor: indexCustom <= 3 ? "orange" : "transparent",
|
|
133
189
|
borderRadius: 50,
|
|
134
190
|
alignItems: "center",
|
|
135
191
|
justifyContent: "center",
|
|
192
|
+
borderWidth: 1,
|
|
193
|
+
borderColor: "#fff",
|
|
136
194
|
}}
|
|
137
195
|
>
|
|
138
|
-
|
|
196
|
+
<View
|
|
197
|
+
style={{
|
|
198
|
+
width: 45,
|
|
199
|
+
height: 45,
|
|
200
|
+
backgroundColor: "transparent",
|
|
201
|
+
borderRadius: 50,
|
|
202
|
+
alignItems: "center",
|
|
203
|
+
justifyContent: "center",
|
|
204
|
+
}}
|
|
205
|
+
>
|
|
206
|
+
{descricao && <Icons icon={descricao} />}
|
|
207
|
+
</View>
|
|
208
|
+
<Text
|
|
209
|
+
style={{
|
|
210
|
+
position: "absolute",
|
|
211
|
+
top: 56,
|
|
212
|
+
fontWeight: "600",
|
|
213
|
+
fontSize: 10,
|
|
214
|
+
lineHeight: 14,
|
|
215
|
+
textAlign: "center",
|
|
216
|
+
color: "#fff",
|
|
217
|
+
width: 75,
|
|
218
|
+
}}
|
|
219
|
+
>
|
|
220
|
+
{step.descricao}
|
|
221
|
+
</Text>
|
|
139
222
|
</View>
|
|
140
|
-
<Text
|
|
141
|
-
style={{
|
|
142
|
-
position: "absolute",
|
|
143
|
-
top: 56,
|
|
144
|
-
fontWeight: "600",
|
|
145
|
-
fontSize: 10,
|
|
146
|
-
lineHeight: 14,
|
|
147
|
-
textAlign: "center",
|
|
148
|
-
color: "#fff",
|
|
149
|
-
width: 75,
|
|
150
|
-
}}
|
|
151
|
-
>
|
|
152
|
-
{step.descricao}
|
|
153
|
-
</Text>
|
|
154
|
-
</View>
|
|
155
223
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
}
|
|
224
|
+
{data?.length > 1 && indexCustom < data?.length - 1 && (
|
|
225
|
+
<View
|
|
226
|
+
style={{
|
|
227
|
+
width: 35,
|
|
228
|
+
height: 2,
|
|
229
|
+
marginTop: 24,
|
|
230
|
+
position: "relative",
|
|
231
|
+
backgroundColor: "orange",
|
|
232
|
+
}}
|
|
233
|
+
/>
|
|
234
|
+
)}
|
|
235
|
+
</React.Fragment>
|
|
236
|
+
);
|
|
237
|
+
})}
|
|
238
|
+
</View>
|
|
239
|
+
);
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
const handleRenderComponent = (stepType: "default" | "custom") => {
|
|
243
|
+
switch (stepType) {
|
|
244
|
+
case "default":
|
|
245
|
+
return <StepDefault />;
|
|
246
|
+
case "custom":
|
|
247
|
+
return <StepCustom />;
|
|
248
|
+
default:
|
|
249
|
+
return <View />;
|
|
250
|
+
}
|
|
251
|
+
};
|
|
252
|
+
|
|
253
|
+
return <>{handleRenderComponent(type!)}</>;
|
|
254
|
+
}
|
|
255
|
+
);
|
|
256
|
+
|
|
257
|
+
StepIndicator.displayName = "StepIndicator";
|
|
187
258
|
|
|
188
259
|
/**
|
|
189
|
-
*
|
|
260
|
+
* Componente StepIndicator para a interação da ui.
|
|
190
261
|
*/
|
|
191
|
-
export default StepIndicator;
|
|
262
|
+
export default asBaseComponent(StepIndicator);
|