Explorar el Código

1. At registration page
- add vehicle brand selection field
- add model selection field
https://dev.wormwood.com.sg/zentao/task-view-48.html

2. Campaigns was configurable now

vbea hace 2 años
padre
commit
14823fbf8a

+ 4 - 2
Strides-APP/app.json

@@ -31,13 +31,15 @@
     "drawer": true,
     "drawer": true,
     "summary": true,
     "summary": true,
     "anzPayment": false,
     "anzPayment": false,
-    "paymentMethod": false
+    "paymentMethod": false,
+    "showCampaigns": true
   },
   },
   "vehicle": {
   "vehicle": {
     "newVersionPage": false,
     "newVersionPage": false,
     "showLicencePlate": true,
     "showLicencePlate": true,
     "showRequiredAsterisk": false,
     "showRequiredAsterisk": false,
     "requireConnectorType": true,
     "requireConnectorType": true,
-    "requireImageUpload": true
+    "requireImageUpload": true,
+    "vehicleInRegisterPage": false
   }
   }
 }
 }

+ 4 - 2
Strides-APP/app/i18n/locales/en.js

@@ -108,6 +108,8 @@ export default {
     labelPDVPhotos: "  PDV Photos\n(Front & Back)",
     labelPDVPhotos: "  PDV Photos\n(Front & Back)",
     labelPhoneNumber: "Phone Number",
     labelPhoneNumber: "Phone Number",
     labelValidateEmail: "Validate Email",
     labelValidateEmail: "Validate Email",
+    labelVehicleBrand: "Vehicle Brand",
+    labelVehicleModel: "Vehicle Model",
     labelYourCompany: "Your Company",
     labelYourCompany: "Your Company",
     linkAndLink: "and ",
     linkAndLink: "and ",
     linkAndLinkEnd: ".",
     linkAndLinkEnd: ".",
@@ -230,8 +232,8 @@ export default {
     userType: "User Type",
     userType: "User Type",
     vehicleBrand: "Brand",
     vehicleBrand: "Brand",
     vehicleModel: "Model",
     vehicleModel: "Model",
-    selectBrand: "Select Brand",
-    selectModel: "Select Model",
+    selectBrand: "Select Vehicle Brand",
+    selectModel: "Select Vehicle Model",
     selectUpload: "Select To Upload",
     selectUpload: "Select To Upload",
     max4mbPhoto: "(Max 4 mb Per Photo)",
     max4mbPhoto: "(Max 4 mb Per Photo)",
     connecterType: "Connecter Type",
     connecterType: "Connecter Type",

+ 2 - 0
Strides-APP/app/i18n/locales/zh-TW.js

@@ -108,6 +108,8 @@ export default {
     labelPDVPhotos: " 駕駛證照片\n(正面&背面)",
     labelPDVPhotos: " 駕駛證照片\n(正面&背面)",
     labelPhoneNumber: "手機號碼",
     labelPhoneNumber: "手機號碼",
     labelValidateEmail: "信箱驗證碼",
     labelValidateEmail: "信箱驗證碼",
+    labelVehicleBrand: "車輛品牌",
+    labelVehicleModel: "車輛型號",
     labelYourCompany: "妳的公司",
     labelYourCompany: "妳的公司",
     linkAndLink: "》《",
     linkAndLink: "》《",
     linkAndLinkEnd: "》",
     linkAndLinkEnd: "》",

+ 2 - 0
Strides-APP/app/i18n/locales/zh.js

@@ -108,6 +108,8 @@ export default {
     labelPDVPhotos: " 驾驶证照片\n(正面&背面)",
     labelPDVPhotos: " 驾驶证照片\n(正面&背面)",
     labelPhoneNumber: "手机号码",
     labelPhoneNumber: "手机号码",
     labelValidateEmail: "邮箱验证码",
     labelValidateEmail: "邮箱验证码",
+    labelVehicleBrand: "车辆品牌",
+    labelVehicleModel: "车辆型号",
     labelYourCompany: "你的公司",
     labelYourCompany: "你的公司",
     linkAndLink: "》《",
     linkAndLink: "》《",
     linkAndLinkEnd: "》",
     linkAndLinkEnd: "》",

+ 1 - 1
Strides-APP/app/pages/alert/ListAlerts.js

@@ -29,7 +29,7 @@ export default class ListAlerts extends Component {
     });
     });
     setTimeout(() => {
     setTimeout(() => {
       this.getMessageList();
       this.getMessageList();
-    }, 1000);
+    }, 500);
   }
   }
 
 
   toDetail(item={}) {
   toDetail(item={}) {

+ 3 - 0
Strides-APP/app/pages/alert/ListCampaign.js

@@ -23,6 +23,9 @@ export default class ListCampaign extends Component {
     this.props.navigation.addListener('focus', () => {
     this.props.navigation.addListener('focus', () => {
       this.getMessageList();
       this.getMessageList();
     });
     });
+    setTimeout(() => {
+      this.getMessageList();
+    }, 500);
   }
   }
 
 
   toDetail(item={}) {
   toDetail(item={}) {

+ 3 - 0
Strides-APP/app/pages/alert/ListNews.js

@@ -24,6 +24,9 @@ export default class ListNews extends Component {
     this.props.navigation.addListener('focus', () => {
     this.props.navigation.addListener('focus', () => {
       this.getMessageList();
       this.getMessageList();
     });
     });
+    setTimeout(() => {
+      this.getMessageList();
+    }, 500);
   }
   }
 
 
   toDetail(item={}) {
   toDetail(item={}) {

+ 69 - 37
Strides-APP/app/pages/alert/Notification.js

@@ -4,7 +4,7 @@
  */
  */
 import { createMaterialTopTabNavigator } from '@react-navigation/material-top-tabs';
 import { createMaterialTopTabNavigator } from '@react-navigation/material-top-tabs';
 import React, { Component } from 'react';
 import React, { Component } from 'react';
-import { StyleSheet } from 'react-native';
+import { StyleSheet, View } from 'react-native';
 import { PageList } from '../Router';
 import { PageList } from '../Router';
 import ListAlerts from './ListAlerts';
 import ListAlerts from './ListAlerts';
 import ListNews from './ListNews';
 import ListNews from './ListNews';
@@ -21,13 +21,23 @@ export default class Notification extends Component {
     super(props);
     super(props);
     this.state = {
     this.state = {
       refreshing: false,
       refreshing: false,
-      countInfo: {}
+      countInfo: {},
+      pageAdapter: []
     };
     };
-    this.pageAdapter = [/*{
+    this.pageAdapterAll = [{
       title: $t('notification.tabCampaign'),
       title: $t('notification.tabCampaign'),
       name: "Campaigns",
       name: "Campaigns",
       component: ListCampaign
       component: ListCampaign
-    }, */{
+    }, {
+      title: $t('notification.tabAlerts'),
+      name: "Alerts",
+      component: ListAlerts
+    }, {
+      title: AlertUtil.isPromotion ? $t('notification.tabPromotions') : $t("notification.tabArticles"),
+      name: "News",
+      component: ListNews
+    }]
+    this.pageAdapter = [{
       title: $t('notification.tabAlerts'),
       title: $t('notification.tabAlerts'),
       name: "Alerts",
       name: "Alerts",
       component: ListAlerts
       component: ListAlerts
@@ -48,7 +58,13 @@ export default class Notification extends Component {
   }
   }
 
 
   componentDidMount() {
   componentDidMount() {
-    utils.setBackClick([this.props?.route?.name, "Campaigns", "Alerts", "Promotions"], this.backPage)
+    this.setState({
+      pageAdapter: app.v3.showCampaigns ? this.pageAdapterAll : this.pageAdapter
+    }, () => {
+      setTimeout(() => {
+        this.init();
+      }, 300);
+    });
     this.props.navigation.addListener('focus', () => {
     this.props.navigation.addListener('focus', () => {
       if (this.isHide) {
       if (this.isHide) {
         this.isHide = false;
         this.isHide = false;
@@ -58,11 +74,6 @@ export default class Notification extends Component {
     this.props.navigation.addListener('blur', () => {
     this.props.navigation.addListener('blur', () => {
       this.isHide = true;
       this.isHide = true;
     });
     });
-    this.getTotalCount();
-    //BackHandler.addEventListener('hardwareBackPress', this.backPage)
-    AlertUtil.setOnRefreshListener(() => {
-      this.getTotalCount();
-    })
   }
   }
 
 
   componentWillUnmount() {
   componentWillUnmount() {
@@ -70,6 +81,15 @@ export default class Notification extends Component {
     //BackHandler.removeEventListener("hardwareBackPress", this.backPage)
     //BackHandler.removeEventListener("hardwareBackPress", this.backPage)
   }
   }
 
 
+  init() {
+    utils.setBackClick([this.props?.route?.name, "Campaigns", "Alerts", "Promotions"], this.backPage)
+    this.getTotalCount();
+    //BackHandler.addEventListener('hardwareBackPress', this.backPage)
+    AlertUtil.setOnRefreshListener(() => {
+      this.getTotalCount();
+    })
+  }
+
   backPage = () => {
   backPage = () => {
     //const params = this.props.route.params;
     //const params = this.props.route.params;
     if (!this.isHide) {
     if (!this.isHide) {
@@ -99,11 +119,19 @@ export default class Notification extends Component {
   getBadgeText(index) {
   getBadgeText(index) {
     let count = 0;
     let count = 0;
     switch (index) {
     switch (index) {
-      /*case 0:
-        count = this.state.countInfo?.campaignUnreadCount;
-        break;*/
       case 0:
       case 0:
-        count = this.state.countInfo?.alertUnreadCount;
+        if (app.v3.showCampaigns) {
+          count = this.state.countInfo?.campaignUnreadCount;
+        } else {
+          count = this.state.countInfo?.alertUnreadCount;
+        }
+        break;
+      case 1:
+        if (app.v3.showCampaigns) {
+          count = this.state.countInfo?.alertUnreadCount;
+        } else {
+          count = this.state.countInfo?.newsUnreadCount;
+        }
         break
         break
       case 2:
       case 2:
         count = this.state.countInfo?.newsUnreadCount;
         count = this.state.countInfo?.newsUnreadCount;
@@ -118,29 +146,33 @@ export default class Notification extends Component {
 
 
   render() {
   render() {
     const Tab = createMaterialTopTabNavigator();
     const Tab = createMaterialTopTabNavigator();
-    return (
-      <Tab.Navigator
-        style={styles.container}
-        screenOptions={{
-          lazy: false,
-          lazyPreloadDistance: 1,
-          ...this.tabBarStyle
-        }}
-        backBehavior={() => this.backPage()}>
-        { this.pageAdapter.map((item, index) => 
-          <Tab.Screen
-            key={index}
-            name={item.name}
-            component={item.component}
-            options={{
-              title: item.title,
-              tabBarAllowFontScaling: false,
-              tabBarBadge: () => this.getBadgeText(index)
-            }}
-          />
-        )}
-      </Tab.Navigator>
-    );
+    if (this.state.pageAdapter.length > 0) {
+      return (
+        <Tab.Navigator
+          style={styles.container}
+          screenOptions={{
+            lazy: false,
+            lazyPreloadDistance: 1,
+            ...this.tabBarStyle
+          }}
+          backBehavior={() => this.backPage()}>
+          { this.state.pageAdapter.map((item, index) => 
+            <Tab.Screen
+              key={index}
+              name={item.name}
+              component={item.component}
+              options={{
+                title: item.title,
+                tabBarAllowFontScaling: false,
+                tabBarBadge: () => this.getBadgeText(index)
+              }}
+            />
+          )}
+        </Tab.Navigator>
+      );
+    } else {
+      return <View></View>
+    }
   }
   }
 }
 }