react-native-exp-fig 0.1.25 → 0.1.27
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/input-text-counter/index.js +66 -0
- package/lib/commonjs/components/input-text-counter/index.js.map +1 -0
- package/lib/commonjs/components/input-text-counter/interface.d.js.map +1 -0
- package/lib/commonjs/components/input-text-counter/styles.js +42 -0
- package/lib/commonjs/components/input-text-counter/styles.js.map +1 -0
- package/lib/commonjs/components/modal-create-activitie/index.js +202 -0
- package/lib/commonjs/components/modal-create-activitie/index.js.map +1 -0
- package/lib/commonjs/components/modal-create-activitie/interface.js +2 -0
- package/lib/commonjs/components/modal-create-activitie/interface.js.map +1 -0
- package/lib/commonjs/components/modal-create-activitie/styles.js +42 -0
- package/lib/commonjs/components/modal-create-activitie/styles.js.map +1 -0
- package/lib/commonjs/components/modal-journey-rectification/index.js +202 -0
- package/lib/commonjs/components/modal-journey-rectification/index.js.map +1 -0
- package/lib/commonjs/components/modal-journey-rectification/interface.d.js +2 -0
- package/lib/commonjs/components/modal-journey-rectification/interface.d.js.map +1 -0
- package/lib/commonjs/components/modal-journey-rectification/styles.js +42 -0
- package/lib/commonjs/components/modal-journey-rectification/styles.js.map +1 -0
- package/lib/commonjs/components/{modal-activities → modals/modal-activities}/data-activities/index.js +2 -2
- package/lib/commonjs/components/modals/modal-activities/data-activities/index.js.map +1 -0
- package/lib/commonjs/components/{modal-activities → modals/modal-activities}/index.js +8 -8
- package/lib/commonjs/components/modals/modal-activities/index.js.map +1 -0
- package/lib/commonjs/components/modals/modal-activities/interface.d.js +6 -0
- package/lib/commonjs/components/modals/modal-activities/interface.d.js.map +1 -0
- package/lib/commonjs/components/modals/modal-activity-reason/index.js +161 -0
- package/lib/commonjs/components/modals/modal-activity-reason/index.js.map +1 -0
- package/lib/commonjs/components/modals/modal-activity-reason/interface.d.js +2 -0
- package/lib/commonjs/components/modals/modal-activity-reason/interface.d.js.map +1 -0
- package/lib/commonjs/components/{modal-change-activity → modals/modal-change-activity}/index.js +7 -7
- package/lib/commonjs/components/modals/modal-change-activity/index.js.map +1 -0
- package/lib/commonjs/components/selects/select-date-and-hours/index.js +95 -0
- package/lib/commonjs/components/selects/select-date-and-hours/index.js.map +1 -0
- package/lib/commonjs/components/selects/select-date-and-hours/interface.js +6 -0
- package/lib/commonjs/components/selects/select-date-and-hours/interface.js.map +1 -0
- package/lib/commonjs/components/selects/select-date-and-hours/styles.js +33 -0
- package/lib/commonjs/components/selects/select-date-and-hours/styles.js.map +1 -0
- package/lib/commonjs/components/selects/select-option/index.js +41 -39
- package/lib/commonjs/components/selects/select-option/index.js.map +1 -1
- package/lib/commonjs/components/step-indicator/index.js +10 -10
- package/lib/commonjs/components/step-indicator/index.js.map +1 -1
- package/lib/commonjs/components/step-indicator/interface.d.js.map +1 -1
- package/lib/commonjs/index.js +32 -4
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/stories/input-text-counter/input-text-counter.stories.js +259 -0
- package/lib/commonjs/stories/input-text-counter/input-text-counter.stories.js.map +1 -0
- package/lib/commonjs/stories/modal-activities/modal-activities.stories.js +1 -1
- package/lib/commonjs/stories/modal-activities/modal-activities.stories.js.map +1 -1
- package/lib/commonjs/stories/modal-activity-reason/modal-activity-reason.stories.js +198 -0
- package/lib/commonjs/stories/modal-activity-reason/modal-activity-reason.stories.js.map +1 -0
- package/lib/commonjs/stories/modal-change-activity/modal-change-activity.stories.js +3 -3
- package/lib/commonjs/stories/modal-change-activity/modal-change-activity.stories.js.map +1 -1
- package/lib/commonjs/stories/modal-create-activitie/modal-create-activitie.stories.js +86 -0
- package/lib/commonjs/stories/modal-create-activitie/modal-create-activitie.stories.js.map +1 -0
- package/lib/commonjs/stories/modal-journey-rectification/modal-journey-rectification.stories.js +172 -0
- package/lib/commonjs/stories/modal-journey-rectification/modal-journey-rectification.stories.js.map +1 -0
- package/lib/commonjs/stories/select-option/select-option.stories.js +3 -2
- package/lib/commonjs/stories/select-option/select-option.stories.js.map +1 -1
- package/lib/commonjs/stories/step-indicator/step-indicator.stories.js +2 -1
- package/lib/commonjs/stories/step-indicator/step-indicator.stories.js.map +1 -1
- package/lib/commonjs/styles/theme/theme.js +18 -2
- package/lib/commonjs/styles/theme/theme.js.map +1 -1
- package/lib/commonjs/utils/options-activity/index.js +27 -0
- package/lib/commonjs/utils/options-activity/index.js.map +1 -0
- package/lib/commonjs/utils/text-limit/index.js +37 -0
- package/lib/commonjs/utils/text-limit/index.js.map +1 -0
- package/lib/module/components/input-text-counter/index.js +63 -0
- package/lib/module/components/input-text-counter/index.js.map +1 -0
- package/lib/module/components/input-text-counter/interface.d.js.map +1 -0
- package/lib/module/components/input-text-counter/styles.js +37 -0
- package/lib/module/components/input-text-counter/styles.js.map +1 -0
- package/lib/module/components/modal-create-activitie/index.js +192 -0
- package/lib/module/components/modal-create-activitie/index.js.map +1 -0
- package/lib/module/components/modal-create-activitie/interface.js +2 -0
- package/lib/module/components/modal-create-activitie/interface.js.map +1 -0
- package/lib/module/components/modal-create-activitie/styles.js +37 -0
- package/lib/module/components/modal-create-activitie/styles.js.map +1 -0
- package/lib/module/components/modal-journey-rectification/index.js +192 -0
- package/lib/module/components/modal-journey-rectification/index.js.map +1 -0
- package/lib/module/components/modal-journey-rectification/interface.d.js +2 -0
- package/lib/module/components/modal-journey-rectification/interface.d.js.map +1 -0
- package/lib/module/components/modal-journey-rectification/styles.js +37 -0
- package/lib/module/components/modal-journey-rectification/styles.js.map +1 -0
- package/lib/module/components/{modal-activities → modals/modal-activities}/data-activities/index.js +2 -2
- package/lib/module/components/modals/modal-activities/data-activities/index.js.map +1 -0
- package/lib/module/components/{modal-activities → modals/modal-activities}/index.js +8 -8
- package/lib/module/components/modals/modal-activities/index.js.map +1 -0
- package/lib/module/components/modals/modal-activities/interface.d.js +2 -0
- package/lib/module/components/modals/modal-activities/interface.d.js.map +1 -0
- package/lib/module/components/modals/modal-activity-reason/index.js +151 -0
- package/lib/module/components/modals/modal-activity-reason/index.js.map +1 -0
- package/lib/module/components/modals/modal-activity-reason/interface.d.js +2 -0
- package/lib/module/components/modals/modal-activity-reason/interface.d.js.map +1 -0
- package/lib/module/components/{modal-change-activity → modals/modal-change-activity}/index.js +6 -6
- package/lib/module/components/modals/modal-change-activity/index.js.map +1 -0
- package/lib/module/components/selects/select-date-and-hours/index.js +86 -0
- package/lib/module/components/selects/select-date-and-hours/index.js.map +1 -0
- package/lib/module/components/selects/select-date-and-hours/interface.js +2 -0
- package/lib/module/components/selects/select-date-and-hours/interface.js.map +1 -0
- package/lib/module/components/selects/select-date-and-hours/styles.js +28 -0
- package/lib/module/components/selects/select-date-and-hours/styles.js.map +1 -0
- package/lib/module/components/selects/select-option/index.js +41 -42
- package/lib/module/components/selects/select-option/index.js.map +1 -1
- package/lib/module/components/step-indicator/index.js +10 -10
- package/lib/module/components/step-indicator/index.js.map +1 -1
- package/lib/module/components/step-indicator/interface.d.js.map +1 -1
- package/lib/module/index.js +9 -5
- package/lib/module/index.js.map +1 -1
- package/lib/module/stories/input-text-counter/input-text-counter.stories.js +253 -0
- package/lib/module/stories/input-text-counter/input-text-counter.stories.js.map +1 -0
- package/lib/module/stories/modal-activities/modal-activities.stories.js +1 -1
- package/lib/module/stories/modal-activities/modal-activities.stories.js.map +1 -1
- package/lib/module/stories/modal-activity-reason/modal-activity-reason.stories.js +193 -0
- package/lib/module/stories/modal-activity-reason/modal-activity-reason.stories.js.map +1 -0
- package/lib/module/stories/modal-change-activity/modal-change-activity.stories.js +3 -3
- package/lib/module/stories/modal-change-activity/modal-change-activity.stories.js.map +1 -1
- package/lib/module/stories/modal-create-activitie/modal-create-activitie.stories.js +78 -0
- package/lib/module/stories/modal-create-activitie/modal-create-activitie.stories.js.map +1 -0
- package/lib/module/stories/modal-journey-rectification/modal-journey-rectification.stories.js +168 -0
- package/lib/module/stories/modal-journey-rectification/modal-journey-rectification.stories.js.map +1 -0
- package/lib/module/stories/select-option/select-option.stories.js +1 -1
- package/lib/module/stories/select-option/select-option.stories.js.map +1 -1
- package/lib/module/stories/step-indicator/step-indicator.stories.js +2 -1
- package/lib/module/stories/step-indicator/step-indicator.stories.js.map +1 -1
- package/lib/module/styles/theme/theme.js +18 -2
- package/lib/module/styles/theme/theme.js.map +1 -1
- package/lib/module/utils/options-activity/index.js +22 -0
- package/lib/module/utils/options-activity/index.js.map +1 -0
- package/lib/module/utils/text-limit/index.js +30 -0
- package/lib/module/utils/text-limit/index.js.map +1 -0
- package/lib/typescript/src/components/input-text-counter/index.d.ts +33 -0
- package/lib/typescript/src/components/input-text-counter/styles.d.ts +34 -0
- package/lib/typescript/src/components/modal-create-activitie/index.d.ts +7 -0
- package/lib/typescript/src/components/modal-create-activitie/interface.d.ts +18 -0
- package/lib/typescript/src/components/modal-create-activitie/styles.d.ts +32 -0
- package/lib/typescript/src/components/modal-journey-rectification/index.d.ts +7 -0
- package/lib/typescript/src/components/modal-journey-rectification/styles.d.ts +32 -0
- package/lib/typescript/src/components/modals/modal-activity-reason/index.d.ts +7 -0
- package/lib/typescript/src/components/selects/select-date-and-hours/index.d.ts +12 -0
- package/lib/typescript/src/components/selects/select-date-and-hours/interface.d.ts +21 -0
- package/lib/typescript/src/components/selects/select-date-and-hours/styles.d.ts +24 -0
- package/lib/typescript/src/components/selects/select-option/index.d.ts +3 -6
- package/lib/typescript/src/index.d.ts +7 -3
- package/lib/typescript/src/stories/input-text-counter/input-text-counter.stories.d.ts +17 -0
- package/lib/typescript/src/stories/modal-activities/modal-activities.stories.d.ts +1 -1
- package/lib/typescript/src/stories/modal-activity-reason/modal-activity-reason.stories.d.ts +15 -0
- package/lib/typescript/src/stories/modal-change-activity/modal-change-activity.stories.d.ts +1 -1
- package/lib/typescript/src/stories/modal-create-activitie/modal-create-activitie.stories.d.ts +12 -0
- package/lib/typescript/src/stories/modal-journey-rectification/modal-journey-rectification.stories.d.ts +34 -0
- package/lib/typescript/src/stories/select-option/select-option.stories.d.ts +1 -1
- package/lib/typescript/src/styles/global/theme-provider.d.ts +16 -0
- package/lib/typescript/src/styles/theme/theme.d.ts +16 -0
- package/lib/typescript/src/utils/options-activity/index.d.ts +20 -0
- package/lib/typescript/src/utils/text-limit/index.d.ts +13 -0
- package/package.json +1 -1
- package/src/components/input-text-counter/index.tsx +64 -0
- package/src/components/input-text-counter/interface.d.ts +41 -0
- package/src/components/input-text-counter/styles.ts +38 -0
- package/src/components/modal-create-activitie/index.tsx +211 -0
- package/src/components/modal-create-activitie/interface.ts +22 -0
- package/src/components/modal-create-activitie/styles.ts +24 -0
- package/src/components/modal-journey-rectification/index.tsx +211 -0
- package/src/components/modal-journey-rectification/interface.d.ts +22 -0
- package/src/components/modal-journey-rectification/styles.ts +24 -0
- package/src/components/{modal-activities → modals/modal-activities}/data-activities/index.ts +65 -65
- package/src/components/{modal-activities → modals/modal-activities}/index.tsx +137 -137
- package/src/components/{modal-activities → modals/modal-activities}/interface.d.ts +32 -32
- package/src/components/modals/modal-activity-reason/index.tsx +162 -0
- package/src/components/modals/modal-activity-reason/interface.d.ts +10 -0
- package/src/components/{modal-change-activity → modals/modal-change-activity}/index.tsx +6 -6
- package/src/components/selects/select-date-and-hours/index.tsx +97 -0
- package/src/components/selects/select-date-and-hours/interface.ts +31 -0
- package/src/components/selects/select-date-and-hours/styles.ts +24 -0
- package/src/components/selects/select-option/index.tsx +50 -41
- package/src/components/step-indicator/index.tsx +235 -235
- package/src/components/step-indicator/interface.d.ts +2 -2
- package/src/index.ts +49 -45
- package/src/stories/input-text-counter/input-text-counter.stories.tsx +232 -0
- package/src/stories/modal-activities/modal-activities.stories.tsx +64 -64
- package/src/stories/modal-activity-reason/modal-activity-reason.stories.tsx +192 -0
- package/src/stories/modal-change-activity/modal-change-activity.stories.tsx +49 -49
- package/src/stories/modal-create-activitie/modal-create-activitie.stories.tsx +82 -0
- package/src/stories/modal-journey-rectification/modal-journey-rectification.stories.tsx +161 -0
- package/src/stories/select-option/select-option.stories.tsx +1 -1
- package/src/stories/step-indicator/step-indicator.stories.tsx +2 -1
- package/src/styles/theme/theme.ts +17 -0
- package/src/utils/options-activity/index.ts +14 -0
- package/src/utils/text-limit/index.ts +28 -0
- package/lib/commonjs/components/modal-activities/data-activities/index.js.map +0 -1
- package/lib/commonjs/components/modal-activities/index.js.map +0 -1
- package/lib/commonjs/components/modal-activities/interface.d.js.map +0 -1
- package/lib/commonjs/components/modal-change-activity/index.js.map +0 -1
- package/lib/module/components/modal-activities/data-activities/index.js.map +0 -1
- package/lib/module/components/modal-activities/index.js.map +0 -1
- package/lib/module/components/modal-activities/interface.d.js.map +0 -1
- package/lib/module/components/modal-change-activity/index.js.map +0 -1
- /package/lib/commonjs/components/{modal-activities → input-text-counter}/interface.d.js +0 -0
- /package/lib/module/components/{modal-activities → input-text-counter}/interface.d.js +0 -0
- /package/lib/typescript/src/components/{modal-activities → modals/modal-activities}/data-activities/index.d.ts +0 -0
- /package/lib/typescript/src/components/{modal-activities → modals/modal-activities}/index.d.ts +0 -0
- /package/lib/typescript/src/components/{modal-change-activity → modals/modal-change-activity}/index.d.ts +0 -0
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IMPORTS
|
|
3
|
+
*/
|
|
4
|
+
import React, { useMemo, useState, useCallback } from "react";
|
|
5
|
+
import { Modal, View, Pressable } from "react-native";
|
|
6
|
+
|
|
7
|
+
// components
|
|
8
|
+
import Box from "..//box";
|
|
9
|
+
import { Button }from "../button";
|
|
10
|
+
|
|
11
|
+
import { Typography } from "../typography";
|
|
12
|
+
|
|
13
|
+
import ActivityFields from "../selects/select-date-and-hours";
|
|
14
|
+
|
|
15
|
+
import SelectOption from "../selects/select-option";
|
|
16
|
+
|
|
17
|
+
// commons
|
|
18
|
+
import { Icons } from "../../common/icons-svg";
|
|
19
|
+
import { asBaseComponent } from "../../@types/as-base-component";
|
|
20
|
+
|
|
21
|
+
// helpers
|
|
22
|
+
import { OPTIONS } from "../../utils/options-activity";
|
|
23
|
+
|
|
24
|
+
// typings
|
|
25
|
+
import type { IDateAndHoursProps, IModalCreateActivitieProps } from "./interface";
|
|
26
|
+
|
|
27
|
+
// styles / theme
|
|
28
|
+
import { theme } from "../../styles/theme/theme";
|
|
29
|
+
import { styles } from "./styles";
|
|
30
|
+
import { formatDate, formHoursMinute } from "../../utils/format-data";
|
|
31
|
+
|
|
32
|
+
const ModalCreteActivitie: React.FC<IModalCreateActivitieProps<any>> = React.memo(
|
|
33
|
+
({ visible, onClose, onPressConfirm, textTitle }) => {
|
|
34
|
+
const [dateAndHours, setDateAndHours] = useState<IDateAndHoursProps>({
|
|
35
|
+
date: formatDate(new Date()),
|
|
36
|
+
hours: formHoursMinute(String(new Date().getHours() * 3600 + new Date().getMinutes() * 60)),
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
// estados controlados mínimos
|
|
40
|
+
const [selectedActivitie, setSelectedActivitie] = useState<string | null>(
|
|
41
|
+
OPTIONS[0]?.value ?? null
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
// label do motivo derivada com memo
|
|
45
|
+
const activitieLabel = useMemo(
|
|
46
|
+
() => OPTIONS.find((activitie) => activitie.value === selectedActivitie)?.label ?? null,
|
|
47
|
+
[selectedActivitie]
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
// handlers estáveis
|
|
51
|
+
const handleChangeReason = useCallback((value: string | null) => {
|
|
52
|
+
setSelectedActivitie(value);
|
|
53
|
+
}, []);
|
|
54
|
+
|
|
55
|
+
const handleCancel = useCallback(() => {
|
|
56
|
+
onClose?.();
|
|
57
|
+
}, [onClose]);
|
|
58
|
+
|
|
59
|
+
const handleConfirm = useCallback(() => {
|
|
60
|
+
onPressConfirm?.({
|
|
61
|
+
reasonValue: selectedActivitie,
|
|
62
|
+
label: activitieLabel,
|
|
63
|
+
dateAndHours: dateAndHours,
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
onClose?.();
|
|
67
|
+
}, [onPressConfirm, onClose, activitieLabel, selectedActivitie, dateAndHours]);
|
|
68
|
+
|
|
69
|
+
return (
|
|
70
|
+
<Modal
|
|
71
|
+
animationType="fade"
|
|
72
|
+
transparent
|
|
73
|
+
visible={visible}
|
|
74
|
+
onRequestClose={handleCancel}
|
|
75
|
+
statusBarTranslucent
|
|
76
|
+
>
|
|
77
|
+
<Pressable style={styles.overlay} onPress={handleCancel}>
|
|
78
|
+
<Box
|
|
79
|
+
width="90%"
|
|
80
|
+
backgroundColor={theme.colors.orange[500]}
|
|
81
|
+
borderStyled={{ borderRadius: theme.borderWidths.thick_medium }}
|
|
82
|
+
paddingStyle={{
|
|
83
|
+
paddingLeft: theme.paddings["2xs"],
|
|
84
|
+
paddingRight: theme.paddings["2xs"],
|
|
85
|
+
paddingTop: theme.paddings.sm,
|
|
86
|
+
paddingBottom: theme.paddings.sm,
|
|
87
|
+
}}
|
|
88
|
+
>
|
|
89
|
+
<View style={styles.headerRow}>
|
|
90
|
+
<Icons
|
|
91
|
+
icon="EXCLAMATION_TRIANGLE"
|
|
92
|
+
color={theme.colors.orange[500]}
|
|
93
|
+
background={theme.colors.neutral[300]}
|
|
94
|
+
size={22}
|
|
95
|
+
/>
|
|
96
|
+
<Typography
|
|
97
|
+
text={textTitle ?? "Incluir atividade"}
|
|
98
|
+
color={theme.colors.neutral[25]}
|
|
99
|
+
marginLeft={theme.margins["2xs"]}
|
|
100
|
+
fontFamily={theme.fonts.inter_bold}
|
|
101
|
+
fontWeight="700"
|
|
102
|
+
size={theme.fontSizes.lg}
|
|
103
|
+
/>
|
|
104
|
+
</View>
|
|
105
|
+
|
|
106
|
+
<Box
|
|
107
|
+
backgroundColor={theme.colors.neutral[300]}
|
|
108
|
+
paddingStyle={{ padding: theme.paddings.xs }}
|
|
109
|
+
borderStyled={{ borderRadius: theme.borderWidths.thick_medium }}
|
|
110
|
+
>
|
|
111
|
+
<Typography
|
|
112
|
+
text="Preencha os dados da atividade que deseja incluir."
|
|
113
|
+
color={theme.colors.black[100]}
|
|
114
|
+
fontFamily={theme.fonts.inter_regular_400}
|
|
115
|
+
fontWeight="400"
|
|
116
|
+
lineHeight={theme.lineHeight["2xl"]}
|
|
117
|
+
size={theme.fontSizes.sm}
|
|
118
|
+
marginBottom={16}
|
|
119
|
+
/>
|
|
120
|
+
|
|
121
|
+
<SelectOption
|
|
122
|
+
titleLabel="Selecione um motivo"
|
|
123
|
+
sizeTitleLabel={18}
|
|
124
|
+
dataOption={OPTIONS as any}
|
|
125
|
+
handleSelectDown={handleChangeReason}
|
|
126
|
+
backgroundColor={theme.colors.neutral[300]}
|
|
127
|
+
/>
|
|
128
|
+
|
|
129
|
+
<ActivityFields
|
|
130
|
+
disabled={false}
|
|
131
|
+
icon={"CALENDAR"}
|
|
132
|
+
value={dateAndHours?.date}
|
|
133
|
+
onPressConfirm={(value) =>
|
|
134
|
+
setDateAndHours({ date: value, hours: dateAndHours?.hours })
|
|
135
|
+
}
|
|
136
|
+
/>
|
|
137
|
+
|
|
138
|
+
<ActivityFields
|
|
139
|
+
disabled={false}
|
|
140
|
+
icon={"TIMER"}
|
|
141
|
+
value={dateAndHours?.hours}
|
|
142
|
+
onPressConfirm={(value) =>
|
|
143
|
+
setDateAndHours({ date: dateAndHours?.date, hours: value })
|
|
144
|
+
}
|
|
145
|
+
/>
|
|
146
|
+
|
|
147
|
+
<View style={styles.actions}>
|
|
148
|
+
<Button
|
|
149
|
+
title="CANCELAR"
|
|
150
|
+
onPress={handleCancel}
|
|
151
|
+
width="48%"
|
|
152
|
+
height={40}
|
|
153
|
+
isLoading={false}
|
|
154
|
+
disabled={false}
|
|
155
|
+
backgroundColor={theme.colors.neutral[300]}
|
|
156
|
+
buttonTextStyle={{
|
|
157
|
+
color: theme.colors.blue[500],
|
|
158
|
+
fontFamily: theme.fonts.inter_medium_500,
|
|
159
|
+
fontSize: theme.fontSizes.xs,
|
|
160
|
+
fontWeight: "500",
|
|
161
|
+
}}
|
|
162
|
+
flexStyle={{
|
|
163
|
+
flexDirection: "row",
|
|
164
|
+
alignItems: "center",
|
|
165
|
+
justifyContent: "center",
|
|
166
|
+
textAlign: "center",
|
|
167
|
+
}}
|
|
168
|
+
borderStyled={{
|
|
169
|
+
borderWidth: theme.borderWidths.thin,
|
|
170
|
+
borderColor: theme.colors.blue[100],
|
|
171
|
+
borderRadius: theme.borderWidths.thick_medium,
|
|
172
|
+
}}
|
|
173
|
+
/>
|
|
174
|
+
|
|
175
|
+
<Button
|
|
176
|
+
title="CONFIRMAR"
|
|
177
|
+
onPress={handleConfirm}
|
|
178
|
+
width="48%"
|
|
179
|
+
height={40}
|
|
180
|
+
isLoading={false}
|
|
181
|
+
disabled={false}
|
|
182
|
+
backgroundColor={theme.colors.blue[500]}
|
|
183
|
+
buttonTextStyle={{
|
|
184
|
+
color: theme.colors.neutral[25],
|
|
185
|
+
fontFamily: theme.fonts.inter_medium_500,
|
|
186
|
+
fontSize: theme.fontSizes.xs,
|
|
187
|
+
fontWeight: "500",
|
|
188
|
+
}}
|
|
189
|
+
flexStyle={{
|
|
190
|
+
flexDirection: "row",
|
|
191
|
+
alignItems: "center",
|
|
192
|
+
justifyContent: "center",
|
|
193
|
+
textAlign: "center",
|
|
194
|
+
}}
|
|
195
|
+
borderStyled={{
|
|
196
|
+
borderWidth: theme.borderWidths.thin,
|
|
197
|
+
borderColor: theme.colors.blue[100],
|
|
198
|
+
borderRadius: theme.borderWidths.thick_medium,
|
|
199
|
+
}}
|
|
200
|
+
/>
|
|
201
|
+
</View>
|
|
202
|
+
</Box>
|
|
203
|
+
</Box>
|
|
204
|
+
</Pressable>
|
|
205
|
+
</Modal>
|
|
206
|
+
);
|
|
207
|
+
}
|
|
208
|
+
);
|
|
209
|
+
|
|
210
|
+
ModalCreteActivitie.displayName = "ModalCreteActivitie";
|
|
211
|
+
export default asBaseComponent(ModalCreteActivitie);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/* eslint-disable no-unused-vars */
|
|
2
|
+
/**
|
|
3
|
+
* IMPORTS
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
type IModalCreateActivitieProps<T> = {
|
|
7
|
+
visible: boolean;
|
|
8
|
+
textTitle?: string;
|
|
9
|
+
options?: T;
|
|
10
|
+
onClose: () => void;
|
|
11
|
+
onPressConfirm: (value: T) => void;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
type IDateAndHoursProps = {
|
|
15
|
+
date: string;
|
|
16
|
+
hours: string;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* EXPORTS
|
|
21
|
+
*/
|
|
22
|
+
export type { IModalCreateActivitieProps, IDateAndHoursProps };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IMPORTS
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { StyleSheet } from "react-native";
|
|
6
|
+
import { theme } from "../../styles/theme/theme";
|
|
7
|
+
|
|
8
|
+
const styles = StyleSheet.create({
|
|
9
|
+
overlay: {
|
|
10
|
+
flex: 1,
|
|
11
|
+
justifyContent: "center",
|
|
12
|
+
alignItems: "center",
|
|
13
|
+
backgroundColor: theme.shadows.z1,
|
|
14
|
+
},
|
|
15
|
+
card: { width: "90%" },
|
|
16
|
+
headerRow: { marginBottom: 10, marginLeft: 4, flexDirection: "row", alignItems: "center" },
|
|
17
|
+
content: { padding: theme.paddings.xs },
|
|
18
|
+
actions: { marginTop: 16, flexDirection: "row", justifyContent: "space-between" },
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* EXPORTS
|
|
23
|
+
*/
|
|
24
|
+
export { styles };
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IMPORTS
|
|
3
|
+
*/
|
|
4
|
+
import React, { useMemo, useState, useCallback } from "react";
|
|
5
|
+
import { Modal, View, Pressable } from "react-native";
|
|
6
|
+
|
|
7
|
+
// components
|
|
8
|
+
import Box from "..//box";
|
|
9
|
+
import { Button }from "../button";
|
|
10
|
+
|
|
11
|
+
import { Typography } from "../typography";
|
|
12
|
+
|
|
13
|
+
import ActivityFields from "../selects/select-date-and-hours";
|
|
14
|
+
|
|
15
|
+
import SelectOption from "../selects/select-option";
|
|
16
|
+
|
|
17
|
+
// commons
|
|
18
|
+
import { Icons } from "../../common/icons-svg";
|
|
19
|
+
import { asBaseComponent } from "../../@types/as-base-component";
|
|
20
|
+
|
|
21
|
+
// helpers
|
|
22
|
+
import { OPTIONS } from "../../utils/options-activity";
|
|
23
|
+
|
|
24
|
+
// typings
|
|
25
|
+
import type { IDateAndHoursProps, IModalJourneyRectificationProps } from "./interface";
|
|
26
|
+
|
|
27
|
+
// styles / theme
|
|
28
|
+
import { theme } from "../../styles/theme/theme";
|
|
29
|
+
import { styles } from "./styles";
|
|
30
|
+
import { formatDate, formHoursMinute } from "../../utils/format-data";
|
|
31
|
+
|
|
32
|
+
const ModalJourneyRectification: React.FC<IModalJourneyRectificationProps<any>> = React.memo(
|
|
33
|
+
({ visible, onClose, onPressConfirm, textTitle }) => {
|
|
34
|
+
const [dateAndHours, setDateAndHours] = useState<IDateAndHoursProps>({
|
|
35
|
+
date: formatDate(new Date()),
|
|
36
|
+
hours: formHoursMinute(String(new Date().getHours() * 3600 + new Date().getMinutes() * 60)),
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
// estados controlados mínimos
|
|
40
|
+
const [selectedActivitie, setSelectedActivitie] = useState<string | null>(
|
|
41
|
+
OPTIONS[0]?.value ?? null
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
// label do motivo derivada com memo
|
|
45
|
+
const activitieLabel = useMemo(
|
|
46
|
+
() => OPTIONS.find((activitie) => activitie.value === selectedActivitie)?.label ?? null,
|
|
47
|
+
[selectedActivitie]
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
// handlers estáveis
|
|
51
|
+
const handleChangeReason = useCallback((value: string | null) => {
|
|
52
|
+
setSelectedActivitie(value);
|
|
53
|
+
}, []);
|
|
54
|
+
|
|
55
|
+
const handleCancel = useCallback(() => {
|
|
56
|
+
onClose?.();
|
|
57
|
+
}, [onClose]);
|
|
58
|
+
|
|
59
|
+
const handleConfirm = useCallback(() => {
|
|
60
|
+
onPressConfirm?.({
|
|
61
|
+
reasonValue: selectedActivitie,
|
|
62
|
+
label: activitieLabel,
|
|
63
|
+
dateAndHours: dateAndHours,
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
onClose?.();
|
|
67
|
+
}, [onPressConfirm, onClose, activitieLabel, selectedActivitie, dateAndHours]);
|
|
68
|
+
|
|
69
|
+
return (
|
|
70
|
+
<Modal
|
|
71
|
+
animationType="fade"
|
|
72
|
+
transparent
|
|
73
|
+
visible={visible}
|
|
74
|
+
onRequestClose={handleCancel}
|
|
75
|
+
statusBarTranslucent
|
|
76
|
+
>
|
|
77
|
+
<Pressable style={styles.overlay} onPress={handleCancel}>
|
|
78
|
+
<Box
|
|
79
|
+
width="90%"
|
|
80
|
+
backgroundColor={theme.colors.orange[500]}
|
|
81
|
+
borderStyled={{ borderRadius: theme.borderWidths.thick_medium }}
|
|
82
|
+
paddingStyle={{
|
|
83
|
+
paddingLeft: theme.paddings["2xs"],
|
|
84
|
+
paddingRight: theme.paddings["2xs"],
|
|
85
|
+
paddingTop: theme.paddings.sm,
|
|
86
|
+
paddingBottom: theme.paddings.sm,
|
|
87
|
+
}}
|
|
88
|
+
>
|
|
89
|
+
<View style={styles.headerRow}>
|
|
90
|
+
<Icons
|
|
91
|
+
icon="EXCLAMATION_TRIANGLE"
|
|
92
|
+
color={theme.colors.orange[500]}
|
|
93
|
+
background={theme.colors.neutral[300]}
|
|
94
|
+
size={22}
|
|
95
|
+
/>
|
|
96
|
+
<Typography
|
|
97
|
+
text={textTitle ?? "Editar atividad"}
|
|
98
|
+
color={theme.colors.neutral[25]}
|
|
99
|
+
marginLeft={theme.margins["2xs"]}
|
|
100
|
+
fontFamily={theme.fonts.inter_bold}
|
|
101
|
+
fontWeight="700"
|
|
102
|
+
size={theme.fontSizes.lg}
|
|
103
|
+
/>
|
|
104
|
+
</View>
|
|
105
|
+
|
|
106
|
+
<Box
|
|
107
|
+
backgroundColor={theme.colors.neutral[300]}
|
|
108
|
+
paddingStyle={{ padding: theme.paddings.xs }}
|
|
109
|
+
borderStyled={{ borderRadius: theme.borderWidths.thick_medium }}
|
|
110
|
+
>
|
|
111
|
+
<Typography
|
|
112
|
+
text="Confirme as alterações antes de salvar."
|
|
113
|
+
color={theme.colors.black[100]}
|
|
114
|
+
fontFamily={theme.fonts.inter_regular_400}
|
|
115
|
+
fontWeight="400"
|
|
116
|
+
lineHeight={theme.lineHeight["2xl"]}
|
|
117
|
+
size={theme.fontSizes.sm}
|
|
118
|
+
marginBottom={16}
|
|
119
|
+
/>
|
|
120
|
+
|
|
121
|
+
<SelectOption
|
|
122
|
+
titleLabel="Selecione um motivo"
|
|
123
|
+
sizeTitleLabel={18}
|
|
124
|
+
dataOption={OPTIONS as any}
|
|
125
|
+
handleSelectDown={handleChangeReason}
|
|
126
|
+
backgroundColor={theme.colors.neutral[300]}
|
|
127
|
+
/>
|
|
128
|
+
|
|
129
|
+
<ActivityFields
|
|
130
|
+
disabled={false}
|
|
131
|
+
icon={"CALENDAR"}
|
|
132
|
+
value={dateAndHours?.date}
|
|
133
|
+
onPressConfirm={(value) =>
|
|
134
|
+
setDateAndHours({ date: value, hours: dateAndHours?.hours })
|
|
135
|
+
}
|
|
136
|
+
/>
|
|
137
|
+
|
|
138
|
+
<ActivityFields
|
|
139
|
+
disabled={false}
|
|
140
|
+
icon={"TIMER"}
|
|
141
|
+
value={dateAndHours?.hours}
|
|
142
|
+
onPressConfirm={(value) =>
|
|
143
|
+
setDateAndHours({ date: dateAndHours?.date, hours: value })
|
|
144
|
+
}
|
|
145
|
+
/>
|
|
146
|
+
|
|
147
|
+
<View style={styles.actions}>
|
|
148
|
+
<Button
|
|
149
|
+
title="CANCELAR"
|
|
150
|
+
onPress={handleCancel}
|
|
151
|
+
width="48%"
|
|
152
|
+
height={40}
|
|
153
|
+
isLoading={false}
|
|
154
|
+
disabled={false}
|
|
155
|
+
backgroundColor={theme.colors.neutral[300]}
|
|
156
|
+
buttonTextStyle={{
|
|
157
|
+
color: theme.colors.blue[500],
|
|
158
|
+
fontFamily: theme.fonts.inter_medium_500,
|
|
159
|
+
fontSize: theme.fontSizes.xs,
|
|
160
|
+
fontWeight: "500",
|
|
161
|
+
}}
|
|
162
|
+
flexStyle={{
|
|
163
|
+
flexDirection: "row",
|
|
164
|
+
alignItems: "center",
|
|
165
|
+
justifyContent: "center",
|
|
166
|
+
textAlign: "center",
|
|
167
|
+
}}
|
|
168
|
+
borderStyled={{
|
|
169
|
+
borderWidth: theme.borderWidths.thin,
|
|
170
|
+
borderColor: theme.colors.blue[100],
|
|
171
|
+
borderRadius: theme.borderWidths.thick_medium,
|
|
172
|
+
}}
|
|
173
|
+
/>
|
|
174
|
+
|
|
175
|
+
<Button
|
|
176
|
+
title="CONFIRMAR"
|
|
177
|
+
onPress={handleConfirm}
|
|
178
|
+
width="48%"
|
|
179
|
+
height={40}
|
|
180
|
+
isLoading={false}
|
|
181
|
+
disabled={false}
|
|
182
|
+
backgroundColor={theme.colors.blue[500]}
|
|
183
|
+
buttonTextStyle={{
|
|
184
|
+
color: theme.colors.neutral[25],
|
|
185
|
+
fontFamily: theme.fonts.inter_medium_500,
|
|
186
|
+
fontSize: theme.fontSizes.xs,
|
|
187
|
+
fontWeight: "500",
|
|
188
|
+
}}
|
|
189
|
+
flexStyle={{
|
|
190
|
+
flexDirection: "row",
|
|
191
|
+
alignItems: "center",
|
|
192
|
+
justifyContent: "center",
|
|
193
|
+
textAlign: "center",
|
|
194
|
+
}}
|
|
195
|
+
borderStyled={{
|
|
196
|
+
borderWidth: theme.borderWidths.thin,
|
|
197
|
+
borderColor: theme.colors.blue[100],
|
|
198
|
+
borderRadius: theme.borderWidths.thick_medium,
|
|
199
|
+
}}
|
|
200
|
+
/>
|
|
201
|
+
</View>
|
|
202
|
+
</Box>
|
|
203
|
+
</Box>
|
|
204
|
+
</Pressable>
|
|
205
|
+
</Modal>
|
|
206
|
+
);
|
|
207
|
+
}
|
|
208
|
+
);
|
|
209
|
+
|
|
210
|
+
ModalJourneyRectification.displayName = "ModalJourneyRectification";
|
|
211
|
+
export default asBaseComponent(ModalJourneyRectification);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/* eslint-disable no-unused-vars */
|
|
2
|
+
/**
|
|
3
|
+
* IMPORTS
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
type IModalJourneyRectificationProps<T> = {
|
|
7
|
+
visible: boolean;
|
|
8
|
+
textTitle?: string;
|
|
9
|
+
options?: T;
|
|
10
|
+
onClose: () => void;
|
|
11
|
+
onPressConfirm: (value: T) => void;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
type IDateAndHoursProps = {
|
|
15
|
+
date: string;
|
|
16
|
+
hours: string;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* EXPORTS
|
|
21
|
+
*/
|
|
22
|
+
export type { IModalJourneyRectificationProps, IDateAndHoursProps };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IMPORTS
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { StyleSheet } from "react-native";
|
|
6
|
+
import { theme } from "../../styles/theme/theme";
|
|
7
|
+
|
|
8
|
+
const styles = StyleSheet.create({
|
|
9
|
+
overlay: {
|
|
10
|
+
flex: 1,
|
|
11
|
+
justifyContent: "center",
|
|
12
|
+
alignItems: "center",
|
|
13
|
+
backgroundColor: theme.shadows.z1,
|
|
14
|
+
},
|
|
15
|
+
card: { width: "90%" },
|
|
16
|
+
headerRow: { marginBottom: 10, marginLeft: 4, flexDirection: "row", alignItems: "center" },
|
|
17
|
+
content: { padding: theme.paddings.xs },
|
|
18
|
+
actions: { marginTop: 16, flexDirection: "row", justifyContent: "space-between" },
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* EXPORTS
|
|
23
|
+
*/
|
|
24
|
+
export { styles };
|
package/src/components/{modal-activities → modals/modal-activities}/data-activities/index.ts
RENAMED
|
@@ -1,65 +1,65 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* dados para os tipos de atividades selecionado
|
|
3
|
-
*/
|
|
4
|
-
export const activities = {
|
|
5
|
-
trabalho: [
|
|
6
|
-
{
|
|
7
|
-
id: 1,
|
|
8
|
-
referencia: "operacao_veiculo",
|
|
9
|
-
cor_hex: "000000",
|
|
10
|
-
descricao: "Operação com Veículo",
|
|
11
|
-
tipo: "trabalho",
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
id: 2,
|
|
15
|
-
referencia: "aguardando_carga",
|
|
16
|
-
cor_hex: "000000",
|
|
17
|
-
descricao: "Em carga",
|
|
18
|
-
tipo: "trabalho",
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
id: 3,
|
|
22
|
-
referencia: "aguardando_descarga",
|
|
23
|
-
cor_hex: "000000",
|
|
24
|
-
descricao: "Em Descarga",
|
|
25
|
-
tipo: "trabalho",
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
id: 8,
|
|
29
|
-
referencia: "disposicao_veiculo_parado",
|
|
30
|
-
cor_hex: "000000",
|
|
31
|
-
descricao: "Disposição com Veículo Parado",
|
|
32
|
-
tipo: "trabalho",
|
|
33
|
-
},
|
|
34
|
-
],
|
|
35
|
-
descanso: [
|
|
36
|
-
{
|
|
37
|
-
id: 5,
|
|
38
|
-
referencia: "repouso_semanal",
|
|
39
|
-
cor_hex: "000000",
|
|
40
|
-
descricao: "Repouso Semanal",
|
|
41
|
-
tipo: "descanso",
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
id: 6,
|
|
45
|
-
referencia: "repouso_noturno",
|
|
46
|
-
cor_hex: "000000",
|
|
47
|
-
descricao: "Repouso Noturno",
|
|
48
|
-
tipo: "descanso",
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
id: 7,
|
|
52
|
-
referencia: "refeicao",
|
|
53
|
-
cor_hex: "000000",
|
|
54
|
-
descricao: "Refeição",
|
|
55
|
-
tipo: "descanso",
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
id: 9,
|
|
59
|
-
referencia: "descanso",
|
|
60
|
-
cor_hex: "000000",
|
|
61
|
-
descricao: "Descanso",
|
|
62
|
-
tipo: "descanso",
|
|
63
|
-
},
|
|
64
|
-
],
|
|
65
|
-
};
|
|
1
|
+
/**
|
|
2
|
+
* dados para os tipos de atividades selecionado
|
|
3
|
+
*/
|
|
4
|
+
export const activities = {
|
|
5
|
+
trabalho: [
|
|
6
|
+
{
|
|
7
|
+
id: 1,
|
|
8
|
+
referencia: "operacao_veiculo",
|
|
9
|
+
cor_hex: "000000",
|
|
10
|
+
descricao: "Operação com Veículo",
|
|
11
|
+
tipo: "trabalho",
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
id: 2,
|
|
15
|
+
referencia: "aguardando_carga",
|
|
16
|
+
cor_hex: "000000",
|
|
17
|
+
descricao: "Em carga",
|
|
18
|
+
tipo: "trabalho",
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
id: 3,
|
|
22
|
+
referencia: "aguardando_descarga",
|
|
23
|
+
cor_hex: "000000",
|
|
24
|
+
descricao: "Em Descarga",
|
|
25
|
+
tipo: "trabalho",
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
id: 8,
|
|
29
|
+
referencia: "disposicao_veiculo_parado",
|
|
30
|
+
cor_hex: "000000",
|
|
31
|
+
descricao: "Disposição com Veículo Parado",
|
|
32
|
+
tipo: "trabalho",
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
descanso: [
|
|
36
|
+
{
|
|
37
|
+
id: 5,
|
|
38
|
+
referencia: "repouso_semanal",
|
|
39
|
+
cor_hex: "000000",
|
|
40
|
+
descricao: "Repouso Semanal",
|
|
41
|
+
tipo: "descanso",
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
id: 6,
|
|
45
|
+
referencia: "repouso_noturno",
|
|
46
|
+
cor_hex: "000000",
|
|
47
|
+
descricao: "Repouso Noturno",
|
|
48
|
+
tipo: "descanso",
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
id: 7,
|
|
52
|
+
referencia: "refeicao",
|
|
53
|
+
cor_hex: "000000",
|
|
54
|
+
descricao: "Refeição",
|
|
55
|
+
tipo: "descanso",
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
id: 9,
|
|
59
|
+
referencia: "descanso",
|
|
60
|
+
cor_hex: "000000",
|
|
61
|
+
descricao: "Descanso",
|
|
62
|
+
tipo: "descanso",
|
|
63
|
+
},
|
|
64
|
+
],
|
|
65
|
+
};
|