/** * Project iLinkWorld * File UbaFormScreen * Path screens/wallet/user * Created by BRICE ZELE * Date: 01/02/2022 */ import React, {useEffect, useRef, useState} from 'react'; import { ActivityIndicator, Alert, Dimensions, FlatList, KeyboardAvoidingView, Platform, ProgressBarAndroid, ScrollView, StyleSheet, TouchableOpacity, View, } from 'react-native'; import {connect, useDispatch} from 'react-redux'; import {Color} from "../../../config/Color"; import I18n from 'react-native-i18n'; import {ScreenComponent} from "../../../components/ScreenComponent"; import { fetchAcceptRejectConsultation, fetchActivePaySubscription, fetchDemaneAutorisationSoin, fetchGetListInsuranceWithBeneficiaries, fetchGetNetworkActs, fetchGetUserByIdQRCode, fetchGetUserByNameOrNumber, fetchGetUserByNameOrNumberReset } from "../../../redux/insurance/insurance.actions"; import DropdownAlert from "react-native-dropdownalert"; import {createStructuredSelector} from "reselect"; import { selectActivatePaySubscription, selectDemandeAutorisationSoin, selectGetConsultation, selectGetNetworkAct, selectGetUserByIdQRCode, selectGetUserByNameOrNumber, selectInsuranceList, selectSubscriptionList } from "../../../redux/insurance/insurance.selector"; import Text from '../../../components/Text'; import Dialog from "react-native-dialog"; import {store} from "../../../redux/store"; import {useFormik} from "formik"; import {responsiveWidth} from "react-native-responsive-dimensions"; import FontAwesome from "react-native-vector-icons/FontAwesome"; import Button from "../../../components/Button"; import * as Yup from "yup"; import SpinnerOverlay from "../../../components/SpinnerOverlayComponent"; import Modal from "react-native-modal"; import QRCodeScanner from "react-native-qrcode-scanner"; import {RNCamera} from "react-native-camera"; import TextInput from "../../../components/TextInput"; import Icon from "react-native-vector-icons/FontAwesome5"; import SwitchSelector from "react-native-switch-selector"; import StepHeader from "../../../components/StepHeaderComponent"; import Wizard from "react-native-wizard"; import {readUser} from "../../../webservice/AuthApi"; import Fontisto from "react-native-vector-icons/Fontisto"; import MaterialCommunityIcons from "react-native-vector-icons/MaterialCommunityIcons"; let moment = require('moment-timezone'); const {width, height} = Dimensions.get('window'); const UbaFormScreen = ({ navigation, fetchGetNetworkActs, fetchAcceptRejectConsultation, fetchGetListInsuranceWithBeneficiaries, fetchDemaneAutorisationSoin, fetchGetUserByIdQRCode, fetchGetUserByNameOrNumber, getConsultation, getUserByNameOrNumber, getUserByIdQRCode, insuranceList, getNetworkAct, subscriptionList, demandeAutorisationSoin }) => { const dispatch = useDispatch(); const [user, setUser] = useState(null); const wizard = useRef(); const [isFirstStep, setIsFirstStep] = useState(true); const [isLastStep, setIsLastStep] = useState(false); const [currentStep, setCurrentStep] = useState(1); const [statutMatrimonial] = useState([ {label: 'Célibataire', value: "C"}, {label: 'Marié', value: "M"}, {label: 'Veuf', value: "V"}, {label: 'Divorcé', value: "D"}, ]); let dropDownAlertRef: any = null; const RegisterSchema = Yup.object().shape({ password: Yup.string() }); useEffect(() => { readUser().then((user) => { setUser(user); }); }, []); const { handleChange, handleSubmit, handleBlur, values, errors, touched, setFieldValue, setFieldTouched, isValid, } = useFormik({ validationSchema: RegisterSchema, initialValues: { password: '', code_acte: '', firstname_patient: '', lastname_patient: '', }, onSubmit: values => { }, }); const onNext = () => { switch (currentStep) { case 0: return true; break; default: return true; } }; const stepList = [ { title: 'Infos pers.', content: ( } /> } /> } /> } /> } /> ), }, { title: 'Infos. des parents', content: ( } /> } /> ), }, { title: 'Statut matrimonial', content: ( } /> Situation matrimonial { //setGender(value); }}/> ), }, { title: 'Employeur', content: ( ), }, ] return ( (dropDownAlertRef = ref)}/> setIsFirstStep(val) } isLastStep={val => setIsLastStep(val) } onNext={() => { onNext(); }} onPrev={() => { }} currentStep={({ currentStep, isLastStep, isFirstStep, }) => { setCurrentStep(currentStep); setIsFirstStep(isFirstStep); setIsLastStep(isLastStep); }} /> {!isFirstStep ? ( wizard.current.prev() }> ) : ( )} {currentStep === stepList.length - 1 ? ( ) : ( { handleSubmit(e); if (onNext()) wizard.current.next(); }}> {(subscriptionList.loading || getUserByNameOrNumber.loading || getUserByIdQRCode.loading) ? : } )} {/* {getConsultation.loading ? renderLoader() : getConsultation.result !== null ? ( { return ( {I18n.t('NO_CONSULTATION_DEMAND')} ) }} data={[]} keyExtractor={(item, index) => item.id} renderItem={({item, index}) => ( renderItem(item) )} /> ) : null}*/} ) }; const mapStateToProps = createStructuredSelector({ subscriptionList: selectSubscriptionList, insuranceList: selectInsuranceList, activatePaySubscription: selectActivatePaySubscription, getConsultation: selectGetConsultation, getNetworkAct: selectGetNetworkAct, demandeAutorisationSoin: selectDemandeAutorisationSoin, getUserByNameOrNumber: selectGetUserByNameOrNumber, getUserByIdQRCode: selectGetUserByIdQRCode, }); export default connect(mapStateToProps, { fetchActivePaySubscription, fetchGetNetworkActs, fetchAcceptRejectConsultation, fetchGetListInsuranceWithBeneficiaries, fetchDemaneAutorisationSoin, fetchGetUserByIdQRCode, fetchGetUserByNameOrNumber, })( UbaFormScreen, ); 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: { marginTop: 20, paddingBottom: 20, paddingLeft: 10, paddingRight: 10, flex: 1, }, content: { padding: 10, marginBottom: 10, borderRadius: 8 }, contentTop: { flexDirection: "row", paddingBottom: 10, borderBottomWidth: 1 }, contentBottom: { flexDirection: "row", marginTop: 10, justifyContent: "space-between" }, bottomLeft: {flexDirection: "row", alignItems: "center"}, image: {width: 32, height: 32, marginRight: 10, borderRadius: 16}, blockView: { paddingVertical: 10, borderBottomWidth: 0.5, }, ineSeparator: { 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: 10, marginBottom: 10, justifyContent: "space-between", borderBottomWidth: 1 }, containModal: { paddingVertical: 10, paddingHorizontal: 20, flexDirection: 'row', justifyContent: 'space-between', }, iconNavigation: { width: '100%', flexDirection: 'row', marginTop: 20, justifyContent: 'space-between', alignItems: 'center', }, iconNavigationButton: { borderWidth: 1, borderRadius: 25, width: 50, height: 50, alignItems: 'center', justifyContent: 'center' }, beneficiarySubSection: { marginTop: 10, flexDirection: 'row', width: '100%', } });