Nano sante utilisateur OK

This commit is contained in:
Brice Zele 2021-11-11 12:43:33 +01:00
parent 6b01bc8f14
commit 2767c26524
25 changed files with 36037 additions and 7614 deletions

4
App.js
View File

@ -85,6 +85,8 @@ import EnvoieWalletToBankAgent from "./screens/wallet/agent/EnvoieWalletToBankAg
import ReattachAccountUser from "./screens/wallet/user/ReattachAccountUser"; import ReattachAccountUser from "./screens/wallet/user/ReattachAccountUser";
import InsuranceSubscriptionScreen from "./screens/wallet/user/InsuranceSubscriptionScreen"; import InsuranceSubscriptionScreen from "./screens/wallet/user/InsuranceSubscriptionScreen";
import AddBeneficiaryScreen from "./screens/wallet/user/AddBeneficiaryScreen"; import AddBeneficiaryScreen from "./screens/wallet/user/AddBeneficiaryScreen";
import ActivateBuySubscriptionScreen from "./screens/wallet/user/ActivateBuySubscriptionScreen";
import SaisirFeuilleSoinScreen from "./screens/wallet/agent/SaisirFeuilleSoinScreen";
const instructions = Platform.select({ const instructions = Platform.select({
@ -134,6 +136,7 @@ const AppStack = createDrawerNavigator({
envoieWalletToBankUser: EnvoieWalletToBankUser, envoieWalletToBankUser: EnvoieWalletToBankUser,
addBeneficiaryScreen: AddBeneficiaryScreen, addBeneficiaryScreen: AddBeneficiaryScreen,
insuranceSubscriptionScreen: InsuranceSubscriptionScreen, insuranceSubscriptionScreen: InsuranceSubscriptionScreen,
activateBuySubscriptionScreen: ActivateBuySubscriptionScreen,
retraitWalletVersCashUser: RetraitWalletVersCashUser, retraitWalletVersCashUser: RetraitWalletVersCashUser,
retraitCarteVersCashUser: RetraitCarteVersCashUser, retraitCarteVersCashUser: RetraitCarteVersCashUser,
retraitCarteVersWalletUser: RetraitCarteVersWalletUser, retraitCarteVersWalletUser: RetraitCarteVersWalletUser,
@ -248,6 +251,7 @@ const AppAgentStack = createDrawerNavigator({
historyItemDetails: HistoryItemDetails, historyItemDetails: HistoryItemDetails,
creditrequest: HistoryRequester, creditrequest: HistoryRequester,
saisirFeuilleSoinScreen: SaisirFeuilleSoinScreen,
addNetwork: AddNetwork, addNetwork: AddNetwork,
updateinformation: UpdateInformations, updateinformation: UpdateInformations,
notificationview: Notifications, notificationview: Notifications,

File diff suppressed because one or more lines are too long

View File

@ -597,9 +597,11 @@
"PLEASE_SELECT_INSURANCE_BEFORE": "Veuillez d'abord sélectionner une assurance", "PLEASE_SELECT_INSURANCE_BEFORE": "Veuillez d'abord sélectionner une assurance",
"NUMBER_MAX_BENEFICIARY": "Nombre maximum d'ayant droit atteint", "NUMBER_MAX_BENEFICIARY": "Nombre maximum d'ayant droit atteint",
"BENEFICIARY_SUCCESSFULLY_ADDED": "L'ayant droit a été correctement ajouté", "BENEFICIARY_SUCCESSFULLY_ADDED": "L'ayant droit a été correctement ajouté",
"NUMBER_OF_MONTHS": "Nombre de mois", "NUMBER_OF_MONTHS": "Nbre de mois",
"MINIMUM_AMOUNT": "Montant minimum", "MINIMUM_AMOUNT": "Montant min.",
"AMOUNT_PER_MONTH": "Montant par durée de couverture", "AMOUNT_PER_MONTH": "Montant par durée de couverture",
"DETAIL": "Détail", "DETAIL": "Détail",
"PRIME_AMOUNT": "Montant de la prime" "PRIME_AMOUNT": "Montant de la prime",
"AYANT_DROIT": "Ayant(s) droit(s)",
"SELECT_SUBSCRIPTION": "Sélectionner une souscription"
} }

View File

@ -0,0 +1,114 @@
/**
* Project iLinkWorld
* File StepHeaderComponent
* Path components
* Created by BRICE ZELE
* Date: 11/11/2021
*/
/**
* Project yoolearn-mobile
* File StepHeader
* Path app/components
* Created by BRICE ZELE
* Date: 17/10/2021
*/
import React from 'react';
import {StyleSheet, View} from 'react-native';
import {Color} from "../config/Color";
const Circle = ({index, selectedIndex}) => {
return (
<View
style={
index === selectedIndex
? {
...styles.circle,
backgroundColor: Color.whiteColor,
borderColor: Color.primaryColor,
}
: {
...styles.circle,
backgroundColor: Color.primaryColor,
borderColor: Color.primaryColor,
}
}>
<Text
style={
index === selectedIndex
? styles.selectedcircleTitle
: styles.circleTitle
}>
{index}
</Text>
</View>
);
};
const StepHeader = props => {
const MAX_NUMBER_LINES = 2;
const {steps, currentStepIndex} = props;
return (
<View style={styles.container}>
{steps.map((step, index) => (
<View key={index} style={styles.stepContainer}>
<Circle selectedIndex={currentStepIndex} index={++index}/>
<Text
numberOfLines={MAX_NUMBER_LINES}
ellipsizeMode="tail"
style={styles.titleCircle}>
{step.title}
</Text>
</View>
))}
<View style={[styles.line, {borderBottomColor: Color.primaryColor}]}/>
</View>
);
};
export default StepHeader;
const styles = StyleSheet.create({
container: {
flexDirection: 'row',
justifyContent: 'space-between',
width: '100%',
},
stepContainer: {
flexDirection: 'column',
padding: 10,
alignItems: 'center',
justifyContent: 'center',
},
titleCircle: {
marginTop: 10,
fontSize: 12,
paddingBottom: 10,
},
line: {
borderBottomWidth: 1,
justifyContent: 'center',
width: '80%',
position: 'absolute',
top: 35,
zIndex: 1,
marginHorizontal: 20,
},
circle: {
borderWidth: 1,
borderRadius: 50,
width: 30,
height: 30,
alignItems: 'center',
justifyContent: 'center',
marginTop: 10,
zIndex: 10,
},
circleTitle: {
fontSize: 12,
color: '#fff',
},
selectedcircleTitle: {
fontSize: 12,
color: '#2E81D3',
},
});

25853
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -85,6 +85,7 @@
"react-native-textinput-effects": "^0.5.1", "react-native-textinput-effects": "^0.5.1",
"react-native-vector-icons": "^6.5.0", "react-native-vector-icons": "^6.5.0",
"react-native-webview": "^11.6.2", "react-native-webview": "^11.6.2",
"react-native-wizard": "^2.1.0",
"react-navigation": "3.11.0", "react-navigation": "3.11.0",
"react-navigation-drawer": "^1.4.0", "react-navigation-drawer": "^1.4.0",
"react-navigation-material-bottom-tabs": "^1.0.0", "react-navigation-material-bottom-tabs": "^1.0.0",

View File

@ -34,7 +34,7 @@ export const fetchGetListInsuranceError = (error: any) => ({
export const fetchGetListInsurance = (idCountry) => { export const fetchGetListInsurance = (idCountry) => {
return ApiAction({ return ApiAction({
url: `${getInsuranceListUrl}?country_id=${idCountry}`, url: `${getInsuranceListUrl}/networks?country_id=${idCountry}`,
method: 'GET', method: 'GET',
onLoading: fetchGetListInsurancePending, onLoading: fetchGetListInsurancePending,
onSuccess: fetchGetListInsuranceSuccess, onSuccess: fetchGetListInsuranceSuccess,
@ -132,3 +132,92 @@ export const fetchUploadInsurance = (data) => {
onError: fetchUploadInsuranceError, onError: fetchUploadInsuranceError,
}); });
}; };
/************************************************************/
export const fetchGetSubscriptionListPending = () => ({
type: InsuranceActions.GET_SUBSCRIPTION_LIST_PENDING,
});
export const fetchGetSubscriptionListReset = () => ({
type: InsuranceActions.GET_SUBSCRIPTION_LIST_RESET,
});
export const fetchGetSubscriptionListSuccess = (authkey: any) => ({
type: InsuranceActions.GET_SUBSCRIPTION_LIST_SUCCESS,
payload: authkey,
});
export const fetchGetSubscriptionListError = (error: any) => ({
type: InsuranceActions.GET_SUBSCRIPTION_LIST_ERROR,
payload: error,
});
export const fetchGetSubscriptionList = (idUser, type, includeSubscription = true) => {
return ApiAction({
url: includeSubscription ? `${getInsuranceListUrl}/subscriptions?user_id=${idUser}&type=${type}` : `${getInsuranceListUrl}?user_id=${idUser}&type=${type}`,
method: 'GET',
onLoading: fetchGetSubscriptionListPending,
onSuccess: fetchGetSubscriptionListSuccess,
onError: fetchGetSubscriptionListError,
});
};
/************************************************************/
export const fetchActivePaySubscriptionPending = () => ({
type: InsuranceActions.ACTIVATE_PAY_SUBSCRIPTION_PENDING,
});
export const fetchActivePaySubscriptionReset = () => ({
type: InsuranceActions.ACTIVATE_PAY_SUBSCRIPTION_RESET,
});
export const fetchActivePaySubscriptionSuccess = (authkey: any) => ({
type: InsuranceActions.ACTIVATE_PAY_SUBSCRIPTION_SUCCESS,
payload: authkey,
});
export const fetchActivePaySubscriptionError = (error: any) => ({
type: InsuranceActions.ACTIVATE_PAY_SUBSCRIPTION_ERROR,
payload: error,
});
export const fetchActivePaySubscription = (id, data) => {
return ApiAction({
url: `${subscribeInsuranceUrl}/${id}/pay`,
data,
method: 'PUT',
onLoading: fetchActivePaySubscriptionPending,
onSuccess: fetchActivePaySubscriptionSuccess,
onError: fetchActivePaySubscriptionError,
});
};
/************************************************************/
export const fetchAddBeneficiaryToSubscriptionPending = () => ({
type: InsuranceActions.ADD_BENEFICIARY_TO_SUBSCRIPTION_PENDING,
});
export const fetchAddBeneficiaryToSubscriptionReset = () => ({
type: InsuranceActions.ADD_BENEFICIARY_TO_SUBSCRIPTION_RESET,
});
export const fetchAddBeneficiaryToSubscriptionSuccess = (authkey: any) => ({
type: InsuranceActions.ADD_BENEFICIARY_TO_SUBSCRIPTION_SUCCESS,
payload: authkey,
});
export const fetchAddBeneficiaryToSubscriptionError = (error: any) => ({
type: InsuranceActions.ADD_BENEFICIARY_TO_SUBSCRIPTION_ERROR,
payload: error,
});
export const fetchAddBeneficiaryToSubscription = (id, data) => {
return ApiAction({
url: `${getInsuranceListUrl}/${id}/add-beneficiaries`,
data,
method: 'PUT',
onLoading: fetchAddBeneficiaryToSubscriptionPending,
onSuccess: fetchAddBeneficiaryToSubscriptionSuccess,
onError: fetchAddBeneficiaryToSubscriptionError,
});
};

View File

@ -137,3 +137,93 @@ export const uploadInsuranceImagesReducer = (state = INITIAL_STATE, action: Insu
} }
}; };
export const getSubscriptionListReducer = (state = INITIAL_STATE, action: InsuranceActions) => {
switch (action.type) {
case InsuranceActions.GET_SUBSCRIPTION_LIST_PENDING:
return {
...state,
loading: true
}
case InsuranceActions.GET_SUBSCRIPTION_LIST_SUCCESS:
return {
loading: false,
result: action.payload,
error: null
}
case InsuranceActions.GET_SUBSCRIPTION_LIST_ERROR:
return {
...state,
loading: false,
result: null,
error: action.payload
}
case InsuranceActions.GET_SUBSCRIPTION_LIST_RESET:
return INITIAL_STATE;
default:
return state
}
};
export const activatePaySubscriptionReducer = (state = INITIAL_STATE, action: InsuranceActions) => {
switch (action.type) {
case InsuranceActions.ACTIVATE_PAY_SUBSCRIPTION_PENDING:
return {
...state,
loading: true
}
case InsuranceActions.ACTIVATE_PAY_SUBSCRIPTION_SUCCESS:
return {
loading: false,
result: action.payload,
error: null
}
case InsuranceActions.ACTIVATE_PAY_SUBSCRIPTION_ERROR:
return {
...state,
loading: false,
result: null,
error: action.payload
}
case InsuranceActions.ACTIVATE_PAY_SUBSCRIPTION_RESET:
return INITIAL_STATE;
default:
return state
}
};
export const addBeneficiaryToSubscriptionReducer = (state = INITIAL_STATE, action: InsuranceActions) => {
switch (action.type) {
case InsuranceActions.ADD_BENEFICIARY_TO_SUBSCRIPTION_PENDING:
return {
...state,
loading: true
}
case InsuranceActions.ADD_BENEFICIARY_TO_SUBSCRIPTION_SUCCESS:
return {
loading: false,
result: action.payload,
error: null
}
case InsuranceActions.ADD_BENEFICIARY_TO_SUBSCRIPTION_ERROR:
return {
...state,
loading: false,
result: null,
error: action.payload
}
case InsuranceActions.ADD_BENEFICIARY_TO_SUBSCRIPTION_RESET:
return INITIAL_STATE;
default:
return state
}
};

View File

@ -11,6 +11,9 @@ const selectInsuranceListReducer = (state) => state.insuranceList;
const selectSubscribeInsuranceReducer = (state) => state.subscribeInsurance; const selectSubscribeInsuranceReducer = (state) => state.subscribeInsurance;
const selectInsurancePrimeAmountReducer = (state) => state.insurancePrimeAmount; const selectInsurancePrimeAmountReducer = (state) => state.insurancePrimeAmount;
const selectUploadInsuranceImagesReducerReducer = (state) => state.uploadInsuranceImagesReducer; const selectUploadInsuranceImagesReducerReducer = (state) => state.uploadInsuranceImagesReducer;
const selectGetSubscriptionListReducerReducer = (state) => state.subscriptionList;
const selectActivatePaySubscriptionReducer = (state) => state.activatePaySubscription;
const selectAddBeneficiaryToSubscriptionReducer = (state) => state.addBeneficiaryToSubscription;
export const selectInsuranceList = createSelector( export const selectInsuranceList = createSelector(
[selectInsuranceListReducer], [selectInsuranceListReducer],
@ -31,3 +34,18 @@ export const selectUploadInsuranceImages = createSelector(
[selectUploadInsuranceImagesReducerReducer], [selectUploadInsuranceImagesReducerReducer],
(uploadInsuranceImagesReducer) => uploadInsuranceImagesReducer (uploadInsuranceImagesReducer) => uploadInsuranceImagesReducer
); );
export const selectSubscriptionList = createSelector(
[selectGetSubscriptionListReducerReducer],
(subscriptionList) => subscriptionList
);
export const selectAddBeneficiaryToSubscription = createSelector(
[selectAddBeneficiaryToSubscriptionReducer],
(addBeneficiaryToSubscription) => addBeneficiaryToSubscription
);
export const selectActivatePaySubscription = createSelector(
[selectActivatePaySubscriptionReducer],
(activatePaySubscription) => activatePaySubscription
);

View File

@ -24,6 +24,23 @@ const InsuranceActions = {
UPLOAD_INSURANCE_IMAGES_PENDING: 'UPLOAD_INSURANCE_IMAGES_PENDING', UPLOAD_INSURANCE_IMAGES_PENDING: 'UPLOAD_INSURANCE_IMAGES_PENDING',
UPLOAD_INSURANCE_IMAGES_SUCCESS: 'UPLOAD_INSURANCE_IMAGES_SUCCESS', UPLOAD_INSURANCE_IMAGES_SUCCESS: 'UPLOAD_INSURANCE_IMAGES_SUCCESS',
UPLOAD_INSURANCE_IMAGES_ERROR: 'UPLOAD_INSURANCE_IMAGES_ERROR', UPLOAD_INSURANCE_IMAGES_ERROR: 'UPLOAD_INSURANCE_IMAGES_ERROR',
UPLOAD_INSURANCE_IMAGES_RESET: 'UPLOAD_INSURANCE_IMAGES_RESET' UPLOAD_INSURANCE_IMAGES_RESET: 'UPLOAD_INSURANCE_IMAGES_RESET',
GET_SUBSCRIPTION_LIST_PENDING: 'GET_SUBSCRIPTION_LIST_PENDING',
GET_SUBSCRIPTION_LIST_SUCCESS: 'GET_SUBSCRIPTION_LIST_SUCCESS',
GET_SUBSCRIPTION_LIST_ERROR: 'GET_SUBSCRIPTION_LIST_ERROR',
GET_SUBSCRIPTION_LIST_RESET: 'GET_SUBSCRIPTION_LIST_RESET',
ACTIVATE_PAY_SUBSCRIPTION_PENDING: 'ACTIVATE_PAY_SUBSCRIPTION_PENDING',
ACTIVATE_PAY_SUBSCRIPTION_SUCCESS: 'ACTIVATE_PAY_SUBSCRIPTION_SUCCESS',
ACTIVATE_PAY_SUBSCRIPTION_ERROR: 'ACTIVATE_PAY_SUBSCRIPTION_ERROR',
ACTIVATE_PAY_SUBSCRIPTION_RESET: 'ACTIVATE_PAY_SUBSCRIPTION_RESET',
ADD_BENEFICIARY_TO_SUBSCRIPTION_PENDING: 'ADD_BENEFICIARY_TO_SUBSCRIPTION_PENDING',
ADD_BENEFICIARY_TO_SUBSCRIPTION_SUCCESS: 'ADD_BENEFICIARY_TO_SUBSCRIPTION_SUCCESS',
ADD_BENEFICIARY_TO_SUBSCRIPTION_ERROR: 'ADD_BENEFICIARY_TO_SUBSCRIPTION_ERROR',
ADD_BENEFICIARY_TO_SUBSCRIPTION_RESET: 'ADD_BENEFICIARY_TO_SUBSCRIPTION_RESET',
} }
export default InsuranceActions; export default InsuranceActions;

View File

@ -51,9 +51,13 @@ import PayBillReducer from "./PayBillReducer";
import GetIlinkBankReducer from "./GetIlinkBankReducer"; import GetIlinkBankReducer from "./GetIlinkBankReducer";
import ReattachAccountReducer from "./ReattachAccountReducer"; import ReattachAccountReducer from "./ReattachAccountReducer";
import { import {
activatePaySubscriptionReducer,
addBeneficiaryToSubscriptionReducer,
getInsurancePrimeAmountReducer, getInsurancePrimeAmountReducer,
getSubscriptionListReducer,
insuranceListReducer, insuranceListReducer,
subscribeInsuranceReducer, uploadInsuranceImagesReducer subscribeInsuranceReducer,
uploadInsuranceImagesReducer
} from "../insurance/insurance.reducer"; } from "../insurance/insurance.reducer";
const persistConfig = { const persistConfig = {
@ -144,7 +148,10 @@ const rootReducer = persistCombineReducers(persistConfig, {
insuranceList: insuranceListReducer, insuranceList: insuranceListReducer,
subscribeInsurance: subscribeInsuranceReducer, subscribeInsurance: subscribeInsuranceReducer,
insurancePrimeAmount: getInsurancePrimeAmountReducer, insurancePrimeAmount: getInsurancePrimeAmountReducer,
uploadInsuranceImagesReducer: uploadInsuranceImagesReducer uploadInsuranceImagesReducer: uploadInsuranceImagesReducer,
subscriptionList: getSubscriptionListReducer,
activatePaySubscription: activatePaySubscriptionReducer,
addBeneficiaryToSubscription: addBeneficiaryToSubscriptionReducer
}); });
export default rootReducer; export default rootReducer;

View File

@ -67,5 +67,6 @@
"reattachAccountUser": "reattachAccountUser", "reattachAccountUser": "reattachAccountUser",
"acceptPrestationAgent": "acceptPrestationAgent", "acceptPrestationAgent": "acceptPrestationAgent",
"souscrireAssuranceUser": "souscrireAssuranceUser", "souscrireAssuranceUser": "souscrireAssuranceUser",
"askPrestationUser": "askPrestationUser" "askPrestationUser": "askPrestationUser",
"saisirFeuilleSoinScreen": "saisirFeuilleSoinScreen"
} }

View File

@ -1667,7 +1667,7 @@ class Home extends BaseScreen {
translucent={true} translucent={true}
/> />
{/* Start here to comment */} {/* Start here to comment */}
{ {/* {
(this.state.loadingDialog || this.props.loading) ? (this.state.loadingDialog || this.props.loading) ?
<View <View
style={{ style={{
@ -1720,7 +1720,7 @@ class Home extends BaseScreen {
} }
}]) }])
}} }}
/> />*/}
{this.makeCardSearch()} {this.makeCardSearch()}
{this.showInterticiel()} {this.showInterticiel()}
{this.makeSlidingUp()} {this.makeSlidingUp()}

View File

@ -1,31 +1,44 @@
import React, { Component } from 'react'; import React, {Component} from 'react';
import { Alert, ActivityIndicator, StyleSheet, Text, View, Image, ScrollView, Platform, ProgressBarAndroid, PermissionsAndroid, Keyboard } from 'react-native'; import {
import PropTypes from 'prop-types'; Alert,
Keyboard,
PermissionsAndroid,
Platform,
ProgressBarAndroid,
ScrollView,
StyleSheet,
Text,
View
} from 'react-native';
import FontAwesomeIcon from 'react-native-vector-icons/FontAwesome'; import FontAwesomeIcon from 'react-native-vector-icons/FontAwesome';
import Ionicons from 'react-native-vector-icons/Ionicons'; import {responsiveHeight, responsiveWidth} from 'react-native-responsive-dimensions';
import Icon from 'react-native-vector-icons/MaterialIcons'; import {Fumi} from 'react-native-textinput-effects'
import { responsiveHeight, responsiveWidth, responsiveFontSize } from 'react-native-responsive-dimensions';
import { Fumi, Kaede } from 'react-native-textinput-effects'
import * as Animatable from 'react-native-animatable'; import * as Animatable from 'react-native-animatable';
import Button from 'apsl-react-native-button'; import Button from 'apsl-react-native-button';
let theme = require('./../../utils/theme.json');
let route = require('./../../route.json');
import I18n from 'react-native-i18n'; import I18n from 'react-native-i18n';
import isEqual from 'lodash/isEqual'; import isEqual from 'lodash/isEqual';
import isNil from 'lodash/isNil'; import isNil from 'lodash/isNil';
import { Color } from '../../config/Color'; import {Color} from '../../config/Color';
import DateTimePicker from '@react-native-community/datetimepicker'; import DateTimePicker from '@react-native-community/datetimepicker';
import { Dropdown } from 'react-native-material-dropdown'; import {Dropdown} from 'react-native-material-dropdown';
import { getPositionInformation } from './../../webservice/MapService'; import {getPositionInformation} from './../../webservice/MapService';
import { ProgressDialog } from 'react-native-simple-dialogs'; import {ProgressDialog} from 'react-native-simple-dialogs';
import { getCountryNetwork, createGeolocatedAccount, createUserAccount, getTownInformationName, getListCountriesActive, getCodeInformation, readUser } from './../../webservice/AuthApi'; import {getListCountriesActive, getTownInformationName, readUser} from './../../webservice/AuthApi';
import { SinglePickerMaterialDialog, MultiPickerMaterialDialog, MaterialDialog } from "react-native-material-dialog"; import {MaterialDialog} from "react-native-material-dialog";
import Geolocation from 'react-native-geolocation-service'; import Geolocation from 'react-native-geolocation-service';
import { identityPieces } from '../../utils/UtilsFunction'; import {identityPieces} from '../../utils/UtilsFunction';
import { connect } from 'react-redux'; import {connect} from 'react-redux';
import { bindActionCreators } from 'redux'; import {bindActionCreators} from 'redux';
import { createIndentificationAction, createIndentificationResetAction, getUserIdentificationAction } from '../../webservice/IdentificationApi'; import {
const GEOLOCATION_OPTIONS = { enableHighAccuracy: true, timeout: 20000, maximumAge: 1000, useSignificantChanges: true }; createIndentificationAction,
createIndentificationResetAction,
getUserIdentificationAction
} from '../../webservice/IdentificationApi';
import SwitchSelector from "react-native-switch-selector";
let theme = require('./../../utils/theme.json');
let route = require('./../../route.json');
const GEOLOCATION_OPTIONS = {enableHighAccuracy: true, timeout: 20000, maximumAge: 1000, useSignificantChanges: true};
const moment = require('moment'); const moment = require('moment');
class CreateIdentificationUser extends Component { class CreateIdentificationUser extends Component {
@ -78,7 +91,12 @@ class CreateIdentificationUser extends Component {
modalVisible: true, modalVisible: true,
select_network: I18n.t("SELECT_NETWORK"), select_network: I18n.t("SELECT_NETWORK"),
user: null, user: null,
triggerSubmitClick: false triggerSubmitClick: false,
sexe: [
{label: I18n.t('MASCULIN'), value: "M"},
{label: I18n.t('FEMININ'), value: "F"},
],
gender: 'M'
}; };
this.dateNaissanceFumiProps = {}; this.dateNaissanceFumiProps = {};
this.dateExpirationFumiProps = {}; this.dateExpirationFumiProps = {};
@ -108,7 +126,7 @@ class CreateIdentificationUser extends Component {
} }
renderCreateIdentificationResponse() { renderCreateIdentificationResponse() {
const { result, error } = this.props; const {result, error} = this.props;
console.log("PROPS", this.props); console.log("PROPS", this.props);
@ -122,13 +140,13 @@ class CreateIdentificationUser extends Component {
text: I18n.t("OK"), onPress: () => { text: I18n.t("OK"), onPress: () => {
this.props.createIndentificationResetAction(); this.props.createIndentificationResetAction();
this.props.getUserIdentificationAction(this.state.user.phone); this.props.getUserIdentificationAction(this.state.user.phone);
this.setState({ triggerSubmitClick: false }); this.setState({triggerSubmitClick: false});
this.props.navigation.pop(); this.props.navigation.pop();
} }
} }
], ],
{ cancelable: false } {cancelable: false}
) )
} }
} }
@ -142,12 +160,12 @@ class CreateIdentificationUser extends Component {
{ {
text: I18n.t("OK"), onPress: () => { text: I18n.t("OK"), onPress: () => {
this.props.createIndentificationResetAction(); this.props.createIndentificationResetAction();
this.setState({ triggerSubmitClick: false }); this.setState({triggerSubmitClick: false});
} }
} }
], ],
{ cancelable: false } {cancelable: false}
) )
} else { } else {
Alert.alert( Alert.alert(
@ -161,7 +179,7 @@ class CreateIdentificationUser extends Component {
} }
], ],
{ cancelable: false } {cancelable: false}
) )
} }
} }
@ -183,13 +201,17 @@ class CreateIdentificationUser extends Component {
} }
showErrorDialog() { showErrorDialog() {
this.setState({ modalDialog: false }) this.setState({modalDialog: false})
Aler.alert("Une erreur est survenue", "Impossible de récuperer des informations du pays verifier que votre gps est activé," + Aler.alert("Une erreur est survenue", "Impossible de récuperer des informations du pays verifier que votre gps est activé," +
"et que vous êtes connecté à internet puis ressayer", [{ "et que vous êtes connecté à internet puis ressayer", [{
text: "Recommencer", onPress: () => { text: "Recommencer", onPress: () => {
this.watchLocation() this.watchLocation()
} }
}, { text: "Annuler", onPress: () => { this.props.navigation.popToTop() } }]) }, {
text: "Annuler", onPress: () => {
this.props.navigation.popToTop()
}
}])
} }
async watchLocation() { async watchLocation() {
@ -199,7 +221,11 @@ class CreateIdentificationUser extends Component {
this.showErrorDialog() this.showErrorDialog()
}, this.props.geolocationOptions); }, this.props.geolocationOptions);
if (!this.watchID) { if (!this.watchID) {
Geolocation.watchPosition((position) => { this.treatPosition(position) }, (e) => { this.showErrorDialog() }, this.props.geolocationOptions) Geolocation.watchPosition((position) => {
this.treatPosition(position)
}, (e) => {
this.showErrorDialog()
}, this.props.geolocationOptions)
} }
} }
@ -216,7 +242,7 @@ class CreateIdentificationUser extends Component {
if (granted === PermissionsAndroid.RESULTS.GRANTED) { if (granted === PermissionsAndroid.RESULTS.GRANTED) {
this.watchLocation(); this.watchLocation();
} else { } else {
this.setState({ modalDialog: false }) this.setState({modalDialog: false})
Alert.alert("Echec à l'autorisation", Alert.alert("Echec à l'autorisation",
"L'application n'est pas autorisé à acceder à votre position veuillez verifier que votre GPS est activé et configurer en mode Haute Precision", "L'application n'est pas autorisé à acceder à votre position veuillez verifier que votre GPS est activé et configurer en mode Haute Precision",
[{ [{
@ -226,7 +252,7 @@ class CreateIdentificationUser extends Component {
}]) }])
} }
} catch (err) { } catch (err) {
this.setState({ modalDialog: false }) this.setState({modalDialog: false})
Alert.alert("Une erreur est Survenue", Alert.alert("Une erreur est Survenue",
"Une erreur est survenu lors du demarrage de l'application veuillez relancer l'application", "Une erreur est survenu lors du demarrage de l'application veuillez relancer l'application",
[{ [{
@ -246,8 +272,8 @@ class CreateIdentificationUser extends Component {
if (response.results !== undefined) { if (response.results !== undefined) {
if (response.results.length > 0) { if (response.results.length > 0) {
let most = response.results[0] let most = response.results[0]
let { address_components, formatted_address, place_id } = most let {address_components, formatted_address, place_id} = most
this.setState({ address: address_components, textadress: formatted_address, place: place_id }) this.setState({address: address_components, textadress: formatted_address, place: place_id})
let results = response.results; let results = response.results;
let shortcountry; let shortcountry;
@ -257,10 +283,10 @@ class CreateIdentificationUser extends Component {
if (results[0].address_components[i].types[j] === "country") { if (results[0].address_components[i].types[j] === "country") {
mcountry = results[0].address_components[i]; mcountry = results[0].address_components[i];
shortcountry = mcountry.short_name; shortcountry = mcountry.short_name;
this.setState({ shortCountry: mcountry.short_name, longCountry: mcountry.long_name }) this.setState({shortCountry: mcountry.short_name, longCountry: mcountry.long_name})
} else if (results[0].address_components[i].types[j] === "locality") { } else if (results[0].address_components[i].types[j] === "locality") {
const name = results[0].address_components[i].short_name; const name = results[0].address_components[i].short_name;
this.setState({ townName: name }); this.setState({townName: name});
getTownInformationName(name).then((result) => { getTownInformationName(name).then((result) => {
let town = null; let town = null;
if (result instanceof Array) { if (result instanceof Array) {
@ -269,24 +295,24 @@ class CreateIdentificationUser extends Component {
town = result; town = result;
} }
this.setState({ modalVisible: false, town: new Array(town) }); this.setState({modalVisible: false, town: new Array(town)});
}) })
} }
} }
} }
getListCountriesActive().then((cnt) => { getListCountriesActive().then((cnt) => {
this.setState({ countries: cnt }) this.setState({countries: cnt})
console.debug(cnt, shortcountry); console.debug(cnt, shortcountry);
var found = false var found = false
for (let i of cnt) { for (let i of cnt) {
if (i.code_country === shortcountry) { if (i.code_country === shortcountry) {
found = true; found = true;
this.setState({ modalVisible: false, country: i.name }) this.setState({modalVisible: false, country: i.name})
/* this.getNetworks(i.code_dial); */ /* this.getNetworks(i.code_dial); */
} }
} }
if (!found) { if (!found) {
Alert.alert("Impossible de recupérer vos informations", "Nous n'avons pas pu recuperer les informations de votre pays veuillez contacter les administrateurs", [{ text: "OK" }]); Alert.alert("Impossible de recupérer vos informations", "Nous n'avons pas pu recuperer les informations de votre pays veuillez contacter les administrateurs", [{text: "OK"}]);
} }
}) })
@ -298,7 +324,7 @@ class CreateIdentificationUser extends Component {
}).catch((e) => { }).catch((e) => {
this.showErrorDialog() this.showErrorDialog()
}); });
this.setState({ myPosition: myPosition }); this.setState({myPosition: myPosition});
/* if (this.mapRef !== undefined && this.mapRef !== null) { /* if (this.mapRef !== undefined && this.mapRef !== null) {
this.mapRef.animateToCoordinate({ this.mapRef.animateToCoordinate({
latitude: myPosition.latitude, latitude: myPosition.latitude,
@ -339,7 +365,15 @@ class CreateIdentificationUser extends Component {
} }
onSubmitIdentityClient = () => { onSubmitIdentityClient = () => {
const { lastname, numeroIdentite, dateNaissance, dateExpiration, country, townName, identityPiecesName } = this.state; const {
lastname,
numeroIdentite,
dateNaissance,
dateExpiration,
country,
townName,
identityPiecesName
} = this.state;
if (this.ckeckIfFieldIsOK(lastname)) if (this.ckeckIfFieldIsOK(lastname))
this.lastnameAnim.shake(800); this.lastnameAnim.shake(800);
@ -366,7 +400,8 @@ class CreateIdentificationUser extends Component {
id_identity_document: this.state.numeroIdentite, id_identity_document: this.state.numeroIdentite,
expiry_date_document: moment(this.state.dateExpiration).format('DD-MM-YYYY'), expiry_date_document: moment(this.state.dateExpiration).format('DD-MM-YYYY'),
phone_number: null, phone_number: null,
id_user: this.state.user.id id_user: this.state.user.id,
gender: this.state.gender
}); });
} }
this.setState({ this.setState({
@ -380,9 +415,9 @@ class CreateIdentificationUser extends Component {
<MaterialDialog <MaterialDialog
visible={this.state.modalVisible} visible={this.state.modalVisible}
title={I18n.t("LOADING_INFO")}> title={I18n.t("LOADING_INFO")}>
<View style={{ justifyContent: 'center', alignItems: 'center' }}> <View style={{justifyContent: 'center', alignItems: 'center'}}>
<Text>{I18n.t("LOADING_DESCRIPTION_COUNTRY")}</Text> <Text>{I18n.t("LOADING_DESCRIPTION_COUNTRY")}</Text>
<ProgressBarAndroid /> <ProgressBarAndroid/>
</View> </View>
</MaterialDialog>) </MaterialDialog>)
} }
@ -438,20 +473,24 @@ class CreateIdentificationUser extends Component {
{this.state.triggerSubmitClick && this.renderCreateIdentificationResponse()} {this.state.triggerSubmitClick && this.renderCreateIdentificationResponse()}
<ScrollView style={styles.container}> <ScrollView style={styles.container}>
<Text style={styles.subbigtitle}>{I18n.t('CREATE_IDENTIFICATION_TITLE')}</Text> <Text style={styles.subbigtitle}>{I18n.t('CREATE_IDENTIFICATION_TITLE')}</Text>
<Animatable.View ref={(comp) => { this.lastnameAnim = comp }}> <Animatable.View ref={(comp) => {
this.lastnameAnim = comp
}}>
<Fumi iconClass={FontAwesomeIcon} iconName={'user'} <Fumi iconClass={FontAwesomeIcon} iconName={'user'}
label={`${I18n.t('NAME')} ${I18n.t('AND')} ${I18n.t('FIRSTNAME')}`} label={`${I18n.t('NAME')} ${I18n.t('AND')} ${I18n.t('FIRSTNAME')}`}
iconColor={'#f95a25'} iconColor={'#f95a25'}
iconSize={20} iconSize={20}
value={this.state.lastname} value={this.state.lastname}
onChangeText={(lastname) => { onChangeText={(lastname) => {
this.setState({ lastname }) this.setState({lastname})
}} }}
style={styles.input} style={styles.input}
> >
</Fumi> </Fumi>
</Animatable.View> </Animatable.View>
<Animatable.View ref={(comp) => { this.datenaissanceAnim = comp }}> <Animatable.View ref={(comp) => {
this.datenaissanceAnim = comp
}}>
<Fumi iconClass={FontAwesomeIcon} iconName={'calendar'} <Fumi iconClass={FontAwesomeIcon} iconName={'calendar'}
label={I18n.t('DATE_NAISSANCE')} label={I18n.t('DATE_NAISSANCE')}
iconColor={'#f95a25'} iconColor={'#f95a25'}
@ -459,12 +498,14 @@ class CreateIdentificationUser extends Component {
style={styles.input} style={styles.input}
onFocus={() => { onFocus={() => {
Keyboard.dismiss(); Keyboard.dismiss();
this.setState({ showPickerDateNaissance: true }) this.setState({showPickerDateNaissance: true})
}} }}
{...this.dateNaissanceFumiProps}> {...this.dateNaissanceFumiProps}>
</Fumi> </Fumi>
</Animatable.View> </Animatable.View>
<Animatable.View ref={(comp) => { this.countryAnim = comp }} <Animatable.View ref={(comp) => {
this.countryAnim = comp
}}
style={{ style={{
width: responsiveWidth(90), width: responsiveWidth(90),
height: 60, height: 60,
@ -482,13 +523,19 @@ class CreateIdentificationUser extends Component {
value={this.state.country === null ? "" : value={this.state.country === null ? "" :
this.state.country} this.state.country}
onChangeText={(value, index, data) => { onChangeText={(value, index, data) => {
this.setState({ country: value }); this.setState({country: value});
}}
valueExtractor={(value) => {
return value.name
}}
labelExtractor={(value) => {
return value.name
}} }}
valueExtractor={(value) => { return value.name }}
labelExtractor={(value) => { return value.name }}
/> />
</Animatable.View> </Animatable.View>
<Animatable.View ref={(comp) => { this.townAnim = comp }} <Animatable.View ref={(comp) => {
this.townAnim = comp
}}
style={{ style={{
width: responsiveWidth(90), width: responsiveWidth(90),
height: 60, height: 60,
@ -506,13 +553,19 @@ class CreateIdentificationUser extends Component {
value={this.state.townName === null ? "" : value={this.state.townName === null ? "" :
this.state.townName} this.state.townName}
onChangeText={(value, index, data) => { onChangeText={(value, index, data) => {
this.setState({ townName: value }); this.setState({townName: value});
}}
valueExtractor={(value) => {
return value.name
}}
labelExtractor={(value) => {
return value.name
}} }}
valueExtractor={(value) => { return value.name }}
labelExtractor={(value) => { return value.name }}
/> />
</Animatable.View> </Animatable.View>
<Animatable.View ref={(comp) => { this.identityPiecesAnim = comp }} <Animatable.View ref={(comp) => {
this.identityPiecesAnim = comp
}}
style={{ style={{
width: responsiveWidth(90), width: responsiveWidth(90),
height: 60, height: 60,
@ -529,25 +582,34 @@ class CreateIdentificationUser extends Component {
useNativeDriver={true} useNativeDriver={true}
value={this.state.identityPiecesName} value={this.state.identityPiecesName}
onChangeText={(value, index, data) => { onChangeText={(value, index, data) => {
this.setState({ identityPiecesName: value }); this.setState({identityPiecesName: value});
}}
valueExtractor={(value) => {
return I18n.t(value.name)
}}
labelExtractor={(value) => {
return I18n.t(value.name)
}} }}
valueExtractor={(value) => { return I18n.t(value.name) }}
labelExtractor={(value) => { return I18n.t(value.name) }}
/> />
</Animatable.View> </Animatable.View>
<Animatable.View ref={(comp) => { this.numeroIdentiteAnim = comp }}>
<Animatable.View ref={(comp) => {
this.numeroIdentiteAnim = comp
}}>
<Fumi iconClass={FontAwesomeIcon} iconName={'address-card'} <Fumi iconClass={FontAwesomeIcon} iconName={'address-card'}
label={`${I18n.t('NUMERO_IDENTITE')}`} label={`${I18n.t('NUMERO_IDENTITE')}`}
iconColor={'#f95a25'} iconColor={'#f95a25'}
iconSize={20} iconSize={20}
onChangeText={(numeroIdentite) => { onChangeText={(numeroIdentite) => {
this.setState({ numeroIdentite }) this.setState({numeroIdentite})
}} }}
style={styles.input} style={styles.input}
> >
</Fumi> </Fumi>
</Animatable.View> </Animatable.View>
<Animatable.View ref={(comp) => { this.identityDateExpiryAnim = comp }}> <Animatable.View ref={(comp) => {
this.identityDateExpiryAnim = comp
}}>
<Fumi iconClass={FontAwesomeIcon} iconName={'calendar-times-o'} <Fumi iconClass={FontAwesomeIcon} iconName={'calendar-times-o'}
label={I18n.t('IDENTITY_PIECE_EXPIRY_DATE')} label={I18n.t('IDENTITY_PIECE_EXPIRY_DATE')}
iconColor={'#f95a25'} iconColor={'#f95a25'}
@ -555,16 +617,42 @@ class CreateIdentificationUser extends Component {
style={styles.input} style={styles.input}
onFocus={() => { onFocus={() => {
Keyboard.dismiss(); Keyboard.dismiss();
this.setState({ showPickerDateExpiration: true }) this.setState({showPickerDateExpiration: true})
}} }}
{...this.dateExpirationFumiProps}> {...this.dateExpirationFumiProps}>
</Fumi> </Fumi>
</Animatable.View> </Animatable.View>
<View style={{
paddingLeft: 20,
paddingRight: 20,
marginTop: 10,
flexDirection: 'row',
justifyContent: "space-between"
}}>
<Text style={{color: Color.whiteColor}}>{I18n.t('SEXE')}</Text>
<View style={styles.contentSwitch}>
<SwitchSelector options={this.state.sexe}
initial={0}
buttonColor={Color.accentColor}
backgroundColor={Color.primaryDarkColor}
textColor='white'
bold={true}
hasPadding
height={32}
onPress={(value) => {
this.setState({gender: value})
}}/>
</View>
</View>
<Button style={styles.btnvalide} <Button style={styles.btnvalide}
textStyle={styles.textbtnvalide} textStyle={styles.textbtnvalide}
isLoading={this.state.isLoging} isLoading={this.state.isLoging}
onPress={() => { this.onSubmitIdentityClient() }}> onPress={() => {
this.onSubmitIdentityClient()
}}>
{I18n.t('SUBMIT_LABEL')}</Button> {I18n.t('SUBMIT_LABEL')}</Button>
</ScrollView> </ScrollView>
@ -624,5 +712,8 @@ const styles = StyleSheet.create({
marginLeft: responsiveWidth(5), marginLeft: responsiveWidth(5),
marginRight: responsiveWidth(5), marginRight: responsiveWidth(5),
borderRadius: 5, borderRadius: 5,
} },
contentSwitch: {
width: responsiveWidth(40),
},
}); });

View File

@ -25,6 +25,7 @@ import { identityPieces } from '../../utils/UtilsFunction';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { bindActionCreators } from 'redux'; import { bindActionCreators } from 'redux';
import { createIndentificationAction, createIndentificationResetAction, getNumberResetAction, getNumberDetailAction, getUserIdentificationAction } from '../../webservice/IdentificationApi'; import { createIndentificationAction, createIndentificationResetAction, getNumberResetAction, getNumberDetailAction, getUserIdentificationAction } from '../../webservice/IdentificationApi';
import SwitchSelector from "react-native-switch-selector";
const GEOLOCATION_OPTIONS = { enableHighAccuracy: true, timeout: 20000, maximumAge: 1000, useSignificantChanges: true }; const GEOLOCATION_OPTIONS = { enableHighAccuracy: true, timeout: 20000, maximumAge: 1000, useSignificantChanges: true };
const moment = require('moment'); const moment = require('moment');
@ -87,6 +88,11 @@ class CreateIdentification extends Component {
triggerNextClick: false, triggerNextClick: false,
displayFirstStep: true, displayFirstStep: true,
displaySecondStep: false, displaySecondStep: false,
sexe: [
{label: I18n.t('MASCULIN'), value: "M"},
{label: I18n.t('FEMININ'), value: "F"},
],
gender: 'M'
}; };
this.dateNaissanceFumiProps = {}; this.dateNaissanceFumiProps = {};
this.dateExpirationFumiProps = {}; this.dateExpirationFumiProps = {};
@ -376,7 +382,8 @@ class CreateIdentification extends Component {
id_identity_document: this.state.numeroIdentite, id_identity_document: this.state.numeroIdentite,
expiry_date_document: moment(this.state.dateExpiration).format('DD-MM-YYYY'), expiry_date_document: moment(this.state.dateExpiration).format('DD-MM-YYYY'),
phone_number: this.state.numeroTelephone, phone_number: this.state.numeroTelephone,
id_user: this.state.userId id_user: this.state.userId,
gender: this.state.gender
}); });
} }
this.setState({ this.setState({
@ -670,6 +677,29 @@ class CreateIdentification extends Component {
</Fumi> </Fumi>
</Animatable.View> </Animatable.View>
<View style={{
paddingLeft: 20,
paddingRight: 20,
marginTop: 10,
flexDirection: 'row',
justifyContent: "space-between"
}}>
<Text style={{color: Color.whiteColor}}>{I18n.t('SEXE')}</Text>
<View style={styles.contentSwitch}>
<SwitchSelector options={this.state.sexe}
initial={0}
buttonColor={Color.accentColor}
backgroundColor={Color.primaryDarkColor}
textColor='white'
bold={true}
hasPadding
height={32}
onPress={(value) => {
this.setState({gender: value})
}}/>
</View>
</View>
<View style={{ flexDirection: 'row', justifyContent: 'space-between', flex: 1 }}> <View style={{ flexDirection: 'row', justifyContent: 'space-between', flex: 1 }}>
<Button style={styles.btnSubmit} <Button style={styles.btnSubmit}
textStyle={styles.textbtnvalide} textStyle={styles.textbtnvalide}

View File

@ -272,7 +272,7 @@ export default class OptionsMenu extends Component {
|| item === 'envoieCashVersCarteAgent' || item === 'modifyIdentificationUser' || item === 'createGroupNanoCredit' || item === 'groupNanoCredit' || item === 'demandeValidationGroupe' || item === 'envoieCashVersCarteAgent' || item === 'modifyIdentificationUser' || item === 'createGroupNanoCredit' || item === 'groupNanoCredit' || item === 'demandeValidationGroupe'
|| item === 'adhererGroupNanoCredit' || item === 'myNanoCreditGroup' || item === 'askNanoCredit' || item === 'refundNanoCreditUser' || item === 'cautionNanoCreditAgent' || item === 'adhererGroupNanoCredit' || item === 'myNanoCreditGroup' || item === 'askNanoCredit' || item === 'refundNanoCreditUser' || item === 'cautionNanoCreditAgent'
|| item === 'epargnerArgentUser' || item === 'askNanoCredit' || item === 'casserEpargneUser' || item === 'envoieWalletToBankAgent' || item === 'reattachAccountUser' || item === 'insuranceSubscriptionScreen' || item === 'epargnerArgentUser' || item === 'askNanoCredit' || item === 'casserEpargneUser' || item === 'envoieWalletToBankAgent' || item === 'reattachAccountUser' || item === 'insuranceSubscriptionScreen'
|| item === 'addBeneficiaryScreen') { || item === 'addBeneficiaryScreen' || item === 'activateBuySubscriptionScreen' || item === 'saisirFeuilleSoinScreen') {
return null return null
} else { } else {
const color = this.state.currentId === item.id ? theme.accent : "grey" const color = this.state.currentId === item.id ? theme.accent : "grey"

View File

@ -45,7 +45,7 @@ import {
optionDepotScreen, optionDepotScreen,
optionIdentificationScreen, optionIdentificationScreen,
optionNanoCreditAgentScreen, optionNanoCreditAgentScreen,
optionNanoSanteUserScreen, optionNanoSanteAgentScreen,
optionPaiementFacture, optionPaiementFacture,
optionRetraitScreen, optionRetraitScreen,
transactionHistoryIlinkLabel transactionHistoryIlinkLabel
@ -1484,6 +1484,15 @@ class WalletDetail extends Component {
<View style={[styles.containerTouch]}> <View style={[styles.containerTouch]}>
<TouchableOpacity style={styles.contain} <TouchableOpacity style={styles.contain}
onPress={() => { onPress={() => {
this.props.navigation.push(route.walletOptionSelect, {
optionSelect: optionNanoSanteAgentScreen,
wallet,
lottie: {
source: require("./../../datas/json/cedit-cards.json"),
loop: true
},
isNanoSanteAgent: true
});
}} }}
activeOpacity={0.9}> activeOpacity={0.9}>
<Icon name='heart-multiple' <Icon name='heart-multiple'

View File

@ -49,6 +49,8 @@ import {getWalletDetailActivated} from "../../webservice/WalletApi";
import {getWalletTransactionHistoryUser} from "../../webservice/WalletTransactionHistoryApi"; import {getWalletTransactionHistoryUser} from "../../webservice/WalletTransactionHistoryApi";
import {getUserIdentificationAction} from "../../webservice/IdentificationApi"; import {getUserIdentificationAction} from "../../webservice/IdentificationApi";
import {store} from "../../redux/store"; import {store} from "../../redux/store";
import FontAwesome5 from "react-native-vector-icons/FontAwesome5";
import FontAwesome from "react-native-vector-icons/FontAwesome";
const route = require('./../../route.json'); const route = require('./../../route.json');
let slugify = require('slugify'); let slugify = require('slugify');
@ -68,6 +70,7 @@ class WalletOptionSelect extends Component {
isIdentified: store.getState().getUserIdentificationReducer.result !== null ? store.getState().getUserIdentificationReducer.result.response.isIdentified : false, isIdentified: store.getState().getUserIdentificationReducer.result !== null ? store.getState().getUserIdentificationReducer.result.response.isIdentified : false,
isNanoCredit: this.props.navigation.state.params.hasOwnProperty('isNanoCredit'), isNanoCredit: this.props.navigation.state.params.hasOwnProperty('isNanoCredit'),
isNanoSante: this.props.navigation.state.params.hasOwnProperty('isNanoSante'), isNanoSante: this.props.navigation.state.params.hasOwnProperty('isNanoSante'),
isNanoSanteAgent: this.props.navigation.state.params.hasOwnProperty('isNanoSanteAgent'),
user: null, user: null,
displayModalHistory: false, displayModalHistory: false,
historyItemDetail: null, historyItemDetail: null,
@ -296,10 +299,17 @@ class WalletOptionSelect extends Component {
}} }}
activeOpacity={0.9}> activeOpacity={0.9}>
<Icon name={options.icon} {
this.state.isNanoSanteAgent
? <FontAwesome name={options.icon}
color={Color.primaryColor} color={Color.primaryColor}
size={30} size={30}
style={styles.imageBanner}/> style={styles.imageBanner}/>
: <Icon name={options.icon}
color={Color.primaryColor}
size={30}
style={styles.imageBanner}/>
}
<View style={[styles.content]}> <View style={[styles.content]}>
@ -482,6 +492,92 @@ class WalletOptionSelect extends Component {
</View> </View>
</> </>
); );
renderNanoSanteAgentAccountDetail = (options) => (
<>
<View
style={[styles.blockView, {borderBottomColor: Color.borderColor}]}>
{/*<View style={{flexDirection: 'row', justifyContent: 'space-between'}}>
<View
style={{
flexDirection: 'row',
alignItems: 'center',
}}>
<View
style={[
styles.circlePoint,
{backgroundColor: Color.primaryColor},
]}>
<Icons name='md-wallet'
size={28}
color={Color.whiteColor}
/>
</View>
<View>
<Text style={[Typography.title3, Color.primaryColor], {marginBottom: 3}}>
{I18n.t('CREDIT_ACCOUNT')}
</Text>
{this.state.user !== null ?
<Text
style={[Typography.body2]}>{this.props.result != null ? `${thousands(this.props.result.response.balance_credit, ' ')} ${this.state.wallet.currency_code}` : `${thousands(this.state.user.balance_credit, ' ')} ${this.state.wallet.currency_code}`}</Text>
: null}
</View>
</View>
<View
style={{
flexDirection: 'row',
alignItems: 'center',
}}>
<View
style={[
styles.circlePoint,
{backgroundColor: Color.primaryColor},
]}>
<Icons name='md-key'
size={28}
color={Color.whiteColor}
/>
</View>
<View>
<Text style={[Typography.title3, Color.primaryColor], {marginBottom: 3}}>
{I18n.t('SAVINGS_ACCOUNT')}
</Text>
{this.state.user !== null ?
<Text
style={[Typography.body2]}>{this.props.result != null ? `${thousands(this.props.result.response.balance_epargne, ' ')} ${this.state.wallet.currency_code}` : `${thousands(this.state.user.balance_epargne, ' ')} ${this.state.wallet.currency_code}`}</Text>
: null}
</View>
</View>
</View>*/}
</View>
<View style={{
flexDirection: 'row',
marginTop: 30,
marginBottom: 10,
flex: 1,
alignItems: 'center',
justifyContent: 'center'
}}>
<Tag icon={<FontAwesome5 name='money-check-alt' size={20} color={Color.whiteColor}
style={{marginLeft: -15}}/>}
style={{
paddingRight: 10,
width: "70%",
borderRightWidth: 1,
borderRightColor: Color.whiteColor
}}
primary
onPress={() => {
//this._scrollView.scrollToEnd();
}}>{' ' + I18n.t('FACTURER_FEUILLES_SOINS')}
</Tag>
</View>
</>
);
renderHistoryTransactionList = () => { renderHistoryTransactionList = () => {
const {resultHistory, errorHistory} = this.props; const {resultHistory, errorHistory} = this.props;
if (errorHistory !== null) { if (errorHistory !== null) {
@ -1055,6 +1151,8 @@ class WalletOptionSelect extends Component {
this.renderAccountDetail() this.renderAccountDetail()
: this.state.isNanoSante ? : this.state.isNanoSante ?
this.renderNanoSanteAccountDetail() : this.renderNanoSanteAccountDetail() :
this.state.isNanoSanteAgent ?
this.renderNanoSanteAgentAccountDetail() :
<View style={{ <View style={{
justifyContent: 'center', justifyContent: 'center',
alignItems: 'center' alignItems: 'center'
@ -1128,7 +1226,8 @@ class WalletOptionSelect extends Component {
{ {
isEqual(this.props.navigation.state.params.optionSelect.type, 'NANO_CREDIT') ? isEqual(this.props.navigation.state.params.optionSelect.type, 'NANO_CREDIT')
|| isEqual(this.props.navigation.state.params.optionSelect.type, 'NANO_SANTE') ?
this.renderHistory() this.renderHistory()
: <View style={{flex: 1}}/> : <View style={{flex: 1}}/>
} }

View File

@ -0,0 +1,382 @@
/**
* Project iLinkWorld
* File SaisirFeuilleSoinScreen
* Path screens/wallet/agent
* Created by BRICE ZELE
* Date: 11/11/2021
*/
import React, {useEffect, useState} from 'react';
import {Alert, Dimensions, KeyboardAvoidingView, Platform, ScrollView, StyleSheet, View,} from 'react-native';
import {connect, useDispatch} from 'react-redux';
import {Formik} from 'formik';
import * as Yup from 'yup';
import * as Utils from '../../../utils/UtilsFunction';
import {Color} from "../../../config/Color";
import I18n from 'react-native-i18n';
import {ScreenComponent} from "../../../components/ScreenComponent";
import PasswordInput from '../../../components/PasswordInput';
import Button from "../../../components/Button";
import FontAwesome from "react-native-vector-icons/FontAwesome";
import {responsiveWidth} from "react-native-responsive-dimensions";
import {
fetchActivePaySubscription,
fetchActivePaySubscriptionReset,
fetchGetSubscriptionList,
fetchGetSubscriptionListReset
} from "../../../redux/insurance/insurance.actions";
import DropdownAlert from "react-native-dropdownalert";
import {readUser} from "../../../webservice/AuthApi";
import * as Animatable from 'react-native-animatable';
import {createStructuredSelector} from "reselect";
import {selectActivatePaySubscription, selectSubscriptionList} from "../../../redux/insurance/insurance.selector";
import {Dropdown} from "react-native-material-dropdown";
let moment = require('moment-timezone');
const {width, height} = Dimensions.get('window');
const CIRCLE_SIZE = width * 0.5;
const styles = StyleSheet.create({
textInput: {
height: 46,
backgroundColor: Color.fieldColor,
borderRadius: 5,
marginTop: 10,
padding: 10,
width: '100%',
},
lineRow: {
flexDirection: 'row',
justifyContent: 'space-between',
paddingBottom: 20,
},
contain: {
alignItems: 'center',
marginTop: 40,
paddingBottom: 20,
paddingLeft: 20,
paddingRight: 20,
flex: 1,
},
circle: {
width: CIRCLE_SIZE,
height: CIRCLE_SIZE,
borderRadius: CIRCLE_SIZE / 2,
position: 'absolute',
top: '15%',
},
circleContainer: {
alignItems: 'flex-end',
right: -(CIRCLE_SIZE / 3),
top: -(CIRCLE_SIZE / 1.5),
},
lineSeparator: {
borderWidth: 1,
width: '40%',
height: 1,
alignSelf: 'center',
},
line: {
width: 1,
height: 14,
backgroundColor: Color.grayColor,
marginLeft: 10,
},
contentModeView: {
width: 30,
height: '100%',
alignItems: 'flex-end',
justifyContent: 'center',
},
contentFilter: {
flexDirection: 'row',
alignItems: 'center',
marginLeft: 10,
},
bottomModal: {
justifyContent: 'flex-end',
margin: 0,
},
contentFilterBottom: {
width: "100%",
borderTopLeftRadius: 8,
borderTopRightRadius: 8,
paddingHorizontal: 20
},
contentSwipeDown: {
paddingTop: 10,
alignItems: 'center',
},
lineSwipeDown: {
width: 30,
height: 2.5,
backgroundColor: Color.dividerColor,
},
contentActionModalBottom: {
flexDirection: 'row',
paddingVertical: 15,
justifyContent: 'space-between',
borderBottomWidth: 1,
},
containModal: {
paddingVertical: 10,
paddingHorizontal: 20,
flexDirection: 'row',
justifyContent: 'space-between',
},
floatingButtonAdd: {
backgroundColor: Color.accentColor,
position: "absolute",
width: 25,
bottom: 0,
zIndex: 1000,
right: 20,
top: 35,
height: 25,
borderRadius: 12.5,
alignItems: 'center',
justifyContent: 'center',
},
contentSwitch: {
width: responsiveWidth(40),
},
switch: {},
choosePhotoBtn: {
marginTop: 10,
marginBottom: 10,
width: "auto",
height: "auto",
padding: 5,
alignItems: 'center',
borderColor: Color.borderColor,
marginRight: 10,
elevation: 2,
},
checkbox: {
alignSelf: "center",
color: "white"
},
itemAmountPerMonth: {
paddingLeft: 10,
marginTop: 10,
flexDirection: 'row',
},
dot: {
width: 12,
height: 12,
borderRadius: 6
},
blockView: {
paddingVertical: 10,
borderBottomWidth: 0.5,
},
});
const SaisirFeuilleSoinScreen = ({
activatePaySubscription,
fetchGetSubscriptionList,
subscriptionList,
fetchActivePaySubscription,
navigation
}) => {
const [user, setUser] = useState(null);
const [password, setPassword] = useState(null);
const [subscriptions, setSubscriptions] = useState([]);
const [subscription, setSubscription] = useState(null);
const dispatch = useDispatch();
let dropDownAlertRef: any = null;
let subscriptionRef = null;
let amountPerMonthRef = null;
useEffect(() => {
readUser().then((user) => {
setUser(user)
});
dispatch(fetchGetSubscriptionListReset());
dispatch(fetchActivePaySubscriptionReset());
}, []);
useEffect(() => {
if (user !== null) {
console.log("user", user.id);
fetchGetSubscriptionList(user.id, 'ACCEPTED', true);
}
}, [user]);
useEffect(() => {
if (subscriptionList.result !== null) {
let subscriptionListTemp = [];
subscriptionList.result.response.map((subscriptionItem, index) => {
subscriptionListTemp.push(subscriptionItem);
});
setSubscriptions(subscriptionListTemp);
}
if (subscriptionList.error) {
dropDownAlertRef.alertWithType(
'error',
I18n.t('ERROR_LABEL'),
Utils.getErrorMsg(subscriptionList),
);
dispatch(fetchGetSubscriptionListReset());
}
}, [subscriptionList]);
useEffect(() => {
if (activatePaySubscription.result !== null) {
Alert.alert(
I18n.t("SUCCESS"),
activatePaySubscription.result.response,
[
{
text: I18n.t("OK"), onPress: () => {
dispatch(fetchActivePaySubscriptionReset());
navigation.goBack();
}
}
],
{cancelable: false}
)
}
if (activatePaySubscription.error) {
dropDownAlertRef.alertWithType(
'error',
I18n.t('ERROR_LABEL'),
Utils.getErrorMsg(activatePaySubscription),
);
dispatch(fetchActivePaySubscriptionReset());
}
}, [activatePaySubscription]);
const RegisterSchema = Yup.object().shape({
password: Yup.string()
.required(I18n.t('THIS_FIELD_IS_REQUIRED'))
});
return (
<ScreenComponent>
<DropdownAlert ref={ref => (dropDownAlertRef = ref)}/>
<KeyboardAvoidingView
behavior={Platform.OS === 'android' ? 'height' : 'padding'}
style={{flex: 1}}>
<ScrollView style={{flex: 1}}>
<Formik validationSchema={RegisterSchema}
initialValues={{
password: '',
}}
onSubmit={(values) => {
if (user !== null) {
if (subscription === null) {
subscriptionRef.shake(800);
} else {
console.log("subscription", subscription);
fetchActivePaySubscription(subscription.id, {password: values.password});
}
}
}}>
{({
values,
errors,
touched,
handleChange,
handleBlur,
handleSubmit,
isSubmitting,
}) => (
<View style={styles.contain}>
<Animatable.View ref={(comp) => {
subscriptionRef = comp
}}
style={{
width: responsiveWidth(90),
height: 60,
alignSelf: 'center',
borderRadius: 10,
paddingLeft: 20,
paddingRight: 20,
backgroundColor: 'white'
}}>
<Dropdown
label={I18n.t('SELECT_INSURANCE')}
data={subscriptions}
useNativeDriver={true}
onChangeText={(value, index, data) => {
console.log("Value", value);
setSubscription(
{
id: value.id,
insurance_subscription_id: value.insurance_subscription_id,
network_id: value.network_id,
user_id: value.user_id,
number_of_months: value.number_of_months,
bonus_amount: value.bonus_amount,
number_of_beneficiaries: value.number_of_beneficiaries,
total_bonus_amount: value.total_bonus_amount,
state: value.state,
created_at: value.created_at,
updated_at: value.updated_at,
start_at: value.start_at,
end_at: value.end_at,
reason: value.reason,
network: value.network,
beneficiaries: value.beneficiaries
}
);
}}
valueExtractor={(value) => {
return value
}}
labelExtractor={(value) => {
return `${value.network.name} | ${I18n.t('ETAT')}: ${value.state} | ${I18n.t('AMOUNT_LABEL')}: ${value.total_bonus_amount}`
}}
/>
</Animatable.View>
<PasswordInput
style={{marginTop: 10}}
onChangeText={handleChange('password')}
placeholder={I18n.t('PASSWORD')}
secureTextEntry
icon={<FontAwesome name="lock" size={20}/>}
value={values.password}
onBlur={handleBlur('password')}
success={touched.password && !errors.password}
touched={touched.password}
error={errors.password}
/>
<Button
style={{marginTop: 20}}
full
loading={activatePaySubscription.loading}
onPress={handleSubmit}>
{I18n.t('SUBMIT_LABEL')}
</Button>
</View>
)}
</Formik>
</ScrollView>
</KeyboardAvoidingView>
</ScreenComponent>
);
};
const mapStateToProps = createStructuredSelector({
subscriptionList: selectSubscriptionList,
activatePaySubscription: selectActivatePaySubscription
});
export default connect(mapStateToProps, {
fetchActivePaySubscription,
fetchGetSubscriptionList,
})(
SaisirFeuilleSoinScreen,
);

View File

@ -0,0 +1,382 @@
/**
* Project iLinkWorld
* File ActivateBuySubscriptionScreen
* Path screens/wallet/user
* Created by BRICE ZELE
* Date: 08/11/2021
*/
import React, {useEffect, useState} from 'react';
import {Alert, Dimensions, KeyboardAvoidingView, Platform, ScrollView, StyleSheet, View,} from 'react-native';
import {connect, useDispatch} from 'react-redux';
import {Formik} from 'formik';
import * as Yup from 'yup';
import * as Utils from '../../../utils/UtilsFunction';
import {Color} from "../../../config/Color";
import I18n from 'react-native-i18n';
import {ScreenComponent} from "../../../components/ScreenComponent";
import PasswordInput from '../../../components/PasswordInput';
import Button from "../../../components/Button";
import FontAwesome from "react-native-vector-icons/FontAwesome";
import {responsiveWidth} from "react-native-responsive-dimensions";
import {
fetchActivePaySubscription,
fetchActivePaySubscriptionReset,
fetchGetSubscriptionList,
fetchGetSubscriptionListReset
} from "../../../redux/insurance/insurance.actions";
import DropdownAlert from "react-native-dropdownalert";
import {readUser} from "../../../webservice/AuthApi";
import * as Animatable from 'react-native-animatable';
import {createStructuredSelector} from "reselect";
import {selectActivatePaySubscription, selectSubscriptionList} from "../../../redux/insurance/insurance.selector";
import {Dropdown} from "react-native-material-dropdown";
let moment = require('moment-timezone');
const {width, height} = Dimensions.get('window');
const CIRCLE_SIZE = width * 0.5;
const styles = StyleSheet.create({
textInput: {
height: 46,
backgroundColor: Color.fieldColor,
borderRadius: 5,
marginTop: 10,
padding: 10,
width: '100%',
},
lineRow: {
flexDirection: 'row',
justifyContent: 'space-between',
paddingBottom: 20,
},
contain: {
alignItems: 'center',
marginTop: 40,
paddingBottom: 20,
paddingLeft: 20,
paddingRight: 20,
flex: 1,
},
circle: {
width: CIRCLE_SIZE,
height: CIRCLE_SIZE,
borderRadius: CIRCLE_SIZE / 2,
position: 'absolute',
top: '15%',
},
circleContainer: {
alignItems: 'flex-end',
right: -(CIRCLE_SIZE / 3),
top: -(CIRCLE_SIZE / 1.5),
},
lineSeparator: {
borderWidth: 1,
width: '40%',
height: 1,
alignSelf: 'center',
},
line: {
width: 1,
height: 14,
backgroundColor: Color.grayColor,
marginLeft: 10,
},
contentModeView: {
width: 30,
height: '100%',
alignItems: 'flex-end',
justifyContent: 'center',
},
contentFilter: {
flexDirection: 'row',
alignItems: 'center',
marginLeft: 10,
},
bottomModal: {
justifyContent: 'flex-end',
margin: 0,
},
contentFilterBottom: {
width: "100%",
borderTopLeftRadius: 8,
borderTopRightRadius: 8,
paddingHorizontal: 20
},
contentSwipeDown: {
paddingTop: 10,
alignItems: 'center',
},
lineSwipeDown: {
width: 30,
height: 2.5,
backgroundColor: Color.dividerColor,
},
contentActionModalBottom: {
flexDirection: 'row',
paddingVertical: 15,
justifyContent: 'space-between',
borderBottomWidth: 1,
},
containModal: {
paddingVertical: 10,
paddingHorizontal: 20,
flexDirection: 'row',
justifyContent: 'space-between',
},
floatingButtonAdd: {
backgroundColor: Color.accentColor,
position: "absolute",
width: 25,
bottom: 0,
zIndex: 1000,
right: 20,
top: 35,
height: 25,
borderRadius: 12.5,
alignItems: 'center',
justifyContent: 'center',
},
contentSwitch: {
width: responsiveWidth(40),
},
switch: {},
choosePhotoBtn: {
marginTop: 10,
marginBottom: 10,
width: "auto",
height: "auto",
padding: 5,
alignItems: 'center',
borderColor: Color.borderColor,
marginRight: 10,
elevation: 2,
},
checkbox: {
alignSelf: "center",
color: "white"
},
itemAmountPerMonth: {
paddingLeft: 10,
marginTop: 10,
flexDirection: 'row',
},
dot: {
width: 12,
height: 12,
borderRadius: 6
},
blockView: {
paddingVertical: 10,
borderBottomWidth: 0.5,
},
});
const ActivateBuySubscriptionScreen = ({
activatePaySubscription,
fetchGetSubscriptionList,
subscriptionList,
fetchActivePaySubscription,
navigation
}) => {
const [user, setUser] = useState(null);
const [password, setPassword] = useState(null);
const [subscriptions, setSubscriptions] = useState([]);
const [subscription, setSubscription] = useState(null);
const dispatch = useDispatch();
let dropDownAlertRef: any = null;
let subscriptionRef = null;
let amountPerMonthRef = null;
useEffect(() => {
readUser().then((user) => {
setUser(user)
});
dispatch(fetchGetSubscriptionListReset());
dispatch(fetchActivePaySubscriptionReset());
}, []);
useEffect(() => {
if (user !== null) {
console.log("user", user.id);
fetchGetSubscriptionList(user.id, 'ACCEPTED', true);
}
}, [user]);
useEffect(() => {
if (subscriptionList.result !== null) {
let subscriptionListTemp = [];
subscriptionList.result.response.map((subscriptionItem, index) => {
subscriptionListTemp.push(subscriptionItem);
});
setSubscriptions(subscriptionListTemp);
}
if (subscriptionList.error) {
dropDownAlertRef.alertWithType(
'error',
I18n.t('ERROR_LABEL'),
Utils.getErrorMsg(subscriptionList),
);
dispatch(fetchGetSubscriptionListReset());
}
}, [subscriptionList]);
useEffect(() => {
if (activatePaySubscription.result !== null) {
Alert.alert(
I18n.t("SUCCESS"),
activatePaySubscription.result.response,
[
{
text: I18n.t("OK"), onPress: () => {
dispatch(fetchActivePaySubscriptionReset());
navigation.goBack();
}
}
],
{cancelable: false}
)
}
if (activatePaySubscription.error) {
dropDownAlertRef.alertWithType(
'error',
I18n.t('ERROR_LABEL'),
Utils.getErrorMsg(activatePaySubscription),
);
dispatch(fetchActivePaySubscriptionReset());
}
}, [activatePaySubscription]);
const RegisterSchema = Yup.object().shape({
password: Yup.string()
.required(I18n.t('THIS_FIELD_IS_REQUIRED'))
});
return (
<ScreenComponent>
<DropdownAlert ref={ref => (dropDownAlertRef = ref)}/>
<KeyboardAvoidingView
behavior={Platform.OS === 'android' ? 'height' : 'padding'}
style={{flex: 1}}>
<ScrollView style={{flex: 1}}>
<Formik validationSchema={RegisterSchema}
initialValues={{
password: '',
}}
onSubmit={(values) => {
if (user !== null) {
if (subscription === null) {
subscriptionRef.shake(800);
} else {
console.log("subscription", subscription);
fetchActivePaySubscription(subscription.id, {password: values.password});
}
}
}}>
{({
values,
errors,
touched,
handleChange,
handleBlur,
handleSubmit,
isSubmitting,
}) => (
<View style={styles.contain}>
<Animatable.View ref={(comp) => {
subscriptionRef = comp
}}
style={{
width: responsiveWidth(90),
height: 60,
alignSelf: 'center',
borderRadius: 10,
paddingLeft: 20,
paddingRight: 20,
backgroundColor: 'white'
}}>
<Dropdown
label={I18n.t('SELECT_INSURANCE')}
data={subscriptions}
useNativeDriver={true}
onChangeText={(value, index, data) => {
console.log("Value", value);
setSubscription(
{
id: value.id,
insurance_subscription_id: value.insurance_subscription_id,
network_id: value.network_id,
user_id: value.user_id,
number_of_months: value.number_of_months,
bonus_amount: value.bonus_amount,
number_of_beneficiaries: value.number_of_beneficiaries,
total_bonus_amount: value.total_bonus_amount,
state: value.state,
created_at: value.created_at,
updated_at: value.updated_at,
start_at: value.start_at,
end_at: value.end_at,
reason: value.reason,
network: value.network,
beneficiaries: value.beneficiaries
}
);
}}
valueExtractor={(value) => {
return value
}}
labelExtractor={(value) => {
return `${value.network.name} | ${I18n.t('ETAT')}: ${value.state} | ${I18n.t('AMOUNT_LABEL')}: ${value.total_bonus_amount}`
}}
/>
</Animatable.View>
<PasswordInput
style={{marginTop: 10}}
onChangeText={handleChange('password')}
placeholder={I18n.t('PASSWORD')}
secureTextEntry
icon={<FontAwesome name="lock" size={20}/>}
value={values.password}
onBlur={handleBlur('password')}
success={touched.password && !errors.password}
touched={touched.password}
error={errors.password}
/>
<Button
style={{marginTop: 20}}
full
loading={activatePaySubscription.loading}
onPress={handleSubmit}>
{I18n.t('SUBMIT_LABEL')}
</Button>
</View>
)}
</Formik>
</ScrollView>
</KeyboardAvoidingView>
</ScreenComponent>
);
};
const mapStateToProps = createStructuredSelector({
subscriptionList: selectSubscriptionList,
activatePaySubscription: selectActivatePaySubscription
});
export default connect(mapStateToProps, {
fetchActivePaySubscription,
fetchGetSubscriptionList,
})(
ActivateBuySubscriptionScreen,
);

File diff suppressed because it is too large Load Diff

View File

@ -59,8 +59,10 @@ import {
} from "../../../redux/insurance/insurance.selector"; } from "../../../redux/insurance/insurance.selector";
import Dialog from "react-native-dialog"; import Dialog from "react-native-dialog";
import {Typography} from "../../../config/typography"; import {Typography} from "../../../config/typography";
import {Dropdown} from "react-native-material-dropdown"; import {Dropdown} from "react-native-material-dropdown";
import Icon from "react-native-vector-icons/FontAwesome5"; import Icon from "react-native-vector-icons/FontAwesome5";
import isNil from "lodash/isNil";
let moment = require('moment-timezone'); let moment = require('moment-timezone');
@ -271,7 +273,7 @@ const InsuranceSubscriptionScreen = ({
fetchGetListInsurance(user.country_id); fetchGetListInsurance(user.country_id);
}, [user]); }, [user]);
useEffect(()=>{ useEffect(() => {
console.log('Beneficiaries', beneficiaries); console.log('Beneficiaries', beneficiaries);
}, [beneficiaries]); }, [beneficiaries]);
@ -362,7 +364,7 @@ const InsuranceSubscriptionScreen = ({
lastname: lastNameBeneficiary, lastname: lastNameBeneficiary,
firstname: firstNameBeneficiary, firstname: firstNameBeneficiary,
gender: gender, gender: gender,
birthdate: dateNaissance, birthdate: moment(dateNaissance).format('YYYY-MM-DD'),
affiliation: affiliation, affiliation: affiliation,
birthdate_proof: childAyantDroitDocument[0].checboxSelectedValue, birthdate_proof: childAyantDroitDocument[0].checboxSelectedValue,
birthdate_proof_doc: uploadInsuranceImages.result.response[0], birthdate_proof_doc: uploadInsuranceImages.result.response[0],
@ -499,7 +501,8 @@ const InsuranceSubscriptionScreen = ({
const handleTakePhotoFromCamera = (name, isFrontCamera = false) => { const handleTakePhotoFromCamera = (name, isFrontCamera = false) => {
ImagePicker.openCamera({ ImagePicker.openCamera({
cropping: true, cropping: true,
compressImageQuality: 0.7 compressImageQuality: 0.7,
useFrontCamera: false
}).then(image => { }).then(image => {
if (affiliation === "CHILD") { if (affiliation === "CHILD") {
let tempChildAyantDroitDocument = childAyantDroitDocument; let tempChildAyantDroitDocument = childAyantDroitDocument;
@ -561,7 +564,7 @@ const InsuranceSubscriptionScreen = ({
setDateNaissance(currentDate); setDateNaissance(currentDate);
}; };
const onSelectAmountPerMonth = () => { const onSelectAmountPerMonth = (selected) => {
let insuranceTemp = insurance; let insuranceTemp = insurance;
setInsurance( setInsurance(
{ {
@ -575,6 +578,7 @@ const InsuranceSubscriptionScreen = ({
id: item.id, id: item.id,
number_of_months: item.number_of_months, number_of_months: item.number_of_months,
min_amount: item.min_amount, min_amount: item.min_amount,
checked: item.id === selected.id,
}; };
}) })
} }
@ -587,7 +591,7 @@ const InsuranceSubscriptionScreen = ({
is24Hour={true} is24Hour={true}
value={new Date(dateNaissance)} value={new Date(dateNaissance)}
mode='date' mode='date'
maximumDate={currentYearMinusAgeLimit} minimumDate={currentYearMinusAgeLimit}
display="spinner" display="spinner"
onChange={onChangeDateNaissance} onChange={onChangeDateNaissance}
/> />
@ -959,6 +963,7 @@ const InsuranceSubscriptionScreen = ({
insurancesRef.shake(800); insurancesRef.shake(800);
} else { } else {
console.log(user); console.log(user);
console.log("insurance", insurance);
setPassword(values.password); setPassword(values.password);
fetchGetInsurancePrimeAmount({ fetchGetInsurancePrimeAmount({
network_id: insurance.id, network_id: insurance.id,
@ -1009,6 +1014,7 @@ const InsuranceSubscriptionScreen = ({
id: item.id, id: item.id,
number_of_months: item.number_of_months, number_of_months: item.number_of_months,
min_amount: item.min_amount, min_amount: item.min_amount,
checked: index === 0,
}; };
}) })
} }
@ -1082,12 +1088,15 @@ const InsuranceSubscriptionScreen = ({
? `${I18n.t('NUMBER_OF_MONTHS')}: ${amountPerMonth.number_of_months} | ${I18n.t('MINIMUM_AMOUNT')}: ${amountPerMonth.min_amount}` ? `${I18n.t('NUMBER_OF_MONTHS')}: ${amountPerMonth.number_of_months} | ${I18n.t('MINIMUM_AMOUNT')}: ${amountPerMonth.min_amount}`
: `${I18n.t('NUMBER_OF_MONTHS')}: ${insurance.months_prices[0].number_of_months} | ${I18n.t('MINIMUM_AMOUNT')}: ${insurance.months_prices[0].min_amount}` : `${I18n.t('NUMBER_OF_MONTHS')}: ${insurance.months_prices[0].number_of_months} | ${I18n.t('MINIMUM_AMOUNT')}: ${insurance.months_prices[0].min_amount}`
} }
data={insurance.months_prices} data={insurance.months_prices.map((item, index) => ({
checked: !isNil(item.checked) ? item.checked : index === 0,
...item
}))}
useNativeDriver={true} useNativeDriver={true}
onChangeText={(value, index, data) => { onChangeText={(value, index, data) => {
console.log("Value", data[index]); console.log("Value", data[index]);
setAmountPerMonth(data[index]); setAmountPerMonth(data[index]);
onSelectAmountPerMonth(); onSelectAmountPerMonth(data[index]);
}} }}
valueExtractor={(value) => { valueExtractor={(value) => {
return `${I18n.t('NUMBER_OF_MONTHS')}: ${value.number_of_months} | ${I18n.t('MINIMUM_AMOUNT')}: ${value.min_amount}` return `${I18n.t('NUMBER_OF_MONTHS')}: ${value.number_of_months} | ${I18n.t('MINIMUM_AMOUNT')}: ${value.min_amount}`
@ -1166,18 +1175,19 @@ const InsuranceSubscriptionScreen = ({
I18n.t('ERROR_LABEL'), I18n.t('ERROR_LABEL'),
I18n.t('PLEASE_SELECT_INSURANCE_BEFORE'), I18n.t('PLEASE_SELECT_INSURANCE_BEFORE'),
); );
} else } else {
setModalVisible(true); setModalVisible(true);
setShowDateNaissancePicker(false); setShowDateNaissancePicker(false);
dispatch(fetchUploadInsuranceReset()); dispatch(fetchUploadInsuranceReset());
setAffliliation('CHILD'); setAffliliation('CHILD');
if (insurance !== null)
setCurrentYearMinusAgeLimit(new Date(((new Date()).getFullYear() - parseInt(insurance.age_limit_of_child_beneficiary)), 0, 1)); setCurrentYearMinusAgeLimit(new Date(((new Date()).getFullYear() - parseInt(insurance.age_limit_of_child_beneficiary)), 0, 1));
setDateNaissance('' + moment(new Date(((new Date()).getFullYear() - parseInt(insurance.age_limit_of_child_beneficiary)), 0, 1)).format('YYYY-MM-DD')); setDateNaissance('' + moment(new Date(((new Date()).getFullYear() - parseInt(insurance.age_limit_of_child_beneficiary)), 0, 1)).format('YYYY-MM-DD'));
setFirstNameBeneficiary(null); setFirstNameBeneficiary(null);
setLastNameBeneficiary(null); setLastNameBeneficiary(null);
setFileAdded([]); setFileAdded([]);
//setDateNaissance('' + moment().subtract(5, 'years').format()); //setDateNaissance('' + moment().subtract(5, 'years').format());
}
}}> }}>
<Text body1 primaryColor bold> <Text body1 primaryColor bold>
{I18n.t('ADD_AYANT_DROIT')} {I18n.t('ADD_AYANT_DROIT')}

View File

@ -494,7 +494,7 @@ export const optionNanoSanteUserScreen = {
}, },
{ {
title: 'ACTIVATE_INSSURANCE', title: 'ACTIVATE_INSSURANCE',
screen: '', screen: 'activateBuySubscriptionScreen',
icon: "cash-refund" icon: "cash-refund"
}, },
{ {
@ -606,6 +606,24 @@ export const optionNanoCreditAgentScreen = {
] ]
} }
export const optionNanoSanteAgentScreen = {
type: 'NANO_SANTE',
title: 'NANO_SANTE',
subTitle: 'CHOOSE_OPTION',
options: [
{
screen: route.cautionNanoCreditAgent,
icon: 'user-plus',
title: 'SAISIR_FEUILLE_SOIN',
},
{
screen: route.cautionNanoCreditAgent,
icon: 'edit',
title: 'MODIFIER_FEUILLE_SOIN',
}
]
}
export const optionPaiementEau = { export const optionPaiementEau = {
title: 'PAIEMENT_FACTURE', title: 'PAIEMENT_FACTURE',

View File

@ -602,5 +602,9 @@
"AMOUNT_PER_MONTH": "Montant par durée de couverture", "AMOUNT_PER_MONTH": "Montant par durée de couverture",
"DETAIL": "Détail", "DETAIL": "Détail",
"PRIME_AMOUNT": "Montant de la prime", "PRIME_AMOUNT": "Montant de la prime",
"AYANT_DROIT": "Ayant(s) droit(s)" "AYANT_DROIT": "Ayant(s) droit(s)",
"SELECT_SUBSCRIPTION": "Sélectionner une souscription",
"SAISIR_FEUILLE_SOIN": "Saisir une feuille de soin",
"MODIFIER_FEUILLE_SOIN": "Modifier une feuille de soin",
"FACTURER_FEUILLES_SOINS": "Facturer les feuilles de soins"
} }

14072
yarn.lock

File diff suppressed because it is too large Load Diff