| 
									
										
										
										
											2022-02-09 10:12:27 +00:00
										 |  |  | 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 { | 
					
						
							| 
									
										
										
										
											2022-04-24 22:09:59 +00:00
										 |  |  |     fetchGetListInsuranceReset, | 
					
						
							|  |  |  |     fetchGetListInsuranceWithBeneficiaries, | 
					
						
							| 
									
										
										
										
											2022-02-09 10:12:27 +00:00
										 |  |  |     fetchGetSubscriptionList, | 
					
						
							| 
									
										
										
										
											2022-04-24 22:09:59 +00:00
										 |  |  |     fetchGetSubscriptionListReset, | 
					
						
							|  |  |  |     fetchStopSubscription, | 
					
						
							|  |  |  |     fetchStopSubscriptionReset | 
					
						
							| 
									
										
										
										
											2022-02-09 10:12:27 +00:00
										 |  |  | } 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"; | 
					
						
							| 
									
										
										
										
											2022-04-24 22:09:59 +00:00
										 |  |  | import {selectInsuranceList, selectStopSubscription} from "../../../redux/insurance/insurance.selector"; | 
					
						
							| 
									
										
										
										
											2022-02-09 10:12:27 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-12 23:38:33 +00:00
										 |  |  | import {Dropdown} from "react-native-material-dropdown-v2"; | 
					
						
							| 
									
										
										
										
											2022-04-24 22:09:59 +00:00
										 |  |  | import {store} from "../../../redux/store"; | 
					
						
							| 
									
										
										
										
											2022-02-09 10:12:27 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 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 StopSubscriptionScreen = ({ | 
					
						
							|  |  |  |                                            stopSubscription, | 
					
						
							|  |  |  |                                            fetchGetSubscriptionList, | 
					
						
							| 
									
										
										
										
											2022-02-09 17:43:48 +00:00
										 |  |  |                                     fetchGetListInsuranceWithBeneficiaries, | 
					
						
							|  |  |  |                                            insuranceList, | 
					
						
							| 
									
										
										
										
											2022-02-09 10:12:27 +00:00
										 |  |  |                                            fetchStopSubscription, | 
					
						
							|  |  |  |                                            navigation | 
					
						
							|  |  |  |                                        }) => { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     const [user, setUser] = useState(null); | 
					
						
							|  |  |  |     const [password, setPassword] = useState(null); | 
					
						
							|  |  |  |     const [subscriptions, setSubscriptions] = useState([]); | 
					
						
							|  |  |  |     const [subscription, setSubscription] = useState(null); | 
					
						
							| 
									
										
										
										
											2022-04-24 22:09:59 +00:00
										 |  |  |     const [wallet] = useState(store.getState().walletDetailReducer.result.response); | 
					
						
							| 
									
										
										
										
											2022-02-09 10:12:27 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |     const dispatch = useDispatch(); | 
					
						
							|  |  |  |     let dropDownAlertRef: any = null; | 
					
						
							|  |  |  |     let subscriptionRef = null; | 
					
						
							|  |  |  |     let amountPerMonthRef = null; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     useEffect(() => { | 
					
						
							|  |  |  |         readUser().then((user) => { | 
					
						
							|  |  |  |             setUser(user) | 
					
						
							|  |  |  |         }); | 
					
						
							| 
									
										
										
										
											2022-02-09 17:43:48 +00:00
										 |  |  |         dispatch(fetchGetListInsuranceReset()); | 
					
						
							| 
									
										
										
										
											2022-02-09 10:12:27 +00:00
										 |  |  |         dispatch(fetchGetSubscriptionListReset()); | 
					
						
							|  |  |  |         dispatch(fetchStopSubscriptionReset()); | 
					
						
							|  |  |  |     }, []); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     useEffect(() => { | 
					
						
							|  |  |  |         if (user !== null) { | 
					
						
							|  |  |  |             console.log("user", user.id); | 
					
						
							| 
									
										
										
										
											2022-02-09 17:43:48 +00:00
										 |  |  |             fetchGetListInsuranceWithBeneficiaries(`?user_id=${user.id}&type=EDITABLE`); | 
					
						
							|  |  |  |             //fetchGetSubscriptionList(user.id, 'ACCEPTED', true);
 | 
					
						
							| 
									
										
										
										
											2022-02-09 10:12:27 +00:00
										 |  |  |         } | 
					
						
							|  |  |  |     }, [user]); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     useEffect(() => { | 
					
						
							| 
									
										
										
										
											2022-02-09 17:43:48 +00:00
										 |  |  |         if (insuranceList.result !== null) { | 
					
						
							|  |  |  |             let insuranceListTemp = []; | 
					
						
							|  |  |  |             insuranceList.result.response.map((subscriptionItem, index) => { | 
					
						
							|  |  |  |                 insuranceListTemp.push(subscriptionItem); | 
					
						
							| 
									
										
										
										
											2022-02-09 10:12:27 +00:00
										 |  |  |             }); | 
					
						
							| 
									
										
										
										
											2022-02-09 17:43:48 +00:00
										 |  |  |             setSubscriptions(insuranceListTemp); | 
					
						
							| 
									
										
										
										
											2022-02-09 10:12:27 +00:00
										 |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-09 17:43:48 +00:00
										 |  |  |         if (insuranceList.error) { | 
					
						
							|  |  |  |             Alert.alert( | 
					
						
							|  |  |  |                 I18n.t("ERROR_LABLE"), | 
					
						
							|  |  |  |                 Utils.getErrorMsg(insuranceList), | 
					
						
							|  |  |  |                 [ | 
					
						
							|  |  |  |                     { | 
					
						
							|  |  |  |                         text: I18n.t("OK"), onPress: () => { | 
					
						
							|  |  |  |                             dispatch(fetchGetSubscriptionListReset()); | 
					
						
							|  |  |  |                         } | 
					
						
							|  |  |  |                     } | 
					
						
							|  |  |  |                 ], | 
					
						
							|  |  |  |                 { cancelable: false } | 
					
						
							|  |  |  |             ); | 
					
						
							|  |  |  | /*            dropDownAlertRef.alertWithType( | 
					
						
							| 
									
										
										
										
											2022-02-09 10:12:27 +00:00
										 |  |  |                 'error', | 
					
						
							|  |  |  |                 I18n.t('ERROR_LABEL'), | 
					
						
							| 
									
										
										
										
											2022-02-09 17:43:48 +00:00
										 |  |  |                 Utils.getErrorMsg(insuranceList), | 
					
						
							| 
									
										
										
										
											2022-02-09 10:12:27 +00:00
										 |  |  |             ); | 
					
						
							| 
									
										
										
										
											2022-02-09 17:43:48 +00:00
										 |  |  |             dispatch(fetchGetSubscriptionListReset());*/ | 
					
						
							| 
									
										
										
										
											2022-02-09 10:12:27 +00:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2022-02-09 17:43:48 +00:00
										 |  |  |     }, [insuranceList]); | 
					
						
							| 
									
										
										
										
											2022-02-09 10:12:27 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |     useEffect(() => { | 
					
						
							|  |  |  |         if (stopSubscription.result !== null) { | 
					
						
							|  |  |  |             Alert.alert( | 
					
						
							|  |  |  |                 I18n.t("SUCCESS"), | 
					
						
							|  |  |  |                 stopSubscription.result.response, | 
					
						
							|  |  |  |                 [ | 
					
						
							|  |  |  |                     { | 
					
						
							|  |  |  |                         text: I18n.t("OK"), onPress: () => { | 
					
						
							|  |  |  |                             dispatch(fetchStopSubscriptionReset()); | 
					
						
							|  |  |  |                             navigation.goBack(); | 
					
						
							|  |  |  |                         } | 
					
						
							|  |  |  |                     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                 ], | 
					
						
							|  |  |  |                 {cancelable: false} | 
					
						
							|  |  |  |             ) | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         if (stopSubscription.error) { | 
					
						
							| 
									
										
										
										
											2022-02-09 17:43:48 +00:00
										 |  |  |             Alert.alert( | 
					
						
							|  |  |  |                 I18n.t("ERROR_LABLE"), | 
					
						
							|  |  |  |                 Utils.getErrorMsg(stopSubscription), | 
					
						
							|  |  |  |                 [ | 
					
						
							|  |  |  |                     { | 
					
						
							|  |  |  |                         text: I18n.t("OK"), onPress: () => { | 
					
						
							|  |  |  |                             dispatch(fetchStopSubscriptionReset()); | 
					
						
							|  |  |  |                         } | 
					
						
							|  |  |  |                     } | 
					
						
							|  |  |  |                 ], | 
					
						
							|  |  |  |                 { cancelable: false } | 
					
						
							|  |  |  |             ); | 
					
						
							|  |  |  | /*            dropDownAlertRef.alertWithType( | 
					
						
							| 
									
										
										
										
											2022-02-09 10:12:27 +00:00
										 |  |  |                 'error', | 
					
						
							|  |  |  |                 I18n.t('ERROR_LABEL'), | 
					
						
							|  |  |  |                 Utils.getErrorMsg(stopSubscription), | 
					
						
							|  |  |  |             ); | 
					
						
							| 
									
										
										
										
											2022-02-09 17:43:48 +00:00
										 |  |  |             dispatch(fetchStopSubscriptionReset());*/ | 
					
						
							| 
									
										
										
										
											2022-02-09 10:12:27 +00:00
										 |  |  |         } | 
					
						
							|  |  |  |     }, [stopSubscription]); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     const RegisterSchema = Yup.object().shape({ | 
					
						
							| 
									
										
										
										
											2022-05-04 02:26:39 +00:00
										 |  |  |         password: Yup.string().required(I18n.t('THIS_FIELD_IS_REQUIRED')) | 
					
						
							| 
									
										
										
										
											2022-02-09 10:12:27 +00:00
										 |  |  |     }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     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); | 
					
						
							|  |  |  |                                         fetchStopSubscription(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> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-05-04 02:26:39 +00:00
										 |  |  |                                 <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} | 
					
						
							|  |  |  |                                 /> | 
					
						
							| 
									
										
										
										
											2022-02-09 10:12:27 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |                                 <Button | 
					
						
							|  |  |  |                                     style={{marginTop: 20}} | 
					
						
							|  |  |  |                                     full | 
					
						
							|  |  |  |                                     loading={stopSubscription.loading} | 
					
						
							|  |  |  |                                     onPress={handleSubmit}> | 
					
						
							|  |  |  |                                     {I18n.t('SUBMIT_LABEL')} | 
					
						
							|  |  |  |                                 </Button> | 
					
						
							|  |  |  |                             </View> | 
					
						
							|  |  |  |                         )} | 
					
						
							|  |  |  |                     </Formik> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                 </ScrollView> | 
					
						
							|  |  |  |             </KeyboardAvoidingView> | 
					
						
							|  |  |  |         </ScreenComponent> | 
					
						
							|  |  |  |     ); | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | const mapStateToProps = createStructuredSelector({ | 
					
						
							| 
									
										
										
										
											2022-02-09 17:43:48 +00:00
										 |  |  |     insuranceList: selectInsuranceList, | 
					
						
							| 
									
										
										
										
											2022-02-09 10:12:27 +00:00
										 |  |  |     stopSubscription: selectStopSubscription | 
					
						
							|  |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | export default connect(mapStateToProps, { | 
					
						
							|  |  |  |     fetchStopSubscription, | 
					
						
							| 
									
										
										
										
											2022-02-09 17:43:48 +00:00
										 |  |  |     fetchGetListInsuranceWithBeneficiaries, | 
					
						
							| 
									
										
										
										
											2022-02-09 10:12:27 +00:00
										 |  |  |     fetchGetSubscriptionList, | 
					
						
							|  |  |  | })( | 
					
						
							|  |  |  |     StopSubscriptionScreen, | 
					
						
							|  |  |  | ); |