|
|
@@ -225,7 +225,8 @@ const HomePage: React.FC<HomePageProps> = () => {
|
|
|
|
|
|
// Handle promotion data
|
|
|
if (results[1].status === 'fulfilled') {
|
|
|
- setPassingThisPromotionToBell(results[1].value);
|
|
|
+ const passingThisPromotionToBell = results[1].value.filter((p: any) => p.is_show);
|
|
|
+ setPassingThisPromotionToBell(passingThisPromotionToBell);
|
|
|
} else if (results[1].status === 'rejected') {
|
|
|
Alert.alert('Error fetching promotions:', results[1].reason);
|
|
|
}
|
|
|
@@ -320,91 +321,86 @@ const HomePage: React.FC<HomePageProps> = () => {
|
|
|
onRequestClose={() => setShowLicencePlateMessage(false)}
|
|
|
>
|
|
|
<View className="flex-1 bg-black/50 items-center justify-center">
|
|
|
- <View className="flex flex-col rounded-2xl bg-white overflow-hidden w-[80%]">
|
|
|
- <View className="bg-[#E3F2F8]">
|
|
|
- <Text className="text-base lg:text-lg font-[500] text-center p-4">
|
|
|
- 請添加您的車牌號碼
|
|
|
- </Text>
|
|
|
- </View>
|
|
|
- <View className="p-4 ">
|
|
|
- <Text className="text-sm lg:text-base font-[500] text-left mb-4">
|
|
|
- 為更好地為您提供服務,請在您的帳戶中添加車牌號碼。
|
|
|
- </Text>
|
|
|
- <NormalInput
|
|
|
- value={licensePlate}
|
|
|
- placeholder="車牌號碼"
|
|
|
- onChangeText={(s) => setLicensePlate(s)}
|
|
|
- extendedStyle={{ borderRadius: 12, marginBottom: 0 }}
|
|
|
- textContentType="none"
|
|
|
- autoComplete="off"
|
|
|
- keyboardType="default"
|
|
|
- />
|
|
|
- </View>
|
|
|
- <View className="pr-4 pl-4 pb-4 ">
|
|
|
- <NormalButton
|
|
|
- title={<Text className="text-white text-sm lg:text-lg">確定</Text>}
|
|
|
- onPress={() => {
|
|
|
- //here when users click confirm, i want to pop another modal that say you have entered "xxxxxx", click confirm to continue
|
|
|
- if (!licensePlate.trim()) {
|
|
|
- Alert.alert('請輸入車牌號碼');
|
|
|
- return;
|
|
|
- }
|
|
|
- if (licensePlate.trim().length < 4 || licensePlate.trim().length > 10) {
|
|
|
- Alert.alert('無效的車牌號碼', '請輸入有效的車牌號碼');
|
|
|
- return;
|
|
|
- }
|
|
|
- setShowConfirmationModal(true);
|
|
|
- }}
|
|
|
- />
|
|
|
- </View>
|
|
|
- </View>
|
|
|
- </View>
|
|
|
- </Modal>
|
|
|
- )}
|
|
|
-
|
|
|
- {showConfirmationModal && (
|
|
|
- <Modal
|
|
|
- animationType="fade"
|
|
|
- transparent={true}
|
|
|
- visible={showConfirmationModal}
|
|
|
- onRequestClose={() => setShowConfirmationModal(false)}
|
|
|
- >
|
|
|
- <Pressable
|
|
|
- className="flex-1 bg-black/50 items-center justify-center"
|
|
|
- onPress={() => setShowConfirmationModal(false)}
|
|
|
- >
|
|
|
- <View className="flex flex-col rounded-2xl bg-white overflow-hidden w-[80%]">
|
|
|
- <View className="bg-[#E3F2F8]">
|
|
|
- <Text className="text-base lg:text-lg font-[500] text-center p-4">確認車牌號碼</Text>
|
|
|
- </View>
|
|
|
- <View className="p-4">
|
|
|
- <Text className="text-sm lg:text-base font-[500] text-center mb-4">
|
|
|
- 您輸入的車牌號碼為:{licensePlate}
|
|
|
- </Text>
|
|
|
- </View>
|
|
|
- <View className="flex-row p-4 space-x-4">
|
|
|
- <View className="flex-1">
|
|
|
- <NormalButton
|
|
|
- title={<Text className="text-white text-sm lg:text-lg">取消</Text>}
|
|
|
- onPress={() => setShowConfirmationModal(false)}
|
|
|
+ {!showConfirmationModal ? (
|
|
|
+ // License Plate Input Modal
|
|
|
+ <View className="flex flex-col rounded-2xl bg-white overflow-hidden w-[80%]">
|
|
|
+ <View className="bg-[#E3F2F8]">
|
|
|
+ <Text className="text-base lg:text-lg font-[500] text-center p-4">
|
|
|
+ 請添加您的車牌號碼
|
|
|
+ </Text>
|
|
|
+ </View>
|
|
|
+ <View className="p-4 ">
|
|
|
+ <Text className="text-sm lg:text-base font-[500] text-left mb-4">
|
|
|
+ 為更好地為您提供服務,請在您的帳戶中添加車牌號碼。
|
|
|
+ </Text>
|
|
|
+ <NormalInput
|
|
|
+ value={licensePlate}
|
|
|
+ placeholder="車牌號碼"
|
|
|
+ onChangeText={(s) => setLicensePlate(s)}
|
|
|
+ extendedStyle={{ borderRadius: 12, marginBottom: 0 }}
|
|
|
+ textContentType="none"
|
|
|
+ autoComplete="off"
|
|
|
+ keyboardType="default"
|
|
|
/>
|
|
|
</View>
|
|
|
- <View className="flex-1">
|
|
|
+ <View className="pr-4 pl-4 pb-4 ">
|
|
|
<NormalButton
|
|
|
- title={<Text className="text-white text-sm lg:text-lg">確認</Text>}
|
|
|
+ title={<Text className="text-white text-sm lg:text-lg">確定</Text>}
|
|
|
onPress={() => {
|
|
|
- saveLicensePlate(licensePlate);
|
|
|
- setShowConfirmationModal(false);
|
|
|
- setShowLicencePlateMessage(false);
|
|
|
- setLicensePlate('');
|
|
|
+ console.log('licensePlate', licensePlate);
|
|
|
+ //here when users click confirm, i want to pop another modal that say you have entered "xxxxxx", click confirm to continue
|
|
|
+ if (!licensePlate.trim()) {
|
|
|
+ Alert.alert('請輸入車牌號碼');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (licensePlate.trim().length < 4 || licensePlate.trim().length > 10) {
|
|
|
+ Alert.alert('無效的車牌號碼', '請輸入有效的車牌號碼');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ setShowConfirmationModal(true);
|
|
|
+ console.log('showConfirmationModal', showConfirmationModal);
|
|
|
}}
|
|
|
/>
|
|
|
</View>
|
|
|
</View>
|
|
|
- </View>
|
|
|
- </Pressable>
|
|
|
+ ) : (
|
|
|
+ // Confirmation Modal
|
|
|
+ <View className="flex flex-col rounded-2xl bg-white overflow-hidden w-[80%]">
|
|
|
+ <View className="bg-[#E3F2F8]">
|
|
|
+ <Text className="text-base lg:text-lg font-[500] text-center p-4">
|
|
|
+ 確認車牌號碼
|
|
|
+ </Text>
|
|
|
+ </View>
|
|
|
+ <View className="p-4">
|
|
|
+ <Text className="text-sm lg:text-base font-[500] text-center mb-4">
|
|
|
+ 您輸入的車牌號碼為:{licensePlate}
|
|
|
+ </Text>
|
|
|
+ </View>
|
|
|
+ <View className="flex-row p-4 space-x-4">
|
|
|
+ <View className="flex-1">
|
|
|
+ <NormalButton
|
|
|
+ title={<Text className="text-white text-sm lg:text-lg">取消</Text>}
|
|
|
+ onPress={() => setShowConfirmationModal(false)}
|
|
|
+ />
|
|
|
+ </View>
|
|
|
+ <View className="flex-1">
|
|
|
+ <NormalButton
|
|
|
+ title={<Text className="text-white text-sm lg:text-lg">確認</Text>}
|
|
|
+ onPress={() => {
|
|
|
+ saveLicensePlate(licensePlate);
|
|
|
+ setShowConfirmationModal(false);
|
|
|
+ setShowLicencePlateMessage(false);
|
|
|
+ setLicensePlate('');
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ </View>
|
|
|
+ </View>
|
|
|
+ </View>
|
|
|
+ )}
|
|
|
+ </View>
|
|
|
</Modal>
|
|
|
)}
|
|
|
+
|
|
|
<ScrollView showsVerticalScrollIndicator={false} className="flex-1 mx-[5%] ">
|
|
|
<View className=" flex-1 pt-8 ">
|
|
|
<View className="flex-row items-center pb-4">
|