diff --git a/android/app/src/main/assets/index.android.bundle b/android/app/src/main/assets/index.android.bundle index 5ab1c353..870a880a 100644 --- a/android/app/src/main/assets/index.android.bundle +++ b/android/app/src/main/assets/index.android.bundle @@ -1821,7 +1821,7 @@ __d(function(g,r,i,a,m,e,d){var t=r(d[0]),l=r(d[1]);Object.defineProperty(e,"__e __d(function(g,r,i,a,m,e,d){var t=r(d[0]),n=r(d[1]);Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var o=n(r(d[2])),l=n(r(d[3])),s=n(r(d[4])),u=n(r(d[5])),c=n(r(d[6])),f=n(r(d[7])),C=n(r(d[8])),p=n(r(d[9])),y=t(r(d[10])),E=r(d[11]),h=t(r(d[12])),A=n(r(d[13])),v=n(r(d[14])),T=r(d[15]),S=r(d[16]),w=r(d[17]),b=r(d[18]),R=n(r(d[19])),D=r(d[20]),N=r(d[21]),k=r(d[22]),_=r(d[23]),L=r(d[24]),I=r(d[25]),W=r(d[26]),P=r(d[27]),x=r(d[28]),V=n(r(d[29])),O=r(d[30]),F=(r(d[31]),r(d[32]),(function(t){function n(t){var l;return(0,o.default)(this,n),(l=(0,s.default)(this,(0,u.default)(n).call(this,t))).renderGetActionCountryList=function(){var t=l.props,n=t.resultActiveCountryList,o=t.errorActiveCountryList;null!==n&&void 0!==n.response&&(l.setState({hasLoadActiveCountryList:!1,paysDestination:n.response,paysDestinationSelect:n.response[0].name}),l.state.hasLoadActivePayCountryNetworkList&&l.props.getPayCountryNetworkAction({id_wallet_agent:l.state.wallet.id,id_country:n.response[0].id})),null!==o&&(void 0!==o.data?E.Alert.alert(A.default.t('ERROR_LABEL'),o.data.error,[{text:A.default.t("OK"),onPress:function(){l.props.getActiveCountryReset()}}],{cancelable:!1}):E.Alert.alert(A.default.t('ERROR_LABEL'),JSON.stringify(o),[{text:A.default.t("OK"),onPress:function(){l.props.getActiveCountryReset()}}],{cancelable:!1}))},l.renderGetPayCountryNetworkResponse=function(){var t=l.props,n=t.resultPayCountryNetwork,o=t.errorPayCountryNetwork;null!==n&&void 0!==n.response&&(n.response.length>0?l.setState({hasLoadActivePayCountryNetworkList:!1,walletActifs:n.response,walletActifSelect:n.response[0].name,modalVisible:!1}):0===n.response.length&&l.setState({walletActifs:[],walletActifSelect:'',modalVisible:!1,hasLoadActivePayCountryNetworkList:!1})),null!==o&&(void 0!==o.data?E.Alert.alert(A.default.t('ERROR_LABEL'),o.data.error,[{text:A.default.t("OK"),onPress:function(){l.props.getPayCountryNetworkReset()}}],{cancelable:!1}):E.Alert.alert(A.default.t('ERROR_LABEL'),JSON.stringify(o),[{text:A.default.t("OK"),onPress:function(){l.props.getPayCountryNetworkReset()}}],{cancelable:!1}))},l.renderEnvoieWalletToWalletResponse=function(){var t=l.props,n=t.resultEnvoieWalletToCash,o=t.errorEnvoieWalletToCash;null!==o&&void 0!==o.data&&E.Alert.alert(A.default.t("ERROR_TRANSFER"),o.data.error,[{text:A.default.t("OK"),onPress:function(){l.props.envoieUserWalletToCashReset()}}],{cancelable:!1}),null!==n&&null!==n.response&&E.Alert.alert(A.default.t("SUCCESS_TRANSFER"),n.response,[{text:A.default.t("OK"),onPress:function(){l.props.envoieUserWalletToCashReset(),O.IlinkEmitter.emit("refreshWallet"),l.props.navigation.pop()}}],{cancelable:!1})},l.renderDialogGetCommissionResponse=function(){var t=l.props.errorEnvoieWalletToCashGetCommission;null!==t&&void 0!==t.data&&E.Alert.alert(A.default.t("ERROR_LABLE"),t.data.error,[{text:A.default.t("OK"),onPress:function(){l.props.getCommissionUserWalletToCashReset()}}],{cancelable:!1})},l.isMontantValid=function(){var t=l.state.montant;return parseInt((0,C.default)(t,0))||t<0?{errorMessage:A.default.t('ENTER_AMOUNT_SUPERIOR_ZEROR'),isValid:!1}:(0,L.isNormalInteger)(t)?t>parseInt(l.state.comptePrincipal)?{errorMessage:A.default.t('AMOUNT_SUPERIOR_TO_PRINCIPAL_ACCOUNT'),isValid:!1}:{errorMessage:'',isValid:!0}:{errorMessage:A.default.t('ENTER_VALID_AMOUNT'),isValid:!1}},l.modalConfirmTransaction=function(t){var n=t.response.frais,o=t.response.montant_net_final;t.response.montant_net_init;return console.log("DATA SEND TO CONFIRM DIALOG",t),y.default.createElement(v.default.Container,{useNativeDriver:!0,visible:l.state.isModalConfirmVisible},y.default.createElement(v.default.Title,null,A.default.t('TRANSACTION_DETAIL')),y.default.createElement(E.View,null,y.default.createElement(E.View,{style:[B.blockView,{borderBottomColor:k.Color.borderColor}]},y.default.createElement(E.View,{style:{flexDirection:'row',marginTop:10}},y.default.createElement(E.View,{style:{flex:1}},y.default.createElement(E.Text,{style:[B.body2]},A.default.t('AMOUNT'))),y.default.createElement(E.View,{style:{flex:1,alignItems:'flex-end'}},y.default.createElement(E.Text,{style:[x.Typography.caption1,k.Color.grayColor]},(0,V.default)(l.state.montant,' ')+" "+l.state.wallet.currency_code))),y.default.createElement(E.View,{style:{flexDirection:'row',marginTop:10}},y.default.createElement(E.View,{style:{flex:1}},y.default.createElement(E.Text,{tyle:[x.Typography.body2]},A.default.t('FEES_AND_TAXES'))),y.default.createElement(E.View,{style:{flex:1,alignItems:'flex-end'}},y.default.createElement(E.Text,{style:[x.Typography.caption1,k.Color.grayColor]},(0,V.default)(n,' ')+" "+l.state.wallet.currency_code)))),y.default.createElement(E.View,{style:{paddingVertical:10}},y.default.createElement(E.View,{style:{paddingVertical:10}},y.default.createElement(E.View,{style:{flexDirection:'row',marginTop:10}},y.default.createElement(E.View,{style:{flex:1}},y.default.createElement(E.Text,{tyle:[x.Typography.body2,x.FontWeight.bold]},A.default.t('NET_AMOUNT'),":")),y.default.createElement(E.View,{style:{flex:1,alignItems:'flex-end'}},y.default.createElement(E.Text,{style:[x.Typography.caption1,k.Color.grayColor]},(0,V.default)(o,' ')+"}")))))),y.default.createElement(v.default.Button,{bold:!0,label:A.default.t('CANCEL_LABEL'),onPress:function(){l.setState({isModalConfirmVisible:!1})}}),y.default.createElement(v.default.Button,{bold:!0,label:A.default.t('SUBMIT_LABEL'),onPress:function(){l.setState({isModalConfirmVisible:!1,isDataSubmit:!0}),l.props.envoieUserWalletToCashAction({type:17,id_wallet_agent:l.state.wallet.id,nom_emetteur:l.state.nomsEmetteur,prenom_emetteur:l.state.prenomsDestinataire,email_emetteur:l.state.emailEmetteur,type_document_emetteur:l.state.identityPiecesNameEmetteur,id_document_emetteur:l.state.numeroIdentiteEmetteur,final_country:l.state.paysDestination.filter(function(t){return t.name===l.state.paysDestinationSelect})[0].id,id_destinataire:l.state.numeroIdentiteEmetteur,type_document_destinataire:l.state.identityPiecesNameEmetteur,nom_destinataire:l.state.nomsDestinataire,prenom_destinataire:l.state.prenomsDestinataire,id_document_destinataire:l.state.numeroIdentiteDestinataire,network_destinataire:l.state.walletActifs.filter(function(t){return t.name===l.state.walletActifSelect})[0].id,montant:l.state.montant,password:l.state.password}),l.props.getCommissionUserWalletToCashReset()}}))},l.onSubmitNextStep=function(){var t=l.state,n=t.nomsEmetteur,o=t.prenomsEmetteur,s=t.emailEmetteur,u=t.numeroIdentiteEmetteur;l.ckeckIfFieldIsOK(n)?l.nomsEmetteurAnim.shake(800):l.ckeckIfFieldIsOK(o)?l.prenomsEmetteurAnim.shake(800):l.ckeckIfFieldIsOK(s)?l.emailEmetteurAnim.shake(800):l.ckeckIfFieldIsOK(u)?l.numeroIdentiteEmetteurAnim.shake(800):l.setState({triggerNextClick:!0,modalVisible:!0,hasLoadActiveCountryList:!0,hasLoadActivePayCountryNetworkList:!0,displayFirstStep:!l.state.displayFirstStep,displaySecondStep:!l.state.displaySecondSte},function(){l.props.getActiveCountryAction(),console.log("ENVOIE WALLET PROPS",l.props)})},l.onSubmitCashVersAutreWallet=function(){var t=l.state,n=t.nomsDestinataire,o=t.prenomsDestinataire,s=t.montant,u=t.password,c=t.numeroIdentiteDestinataire;l.ckeckIfFieldIsOK(n)?l.nomDestinataireAnim.shake(800):l.ckeckIfFieldIsOK(o)?l.prenomsDestinataireAnim.shake(800):l.ckeckIfFieldIsOK(c)?l.identityPiecesDestinataireAnim.shake(800):l.ckeckIfFieldIsOK(s)||!l.isMontantValid().isValid?(console.log("IS MONTANT VALID",l.isMontantValid()),l.montantAnim.shake(800)):l.ckeckIfFieldIsOK(u)?l.passwordAnim.shake(800):l.props.getCommissionUserWalletToCashAction({type:17,id_wallet_agent:l.state.wallet.id,final_country:l.state.paysDestination.filter(function(t){return t.name===l.state.paysDestinationSelect})[0].id,montant:l.state.montant}),l.setState({isDataSubmit:!1,triggerSubmitClick:!0})},l.renderLoader=function(){return y.default.createElement(w.ProgressDialog,{visible:l.state.modalVisible||l.props.loadingEnvoieWalletToCashGetCommission||l.props.loadingEnvoieWalletToCash||l.props.loadingCountryByDialCode||l.props.loadingActiveCountryList||l.props.loadingCountryByDialCode,title:A.default.t('LOADING'),message:A.default.t('LOADING_INFO')})},l.state={identityPiecesEmetteur:(0,L.identityPieces)(),identityPiecesNameEmetteur:A.default.t((0,L.identityPieces)()[0].name),paysDestination:[],paysDestinationSelect:null,walletActifs:[],walletActifSelect:null,nomsEmetteur:null,prenomsEmetteur:null,emailEmetteur:null,numeroIdentiteEmetteur:null,nomsDestinataire:null,prenomsDestinataire:null,idDestinataire:null,numeroIdentiteDestinataire:null,montant:null,password:null,loading:!1,user:null,triggerSubmitClick:!1,triggerNextClick:!1,displayFirstStep:!0,displaySecondStep:!1,modalVisible:!1,hasLoadActiveCountryList:!1,hasLoadActivePayCountryNetworkList:!1,triggerSubmitClick:!1,isDataSubmit:!1,isModalConfirmVisible:!1,wallet:_.store.getState().walletDetailReducer.result.response},l.props.getActiveCountryReset(),l.props.getActiveCountryByDialCodeReset(),l.props.getPayCountryNetworkReset(),l.props.envoieUserWalletToCashReset(),l.props.getCommissionUserWalletToCashReset(),l}return(0,c.default)(n,t),(0,l.default)(n,[{key:"componentDidMount",value:function(){var t=this;(0,I.readUser)().then(function(n){n&&void 0!==n&&t.setState({user:n})})}},{key:"componentWillReceiveProps",value:function(t){null!=t.resultEnvoieWalletToCashGetCommission&&void 0!==t.resultEnvoieWalletToCashGetCommission.response&&(t.loadingEnvoieWalletToCashGetCommission||this.setState({isModalConfirmVisible:!0}))}},{key:"ckeckIfFieldIsOK",value:function(t){return(0,p.default)(t)||(0,C.default)(t.length,0)}},{key:"render",value:function(){var t=this;console.log("STATE",this.state);var n=this.props.resultEnvoieWalletToCashGetCommission;return y.default.createElement(y.default.Fragment,null,(this.state.modalVisible||this.props.loadingEnvoieWalletToCashGetCommission||this.props.loadingEnvoieWalletToCash||this.props.loadingCountryByDialCode||this.props.loadingActiveCountryList||this.props.loadingCountryByDialCode)&&this.renderLoader(),this.state.hasLoadActiveCountryList&&this.renderGetActionCountryList(),this.state.hasLoadActivePayCountryNetworkList&&this.renderGetPayCountryNetworkResponse(),this.state.isDataSubmit&&this.renderEnvoieWalletToWalletResponse(),this.state.triggerSubmitClick&&this.renderDialogGetCommissionResponse(),null!==n&&void 0!==n.response&&this.modalConfirmTransaction(n),y.default.createElement(E.ScrollView,{style:B.container},this.state.displayFirstStep&&y.default.createElement(y.default.Fragment,null,y.default.createElement(E.Text,{style:B.subbigtitle},A.default.t('ENVOIE_CASH_TO_CASH')),y.default.createElement(h.View,{ref:function(n){t.nomsEmetteurAnim=n}},y.default.createElement(b.Fumi,{iconClass:R.default,iconName:'user',label:""+A.default.t('NAME_EMETTEUR'),iconColor:'#f95a25',iconSize:20,value:this.state.nomsEmetteur,onChangeText:function(n){t.setState({nomsEmetteur:n})},style:B.input})),y.default.createElement(h.View,{ref:function(n){t.prenomsEmetteurAnim=n}},y.default.createElement(b.Fumi,{iconClass:R.default,iconName:'user-circle-o',label:""+A.default.t('FIRSTNAME_EMETTEUR'),iconColor:'#f95a25',iconSize:20,value:this.state.prenomsEmetteur,onChangeText:function(n){t.setState({prenomsEmetteur:n})},style:B.input})),y.default.createElement(h.View,{ref:function(n){t.emailEmetteurAnim=n}},y.default.createElement(b.Fumi,{iconClass:R.default,iconName:"envelope",label:A.default.t('EMAIL_EMETTEUR'),iconColor:'#f95a25',keyboardType:"email-address",iconSize:20,value:this.state.emailEmetteur,onChangeText:function(n){t.setState({emailEmetteur:n})},style:B.input})),y.default.createElement(h.View,{ref:function(n){t.identityPiecesEmetteurAnim=n},style:{width:(0,S.responsiveWidth)(90),height:60,marginTop:20,alignSelf:'center',borderRadius:10,paddingLeft:20,paddingRight:20,backgroundColor:'white'}},y.default.createElement(T.Dropdown,{label:A.default.t('PIECE_IDENTITE'),data:this.state.identityPiecesEmetteur,useNativeDriver:!0,value:this.state.identityPiecesNameEmetteur,onChangeText:function(n,o,l){t.setState({identityPiecesNameEmetteur:n,isDataSubmit:!1})},valueExtractor:function(t){return A.default.t(t.name)},labelExtractor:function(t){return A.default.t(t.name)}})),y.default.createElement(h.View,{ref:function(n){t.numeroIdentiteEmetteurAnim=n}},y.default.createElement(b.Fumi,{iconClass:R.default,iconName:'address-card',label:""+A.default.t('NUMERO_IDENTITE_EMETTEUR'),iconColor:'#f95a25',iconSize:20,onChangeText:function(n){t.setState({numeroIdentiteEmetteur:n})},style:B.input})),y.default.createElement(f.default,{style:B.btnvalide,textStyle:B.textbtnvalide,isLoading:this.state.isLoging,onPress:function(){t.onSubmitNextStep()}},A.default.t('NEXT'))),this.state.displaySecondStep&&y.default.createElement(y.default.Fragment,null,y.default.createElement(h.View,{ref:function(n){t.nomDestinataireAnim=n}},y.default.createElement(b.Fumi,{iconClass:R.default,iconName:'user',label:""+A.default.t('NAME_DESTINATAIRE'),iconColor:'#f95a25',iconSize:20,value:this.state.nomsDestinataire,onChangeText:function(n){t.setState({nomsDestinataire:n})},style:B.input})),y.default.createElement(h.View,{ref:function(n){t.prenomsDestinataireAnim=n}},y.default.createElement(b.Fumi,{iconClass:R.default,iconName:'user-circle-o',label:""+A.default.t('FIRSTNAME_DESTINATAIRE'),iconColor:'#f95a25',iconSize:20,value:this.state.prenomsDestinataire,onChangeText:function(n){t.setState({prenomsDestinataire:n})},style:B.input})),y.default.createElement(h.View,{ref:function(n){t.identityPiecesDestinataireAnim=n}},y.default.createElement(b.Fumi,{iconClass:R.default,iconName:'user-circle-o',label:""+A.default.t('NUMERO_IDENTITE'),iconColor:'#f95a25',iconSize:20,value:this.state.numeroIdentiteDestinataire,onChangeText:function(n){t.setState({numeroIdentiteDestinataire:n})},style:B.input})),y.default.createElement(h.View,{ref:function(n){t.paysDestinationAnim=n},style:{width:(0,S.responsiveWidth)(90),height:60,marginTop:20,alignSelf:'center',borderRadius:10,paddingLeft:20,paddingRight:20,backgroundColor:'white'}},y.default.createElement(T.Dropdown,{label:A.default.t('PAYS_DESTINATION'),data:this.state.paysDestination,useNativeDriver:!0,value:null===this.state.paysDestinationSelect?'':this.state.paysDestinationSelect,onChangeText:function(n,o,l){t.props.getPayCountryNetworkReset();var s=l.filter(function(t){return t.name===n});t.setState({paysDestinationSelect:n,hasLoadActivePayCountryNetworkList:!0,isDataSubmit:!1},function(){t.props.getPayCountryNetworkAction({id_wallet_agent:t.state.wallet.id,id_country:s[0].id})}),t.props.getCommissionUserWalletToCashReset()},valueExtractor:function(t){return t.name},labelExtractor:function(t){return t.name}})),y.default.createElement(h.View,{ref:function(n){t.walletActifAnim=n},style:{width:(0,S.responsiveWidth)(90),height:60,marginTop:20,alignSelf:'center',borderRadius:10,paddingLeft:20,paddingRight:20,backgroundColor:'white'}},y.default.createElement(T.Dropdown,{label:A.default.t('ACTIVE_WALLET'),data:this.state.walletActifs,useNativeDriver:!0,value:(0,p.default)(this.state.walletActifSelect)?'':this.state.walletActifSelect,onChangeText:function(n,o,l){t.setState({walletActifSelect:n,isDataSubmit:!1})},valueExtractor:function(t){return t.name},labelExtractor:function(t){return t.name}})),y.default.createElement(h.View,{ref:function(n){t.montantAnim=n}},y.default.createElement(b.Fumi,{iconClass:R.default,iconName:'money',label:A.default.t('AMOUNT'),iconColor:'#f95a25',keyboardType:"numeric",iconSize:20,value:this.state.montant,onChangeText:function(n){t.setState({montant:n})},style:B.input}),y.default.createElement(E.View,{style:{position:'absolute',left:(0,S.responsiveWidth)(82),top:35,flexDirection:'row'}},y.default.createElement(E.View,{style:{width:1,borderLeftColor:'#f0f0f0',height:40,left:-8,top:-10,borderLeftWidth:1}}),y.default.createElement(E.Text,{style:[x.Typography.body1,x.FontWeight.bold]},this.state.wallet.currency_code))),y.default.createElement(h.View,{ref:function(n){t.passwordAnim=n}},y.default.createElement(b.Fumi,{iconClass:R.default,iconName:'lock',label:A.default.t('PASSWORD'),iconColor:'#f95a25',iconSize:20,secureTextEntry:!0,value:this.state.password,onChangeText:function(n){t.setState({password:n})},style:B.input})),y.default.createElement(f.default,{style:B.btnvalide,textStyle:B.textbtnvalide,isLoading:this.state.isLoging,onPress:function(){t.onSubmitCashVersAutreWallet()}},A.default.t('SUBMIT_LABEL')))))}}]),n})(y.Component));F.navigatorStyle={navBarBackgroundColor:k.Color.primaryColor,statusBarColor:k.Color.primaryDarkColor,navBarTextColor:'#FFFFFF',navBarButtonColor:'#FFFFFF'},F.navigationOptions=function(){return{drawerLabel:function(){return null},headerTitle:A.default.t('DEPOSIT_CASH_TO_CASH'),headerTintColor:'white',headerStyle:{backgroundColor:k.Color.primaryColor,marginTop:0,color:'white'},headerTitleStyle:{color:"white"},title:A.default.t('DEPOSIT_CASH_TO_CASH')}};var U=(0,D.connect)(function(t){return{loadingCountryByDialCode:t.countryByDialCode.loading,resultCountryByDialCode:t.countryByDialCode.result,errorCountryByDialCode:t.countryByDialCode.error,loadingActiveCountryList:t.activeCountryListReducer.loading,resultActiveCountryList:t.activeCountryListReducer.result,errorActiveCountryList:t.activeCountryListReducer.error,loadingPayCountryNetwork:t.payCountryNetworkReducer.loading,resultPayCountryNetwork:t.payCountryNetworkReducer.result,errorPayCountryNetwork:t.payCountryNetworkReducer.error,loadingEnvoieWalletToCash:t.envoieUserWalletToCashReducer.loading,resultEnvoieWalletToCash:t.envoieUserWalletToCashReducer.result,errorEnvoieWalletToCash:t.envoieUserWalletToCashReducer.error,loadingEnvoieWalletToCashGetCommission:t.envoieUserWalletToCashGetCommissionReducer.loading,resultEnvoieWalletToCashGetCommission:t.envoieUserWalletToCashGetCommissionReducer.result,errorEnvoieWalletToCashGetCommission:t.envoieUserWalletToCashGetCommissionReducer.error}},function(t){return(0,N.bindActionCreators)({getActiveCountryByDialCodeAction:W.getActiveCountryByDialCodeAction,getActiveCountryByDialCodeReset:W.getActiveCountryByDialCodeReset,getPayCountryNetworkAction:W.getPayCountryNetworkAction,getPayCountryNetworkReset:W.getPayCountryNetworkReset,getActiveCountryAction:W.getActiveCountryAction,getActiveCountryReset:W.getActiveCountryReset,envoieUserWalletToCashAction:P.envoieUserWalletToCashAction,envoieUserWalletToCashReset:P.envoieUserWalletToCashReset,getCommissionUserWalletToCashAction:P.getCommissionUserWalletToCashAction,getCommissionUserWalletToCashReset:P.getCommissionUserWalletToCashReset},t)})(F);e.default=U;var B=E.StyleSheet.create({container:{flex:1,backgroundColor:k.Color.primaryDarkColor},textbtnvalide:{color:'white',fontWeight:'bold'},bigtitle:{color:'white',fontSize:20,flex:1,fontWeight:'bold',textAlign:'center',margin:20},blockView:{paddingVertical:10,borderBottomWidth:1},subbigtitle:{color:'white',fontSize:17,textAlign:'center',margin:5},btnvalide:{marginTop:20,marginLeft:20,marginRight:20,borderColor:'transparent',backgroundColor:k.Color.accentLightColor,height:52},btnSubmit:{marginTop:20,borderColor:'transparent',backgroundColor:k.Color.accentLightColor,height:52,width:"30%",marginLeft:20,marginRight:20},input:{height:60,marginTop:(0,S.responsiveHeight)(2),marginLeft:(0,S.responsiveWidth)(5),marginRight:(0,S.responsiveWidth)(5),borderRadius:5}})},1815,[4,1,8,9,10,12,13,717,689,1615,15,18,751,720,1629,973,535,1518,704,539,1039,1056,1026,1099,1648,719,1797,1799,1015,1650,774,814,815]); __d(function(g,r,i,a,m,e,d){var t=r(d[0]),n=r(d[1]);Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var o=n(r(d[2])),s=n(r(d[3])),l=n(r(d[4])),u=n(r(d[5])),c=n(r(d[6])),f=n(r(d[7])),p=n(r(d[8])),h=n(r(d[9])),I=n(r(d[10])),v=n(r(d[11])),D=n(r(d[12])),E=t(r(d[13])),N=r(d[14]),y=t(r(d[15])),C=n(r(d[16])),b=n(r(d[17])),P=r(d[18]),w=r(d[19]),S=r(d[20]),k=r(d[21]),A=r(d[22]),x=n(r(d[23])),T=r(d[24]),O=r(d[25]),_=r(d[26]),F=r(d[27]),R=r(d[28]),Y=r(d[29]),L=r(d[30]),M=r(d[31]),U=(r(d[32]),r(d[33]),r(d[34])),V=(function(t){function n(t){var o;return(0,l.default)(this,n),(o=(0,c.default)(this,(0,f.default)(n).call(this,t))).onChangeDateNaissance=function(t,n){var s=(0,D.default)(o.state.dateNaissance)?new Date:o.state.dateNaissance,l=n||s;o.setState({showPickerDateNaissance:'ios'===N.Platform.OS||!1,dateNaissance:l})},o.onChangeDateExpiration=function(t,n){var s=(0,D.default)(o.state.dateExpiration)?new Date:o.state.dateExpiration,l=n||s;o.setState({showPickerDateExpiration:'ios'===N.Platform.OS||!1,dateExpiration:l})},o.onSubmitIdentityClient=function(){var t=o.state,n=t.lastname,s=t.numeroIdentite,l=t.dateNaissance,u=(t.dateExpiration,t.country),c=t.townName,f=t.identityPiecesName;o.ckeckIfFieldIsOK(n)?o.lastnameAnim.shake(800):o.ckeckIfFieldIsOK(u)?o.countryAnim.shake(800):o.ckeckIfFieldIsOK(c)?o.townAnim.shake(800):o.ckeckIfFieldIsOK(f)?o.identityPiecesAnim.shake(800):o.ckeckIfFieldIsOK(s)?o.numeroIdentiteAnim.shake(800):(console.log('USER ID',o.state.user.id),U(l).format('DD-MM-YYYY'),o.props.updateIndentificationAction({id:o.state.userIdentificationData.id,lastname:o.state.lastname,firstname:"",birth_date:(0,D.default)(o.state.dateNaissance)?o.dateNaissanceFumiProps.value:U(o.state.dateNaissance).format('DD-MM-YYYY'),town:o.state.townName,country:o.state.country,identity_document:o.state.identityPiecesName,id_identity_document:o.state.numeroIdentite,expiry_date_document:(0,D.default)(o.state.dateExpiration)?o.dateExpirationFumiProps.value:U(o.state.dateExpiration).format('DD-MM-YYYY')})),o.setState({triggerSubmitClick:!0})},o.renderLoader=function(){return E.default.createElement(k.ProgressDialog,{visible:o.props.loading||o.props.loadingNumberDetail,title:b.default.t('LOADING'),message:b.default.t('LOADING_INFO')})},o.renderDateNaissancePicker=function(){return E.default.createElement(h.default,{testID:"dateTimePicker",timeZoneOffsetInMinutes:0,is24Hour:!0,value:(0,D.default)(o.state.dateNaissance)?new Date:o.state.dateNaissance,mode:"date",maximumDate:new Date,display:"spinner",onChange:o.onChangeDateNaissance})},o.renderDateExpirationPicker=function(){return E.default.createElement(h.default,{testID:"dateTimePicker",timeZoneOffsetInMinutes:0,is24Hour:!0,value:(0,D.default)(o.state.dateExpiration)?new Date:o.state.dateExpiration,mode:"date",maximumDate:new Date(2300,10,20),display:"spinner",onChange:o.onChangeDateExpiration})},o.state={enterPhone:null,firstname:null,lastname:null,numeroIdentite:null,dateNaissance:null,dateExpiration:null,numeroTelephone:null,networksinglePickerVisible:!1,confirmpassanim:null,isLoging:!1,countries:[],town:[],townName:null,country:null,identityPieces:(0,R.identityPieces)(),identityPiecesName:b.default.t((0,R.identityPieces)()[0].name),snackVisible:!1,snackText:'',disableNetwork:!1,networks:[],showPickerDateNaissance:!1,showPickerDateExpiration:!1,modalVisible:!0,user:null,triggerSubmitClick:!1,triggerNextClick:!1,displayFirstStep:!0,displaySecondStep:!1,userIdentificationData:F.store.getState().getUserIdentificationReducer.result.response.data},o.dateNaissanceFumiProps={},o.dateExpirationFumiProps={},o.props.createIndentificationResetAction(),o}return(0,p.default)(n,t),(0,u.default)(n,[{key:"componentDidMount",value:function(){var t=this;this.dateNaissanceFumiProps.value=U(this.state.userIdentificationData.birth_date).format('DD-MM-YYYY'),this.dateExpirationFumiProps.value=U(this.state.userIdentificationData.expiry_date_document).format('DD-MM-YYYY'),(0,L.readUser)().then(function(n){n&&void 0!==n&&t.setState({user:n,lastname:t.state.userIdentificationData.firstname+' '+t.state.userIdentificationData.lastname,numeroIdentite:t.state.userIdentificationData.id_identity_document})}),'android'===N.Platform.OS?this.requestCameraPermission():this.watchLocation()}},{key:"renderCreateIdentificationResponse",value:function(){var t=this,n=this.props,o=n.result,s=n.error;console.log("PROPS",this.props),null!==o&&void 0!==o.response&&N.Alert.alert(b.default.t('SUCCESS_IDENTIFICATION'),o.response,[{text:b.default.t("OK"),onPress:function(){t.props.getUserIdentificationAction(t.state.user.phone),t.props.createIndentificationResetAction(),t.setState({triggerSubmitClick:!1}),t.props.navigation.pop()}}],{cancelable:!1}),null!==s&&(void 0!==s.data?N.Alert.alert(b.default.t('ERROR_IDENTIFICATION'),s.data.error,[{text:b.default.t("OK"),onPress:function(){t.props.createIndentificationResetAction(),t.setState({triggerSubmitClick:!1})}}],{cancelable:!1}):N.Alert.alert(b.default.t('ERROR_IDENTIFICATION'),JSON.stringify(s),[{text:b.default.t("OK"),onPress:function(){t.props.createIndentificationResetAction()}}],{cancelable:!1}))}},{key:"componentWillUpdate",value:function(t,n){var o=n.dateNaissance||new Date;this.state.showPickerDateNaissance&&(this.dateNaissanceFumiProps.value=U(o).format('DD-MM-YYYY')),this.state.showPickerDateExpiration&&(this.dateExpirationFumiProps.value=U(n.dateExpiration).format('DD-MM-YYYY'))}},{key:"componentWillUnmount",value:function(){this.mounted=!1,this.watchID&&C.default.clearWatch(this.watchID)}},{key:"showErrorDialog",value:function(){var t=this;this.setState({modalDialog:!1}),N.Alert.alert("Une erreur est survenue","Impossible de r\xe9cuperer des informations du pays verifier que votre gps est activ\xe9,et que vous \xeates connect\xe9 \xe0 internet puis ressayer",[{text:"Recommencer",onPress:function(){t.watchLocation()}},{text:"Annuler",onPress:function(){t.props.navigation.popToTop()}}])}},{key:"watchLocation",value:function(){var t=this;return s.default.async(function(n){for(;;)switch(n.prev=n.next){case 0:C.default.getCurrentPosition(function(n){t.treatPosition(n)},function(n){t.showErrorDialog()},this.props.geolocationOptions),this.watchID||C.default.watchPosition(function(n){t.treatPosition(n)},function(n){t.showErrorDialog()},this.props.geolocationOptions);case 2:case"end":return n.stop()}},null,this,null,Promise)}},{key:"requestCameraPermission",value:function(){var t=this;return s.default.async(function(n){for(;;)switch(n.prev=n.next){case 0:return n.prev=0,n.next=3,s.default.awrap(N.PermissionsAndroid.request(N.PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION,{title:'Cool Photo App Camera Permission',message:"Cool Photo App needs access to your camera so you can take awesome pictures."}));case 3:n.sent===N.PermissionsAndroid.RESULTS.GRANTED?this.watchLocation():(this.setState({modalDialog:!1}),N.Alert.alert("Echec \xe0 l'autorisation","L'application n'est pas autoris\xe9 \xe0 acceder \xe0 votre position veuillez verifier que votre GPS est activ\xe9 et configurer en mode Haute Precision",[{text:"Ok",onPress:function(){t.props.navigation.popToTop()}}])),n.next=11;break;case 7:n.prev=7,n.t0=n.catch(0),this.setState({modalDialog:!1}),N.Alert.alert("Une erreur est Survenue","Une erreur est survenu lors du demarrage de l'application veuillez relancer l'application",[{text:"Ok",onPress:function(){BackHandler.exitApp()}}]);case 11:case"end":return n.stop()}},null,this,[[0,7]],Promise)}},{key:"treatPosition",value:function(t){var n=this,o=this.state.myPosition,s=t.coords;(0,v.default)(s,o)||((0,M.getPositionInformation)(s).then(function(t){if(void 0!==t.results&&t.results.length>0){var o=t.results[0],s=o.address_components,l=o.formatted_address,u=o.place_id;n.setState({address:s,textadress:l,place:u});for(var c,f,p=t.results,h=0;h=s.length)break;f=s[u++]}else{if((u=s.next()).done)break;f=u.value}var p=f;p.code_country===c&&(o=!0,n.setState({modalVisible:!1,indicatif:p.code_dial,country:p.name}))}o||N.Alert.alert("Impossible de recup\xe9rer vos informations","Nous n'avons pas pu recuperer les informations de votre pays veuillez contacter les administrateurs",[{text:"OK"}])})}}).catch(function(t){n.showErrorDialog()}),this.setState({myPosition:s}))}},{key:"ckeckIfFieldIsOK",value:function(t){return(0,D.default)(t)||(0,v.default)(t.length,0)}},{key:"renderLoaderModal",value:function(){return E.default.createElement(P.MaterialDialog,{visible:this.state.modalVisible,title:b.default.t("LOADING_INFO")},E.default.createElement(N.View,{style:{justifyContent:'center',alignItems:'center'}},E.default.createElement(N.Text,null,b.default.t("LOADING_DESCRIPTION_COUNTRY")),E.default.createElement(N.ProgressBarAndroid,null)))}},{key:"render",value:function(){var t=this;console.log("STATE",this.state);this.state.showPickerDateNaissance;return E.default.createElement(E.default.Fragment,null,this.state.showPickerDateNaissance&&this.renderDateNaissancePicker(),this.state.showPickerDateExpiration&&this.renderDateExpirationPicker(),this.state.modalVisible&&this.renderLoaderModal(),(this.props.loading||this.props.loadingNumberDetail)&&this.renderLoader(),this.state.triggerSubmitClick&&this.renderCreateIdentificationResponse(),E.default.createElement(N.ScrollView,{style:W.container},E.default.createElement(y.View,{ref:function(n){t.lastnameAnim=n}},E.default.createElement(A.Fumi,{iconClass:x.default,iconName:'user',label:b.default.t('NAME')+" "+b.default.t('AND')+" "+b.default.t('FIRSTNAME'),iconColor:'#f95a25',iconSize:20,value:this.state.lastname,onChangeText:function(n){t.setState({lastname:n})},style:W.input})),E.default.createElement(y.View,{ref:function(n){t.datenaissanceAnim=n}},E.default.createElement(A.Fumi,(0,o.default)({iconClass:x.default,iconName:'calendar',label:b.default.t('DATE_NAISSANCE'),iconColor:'#f95a25',iconSize:20,style:W.input,onFocus:function(){N.Keyboard.dismiss(),t.setState({showPickerDateNaissance:!0})}},this.dateNaissanceFumiProps))),E.default.createElement(y.View,{ref:function(n){t.countryAnim=n},style:{width:(0,S.responsiveWidth)(90),height:60,marginTop:20,alignSelf:'center',borderRadius:10,paddingLeft:20,paddingRight:20,backgroundColor:'white'}},E.default.createElement(w.Dropdown,{label:b.default.t('COUNTRY_CHOICE'),data:this.state.countries,useNativeDriver:!0,value:null===this.state.country?"":this.state.country,onChangeText:function(n,o,s){t.setState({country:n})},valueExtractor:function(t){return t.name},labelExtractor:function(t){return t.name}})),E.default.createElement(y.View,{ref:function(n){t.townAnim=n},style:{width:(0,S.responsiveWidth)(90),height:60,marginTop:20,alignSelf:'center',borderRadius:10,paddingLeft:20,paddingRight:20,backgroundColor:'white'}},E.default.createElement(w.Dropdown,{label:b.default.t('CHOICE_TOWN'),data:this.state.town,useNativeDriver:!0,value:null===this.state.townName?"":this.state.townName,onChangeText:function(n,o,s){t.setState({townName:n})},valueExtractor:function(t){return t.name},labelExtractor:function(t){return t.name}})),E.default.createElement(y.View,{ref:function(n){t.identityPiecesAnim=n},style:{width:(0,S.responsiveWidth)(90),height:60,marginTop:20,alignSelf:'center',borderRadius:10,paddingLeft:20,paddingRight:20,backgroundColor:'white'}},E.default.createElement(w.Dropdown,{label:b.default.t('PIECE_IDENTITE'),data:this.state.identityPieces,useNativeDriver:!0,value:this.state.identityPiecesName,onChangeText:function(n,o,s){t.setState({identityPiecesName:n})},valueExtractor:function(t){return b.default.t(t.name)},labelExtractor:function(t){return b.default.t(t.name)}})),E.default.createElement(y.View,{ref:function(n){t.numeroIdentiteAnim=n}},E.default.createElement(A.Fumi,{iconClass:x.default,iconName:'address-card',label:""+b.default.t('NUMERO_IDENTITE'),iconColor:'#f95a25',iconSize:20,value:this.state.numeroIdentite,onChangeText:function(n){t.setState({numeroIdentite:n})},style:W.input})),E.default.createElement(y.View,{ref:function(n){t.identityDateExpiryAnim=n}},E.default.createElement(A.Fumi,(0,o.default)({iconClass:x.default,iconName:'calendar-times-o',label:b.default.t('IDENTITY_PIECE_EXPIRY_DATE'),iconColor:'#f95a25',iconSize:20,style:W.input,onFocus:function(){N.Keyboard.dismiss(),t.setState({showPickerDateExpiration:!0})}},this.dateExpirationFumiProps))),E.default.createElement(I.default,{style:W.btnvalide,textStyle:W.textbtnvalide,isLoading:this.state.isLoging,onPress:function(){t.onSubmitIdentityClient()}},b.default.t('MODIFY'))))}}]),n})(E.Component);V.navigatorStyle={navBarBackgroundColor:_.Color.primaryColor,statusBarColor:_.Color.primaryDarkColor,navBarTextColor:'#FFFFFF',navBarButtonColor:'#FFFFFF'},V.navigationOptions=function(){return{drawerLabel:function(){return null},headerTitle:b.default.t('IDENTIFICATION'),headerTintColor:'white',headerStyle:{backgroundColor:_.Color.primaryColor,marginTop:0,color:'white'},headerTitleStyle:{color:"white"},title:b.default.t('IDENTIFICATION')}};var K=(0,T.connect)(function(t){return{loading:t.createIdentificationReducer.loading,result:t.createIdentificationReducer.result,error:t.createIdentificationReducer.error,loadingNumberDetail:t.getNumberInformationReducer.loading,resultNumberDetail:t.getNumberInformationReducer.result,errorNumberDetail:t.getNumberInformationReducer.error}},function(t){return(0,O.bindActionCreators)({updateIndentificationAction:Y.updateIndentificationAction,createIndentificationResetAction:Y.createIndentificationResetAction,getUserIdentificationAction:Y.getUserIdentificationAction,getNumberDetailAction:Y.getNumberDetailAction,getNumberResetAction:Y.getNumberResetAction},t)})(V);e.default=K;var W=N.StyleSheet.create({container:{flex:1,backgroundColor:_.Color.primaryDarkColor},textbtnvalide:{color:'white',fontWeight:'bold'},bigtitle:{color:'white',fontSize:20,flex:1,fontWeight:'bold',textAlign:'center',margin:20},subbigtitle:{color:'white',fontSize:17,textAlign:'center',margin:5},btnvalide:{marginTop:20,marginLeft:20,marginRight:20,borderColor:'transparent',backgroundColor:_.Color.accentLightColor,height:52},btnSubmit:{marginTop:20,borderColor:'transparent',backgroundColor:_.Color.accentLightColor,height:52,width:"30%",marginLeft:20,marginRight:20},input:{height:60,marginTop:(0,S.responsiveHeight)(2),marginLeft:(0,S.responsiveWidth)(5),marginRight:(0,S.responsiveWidth)(5),borderRadius:5}})},1816,[4,1,6,273,8,9,10,12,13,1775,717,689,1615,15,18,751,812,720,776,973,535,1518,704,539,1039,1056,1026,1099,1648,1782,719,772,814,815,1031]); __d(function(g,r,i,a,m,e,d){var t=r(d[0]),o=r(d[1]);Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var n=o(r(d[2])),l=o(r(d[3])),s=o(r(d[4])),u=o(r(d[5])),c=o(r(d[6])),p=o(r(d[7])),f=o(r(d[8])),S=o(r(d[9])),C=t(r(d[10])),h=r(d[11]),_=t(r(d[12])),b=o(r(d[13])),E=r(d[14]),O=r(d[15]),v=r(d[16]),G=o(r(d[17])),R=r(d[18]),k=r(d[19]),y=r(d[20]),I=r(d[21]),T=r(d[22]),A=r(d[23]),w=r(d[24]),F=r(d[25]),N=r(d[26]),D=(r(d[27]),r(d[28]),(function(t){function o(t){var l;return(0,n.default)(this,o),(l=(0,s.default)(this,(0,u.default)(o).call(this,t))).isMontantValid=function(){var t=l.state.limitCredit;return parseInt((0,f.default)(t,0))||t<0?{errorMessage:b.default.t('ENTER_AMOUNT_SUPERIOR_ZEROR'),isValid:!1}:(0,N.isNormalInteger)(t)?{errorMessage:'',isValid:!0}:{errorMessage:b.default.t('ENTER_VALID_AMOUNT'),isValid:!1}},l.renderCreateGroupReponse=function(){var t=l.props,o=t.result,n=t.error;null!==n&&void 0!==n.data&&h.Alert.alert(b.default.t("ERROR_CREATION_GROUP"),n.data.error,[{text:b.default.t("OK"),onPress:function(){l.props.createGroupReset()}}],{cancelable:!1}),null!==o&&null!==o.response&&h.Alert.alert(b.default.t("SUCCESS_CREATION_GROUP"),o.response,[{text:b.default.t("OK"),onPress:function(){l.props.createGroupReset(),A.IlinkEmitter.emit("treatNanoGroupDemand"),l.props.navigation.pop()}}],{cancelable:!1})},l.onSubmitSendWalletToCard=function(){var t=l.state,o=t.codeSponsor1,n=t.codeSponsor2,s=t.nomGroupe,u=t.codeSponsor3,c=t.limitCredit,p=t.password;l.ckeckIfFieldIsOK(s)?l.nomGroupeAnim.shake(800):l.ckeckIfFieldIsOK(c)||!l.isMontantValid().isValid?l.limitCreditAnim.shake(800):l.ckeckIfFieldIsOK(o)?l.codeSponsor1Anim.shake(800):l.ckeckIfFieldIsOK(n)?l.codeSponsor2Anim.shake(800):l.ckeckIfFieldIsOK(u)?l.codeSponsor3Anim.shake(800):l.ckeckIfFieldIsOK(p)?l.passwordAnim.shake(800):l.state.isGroupToModify?l.props.createGroupAction({id_user:l.state.user.id,nom:l.state.nomGroupe,code_group:l.state.codeGroup,code_sponsor1:l.state.codeSponsor1,code_sponsor2:l.state.codeSponsor2,code_sponsor3:l.state.codeSponsor3,password:l.state.password,limite_credit:l.state.limitCredit,code_groupe:l.state.codeGroup},1):l.props.createGroupAction({id_user:l.state.user.id,nom:l.state.nomGroupe,code_sponsor1:l.state.codeSponsor1,code_sponsor2:l.state.codeSponsor2,code_sponsor3:l.state.codeSponsor3,password:l.state.password,limite_credit:l.state.limitCredit},0),l.setState({isDataSubmit:!0})},l.renderLoader=function(){return C.default.createElement(O.ProgressDialog,{visible:l.props.loading||l.props.loadingGetCommission,title:b.default.t('LOADING'),message:b.default.t('LOADING_INFO')})},l.state={montant:null,password:null,nomGroupe:null,limitCredit:null,codeSponsor1:null,codeSponsor2:null,codeSponsor3:null,codeGroup:null,loading:!1,user:null,triggerSubmitClick:!1,isSubmitClick:!1,isDataSubmit:!1,isModalConfirmVisible:!1,isGroupToModify:!1,wallet:T.store.getState().walletDetailReducer.result.response},l}return(0,c.default)(o,t),(0,l.default)(o,[{key:"componentDidMount",value:function(){var t=this;(0,w.readUser)().then(function(o){if(o&&void 0!==o){var n=t.props.navigation.getParam('group',null);(0,S.default)(n)||t.setState({limitCredit:n.limite_credit,nomGroupe:n.nom,codeSponsor1:n.codeSponsor1,codeSponsor2:n.codeSponsor2,codeSponsor3:n.codeSponsor3,codeGroup:n.code_groupe,isGroupToModify:!0}),t.setState({user:o})}})}},{key:"ckeckIfFieldIsOK",value:function(t){return(0,S.default)(t)||(0,f.default)(t.length,0)}},{key:"updateLangue",value:function(){this.props.navigation.setParams({name:b.default.t('DEPOSIT_TO_CARD')}),this.forceUpdate()}},{key:"ckeckIfFieldIsOK",value:function(t){return(0,S.default)(t)||(0,f.default)(t.length,0)}},{key:"render",value:function(){var t=this;return C.default.createElement(C.default.Fragment,null,(this.props.loading||this.props.loadingGetCommission)&&this.renderLoader(),this.state.isDataSubmit&&this.renderCreateGroupReponse(),C.default.createElement(h.ScrollView,{style:L.container},C.default.createElement(h.Text,{style:L.subbigtitle},b.default.t('GROUP_INFOS')),C.default.createElement(_.View,{ref:function(o){t.nomGroupeAnim=o}},C.default.createElement(v.Fumi,{iconClass:G.default,iconName:'id-card',label:b.default.t('NOM_GROUP'),iconColor:'#f95a25',iconSize:20,value:this.state.nomGroupe,onChangeText:function(o){t.setState({nomGroupe:o})},style:L.input})),C.default.createElement(_.View,{ref:function(o){t.limitCreditAnim=o}},C.default.createElement(v.Fumi,{iconClass:G.default,iconName:'money',label:b.default.t('LIMIT_OF_CREDIT'),iconColor:'#f95a25',keyboardType:"numeric",iconSize:20,value:this.state.limitCredit,onChangeText:function(o){t.setState({limitCredit:o})},style:L.input}),C.default.createElement(h.View,{style:{position:'absolute',left:(0,E.responsiveWidth)(82),top:35,flexDirection:'row'}},C.default.createElement(h.View,{style:{width:1,borderLeftColor:'#f0f0f0',height:40,left:-8,top:-10,borderLeftWidth:1}}),C.default.createElement(h.Text,{style:[I.Typography.body1,I.FontWeight.bold]},this.state.wallet.currency_code))),C.default.createElement(_.View,{ref:function(o){t.codeSponsor1Anim=o}},C.default.createElement(v.Fumi,{iconClass:G.default,iconName:'user-circle-o',label:b.default.t('CODE_USER_ILINK_SPONSOR_1'),iconColor:'#f95a25',iconSize:20,value:this.state.codeSponsor1,onChangeText:function(o){t.setState({codeSponsor1:o})},style:L.input})),C.default.createElement(_.View,{ref:function(o){t.codeSponsor2Anim=o}},C.default.createElement(v.Fumi,{iconClass:G.default,iconName:'user-circle-o',label:b.default.t('CODE_USER_ILINK_SPONSOR_2'),iconColor:'#f95a25',iconSize:20,value:this.state.codeSponsor2,onChangeText:function(o){t.setState({codeSponsor2:o})},style:L.input})),C.default.createElement(_.View,{ref:function(o){t.codeSponsor3Anim=o}},C.default.createElement(v.Fumi,{iconClass:G.default,iconName:'user-circle-o',label:b.default.t('CODE_USER_ILINK_SPONSOR_3'),iconColor:'#f95a25',iconSize:20,value:this.state.codeSponsor3,onChangeText:function(o){t.setState({codeSponsor3:o})},style:L.input})),C.default.createElement(_.View,{ref:function(o){t.passwordAnim=o}},C.default.createElement(v.Fumi,{iconClass:G.default,iconName:'lock',label:b.default.t('PASSWORD'),iconColor:'#f95a25',iconSize:20,secureTextEntry:!0,value:this.state.password,onChangeText:function(o){t.setState({password:o})},style:L.input})),C.default.createElement(p.default,{style:L.btnvalide,textStyle:L.textbtnvalide,onPress:function(){t.onSubmitSendWalletToCard()}},this.state.isGroupToModify?b.default.t('MODIFY'):b.default.t('SUBMIT_LABEL'))))}}]),o})(C.Component));D.navigatorStyle={navBarBackgroundColor:y.Color.primaryColor,statusBarColor:y.Color.primaryDarkColor,navBarTextColor:'#FFFFFF',navBarButtonColor:'#FFFFFF'},D.navigationOptions=function(){return{drawerLabel:function(){return null},headerTitle:b.default.t('MANAGE_GROUP'),headerTintColor:'white',headerStyle:{backgroundColor:y.Color.primaryColor,marginTop:0,color:'white'},headerTitleStyle:{color:"white"},title:b.default.t('CREATE_GROUP')}};var x=(0,R.connect)(function(t){return{loading:t.createGroupReducer.loading,result:t.createGroupReducer.result,error:t.createGroupReducer.error}},function(t){return(0,k.bindActionCreators)({createGroupAction:F.createGroupAction,createGroupReset:F.createGroupReset},t)})(D);e.default=x;var L=h.StyleSheet.create({container:{flex:1,backgroundColor:y.Color.primaryDarkColor},textbtnvalide:{color:'white',fontWeight:'bold'},bigtitle:{color:'white',fontSize:20,flex:1,fontWeight:'bold',textAlign:'center',margin:20},blockView:{paddingVertical:10,borderBottomWidth:1},subbigtitle:{color:'white',fontSize:17,textAlign:'center',margin:5},btnvalide:{marginTop:20,marginLeft:20,marginRight:20,borderColor:'transparent',backgroundColor:y.Color.accentLightColor,height:52},btnSubmit:{marginTop:20,borderColor:'transparent',backgroundColor:y.Color.accentLightColor,height:52,width:"30%",marginLeft:20,marginRight:20},input:{height:60,marginTop:(0,E.responsiveHeight)(2),marginLeft:(0,E.responsiveWidth)(5),marginRight:(0,E.responsiveWidth)(5),borderRadius:5}})},1817,[4,1,8,9,10,12,13,717,689,1615,15,18,751,720,535,1518,704,539,1039,1056,1026,1015,1099,774,719,1818,1648,814,815]); -__d(function(g,r,i,a,m,e,d){var t=r(d[0]);Object.defineProperty(e,"__esModule",{value:!0}),e.getNanoCreditUserHistoryInProgressReset=e.getNanoCreditUserHistoryInProgressAction=e.getEpargneInProgressReset=e.getEpargneInProgressAction=e.getNanoCreditDemandDurationReset=e.getNanoCreditDemandDurationAction=e.askNanoCreditReset=e.askNanoCreditAction=e.joinGroupReset=e.joinGroupAction=e.treatDemandGroupReset=e.cancelDemandGroupAction=e.treatDemandGroupAction=e.createGroupReset=e.createGroupAction=void 0;var n=t(r(d[1])),o=t(r(d[2])),s=r(d[3]),u=r(d[4]),c=r(d[5]);e.createGroupAction=function(t,f){var h=u.store.getState().authKeyReducer,l=null!==h?h.authKey.token_type+" "+h.authKey.access_token:'';return function(u){u((0,s.fetchCreateGroupPending)()),(0,n.default)({url:""+c.groupUrl,method:0===f?'POST':1===f?'PUT':'DELETE',data:t,headers:{Authorization:l,'X-Localization':o.default.currentLocale()}}).then(function(t){console.log(t),u((0,s.fetchCreateGroupSuccess)(t))}).catch(function(t){t.response?u((0,s.fetchCreateGroupError)(t.response)):t.request?u((0,s.fetchCreateGroupError)(t.request)):u((0,s.fetchCreateGroupError)(t.message))})}};e.createGroupReset=function(){return function(t){t((0,s.fetchCreateGroupReset)())}};e.treatDemandGroupAction=function(t){var f=u.store.getState().authKeyReducer,h=null!==f?f.authKey.token_type+" "+f.authKey.access_token:'';return function(u){u((0,s.fetchTreatDemandsGroupPending)()),(0,n.default)({url:""+c.treatDemandUrl,method:'POST',data:t,headers:{Authorization:h,'X-Localization':o.default.currentLocale()}}).then(function(t){console.log(t),u((0,s.fetchTreatDemandsGroupSuccess)(t))}).catch(function(t){t.response?u((0,s.fetchTreatDemandsGroupError)(t.response)):t.request?u((0,s.fetchTreatDemandsGroupError)(t.request)):u((0,s.fetchTreatDemandsGroupError)(t.message))})}};e.cancelDemandGroupAction=function(t){var f=u.store.getState().authKeyReducer,h=null!==f?f.authKey.token_type+" "+f.authKey.access_token:'';return function(u){u((0,s.fetchTreatDemandsGroupPending)()),(0,n.default)({url:""+c.cancelDemandUrl,method:'POST',data:t,headers:{Authorization:h,'X-Localization':o.default.currentLocale()}}).then(function(t){console.log(t),u((0,s.fetchTreatDemandsGroupSuccess)(t))}).catch(function(t){t.response?u((0,s.fetchTreatDemandsGroupError)(t.response)):t.request?u((0,s.fetchTreatDemandsGroupError)(t.request)):u((0,s.fetchTreatDemandsGroupError)(t.message))})}};e.treatDemandGroupReset=function(){return function(t){t((0,s.fetchTreatDemandsGroupReset)())}};e.joinGroupAction=function(t){var f=u.store.getState().authKeyReducer,h=null!==f?f.authKey.token_type+" "+f.authKey.access_token:'';return function(u){u((0,s.fetchJoinGroupPending)()),(0,n.default)({url:""+c.joinGroupUrl,method:'POST',data:t,headers:{Authorization:h,'X-Localization':o.default.currentLocale()}}).then(function(t){console.log(t),u((0,s.fetchJoinGroupSuccess)(t))}).catch(function(t){t.response?u((0,s.fetchJoinGroupError)(t.response)):t.request?u((0,s.fetchJoinGroupError)(t.request)):u((0,s.fetchJoinGroupError)(t.message))})}};e.joinGroupReset=function(){return function(t){t((0,s.fetchJoinGroupReset)())}};e.askNanoCreditAction=function(t){var f=u.store.getState().authKeyReducer,h=null!==f?f.authKey.token_type+" "+f.authKey.access_token:'';return function(u){u((0,s.fetchAskNanoCreditPending)()),(0,n.default)({url:""+c.askNanoCreditUrl,method:'POST',data:t,headers:{Authorization:h,'X-Localization':o.default.currentLocale()}}).then(function(t){console.log(t),u((0,s.fetchAskNanoCreditSuccess)(t))}).catch(function(t){t.response?u((0,s.fetchAskNanoCreditError)(t.response)):t.request?u((0,s.fetchAskNanoCreditError)(t.request)):u((0,s.fetchAskNanoCreditError)(t.message))})}};e.askNanoCreditReset=function(){return function(t){t((0,s.fetchAskNanoCreditReset)())}};e.getNanoCreditDemandDurationAction=function(t){var f=u.store.getState().authKeyReducer,h=null!==f?f.authKey.token_type+" "+f.authKey.access_token:'';return function(u){u((0,s.fetchGetNanoCreditDemandDurationPending)()),(0,n.default)({url:""+c.getNanoCreditDemandDureationUrl,method:'POST',data:t,headers:{Authorization:h,'X-Localization':o.default.currentLocale()}}).then(function(t){console.log(t),u((0,s.fetchGetNanoCreditDemandDurationSuccess)(t))}).catch(function(t){t.response?u((0,s.fetchGetNanoCreditDemandDurationError)(t.response)):t.request?u((0,s.fetchGetNanoCreditDemandDurationError)(t.request)):u((0,s.fetchGetNanoCreditDemandDurationError)(t.message))})}};e.getNanoCreditDemandDurationReset=function(){return function(t){t((0,s.fetchGetNanoCreditDemandDurationReset)())}};e.getEpargneInProgressAction=function(t){var f=u.store.getState().authKeyReducer,h=null!==f?f.authKey.token_type+" "+f.authKey.access_token:'';return function(u){u((0,s.fetchGetEpargneInProgressPending)()),(0,n.default)({url:""+c.getHistoryNanoPendingCreditUrl,method:'POST',data:t,headers:{Authorization:h,'X-Localization':o.default.currentLocale()}}).then(function(t){console.log(t),u((0,s.fetchGetEpargneInProgressSuccess)(t))}).catch(function(t){t.response?u((0,s.fetchGetEpargneInProgressError)(t.response)):t.request?u((0,s.fetchGetEpargneInProgressError)(t.request)):u((0,s.fetchGetEpargneInProgressError)(t.message))})}};e.getEpargneInProgressReset=function(){return function(t){t((0,s.fetchGetEpargneInProgressReset)())}};e.getNanoCreditUserHistoryInProgressAction=function(t){var f=u.store.getState().authKeyReducer,h=null!==f?f.authKey.token_type+" "+f.authKey.access_token:'';return function(u){u((0,s.fetchGetNanoCreditUserHistoryInProgressPending)()),(0,n.default)({url:c.getHistoryNanoPendingCreditUrl+"/"+t,method:'GET',headers:{Authorization:h,'X-Localization':o.default.currentLocale()}}).then(function(t){console.log(t),u((0,s.fetchGetNanoCreditUserHistoryInProgressSuccess)(t))}).catch(function(t){t.response?u((0,s.fetchGetNanoCreditUserHistoryInProgressError)(t.response)):t.request?u((0,s.fetchGetNanoCreditUserHistoryInProgressError)(t.request)):u((0,s.fetchGetNanoCreditUserHistoryInProgressError)(t.message))})}};e.getNanoCreditUserHistoryInProgressReset=function(){return function(t){t((0,s.fetchGetNanoCreditUserHistoryInProgressReset)())}}},1818,[1,1073,720,1174,1099,744]); +__d(function(g,r,i,a,m,e,d){var t=r(d[0]);Object.defineProperty(e,"__esModule",{value:!0}),e.getNanoCreditUserHistoryInProgressReset=e.getNanoCreditUserHistoryInProgressAction=e.getEpargneInProgressReset=e.getEpargneInProgressAction=e.getNanoCreditDemandDurationReset=e.getNanoCreditDemandDurationAction=e.askNanoCreditReset=e.askNanoCreditAction=e.joinGroupReset=e.joinGroupAction=e.treatDemandGroupReset=e.cancelDemandGroupAction=e.treatDemandGroupAction=e.createGroupReset=e.createGroupAction=void 0;var n=t(r(d[1])),o=t(r(d[2])),s=r(d[3]),u=r(d[4]),c=r(d[5]);e.createGroupAction=function(t,f){var h=u.store.getState().authKeyReducer,l=null!==h?h.authKey.token_type+" "+h.authKey.access_token:'';return function(u){u((0,s.fetchCreateGroupPending)()),(0,n.default)({url:""+c.groupUrl,method:0===f?'POST':1===f?'PUT':'DELETE',data:t,headers:{Authorization:l,'X-Localization':o.default.currentLocale()}}).then(function(t){console.log(t),u((0,s.fetchCreateGroupSuccess)(t))}).catch(function(t){t.response?u((0,s.fetchCreateGroupError)(t.response)):t.request?u((0,s.fetchCreateGroupError)(t.request)):u((0,s.fetchCreateGroupError)(t.message))})}};e.createGroupReset=function(){return function(t){t((0,s.fetchCreateGroupReset)())}};e.treatDemandGroupAction=function(t){var f=u.store.getState().authKeyReducer,h=null!==f?f.authKey.token_type+" "+f.authKey.access_token:'';return function(u){u((0,s.fetchTreatDemandsGroupPending)()),(0,n.default)({url:""+c.treatDemandUrl,method:'POST',data:t,headers:{Authorization:h,'X-Localization':o.default.currentLocale()}}).then(function(t){console.log(t),u((0,s.fetchTreatDemandsGroupSuccess)(t))}).catch(function(t){t.response?u((0,s.fetchTreatDemandsGroupError)(t.response)):t.request?u((0,s.fetchTreatDemandsGroupError)(t.request)):u((0,s.fetchTreatDemandsGroupError)(t.message))})}};e.cancelDemandGroupAction=function(t){var f=u.store.getState().authKeyReducer,h=null!==f?f.authKey.token_type+" "+f.authKey.access_token:'';return function(u){u((0,s.fetchTreatDemandsGroupPending)()),(0,n.default)({url:""+c.cancelDemandUrl,method:'POST',data:t,headers:{Authorization:h,'X-Localization':o.default.currentLocale()}}).then(function(t){console.log(t),u((0,s.fetchTreatDemandsGroupSuccess)(t))}).catch(function(t){t.response?u((0,s.fetchTreatDemandsGroupError)(t.response)):t.request?u((0,s.fetchTreatDemandsGroupError)(t.request)):u((0,s.fetchTreatDemandsGroupError)(t.message))})}};e.treatDemandGroupReset=function(){return function(t){t((0,s.fetchTreatDemandsGroupReset)())}};e.joinGroupAction=function(t){var f=u.store.getState().authKeyReducer,h=null!==f?f.authKey.token_type+" "+f.authKey.access_token:'';return function(u){u((0,s.fetchJoinGroupPending)()),(0,n.default)({url:""+c.joinGroupUrl,method:'POST',data:t,headers:{Authorization:h,'X-Localization':o.default.currentLocale()}}).then(function(t){console.log(t),u((0,s.fetchJoinGroupSuccess)(t))}).catch(function(t){t.response?u((0,s.fetchJoinGroupError)(t.response)):t.request?u((0,s.fetchJoinGroupError)(t.request)):u((0,s.fetchJoinGroupError)(t.message))})}};e.joinGroupReset=function(){return function(t){t((0,s.fetchJoinGroupReset)())}};e.askNanoCreditAction=function(t){var f=u.store.getState().authKeyReducer,h=null!==f?f.authKey.token_type+" "+f.authKey.access_token:'';return function(u){u((0,s.fetchAskNanoCreditPending)()),(0,n.default)({url:""+c.askNanoCreditUrl,method:'POST',data:t,headers:{Authorization:h,'X-Localization':o.default.currentLocale()}}).then(function(t){console.log(t),u((0,s.fetchAskNanoCreditSuccess)(t))}).catch(function(t){t.response?u((0,s.fetchAskNanoCreditError)(t.response)):t.request?u((0,s.fetchAskNanoCreditError)(t.request)):u((0,s.fetchAskNanoCreditError)(t.message))})}};e.askNanoCreditReset=function(){return function(t){t((0,s.fetchAskNanoCreditReset)())}};e.getNanoCreditDemandDurationAction=function(t){var f=u.store.getState().authKeyReducer,h=null!==f?f.authKey.token_type+" "+f.authKey.access_token:'';return function(u){u((0,s.fetchGetNanoCreditDemandDurationPending)()),(0,n.default)({url:""+c.getNanoCreditDemandDureationUrl,method:'POST',data:t,headers:{Authorization:h,'X-Localization':o.default.currentLocale()}}).then(function(t){console.log(t),u((0,s.fetchGetNanoCreditDemandDurationSuccess)(t))}).catch(function(t){t.response?u((0,s.fetchGetNanoCreditDemandDurationError)(t.response)):t.request?u((0,s.fetchGetNanoCreditDemandDurationError)(t.request)):u((0,s.fetchGetNanoCreditDemandDurationError)(t.message))})}};e.getNanoCreditDemandDurationReset=function(){return function(t){t((0,s.fetchGetNanoCreditDemandDurationReset)())}};e.getEpargneInProgressAction=function(t){var f=u.store.getState().authKeyReducer,h=null!==f?f.authKey.token_type+" "+f.authKey.access_token:'';return function(u){u((0,s.fetchGetEpargneInProgressPending)()),(0,n.default)({url:c.getHistoryEpargnePendingUrl+"/"+t,method:'GET',headers:{Authorization:h,'X-Localization':o.default.currentLocale()}}).then(function(t){console.log(t),u((0,s.fetchGetEpargneInProgressSuccess)(t))}).catch(function(t){t.response?u((0,s.fetchGetEpargneInProgressError)(t.response)):t.request?u((0,s.fetchGetEpargneInProgressError)(t.request)):u((0,s.fetchGetEpargneInProgressError)(t.message))})}};e.getEpargneInProgressReset=function(){return function(t){t((0,s.fetchGetEpargneInProgressReset)())}};e.getNanoCreditUserHistoryInProgressAction=function(t){var f=u.store.getState().authKeyReducer,h=null!==f?f.authKey.token_type+" "+f.authKey.access_token:'';return function(u){u((0,s.fetchGetNanoCreditUserHistoryInProgressPending)()),(0,n.default)({url:c.getHistoryNanoPendingCreditUrl+"/"+t,method:'GET',headers:{Authorization:h,'X-Localization':o.default.currentLocale()}}).then(function(t){console.log(t),u((0,s.fetchGetNanoCreditUserHistoryInProgressSuccess)(t))}).catch(function(t){t.response?u((0,s.fetchGetNanoCreditUserHistoryInProgressError)(t.response)):t.request?u((0,s.fetchGetNanoCreditUserHistoryInProgressError)(t.request)):u((0,s.fetchGetNanoCreditUserHistoryInProgressError)(t.message))})}};e.getNanoCreditUserHistoryInProgressReset=function(){return function(t){t((0,s.fetchGetNanoCreditUserHistoryInProgressReset)())}}},1818,[1,1073,720,1174,1099,744]); __d(function(g,r,i,a,m,e,d){var t=r(d[0]),n=r(d[1]);Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var o=n(r(d[2])),l=n(r(d[3])),u=n(r(d[4])),s=n(r(d[5])),c=n(r(d[6])),f=n(r(d[7])),p=t(r(d[8])),h=r(d[9]),y=n(r(d[10])),E=n(r(d[11])),v=r(d[12]),C=(r(d[13]),r(d[14]),r(d[15]),n(r(d[16])),n(r(d[17])),n(r(d[18])),r(d[19]));n(r(d[20]));r(d[21]),r(d[22]),r(d[23]),r(d[24]),r(d[25]),r(d[26]),r(d[27]),r(d[28]),r(d[29]);var D=n(r(d[30])),b=r(d[31]),A=(r(d[32]),n(r(d[33]))),I=(r(d[34]),r(d[35]),r(d[36]),n(r(d[37])),r(d[38])),T=n(r(d[39])),x=r(d[40]),S=r(d[41]),w=r(d[42]),G=r(d[43]),k=r(d[44]),N=r(d[45]),L=r(d[46]),_=(r(d[47]),r(d[14])),V=r(d[31]);r(d[48]);var O=(function(t){function n(t){var l;return(0,o.default)(this,n),(l=(0,u.default)(this,(0,s.default)(n).call(this,t,!0)))._openMenu=function(){return l.setState({visibleMenu:!0})},l._closeMenu=function(){return l.setState({visibleMenu:!1})},l.getDemandTypeIcon=function(t){switch(t){case'creation':return'account-multiple-plus';case'suppression':return'account-multiple-minus';case'adhesion':return'account-multiple-check';case'nano_credit':return'cash';default:return'account-multiple'}},l.getDemandTypeColor=function(t){switch(t){case'creation':return'green';case'suppression':return'red';case'adhesion':case'nano_credit':default:return L.Color.primaryColor}},l.renderDemandItem=function(t){var n=D.default.tz(t.date_creation_demande,'Etc/GMT+0').format();return n=(0,D.default)(n).fromNow(),p.default.createElement(h.TouchableOpacity,{onPress:function(){l.props.navigation.push(_.demandGroupNanoCreditDetail,{id:t.id})},style:[R.paymentItem]},p.default.createElement(h.View,{style:{flexDirection:'row',alignItems:'center'}},p.default.createElement(h.View,{style:R.iconContent},p.default.createElement(E.default,{name:l.getDemandTypeIcon(t.type),color:l.getDemandTypeColor(t.type),size:35}))),p.default.createElement(h.View,{style:R.content},p.default.createElement(h.Text,{style:R.title},t.nom),p.default.createElement(h.Text,{style:R.description},A.default.t('CREATOR')+": "+t.createur),p.default.createElement(h.View,{style:R.timeContent},p.default.createElement(h.View,{style:{alignContent:'flex-start',flex:1,flexDirection:'row'}},p.default.createElement(h.Text,{style:{fontWeight:'bold',marginLeft:20,marginBottom:10,color:3===t.nombre_validation?'green':'red'}},3===t.nombre_validation?A.default.t('VALIDATE'):A.default.t('NO_VALIDATE')," ("+t.nombre_validation+" "+(t.nombre_validation>1?A.default.t('VALIDATIONS'):A.default.t('VALIDATION'))+")")),p.default.createElement(h.View,{style:{alignContent:'flex-end',flex:1,flexDirection:'row'}},p.default.createElement(E.default,{name:"map-marker",style:(R.descriptionIcon,{color:L.Color.accentColor,marginTop:5})}),p.default.createElement(h.Text,{style:R.time},t.country),p.default.createElement(E.default,{name:"clock",style:(R.descriptionIcon,{color:L.Color.accentColor,marginTop:5})}),p.default.createElement(h.Text,{style:R.time}," ",n)))))},l.rendeGetDemandsGroupResponse=function(){var t=l.props,n=t.resultGetDemandsGroup,o=t.errorGetDemandsGroup;return null!==o?void 0!==o.data?p.default.createElement(h.View,{style:{flex:1,justifyContent:'center',alignItems:'center'}},p.default.createElement(h.Text,{style:k.Typography.body1},o.data.error)):p.default.createElement(h.View,{style:{flex:1,justifyContent:'center',alignItems:'center'}},p.default.createElement(h.Text,{style:k.Typography.body1},o)):null!==n&&null!==n.response?Array.isArray(n.response)&&n.response.length>0?p.default.createElement(N.ScrollView,{style:{flex:1}},n.response.map(function(t){return l.renderDemandItem(t)})):p.default.createElement(h.View,{style:{flex:1,justifyContent:'center',alignItems:'center'}},p.default.createElement(h.Text,{style:k.Typography.body1},A.default.t('NO_DEMAND_CREATION_GROUP'))):void 0},l.renderLoader=function(){return p.default.createElement(h.View,{style:{flex:1,justifyContent:'center',alignItems:'center'}},'android'===h.Platform.OS?p.default.createElement(p.default.Fragment,null,p.default.createElement(h.ProgressBarAndroid,null),p.default.createElement(h.Text,null,A.default.t('LOADING_DOTS'))):p.default.createElement(p.default.Fragment,null,p.default.createElement(ActivityIndicator,{size:"large",color:'#ccc'}),p.default.createElement(h.Text,null,A.default.t('LOADING_DOTS'))))},l.state={user:{},conserve:[],count:0,translateAnim:new h.Animated.Value(0),visibleMenu:!1,appState:h.AppState.currentState,filter:!1,sortIcons:null,panelVisible:!1,filder_disable:!0,datestartformated:'La date de debut',dateendformated:'La date de fin',datestart:null,dateend:null,isLoaded:!1,isSectionned:!1,isDateTimePickerVisible:!1,isDateEndTimePickerVisible:!1,isDataSubmit:!1,position:0},(0,C.readUser)().then(function(t){l.setState({user:t}),l.props.getNanoCreditDemandsAction(t.id)}),G.IlinkEmitter.on("langueChange",l.updateLangue.bind((0,c.default)(l))),l.props.getNanoCreditDemandsReset(),l.navigation=l.props.navigation,l.currentLocale=T.default.getDeviceLocale().includes("fr")?"fr":"en-gb",l}return(0,f.default)(n,t),(0,l.default)(n,[{key:"updateLangue",value:function(){this.props.navigation.setParams({name:A.default.t('WALLET')}),this.forceUpdate()}},{key:"componentDidMount",value:function(){var t=this.navigation.state.routeName;this.setState({position:"demandeValidationGroupe"===t?0:"myNanoCreditGroup"===t?1:2}),this.animateSlidingUp(!1)}},{key:"componentWillUnmount",value:function(){clearInterval(this.intervaller)}},{key:"animateSlidingUp",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],n=(0,v.responsiveHeight)(100),o=t?n:0,l=t?0:n;this.setState({isSliding:t}),this.state.translateAnim.setValue(o),h.Animated.timing(this.state.translateAnim,{toValue:l,duration:500,useNativeDriver:!0}).start()}},{key:"printOptions",value:function(){var t=this;return p.default.createElement(y.default,{buttonColor:b.accent},p.default.createElement(y.default.Item,{buttonColor:b.primary,title:A.default.t('CREATE_GROUP'),onPress:function(){t.props.navigation.push(_.createGroupNanoCredit)}},p.default.createElement(E.default,{name:"account-multiple-plus",style:R.actionButtonIcon})),p.default.createElement(y.default.Item,{buttonColor:b.purpleLight,title:A.default.t('JOIN_GROUP'),onPress:function(){t.props.navigation.push(_.adhererGroupNanoCredit)}},p.default.createElement(E.default,{name:"account-multiple",style:R.actionButtonIcon})))}},{key:"refreshData",value:function(){this.props.getNanoCreditDemandsAction(this.state.user.id)}},{key:"render",value:function(){var t=this;return console.warn("POSITION",this.state.position),p.default.createElement(I.Provider,null,p.default.createElement(h.View,{style:{flex:1}},p.default.createElement(h.StatusBar,{backgroundColor:V.primaryDark,barStyle:"light-content",translucent:!1}),p.default.createElement(I.Appbar.Header,{dark:!0,style:{backgroundColor:V.primary}},p.default.createElement(I.Appbar.BackAction,{onPress:function(){t.props.navigation.pop()}}),p.default.createElement(I.Appbar.Content,{title:A.default.t('MANAGE_GROUP'),subtitle:0===this.state.position?A.default.t('VALIDATION_DEMAND'):A.default.t('DELETE_DEMAND')}),p.default.createElement(I.Appbar.Action,{icon:"refresh",onPress:function(){t.refreshData()}})),0===this.state.position?this.props.loadingGetDemandsGroup?this.renderLoader():this.rendeGetDemandsGroupResponse():null,0===this.state.position&&this.printOptions()))}}]),n})(p.default.Component);O.navigatorStyle={navBarBackgroundColor:b.primary,statusBarColor:b.primaryDark,navBarTextColor:'#FFFFFF',navBarButtonColor:'#FFFFFF',contextualMenuStatusBarColor:V.accent,contextualMenuBackgroundColor:V.accentLight,contextualMenuButtonsColor:'#ffffff'};var B=(0,S.connect)(function(t){return{loadingGetDemandsGroup:t.getDemandsGroupReducer.loading,resultGetDemandsGroup:t.getDemandsGroupReducer.result,errorGetDemandsGroup:t.getDemandsGroupReducer.error}},function(t){return(0,x.bindActionCreators)({getNanoCreditDemandsAction:w.getNanoCreditDemandsAction,getNanoCreditDemandsReset:w.getNanoCreditDemandsReset},t)})(O);e.default=B;var R=h.StyleSheet.create({slidingup:{position:"absolute",height:(0,v.responsiveHeight)(84),bottom:0,backgroundColor:'white',width:(0,v.responsiveWidth)(100),zIndex:1e3},root:{flex:1},container:{flex:1,backgroundColor:'white',justifyContent:'center',alignItems:'center'},emptylist:{flex:1,justifyContent:'center',alignItems:'center'},backgroundd_drawer:{backgroundColor:'#000'},listbackground:{},actionButtonIcon:{fontSize:20,height:22,color:'white'},descriptionIcon:{fontSize:10,height:12,top:10},welcome:{fontSize:20,textAlign:'center',margin:10},instructions:{textAlign:'center',color:'#333333',marginBottom:5},dateText:{marginTop:20,marginLeft:(0,v.responsiveWidth)(13),marginBottom:20,fontSize:17},titlecontent:{fontSize:17,marginLeft:(0,v.responsiveWidth)(10),color:'black'},title:{fontSize:20,marginLeft:20,marginTop:20,color:'black',fontWeight:'bold'},content:{flex:1,flexDirection:'column',paddingTop:10},listStyle:{backgroundColor:'white'},bottomSeparator:{width:(0,v.responsiveWidth)(100),height:5,justifyContent:'center',alignSelf:'center',backgroundColor:'#EEE'},title:{color:'#000',paddingLeft:10,fontSize:(0,v.responsiveFontSize)(2.2)},description:{fontSize:(0,v.responsiveFontSize)(1.8),color:'#4f5b62',paddingLeft:10},timeContent:{justifyContent:'space-between',flex:1,marginTop:10,marginBottom:5,flexDirection:'row'},time:{fontWeight:'bold',marginRight:20,marginBottom:10,color:V.accent},paymentItem:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",width:"100%",borderBottomColor:'#EEE',borderBottomWidth:1},iconContent:{width:40,marginRight:5,alignItems:"center"}})},1819,[4,1,8,9,10,12,11,13,15,18,532,876,535,1294,815,1296,1008,823,717,719,1180,1031,1038,1037,1030,1032,1034,1035,1036,1033,1175,814,943,720,776,848,416,1655,1185,936,1056,1039,1786,774,1015,2,1026,1530,816]); __d(function(g,r,i,a,m,e,d){var t=r(d[0]),n=r(d[1]);Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var l=n(r(d[2])),o=n(r(d[3])),s=n(r(d[4])),u=n(r(d[5])),c=n(r(d[6])),f=n(r(d[7])),p=t(r(d[8])),y=r(d[9]),D=n(r(d[10])),E=n(r(d[11])),C=r(d[12]),T=n(r(d[13])),h=(r(d[14]),r(d[15])),R=n(r(d[16])),x=r(d[17]),b=r(d[18]),O=(r(d[19]),r(d[20]),r(d[21])),w=r(d[22]),v=n(r(d[23])),G=r(d[24]),L=(n(r(d[25])),r(d[26]),n(r(d[27]))),S=r(d[28]),A=r(d[29]);r(d[30]);function P(t,n){var l=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);n&&(o=o.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),l.push.apply(l,o)}return l}var _=r(d[31]),j='white',U=r(d[32]),N=(r(d[33]),(function(t){function n(t){var l;return(0,o.default)(this,n),(l=(0,u.default)(this,(0,c.default)(n).call(this,t))).displayToast=function(t){v.default.show(t,{duration:v.default.durations.LONG,position:v.default.positions.BOTTOM,backgroundColor:G.Color.primaryColor,shadow:!0,animation:!0,hideOnPress:!0,delay:0,onShow:function(){},onShown:function(){},onHide:function(){},onHidden:function(){}})},l.onCancelDemand=function(){l.props.treatDemandGroupReset(),l.props.cancelDemandGroupAction({id_demande:l.props.resultGetUniqueDemand.response.id,id_user:l.state.user.id})},l.renderAlertErrorTreatOrCancelDemand=function(){var t=l.props,n=t.errorTreatDemand,o=t.resultTreatDemand;t.resultCancelDemand,t.errorCancelDemand;null!==n&&void 0!==n.data&&y.Alert.alert(R.default.t("ERROR_TREATMENT_DEMAND"),n.data.error,[{text:R.default.t("OK"),onPress:function(){l.props.treatDemandGroupReset()}}],{cancelable:!1}),null!==o&&(console.log("resultTreatDemand",o),200===o.status&&(l.displayToast(o.response),l.props.navigation.goBack(),l.props.treatDemandGroupReset()))},l.renderLabelState=function(t){return 0===t?R.default.t('NO_TREAT'):1===t?R.default.t('TREAT'):R.default.t('REFUSED')},l.renderLoader=function(){return p.default.createElement(y.View,{style:{flex:1,justifyContent:'center',alignItems:'center'}},'android'===y.Platform.OS?p.default.createElement(p.default.Fragment,null,p.default.createElement(y.ProgressBarAndroid,null),p.default.createElement(y.Text,null,R.default.t('LOADING_DOTS'))):p.default.createElement(p.default.Fragment,null,p.default.createElement(ActivityIndicator,{size:"large",color:'#ccc'}),p.default.createElement(y.Text,null,R.default.t('LOADING_DOTS'))))},l.getDemandTypeIcon=function(t){switch(t){case'creation':return'account-multiple-plus';case'suppression':return'account-multiple-minus';case'adhesion':return'account-multiple-check';case'nano_credit':return'cash';default:return'account-multiple'}},l.renderDetail=function(){var t=l.props.resultGetUniqueDemand,n=_.tz(t.response.date_creation_groupe,'Etc/GMT+0').format(),o=_.tz(t.response.date_creation_demande,'Etc/GMT+0').format();return n=_(n),o=_(o),p.default.createElement(y.View,{style:q.container},p.default.createElement(D.default,{style:q.cardcontainer},p.default.createElement(y.Text,{style:{fontSize:17,fontWeight:'bold',color:'black',marginLeft:(0,C.responsiveWidth)(5)}},t.response.nom),p.default.createElement(y.View,{style:{flexDirection:'row',justifyContent:'flex-start'}},p.default.createElement(T.default,{name:l.getDemandTypeIcon(t.response.type),size:28,color:U.accent,style:{marginLeft:20}}),p.default.createElement(y.Text,{style:q.simpleuser},R.default.t('TYPE_DEMAND')+": "+t.response.type)),p.default.createElement(y.View,{style:{flexDirection:'row',justifyContent:'flex-start'}},p.default.createElement(T.default,{name:"account",size:28,color:U.accent,style:{marginLeft:20}}),p.default.createElement(y.Text,{style:q.simpleuser},R.default.t('CREATOR')+": "+t.response.createur)),p.default.createElement(y.View,{style:{flexDirection:'row',justifyContent:'flex-start'}},p.default.createElement(T.default,{name:"map-marker",size:28,color:U.accent,style:{marginLeft:20}}),p.default.createElement(y.Text,{style:q.simpleuser},R.default.t('COUNTRY')+": "+t.response.country))),p.default.createElement(D.default,{style:q.cardcontainer},p.default.createElement(y.View,{style:{flexDirection:'row',justifyContent:'flex-start'}},p.default.createElement(T.default,{name:"account-multiple",size:28,color:U.accent,style:{marginLeft:20}}),p.default.createElement(y.Text,{style:q.simpleuser},"SPONSOR 1: "+t.response.sponsor1)),p.default.createElement(y.View,{style:{flexDirection:'row',justifyContent:'flex-start'}},p.default.createElement(T.default,{name:"account-multiple",size:28,color:U.accent,style:{marginLeft:20}}),p.default.createElement(y.Text,{style:q.simpleuser},"SPONSOR 2: "+t.response.sponsor2)),p.default.createElement(y.View,{style:{flexDirection:'row',justifyContent:'flex-start'}},p.default.createElement(T.default,{name:"account-multiple",size:28,color:U.accent,style:{marginLeft:20}}),p.default.createElement(y.Text,{style:q.simpleuser},"SPONSOR 3: "+t.response.sponsor3))),p.default.createElement(D.default,{style:q.cardcontainer},p.default.createElement(y.View,{style:{flexDirection:'row',justifyContent:'flex-start'}},p.default.createElement(T.default,{name:"code-tags",size:28,color:U.accent,style:{marginLeft:20}}),p.default.createElement(y.Text,{style:q.simpleuser},t.response.code_groupe)),p.default.createElement(y.View,{style:{flexDirection:'row',justifyContent:'flex-start'}},p.default.createElement(T.default,{name:"cash",size:28,color:U.accent,style:{marginLeft:20}}),p.default.createElement(y.Text,{style:q.simpleuser},R.default.t('LIMITE_GROUP')+": "+t.response.limite_credit+" "+t.response.currency_code)),p.default.createElement(y.View,{style:{flexDirection:'row',justifyContent:'flex-start'}},p.default.createElement(T.default,{name:"calendar",size:28,color:U.accent,style:{marginLeft:20}}),p.default.createElement(y.Text,{style:q.simpleuser},R.default.t('CREATION_DATE')+": "+n.format(" Do MMMM YYYY \xe0 HH:mm"))),p.default.createElement(y.View,{style:{flexDirection:'row',alignSelf:'flex-end',marginRight:20,justifyContent:'flex-start'}},p.default.createElement(T.default,{name:"update",size:28,color:U.accent}),p.default.createElement(y.Text,{style:{marginLeft:(0,C.responsiveWidth)(2),fontSize:16,color:U.accent}},o.fromNow()))),l.renderBtn())},l.state={displayAmountModifyDialog:!1,user:null,networks:[],loadingTreat:!1,loadingCancel:!1,triggerTreatmentClick:!1,triggerCancelClick:!1,color:j,montant:null,isBtnModifyAmountEnabled:!1,id:l.props.navigation.getParam("id",null)},l.currentLocale=L.default.getDeviceLocale().includes("fr")?"fr":"en-gb",_.locale(l.currentLocale),l.props.getNanoCreditUniqueDemandsReset(),l.props.getNanoCreditUniqueDemandsAction(l.state.id),l}return(0,f.default)(n,t),(0,s.default)(n,[{key:"componentDidMount",value:function(){var t=this;(0,h.readUser)().then(function(n){n&&void 0!==n&&t.setState({user:n})})}},{key:"onTreatDemand",value:function(){this.props.treatDemandGroupReset(),this.props.treatDemandGroupAction({id_demande:this.props.resultGetUniqueDemand.response.id,id_user:this.state.user.id})}},{key:"renderBtn",value:function(){var t=this,n=this.props.resultGetUniqueDemand;return 1===n.response.statut?p.default.createElement(E.default,{style:{borderColor:'transparent',borderRadius:6,marginLeft:5,marginRight:5,backgroundColor:'gray'},isLoading:this.props.loadingTreatDemand,onPress:function(){},disabled:!0,textStyle:q.textbtnstyle},this.renderLabelState(n.response.statut)):2===n.response.statut?p.default.createElement(E.default,{style:{borderColor:'transparent',borderRadius:6,marginLeft:5,marginRight:5,backgroundColor:'gray'},onPress:function(){},disabled:!0,textStyle:q.textbtnstyle},this.renderLabelState(n.response.statut)):p.default.createElement(y.View,{style:{flexDirection:'row',paddingTop:10}},p.default.createElement(y.View,{style:{flex:1,alignItems:'center'}},p.default.createElement(E.default,{style:{borderColor:'transparent',borderRadius:6,marginLeft:5,marginRight:5,backgroundColor:'green'},isLoading:this.props.loadingTreatDemand,onPress:function(){t.setState({triggerTreatmentClick:!0}),t.onTreatDemand()},textStyle:q.textbtnstyle},R.default.t('ACTION_TREAT_DEMAND'))),p.default.createElement(y.View,{style:{flex:1,alignItems:'center'}},p.default.createElement(E.default,{style:{borderColor:'transparent',borderRadius:6,marginLeft:5,marginRight:5,backgroundColor:G.Color.redColor},isLoading:this.props.loadingCancelDemand,onPress:function(){t.setState({triggerCancelClick:!0}),t.onCancelDemand()},textStyle:q.textbtnstyle},R.default.t('REFUSER_DEMANDE'))))}},{key:"render",value:function(){return console.log("DEMAND GROUP PROPS",this.props),p.default.createElement(p.default.Fragment,null,(this.state.triggerTreatmentClick||this.state.triggerCancelClick)&&this.renderAlertErrorTreatOrCancelDemand(),this.props.loadingGetUniqueDemand?this.renderLoader():null!=this.props.resultGetUniqueDemand?this.renderDetail():null)}}]),n})(p.Component));N.navigatorStyle={navBarBackgroundColor:U.accentLight,statusBarColor:U.accent,navBarTextColor:'#FFFFFF',navBarButtonColor:'#FFFFFF'},N.navigationOptions=function(t){var n=t.navigation;return{drawerLabel:function(){return null},title:R.default.t('GROUP')+' N\xb0'+n.getParam("id","-")}};var k=(0,O.connect)(function(t){return{loadingGetUniqueDemand:t.getUniqueDemandsGroupReducer.loading,resultGetUniqueDemand:t.getUniqueDemandsGroupReducer.result,errorGetUniqueDemand:t.getUniqueDemandsGroupReducer.error,loadingTreatDemand:t.treatDemandGroupReducer.loading,resultTreatDemand:t.treatDemandGroupReducer.result,errorTreatDemand:t.treatDemandGroupReducer.error}},function(t){return(0,w.bindActionCreators)({getNanoCreditUniqueDemandsAction:S.getNanoCreditUniqueDemandsAction,getNanoCreditUniqueDemandsReset:S.getNanoCreditUniqueDemandsReset,treatDemandGroupAction:A.treatDemandGroupAction,cancelDemandGroupAction:A.cancelDemandGroupAction,treatDemandGroupReset:A.treatDemandGroupReset,treatCreditDemand:x.treatCreditDemand,creditDemandResetReducer:x.creditDemandResetReducer,treatCancelDemand:b.treatCancelDemand,creditCancelResetReducer:b.creditCancelResetReducer},t)})(N);e.default=k;var q=y.StyleSheet.create({container:{flex:1},btnstyle:{},inputAmountText:(function(t){for(var n=1;nparseInt(l.state.comptePrincipal)?{errorMessage:b.default.t('AMOUNT_SUPERIOR_TO_PRINCIPAL_ACCOUNT'),isValid:!1}:{errorMessage:'',isValid:!0}:{errorMessage:b.default.t('ENTER_VALID_AMOUNT'),isValid:!1}},l.renderGetDurationesponse=function(){var t=l.props,n=t.resultGetNanoCreditDuration,o=t.errorGetNanoCreditDuration;null!==n&&void 0!==n.response&&(n.response.length>0?l.setState({hasLoadDuration:!0,durations:n.response,durationSelect:n.response[0].value,modalVisible:!1}):0===n.response.length&&l.setState({hasLoadDuration:!0,durations:[],durationSelect:'',modalVisible:!1})),null!==o&&(void 0!==o.data?C.Alert.alert(b.default.t('ERROR_LABEL'),o.data.error,[{text:b.default.t("OK"),onPress:function(){l.props.getNanoCreditDemandDurationReset()}}],{cancelable:!1}):C.Alert.alert(b.default.t('ERROR_LABEL'),JSON.stringify(o),[{text:b.default.t("OK"),onPress:function(){l.props.getNanoCreditDemandDurationReset()}}],{cancelable:!1}))},l.renderEpargnerArgentResponse=function(){var t=l.props,n=t.result,o=t.error;null!==o&&void 0!==o.data&&C.Alert.alert(b.default.t("ERROR_LABLE"),o.data.error,[{text:b.default.t("OK"),onPress:function(){l.props.epargnerArgentUserReset()}}],{cancelable:!1}),null!==n&&null!==n.response&&C.Alert.alert(b.default.t("EPARGNE_DEPOSE"),n.response,[{text:b.default.t("OK"),onPress:function(){l.props.epargnerArgentUserReset(),x.IlinkEmitter.emit("updateNanoCreditAccount"),l.props.navigation.pop()}}],{cancelable:!1})},l.onSubmitEpargnerArgent=function(){var t=l.state,n=t.montant,o=t.typeEpargneName,s=t.durationSelect;l.ckeckIfFieldIsOK(o)?l.typeEpargneAnim.shake(800):l.ckeckIfFieldIsOK(s)&&l.state.displayDuration?l.durationAnim.shake(800):l.ckeckIfFieldIsOK(n)||!l.isMontantValid().isValid?l.montantAnim.shake(800):l.props.epargnerArgentUserAction({id_user:l.state.user.id,type:l.state.typeEpargneToSend,duree_mois:l.state.durationSelect,montant:l.state.montant,password:l.state.password}),l.setState({isDataSubmit:!0})},l.renderLoader=function(){return E.default.createElement(y.ProgressDialog,{visible:l.props.loading||l.props.loadingGetNanoCredit,title:b.default.t('LOADING'),message:b.default.t('LOADING_INFO')})},l.state={codeGroupe:null,codeSponsor:null,nomGroupe:null,codeSponsor:null,displayDuration:!1,user:null,montant:null,password:null,durations:[],durationSelect:null,triggerSubmitClick:!1,hasLoadDuration:!1,modalVisible:!1,isSubmitClick:!1,isDataSubmit:!1,isModalConfirmVisible:!1,typeEpargne:(0,_.typeEpargne)(),typeEpargneName:b.default.t((0,_.typeEpargne)()[0].name),typeEpargneToSend:'simple',wallet:w.store.getState().walletDetailReducer.result.response},l.props.getNanoCreditDemandDurationReset(),(0,k.readUser)().then(function(t){console.log("USER",t),t&&void 0!==t&&l.props.getNanoCreditDemandDurationAction({id_user:t.id,type:"epargne"})}),l}return(0,p.default)(n,t),(0,l.default)(n,[{key:"componentDidMount",value:function(){var t=this;(0,k.readUser)().then(function(n){n&&void 0!==n&&t.setState({user:n})})}},{key:"ckeckIfFieldIsOK",value:function(t){return(0,h.default)(t)||(0,f.default)(t.length,0)}},{key:"updateLangue",value:function(){this.props.navigation.setParams({name:b.default.t('SAVE_MONEY')}),this.forceUpdate()}},{key:"render",value:function(){var t=this;return E.default.createElement(E.default.Fragment,null,(this.props.loading||this.props.loadingGetNanoCredit||this.state.modalVisible)&&this.renderLoader(),this.state.isDataSubmit&&this.renderEpargnerArgentResponse(),!this.state.hasLoadDuration&&this.renderGetDurationesponse(),E.default.createElement(C.ScrollView,{style:U.container},E.default.createElement(C.Text,{style:U.subbigtitle},b.default.t('FILL_INFORMATION')),E.default.createElement(D.View,{ref:function(n){t.typeEpargneAnim=n},style:{width:(0,A.responsiveWidth)(90),height:60,marginTop:20,alignSelf:'center',borderRadius:10,paddingLeft:20,paddingRight:20,backgroundColor:'white'}},E.default.createElement(S.Dropdown,{label:b.default.t('SAVE_MONEY_TYPE'),data:this.state.typeEpargne,useNativeDriver:!0,value:this.state.typeEpargneName,onChangeText:function(n,o,l){n===b.default.t('SIMPLE')?t.setState({typeEpargneToSend:'simple',typeEpargneName:b.default.t('SIMPLE'),displayDuration:!1}):t.setState({typeEpargneToSend:'blocked',typeEpargneName:b.default.t('BLOCKED'),displayDuration:!0})},valueExtractor:function(t){return b.default.t(t.name)},labelExtractor:function(t){return b.default.t(t.name)}})),this.state.displayDuration&&E.default.createElement(D.View,{ref:function(n){t.durationAnim=n},style:{width:(0,A.responsiveWidth)(90),height:60,marginTop:20,alignSelf:'center',borderRadius:10,paddingLeft:20,paddingRight:20,backgroundColor:'white'}},E.default.createElement(S.Dropdown,{label:b.default.t('DEMAND_DURATION_IN_MONTH'),data:this.state.durations,useNativeDriver:!0,value:null!==this.state.durationSelect?this.state.durationSelect:'',onChangeText:function(n,o,l){t.setState({durationSelect:n})},valueExtractor:function(t){return b.default.t(t.value)},labelExtractor:function(t){return b.default.t(t.value)}})),E.default.createElement(D.View,{ref:function(n){t.montantAnim=n}},E.default.createElement(v.Fumi,{iconClass:N.default,iconName:'money',label:b.default.t('AMOUNT'),iconColor:'#f95a25',keyboardType:"numeric",iconSize:20,value:this.state.montant,onChangeText:function(n){t.setState({montant:n})},style:U.input}),E.default.createElement(C.View,{style:{position:'absolute',left:(0,A.responsiveWidth)(82),top:35,flexDirection:'row'}},E.default.createElement(C.View,{style:{width:1,borderLeftColor:'#f0f0f0',height:40,left:-8,top:-10,borderLeftWidth:1}}),E.default.createElement(C.Text,{style:[L.Typography.body1,L.FontWeight.bold]},this.state.wallet.currency_code))),E.default.createElement(D.View,{ref:function(n){t.passwordAnim=n}},E.default.createElement(v.Fumi,{iconClass:N.default,iconName:'lock',label:b.default.t('PASSWORD'),iconColor:'#f95a25',iconSize:20,secureTextEntry:!0,value:this.state.password,onChangeText:function(n){t.setState({password:n})},style:U.input})),E.default.createElement(c.default,{style:U.btnvalide,textStyle:U.textbtnvalide,onPress:function(){t.onSubmitEpargnerArgent()}},b.default.t('SUBMIT_LABEL'))))}}]),n})(E.Component));F.navigatorStyle={navBarBackgroundColor:T.Color.primaryColor,statusBarColor:T.Color.primaryDarkColor,navBarTextColor:'#FFFFFF',navBarButtonColor:'#FFFFFF'},F.navigationOptions=function(){return{drawerLabel:function(){return null},headerTitle:b.default.t('SAVE_MONEY'),headerTintColor:'white',headerStyle:{backgroundColor:T.Color.primaryColor,marginTop:0,color:'white'},headerTitleStyle:{color:"white"},title:b.default.t('SAVE_MONEY')}};var M=(0,R.connect)(function(t){return{loading:t.epargnerArgentUserReducer.loading,result:t.epargnerArgentUserReducer.result,error:t.epargnerArgentUserReducer.error,loadingGetNanoCreditDuration:t.getNanoCreditDemandDurationReducer.loading,resultGetNanoCreditDuration:t.getNanoCreditDemandDurationReducer.result,errorGetNanoCreditDuration:t.getNanoCreditDemandDurationReducer.error}},function(t){return(0,O.bindActionCreators)({epargnerArgentUserAction:V.epargnerArgentUserAction,epargnerArgentUserReset:V.epargnerArgentUserReset,getNanoCreditDemandDurationAction:I.getNanoCreditDemandDurationAction,getNanoCreditDemandDurationReset:I.getNanoCreditDemandDurationReset},t)})(F);e.default=M;var U=C.StyleSheet.create({container:{flex:1,backgroundColor:T.Color.primaryDarkColor},textbtnvalide:{color:'white',fontWeight:'bold'},bigtitle:{color:'white',fontSize:20,flex:1,fontWeight:'bold',textAlign:'center',margin:20},blockView:{paddingVertical:10,borderBottomWidth:1},subbigtitle:{color:'white',fontSize:17,textAlign:'center',margin:5},btnvalide:{marginTop:20,marginLeft:20,marginRight:20,borderColor:'transparent',backgroundColor:T.Color.accentLightColor,height:52},btnSubmit:{marginTop:20,borderColor:'transparent',backgroundColor:T.Color.accentLightColor,height:52,width:"30%",marginLeft:20,marginRight:20},input:{height:60,marginTop:(0,A.responsiveHeight)(2),marginLeft:(0,A.responsiveWidth)(5),marginRight:(0,A.responsiveWidth)(5),borderRadius:5}})},1828,[4,1,8,9,10,12,13,717,689,1615,15,18,751,720,973,535,1518,704,539,1039,1056,1026,1015,1099,1648,719,1818,1786,774,814,815]); -__d(function(g,r,i,a,m,e,d){var t=r(d[0]),n=r(d[1]);Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var o=n(r(d[2])),l=n(r(d[3])),s=n(r(d[4])),u=n(r(d[5])),c=n(r(d[6])),f=n(r(d[7])),p=n(r(d[8])),h=n(r(d[9])),E=t(r(d[10])),C=r(d[11]),b=t(r(d[12])),v=n(r(d[13])),k=r(d[14]),A=r(d[15]),R=r(d[16]),S=n(r(d[17])),y=r(d[18]),F=r(d[19]),w=r(d[20]),D=(r(d[21]),r(d[22]),r(d[23])),I=r(d[24]),O=(r(d[25]),r(d[26]),r(d[27])),_=(r(d[28]),r(d[29]),(function(t){function n(t){var l;return(0,o.default)(this,n),(l=(0,s.default)(this,(0,u.default)(n).call(this,t))).renderBreakEpargneRespons=function(){var t=l.props,n=t.result,o=t.error;null!==o&&void 0!==o.data&&C.Alert.alert(v.default.t("ERROR_LABLE"),o.data.error,[{text:v.default.t("OK"),onPress:function(){l.props.casserEpargneUserReset()}}],{cancelable:!1}),null!==n&&null!==n.response&&C.Alert.alert(v.default.t("BREAK_EPARGNE_DONE"),n.response,[{text:v.default.t("OK"),onPress:function(){l.props.casserEpargneUserReset(),D.IlinkEmitter.emit("refreshWallet"),l.props.navigation.pop()}}],{cancelable:!1})},l.onSubmitCasserEpargne=function(){var t=l.state,n=t.idEpargne,o=t.password;l.ckeckIfFieldIsOK(n)?l.idEpargneAnim.shake(800):l.ckeckIfFieldIsOK(o)?l.passwordAnim.shake(800):l.props.casserEpargneUserAction({id_user:l.state.user.id,id_epargne:l.state.idEpargne,password:l.state.password},0),l.setState({isDataSubmit:!0})},l.renderLoader=function(){return E.default.createElement(A.ProgressDialog,{visible:l.props.loading||l.props.loadingGetCommission,title:v.default.t('LOADING'),message:v.default.t('LOADING_INFO')})},l.state={password:null,idEpargne:null,codeGroup:null,loading:!1,user:null,triggerSubmitClick:!1,isSubmitClick:!1,isDataSubmit:!1,isModalConfirmVisible:!1,isGroupToModify:!1},l}return(0,c.default)(n,t),(0,l.default)(n,[{key:"componentDidMount",value:function(){var t=this;(0,I.readUser)().then(function(n){n&&void 0!==n&&t.setState({user:n})})}},{key:"ckeckIfFieldIsOK",value:function(t){return(0,h.default)(t)||(0,p.default)(t.length,0)}},{key:"updateLangue",value:function(){this.props.navigation.setParams({name:v.default.t('REFUND_NANO_CREDIT')}),this.forceUpdate()}},{key:"ckeckIfFieldIsOK",value:function(t){return(0,h.default)(t)||(0,p.default)(t.length,0)}},{key:"render",value:function(){var t=this;return E.default.createElement(E.default.Fragment,null,(this.props.loading||this.props.loadingGetCommission)&&this.renderLoader(),this.state.isDataSubmit&&this.renderBreakEpargneRespons(),E.default.createElement(C.ScrollView,{style:B.container},E.default.createElement(C.Text,{style:B.subbigtitle},v.default.t('DEMAND_INFO')),E.default.createElement(b.View,{ref:function(t){idEpargneAnim=t}},E.default.createElement(R.Fumi,{iconClass:S.default,iconName:'id-card',label:v.default.t('ID_EPARGNE'),iconColor:'#f95a25',iconSize:20,value:this.state.idEpargne,onChangeText:function(n){t.setState({idEpargne:n})},style:B.input})),E.default.createElement(b.View,{ref:function(n){t.passwordAnim=n}},E.default.createElement(R.Fumi,{iconClass:S.default,iconName:'lock',label:v.default.t('PASSWORD'),iconColor:'#f95a25',iconSize:20,secureTextEntry:!0,value:this.state.password,onChangeText:function(n){t.setState({password:n})},style:B.input})),E.default.createElement(f.default,{style:B.btnvalide,textStyle:B.textbtnvalide,onPress:function(){t.onSubmitCasserEpargne()}},this.state.isGroupToModify?v.default.t('MODIFY'):v.default.t('SUBMIT_LABEL'))))}}]),n})(E.Component));_.navigatorStyle={navBarBackgroundColor:w.Color.primaryColor,statusBarColor:w.Color.primaryDarkColor,navBarTextColor:'#FFFFFF',navBarButtonColor:'#FFFFFF'},_.navigationOptions=function(){return{drawerLabel:function(){return null},headerTitle:v.default.t('BREAK_EPARGNE'),headerTintColor:'white',headerStyle:{backgroundColor:w.Color.primaryColor,marginTop:0,color:'white'},headerTitleStyle:{color:"white"},title:v.default.t('BREAK_EPARGNE')}};var T=(0,y.connect)(function(t){return{loading:t.casserEpargneUserReducer.loading,result:t.casserEpargneUserReducer.result,error:t.casserEpargneUserReducer.error}},function(t){return(0,F.bindActionCreators)({casserEpargneUserAction:O.casserEpargneUserAction,casserEpargneUserReset:O.casserEpargneUserReset},t)})(_);e.default=T;var B=C.StyleSheet.create({container:{flex:1,backgroundColor:w.Color.primaryDarkColor},textbtnvalide:{color:'white',fontWeight:'bold'},bigtitle:{color:'white',fontSize:20,flex:1,fontWeight:'bold',textAlign:'center',margin:20},blockView:{paddingVertical:10,borderBottomWidth:1},subbigtitle:{color:'white',fontSize:17,textAlign:'center',margin:5},btnvalide:{marginTop:20,marginLeft:20,marginRight:20,borderColor:'transparent',backgroundColor:w.Color.accentLightColor,height:52},btnSubmit:{marginTop:20,borderColor:'transparent',backgroundColor:w.Color.accentLightColor,height:52,width:"30%",marginLeft:20,marginRight:20},input:{height:60,marginTop:(0,k.responsiveHeight)(2),marginLeft:(0,k.responsiveWidth)(5),marginRight:(0,k.responsiveWidth)(5),borderRadius:5}})},1829,[4,1,8,9,10,12,13,717,689,1615,15,18,751,720,535,1518,704,539,1039,1056,1026,1015,1099,774,719,1818,1648,1786,814,815]); +__d(function(g,r,i,a,m,e,d){var t=r(d[0]),l=r(d[1]);Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var o=l(r(d[2])),n=l(r(d[3])),s=l(r(d[4])),u=l(r(d[5])),c=l(r(d[6])),f=l(r(d[7])),p=l(r(d[8])),y=t(r(d[9])),E=r(d[10]),h=l(r(d[11])),C=r(d[12]),w=r(d[13]),T=r(d[14]),x=r(d[15]),b=l(r(d[16])),I=r(d[17]),D=r(d[18]),_=r(d[19]),A=r(d[20]),v=r(d[21]),V=r(d[22]),S=r(d[23]),N=t(r(d[24])),R=l(r(d[25])),P=l(r(d[26])),k=l(r(d[27])),B=(r(d[28]),r(d[29]),(function(t){function l(t){var n;return(0,o.default)(this,l),(n=(0,s.default)(this,(0,u.default)(l).call(this,t))).renderBreakEpargneRespons=function(){var t=n.props,l=t.result,o=t.error;null!==o&&void 0!==o.data&&E.Alert.alert(h.default.t("ERROR_LABLE"),o.data.error,[{text:h.default.t("OK"),onPress:function(){n.props.casserEpargneUserReset()}}],{cancelable:!1}),null!==l&&null!==l.response&&E.Alert.alert(h.default.t("BREAK_EPARGNE_DONE"),l.response,[{text:h.default.t("OK"),onPress:function(){n.props.casserEpargneUserReset(),_.IlinkEmitter.emit("refreshWallet"),n.props.navigation.pop()}}],{cancelable:!1})},n.onSubmitCasserEpargne=function(){var t=n.state,l=t.idEpargne,o=t.password;n.ckeckIfFieldIsOK(l)?n.idEpargneAnim.shake(800):n.ckeckIfFieldIsOK(o)?n.passwordAnim.shake(800):n.props.casserEpargneUserAction({id_user:n.state.user.id,id_epargne:n.state.idEpargne,password:n.state.password},0),n.setState({isDataSubmit:!0})},n.renderLoader=function(){return y.default.createElement(w.ProgressDialog,{visible:n.props.loading||n.props.loadingGetCommission||n.props.loadingNanoCreditHistory,title:h.default.t('LOADING'),message:h.default.t('LOADING_INFO')})},n.renderModalHistoryDetail=function(){return y.default.createElement(k.default.Container,{useNativeDriver:!0,visible:n.state.displayModalHistory},y.default.createElement(k.default.Title,null,h.default.t('DEMAND_DETAIL')),y.default.createElement(E.ScrollView,null,y.default.createElement(E.View,{style:[O.blockView,{borderBottomColor:I.Color.borderColor}]},y.default.createElement(E.View,{style:{flexDirection:'row',marginTop:10}},y.default.createElement(E.View,{style:{flex:1}},y.default.createElement(E.Text,{style:[O.body2]},"Type")),y.default.createElement(E.View,{style:{flex:1,alignItems:'flex-end'}},y.default.createElement(E.Text,{style:[D.Typography.caption1,I.Color.grayColor]},h.default.t((0,S.displayTransactionType)(n.state.historyItemDetail.type_historique))))),y.default.createElement(E.View,{style:{flexDirection:'row',marginTop:10}},y.default.createElement(E.View,{style:{flex:1}},y.default.createElement(E.Text,{style:[O.body2]},h.default.t('ID_DEMAND'))),y.default.createElement(E.View,{style:{flex:1,alignItems:'flex-end'}},y.default.createElement(E.Text,{style:[D.Typography.caption1,I.Color.grayColor]},n.state.historyItemDetail.id_demande))),y.default.createElement(E.View,{style:{flexDirection:'row',marginTop:10}},y.default.createElement(E.View,{style:{flex:1}},y.default.createElement(E.Text,{style:[O.body2]},h.default.t('STATUS'))),y.default.createElement(E.View,{style:{flex:1,alignItems:'flex-end'}},y.default.createElement(E.Text,{style:[D.Typography.caption1,I.Color.grayColor]},n.state.historyItemDetail.etat))),y.default.createElement(E.View,{style:{flexDirection:'row',marginTop:10}},y.default.createElement(E.View,{style:{flex:1}},y.default.createElement(E.Text,{style:[O.body2]},h.default.t('DEMAND_DURATION_IN_MONTH'))),y.default.createElement(E.View,{style:{flex:1,alignItems:'flex-end'}},y.default.createElement(E.Text,{style:[D.Typography.caption1,I.Color.grayColor]},n.state.historyItemDetail.duree_mois))),y.default.createElement(E.View,{style:{flexDirection:'row',marginTop:10}},y.default.createElement(E.View,{style:{flex:1}},y.default.createElement(E.Text,{style:[O.body2]},"Type")),y.default.createElement(E.View,{style:{flex:1,alignItems:'flex-end'}},y.default.createElement(E.Text,{style:[D.Typography.caption1,I.Color.grayColor]},n.state.historyItemDetail.type))),y.default.createElement(E.View,{style:{flexDirection:'row',marginTop:10}},y.default.createElement(E.View,{style:{flex:1}},y.default.createElement(E.Text,{tyle:[D.Typography.body2]},h.default.t('AMOUNT'))),y.default.createElement(E.View,{style:{flex:1,alignItems:'flex-end'}},y.default.createElement(E.Text,{style:[D.Typography.caption1,I.Color.grayColor]},n.state.historyItemDetail.montant+' '+n.state.wallet.currency_code))),y.default.createElement(E.View,{style:{flexDirection:'row',marginTop:10}},y.default.createElement(E.View,{style:{flex:1}},y.default.createElement(E.Text,{tyle:[D.Typography.body2]},h.default.t('TAXES'))),y.default.createElement(E.View,{style:{flex:1,alignItems:'flex-end'}},y.default.createElement(E.Text,{style:[D.Typography.caption1,I.Color.grayColor]},n.state.historyItemDetail.taxe+' '+n.state.wallet.currency_code))),y.default.createElement(E.View,{style:{flexDirection:'row',marginTop:10}},y.default.createElement(E.View,{style:{flex:1}},y.default.createElement(E.Text,{tyle:[D.Typography.body2]},h.default.t('INTERET'))),y.default.createElement(E.View,{style:{flex:1,alignItems:'flex-end'}},y.default.createElement(E.Text,{style:[D.Typography.caption1,I.Color.grayColor]},n.state.historyItemDetail.interet+' '+n.state.wallet.currency_code))),y.default.createElement(E.View,{style:{flexDirection:'row',marginTop:10}},y.default.createElement(E.View,{style:{flex:1}},y.default.createElement(E.Text,{style:[O.body2]},h.default.t('CREATION_DATE'))),y.default.createElement(E.View,{style:{flex:1,alignItems:'flex-end'}},y.default.createElement(E.Text,{style:[D.Typography.caption1,I.Color.grayColor]},n.state.historyItemDetail.date_creation))),y.default.createElement(E.View,{style:{flexDirection:'row',marginTop:10}},y.default.createElement(E.View,{style:{flex:1}},y.default.createElement(E.Text,{tyle:[D.Typography.body2]},h.default.t('FINAL_DATE'))),y.default.createElement(E.View,{style:{flex:1,alignItems:'flex-end'}},y.default.createElement(E.Text,{style:[D.Typography.caption1,I.Color.grayColor]},n.state.historyItemDetail.date_fin))),y.default.createElement(E.View,{style:{flexDirection:'row',marginTop:10}},y.default.createElement(E.View,{style:{flex:1}},y.default.createElement(E.Text,{tyle:[D.Typography.body2]},h.default.t('CASSATION_DATE'))),y.default.createElement(E.View,{style:{flex:1,alignItems:'flex-end'}},y.default.createElement(E.Text,{style:[D.Typography.caption1,I.Color.grayColor]},n.state.historyItemDetail.date_cassation))))),y.default.createElement(k.default.Button,{bold:!0,label:h.default.t('CANCEL_LABEL'),onPress:function(){n.setState({displayModalHistory:!n.state.displayModalHistory})}}),y.default.createElement(k.default.Button,{bold:!0,label:h.default.t('SUBMIT_LABEL'),onPress:function(){n.setState({displayPasswordModal:!n.state.displayPasswordModal})}}))},n.renderPasswordDialog=function(){return y.default.createElement(k.default.Container,{useNativeDriver:!0,visible:n.state.displayPasswordModal},y.default.createElement(k.default.Title,null,h.default.t('PASSWORD')),y.default.createElement(k.default.Input,{placeholder:h.default.t('PLEASE_ENTER_THE_PASSWORD'),style:{borderBottomWidth:1,borderBottomColor:I.Color.borderColor},showSoftInputOnFocus:!0,onChangeText:function(t){n.setState({password:t})},secureTextEntry:!0,value:n.state.password,onSubmitEditing:function(){n.setState({displayPasswordModal:!1,displayModalHistory:!1,isDataSubmit:!0}),n.props.refundCreditDemandUserAction({id_user:n.state.user.id,id_epargne:n.state.historyItemDetail.id_epargne,password:n.state.password})}}),y.default.createElement(k.default.Button,{label:h.default.t('CANCEL_LABEL'),onPress:function(){n.setState({displayPasswordModal:!n.state.displayPasswordModal})}}),y.default.createElement(k.default.Button,{label:h.default.t('SUBMIT_LABEL'),onPress:function(){n.setState({displayPasswordModal:!1,displayModalHistory:!1,isDataSubmit:!0}),n.props.casserEpargneUserAction({id_user:n.state.user.id,id_epargne:n.state.historyItemDetail.id_epargne,password:n.state.password})}}))},n.renderNanoCreditItem=function(t,l){return y.default.createElement(E.TouchableOpacity,{onPress:function(){n.setState({displayModalHistory:!0,historyItemDetail:t})},style:[O.contentService,{borderBottomColor:I.Color.primaryColor}]},Object.keys((0,b.default)(t,['id','id_epargne','date_demande','date_fin','date_remboursement_prevu','date_validation','date_cassation','date_remboursement','id_demande','duree_mois','taxe','','date_fin','date_cassation','id_user','id_network','user','partiellement_rembourse','user_phone','interet','date_remboursement_prevu','date_remboursement','id_wallet_agent','retrait_cash','codeParrain','agent','montant_rembourse',''])).map(function(l,o){return y.default.createElement(E.View,{style:{alignItems:'center'},key:o},y.default.createElement(E.Text,{style:(D.Typography.overline,I.Color.grayColor,{marginTop:4})},(0,f.default)(l,'montant')?" "+(0,P.default)(t[l],' '):(0,f.default)(l,'date_creation')?(0,S.cutStringWithoutDot)(t[l],16):t[l]))}))},n.renderNanoCreditList=function(){var t=n.props,l=t.errorNanoCreditHistory,o=t.resultNanoCreditHistory;return null!==l?void 0!==l.data?y.default.createElement(E.View,{style:{flex:1,justifyContent:'center',alignItems:'center'}},y.default.createElement(E.Text,{style:D.Typography.body1},l.data.error)):y.default.createElement(E.View,{style:{flex:1,justifyContent:'center',alignItems:'center'}},y.default.createElement(E.Text,{style:D.Typography.body1},l)):null!==o&&null!==o.response?Array.isArray(o.response)&&o.response.length>0?y.default.createElement(y.default.Fragment,null,y.default.createElement(E.View,{style:[O.contentService,{borderBottomColor:I.Color.primaryColor}]},(0,S.nanoCreditHistoryLabel)().map(function(t,l){return y.default.createElement(E.View,{style:{alignItems:'center'},key:l},y.default.createElement(R.default,{name:t.icon,size:24,color:I.Color.primaryColor}),y.default.createElement(E.Text,{style:(D.Typography.overline,I.Color.grayColor,{marginTop:4})},h.default.t(t.label)))})),o.response.map(function(t,l){return n.renderNanoCreditItem(t,l)})):y.default.createElement(E.View,{style:{flex:1,justifyContent:'center',alignItems:'flex-start'}},y.default.createElement(E.Text,{style:D.Typography.body1},h.default.t('NO_NANO_CREDIT'))):void 0},n.renderNanoCreditHistory=function(){return y.default.createElement(E.View,{style:{backgroundColor:I.Color.containerBackgroundColor,flex:1}},n.props.loadingNanoCreditHistory?y.default.createElement(E.View,{style:{flex:1,justifyContent:'center',alignItems:'center'}},y.default.createElement(y.default.Fragment,null,y.default.createElement(E.ProgressBarAndroid,null),y.default.createElement(E.Text,null,h.default.t('LOADING_DOTS')))):n.renderNanoCreditList())},n.state={password:null,idEpargne:null,codeGroup:null,loading:!1,user:null,triggerSubmitClick:!1,isSubmitClick:!1,isDataSubmit:!1,isModalConfirmVisible:!1,isGroupToModify:!1,displayModalHistory:!1,historyItemDetail:null,isDataHasLoaded:!1,displayPasswordModal:!1,wallet:n.props.navigation.state.params.wallet},n.props.getEpargneInProgressReset(),n}return(0,c.default)(l,t),(0,n.default)(l,[{key:"componentDidMount",value:function(){var t=this;(0,A.readUser)().then(function(l){l&&void 0!==l&&(t.setState({user:l}),t.props.getEpargneInProgressAction(l.id))})}},{key:"ckeckIfFieldIsOK",value:function(t){return(0,p.default)(t)||(0,f.default)(t.length,0)}},{key:"updateLangue",value:function(){this.props.navigation.setParams({name:h.default.t('REFUND_NANO_CREDIT')}),this.forceUpdate()}},{key:"ckeckIfFieldIsOK",value:function(t){return(0,p.default)(t)||(0,f.default)(t.length,0)}},{key:"render",value:function(){return y.default.createElement(y.default.Fragment,null,(this.props.loading||this.props.loadingGetCommission||this.props.loadingNanoCreditHistory)&&this.renderLoader(),this.state.isDataSubmit&&this.renderBreakEpargneRespons(),this.state.displayModalHistory&&this.renderModalHistoryDetail(),this.state.displayPasswordModal&&this.renderPasswordDialog(),y.default.createElement(E.ScrollView,{style:O.container},y.default.createElement(E.View,{style:[O.checkDefault,{borderBottomColor:I.Color.borderColor}]},y.default.createElement(E.Text,{style:[D.Typography.title3,D.Typography.semibold]},h.default.t('NANO_CREDIT_LIST'))),this.renderNanoCreditHistory()))}}]),l})(y.Component));B.navigatorStyle={navBarBackgroundColor:I.Color.primaryColor,statusBarColor:I.Color.primaryDarkColor,navBarTextColor:'#FFFFFF',navBarButtonColor:'#FFFFFF'},B.navigationOptions=function(){return{drawerLabel:function(){return null},headerTitle:h.default.t('BREAK_EPARGNE'),headerTintColor:'white',headerStyle:{backgroundColor:I.Color.primaryColor,marginTop:0,color:'white'},headerTitleStyle:{color:"white"},title:h.default.t('BREAK_EPARGNE')}};var L=(0,T.connect)(function(t){return{loading:t.casserEpargneUserReducer.loading,result:t.casserEpargneUserReducer.result,error:t.casserEpargneUserReducer.error,errorNanoCreditHistory:t.getEpargneInProgressReducer.error,resultNanoCreditHistory:t.getEpargneInProgressReducer.result,loadingNanoCreditHistory:t.getEpargneInProgressReducer.loading}},function(t){return(0,x.bindActionCreators)({casserEpargneUserAction:V.casserEpargneUserAction,casserEpargneUserReset:V.casserEpargneUserReset,getEpargneInProgressAction:v.getEpargneInProgressAction,getEpargneInProgressReset:v.getEpargneInProgressReset},t)})(B);e.default=L;var O=E.StyleSheet.create({container:{flex:1,backgroundColor:I.Color.containerBackgroundColor,paddingHorizontal:20},textbtnvalide:{color:'white',fontWeight:'bold'},bigtitle:{color:'white',fontSize:20,flex:1,fontWeight:'bold',textAlign:'center',margin:20},blockView:{paddingVertical:10,borderBottomWidth:1},subbigtitle:{color:'white',fontSize:17,textAlign:'center',margin:5},btnvalide:{marginTop:20,marginLeft:20,marginRight:20,borderColor:'transparent',backgroundColor:I.Color.accentLightColor,height:52},btnSubmit:{marginTop:20,borderColor:'transparent',backgroundColor:I.Color.accentLightColor,height:52,width:"30%",marginLeft:20,marginRight:20},input:{height:60,marginTop:(0,C.responsiveHeight)(2),marginLeft:(0,C.responsiveWidth)(5),marginRight:(0,C.responsiveWidth)(5),borderRadius:5},circlePoint:{width:50,height:50,borderRadius:25,marginRight:5,alignItems:'center',justifyContent:'center'},checkDefault:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",borderBottomWidth:1,paddingVertical:10,marginTop:5},transactionContainer:{flexDirection:'row',paddingTop:10},containerTouch:{flex:1,flexDirection:'row',alignItems:'center',shadowColor:I.Color.borderColor,borderColor:I.Color.borderColor,borderWidth:.5,shadowOffset:{width:1.5,height:1.5},shadowOpacity:1,elevation:5,borderRadius:10,backgroundColor:I.Color.cardBackgroundColor},contain:{flexDirection:'row',justifyContent:'space-between'},imageBanner:{marginTop:15,marginLeft:5,width:N.scaleWithPixel(30),height:N.scaleWithPixel(30)},content:{height:N.scaleWithPixel(65),paddingHorizontal:10,justifyContent:'space-between',alignItems:'flex-start',flex:1},contentTitle:{paddingTop:12},contentService:{paddingVertical:10,borderBottomWidth:.5,flexDirection:'row',flexWrap:'wrap',justifyContent:'space-between'},containField:{padding:10,marginBottom:20,borderWidth:.5,shadowOffset:{width:1.5,height:1.5},shadowOpacity:1,elevation:5,flexDirection:"row",height:140,borderRadius:10},paymentItem:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",borderBottomWidth:1,paddingVertical:5,width:(0,C.responsiveWidth)(100),marginBottom:15},iconContent:{width:60,marginRight:10,alignItems:"center"},contentLeftItem:{flex:1,paddingTop:40,paddingLeft:10,paddingRight:10,alignItems:"center"}})},1829,[4,1,8,9,10,12,13,689,1615,15,18,720,535,1518,1039,1056,553,1026,1015,774,719,1818,1786,1648,1014,876,1650,1629,814,815]); __d(function(g,r,i,a,m,e,d){Object.defineProperty(e,"__esModule",{value:!0}),e.fromLeft=function(){return{transitionSpec:{duration:arguments.length>0&&void 0!==arguments[0]?arguments[0]:300,easing:n.Easing.out(n.Easing.poly(4)),timing:n.Animated.timing,useNativeDriver:!0},screenInterpolator:function(n){var t=n.layout,o=n.position,u=n.scene,s=u.index,p=t.initWidth,c=o.interpolate({inputRange:[s-1,s,s+1],outputRange:[-p,0,0]}),l=o.interpolate({inputRange:[s-1,s-.99,s],outputRange:[0,1,1]});return{opacity:l,transform:[{translateX:c}]}}}},e.fromTop=function(){return{transitionSpec:{duration:arguments.length>0&&void 0!==arguments[0]?arguments[0]:300,easing:n.Easing.out(n.Easing.poly(4)),timing:n.Animated.timing,useNativeDriver:!0},screenInterpolator:function(n){var t=n.layout,o=n.position,u=n.scene,s=u.index,p=t.initHeight,c=o.interpolate({inputRange:[s-1,s,s+1],outputRange:[-p,0,0]}),l=o.interpolate({inputRange:[s-1,s-.99,s],outputRange:[0,1,1]});return{opacity:l,transform:[{translateY:c}]}}}},e.fromRight=function(){return{transitionSpec:{duration:arguments.length>0&&void 0!==arguments[0]?arguments[0]:300,easing:n.Easing.out(n.Easing.poly(4)),timing:n.Animated.timing,useNativeDriver:!0},screenInterpolator:function(n){var t=n.layout,o=n.position,u=n.scene,s=u.index,p=t.initWidth,c=o.interpolate({inputRange:[s-1,s,s+1],outputRange:[p,0,0]}),l=o.interpolate({inputRange:[s-1,s-.99,s],outputRange:[0,1,1]});return{opacity:l,transform:[{translateX:c}]}}}},e.fromBottom=function(){return{transitionSpec:{duration:arguments.length>0&&void 0!==arguments[0]?arguments[0]:300,easing:n.Easing.out(n.Easing.poly(4)),timing:n.Animated.timing,useNativeDriver:!0},screenInterpolator:function(n){var t=n.layout,o=n.position,u=n.scene,s=u.index,p=t.initHeight,c=o.interpolate({inputRange:[s-1,s,s+1],outputRange:[p,0,0]}),l=o.interpolate({inputRange:[s-1,s-.99,s],outputRange:[0,1,1]});return{opacity:l,transform:[{translateY:c}]}}}},e.fadeIn=function(){return{transitionSpec:{duration:arguments.length>0&&void 0!==arguments[0]?arguments[0]:300,easing:n.Easing.out(n.Easing.poly(4)),timing:n.Animated.timing,useNativeDriver:!0},screenInterpolator:function(n){var t=n.position,o=n.scene,u=o.index,s=t.interpolate({inputRange:[u-1,u],outputRange:[0,1]});return{opacity:s}}}},e.fadeOut=function(){return{transitionSpec:{duration:arguments.length>0&&void 0!==arguments[0]?arguments[0]:300,easing:n.Easing.out(n.Easing.poly(4)),timing:n.Animated.timing,useNativeDriver:!0},screenInterpolator:function(n){var t=n.position,o=n.scene,u=o.index,s=t.interpolate({inputRange:[u-1,u,u+1],outputRange:[0,1,0]});return{opacity:s}}}},e.zoomIn=function(){return{transitionSpec:{duration:arguments.length>0&&void 0!==arguments[0]?arguments[0]:300,easing:n.Easing.out(n.Easing.poly(4)),timing:n.Animated.timing,useNativeDriver:!0},screenInterpolator:function(t){var o=t.position,u=t.scene,s=u.index,p=0;'ios'!==n.Platform.OS&&(p=.005);var c=o.interpolate({inputRange:[s-1,s],outputRange:[p,1]});return{transform:[{scale:c}]}}}},e.zoomOut=function(){return{transitionSpec:{duration:arguments.length>0&&void 0!==arguments[0]?arguments[0]:300,easing:n.Easing.out(n.Easing.poly(4)),timing:n.Animated.timing,useNativeDriver:!0},screenInterpolator:function(n){var t=n.position,o=n.scene,u=o.index,s=t.interpolate({inputRange:[u-1,u],outputRange:[10,1]});return{transform:[{scale:s}]}}}},e.flipY=function(){return{transitionSpec:{duration:arguments.length>0&&void 0!==arguments[0]?arguments[0]:300,easing:n.Easing.out(n.Easing.poly(4)),timing:n.Animated.timing,useNativeDriver:!0},screenInterpolator:function(n){var t=n.position,o=n.scene,u=o.index,s=t.interpolate({inputRange:[u-1,u],outputRange:['180deg','0deg']});return{transform:[{rotateY:s}],backfaceVisibility:'hidden'}}}},e.flipX=function(){return{transitionSpec:{duration:arguments.length>0&&void 0!==arguments[0]?arguments[0]:300,easing:n.Easing.out(n.Easing.poly(4)),timing:n.Animated.timing,useNativeDriver:!0},screenInterpolator:function(n){var t=n.position,o=n.scene,u=o.index,s=t.interpolate({inputRange:[u-1,u],outputRange:['180deg','0deg']});return{transform:[{rotateX:s}],backfaceVisibility:'hidden'}}}};var n=r(d[0])},1830,[18]); __d(function(g,r,i,a,m,e,d){var t=r(d[0]),n=r(d[1]);Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var o=n(r(d[2])),l=n(r(d[3])),s=n(r(d[4])),u=n(r(d[5])),c=n(r(d[6])),f=n(r(d[7])),p=n(r(d[8])),h=n(r(d[9])),v=t(r(d[10])),k=r(d[11]),b=t(r(d[12])),T=n(r(d[13])),E=r(d[14]),C=r(d[15]),S=n(r(d[16])),W=r(d[17]),w=r(d[18]),B=r(d[19]),y=r(d[20]),_=r(d[21]),A=r(d[22]),R=r(d[23]),I=r(d[24]),O=r(d[25]),F=r(d[26]),L=(r(d[27]),r(d[28]),(function(t){function n(t){var l;return(0,o.default)(this,n),(l=(0,s.default)(this,(0,u.default)(n).call(this,t))).renderEnvoieWalletToBankResponse=function(){var t=l.props,n=t.resultEnvoieWalletToBank,o=t.errorEnvoieWalletToBank;null!==o&&void 0!==o.data&&k.Alert.alert(T.default.t("ERROR_TRANSFER"),o.data.error,[{text:T.default.t("OK"),onPress:function(){l.props.envoieUserWalletToBankReset()}}],{cancelable:!1}),null!==n&&null!==n.response&&k.Alert.alert(T.default.t("SUCCESS_TRANSFER"),n.response,[{text:T.default.t("OK"),onPress:function(){l.props.envoieUserWalletToBankReset(),R.IlinkEmitter.emit("refreshWallet"),l.props.navigation.pop()}}],{cancelable:!1})},l.isMontantValid=function(){var t=l.state.montant;return parseInt((0,p.default)(t,0))||t<0?{errorMessage:T.default.t('ENTER_AMOUNT_SUPERIOR_ZEROR'),isValid:!1}:(0,F.isNormalInteger)(t)?{errorMessage:'',isValid:!0}:{errorMessage:T.default.t('ENTER_VALID_AMOUNT'),isValid:!1}},l.onSubmitSendWalletToBank=function(){var t=l.state,n=t.montant,o=t.password,s=t.codeIban;l.ckeckIfFieldIsOK(s)?(s.length,l.codeIbanAnim.shake(800)):l.ckeckIfFieldIsOK(n)||!l.isMontantValid().isValid?l.montantAnim.shake(800):l.ckeckIfFieldIsOK(o)?l.passwordAnim.shake(800):(console.log("id wallet network",l.state.bank),l.props.envoieUserWalletToBankAction({type:18,id_wallet_agent:l.state.wallet.id,id_wallet_network:l.state.wallet.id_network,iban:s,id_bank:l.state.bank.id_operator,montant:n,password:o})),l.setState({isDataSubmit:!0})},l.renderLoader=function(){return v.default.createElement(C.ProgressDialog,{visible:l.props.loadingEnvoieWalletToBank,title:T.default.t('LOADING'),message:T.default.t('LOADING_INFO')})},l.state={montant:null,password:null,codeIban:null,loading:!1,user:null,triggerSubmitClick:!1,isSubmitClick:!1,isDataSubmit:!1,isModalConfirmVisible:!1,wallet:A.store.getState().walletDetailReducer.result.response,bank:l.props.navigation.state.params.bank},l.props.envoieUserWalletToBankReset(),l}return(0,c.default)(n,t),(0,l.default)(n,[{key:"componentDidMount",value:function(){var t=this;(0,I.readUser)().then(function(n){n&&void 0!==n&&t.setState({user:n})})}},{key:"componentWillReceiveProps",value:function(t){console.log('PROPS',t)}},{key:"updateLangue",value:function(){this.props.navigation.setParams({name:T.default.t('DEPOSIT_TO_CARD')}),this.forceUpdate()}},{key:"ckeckIfFieldIsOK",value:function(t){return(0,h.default)(t)||(0,p.default)(t.length,0)}},{key:"render",value:function(){var t=this;return v.default.createElement(v.default.Fragment,null,this.props.loadingEnvoieWalletToBank&&this.renderLoader(),this.state.isDataSubmit&&this.renderEnvoieWalletToBankResponse(),v.default.createElement(k.ScrollView,{style:U.container},v.default.createElement(k.Text,{style:U.subbigtitle},T.default.t('ENVOIE_WALLET_TO_BANK')),v.default.createElement(b.View,{ref:function(n){t.codeIbanAnim=n}},v.default.createElement(W.Fumi,{iconClass:S.default,iconName:'id-card',label:T.default.t('CODE_IBAN'),iconColor:'#f95a25',iconSize:20,value:this.state.codeIban,onChangeText:function(n){t.setState({codeIban:n})},style:U.input})),v.default.createElement(b.View,{ref:function(n){t.montantAnim=n}},v.default.createElement(W.Fumi,{iconClass:S.default,iconName:'money',label:T.default.t('AMOUNT'),iconColor:'#f95a25',keyboardType:"numeric",iconSize:20,value:this.state.montant,onChangeText:function(n){t.setState({montant:n})},style:U.input}),v.default.createElement(k.View,{style:{position:'absolute',left:(0,E.responsiveWidth)(82),top:35,flexDirection:'row'}},v.default.createElement(k.View,{style:{width:1,borderLeftColor:'#f0f0f0',height:40,left:-8,top:-10,borderLeftWidth:1}}),v.default.createElement(k.Text,{style:[_.Typography.body1,_.FontWeight.bold]},this.state.wallet.currency_code))),v.default.createElement(b.View,{ref:function(n){t.passwordAnim=n}},v.default.createElement(W.Fumi,{iconClass:S.default,iconName:'lock',label:T.default.t('PASSWORD'),iconColor:'#f95a25',iconSize:20,secureTextEntry:!0,value:this.state.password,onChangeText:function(n){t.setState({password:n})},style:U.input})),v.default.createElement(f.default,{style:U.btnvalide,textStyle:U.textbtnvalide,onPress:function(){t.onSubmitSendWalletToBank()}},T.default.t('SUBMIT_LABEL'))))}}]),n})(v.Component));L.navigatorStyle={navBarBackgroundColor:y.Color.primaryColor,statusBarColor:y.Color.primaryDarkColor,navBarTextColor:'#FFFFFF',navBarButtonColor:'#FFFFFF'},L.navigationOptions=function(){return{drawerLabel:function(){return null},headerTitle:T.default.t('DEPOSIT_WALLET_TO_BANK'),headerTintColor:'white',headerStyle:{backgroundColor:y.Color.primaryColor,marginTop:0,color:'white'},headerTitleStyle:{color:"white"},title:T.default.t('DEPOSIT_WALLET_TO_BANK')}};var N=(0,w.connect)(function(t){return{loadingEnvoieWalletToBank:t.envoieUserWalletToBank.loading,resultEnvoieWalletToBank:t.envoieUserWalletToBank.result,errorEnvoieWalletToBank:t.envoieUserWalletToBank.error}},function(t){return(0,B.bindActionCreators)({envoieUserWalletToBankAction:O.envoieUserWalletToBankAction,envoieUserWalletToBankReset:O.envoieUserWalletToBankReset},t)})(L);e.default=N;var U=k.StyleSheet.create({container:{flex:1,backgroundColor:y.Color.primaryDarkColor},textbtnvalide:{color:'white',fontWeight:'bold'},bigtitle:{color:'white',fontSize:20,flex:1,fontWeight:'bold',textAlign:'center',margin:20},blockView:{paddingVertical:10,borderBottomWidth:1},subbigtitle:{color:'white',fontSize:17,textAlign:'center',margin:5},btnvalide:{marginTop:20,marginLeft:20,marginRight:20,borderColor:'transparent',backgroundColor:y.Color.accentLightColor,height:52},btnSubmit:{marginTop:20,borderColor:'transparent',backgroundColor:y.Color.accentLightColor,height:52,width:"30%",marginLeft:20,marginRight:20},input:{height:60,marginTop:(0,E.responsiveHeight)(2),marginLeft:(0,E.responsiveWidth)(5),marginRight:(0,E.responsiveWidth)(5),borderRadius:5}})},1831,[4,1,8,9,10,12,13,717,689,1615,15,18,751,720,535,1518,539,704,1039,1056,1026,1015,1099,774,719,1799,1648,814,815]); __d(function(i,n,d,o,a,e,l){a.exports={name:"iLinkWorld",displayName:"iLinkWorld"}},1832,[]); diff --git a/package.json b/package.json index 9fe1ee8f..6ad3dad8 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "start-emulator": "emulator -avd Nexus_5X_API_29 -dns-server 8.8.8.8", "start-emulator-pixel": "emulator -avd Pixel_2_API_29 -dns-server 8.8.8.8", "run-debug": "cd android && ./gradlew clean && cd .. && react-native run-android", - "run-release": "cd android && ./gradlew clean && cd .. && react-native run-android --variant=release" + "run-release": "cd android && ./gradlew clean && cd h.. && react-native run-android --variant=release" }, "dependencies": { "@expo/react-native-action-sheet": "^3.8.0", diff --git a/redux/actions/WalletActions.js b/redux/actions/WalletActions.js index cdaf4439..c54ea21c 100644 --- a/redux/actions/WalletActions.js +++ b/redux/actions/WalletActions.js @@ -1,176 +1,176 @@ import { - WALLET_LIST_PENDING, - WALLET_LIST_SUCCESS, - WALLET_LIST_ERROR, - WALLET_HISTORY_PENDING, - WALLET_HISTORY_SUCCESS, - WALLET_HISTORY_ERROR, - WALLET_TRANSFER_COMMISSION_PENDING, - WALLET_TRANSFER_COMMISSION_SUCCESS, - WALLET_TRANSFER_COMMISSION_ERROR, - WALLET_TRANSFER_COMMISSION_RESET, - WALLET_HISTORY_RESET, - WALLET_LIST_DETAIL_RESET, - WALLET_LIST_DETAIL_ERROR, - WALLET_LIST_DETAIL_PENDING, - WALLET_LIST_DETAIL_SUCCESS, - WALLET_GET_COMMISSION_PENDING, - WALLET_GET_COMMISSION_SUCCESS, - WALLET_GET_COMMISSION_ERROR, - WALLET_GET_COMMISSION_RESET, - WALLET_GET_RETREAIT_COMMISSION_PENDING, - WALLET_GET_RETREAIT_COMMISSION_SUCCESS, - WALLET_GET_RETREAIT_COMMISSION_ERROR, - WALLET_GET_RETREAIT_COMMISSION_RESET, - LINK_CARD_PENDING, - LINK_CARD_RESET, - LINK_CARD_SUCCESS, - LINK_CARD_ERROR, - WALLET_HISTORY_HYPER_SUPER_PENDING, - WALLET_HISTORY_HYPER_SUPER__SUCCESS, - WALLET_HISTORY_HYPER_SUPER__ERROR, - WALLET_HISTORY_HYPER_SUPER__RESET + GET_OPERATOR_LIST_ERROR, + GET_OPERATOR_LIST_PENDING, + GET_OPERATOR_LIST_RESET, + GET_OPERATOR_LIST_SUCCESS, + LINK_CARD_ERROR, + LINK_CARD_PENDING, + LINK_CARD_RESET, + LINK_CARD_SUCCESS, + WALLET_GET_COMMISSION_ERROR, + WALLET_GET_COMMISSION_PENDING, + WALLET_GET_COMMISSION_RESET, + WALLET_GET_COMMISSION_SUCCESS, + WALLET_HISTORY_ERROR, + WALLET_HISTORY_HYPER_SUPER__ERROR, + WALLET_HISTORY_HYPER_SUPER__RESET, + WALLET_HISTORY_HYPER_SUPER__SUCCESS, + WALLET_HISTORY_HYPER_SUPER_PENDING, + WALLET_HISTORY_PENDING, + WALLET_HISTORY_RESET, + WALLET_HISTORY_SUCCESS, + WALLET_LIST_DETAIL_ERROR, + WALLET_LIST_DETAIL_PENDING, + WALLET_LIST_DETAIL_RESET, + WALLET_LIST_DETAIL_SUCCESS, + WALLET_LIST_ERROR, + WALLET_LIST_PENDING, + WALLET_LIST_SUCCESS, + WALLET_TRANSFER_COMMISSION_ERROR, + WALLET_TRANSFER_COMMISSION_PENDING, + WALLET_TRANSFER_COMMISSION_RESET, + WALLET_TRANSFER_COMMISSION_SUCCESS } from "../types/WalletType"; export const fetchWalletListPending = () => ({ - type: WALLET_LIST_PENDING + type: WALLET_LIST_PENDING }); export const fetchWalletListSuccess = (res) => ({ - type: WALLET_LIST_SUCCESS, - result: res, + type: WALLET_LIST_SUCCESS, + result: res, }); export const fetchWalletListError = (error) => ({ - type: WALLET_LIST_ERROR, - result: error + type: WALLET_LIST_ERROR, + result: error }); export const fetchWalletListReset = (error) => ({ - type: WALLET_LIST_RESET, - result: error + type: WALLET_LIST_RESET, + result: error }); /** * --------------------------------------------------- */ export const fetchWalletListDetailPending = () => ({ - type: WALLET_LIST_DETAIL_PENDING + type: WALLET_LIST_DETAIL_PENDING }); export const fetchWalletListDetailSuccess = (res) => ({ - type: WALLET_LIST_DETAIL_SUCCESS, - result: res, + type: WALLET_LIST_DETAIL_SUCCESS, + result: res, }); export const fetchWalletListDetailError = (error) => ({ - type: WALLET_LIST_DETAIL_ERROR, - result: error + type: WALLET_LIST_DETAIL_ERROR, + result: error }); export const fetchWalletListDetailReset = (error) => ({ - type: WALLET_LIST_DETAIL_RESET, - result: error + type: WALLET_LIST_DETAIL_RESET, + result: error }); /** * --------------------------------------------------- */ export const fetchWalletHistoryPending = () => ({ - type: WALLET_HISTORY_PENDING + type: WALLET_HISTORY_PENDING }); export const fetchWalletHistoryReset = () => ({ - type: WALLET_HISTORY_RESET + type: WALLET_HISTORY_RESET }); export const fetchWalletHistorySuccess = (res) => ({ - type: WALLET_HISTORY_SUCCESS, - result: res, + type: WALLET_HISTORY_SUCCESS, + result: res, }); export const fetchWalletHistoryError = (error) => ({ - type: WALLET_HISTORY_ERROR, - result: error + type: WALLET_HISTORY_ERROR, + result: error }); /** * --------------------------------------------------- */ export const fetchWalletHistoryHyperSuperPending = () => ({ - type: WALLET_HISTORY_HYPER_SUPER_PENDING + type: WALLET_HISTORY_HYPER_SUPER_PENDING }); export const fetchWalletHistoryHyperSuperReset = () => ({ - type: WALLET_HISTORY_HYPER_SUPER__RESET + type: WALLET_HISTORY_HYPER_SUPER__RESET }); export const fetchWalletHistoryHyperSuperSuccess = (res) => ({ - type: WALLET_HISTORY_HYPER_SUPER__SUCCESS, - result: res, + type: WALLET_HISTORY_HYPER_SUPER__SUCCESS, + result: res, }); export const fetchWalletHistoryHyperSuperError = (error) => ({ - type: WALLET_HISTORY_HYPER_SUPER__ERROR, - result: error + type: WALLET_HISTORY_HYPER_SUPER__ERROR, + result: error }); /** * --------------------------------------------------- */ export const fetchWalletTransferCommissionPending = () => ({ - type: WALLET_TRANSFER_COMMISSION_PENDING + type: WALLET_TRANSFER_COMMISSION_PENDING }); export const walletTransferCommissionReset = () => ({ - type: WALLET_TRANSFER_COMMISSION_RESET + type: WALLET_TRANSFER_COMMISSION_RESET }); export const fetchWalletTransferCommissionSuccess = (res) => ({ - type: WALLET_TRANSFER_COMMISSION_SUCCESS, - result: res, + type: WALLET_TRANSFER_COMMISSION_SUCCESS, + result: res, }); export const fetchWalletTransferCommssionError = (error) => ({ - type: WALLET_TRANSFER_COMMISSION_ERROR, - result: error + type: WALLET_TRANSFER_COMMISSION_ERROR, + result: error }); /** * --------------------------------------------------- */ export const fetchWalletGetCommissionPending = () => ({ - type: WALLET_GET_COMMISSION_PENDING + type: WALLET_GET_COMMISSION_PENDING }); export const walletGetCommissionReset = () => ({ - type: WALLET_GET_COMMISSION_RESET + type: WALLET_GET_COMMISSION_RESET }); export const fetchWalletGetCommissionSuccess = (res) => ({ - type: WALLET_GET_COMMISSION_SUCCESS, - result: res, + type: WALLET_GET_COMMISSION_SUCCESS, + result: res, }); export const fetchWalleGetCommissionError = (error) => ({ - type: WALLET_GET_COMMISSION_ERROR, - result: error + type: WALLET_GET_COMMISSION_ERROR, + result: error }); /** * --------------------------------------------------- */ export const fetchLinkCardPending = () => ({ - type: LINK_CARD_PENDING + type: LINK_CARD_PENDING }); export const fetchLinkCardReset = () => ({ - type: LINK_CARD_RESET + type: LINK_CARD_RESET }); export const fetchLinkCardSuccess = (res) => ({ - type: LINK_CARD_SUCCESS, - result: res, + type: LINK_CARD_SUCCESS, + result: res, }); export const fetchLinkCardError = (error) => ({ - type: LINK_CARD_ERROR, - result: error + type: LINK_CARD_ERROR, + result: error }); /* export const fetchWalletGetRetraitCommissionPending = () => ({ @@ -189,4 +189,25 @@ export const fetchWalletGetRetraitCommissionSuccess = (res) => ({ export const fetchWalleGetRetraitCommissionError = (error) => ({ type: WALLET_GET_RETREAIT_COMMISSION_ERROR, result: error -}); */ \ No newline at end of file +}); */ + +/** + * --------------------------------------------------- + */ +export const fetchGetListOperatorPending = () => ({ + type: GET_OPERATOR_LIST_PENDING +}); + +export const fetchGetListOperatorReset = () => ({ + type: GET_OPERATOR_LIST_RESET +}); + +export const fetchGetListOperatorSuccess = (res) => ({ + type: GET_OPERATOR_LIST_SUCCESS, + result: res, +}); + +export const fetchGetListOperatorError = (error) => ({ + type: GET_OPERATOR_LIST_ERROR, + result: error +}); \ No newline at end of file diff --git a/redux/reducers/GetListOperatorReducer.js b/redux/reducers/GetListOperatorReducer.js index e69de29b..842564bc 100644 --- a/redux/reducers/GetListOperatorReducer.js +++ b/redux/reducers/GetListOperatorReducer.js @@ -0,0 +1,42 @@ +import { + GET_OPERATOR_LIST_ERROR, + GET_OPERATOR_LIST_PENDING, + GET_OPERATOR_LIST_RESET, + GET_OPERATOR_LIST_SUCCESS +} from "../types/WalletType"; + +const initialState = { + loading: false, + result: null, + error: null +}; + +export default (state = initialState, action) => { + switch (action.type) { + case GET_OPERATOR_LIST_PENDING: + return { + ...state, + loading: true + } + case GET_OPERATOR_LIST_SUCCESS: + return { + ...state, + loading: false, + result: action.result.data, + error: null + } + case GET_OPERATOR_LIST_ERROR: + return { + ...state, + loading: false, + result: null, + error: action.result + } + case GET_OPERATOR_LIST_RESET: + return initialState; + + default: { + return state; + } + } +}; diff --git a/redux/reducers/index.js b/redux/reducers/index.js index 4450cf66..77dadbe4 100644 --- a/redux/reducers/index.js +++ b/redux/reducers/index.js @@ -46,6 +46,7 @@ import GetBankListReducer from "./GetBankListReducer"; import EnvoieUserWalletToBank from "./EnvoieUserWalletToBankReducer"; import GetEpargneInProgressReducer from "./GetEpargneInProgressReducer"; import GetNanoCreditUserHistoryInProgressReducer from "./GetNanoCreditUserHistoryInProgressReducer"; +import GetListOperatorReducer from "./GetListOperatorReducer"; const persistConfig = { key: 'root', @@ -100,7 +101,8 @@ const rootReducer = persistCombineReducers(persistConfig, { getBankListReducer: GetBankListReducer, envoieUserWalletToBank: EnvoieUserWalletToBank, getEpargneInProgressReducer: GetEpargneInProgressReducer, - getNanoCreditUserHistoryInProgressReducer: GetNanoCreditUserHistoryInProgressReducer + getNanoCreditUserHistoryInProgressReducer: GetNanoCreditUserHistoryInProgressReducer, + getListOperatorReducer: GetListOperatorReducer }); export default rootReducer; \ No newline at end of file diff --git a/redux/types/WalletType.js b/redux/types/WalletType.js index adcc41cc..9b5d9236 100644 --- a/redux/types/WalletType.js +++ b/redux/types/WalletType.js @@ -36,4 +36,9 @@ export const WALLET_TRANSFER_COMMISSION_RESET = 'WALLET_TRANSFER_COMMISSION_RESE export const LINK_CARD_PENDING = 'LINK_CARD_PENDING'; export const LINK_CARD_SUCCESS = 'LINK_CARD_SUCCESS'; export const LINK_CARD_ERROR = 'LINK_CARD_ERROR'; -export const LINK_CARD_RESET = 'LINK_CARD_RESET'; \ No newline at end of file +export const LINK_CARD_RESET = 'LINK_CARD_RESET'; + +export const GET_OPERATOR_LIST_PENDING = 'GET_OPERATOR_LIST_PENDING'; +export const GET_OPERATOR_LIST_SUCCESS = 'GET_OPERATOR_LIST_SUCCESS'; +export const GET_OPERATOR_LIST_ERROR = 'GET_OPERATOR_LIST_ERROR'; +export const GET_OPERATOR_LIST_RESET = 'GET_OPERATOR_LIST_RESET'; \ No newline at end of file diff --git a/screens/groupes/SuperViseurGroupeHome.js b/screens/groupes/SuperViseurGroupeHome.js index 722abe58..e11c606c 100644 --- a/screens/groupes/SuperViseurGroupeHome.js +++ b/screens/groupes/SuperViseurGroupeHome.js @@ -268,7 +268,7 @@ export default class SuperViseurGroupeHome extends BaseScreen { renderMembers(item) { - var re = moment.tz(item.created_at, 'Etc/GMT+0').format(); + var re = moment.tz(item.created_at, moment.tz.guess()).format(); re = moment(re).fromNow(); if (true) { return ( diff --git a/screens/history-request/HistoryItem.js b/screens/history-request/HistoryItem.js index 3d804c8b..bc16c91f 100644 --- a/screens/history-request/HistoryItem.js +++ b/screens/history-request/HistoryItem.js @@ -1,11 +1,7 @@ -import React, { Component, PureComponent } from 'react'; -import PropTypes from 'prop-types'; -import { StyleSheet, Text, View, FlatList, TouchableOpacity, SectionList, RefreshControl } from 'react-native'; -import { responsiveFontSize, responsiveWidth, responsiveHeight } from 'react-native-responsive-dimensions'; -import { convertDateToHumanText } from './../../utils/DateUtils'; +import React, {PureComponent} from 'react'; +import {FlatList, RefreshControl, SectionList, StyleSheet, Text, TouchableOpacity, View} from 'react-native'; +import {responsiveFontSize, responsiveWidth} from 'react-native-responsive-dimensions'; import Icon from 'react-native-vector-icons/FontAwesome5'; -var moment = require('moment-timezone') -const momentJS = require('moment') import I18n from "react-native-i18n" import 'moment/locale/fr' @@ -18,276 +14,316 @@ import 'moment/locale/en-nz' import 'moment/locale/en-gb' import DeviceInfo from 'react-native-device-info' -import { Color } from '../../config/Color'; +import {Color} from '../../config/Color'; + +var moment = require('moment-timezone') +const momentJS = require('moment') let route = require('./../../route.json'); var theme = require('./../../utils/theme.json'); export class HistoryItem extends React.Component { - constructor(props) { - super(props); - this.state = this.initState(); - } + constructor(props) { + super(props); + this.state = this.initState(); + } - statusLabel = (status) => { - switch (status) { - case '0': return I18n.t('NO_TREAT'); - case '1': return I18n.t('TREAT'); - case '2': return I18n.t('REFUSED'); - } - } + statusLabel = (status) => { + switch (status) { + case '0': + return I18n.t('NO_TREAT'); + case '1': + return I18n.t('TREAT'); + case '2': + return I18n.t('REFUSED'); + } + } - colorLabel = (status) => { - switch (status) { - case '0': return Color.accentColor; - case '1': return Color.greenColor; - case '2': return Color.redColor; - } - } + colorLabel = (status) => { + switch (status) { + case '0': + return Color.accentColor; + case '1': + return Color.greenColor; + case '2': + return Color.redColor; + } + } - descriptionLabelUserType = (user) => { - console.log("USER") - let textDescription = (this.props.selfData.montant) + ' ' + I18n.t('TO_') + ' ' + this.props.selfData.reseau; + descriptionLabelUserType = (user) => { + let textDescription = (this.props.selfData.montant) + ' ' + I18n.t('TO_') + ' ' + this.props.selfData.reseau; - switch (user.category) { - case 'geolocated': return `${I18n.t('DEMAND_TEXT_FIRST_PART_YOU')} ${textDescription}`; - case 'super': return this.props.isDemandSend ? + switch (user.category) { + case 'geolocated': + return `${I18n.t('DEMAND_TEXT_FIRST_PART_YOU')} ${textDescription}`; + case 'super': + return this.props.isDemandSend ? `${I18n.t('DEMAND_TEXT_FIRST_PART_YOU')} ${textDescription}` : `${I18n.t('THE_AGENT')} ${this.props.selfData.lastname} (${this.props.selfData.phone}) ${I18n.t('DEMAND_TEXT_FIRST_PART')} ${textDescription}`; - case 'hyper': return `${I18n.t('THE_SUPERVISOR')} ${this.props.selfData.lastname} (${this.props.selfData.phone}) ${I18n.t('DEMAND_TEXT_FIRST_PART')} ${textDescription}`; - } - } + case 'hyper': + return `${I18n.t('THE_SUPERVISOR')} ${this.props.selfData.lastname} (${this.props.selfData.phone}) ${I18n.t('DEMAND_TEXT_FIRST_PART')} ${textDescription}`; + } + } - initState() { - var textTitle = ' Transaction ' + this.props.selfData.id; - var textDescription = I18n.t('PHONE') + ' ' + this.props.selfData.phone + " " + I18n.t('DEMAND_TEXT_FIRST_PART') + ' ' + (this.props.selfData.montant) + ' ' + I18n.t('TO_') + ' '; - textDescription += this.props.selfData.reseau; - var today = new Date(); - var l = this.props.selfData.date_creation; - let t = this.props.selfData.status; - this.currentLocale = DeviceInfo.getDeviceLocale().includes("fr") ? "fr" : "en-gb"; - moment.locale(this.currentLocale); - var re = moment.tz(this.props.selfData.date_creation, 'Etc/GMT+0').format(); - re = moment(re) - return { - title: textTitle, - description: this.descriptionLabelUserType(this.props.user), - status: this.statusLabel(this.props.selfData.status), - time: re.fromNow(), - navigator: this.props.navigator, - type: t, - colorstate: this.colorLabel(t) - } - }; + initState() { + var textTitle = ' Transaction ' + this.props.selfData.id; + var textDescription = I18n.t('PHONE') + ' ' + this.props.selfData.phone + " " + I18n.t('DEMAND_TEXT_FIRST_PART') + ' ' + (this.props.selfData.montant) + ' ' + I18n.t('TO_') + ' '; + textDescription += this.props.selfData.reseau; + var today = new Date(); + var l = this.props.selfData.date_creation; + let t = this.props.selfData.status; + this.currentLocale = DeviceInfo.getDeviceLocale().includes("fr") ? "fr" : "en-gb"; + moment.locale(this.currentLocale); + var re = moment.tz(this.props.selfData.date_creation, moment.tz.guess()).format(); + re = moment(re) + return { + title: textTitle, + description: this.descriptionLabelUserType(this.props.user), + status: this.statusLabel(this.props.selfData.status), + time: re.fromNow(), + navigator: this.props.navigator, + type: t, + colorstate: this.colorLabel(t) + } + }; - render() { - console.log("ITEM RENDER", this.props.selfData) - return ( - - this.props.navigator.navigate(route.historyItemDetails, { - item: this.props.selfData, - onGoBack: () => this.props.refresh(), + render() { + console.log("ITEM RENDER", this.props.selfData) + return ( + + this.props.navigator.navigate(route.historyItemDetails, { + item: this.props.selfData, + onGoBack: () => this.props.refresh(), } + )}> + + {this.state.title} + {this.state.description} + + - - {this.state.title} - {this.state.description} - - {this.props.selfData.nombre_validation} - {this.state.time} - - - + }}>{this.statusLabel(this.props.selfData.status)} + {this.state.time} - - ) + - } + + + ) + + } } + export class HistoryItemSectionned extends PureComponent { - _keyExtractor = (item, index) => item.id; - _renderItem = ({ item }) => ( - - ); - constructor(props) { - super(props); - this.state = this.initState(); - } - render() { - return ( + _keyExtractor = (item, index) => item.id; + _renderItem = ({item}) => ( + + ); - ( - this.onPressedHeader(type)} style={{ - backgroundColor: theme.accent, - justifyContent: 'center', - alignItems: 'center', - flexDirection: 'row', flex: 1, height: 70, width: responsiveWidth(100) - }}> - - {title} - {size} demande(s) - - - - )} - style={style.listStyle} - extraData={this.state} - keyExtractor={this._keyExtractor} - renderItem={this._renderItem} - /> - ); - } - onPressedHeader(type) { - if (type === 0) { - this.setState({ istreatexpand: !this.state.istreatexpand, treat: this.state.istreatexpand ? [] : this.state.conservetreat }) - } else { - this.setState({ isuntreatexpand: !this.state.isuntreatexpand, untreat: this.state.isuntreatexpand ? [] : this.state.conserveuntreat }) + constructor(props) { + super(props); + this.state = this.initState(); + } - } - } - initState() { - let data = this.props.list + render() { + return ( - return { - conservetreat: data.filter(item => item.statut === I18n.t('TREAT')), - treat: data.filter(item => item.statut === I18n.t('TREAT')), - istreatexpand: true, - conserveuntreat: data.filter(item => item.statut !== I18n.t('TREAT')), - untreat: data.filter(item => item.statut !== I18n.t('TREAT')), - isuntreatexpand: true - } - } -} -export class HistoryListItem extends React.Component { - _keyExtractor = (item, index) => item.id; - - _onPressItem = (id: string) => { - - }; - _renderItem = ({ item }) => { - console.log('ITEM ', item); - return ( - - )}; - constructor(props) { - super(props); - this.state = this.initState(); - } - initState() { - return { - refreshing: false, - } - } - render() { - return ( - + - ); - } + ]} + renderSectionHeader={({section: {title, type, data, size, expandState}}) => ( + this.onPressedHeader(type)} style={{ + backgroundColor: theme.accent, + justifyContent: 'center', + alignItems: 'center', + flexDirection: 'row', flex: 1, height: 70, width: responsiveWidth(100) + }}> + + {title} + {size} demande(s) + + + + )} + style={style.listStyle} + extraData={this.state} + keyExtractor={this._keyExtractor} + renderItem={this._renderItem} + /> + ); + } - _onRefresh() { - this.setState({ refreshing: true }) - setTimeout(() => { this.setState({ refreshing: false }) }, 5000); - } + onPressedHeader(type) { + if (type === 0) { + this.setState({ + istreatexpand: !this.state.istreatexpand, + treat: this.state.istreatexpand ? [] : this.state.conservetreat + }) + } else { + this.setState({ + isuntreatexpand: !this.state.isuntreatexpand, + untreat: this.state.isuntreatexpand ? [] : this.state.conserveuntreat + }) + + } + } + + initState() { + let data = this.props.list + + return { + conservetreat: data.filter(item => item.statut === I18n.t('TREAT')), + treat: data.filter(item => item.statut === I18n.t('TREAT')), + istreatexpand: true, + conserveuntreat: data.filter(item => item.statut !== I18n.t('TREAT')), + untreat: data.filter(item => item.statut !== I18n.t('TREAT')), + isuntreatexpand: true + } + } +} + +export class HistoryListItem extends React.Component { + _keyExtractor = (item, index) => item.id; + + _onPressItem = (id: string) => { + + }; + _renderItem = ({item}) => { + console.log('ITEM ', item); + return ( + + ) + }; + + constructor(props) { + super(props); + this.state = this.initState(); + } + + initState() { + return { + refreshing: false, + } + } + + render() { + return ( + + } + /> + ); + } + + _onRefresh() { + this.setState({refreshing: true}) + setTimeout(() => { + this.setState({refreshing: false}) + }, 5000); + } } const style = StyleSheet.create({ - content: { - width: responsiveWidth(100), - borderBottomColor: '#FFFFFF', - flex: 1, - flexDirection: 'column', - paddingTop: 10, + content: { + width: responsiveWidth(100), + borderBottomColor: '#FFFFFF', + flex: 1, + flexDirection: 'column', + paddingTop: 10, - }, - listStyle: { - backgroundColor: 'white' - }, - bottomSeparator: { - width: responsiveWidth(100), - height: 5, - justifyContent: 'center', - alignSelf: 'center', - backgroundColor: '#EEE', - }, - title: { - color: '#000', - paddingLeft: 10, - fontSize: responsiveFontSize(2.2) - }, - description: { - fontSize: responsiveFontSize(1.8), - color: '#4f5b62', - paddingLeft: 10, + }, + listStyle: { + backgroundColor: 'white' + }, + bottomSeparator: { + width: responsiveWidth(100), + height: 5, + justifyContent: 'center', + alignSelf: 'center', + backgroundColor: '#EEE', + }, + title: { + color: '#000', + paddingLeft: 10, + fontSize: responsiveFontSize(2.2) + }, + description: { + fontSize: responsiveFontSize(1.8), + color: '#4f5b62', + paddingLeft: 10, - }, - timeContent: { - justifyContent: 'space-between', - flex: 1, - marginTop: 10, - marginBottom: 5, - flexDirection: 'row', - }, - time: { - fontWeight: 'bold', - marginRight: 20, - marginBottom: 10, - color: theme.accent, - }, - treat: { - }, + }, + timeContent: { + justifyContent: 'space-between', + flex: 1, + marginTop: 10, + marginBottom: 5, + flexDirection: 'row', + }, + time: { + fontWeight: 'bold', + marginRight: 20, + marginBottom: 10, + color: theme.accent, + }, + treat: {}, }); \ No newline at end of file diff --git a/screens/history-request/HistoryItemDetails.js b/screens/history-request/HistoryItemDetails.js index 8d3d7adf..4cfc64a5 100644 --- a/screens/history-request/HistoryItemDetails.js +++ b/screens/history-request/HistoryItemDetails.js @@ -1,588 +1,584 @@ -import React, { Component } from 'react' -import { StyleSheet, View, Text, Alert, Platform } from 'react-native' +import React, {Component} from 'react' +import {Alert, Platform, StyleSheet, Text, View} from 'react-native' import CardView from 'react-native-cardview' import Button from 'apsl-react-native-button' -import { responsiveHeight, responsiveWidth } from 'react-native-responsive-dimensions' +import {responsiveWidth} from 'react-native-responsive-dimensions' import Icons from 'react-native-vector-icons/Ionicons' -import { updateCreditDemand } from "../../webservice/HistoryRequestApi"; -import { readUser } from "../../webservice/AuthApi"; -let typesta = 0; +import {readUser} from "../../webservice/AuthApi"; import isNil from 'lodash/isNil'; +import I18n from "react-native-i18n"; +import {creditDemandResetReducer, treatCreditDemand} from '../../webservice/CreditTreatDemandApi'; +import {creditCancelResetReducer, treatCancelDemand} from '../../webservice/CreditCancelDemandeApi'; +import {getAgentNetworksList} from "../../webservice/NetworkApi"; +import {connect} from 'react-redux'; +import {bindActionCreators} from 'redux'; +import Toast from 'react-native-root-toast'; +import {Color} from '../../config/Color' +import Dialog from "react-native-dialog"; +import {FontWeight} from '../../config/typography' +import DeviceInfo from 'react-native-device-info' + +let typesta = 0; + let moment = require('moment-timezone') var colorback = 'white' -import I18n from "react-native-i18n"; -import { treatCreditDemand, creditDemandResetReducer } from '../../webservice/CreditTreatDemandApi'; -import { treatCancelDemand, creditCancelResetReducer } from '../../webservice/CreditCancelDemandeApi'; -import { getAgentNetworksList } from "../../webservice/NetworkApi"; -import Icon from "./History"; -import { Header } from "react-native-elements"; + let theme = require('./../../utils/theme.json'); -import { connect } from 'react-redux'; -import { bindActionCreators } from 'redux'; -import Toast from 'react-native-root-toast'; -import { Color } from '../../config/Color' + const route = require("./../../route.json"); -import Dialog from "react-native-dialog"; -import { FontWeight } from '../../config/typography' -import DeviceInfo from 'react-native-device-info' class HistoryItemDetails extends Component { - static navigatorStyle = { - navBarBackgroundColor: theme.accentLight, - statusBarColor: theme.accent, - navBarTextColor: '#FFFFFF', - navBarButtonColor: '#FFFFFF', - }; - static navigationOptions = ({ navigation }) => { - return { - drawerLabel: () => null, - title: isNil(navigation.getParam("item", null).item) ? - "Transaction N°" + navigation.getParam("item", { id: "-" }).id : - "Transaction N°" + navigation.getParam("item", { id: "-" }).item.id - } - }; + static navigatorStyle = { + navBarBackgroundColor: theme.accentLight, + statusBarColor: theme.accent, + navBarTextColor: '#FFFFFF', + navBarButtonColor: '#FFFFFF', + }; + static navigationOptions = ({navigation}) => { + return { + drawerLabel: () => null, + title: isNil(navigation.getParam("item", null).item) ? + "Transaction N°" + navigation.getParam("item", {id: "-"}).id : + "Transaction N°" + navigation.getParam("item", {id: "-"}).item.id + } + }; - constructor(props) { - super(props); - this.item = this.props.navigation.getParam("item", null); - if(isNil(this.props.navigation.getParam("item", null).item)) { - this.item = this.props.navigation.getParam("item", null); - } else { - this.item = this.props.navigation.getParam("item", null).item; - } - console.log('HISTORY ITEM PROPS', this.props); - let sta = '' - if (this.item.status === '1') { - typesta = 1 - colorback = '#AEAEAE' - sta = I18n.t('TREAT_DEMAND') - } else if (this.item.status === '0') { - colorback = 'green' - typesta = 2 - sta = I18n.t('ACCEPTER_DEMANDE') - } - else { - colorback = '#AEAEAE' - typesta = 2 - sta = I18n.t('REFUSED') - } + constructor(props) { + super(props); + this.item = this.props.navigation.getParam("item", null); + if (isNil(this.props.navigation.getParam("item", null).item)) { + this.item = this.props.navigation.getParam("item", null); + } else { + this.item = this.props.navigation.getParam("item", null).item; + } + console.log('HISTORY ITEM PROPS', this.props); + let sta = '' + if (this.item.status === '1') { + typesta = 1 + colorback = '#AEAEAE' + sta = I18n.t('TREAT_DEMAND') + } else if (this.item.status === '0') { + colorback = 'green' + typesta = 2 + sta = I18n.t('ACCEPTER_DEMANDE') + } else { + colorback = '#AEAEAE' + typesta = 2 + sta = I18n.t('REFUSED') + } - this.state = { - displayAmountModifyDialog: false, - statut: sta, - user: null, - networks: [], - loadingTreat: false, - loadingCancel: false, - triggerTreatmentClick: false, - triggerCancelClick: false, - color: colorback, - montant: null, - isBtnModifyAmountEnabled: false - } - readUser().then(async (user) => { - let networks = [] - networks = await getAgentNetworksList(user.agentId); - this.setState({ user: user, networks: networks.networks }) + this.state = { + displayAmountModifyDialog: false, + statut: sta, + user: null, + networks: [], + loadingTreat: false, + loadingCancel: false, + triggerTreatmentClick: false, + triggerCancelClick: false, + color: colorback, + montant: null, + isBtnModifyAmountEnabled: false + } + readUser().then(async (user) => { + let networks = [] + networks = await getAgentNetworksList(user.agentId); + this.setState({user: user, networks: networks.networks}) + }); - }); + this.currentLocale = DeviceInfo.getDeviceLocale().includes("fr") ? "fr" : "en-gb"; + moment.locale(this.currentLocale); - this.currentLocale = DeviceInfo.getDeviceLocale().includes("fr") ? "fr" : "en-gb"; - moment.locale(this.currentLocale); + } - } + isNormalInteger = (str) => { + return (/[ `!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?~]/.test(str)) ? false : true; - isNormalInteger = (str) => { - return (/[ `!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?~]/.test(str)) ? false : true; + } - } + isMontantValid = () => { + const {montant} = this.state; + if ((parseInt(montant) == 0 || montant < 0)) + return false; - isMontantValid = () => { - const { montant } = this.state; - if ((parseInt(montant) == 0 || montant < 0)) - return false; + else if (!this.isNormalInteger(montant)) + return false; - else if (!this.isNormalInteger(montant)) - return false; + else if (parseInt(montant) > parseInt(this.item.montant)) + return false; - else if (parseInt(montant) > parseInt(this.item.montant)) - return false; + else + return true; + } - else - return true; - } + displayToast = (message) => { + Toast.show(message, { + duration: Toast.durations.SHORT, + position: Toast.positions.BOTTOM, + backgroundColor: Color.primaryColor, + shadow: true, + animation: true, + hideOnPress: true, + delay: 0, + onShow: () => { + // calls on toast\`s appear animation start + }, + onShown: () => { + // calls on toast\`s appear animation end. + }, + onHide: () => { + // calls on toast\`s hide animation start. + }, + onHidden: () => { + // calls on toast\`s hide animation end. + } + }); + } - displayToast = (message) => { - Toast.show(message, { - duration: Toast.durations.SHORT, - position: Toast.positions.BOTTOM, - backgroundColor: Color.primaryColor, - shadow: true, - animation: true, - hideOnPress: true, - delay: 0, - onShow: () => { - // calls on toast\`s appear animation start - }, - onShown: () => { - // calls on toast\`s appear animation end. - }, - onHide: () => { - // calls on toast\`s hide animation start. - }, - onHidden: () => { - // calls on toast\`s hide animation end. - } - }); - } + onTreatDemand() { + if (this.item !== "1") { + this.props.creditDemandResetReducer(); + this.props.treatCreditDemand(this.item.id); + /* updateCreditDemand(this.item.phone, this.item.id).then((data) => { + this.setState({ loadingTreat: false }) + console.log(data); - onTreatDemand() { - if (this.item !== "1") { - this.props.creditDemandResetReducer(); - this.props.treatCreditDemand(this.item.id); - /* updateCreditDemand(this.item.phone, this.item.id).then((data) => { - this.setState({ loadingTreat: false }) - console.log(data); + if (data.success === 1) { + this.setState({ statut: I18n.t('TREAT_DEMAND'), color: "#AEAEAE" }) + } else { + console.log(data); + } + }) */ + } + } - if (data.success === 1) { - this.setState({ statut: I18n.t('TREAT_DEMAND'), color: "#AEAEAE" }) - } else { - console.log(data); - } - }) */ - } - } + onCancelDemand = () => { + if (this.item !== "1") { + this.props.treatCancelDemand(this.item.id); + } + } - onCancelDemand = () => { - if (this.item !== "1") { - this.props.treatCancelDemand(this.item.id); - } - } + renderPromptModifyAmountToSend = () => { + return ( + - renderPromptModifyAmountToSend = () => { - return ( - + {I18n.t('MODIFY_AMOUNT')} - {I18n.t('MODIFY_AMOUNT')} + + {I18n.t('ENTER_NEW_AMOUNT_TO_SEND')} + - - {I18n.t('ENTER_NEW_AMOUNT_TO_SEND')} - + { - { + this.setState({montant}, () => { + if (this.isMontantValid(montant)) { + this.setState({ + isBtnModifyAmountEnabled: true + }) + } else + this.setState({ + isBtnModifyAmountEnabled: false + }); - this.setState({ montant }, () => { - if (this.isMontantValid(montant)) { - this.setState({ - isBtnModifyAmountEnabled: true - }) - } - else - this.setState({ - isBtnModifyAmountEnabled: false - }); + console.log("this.isMontantValid().isValid", this.isMontantValid()); + console.log("isBtnModifyAmountEnabled", this.state.isBtnModifyAmountEnabled); + }); - console.log("this.isMontantValid().isValid", this.isMontantValid()); - console.log("isBtnModifyAmountEnabled", this.state.isBtnModifyAmountEnabled); - }); + }}/> - }} /> + this.setState({displayAmountModifyDialog: false})}/> + { + this.props.creditDemandResetReducer(); + this.props.treatCreditDemand(this.item.id, this.state.montant); + }}/> + + ) + } - this.setState({ displayAmountModifyDialog: false })} /> - { - this.props.creditDemandResetReducer(); - this.props.treatCreditDemand(this.item.id, this.state.montant); - }} /> - - ) - } + renderAlertErrorTreatOrCancelDemand = () => { + const {errorTreatDemand, resultTreatDemand, resultCancelDemand, errorCancelDemand} = this.props; - renderAlertErrorTreatOrCancelDemand = () => { - const { errorTreatDemand, resultTreatDemand, resultCancelDemand, errorCancelDemand } = this.props; - - if (errorTreatDemand !== null) { - if (typeof errorTreatDemand.data !== 'undefined') { - if (errorTreatDemand.status === 426) { - Alert.alert( - I18n.t("ERROR_TREATMENT_DEMAND"), - errorTreatDemand.data.error, - [{ - text: I18n.t('CANCEL_LABEL'), - onPress: () => { }, - style: 'cancel' - }, - { - text: I18n.t("OK"), onPress: () => { - setTimeout(() => { - this.setState({ - displayAmountModifyDialog: true - }); - }, 10); - this.props.creditDemandResetReducer(); - this.props.creditCancelResetReducer(); - } - }], - { cancelable: false } - ); - } - else { - Alert.alert( - I18n.t("ERROR_TREATMENT_DEMAND"), - errorTreatDemand.data.error, - [ - { - text: I18n.t("OK"), onPress: () => { - this.props.creditDemandResetReducer(); - this.props.creditCancelResetReducer(); - } - } - ], - { cancelable: false } - ); - } - } - } - - if (errorCancelDemand !== null) { - if (typeof errorCancelDemand.data !== 'undefined') { + if (errorTreatDemand !== null) { + if (typeof errorTreatDemand.data !== 'undefined') { + if (errorTreatDemand.status === 426) { Alert.alert( - I18n.t("ERROR_TREATMENT_DEMAND"), - errorCancelDemand.data.error, - [ - { - text: I18n.t("OK"), onPress: () => { - this.props.creditCancelResetReducer(); - this.props.creditDemandResetReducer(); - } - } - ], - { cancelable: false } + I18n.t("ERROR_TREATMENT_DEMAND"), + errorTreatDemand.data.error, + [{ + text: I18n.t('CANCEL_LABEL'), + onPress: () => { + }, + style: 'cancel' + }, + { + text: I18n.t("OK"), onPress: () => { + setTimeout(() => { + this.setState({ + displayAmountModifyDialog: true + }); + }, 10); + this.props.creditDemandResetReducer(); + this.props.creditCancelResetReducer(); + } + }], + {cancelable: false} + ); + } else { + Alert.alert( + I18n.t("ERROR_TREATMENT_DEMAND"), + errorTreatDemand.data.error, + [ + { + text: I18n.t("OK"), onPress: () => { + this.props.creditDemandResetReducer(); + this.props.creditCancelResetReducer(); + } + } + ], + {cancelable: false} + ); + } + } + } + + if (errorCancelDemand !== null) { + if (typeof errorCancelDemand.data !== 'undefined') { + Alert.alert( + I18n.t("ERROR_TREATMENT_DEMAND"), + errorCancelDemand.data.error, + [ + { + text: I18n.t("OK"), onPress: () => { + this.props.creditCancelResetReducer(); + this.props.creditDemandResetReducer(); + } + } + ], + {cancelable: false} + ) + } + } + + if (resultTreatDemand !== null) { + console.log("resultTreatDemand", resultTreatDemand); + if (resultTreatDemand.status === 200) { + this.displayToast(resultTreatDemand.response); + this.props.navigation.goBack(); + if (!isNil(this.props.navigation.state.params.onGoBack)) + this.props.navigation.state.params.onGoBack(); + this.props.creditCancelResetReducer(); + this.props.creditDemandResetReducer(); + } + } + + if (resultCancelDemand !== null) { + console.log("resultCancelDemand", resultCancelDemand); + if (resultCancelDemand.status === 200) { + + this.displayToast(resultCancelDemand.response); + this.props.navigation.goBack(); + if (!isNil(this.props.navigation.state.params.onGoBack)) + this.props.navigation.state.params.onGoBack(); + this.props.creditCancelResetReducer(); + this.props.creditDemandResetReducer(); + + } + } + + } + + renderBtn() { + const {user} = this.state; + console.warn("ITEM ITEM", this.item); + console.warn("Code Membre", user.code_membre); + if (user) { + if (this.item.code_parrain === user.code_membre) { + if (this.item.status === '1') { + return ( ) - } - } + } else if (this.item.status === '2') { + return ( + ) + } else { + return ( - if (resultTreatDemand !== null) { - console.log("resultTreatDemand", resultTreatDemand); - if (resultTreatDemand.status === 200) { - this.displayToast(resultTreatDemand.response); - this.props.navigation.goBack(); - if(!isNil(this.props.navigation.state.params.onGoBack)) - this.props.navigation.state.params.onGoBack(); - this.props.creditCancelResetReducer(); - this.props.creditDemandResetReducer(); - } - } + + + - if (resultCancelDemand !== null) { - console.log("resultCancelDemand", resultCancelDemand); - if (resultCancelDemand.status === 200) { + + + + ) + } + } + } + } - this.displayToast(resultCancelDemand.response); - this.props.navigation.goBack(); - if(!isNil(this.props.navigation.state.params.onGoBack)) - this.props.navigation.state.params.onGoBack(); - this.props.creditCancelResetReducer(); - this.props.creditDemandResetReducer(); + render() { + console.log("CREDIT MANAGE PROPS", this.props); + let ago = moment.tz(this.item.date_creation, moment.tz.guess()).format(); + ago = moment(ago); + return ( + + {this.renderPromptModifyAmountToSend()} + {(this.state.triggerTreatmentClick || this.state.triggerCancelClick) && this.renderAlertErrorTreatOrCancelDemand()} + {I18n.t('MEMBER_INFO')} + + + {this.item.phone} + + + + {this.item.code_membre} + + + + {I18n.t('DEMAND_INFO')} + + + {this.item.code_parrain} + + + + {this.item.reseau} + + + + {this.item.montant} + + + + {ago.format(" Do MMMM YYYY à HH:mm")} + + + + { - }} - disabled={true} - textStyle={styles.textbtnstyle} - > - {this.state.statut} - - ) - } - else if (this.item.status === '2') { - return ( - ) - } - - else { - return ( - - - - - - - - - ) - } - } - } - } - - render() { - console.log("CREDIT MANAGE PROPS", this.props); - let ago = moment.tz(this.item.date_creation, 'Etc/GMT+0').format(); - ago = moment(ago) - return ( - - {this.renderPromptModifyAmountToSend()} - {(this.state.triggerTreatmentClick || this.state.triggerCancelClick) && this.renderAlertErrorTreatOrCancelDemand()} - {I18n.t('MEMBER_INFO')} - - - {this.item.phone} - - - - {this.item.code_membre} - - - - {I18n.t('DEMAND_INFO')} - - - {this.item.code_parrain} - - - - {this.item.reseau} - - - - {this.item.montant} - - - - {ago.format(" Do MMMM YYYY à HH:mm")} - - - - {ago.fromNow()} - - - {this.state.user ? this.renderBtn() : null} - ) - } + }}>{ago.fromNow()} + + + {this.state.user ? this.renderBtn() : null} + ) + } } const mapStateToProps = state => ({ - loadingTreatDemand: state.creditTreatDemandReducer.loadingTreatDemand, - resultTreatDemand: state.creditTreatDemandReducer.resultTreatDemand, - errorTreatDemand: state.creditTreatDemandReducer.errorTreatDemand, + loadingTreatDemand: state.creditTreatDemandReducer.loadingTreatDemand, + resultTreatDemand: state.creditTreatDemandReducer.resultTreatDemand, + errorTreatDemand: state.creditTreatDemandReducer.errorTreatDemand, - loadingCancelDemand: state.creditCancelDemandReducer.loadingCancelDemand, - resultCancelDemand: state.creditCancelDemandReducer.resultCancelDemand, - errorCancelDemand: state.creditCancelDemandReducer.errorCancelDemand + loadingCancelDemand: state.creditCancelDemandReducer.loadingCancelDemand, + resultCancelDemand: state.creditCancelDemandReducer.resultCancelDemand, + errorCancelDemand: state.creditCancelDemandReducer.errorCancelDemand }); const mapDispatchToProps = dispatch => bindActionCreators({ - treatCreditDemand: treatCreditDemand, - creditDemandResetReducer: creditDemandResetReducer, + treatCreditDemand: treatCreditDemand, + creditDemandResetReducer: creditDemandResetReducer, - treatCancelDemand: treatCancelDemand, - creditCancelResetReducer: creditCancelResetReducer + treatCancelDemand: treatCancelDemand, + creditCancelResetReducer: creditCancelResetReducer }, dispatch); export default connect(mapStateToProps, mapDispatchToProps)(HistoryItemDetails); const styles = StyleSheet.create({ - container: { - flex: 1, - }, - btnstyle: { + container: { + flex: 1, + }, + btnstyle: {}, - }, + inputAmountText: { + ...Platform.select({ + android: { + borderBottomColor: Color.borderColor, + borderBottomWidth: 0.5, + } + }) + }, + simpleuser: { + marginLeft: responsiveWidth(2), + fontSize: 16, + color: '#3E3E3E' + }, + textbtnstyle: { + color: "white", + fontWeight: "bold", + fontSize: 18 + }, + cardcontainer1: { + justifyContent: 'space-evenly', + flex: 2, + marginRight: 3, + marginLeft: 3, - inputAmountText: { - ...Platform.select({ - android: { - borderBottomColor: Color.borderColor, - borderBottomWidth: 0.5, - } - }) - }, - simpleuser: { - marginLeft: responsiveWidth(2), - fontSize: 16, - color: '#3E3E3E' - }, - textbtnstyle: { - color: "white", - fontWeight: "bold", - fontSize: 18 - }, - cardcontainer1: { - justifyContent: 'space-evenly', - flex: 2, - marginRight: 3, - marginLeft: 3, + }, + cardcontainer: { + justifyContent: 'space-evenly', - }, - cardcontainer: { - justifyContent: 'space-evenly', - - flex: 3, - margin: 3, - } + flex: 3, + margin: 3, + } }) \ No newline at end of file diff --git a/screens/home/Home.js b/screens/home/Home.js index 2e233114..4f8a5270 100644 --- a/screens/home/Home.js +++ b/screens/home/Home.js @@ -176,8 +176,8 @@ class Home extends BaseScreen { AsyncStorage.getAllKeys((err, keys) => { AsyncStorage.multiGet(keys, (err, stores) => { stores.map(async (result, i, store) => { - /* console.warn("KEY MAP", store); - console.log("KEY SAVE " + store[i][0]); */ + console.warn("KEY MAP", store); + console.log("KEY SAVE " + store[i][0]); let key = store[i][0]; if (i === 0) { if (!_.isEqual(key, '@config:onesignalIds')) { @@ -778,9 +778,8 @@ class Home extends BaseScreen { this.makeMarkerInformation = this.makeMarkerInformation.bind(this); //IlinkEmitter.on("langueChange", this.updateLangue.bind(this)) - OneSignal.addEventListener('ids', this.onIds); - + global.appHasLoaded = true; }; /* updateLangue() { @@ -1656,7 +1655,7 @@ class Home extends BaseScreen { translucent={true} /> {/* Start here to comment */} - {/*{ + { (this.state.loadingDialog || this.props.loading) ? */} + /> {this.makeCardSearch()} {this.makeSlidingUp()} {this.makeDialogLoader()} diff --git a/screens/nano-credit/CasserEpargneUser.js b/screens/nano-credit/CasserEpargneUser.js index 02e595cd..59edcde9 100644 --- a/screens/nano-credit/CasserEpargneUser.js +++ b/screens/nano-credit/CasserEpargneUser.js @@ -1,24 +1,35 @@ -import Button from 'apsl-react-native-button'; import isEqual from 'lodash/isEqual'; import isNil from 'lodash/isNil'; -import React, { Component } from 'react'; -import { Alert, ScrollView, StyleSheet, Text, View } from 'react-native'; -import * as Animatable from 'react-native-animatable'; +import React, {Component} from 'react'; +import { + ActivityIndicator, + Alert, + ProgressBarAndroid, + ScrollView, + StyleSheet, + Text, + TouchableOpacity, + View +} from 'react-native'; import I18n from 'react-native-i18n'; -import { responsiveHeight, responsiveWidth } from 'react-native-responsive-dimensions'; -import { ProgressDialog } from 'react-native-simple-dialogs'; -import { Fumi } from 'react-native-textinput-effects'; -import FontAwesomeIcon from 'react-native-vector-icons/FontAwesome'; -import { connect } from 'react-redux'; -import { bindActionCreators } from 'redux'; -import { Color } from '../../config/Color'; -import { FontWeight, Typography } from '../../config/typography'; -import { store } from "../../redux/store"; -import { IlinkEmitter } from '../../utils/events'; -import { readUser } from '../../webservice/AuthApi'; -import { createGroupAction, createGroupReset } from '../../webservice/NanoCreditApi'; -import { isNormalInteger } from '../../utils/UtilsFunction'; -import { casserEpargneUserAction, casserEpargneUserReset } from '../../webservice/user/NanoCreditApi'; +import {responsiveHeight, responsiveWidth} from 'react-native-responsive-dimensions'; +import {ProgressDialog} from 'react-native-simple-dialogs'; +import {connect} from 'react-redux'; +import {bindActionCreators} from 'redux'; +import omit from 'lodash/omit'; +import {Color} from '../../config/Color'; +import {Typography} from '../../config/typography'; +import {IlinkEmitter} from '../../utils/events'; +import {readUser} from '../../webservice/AuthApi'; +import {getEpargneInProgressAction, getEpargneInProgressReset} from '../../webservice/NanoCreditApi'; +import {casserEpargneUserAction, casserEpargneUserReset} from '../../webservice/user/NanoCreditApi'; +import {cutStringWithoutDot, displayTransactionType, nanoCreditHistoryLabel} from "../../utils/UtilsFunction"; +import * as Utils from "../../utils/DeviceUtils"; +import Icon from 'react-native-vector-icons/MaterialCommunityIcons'; +import thousands from "thousands"; +import Dialog from "react-native-dialog"; + + let theme = require('../../utils/theme.json'); let route = require('../../route.json'); @@ -26,154 +37,472 @@ let route = require('../../route.json'); class CasserEpargneUser extends Component { - constructor(props) { - super(props); - this.state = { - password: null, - idEpargne: null, - codeGroup: null, - loading: false, - user: null, - triggerSubmitClick: false, - isSubmitClick: false, - isDataSubmit: false, - isModalConfirmVisible: false, - isGroupToModify: false, - }; + constructor(props) { + super(props); + this.state = { + password: null, + idEpargne: null, + codeGroup: null, + loading: false, + user: null, + triggerSubmitClick: false, + isSubmitClick: false, + isDataSubmit: false, + isModalConfirmVisible: false, + isGroupToModify: false, + displayModalHistory: false, + historyItemDetail: null, + isDataHasLoaded: false, + displayPasswordModal: false, + wallet: this.props.navigation.state.params.wallet, + }; + this.props.getEpargneInProgressReset(); - } + } - static navigatorStyle = { - navBarBackgroundColor: Color.primaryColor, - statusBarColor: Color.primaryDarkColor, - navBarTextColor: '#FFFFFF', - navBarButtonColor: '#FFFFFF' + static navigatorStyle = { + navBarBackgroundColor: Color.primaryColor, + statusBarColor: Color.primaryDarkColor, + navBarTextColor: '#FFFFFF', + navBarButtonColor: '#FFFFFF' - }; + }; - static navigationOptions = () => { - return { - drawerLabel: () => null, - headerTitle: I18n.t('BREAK_EPARGNE'), - headerTintColor: 'white', - headerStyle: { - backgroundColor: Color.primaryColor, - marginTop: 0, - color: 'white' - }, - headerTitleStyle: { - color: "white" - }, - title: I18n.t('BREAK_EPARGNE') - } - }; + static navigationOptions = () => { + return { + drawerLabel: () => null, + headerTitle: I18n.t('BREAK_EPARGNE'), + headerTintColor: 'white', + headerStyle: { + backgroundColor: Color.primaryColor, + marginTop: 0, + color: 'white' + }, + headerTitleStyle: { + color: "white" + }, + title: I18n.t('BREAK_EPARGNE') + } + }; - componentDidMount() { + componentDidMount() { - readUser().then((user) => { - if (user) { - if (user !== undefined) { - this.setState({ user }); + readUser().then((user) => { + if (user) { + if (user !== undefined) { + this.setState({user}); + this.props.getEpargneInProgressAction(user.id); + + } + } + }); + + } + + ckeckIfFieldIsOK(champ) { + return (isNil(champ) || isEqual(champ.length, 0)); + } + + renderBreakEpargneRespons = () => { + + const {result, error} = this.props; + + if (error !== null) { + if (typeof error.data !== 'undefined') { + Alert.alert( + I18n.t("ERROR_LABLE"), + error.data.error, + [ + { + text: I18n.t("OK"), onPress: () => { + this.props.casserEpargneUserReset(); + } + } + ], + {cancelable: false} + ) + } + } + + if (result !== null) { + if (result.response !== null) { + Alert.alert( + I18n.t("BREAK_EPARGNE_DONE"), + result.response, + [ + { + text: I18n.t("OK"), onPress: () => { + this.props.casserEpargneUserReset(); + IlinkEmitter.emit("refreshWallet"); + this.props.navigation.pop(); + } + } + + ], + {cancelable: false} + ) + } + } + } + + updateLangue() { + this.props.navigation.setParams({name: I18n.t('REFUND_NANO_CREDIT')}) + this.forceUpdate() + } + + ckeckIfFieldIsOK(champ) { + return (isNil(champ) || isEqual(champ.length, 0)); + } + + onSubmitCasserEpargne = () => { + const {idEpargne, password} = this.state; + + if (this.ckeckIfFieldIsOK(idEpargne)) + this.idEpargneAnim.shake(800); + else if (this.ckeckIfFieldIsOK(password)) + this.passwordAnim.shake(800); + else { + + this.props.casserEpargneUserAction({ + id_user: this.state.user.id, + id_epargne: this.state.idEpargne, + password: this.state.password + }, 0); + } + this.setState({ + isDataSubmit: true + }); + } + + renderLoader = () => { + return ( + + ) + } + + renderModalHistoryDetail = () => { + return ( + + + + {I18n.t('DEMAND_DETAIL')} + { + + + + + Type + + + {I18n.t(displayTransactionType(this.state.historyItemDetail.type_historique))} + + + + + {I18n.t('ID_DEMAND')} + + + {this.state.historyItemDetail.id_epargne} + + + + + {I18n.t('STATUS')} + + + {this.state.historyItemDetail.etat} + + + + + {I18n.t('DEMAND_DURATION_IN_MONTH')} + + + {this.state.historyItemDetail.duree_mois} + + + + + Type + + + {this.state.historyItemDetail.type} + + + + + {I18n.t('AMOUNT')} + + + {this.state.historyItemDetail.montant + ' ' + this.state.wallet.currency_code} + + + + + {I18n.t('AMOUNT_WITHDRAWAL')} + + + {this.state.historyItemDetail.montant_retire + ' ' + this.state.wallet.currency_code} + + + + + {I18n.t('TAXES')} + + + {this.state.historyItemDetail.taxe + ' ' + this.state.wallet.currency_code} + + + + + {I18n.t('INTERET')} + + + {this.state.historyItemDetail.interet + ' ' + this.state.wallet.currency_code} + + + + + {I18n.t('CREATION_DATE')} + + + {this.state.historyItemDetail.date_creation} + + + + + {I18n.t('FINAL_DATE')} + + + {this.state.historyItemDetail.date_fin} + + + + + {I18n.t('CASSATION_DATE')} + + + {this.state.historyItemDetail.date_cassation} + + + + + + } + { + this.setState({ + displayModalHistory: !this.state.displayModalHistory, + }); + + }}/> + + { + + this.setState({ + displayPasswordModal: !this.state.displayPasswordModal, + }); + + }}/> + + + + ); + } + + renderPasswordDialog = () => { + return ( + + + {I18n.t('PASSWORD')} + + { + this.setState({password}) + }} + secureTextEntry={true} + value={this.state.password} + onSubmitEditing={() => { + this.setState({ + displayPasswordModal: false, + displayModalHistory: false, + isDataSubmit: true + }); + this.props.refundCreditDemandUserAction({ + id_user: this.state.user.id, + id_epargne: this.state.historyItemDetail.id_epargne, + password: this.state.password + }); + }}/> + + { + this.setState({displayPasswordModal: !this.state.displayPasswordModal}); + }}/> + { + this.setState({ + displayPasswordModal: false, + displayModalHistory: false, + isDataSubmit: true + }) + this.props.casserEpargneUserAction({ + id_user: this.state.user.id, + id_epargne: this.state.historyItemDetail.id_epargne, + password: this.state.password + }); + }}/> + + ); + } + + renderNanoCreditItem = (item, index) => { + + return ( + { + this.setState({displayModalHistory: true, historyItemDetail: item}) + }} style={[styles.contentService, {borderBottomColor: Color.primaryColor}]}> + { + Object.keys(omit(item, ['id', 'id_epargne', 'date_demande', 'date_fin', 'date_remboursement_prevu', 'date_validation', 'date_cassation', 'date_remboursement', 'id_demande', 'duree_mois', 'taxe', '', 'date_fin', 'date_cassation', 'id_user', 'id_network', 'user', 'partiellement_rembourse', 'user_phone', 'interet', 'date_remboursement_prevu', 'date_remboursement', 'id_wallet_agent', 'retrait_cash', 'codeParrain', 'agent', 'montant_rembourse', ''])).map((element, i) => ( + + + + { + isEqual(element, 'montant') ? + ` ${thousands(item[element], ' ')}` + : isEqual(element, 'date_creation') ? + cutStringWithoutDot(item[element], 16) + : item[element] + } + + + )) + } + + ); + } + + renderNanoCreditList = () => { + const {errorNanoCreditHistory, resultNanoCreditHistory} = this.props; + if (errorNanoCreditHistory !== null) { + if (typeof errorNanoCreditHistory.data !== 'undefined') { + return ( + + {errorNanoCreditHistory.data.error} + + ) + } else { + return ( + + {errorNanoCreditHistory} + + ) + } + } + + + if (resultNanoCreditHistory !== null) { + if (resultNanoCreditHistory.response !== null) { + return ( + Array.isArray(resultNanoCreditHistory.response) && (resultNanoCreditHistory.response.length) > 0 ? + ( + <> + + { + nanoCreditHistoryLabel().map((item, index) => ( + + + + {I18n.t(item.label)} + + + )) + } + + { + resultNanoCreditHistory.response.map((item, index) => ( + this.renderNanoCreditItem(item, index) + )) + } + + ) : + ( + + {I18n.t('NO_NANO_CREDIT')} + + ) + ) + } + } + } + + renderNanoCreditHistory = () => { + return ( + + + { + this.props.loadingNanoCreditHistory ? + ( + + {Platform.OS === 'android' + ? + ( + <> + + {I18n.t('LOADING_DOTS')} + + + ) : + <> + + {I18n.t('LOADING_DOTS')} + + } + + ) : this.renderNanoCreditList() + + } + + ); + } + + + render() { + return ( + <> + {(this.props.loading || this.props.loadingGetCommission || this.props.loadingNanoCreditHistory) && this.renderLoader()} + {this.state.isDataSubmit && this.renderBreakEpargneRespons()} + {this.state.displayModalHistory && this.renderModalHistoryDetail()} + {this.state.displayPasswordModal && this.renderPasswordDialog()} + + + + + {I18n.t('SAVINGS_LIST')} + + + + { + this.renderNanoCreditHistory() } - } - }); - } - - ckeckIfFieldIsOK(champ) { - return (isNil(champ) || isEqual(champ.length, 0)); - } - - renderBreakEpargneRespons = () => { - - const { result, error } = this.props; - - if (error !== null) { - if (typeof error.data !== 'undefined') { - Alert.alert( - I18n.t("ERROR_LABLE"), - error.data.error, - [ - { - text: I18n.t("OK"), onPress: () => { - this.props.casserEpargneUserReset(); - } - } - ], - { cancelable: false } - ) - } - } - - if (result !== null) { - if (result.response !== null) { - Alert.alert( - I18n.t("BREAK_EPARGNE_DONE"), - result.response, - [ - { - text: I18n.t("OK"), onPress: () => { - this.props.casserEpargneUserReset(); - IlinkEmitter.emit("refreshWallet"); - this.props.navigation.pop(); - } - } - - ], - { cancelable: false } - ) - } - } - } - - updateLangue() { - this.props.navigation.setParams({ name: I18n.t('REFUND_NANO_CREDIT') }) - this.forceUpdate() - } - - ckeckIfFieldIsOK(champ) { - return (isNil(champ) || isEqual(champ.length, 0)); - } - - onSubmitCasserEpargne = () => { - const { idEpargne, password } = this.state; - - if (this.ckeckIfFieldIsOK(idEpargne)) - this.idEpargneAnim.shake(800); - else if (this.ckeckIfFieldIsOK(password)) - this.passwordAnim.shake(800); - else { - - this.props.casserEpargneUserAction({ - id_user: this.state.user.id, - id_epargne: this.state.idEpargne, - password: this.state.password - }, 0); - } - this.setState({ - isDataSubmit: true - }); - } - - - renderLoader = () => { - return ( - - ) - } - - render() { - return ( - <> - {(this.props.loading || this.props.loadingGetCommission) && this.renderLoader()} - {this.state.isDataSubmit && this.renderBreakEpargneRespons()} - - - {I18n.t('DEMAND_INFO')} + {/*{I18n.t('DEMAND_INFO')} { idEpargneAnim = comp }}> { this.onSubmitCasserEpargne(); }}> - {this.state.isGroupToModify ? I18n.t('MODIFY') : I18n.t('SUBMIT_LABEL')} - - - ) - } + {this.state.isGroupToModify ? I18n.t('MODIFY') : I18n.t('SUBMIT_LABEL')}*/} + + + ) + } } const maptStateToProps = state => ({ - loading: state.casserEpargneUserReducer.loading, - result: state.casserEpargneUserReducer.result, - error: state.casserEpargneUserReducer.error, + loading: state.casserEpargneUserReducer.loading, + result: state.casserEpargneUserReducer.result, + error: state.casserEpargneUserReducer.error, + + errorNanoCreditHistory: state.getEpargneInProgressReducer.error, + resultNanoCreditHistory: state.getEpargneInProgressReducer.result, + loadingNanoCreditHistory: state.getEpargneInProgressReducer.loading, }); const mapDispatchToProps = dispatch => bindActionCreators({ - casserEpargneUserAction, - casserEpargneUserReset, + casserEpargneUserAction, + casserEpargneUserReset, + getEpargneInProgressAction, + getEpargneInProgressReset }, dispatch); export default connect(maptStateToProps, mapDispatchToProps)(CasserEpargneUser); const styles = StyleSheet.create({ - container: { - flex: 1, - backgroundColor: Color.primaryDarkColor, - }, - textbtnvalide: { - color: 'white', - fontWeight: 'bold' - }, - bigtitle: { - color: 'white', - fontSize: 20, - flex: 1, - fontWeight: 'bold', - textAlign: 'center', - margin: 20, - }, - blockView: { - paddingVertical: 10, - borderBottomWidth: 1 - }, - subbigtitle: { - color: 'white', - fontSize: 17, - textAlign: 'center', - margin: 5, - }, - btnvalide: { - marginTop: 20, - marginLeft: 20, - marginRight: 20, - borderColor: 'transparent', - backgroundColor: Color.accentLightColor, - height: 52 - }, - btnSubmit: { - marginTop: 20, - borderColor: 'transparent', - backgroundColor: Color.accentLightColor, - height: 52, - width: "30%", - marginLeft: 20, - marginRight: 20, - }, - input: { - height: 60, - marginTop: responsiveHeight(2), - marginLeft: responsiveWidth(5), - marginRight: responsiveWidth(5), - borderRadius: 5, - } + container: { + flex: 1, + backgroundColor: Color.containerBackgroundColor, + paddingHorizontal: 20 + }, + textbtnvalide: { + color: 'white', + fontWeight: 'bold' + }, + bigtitle: { + color: 'white', + fontSize: 20, + flex: 1, + fontWeight: 'bold', + textAlign: 'center', + margin: 20, + }, + blockView: { + paddingVertical: 10, + borderBottomWidth: 1 + }, + subbigtitle: { + color: 'white', + fontSize: 17, + textAlign: 'center', + margin: 5, + }, + btnvalide: { + marginTop: 20, + marginLeft: 20, + marginRight: 20, + borderColor: 'transparent', + backgroundColor: Color.accentLightColor, + height: 52 + }, + btnSubmit: { + marginTop: 20, + borderColor: 'transparent', + backgroundColor: Color.accentLightColor, + height: 52, + width: "30%", + marginLeft: 20, + marginRight: 20, + }, + input: { + height: 60, + marginTop: responsiveHeight(2), + marginLeft: responsiveWidth(5), + marginRight: responsiveWidth(5), + borderRadius: 5, + }, + circlePoint: { + width: 50, + height: 50, + borderRadius: 25, + marginRight: 5, + alignItems: 'center', + justifyContent: 'center', + }, + checkDefault: { + flexDirection: "row", + justifyContent: "space-between", + alignItems: "center", + borderBottomWidth: 1, + paddingVertical: 10, + marginTop: 5 + }, + transactionContainer: { + flexDirection: 'row', + paddingTop: 10, + }, + containerTouch: { + flex: 1, + flexDirection: 'row', + alignItems: 'center', + shadowColor: Color.borderColor, + borderColor: Color.borderColor, + borderWidth: 0.5, + shadowOffset: {width: 1.5, height: 1.5}, + shadowOpacity: 1.0, + elevation: 5, + borderRadius: 10, + backgroundColor: Color.cardBackgroundColor + }, + + contain: { + flexDirection: 'row', + justifyContent: 'space-between', + }, + imageBanner: { + marginTop: 15, + marginLeft: 5, + width: Utils.scaleWithPixel(30), + height: Utils.scaleWithPixel(30) + }, + content: { + height: Utils.scaleWithPixel(65), + paddingHorizontal: 10, + justifyContent: 'space-between', + alignItems: 'flex-start', + flex: 1, + }, + contentTitle: { + paddingTop: 12, + }, + contentService: { + paddingVertical: 10, + borderBottomWidth: 0.5, + flexDirection: 'row', + flexWrap: 'wrap', + justifyContent: 'space-between', + }, + containField: { + padding: 10, + marginBottom: 20, + borderWidth: 0.5, + shadowOffset: {width: 1.5, height: 1.5}, + shadowOpacity: 1.0, + elevation: 5, + flexDirection: "row", + height: 140, + borderRadius: 10 + }, + paymentItem: { + flexDirection: "row", + alignItems: "center", + justifyContent: "space-between", + borderBottomWidth: 1, + paddingVertical: 5, + width: responsiveWidth(100), + marginBottom: 15 + }, + iconContent: { + width: 60, + marginRight: 10, + alignItems: "center" + }, + contentLeftItem: { + flex: 1, + paddingTop: 40, + paddingLeft: 10, + paddingRight: 10, + alignItems: "center" + }, }); \ No newline at end of file diff --git a/screens/nano-credit/DemandGroupNanoCredit.js b/screens/nano-credit/DemandGroupNanoCredit.js index 2fd88578..d572963f 100644 --- a/screens/nano-credit/DemandGroupNanoCredit.js +++ b/screens/nano-credit/DemandGroupNanoCredit.js @@ -174,7 +174,7 @@ class DemandValidationGroup extends React.Component { } renderDemandItem = (item) => { - let dateFormat = moment.tz(item.date_creation_demande, 'Etc/GMT+0').format(); + let dateFormat = moment.tz(item.date_creation_demande, moment.tz.guess()).format(); dateFormat = moment(dateFormat).fromNow(); return ( diff --git a/screens/nano-credit/DemandGroupNanoCreditDetail.js b/screens/nano-credit/DemandGroupNanoCreditDetail.js index deadb68e..a1a1261c 100644 --- a/screens/nano-credit/DemandGroupNanoCreditDetail.js +++ b/screens/nano-credit/DemandGroupNanoCreditDetail.js @@ -312,8 +312,8 @@ class DemandGroupNanoCreditDetail extends Component { renderDetail = () => { const { resultGetUniqueDemand } = this.props; - let ago = moment.tz(resultGetUniqueDemand.response.date_creation_groupe, 'Etc/GMT+0').format(); - let dateDemand = moment.tz(resultGetUniqueDemand.response.date_creation_demande, 'Etc/GMT+0').format(); + let ago = moment.tz(resultGetUniqueDemand.response.date_creation_groupe, moment.tz.guess()).format(); + let dateDemand = moment.tz(resultGetUniqueDemand.response.date_creation_demande, moment.tz.guess()).format(); ago = moment(ago); dateDemand = moment(dateDemand); diff --git a/screens/nano-credit/MyNanoCreditGroup.js b/screens/nano-credit/MyNanoCreditGroup.js index 35f84205..83c689f4 100644 --- a/screens/nano-credit/MyNanoCreditGroup.js +++ b/screens/nano-credit/MyNanoCreditGroup.js @@ -268,7 +268,7 @@ class MyNanoCreditGroup extends Component { renderDetail = () => { const { resultGetUniqueDemand } = this.props; - let ago = moment.tz(resultGetUniqueDemand.response.date_creation, 'Etc/GMT+0').format(); + let ago = moment.tz(resultGetUniqueDemand.response.date_creation, moment.tz.guess()).format(); ago = moment(ago) return ( ( - - ), - }; - constructor(props) { - super(props); - this.currentLocale = DeviceInfo.getDeviceLocale().includes("fr") ? "fr" : "en-gb"; - moment.locale(this.currentLocale); + static navigatorStyle = { + navBarBackgroundColor: theme.primaryDark, + navBarTextColor: 'white', + statusBarBackgroundColor: theme.primaryDarkAdvanced, + navBarButtonColor: 'white', + statusBarTextColorScheme: 'light', + }; + static navigationOptions = { + headerTitle: I18n.t('NOTIFICATIONS'), + drawerIcon: ({tintColor}) => ( + + ), + }; - } + constructor(props) { + super(props); + this.currentLocale = DeviceInfo.getDeviceLocale().includes("fr") ? "fr" : "en-gb"; + moment.locale(this.currentLocale); - updateLangue() { - this.props.navigation.setParams({ name: I18n.t('WALLET') }) - this.forceUpdate() - } + } - componentDidMount() { + updateLangue() { + this.props.navigation.setParams({name: I18n.t('WALLET')}) + this.forceUpdate() + } - readUser().then((user) => { - if (user) { - if (user !== undefined) { - if (user.category !== undefined) { - if (user.category === "super" || user.category === "geolocated" || user.category === "hyper") { - this.props.getNotificationAction({ - agent_code: user.code_membre - }); - } - } - else { - this.props.getNotificationAction({ - user_code: user.user_code - }); - } + componentDidMount() { + + readUser().then((user) => { + if (user) { + if (user !== undefined) { + if (user.category !== undefined) { + if (user.category === "super" || user.category === "geolocated" || user.category === "hyper") { + this.props.getNotificationAction({ + agent_code: user.code_membre + }); + } + } else { + this.props.getNotificationAction({ + user_code: user.user_code + }); } - } - }); + } + } + }); - } + } - getCreationDateToHumanFormat = (date) => { - let re = moment.tz(date, 'Etc/GMT+0').format(); - return moment(re).fromNow(); - } + getCreationDateToHumanFormat = (date) => { + let re = moment.tz(date, moment.tz.guess()).format(); + console.log("Human date", moment(re).fromNow()); + return moment(re).fromNow(); + } - getNotificationTypeIcon = (notification) => { - switch (notification) { - case 'creation': return 'account-multiple-plus'; - case 'demandeSuppressionGroupe': return 'account-multiple-minus'; - case 'adhesion': return 'account-multiple-check' - case 'nano_credit': return 'cash' - default: return 'account-multiple' - } - } + getNotificationTypeIcon = (notification) => { + switch (notification) { + case 'creation': + return 'account-multiple-plus'; + case 'demandeSuppressionGroupe': + return 'account-multiple-minus'; + case 'adhesion': + return 'account-multiple-check' + case 'nano_credit': + return 'cash' + default: + return 'account-multiple' + } + } - getDemandTypeColor = (type) => { - switch (type) { - case 'creation': return 'green'; - case 'suppression': return 'red'; - case 'adhesion': return Color.primaryColor - case 'nano_credit': return Color.primaryColor - default: - return Color.primaryColor - } - } + getDemandTypeColor = (type) => { + switch (type) { + case 'creation': + return 'green'; + case 'suppression': + return 'red'; + case 'adhesion': + return Color.primaryColor + case 'nano_credit': + return Color.primaryColor + default: + return Color.primaryColor + } + } - renderNotificationItem = (item) => { - return ( + renderNotificationItem = (item) => { + return ( - { - switch (item.data.screen) { - case 'historyItemDetails': - this.props.navigation.navigate(item.data.screen, { - item: item.data.data - }); - break; - - default: - this.props.navigation.navigate(item.data.screen, { - id: item.data.data.id - }); - break; - } + { + switch (item.data.screen) { + case 'historyItemDetails': + this.props.navigation.navigate(item.data.screen, { + item: item.data.data + }); + break; - }}> - - {/* + default: + this.props.navigation.navigate(item.data.screen, { + id: item.data.data.id + }); + break; + } + + }}> + + {/* */} - - {item.message} - - {this.getCreationDateToHumanFormat(item.date)} - - + + {item.message} + + {this.getCreationDateToHumanFormat(item.date)} + - - ) - } + + + ) + } - renderNotificationList = () => { + renderNotificationList = () => { - const { result, error } = this.props; - if (error !== null) { - if (typeof error.data !== 'undefined') { - return ( - - {error.data.error} - - ) - } - else { - return ( - - {error} - - ) - } - } - if (result !== null) { - if (result.response !== null) { - return ( - Array.isArray(result.response) && (result.response.length) > 0 ? - ( - { - result.response.map((item) => ( - this.renderNotificationItem(item) - )) - } - ) : - ( - + const {result, error} = this.props; + if (error !== null) { + if (typeof error.data !== 'undefined') { + return ( + + {error.data.error} + + ) + } else { + return ( + + {error} + + ) + } + } + if (result !== null) { + if (result.response !== null) { + return ( + Array.isArray(result.response) && (result.response.length) > 0 ? + ( + { + result.response.map((item) => ( + this.renderNotificationItem(item) + )) + } + ) : + ( + - - {I18n.t('NO_NOTIFICATION')} - - ) - ) - } - } + + {I18n.t('NO_NOTIFICATION')} + + ) + ) + } + } - } + } - renderLoader = () => { - return ( - - {Platform.OS === 'android' - ? - ( - <> - - {I18n.t('LOADING_DOTS')} + renderLoader = () => { + return ( + + {Platform.OS === 'android' + ? + ( + <> + + {I18n.t('LOADING_DOTS')} - - ) : - <> - - {I18n.t('LOADING_DOTS')} - - } - - ) - } + + ) : + <> + + {I18n.t('LOADING_DOTS')} + + } + + ) + } - render() { - return ( - - + render() { + return ( + + - {this.props.loading ? - this.renderLoader() : - this.renderNotificationList() - } + {this.props.loading ? + this.renderLoader() : + this.renderNotificationList() + } - ) - } + ) + } } const mapStateToProps = state => ({ - loading: state.getNotificationReducer.loading, - result: state.getNotificationReducer.result, - error: state.getNotificationReducer.error + loading: state.getNotificationReducer.loading, + result: state.getNotificationReducer.result, + error: state.getNotificationReducer.error }); const mapDispatchToProps = dispatch => bindActionCreators({ - getNotificationAction: getNotificationAction, - getNotificationReset: getNotificationReset + getNotificationAction: getNotificationAction, + getNotificationReset: getNotificationReset }, dispatch); export default connect(mapStateToProps, mapDispatchToProps)(Notifications); const styles = StyleSheet.create({ - container: { - flex: 1, - backgroundColor: 'white' - }, - text: { - fontSize: 17, - fontWeight: 'bold', - }, - lottie: { - width: 248, - height: 248 - }, - paymentItem: { - flexDirection: "row", - alignItems: "center", - justifyContent: "space-between", - borderBottomWidth: 1, - paddingVertical: 5, - width: "100%", - marginBottom: 15 - }, - iconContent: { - width: 60, - marginRight: 10, - alignItems: "center" - } + container: { + flex: 1, + backgroundColor: 'white' + }, + text: { + fontSize: 17, + fontWeight: 'bold', + }, + lottie: { + width: 248, + height: 248 + }, + paymentItem: { + flexDirection: "row", + alignItems: "center", + justifyContent: "space-between", + borderBottomWidth: 1, + paddingVertical: 5, + width: "100%", + marginBottom: 15 + }, + iconContent: { + width: 60, + marginRight: 10, + alignItems: "center" + } }) \ No newline at end of file diff --git a/screens/optionMenu/OptionsMenu.js b/screens/optionMenu/OptionsMenu.js index 620c21ba..c73d0364 100644 --- a/screens/optionMenu/OptionsMenu.js +++ b/screens/optionMenu/OptionsMenu.js @@ -8,7 +8,7 @@ import React, {Component} from 'react'; -import {Alert, StyleSheet, Text, TouchableOpacity, View} from 'react-native'; +import {Alert, AsyncStorage, StyleSheet, Text, TouchableOpacity, View} from 'react-native'; import Icon from 'react-native-vector-icons/Ionicons'; import {responsiveFontSize, responsiveHeight, responsiveWidth} from 'react-native-responsive-dimensions'; import {primary, primaryDarkAdvanced} from './../../utils/theme.json'; @@ -582,7 +582,7 @@ export default class OptionsMenu extends Component { text: I18n.t('YES'), onPress: () => { disconnect().then(() => { IlinkEmitter.emit("userdisconnect"); - //AsyncStorage.clear(); + AsyncStorage.removeItem('@config:onesignalIds'); this.props.navigation.navigate("Auth"); }) } diff --git a/screens/wallet/OperateurOptionSelect.js b/screens/wallet/OperateurOptionSelect.js index c20db10a..36e2041c 100644 --- a/screens/wallet/OperateurOptionSelect.js +++ b/screens/wallet/OperateurOptionSelect.js @@ -23,6 +23,7 @@ import {bindActionCreators} from "redux"; import {getBankListAction, getBankListReset} from "../../webservice/BankApi"; import {store} from "../../redux/store"; import {readUser} from "../../webservice/AuthApi"; +import {getOperatorListAction, getOperatorListReset} from "../../webservice/WalletApi"; const route = require('../../route.json'); let slugify = require('slugify'); @@ -37,19 +38,32 @@ class OperateurOptionSelect extends Component { options: this.props.navigation.state.params.optionSelect.options, title: this.props.navigation.state.params.optionSelect.title, subTitle: this.props.navigation.state.params.optionSelect.subTitle, + operatorType: this.props.navigation.state.params.optionSelect.operatorType, wallet: store.getState().walletDetailReducer.result.response } this.props.getBankListReset(); + this.props.getOperatorListReset(); readUser().then((user) => { if (user) { if (user !== undefined) { - if (user.category === undefined) { - this.props.getBankListAction(this.state.wallet.id_wallet_network); + if (this.state.options.length > 0) { + if (user.category === undefined) + this.props.getOperatorListAction(this.state.operatorType, this.state.wallet.id_wallet_network) + else { + if (user.category === 'geolocated') + this.props.getOperatorListAction(this.state.operatorType, this.state.wallet.id_network) + } } else { - if (user.category === 'geolocated') - this.props.getBankListAction(this.state.wallet.id_network); + if (user.category === undefined) { + + this.props.getOperatorListAction('bank', this.state.wallet.id_wallet_network) + } else { + if (user.category === 'geolocated') + this.props.getOperatorListAction('bank', this.state.wallet.id_network) + } } + this.setState({user}); } } @@ -78,11 +92,20 @@ class OperateurOptionSelect extends Component { }); redirectToRoute = (item) => { - this.props.navigation.push(item.screen, { - title: item.title, - type: item.type - }); + console.log("Redirection"); + if (this.state.options.length > 0) { + + this.props.navigation.push(this.state.options[0].screen, { + title: this.state.options[0].title, + type: this.state.options[0].type + }); + } else { + if (this.state.user.category === 'geolocated') + this.props.navigation.navigate(route.envoieWalletToBankAgent, {bank: item}); + else + this.props.navigation.navigate(route.envoieWalletToBankUser, {bank: item}); + } } renderLoader = () => { @@ -113,10 +136,7 @@ class OperateurOptionSelect extends Component { key={index} style={[styles.paymentItem, {borderBottomColor: Color.borderColor}]} onPress={() => { - if (this.state.user.category === 'geolocated') - this.props.navigation.navigate(route.envoieWalletToBankAgent, {bank: item}); - else - this.props.navigation.navigate(route.envoieWalletToBankUser, {bank: item}); + this.redirectToRoute(item); }}> @@ -161,7 +181,7 @@ class OperateurOptionSelect extends Component { ) : ( - {I18n.t('NO_BANK_AVAILABLE')} + {I18n.t('NO_OPERATOR_AVAILABLE')} ) ) @@ -240,14 +260,11 @@ class OperateurOptionSelect extends Component { { - this.state.options.length > 0 ? - this.renderList() - : - this.props.loading ? - this.renderLoader() : - this.props.result != null ? - this.renderBankList() : - null + this.props.loading ? + this.renderLoader() : + this.props.result != null ? + this.renderBankList() : + null } @@ -259,14 +276,18 @@ class OperateurOptionSelect extends Component { } const mapStateToProps = state => ({ - loading: state.getBankListReducer.loading, - result: state.getBankListReducer.result, - error: state.getBankListReducer.error, + loading: state.getListOperatorReducer.loading, + result: state.getListOperatorReducer.result, + error: state.getListOperatorReducer.error, + + }); const mapDispatchToProps = dispatch => bindActionCreators({ getBankListAction, - getBankListReset + getBankListReset, + getOperatorListAction, + getOperatorListReset }, dispatch); export default connect(mapStateToProps, mapDispatchToProps)(OperateurOptionSelect); diff --git a/screens/wallet/PaiementFacture.js b/screens/wallet/PaiementFacture.js index 4163b4e7..0a19094f 100644 --- a/screens/wallet/PaiementFacture.js +++ b/screens/wallet/PaiementFacture.js @@ -1,133 +1,139 @@ -import React, { Component } from 'react'; -import { StatusBar, StyleSheet, View } from 'react-native'; +import React, {Component} from 'react'; +import {StatusBar, StyleSheet, View} from 'react-native'; import I18n from 'react-native-i18n'; -import { Appbar, Provider } from 'react-native-paper'; +import {Appbar, Provider} from 'react-native-paper'; import Icon from 'react-native-vector-icons/MaterialCommunityIcons'; -import { Color } from '../../config/Color'; -import { IlinkEmitter } from "../../utils/events"; +import {Color} from '../../config/Color'; +import {IlinkEmitter} from "../../utils/events"; import OutlineTextInput from '../../components/OutlineTextInput'; import CustomButton from '../../components/CustomButton'; -import { ScrollView } from 'react-native-gesture-handler'; +import {ScrollView} from 'react-native-gesture-handler'; + const route = require('../../route.json'); let slugify = require('slugify'); export default class PaiementFacture extends Component { - constructor(props) { - super(props); - IlinkEmitter.on("langueChange", this.updateLangue.bind(this)); - this.state = { - title: this.props.navigation.state.params.title, - type: this.props.navigation.state.params.type, - } - console.log("Paiement facture props", this.props); + constructor(props) { + super(props); + IlinkEmitter.on("langueChange", this.updateLangue.bind(this)); + this.state = { + title: this.props.navigation.state.params.title, + type: this.props.navigation.state.params.type, + } + console.log("Paiement facture props", this.props); - } + } - updateLangue() { - this.props.navigation.setParams({ name: I18n.t('WALLET') }) - this.forceUpdate(); - } + updateLangue() { + this.props.navigation.setParams({name: I18n.t('WALLET')}) + this.forceUpdate(); + } - static navigationOptions = ({ navigation }) => ({ - header: null, - headerMode: 'none', - headerTitle: null, - activeColor: '#f0edf6', - inactiveColor: '#3e2465', - barStyle: { backgroundColor: '#694fad' }, - drawerLabel: I18n.t('CREDIT_MANAGE'), - drawerIcon: ({ tintColor }) => ( - ) - }); + static navigationOptions = ({navigation}) => ({ + header: null, + headerMode: 'none', + headerTitle: null, + activeColor: '#f0edf6', + inactiveColor: '#3e2465', + barStyle: {backgroundColor: '#694fad'}, + drawerLabel: I18n.t('CREDIT_MANAGE'), + drawerIcon: ({tintColor}) => ( + ) + }); - renderLabel = () => { - const { type } = this.state; + renderLabel = () => { + const {type} = this.state; - switch (type) { - case 'PAIEMENT_ECOLE': - return I18n.t('IDENTIFIANT_ETUDIANT') - case 'PAIEMENT_EAU_ELECTRICITE': - return I18n.t('NUMERO_ABONNE') - case 'PAIEMENT_CREDIT_TELEPHONE': - return I18n.t('PHONE_NUMBER') - case 'PAIEMENT_ABONNEMENT_TV': - return I18n.t('NUMERO_ABONNE') + switch (type) { + case 'PAIEMENT_ECOLE': + return I18n.t('IDENTIFIANT_ETUDIANT') + case 'PAIEMENT_EAU': + return I18n.t('NUMERO_ABONNE') + case 'PAIEMENT_ELECTRICITE': + return I18n.t('NUMERO_ABONNE') + case 'PAIEMENT_CREDIT_TELEPHONE': + return I18n.t('PHONE_NUMBER') + case 'PAIEMENT_ABONNEMENT_TV': + return I18n.t('NUMERO_ABONNE') - default: - break; - } - } + default: + break; + } + } - render() { - return ( - - + render() { + return ( + + - + - - { this.props.navigation.pop() }} - /> - - + + { + this.props.navigation.pop() + }} + /> + + - + - + - - - + + + - - - + + + - - { }}> - {I18n.t('VALIDATE')} - - + + { + }}> + {I18n.t('VALIDATE')} + + - + - - - - ); - } + + + + ); + } } const styles = StyleSheet.create({ - container: { - flex: 1, - backgroundColor: Color.containerBackgroundColor - }, + container: { + flex: 1, + backgroundColor: Color.containerBackgroundColor + }, }); \ No newline at end of file diff --git a/screens/wallet/WalletDetail.js b/screens/wallet/WalletDetail.js index 18aba996..0fa37c82 100644 --- a/screens/wallet/WalletDetail.js +++ b/screens/wallet/WalletDetail.js @@ -252,7 +252,7 @@ class WalletDetail extends Component { } getCreationDateToHumanFormat = (date) => { - let re = moment.tz(date, 'Etc/GMT+0').format(); + let re = moment.tz(date, moment.tz.guess()).format(); return moment(re).fromNow(); } diff --git a/screens/wallet/WalletDetailUser.js b/screens/wallet/WalletDetailUser.js index 1377d53a..c5b848ea 100644 --- a/screens/wallet/WalletDetailUser.js +++ b/screens/wallet/WalletDetailUser.js @@ -106,14 +106,25 @@ class WalletDetailUser extends Component { this.props.getWalletDetailActivated(this.props.navigation.state.params.userId, null); this.props.getUserIdentificationResetAction(); + readUser().then((user) => { + console.log("WIIL FOCUS CALL 1"); + if (user) { + if (user !== undefined) { + this.setState({user}); + this.props.getUserIdentificationAction(user.phone); + this.props.getWalletTransactionHistoryUser(user.id); + } + } + }); + this.willFocus = this.props.navigation.addListener( 'willFocus', payload => { + console.log("WIIL FOCUS CALL 2"); readUser().then((user) => { if (user) { if (user !== undefined) { this.setState({user}); - this.props.getUserIdentificationAction(user.phone); this.props.getWalletTransactionHistoryUser(user.id); } } @@ -191,7 +202,7 @@ class WalletDetailUser extends Component { } getCreationDateToHumanFormat = (date) => { - let re = moment.tz(date, 'Etc/GMT+0').format(); + let re = moment.tz(date, moment.tz.guess()).format(); return moment(re).fromNow(); } diff --git a/utils/UtilsFunction.js b/utils/UtilsFunction.js index 7132c601..a66c1359 100644 --- a/utils/UtilsFunction.js +++ b/utils/UtilsFunction.js @@ -369,11 +369,11 @@ export const optionRetraitUserScreen = { screen: route.retraitCarteVersWalletUser, icon: 'credit-card', title: 'WITHDRAWAL_CARD_TO_WALLET', - }, { + }, { screen: '', icon: 'credit-card', title: 'WITHDRAWAL_BANK_TO_WALLET', - }, { + }, { screen: '', icon: 'credit-card', title: 'WITHDRAWAL_BANK_TO_CASH', @@ -401,13 +401,13 @@ export const optionDepotUserScreen = { icon: 'credit-card', title: 'DEPOSIT_TO_CARD', }, - { - type: 'WALLET_TO_BANK', - screen: route.operateurOptionSelect, - icon: 'bank-transfer-in', - title: 'DEPOSIT_TO_BANK', - subScreenOption: optionWalletToBank - }, + { + type: 'WALLET_TO_BANK', + screen: route.operateurOptionSelect, + icon: 'bank-transfer-in', + title: 'DEPOSIT_TO_BANK', + subScreenOption: optionWalletToBank + }, ] } @@ -515,9 +515,54 @@ export const optionNanoCreditAgentScreen = { ] } -export const optionPaiementEauElectricite = { +export const optionPaiementEau = { title: 'PAIEMENT_FACTURE', subTitle: 'CHOOSE_OPERATOR', + operatorType: 'water', + options: [ + { + type: 'PAIEMENT_EAU', + screen: route.paiementFacture, + icon: 'http://test.ilink-app.com:8080/mobilebackend/datas/img/network/ilink-world-logo.png', + title: 'Opérateur eau-électricité 1', + }, + { + type: 'PAIEMENT_EAU', + screen: route.paiementFacture, + icon: 'http://test.ilink-app.com:8080/mobilebackend/datas/img/network/ilink-world-logo.png', + title: 'Opérateur eau-électricité 2', + }, + { + type: 'PAIEMENT_EAU', + screen: route.paiementFacture, + icon: 'http://test.ilink-app.com:8080/mobilebackend/datas/img/network/ilink-world-logo.png', + title: 'Opérateur eau-électricité 3', + }, + { + type: 'PAIEMENT_EAU', + screen: route.paiementFacture, + icon: 'http://test.ilink-app.com:8080/mobilebackend/datas/img/network/ilink-world-logo.png', + title: 'Opérateur eau-électricité 4', + }, + { + type: 'PAIEMENT_EAU', + screen: route.paiementFacture, + icon: 'http://test.ilink-app.com:8080/mobilebackend/datas/img/network/ilink-world-logo.png', + title: 'Opérateur eau-électricité 5', + }, + { + type: 'PAIEMENT_EAU', + screen: route.paiementFacture, + icon: 'http://test.ilink-app.com:8080/mobilebackend/datas/img/network/ilink-world-logo.png', + title: 'Opérateur eau-électricité 6', + }, + ] +} + +export const optionPaiementElectricite = { + title: 'PAIEMENT_FACTURE', + subTitle: 'CHOOSE_OPERATOR', + operatorType: 'electricity', options: [ { type: 'PAIEMENT_EAU_ELECTRICITE', @@ -561,6 +606,7 @@ export const optionPaiementEauElectricite = { export const optionPaiementCreditTelephonique = { title: 'PAIEMENT_FACTURE', subTitle: 'CHOOSE_OPERATOR', + operatorType: 'phone', options: [ { type: 'PAIEMENT_CREDIT_TELEPHONE', @@ -604,6 +650,7 @@ export const optionPaiementCreditTelephonique = { export const optionPaiementAbonnementTV = { title: 'PAIEMENT_FACTURE', subTitle: 'CHOOSE_OPERATOR', + operatorType: 'tv', options: [ { type: 'PAIEMENT_ABONNEMENT_TV', @@ -647,6 +694,7 @@ export const optionPaiementAbonnementTV = { export const optionPaiementEcole = { title: 'PAIEMENT_FACTURE', subTitle: 'CHOOSE_OPERATOR', + operatorType: 'school', options: [ { type: 'PAIEMENT_ECOLE', @@ -695,9 +743,16 @@ export const optionPaiementFacture = { { type: 'FACTURE_WATER_ELECTRICITY', icon: 'water', - title: 'PAIEMENT_EAU_ELECTRICITY', + title: 'PAIEMENT_EAU', screen: route.operateurOptionSelect, - subScreenOption: optionPaiementEauElectricite + subScreenOption: optionPaiementEau + }, + { + type: 'FACTURE_ELECTRICITY', + icon: 'water', + title: 'PAIEMENT_ELECTRICITY', + screen: route.operateurOptionSelect, + subScreenOption: optionPaiementElectricite }, { type: 'FACTURE_SCHOOL', diff --git a/utils/i18n/en.json b/utils/i18n/en.json index 58de9c28..63881018 100644 --- a/utils/i18n/en.json +++ b/utils/i18n/en.json @@ -36,6 +36,7 @@ "MY_ACCOUNT": "My account", "WALLET": "Wallet", "NO_BANK_AVAILABLE": "No bank available", + "NO_OPERATOR_AVAILABLE": "No operator available", "ENTER_VALID_AMOUNT": "Enter a valid amount", "ENTER_AMOUNT_SUPERIOR_ZEROR": "Enter amount superior to zero", "AMOUNT_SUPERIOR_TO_PRINCIPAL_ACCOUNT": "Amount greater than that of the agent's main account", @@ -158,6 +159,7 @@ "DEPOSIT_TO_BANK": "Your Wallet to bank", "NANO_CREDIT": "Nano credit", "NANO_CREDIT_LIST": "Nano credit list", + "SAVINGS_LIST": "Savings list", "NO_NANO_CREDIT": "No nano credit demand", "NANO_CREDIT_DESCRIPTION": "Nano credit description", "NANO_SANTE": "Nano health", @@ -172,7 +174,8 @@ "CAUTIONNEMENT_DONE": "Caution done", "ID_DEMAND": "Demand ID", "DATE": "Date", - "PAIEMENT_EAU_ELECTRICITY": "Water/electricity bill", + "PAIEMENT_EAU_ELECTRICITY": "Water bill", + "PAIEMENT_ELECTRICITY": "Electricity bill", "PAIEMENT_ECOLE": "School fees", "PAIEMENT_CREDIT_TELEPHONIQUE": "Phone credit bills", "PAIEMENT_ABONNEMENT_TV": "TV subscription", @@ -180,6 +183,7 @@ "DATE_REMBOURSEMENT_PREVU": "Expected refund date", "DATE_REMBOURSEMENT": "Refund date", "AMOUNT_REFUND": "Amount reimbursed", + "AMOUNT_WITHDRAWAL": "Amount withdrawal", "AMOUNT_PARTIALLY_REFUND": "Amount partially refunded", "FINAL_DATE": "End date", "CASSATION_DATE": "Cassation date", diff --git a/utils/i18n/fr.json b/utils/i18n/fr.json index b06af03f..a6458df7 100644 --- a/utils/i18n/fr.json +++ b/utils/i18n/fr.json @@ -39,6 +39,7 @@ "DESTINATAIRE": "Destinataire", "ERROR_LABEL": "Erreur", "NO_BANK_AVAILABLE": "Aucune banque disponible", + "NO_OPERATOR_AVAILABLE": "Aucun opérateur disponible", "DEPOSIT_SUCCESS": "Dépôt effectué avec succès", "SUCCESS": "Succès", "ETAT": "Etat", @@ -165,6 +166,7 @@ "DEPOSIT_TO_BANK": "Votre Wallet vers banque", "NANO_CREDIT": "Nano crédit", "NANO_CREDIT_LIST": "Liste des nano crédit", + "SAVINGS_LIST": "Liste des épargnes", "NO_NANO_CREDIT": "Aucune demande de nano crédit", "NANO_CREDIT_DESCRIPTION": "Nano crédit iLink", "NANO_SANTE": "Nano santé", @@ -178,7 +180,8 @@ "CAUTION_CREDIT": "Cautionner une demande de crédit", "CAUTIONNEMENT_DONE": "Cautionnement effectué", "ID_DEMAND": "Identifiant de la demande", - "PAIEMENT_EAU_ELECTRICITY": "Paiement eau/électricité", + "PAIEMENT_EAU": "Paiement eau", + "PAIEMENT_ELECTRICITY": "Paiement électricité", "PAIEMENT_ECOLE": "Paiement école", "PAIEMENT_CREDIT_TELEPHONIQUE": "Paiement crédit téléphonique", "PAIEMENT_ABONNEMENT_TV": "Paiement abonnement TV", @@ -187,6 +190,7 @@ "DATE_REMBOURSEMENT_PREVU": "Date de remboursement prévu", "DATE_REMBOURSEMENT": "Date de remboursement", "AMOUNT_REFUND": "Montant remboursé", + "AMOUNT_WITHDRAWAL": "Montant retiré", "AMOUNT_PARTIALLY_REFUND": "Montant partiellement remboursé", "FINAL_DATE": "Date de fin", "CASSATION_DATE": "Date de cassation", diff --git a/webservice/IlinkConstants.js b/webservice/IlinkConstants.js index 149035e8..a1915dd6 100644 --- a/webservice/IlinkConstants.js +++ b/webservice/IlinkConstants.js @@ -72,6 +72,7 @@ export const getHyperviseurHistoriqueUrl = testBaseUrl + '/walletService/wallets export const getBankUrl = testBaseUrl + '/walletService/wallets/users/operators/bank'; export const getHistoryNanoPendingCreditUrl = testBaseUrl + '/walletService/groups/nanoCredit/demands_in_progress'; export const getHistoryEpargnePendingUrl = testBaseUrl + '/walletService/groups/nanoCredit/savings/demands_in_progress'; +export const getOperatorListUrl = testBaseUrl + '/walletService/wallets/users/operators'; export const authKeyUrl = testBaseUrl + '/oauth/token'; export const videoUrl = "https://www.youtube.com/watch?v=wwGPDPsSLWY"; diff --git a/webservice/NanoCreditApi.js b/webservice/NanoCreditApi.js index bc850049..c57c3327 100644 --- a/webservice/NanoCreditApi.js +++ b/webservice/NanoCreditApi.js @@ -33,7 +33,7 @@ import { import {store} from "../redux/store"; import { askNanoCreditUrl, - cancelDemandUrl, + cancelDemandUrl, getHistoryEpargnePendingUrl, getHistoryNanoPendingCreditUrl, getNanoCreditDemandDureationUrl, groupUrl, @@ -282,9 +282,8 @@ export const getEpargneInProgressAction = (data) => { dispatch(fetchGetEpargneInProgressPending()); axios({ - url: `${getHistoryNanoPendingCreditUrl}`, - method: 'POST', - data, + url: `${getHistoryEpargnePendingUrl}/${data}`, + method: 'GET', headers: { 'Authorization': authKey, 'X-Localization': I18n.currentLocale() diff --git a/webservice/WalletApi.js b/webservice/WalletApi.js index 0bee4389..c96a2a78 100644 --- a/webservice/WalletApi.js +++ b/webservice/WalletApi.js @@ -1,169 +1,228 @@ - -import { walletActionUrl, commissionAmount, walletDetailUrl, walletUserSimpleActionUrl, linkCardUrl } from "./IlinkConstants"; import { - fetchWalletListPending, fetchWalletListSuccess, fetchWalletListError, fetchWalletListReset, - fetchWalletListDetailPending, fetchWalletListDetailSuccess, fetchWalletListDetailError, fetchWalletListDetailReset, - fetchWalletGetCommissionPending, fetchWalletGetCommissionSuccess, fetchWalleGetCommissionError, walletGetCommissionReset, - fetchLinkCardPending, fetchLinkCardSuccess, fetchLinkCardError, fetchLinkCardReset + commissionAmount, + getOperatorListUrl, + linkCardUrl, + walletActionUrl, + walletDetailUrl, + walletUserSimpleActionUrl +} from "./IlinkConstants"; +import { + fetchGetListOperatorError, + fetchGetListOperatorPending, + fetchGetListOperatorReset, + fetchGetListOperatorSuccess, + fetchLinkCardError, + fetchLinkCardPending, + fetchLinkCardReset, + fetchLinkCardSuccess, + fetchWalleGetCommissionError, + fetchWalletGetCommissionPending, + fetchWalletGetCommissionSuccess, + fetchWalletListDetailError, + fetchWalletListDetailPending, + fetchWalletListDetailReset, + fetchWalletListDetailSuccess, + fetchWalletListError, + fetchWalletListPending, + fetchWalletListReset, + fetchWalletListSuccess, + walletGetCommissionReset } from "../redux/actions/WalletActions"; -import { store } from "../redux/store"; +import {store} from "../redux/store"; import axios from "axios"; import I18n from 'react-native-i18n' export const getWalletActivated = (userID) => { - const auth = store.getState().authKeyReducer; - const authKey = auth !== null ? `${auth.authKey.token_type} ${auth.authKey.access_token}` : ''; + const auth = store.getState().authKeyReducer; + const authKey = auth !== null ? `${auth.authKey.token_type} ${auth.authKey.access_token}` : ''; - return dispatch => { - dispatch(fetchWalletListPending()); + return dispatch => { + dispatch(fetchWalletListPending()); - axios({ - url: `${walletActionUrl}/${userID}/activated`, - method: 'GET', - headers: { - 'Authorization': authKey, - 'X-Localization': I18n.currentLocale() - } - }) - .then(response => { - console.log(response); - dispatch(fetchWalletListSuccess(response)); - }) - .catch(error => { - if (error.response) - dispatch(fetchWalletListError(error.response)); - else if (error.request) - dispatch(fetchWalletListError(error.request)) - else - dispatch(fetchWalletListError(error.message)) - }); - } + axios({ + url: `${walletActionUrl}/${userID}/activated`, + method: 'GET', + headers: { + 'Authorization': authKey, + 'X-Localization': I18n.currentLocale() + } + }) + .then(response => { + console.log(response); + dispatch(fetchWalletListSuccess(response)); + }) + .catch(error => { + if (error.response) + dispatch(fetchWalletListError(error.response)); + else if (error.request) + dispatch(fetchWalletListError(error.request)) + else + dispatch(fetchWalletListError(error.message)) + }); + } } export const resetWalletListReducer = () => { - return dispatch => { - dispatch(fetchWalletListReset()); - } + return dispatch => { + dispatch(fetchWalletListReset()); + } } export const getWalletDetailActivated = (id, isAgentCall) => { - const auth = store.getState().authKeyReducer; - const authKey = auth !== null ? `${auth.authKey.token_type} ${auth.authKey.access_token}` : ''; + const auth = store.getState().authKeyReducer; + const authKey = auth !== null ? `${auth.authKey.token_type} ${auth.authKey.access_token}` : ''; - console.log("isAgentCall", isAgentCall); - let url = null; - if (isAgentCall === null) - url = `${walletUserSimpleActionUrl}/${id}`; - else if (isAgentCall === false) - url = `${walletDetailUrl}/${id}`; - else - url = `${walletActionUrl}/${id}/activated`; + console.log("isAgentCall", isAgentCall); + let url = null; + if (isAgentCall === null) + url = `${walletUserSimpleActionUrl}/${id}`; + else if (isAgentCall === false) + url = `${walletDetailUrl}/${id}`; + else + url = `${walletActionUrl}/${id}/activated`; - return dispatch => { - dispatch(fetchWalletListDetailPending()); + return dispatch => { + dispatch(fetchWalletListDetailPending()); - axios({ - url, - method: 'GET', - headers: { - 'Authorization': authKey - } - }) - .then(response => { - console.log("RESPONSE", response); - dispatch(fetchWalletListDetailSuccess(response)); - }) - .catch(error => { - if (error.response) - dispatch(fetchWalletListDetailError(error.response)); - else if (error.request) - dispatch(fetchWalletListDetailError(error.request)) - else - dispatch(fetchWalletListDetailError(error.message)) - }); - } + axios({ + url, + method: 'GET', + headers: { + 'Authorization': authKey + } + }) + .then(response => { + console.log("RESPONSE", response); + dispatch(fetchWalletListDetailSuccess(response)); + }) + .catch(error => { + if (error.response) + dispatch(fetchWalletListDetailError(error.response)); + else if (error.request) + dispatch(fetchWalletListDetailError(error.request)) + else + dispatch(fetchWalletListDetailError(error.message)) + }); + } } export const resetWalletListDetailReducer = () => { - return dispatch => { - dispatch(fetchWalletListDetailReset()); - } + return dispatch => { + dispatch(fetchWalletListDetailReset()); + } } export const getWalletCommissionAmount = (data) => { - const auth = store.getState().authKeyReducer; - const authKey = auth !== null ? `${auth.authKey.token_type} ${auth.authKey.access_token}` : ''; + const auth = store.getState().authKeyReducer; + const authKey = auth !== null ? `${auth.authKey.token_type} ${auth.authKey.access_token}` : ''; - return dispatch => { - dispatch(fetchWalletGetCommissionPending()); + return dispatch => { + dispatch(fetchWalletGetCommissionPending()); - axios({ - url: `${commissionAmount}`, - method: 'POST', - headers: { - 'Authorization': authKey - }, - data - }) - .then(response => { - console.log(response); - dispatch(fetchWalletGetCommissionSuccess(response)); - }) - .catch(error => { - console.log(error); - dispatch(fetchWalleGetCommissionError(error.message)); - if (error.response) - dispatch(fetchWalleGetCommissionError(error.response)); - else if (error.request) - dispatch(fetchWalleGetCommissionError(error.request)) - else - dispatch(fetchWalleGetCommissionError(error.message)) - }); - } + axios({ + url: `${commissionAmount}`, + method: 'POST', + headers: { + 'Authorization': authKey + }, + data + }) + .then(response => { + console.log(response); + dispatch(fetchWalletGetCommissionSuccess(response)); + }) + .catch(error => { + console.log(error); + dispatch(fetchWalleGetCommissionError(error.message)); + if (error.response) + dispatch(fetchWalleGetCommissionError(error.response)); + else if (error.request) + dispatch(fetchWalleGetCommissionError(error.request)) + else + dispatch(fetchWalleGetCommissionError(error.message)) + }); + } } export const walletCommissionAmountReset = () => { - return dispatch => { - dispatch(walletGetCommissionReset()); - } + return dispatch => { + dispatch(walletGetCommissionReset()); + } } export const linkCardAction = (data, userID) => { - const auth = store.getState().authKeyReducer; - const authKey = auth !== null ? `${auth.authKey.token_type} ${auth.authKey.access_token}` : ''; + const auth = store.getState().authKeyReducer; + const authKey = auth !== null ? `${auth.authKey.token_type} ${auth.authKey.access_token}` : ''; - return dispatch => { - dispatch(fetchLinkCardPending()); + return dispatch => { + dispatch(fetchLinkCardPending()); - axios({ - url: `${linkCardUrl}/${userID}`, - data, - method: 'POST', - headers: { - 'Authorization': authKey, - 'X-Localization': I18n.currentLocale() - } - }) - .then(response => { - console.log(response); - dispatch(fetchLinkCardSuccess(response)); - }) - .catch(error => { - if (error.response) - dispatch(fetchLinkCardError(error.response)); - else if (error.request) - dispatch(fetchLinkCardError(error.request)) - else - dispatch(fetchLinkCardError(error.message)) - }); - } + axios({ + url: `${linkCardUrl}/${userID}`, + data, + method: 'POST', + headers: { + 'Authorization': authKey, + 'X-Localization': I18n.currentLocale() + } + }) + .then(response => { + console.log(response); + dispatch(fetchLinkCardSuccess(response)); + }) + .catch(error => { + if (error.response) + dispatch(fetchLinkCardError(error.response)); + else if (error.request) + dispatch(fetchLinkCardError(error.request)) + else + dispatch(fetchLinkCardError(error.message)) + }); + } } export const linkCardReset = () => { - return dispatch => { - dispatch(fetchLinkCardReset()); - } + return dispatch => { + dispatch(fetchLinkCardReset()); + } +} + + +export const getOperatorListAction = (typeOperator, idNetworkWallet) => { + + const auth = store.getState().authKeyReducer; + const authKey = auth !== null ? `${auth.authKey.token_type} ${auth.authKey.access_token}` : ''; + + return dispatch => { + dispatch(fetchGetListOperatorPending()); + + axios({ + url: `${getOperatorListUrl}/${typeOperator}/${idNetworkWallet}`, + method: 'GET', + headers: { + 'Authorization': authKey, + 'X-Localization': I18n.currentLocale() + } + }) + .then(response => { + console.log(response); + dispatch(fetchGetListOperatorSuccess(response)); + }) + .catch(error => { + if (error.response) + dispatch(fetchGetListOperatorError(error.response)); + else if (error.request) + dispatch(fetchGetListOperatorError(error.request)) + else + dispatch(fetchGetListOperatorError(error.message)) + }); + } +} +export const getOperatorListReset = () => { + return dispatch => { + dispatch(fetchGetListOperatorReset()); + } } \ No newline at end of file