-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSelect-package.tsx
149 lines (136 loc) · 4.01 KB
/
Select-package.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
import { Colors } from "@/constants/Colors";
import { MaterialIcons } from "@expo/vector-icons";
import { router,useLocalSearchParams } from "expo-router";
import React, { useContext, useState } from "react";
import {
View,
Text,
ScrollView,
Alert
} from "react-native";
import Icon from "react-native-vector-icons/FontAwesome";
import { ThemeContext } from "@/ctx/ThemeContext";
import Typography from "@/constants/Typography";
import DropDown from "@/components/UI/DropDown";
import { SvgXml } from "react-native-svg";
import {
chatIcon,
clockIcon,
lightClockIcon,
phoneIcon,
videoIcon,
} from "@/constants/icon";
import PackagesContainer from "@/components/PackagesContainer";
import Button from "@/components/UI/Button";
import { StatusBar } from "expo-status-bar";
const SelectPackage = () => {
const { theme } = useContext(ThemeContext);
const { Doctor_id, hour, date,patient_id } = useLocalSearchParams()
const [selectedPackageTitle, setSelectedPackageTitle] = useState<{ title: string, price: string }>({ title: "Messaging", price: "Rwf20" })
const [selectedDuration, setSelectedDuration] = useState<string>("1 hour")
const handleNextPress = () => {
if (!selectedPackageTitle||!selectedDuration) {
Alert.alert("Please select both Duration and package")
return;
}
router.push({
pathname: "ActionMenu/Booking/Patient-details",
params:{ Doctor_id:Doctor_id,hour:hour,date:date,packageTitle:selectedPackageTitle.title,packagePrice:selectedPackageTitle.price,patient_id:patient_id,duration: selectedDuration,},
});
}
const packages = [
{
id: "0",
title: "Messaging",
description: "Chat messages with doctor",
price: "Rwf20",
icon: () => <SvgXml xml={chatIcon} />,
},
{
id: "1",
title: "Voice Call",
description: "Voice call with doctor",
price: "Rwf40",
icon: () => <SvgXml xml={phoneIcon} />,
},
{
id: "2",
title: "Video Call",
description: "Video call with doctor",
price: "Rwf60",
icon: () => <SvgXml xml={videoIcon} />,
},
];
return (
<>
<StatusBar style={theme === "light" ? "dark" : "light"} />
<ScrollView
style={{
backgroundColor: theme === "light" ? "#FFFFFF" : "#181A20",
width: "100%",
paddingVertical: 20,
flex: 1,
}}
contentContainerStyle={{
gap: 30,
flexGrow: 1,
}}
>
<View style={{ gap: 20, paddingHorizontal: 20 }}>
<Text
style={[
Typography.bold.xxLarge,
{
color: theme === "light" ? "#212121" : "#FFFFFF",
},
]}
>
Select Duration
</Text>
<DropDown
data={[
{ label: "1 hour", value: "1 hour" },
{ label: "30 minutes", value: "30 minutes" },
]}
leftIcon={() => (
<SvgXml xml={theme === "light" ? clockIcon : lightClockIcon} />
)}
onSelect={(value) => setSelectedDuration(value)}
/>
</View>
<View style={{ gap: 15 }}>
<Text
style={[
Typography.bold.xxLarge,
{
color: theme === "light" ? "#212121" : "#FFFFFF",
paddingHorizontal: 20,
},
]}
>
Select Package
</Text>
<View>
<PackagesContainer
data={packages}
onPackageSelect={(title, price) => setSelectedPackageTitle({ title, price })}
/>
</View>
</View>
<View
style={{
justifyContent: "flex-end",
paddingHorizontal: 20,
marginTop: "auto",
}}
>
<Button
title="Next"
onPress={handleNextPress}
/>
</View>
</ScrollView>
</>
);
};
export default SelectPackage;