Ian Fung 10 달 전
부모
커밋
4c64bd065c

+ 4 - 2
app/(auth)/(tabs)/(home)/selectCoupon.tsx

@@ -22,6 +22,8 @@ import { useChargingStore } from '../../../../providers/scan_qr_payload_store';
 import { ArrowRightSvg } from '../../../../component/global/SVG';
 import { useRef } from 'react';
 import NormalButton from '../../../../component/global/normal_button';
+
+//this is from optionPage => 優惠券
 const SelectCouponComponent = () => {
     const screenHeight = Dimensions.get('window').height;
     const {
@@ -204,7 +206,7 @@ const SelectCouponComponent = () => {
                             className="flex-1 flex-col bg-white p-8 "
                             contentContainerStyle={{ paddingBottom: 100 }}
                         >
-                            <Text className="text-lg md:text-xl lg:text-2xl">優惠細節</Text>
+                            <Text className="text-lg md:text-xl lg:text-2xl">優惠細節</Text>
                             <View style={{ height: 1, backgroundColor: '#ccc', marginVertical: 24 }} />
                             {/* coupon row */}
                             {processedCoupons &&
@@ -235,7 +237,7 @@ const SelectCouponComponent = () => {
                                         </View>
 
                                         {/* x 1 */}
-                                        <View className="flex flex-row items-center">
+                                        <View className="flex flex-row items-center ">
                                             <Text>X </Text>
                                             <View className="w-8 h-8 rounded-full bg-[#02677D] flex items-center justify-center">
                                                 <Text className="text-white text-center text-lg">

+ 11 - 4
component/global/couponTabView.tsx

@@ -49,7 +49,7 @@ const FirstRoute = ({
         <View className="flex-1">
             <ScrollView
                 style={{ flex: 1, backgroundColor: 'white', marginTop: 14 }}
-                contentContainerStyle={{ paddingBottom: 120 }}
+                contentContainerStyle={{ paddingBottom: 200 }}
             >
                 <View className="flex-1 flex-col">
                     {loading ? (
@@ -61,7 +61,8 @@ const FirstRoute = ({
                             <View>
                                 {coupons.filter(
                                     (coupon: any) =>
-                                        coupon.is_consumed === false && new Date(coupon.expire_date) > new Date()
+                                        coupon.is_consumed === false &&
+                                        (coupon.expire_date === null || new Date(coupon.expire_date) > new Date())
                                 ).length === 0 ? (
                                     <Text className="pl-4">暫時戶口沒有優惠券。</Text>
                                 ) : (
@@ -69,7 +70,8 @@ const FirstRoute = ({
                                         .filter(
                                             (coupon: any) =>
                                                 coupon.is_consumed === false &&
-                                                new Date(coupon.expire_date) > new Date()
+                                                (coupon.expire_date === null ||
+                                                    new Date(coupon.expire_date) > new Date())
                                         )
                                         .sort(
                                             (a: any, b: any) =>
@@ -103,7 +105,11 @@ const SecondRoute = ({ coupons }: { coupons: any }) => (
     <ScrollView style={{ flex: 1, backgroundColor: 'white', marginTop: 14 }}>
         <View className="flex-1 flex-col">
             {coupons
-                .filter((coupon: any) => coupon.is_consumed === true || new Date(coupon.expire_date) < new Date())
+                .filter(
+                    (coupon: any) =>
+                        coupon.is_consumed === true ||
+                        (coupon.expire_date !== null && new Date(coupon.expire_date) < new Date())
+                )
                 .slice(0, 30)
                 .map((coupon: any, index: any) => (
                     <IndividualCouponComponent
@@ -113,6 +119,7 @@ const SecondRoute = ({ coupons }: { coupons: any }) => (
                         detail={coupon.coupon.description}
                         date={formatCouponDate(coupon.expire_date)}
                         setOpacity={true}
+                        noCircle={true}
                     />
                 ))}
         </View>

+ 1 - 1
component/global/tabView.tsx

@@ -119,7 +119,7 @@ const TabViewComponent: React.FC<TabViewComponentProps> = ({
                                 item.actual_total_power > 1
                         )}
                         renderItem={({ item }) => <TabItem item={item} currentLocation={currentLocation} />}
-                        estimatedItemSize={10}
+                        estimatedItemSize={20}
                     />
                 </View>
             )),

+ 72 - 76
component/homePage/homePage.tsx

@@ -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">

+ 2 - 6
component/registrationMultiStepForm/formComponent/formPages/loginPage.tsx

@@ -115,7 +115,7 @@ const LoginPage: React.FC<LoginPageProps> = ({ goToNextPage, goToForgetPassWordP
             // const lowerCaseUsername = username.toLowerCase();
             const isBinding = false;
             const response = await login(username, password, isBinding);
-            console.log('response in _login', response);
+
             if (response === 'login successful') {
                 if (saveAccount) {
                     await AsyncStorage.setItem('savedPhone', username);
@@ -125,11 +125,7 @@ const LoginPage: React.FC<LoginPageProps> = ({ goToNextPage, goToForgetPassWordP
                     await AsyncStorage.removeItem('savedPassword');
                 }
             } else {
-                console.log('response in _login', response);
-                Alert.alert(
-                    '登入失敗',
-                    `Response: ${response}\nUsername: ${username}\nPassword: ${password}\nIs Binding: ${isBinding}\nSave Account: ${saveAccount}\nAPI URL: ${EXPO_PUBLIC_API_URL}`
-                );
+                Alert.alert('登入失敗', `原因: ${response}`);
             }
         }
         setIsLoading(false);

+ 6 - 6
component/searchPage/searchPageComponent.tsx

@@ -34,8 +34,8 @@ const dummyTabItems: TabItem[] = [
         chargeStationName: '觀塘偉業街充電站',
         chargeStationAddress: '九龍觀塘偉業街143號地下',
         distance: '400米',
-        latitude: 22.310958,
-        longitude: 114.226065
+        latitude: 22.31337,
+        longitude: 114.21823
     },
     {
         imgURL: require('../../assets/dummyStationPicture5.jpeg'),
@@ -44,8 +44,8 @@ const dummyTabItems: TabItem[] = [
         chargeStationName: '香港沙頭角農莊',
         chargeStationAddress: '香港沙頭角農莊停車場',
         distance: '680米',
-        latitude: 22.28552,
-        longitude: 114.15769
+        latitude: 22.53898,
+        longitude: 114.21319
     },
     {
         imgURL: require('../../assets/dummyStationPicture4.jpeg'),
@@ -54,8 +54,8 @@ const dummyTabItems: TabItem[] = [
         chargeStationName: '黃竹坑香葉道充電站',
         chargeStationAddress: '黃竹坑香葉道44號地下',
         distance: '680米',
-        latitude: 22.28552,
-        longitude: 114.15769
+        latitude: 22.24839,
+        longitude: 114.16303
     }
 ];
 const SearchPageComponent: React.FC<SearchPageComponentProps> = () => {