diff --git a/screens/nano-sante/SouscrireAssuranceUser.js b/screens/nano-sante/SouscrireAssuranceUser.js index 018f104c..68e7942d 100755 --- a/screens/nano-sante/SouscrireAssuranceUser.js +++ b/screens/nano-sante/SouscrireAssuranceUser.js @@ -22,6 +22,7 @@ import {connect} from "react-redux"; import {bindActionCreators} from "redux"; import {getBankListAction, getBankListReset} from "../../webservice/BankApi"; import {getOperatorListAction, getOperatorListReset} from "../../webservice/WalletApi"; +import {store} from "../../redux/store"; const route = require('../../route.json'); let slugify = require('slugify'); @@ -33,7 +34,8 @@ class SouscrireAssuranceUser extends Component { IlinkEmitter.on("langueChange", this.updateLangue.bind(this)); this.state = { - options: this.props.navigation.state.params.optionSelect + options: this.props.navigation.state.params.optionSelect, + wallet: store.getState().walletDetailReducer.result.response } console.log("OPERATEUR OPTION PROPS", this.props); console.log("OPERATEUR OPTION STATE", this.state); diff --git a/screens/wallet/WalletDetail.js b/screens/wallet/WalletDetail.js index 610816a4..a4ac2182 100755 --- a/screens/wallet/WalletDetail.js +++ b/screens/wallet/WalletDetail.js @@ -2165,7 +2165,7 @@ class WalletDetail extends Component { network_agent_id: this.props.result.response.network_agent_id }); }}> - {I18n.t('SUBMIT_LABEL')} + {I18n.t('SUBMIT_LABEL')}l : diff --git a/screens/wallet/WalletDetailUser.js b/screens/wallet/WalletDetailUser.js index b442ce6a..74e6f2b9 100755 --- a/screens/wallet/WalletDetailUser.js +++ b/screens/wallet/WalletDetailUser.js @@ -1,6 +1,7 @@ import React, {Component} from 'react'; import { ActivityIndicator, + Alert, Animated, Platform, ProgressBarAndroid, @@ -21,7 +22,12 @@ import Tag from '../../components/Tag'; import {IlinkEmitter} from "../../utils/events"; import {Typography} from '../../config/typography'; import {responsiveWidth,} from 'react-native-responsive-dimensions'; -import {getWalletDetailActivated, resetWalletListDetailReducer} from '../../webservice/WalletApi'; +import { + getWalletDetailActivated, + passwordValidationAction, + passwordValidationReset, + resetWalletListDetailReducer +} from '../../webservice/WalletApi'; import {depositActionReset} from '../../webservice/DepositApi'; import { getWalletTransactionHistoryReset, @@ -58,6 +64,10 @@ import { } from '../../utils/UtilsFunction'; import {readUser} from '../../webservice/AuthApi'; import LottieView from "lottie-react-native"; +import * as Animatable from "react-native-animatable"; +import {Fumi} from "react-native-textinput-effects"; +import FontAwesomeIcon from "react-native-vector-icons/FontAwesome"; +import Button from "../../components/Button"; let moment = require('moment-timezone'); @@ -85,7 +95,8 @@ class WalletDetailUser extends Component { historyItemDetail: null, isIdentified: false, isIdentifiedValidated: false, - + password: '', + isLogged: false }; slugify.extend({'+': 'plus'}); @@ -105,6 +116,7 @@ class WalletDetailUser extends Component { this.props.getWalletTransactionHistoryReset(); this.props.depositActionReset(); this.props.resetWalletListDetailReducer(); + this.props.passwordValidationReset(); this.props.getUserIdentificationResetAction(); console.warn("Wallet User Props", this.props); @@ -184,6 +196,44 @@ class WalletDetailUser extends Component { } + componentWillReceiveProps(nextProps) { + if (nextProps.resultPasswordValidation !== null) { + if (nextProps.resultPasswordValidation.status === 200) { + this.setState({ + isLogged: true + }); + this.props.passwordValidationReset(); + } + } + if (nextProps.errorPasswordValidation !== null) { + console.log(nextProps.errorPasswordValidation); + Alert.alert( + I18n.t("ERROR_LABEL"), + '' + nextProps.errorPasswordValidation, + [ + { + text: I18n.t("OK"), onPress: () => { + this.props.passwordValidationReset(); + } + } + ], + {cancelable: false} + ); + this.setState({ + isLogged: false + }); + } + + /* if (nextProps.loading || nextProps.loadingTransferCommission) + this.setState({ + loading: true + }) + else + this.setState({ + loading: false + })*/ + } + shouldComponentUpdate(nextProps, nextState) { if (this.state.triggerTransferCommission !== nextState.triggerTransferCommission) { @@ -1010,8 +1060,38 @@ class WalletDetailUser extends Component { {I18n.t('NO_WALLET_ACTIVED')} : + this.props.result.response.password_validation === "MIN" && !this.state.isLogged ? + + { + this.codeAgentAnim = comp + }}> + { + this.setState({password}); + }} + style={styles.input} /> + - this.renderDetailWallet(this.props.result.response) + + + : + this.renderDetailWallet(this.props.result.response) : this.props.error !== null && this.props.error.data !== null && @@ -1045,6 +1125,10 @@ const mapStateToProps = state => ({ loadingUserIdentification: state.getUserIdentificationReducer.loading, resultUserIdentification: state.getUserIdentificationReducer.result, errorUserIdentification: state.getUserIdentificationReducer.error, + + loadingPasswordValidation: state.passwordValidationReducer.loading, + resultPasswordValidation: state.passwordValidationReducer.result, + errorPasswordValidation: state.passwordValidationReducer.error, }); const mapDispatchToProps = dispatch => bindActionCreators({ @@ -1056,7 +1140,9 @@ const mapDispatchToProps = dispatch => bindActionCreators({ getWalletTransactionHistoryReset, depositActionReset, getUserIdentificationAction, - getUserIdentificationResetAction + getUserIdentificationResetAction, + passwordValidationAction, + passwordValidationReset, }, dispatch); export default connect(mapStateToProps, mapDispatchToProps)(WalletDetailUser); diff --git a/screens/wallet/agent/ExecuterPrescriptionScreen.js b/screens/wallet/agent/ExecuterPrescriptionScreen.js index 5c1f8001..096ad98e 100644 --- a/screens/wallet/agent/ExecuterPrescriptionScreen.js +++ b/screens/wallet/agent/ExecuterPrescriptionScreen.js @@ -521,7 +521,8 @@ const ExecuterPrescriptionScreen = ({ const ExecuterPrescriptionSchema = Yup.object().shape({ numero_assure: Yup.string() .required(I18n.t('THIS_FIELD_IS_REQUIRED')), - password: Yup.string(), + password: wallet.password_validation === "MAX" ? Yup.string() + .required(I18n.t('THIS_FIELD_IS_REQUIRED')) : Yup.string(), practitioner_lastname: Yup.string() .required(I18n.t('THIS_FIELD_IS_REQUIRED')), practitioner_firstname: Yup.string() diff --git a/screens/wallet/agent/ModifierExecutionPrescriptionScreen.js b/screens/wallet/agent/ModifierExecutionPrescriptionScreen.js index 27c4cb7e..490c3767 100644 --- a/screens/wallet/agent/ModifierExecutionPrescriptionScreen.js +++ b/screens/wallet/agent/ModifierExecutionPrescriptionScreen.js @@ -531,7 +531,8 @@ const ModifierExecutionPrescriptionScreen = ({ const ExecuterPrescriptionSchema = Yup.object().shape({ numero_assure: Yup.string() .required(I18n.t('THIS_FIELD_IS_REQUIRED')), - password: Yup.string(), + password: wallet.password_validation === "MAX" ? Yup.string() + .required(I18n.t('THIS_FIELD_IS_REQUIRED')) : Yup.string(), practitioner_lastname: Yup.string() .required(I18n.t('THIS_FIELD_IS_REQUIRED')), practitioner_firstname: Yup.string() diff --git a/screens/wallet/agent/ModifierFeuilleSoinScreen.js b/screens/wallet/agent/ModifierFeuilleSoinScreen.js index e1b02cb5..ffb473ce 100644 --- a/screens/wallet/agent/ModifierFeuilleSoinScreen.js +++ b/screens/wallet/agent/ModifierFeuilleSoinScreen.js @@ -598,7 +598,8 @@ const ModifierFeuilleSoinScreen = ({ const ModifierFeuilleSoinSchema = Yup.object().shape({ numero_assure: Yup.string() .required(I18n.t('THIS_FIELD_IS_REQUIRED')), - password: Yup.string(), + password: wallet.password_validation === "MAX" ? Yup.string() + .required(I18n.t('THIS_FIELD_IS_REQUIRED')) : Yup.string(), practitioner_lastname: Yup.string() .required(I18n.t('THIS_FIELD_IS_REQUIRED')), practitioner_firstname: Yup.string() diff --git a/screens/wallet/agent/SaisirFeuilleSoinScreen.js b/screens/wallet/agent/SaisirFeuilleSoinScreen.js index b818c7ce..a8167bd2 100644 --- a/screens/wallet/agent/SaisirFeuilleSoinScreen.js +++ b/screens/wallet/agent/SaisirFeuilleSoinScreen.js @@ -679,7 +679,8 @@ const SaisirFeuilleSoinScreen = ({ const SaisirFeuilleSoinSchema = Yup.object().shape({ numero_assure: Yup.string() .required(I18n.t('THIS_FIELD_IS_REQUIRED')), - password: Yup.string(), + password: wallet.password_validation === "MAX" ? Yup.string() + .required(I18n.t('THIS_FIELD_IS_REQUIRED')) : Yup.string(), practitioner_lastname: Yup.string() .required(I18n.t('THIS_FIELD_IS_REQUIRED')), practitioner_firstname: Yup.string() diff --git a/screens/wallet/user/ActivateBuySubscriptionScreen.js b/screens/wallet/user/ActivateBuySubscriptionScreen.js index fdfe245f..1f5b58b7 100644 --- a/screens/wallet/user/ActivateBuySubscriptionScreen.js +++ b/screens/wallet/user/ActivateBuySubscriptionScreen.js @@ -31,6 +31,7 @@ import {createStructuredSelector} from "reselect"; import {selectActivatePaySubscription, selectSubscriptionList} from "../../../redux/insurance/insurance.selector"; import {Dropdown} from "react-native-material-dropdown"; +import {store} from "../../../redux/store"; let moment = require('moment-timezone'); @@ -190,6 +191,7 @@ const ActivateBuySubscriptionScreen = ({ let dropDownAlertRef: any = null; let subscriptionRef = null; let amountPerMonthRef = null; + const [wallet] = useState(store.getState().walletDetailReducer.result.response); useEffect(() => { readUser().then((user) => { @@ -278,8 +280,8 @@ const ActivateBuySubscriptionScreen = ({ }, [activatePaySubscription]); const RegisterSchema = Yup.object().shape({ - password: Yup.string() - .required(I18n.t('THIS_FIELD_IS_REQUIRED')) + password: wallet.password_validation === "MAX" ? Yup.string() + .required(I18n.t('THIS_FIELD_IS_REQUIRED')) : Yup.string() }); return ( @@ -363,18 +365,21 @@ const ActivateBuySubscriptionScreen = ({ /> - } - value={values.password} - onBlur={handleBlur('password')} - success={touched.password && !errors.password} - touched={touched.password} - error={errors.password} - /> + { + wallet.password_validation === "MAX" && + } + value={values.password} + onBlur={handleBlur('password')} + success={touched.password && !errors.password} + touched={touched.password} + error={errors.password} + /> + }