2020-08-12 18:24:56 +00:00
|
|
|
import React, { Component } from 'react'
|
2020-08-17 21:16:31 +00:00
|
|
|
import { StyleSheet, View, Text, Alert, Platform, ScrollView, ProgressBarAndroid } from 'react-native'
|
2020-08-12 18:24:56 +00:00
|
|
|
import CardView from 'react-native-cardview'
|
|
|
|
import Button from 'apsl-react-native-button'
|
|
|
|
import { responsiveHeight, responsiveWidth } from 'react-native-responsive-dimensions'
|
2020-08-13 07:23:23 +00:00
|
|
|
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
|
2020-08-12 18:24:56 +00:00
|
|
|
import { updateCreditDemand } from "../../webservice/HistoryRequestApi";
|
|
|
|
import { readUser } from "../../webservice/AuthApi";
|
|
|
|
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 { 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'
|
2020-08-13 07:23:23 +00:00
|
|
|
import { getNanoCreditUniqueDemandsAction, getNanoCreditUniqueDemandsReset } from '../../webservice/user/NanoCreditApi'
|
2020-08-24 19:18:19 +00:00
|
|
|
import { treatDemandGroupAction, treatDemandGroupReset, cancelDemandGroupAction } from '../../webservice/NanoCreditApi'
|
2020-08-19 03:53:12 +00:00
|
|
|
import { IlinkEmitter } from '../../utils/events';
|
2020-08-12 18:24:56 +00:00
|
|
|
|
|
|
|
class DemandGroupNanoCreditDetail extends Component {
|
|
|
|
|
|
|
|
static navigatorStyle = {
|
|
|
|
navBarBackgroundColor: theme.accentLight,
|
|
|
|
statusBarColor: theme.accent,
|
|
|
|
navBarTextColor: '#FFFFFF',
|
|
|
|
navBarButtonColor: '#FFFFFF',
|
|
|
|
};
|
|
|
|
static navigationOptions = ({ navigation }) => {
|
|
|
|
return {
|
|
|
|
drawerLabel: () => null,
|
2020-08-13 07:23:23 +00:00
|
|
|
title: I18n.t('GROUP') + ' N°' + navigation.getParam("id", "-")
|
2020-08-12 18:24:56 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
2020-08-13 07:23:23 +00:00
|
|
|
/* this.item = this.props.navigation.getParam("item", null);
|
|
|
|
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')
|
|
|
|
} */
|
2020-08-12 18:24:56 +00:00
|
|
|
|
|
|
|
this.state = {
|
|
|
|
displayAmountModifyDialog: false,
|
2020-08-13 07:23:23 +00:00
|
|
|
/* statut: sta, */
|
2020-08-12 18:24:56 +00:00
|
|
|
user: null,
|
|
|
|
networks: [],
|
|
|
|
loadingTreat: false,
|
|
|
|
loadingCancel: false,
|
|
|
|
triggerTreatmentClick: false,
|
|
|
|
triggerCancelClick: false,
|
|
|
|
color: colorback,
|
|
|
|
montant: null,
|
2020-08-13 07:23:23 +00:00
|
|
|
isBtnModifyAmountEnabled: false,
|
|
|
|
id: this.props.navigation.getParam("id", null)
|
2020-08-12 18:24:56 +00:00
|
|
|
}
|
|
|
|
this.currentLocale = DeviceInfo.getDeviceLocale().includes("fr") ? "fr" : "en-gb";
|
|
|
|
moment.locale(this.currentLocale);
|
|
|
|
|
2020-08-13 07:23:23 +00:00
|
|
|
this.props.getNanoCreditUniqueDemandsReset();
|
|
|
|
this.props.getNanoCreditUniqueDemandsAction(this.state.id);
|
2020-08-12 18:24:56 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2020-08-13 07:23:23 +00:00
|
|
|
componentDidMount() {
|
2020-08-12 18:24:56 +00:00
|
|
|
|
2020-08-13 07:23:23 +00:00
|
|
|
readUser().then((user) => {
|
|
|
|
if (user) {
|
|
|
|
if (user !== undefined) {
|
|
|
|
this.setState({ user });
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
2020-08-12 18:24:56 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
displayToast = (message) => {
|
|
|
|
Toast.show(message, {
|
2020-08-25 05:39:28 +00:00
|
|
|
duration: Toast.durations.LONG,
|
2020-08-12 18:24:56 +00:00
|
|
|
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() {
|
2020-08-17 05:25:16 +00:00
|
|
|
this.props.treatDemandGroupReset();
|
|
|
|
this.props.treatDemandGroupAction({
|
|
|
|
id_demande: this.props.resultGetUniqueDemand.response.id,
|
2020-08-24 19:18:19 +00:00
|
|
|
id_user: this.state.user.id
|
2020-08-17 05:25:16 +00:00
|
|
|
});
|
2020-08-12 18:24:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
onCancelDemand = () => {
|
2020-08-17 05:25:16 +00:00
|
|
|
this.props.treatDemandGroupReset();
|
2020-08-24 19:18:19 +00:00
|
|
|
this.props.cancelDemandGroupAction({
|
2020-08-17 05:25:16 +00:00
|
|
|
id_demande: this.props.resultGetUniqueDemand.response.id,
|
2020-08-24 19:18:19 +00:00
|
|
|
id_user: this.state.user.id
|
2020-08-17 05:25:16 +00:00
|
|
|
});
|
2020-08-12 18:24:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
renderAlertErrorTreatOrCancelDemand = () => {
|
|
|
|
const { errorTreatDemand, resultTreatDemand, resultCancelDemand, errorCancelDemand } = this.props;
|
|
|
|
|
|
|
|
if (errorTreatDemand !== null) {
|
|
|
|
if (typeof errorTreatDemand.data !== 'undefined') {
|
|
|
|
Alert.alert(
|
|
|
|
I18n.t("ERROR_TREATMENT_DEMAND"),
|
2020-08-17 21:16:31 +00:00
|
|
|
errorTreatDemand.data.error,
|
2020-08-12 18:24:56 +00:00
|
|
|
[
|
|
|
|
{
|
|
|
|
text: I18n.t("OK"), onPress: () => {
|
2020-08-17 21:16:31 +00:00
|
|
|
this.props.treatDemandGroupReset();
|
2020-08-12 18:24:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
],
|
|
|
|
{ cancelable: false }
|
2020-08-17 21:16:31 +00:00
|
|
|
);
|
2020-08-12 18:24:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (resultTreatDemand !== null) {
|
|
|
|
console.log("resultTreatDemand", resultTreatDemand);
|
|
|
|
if (resultTreatDemand.status === 200) {
|
|
|
|
this.displayToast(resultTreatDemand.response);
|
|
|
|
this.props.navigation.goBack();
|
2020-08-19 03:53:12 +00:00
|
|
|
//IlinkEmitter.emit('treatNanoGroupDemand');
|
2020-08-17 21:16:31 +00:00
|
|
|
this.props.treatDemandGroupReset();
|
2020-08-12 18:24:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2020-08-13 07:23:23 +00:00
|
|
|
renderLabelState = (state) => {
|
|
|
|
if (state === 0)
|
|
|
|
return I18n.t('NO_TREAT')
|
2020-08-17 21:16:31 +00:00
|
|
|
else if (state === 1)
|
2020-08-13 07:23:23 +00:00
|
|
|
return I18n.t('TREAT')
|
|
|
|
else
|
|
|
|
return I18n.t('REFUSED')
|
|
|
|
}
|
|
|
|
|
2020-08-12 18:24:56 +00:00
|
|
|
renderBtn() {
|
2020-08-13 07:23:23 +00:00
|
|
|
const { resultGetUniqueDemand } = this.props
|
|
|
|
|
|
|
|
if (resultGetUniqueDemand.response.statut === 1) {
|
|
|
|
return (<Button
|
|
|
|
style={{
|
|
|
|
borderColor: 'transparent',
|
|
|
|
borderRadius: 6,
|
|
|
|
marginLeft: 5,
|
|
|
|
marginRight: 5,
|
|
|
|
backgroundColor: 'gray'
|
|
|
|
}}
|
|
|
|
isLoading={this.props.loadingTreatDemand}
|
|
|
|
onPress={() => {
|
|
|
|
}}
|
|
|
|
disabled={true}
|
|
|
|
textStyle={styles.textbtnstyle}
|
|
|
|
>
|
|
|
|
{this.renderLabelState(resultGetUniqueDemand.response.statut)}
|
|
|
|
</Button>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
else if (resultGetUniqueDemand.response.statut === 2) {
|
|
|
|
return (<Button
|
|
|
|
style={{
|
|
|
|
borderColor: 'transparent',
|
|
|
|
borderRadius: 6,
|
|
|
|
marginLeft: 5,
|
|
|
|
marginRight: 5,
|
|
|
|
backgroundColor: 'gray'
|
|
|
|
}}
|
|
|
|
onPress={() => {
|
|
|
|
}}
|
|
|
|
disabled={true}
|
|
|
|
textStyle={styles.textbtnstyle}
|
|
|
|
>
|
|
|
|
{this.renderLabelState(resultGetUniqueDemand.response.statut)}
|
|
|
|
</Button>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
return (<View style={{
|
|
|
|
flexDirection: 'row',
|
|
|
|
paddingTop: 10
|
|
|
|
}}>
|
|
|
|
|
|
|
|
<View style={{
|
|
|
|
flex: 1,
|
|
|
|
alignItems: 'center'
|
|
|
|
}}>
|
|
|
|
<Button
|
2020-08-12 18:24:56 +00:00
|
|
|
style={{
|
|
|
|
borderColor: 'transparent',
|
|
|
|
borderRadius: 6,
|
|
|
|
marginLeft: 5,
|
|
|
|
marginRight: 5,
|
2020-08-13 07:23:23 +00:00
|
|
|
backgroundColor: 'green'
|
2020-08-12 18:24:56 +00:00
|
|
|
}}
|
|
|
|
isLoading={this.props.loadingTreatDemand}
|
|
|
|
onPress={() => {
|
2020-08-17 05:25:16 +00:00
|
|
|
this.setState({
|
|
|
|
triggerTreatmentClick: true
|
|
|
|
});
|
|
|
|
this.onTreatDemand();
|
2020-08-12 18:24:56 +00:00
|
|
|
}}
|
|
|
|
textStyle={styles.textbtnstyle}
|
|
|
|
>
|
2020-08-13 07:23:23 +00:00
|
|
|
{I18n.t('ACTION_TREAT_DEMAND')}
|
2020-08-12 18:24:56 +00:00
|
|
|
</Button>
|
2020-08-13 07:23:23 +00:00
|
|
|
</View>
|
|
|
|
|
|
|
|
<View style={{
|
|
|
|
flex: 1,
|
|
|
|
alignItems: 'center'
|
|
|
|
}}>
|
|
|
|
<Button
|
2020-08-12 18:24:56 +00:00
|
|
|
style={{
|
|
|
|
borderColor: 'transparent',
|
|
|
|
borderRadius: 6,
|
|
|
|
marginLeft: 5,
|
|
|
|
marginRight: 5,
|
2020-08-13 07:23:23 +00:00
|
|
|
backgroundColor: Color.redColor
|
2020-08-12 18:24:56 +00:00
|
|
|
}}
|
2020-08-13 07:23:23 +00:00
|
|
|
isLoading={this.props.loadingCancelDemand}
|
2020-08-12 18:24:56 +00:00
|
|
|
onPress={() => {
|
2020-08-17 05:25:16 +00:00
|
|
|
this.setState({
|
|
|
|
triggerCancelClick: true
|
|
|
|
});
|
|
|
|
this.onCancelDemand();
|
2020-08-12 18:24:56 +00:00
|
|
|
}}
|
|
|
|
textStyle={styles.textbtnstyle}
|
|
|
|
>
|
2020-08-13 07:23:23 +00:00
|
|
|
{I18n.t('REFUSER_DEMANDE')}
|
2020-08-12 18:24:56 +00:00
|
|
|
</Button>
|
2020-08-13 07:23:23 +00:00
|
|
|
</View>
|
|
|
|
</View>)
|
2020-08-12 18:24:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-13 07:23:23 +00:00
|
|
|
renderLoader = () => {
|
2020-08-12 18:24:56 +00:00
|
|
|
return (
|
2020-08-13 07:23:23 +00:00
|
|
|
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
|
|
|
|
{Platform.OS === 'android'
|
|
|
|
?
|
|
|
|
(
|
|
|
|
<>
|
|
|
|
<ProgressBarAndroid />
|
|
|
|
<Text>{I18n.t('LOADING_DOTS')}</Text>
|
|
|
|
|
|
|
|
</>
|
|
|
|
) :
|
|
|
|
<>
|
|
|
|
<ActivityIndicator size="large" color={'#ccc'} />
|
|
|
|
<Text>{I18n.t('LOADING_DOTS')}</Text>
|
|
|
|
</>
|
|
|
|
}
|
|
|
|
</View>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2020-08-25 05:39:28 +00:00
|
|
|
getDemandTypeIcon = (type) => {
|
|
|
|
switch (type) {
|
|
|
|
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'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-08-13 07:23:23 +00:00
|
|
|
renderDetail = () => {
|
|
|
|
|
2020-08-19 06:25:24 +00:00
|
|
|
const { resultGetUniqueDemand } = this.props;
|
2020-11-18 11:22:53 +00:00
|
|
|
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();
|
2020-08-25 05:39:28 +00:00
|
|
|
ago = moment(ago);
|
|
|
|
dateDemand = moment(dateDemand);
|
|
|
|
|
2020-08-13 07:23:23 +00:00
|
|
|
return (<View style={styles.container}>
|
|
|
|
<CardView
|
2020-08-25 05:39:28 +00:00
|
|
|
style={styles.cardcontainer}
|
2020-08-13 07:23:23 +00:00
|
|
|
>
|
|
|
|
<Text style={{
|
2020-08-12 18:24:56 +00:00
|
|
|
fontSize: 17,
|
|
|
|
fontWeight: 'bold',
|
|
|
|
color: 'black',
|
|
|
|
marginLeft: responsiveWidth(5)
|
2020-08-13 07:23:23 +00:00
|
|
|
}}>
|
2020-08-17 21:16:31 +00:00
|
|
|
{resultGetUniqueDemand.response.nom}
|
2020-08-13 07:23:23 +00:00
|
|
|
</Text>
|
2020-08-25 05:39:28 +00:00
|
|
|
<View style={{
|
|
|
|
flexDirection: 'row',
|
|
|
|
justifyContent: 'flex-start'
|
|
|
|
}}>
|
|
|
|
<Icon name={this.getDemandTypeIcon(resultGetUniqueDemand.response.type)}
|
|
|
|
size={28}
|
|
|
|
color={theme.accent}
|
|
|
|
style={{
|
|
|
|
marginLeft: 20
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
<Text style={styles.simpleuser}>{`${I18n.t('TYPE_DEMAND')}: ${resultGetUniqueDemand.response.type}`}</Text>
|
|
|
|
</View>
|
2020-08-13 07:23:23 +00:00
|
|
|
<View style={{
|
|
|
|
flexDirection: 'row',
|
|
|
|
justifyContent: 'flex-start'
|
|
|
|
}}>
|
|
|
|
<Icon name='account'
|
|
|
|
size={28}
|
|
|
|
color={theme.accent}
|
|
|
|
style={{
|
|
|
|
marginLeft: 20
|
|
|
|
}}
|
|
|
|
/>
|
2020-08-17 21:16:31 +00:00
|
|
|
<Text style={styles.simpleuser}>{`${I18n.t('CREATOR')}: ${resultGetUniqueDemand.response.createur}`}</Text>
|
2020-08-13 07:23:23 +00:00
|
|
|
</View>
|
|
|
|
<View style={{
|
|
|
|
flexDirection: 'row',
|
|
|
|
justifyContent: 'flex-start'
|
|
|
|
}}>
|
|
|
|
<Icon name='map-marker'
|
|
|
|
size={28}
|
|
|
|
color={theme.accent}
|
|
|
|
style={{
|
|
|
|
marginLeft: 20
|
|
|
|
}}
|
|
|
|
/>
|
2020-08-17 21:16:31 +00:00
|
|
|
<Text style={styles.simpleuser}>{`${I18n.t('COUNTRY')}: ${resultGetUniqueDemand.response.country}`}</Text>
|
2020-08-13 07:23:23 +00:00
|
|
|
</View>
|
|
|
|
</CardView>
|
2020-08-17 21:16:31 +00:00
|
|
|
|
|
|
|
<CardView
|
|
|
|
style={styles.cardcontainer}
|
|
|
|
>
|
|
|
|
<View style={{
|
|
|
|
flexDirection: 'row',
|
|
|
|
justifyContent: 'flex-start'
|
|
|
|
}}>
|
|
|
|
<Icon name='account-multiple'
|
|
|
|
size={28}
|
|
|
|
color={theme.accent}
|
|
|
|
style={{
|
|
|
|
marginLeft: 20
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
<Text style={styles.simpleuser}>{`SPONSOR 1: ${resultGetUniqueDemand.response.sponsor1}`}</Text>
|
|
|
|
</View>
|
|
|
|
<View style={{
|
|
|
|
flexDirection: 'row',
|
|
|
|
justifyContent: 'flex-start'
|
|
|
|
}}>
|
|
|
|
<Icon name='account-multiple'
|
|
|
|
size={28}
|
|
|
|
color={theme.accent}
|
|
|
|
style={{
|
|
|
|
marginLeft: 20
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
<Text style={styles.simpleuser}>{`SPONSOR 2: ${resultGetUniqueDemand.response.sponsor2}`}</Text>
|
|
|
|
</View>
|
|
|
|
<View style={{
|
|
|
|
flexDirection: 'row',
|
|
|
|
justifyContent: 'flex-start'
|
|
|
|
}}>
|
|
|
|
<Icon name='account-multiple'
|
|
|
|
size={28}
|
|
|
|
color={theme.accent}
|
|
|
|
style={{
|
|
|
|
marginLeft: 20
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
<Text style={styles.simpleuser}>{`SPONSOR 3: ${resultGetUniqueDemand.response.sponsor3}`}</Text>
|
|
|
|
</View>
|
|
|
|
</CardView>
|
|
|
|
|
2020-08-19 06:25:24 +00:00
|
|
|
<CardView style={styles.cardcontainer}>
|
2020-08-17 21:16:31 +00:00
|
|
|
{/* <Text style={{
|
2020-08-13 07:23:23 +00:00
|
|
|
fontSize: 17,
|
|
|
|
fontWeight: 'bold',
|
|
|
|
color: 'black',
|
|
|
|
marginLeft: responsiveWidth(5)
|
|
|
|
}}>{I18n.t('DEMAND_INFO')}</Text>
|
|
|
|
<View style={{
|
|
|
|
flexDirection: 'row',
|
|
|
|
justifyContent: 'flex-start'
|
|
|
|
}}>
|
|
|
|
<Icon name='md-git-branch'
|
|
|
|
size={28}
|
|
|
|
color={theme.accent}
|
|
|
|
style={{
|
|
|
|
marginLeft: 20
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
<Text style={styles.simpleuser}>{this.item.code_parrain}</Text>
|
2020-08-17 21:16:31 +00:00
|
|
|
</View> */}
|
2020-08-13 07:23:23 +00:00
|
|
|
<View style={{
|
|
|
|
flexDirection: 'row',
|
|
|
|
justifyContent: 'flex-start'
|
|
|
|
}}>
|
2020-08-17 21:16:31 +00:00
|
|
|
<Icon name='code-tags'
|
2020-08-13 07:23:23 +00:00
|
|
|
size={28}
|
|
|
|
color={theme.accent}
|
|
|
|
style={{
|
|
|
|
marginLeft: 20
|
|
|
|
}}
|
|
|
|
/>
|
2020-08-17 21:16:31 +00:00
|
|
|
<Text style={styles.simpleuser}>{resultGetUniqueDemand.response.code_groupe}</Text>
|
2020-08-13 07:23:23 +00:00
|
|
|
</View>
|
|
|
|
<View style={{
|
|
|
|
flexDirection: 'row',
|
|
|
|
justifyContent: 'flex-start'
|
|
|
|
}}>
|
2020-08-17 21:16:31 +00:00
|
|
|
<Icon name='cash'
|
2020-08-13 07:23:23 +00:00
|
|
|
size={28}
|
|
|
|
color={theme.accent}
|
|
|
|
style={{
|
|
|
|
marginLeft: 20
|
|
|
|
}}
|
|
|
|
/>
|
2020-08-17 21:16:31 +00:00
|
|
|
<Text style={styles.simpleuser}>{`${I18n.t('LIMITE_GROUP')}: ${resultGetUniqueDemand.response.limite_credit} ${resultGetUniqueDemand.response.currency_code}`}</Text>
|
2020-08-13 07:23:23 +00:00
|
|
|
</View>
|
|
|
|
<View style={{
|
|
|
|
flexDirection: 'row',
|
|
|
|
justifyContent: 'flex-start'
|
|
|
|
}}>
|
2020-08-17 21:16:31 +00:00
|
|
|
<Icon name='calendar'
|
2020-08-13 07:23:23 +00:00
|
|
|
size={28}
|
|
|
|
color={theme.accent}
|
|
|
|
style={{
|
|
|
|
marginLeft: 20
|
|
|
|
}}
|
|
|
|
/>
|
2020-08-17 21:16:31 +00:00
|
|
|
<Text style={styles.simpleuser}>{`${I18n.t('CREATION_DATE')}: ${ago.format(" Do MMMM YYYY à HH:mm")}`}</Text>
|
2020-08-13 07:23:23 +00:00
|
|
|
</View>
|
|
|
|
<View style={{
|
|
|
|
flexDirection: 'row',
|
|
|
|
alignSelf: 'flex-end',
|
|
|
|
marginRight: 20,
|
|
|
|
justifyContent: 'flex-start'
|
|
|
|
}}>
|
2020-08-17 21:16:31 +00:00
|
|
|
<Icon name='update'
|
2020-08-13 07:23:23 +00:00
|
|
|
size={28}
|
|
|
|
color={theme.accent}
|
|
|
|
/>
|
2020-08-12 18:24:56 +00:00
|
|
|
<Text style={{
|
2020-08-13 07:23:23 +00:00
|
|
|
marginLeft: responsiveWidth(2),
|
|
|
|
fontSize: 16,
|
|
|
|
color: theme.accent
|
|
|
|
|
2020-08-25 05:39:28 +00:00
|
|
|
}}>{dateDemand.fromNow()}</Text>
|
2020-08-13 07:23:23 +00:00
|
|
|
</View>
|
2020-08-17 21:16:31 +00:00
|
|
|
</CardView>
|
|
|
|
|
2020-08-13 07:23:23 +00:00
|
|
|
{this.renderBtn()}
|
|
|
|
</View>);
|
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
|
|
console.log("DEMAND GROUP PROPS", this.props);
|
2020-08-17 21:16:31 +00:00
|
|
|
|
2020-08-13 07:23:23 +00:00
|
|
|
return (
|
|
|
|
<>
|
2020-08-17 05:25:16 +00:00
|
|
|
{(this.state.triggerTreatmentClick || this.state.triggerCancelClick) && this.renderAlertErrorTreatOrCancelDemand()}
|
2020-08-13 07:23:23 +00:00
|
|
|
{
|
|
|
|
this.props.loadingGetUniqueDemand ?
|
|
|
|
this.renderLoader() :
|
2020-08-17 21:16:31 +00:00
|
|
|
this.props.resultGetUniqueDemand != null ?
|
|
|
|
this.renderDetail() :
|
|
|
|
null
|
2020-08-13 07:23:23 +00:00
|
|
|
}
|
|
|
|
</>
|
|
|
|
);
|
2020-08-12 18:24:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
const mapStateToProps = state => ({
|
2020-08-13 07:23:23 +00:00
|
|
|
loadingGetUniqueDemand: state.getUniqueDemandsGroupReducer.loading,
|
|
|
|
resultGetUniqueDemand: state.getUniqueDemandsGroupReducer.result,
|
|
|
|
errorGetUniqueDemand: state.getUniqueDemandsGroupReducer.error,
|
2020-08-12 18:24:56 +00:00
|
|
|
|
2020-08-13 07:23:23 +00:00
|
|
|
loadingTreatDemand: state.treatDemandGroupReducer.loading,
|
|
|
|
resultTreatDemand: state.treatDemandGroupReducer.result,
|
|
|
|
errorTreatDemand: state.treatDemandGroupReducer.error,
|
2020-08-12 18:24:56 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
const mapDispatchToProps = dispatch => bindActionCreators({
|
2020-08-13 07:23:23 +00:00
|
|
|
getNanoCreditUniqueDemandsAction: getNanoCreditUniqueDemandsAction,
|
|
|
|
getNanoCreditUniqueDemandsReset: getNanoCreditUniqueDemandsReset,
|
|
|
|
|
2020-08-17 05:25:16 +00:00
|
|
|
treatDemandGroupAction: treatDemandGroupAction,
|
2020-08-24 19:18:19 +00:00
|
|
|
cancelDemandGroupAction: cancelDemandGroupAction,
|
2020-08-17 05:25:16 +00:00
|
|
|
treatDemandGroupReset: treatDemandGroupReset,
|
|
|
|
|
2020-08-12 18:24:56 +00:00
|
|
|
treatCreditDemand: treatCreditDemand,
|
|
|
|
creditDemandResetReducer: creditDemandResetReducer,
|
|
|
|
|
|
|
|
treatCancelDemand: treatCancelDemand,
|
|
|
|
creditCancelResetReducer: creditCancelResetReducer
|
|
|
|
}, dispatch);
|
|
|
|
|
|
|
|
export default connect(mapStateToProps, mapDispatchToProps)(DemandGroupNanoCreditDetail);
|
|
|
|
|
|
|
|
const styles = StyleSheet.create({
|
|
|
|
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,
|
|
|
|
|
|
|
|
},
|
|
|
|
cardcontainer: {
|
|
|
|
justifyContent: 'space-evenly',
|
|
|
|
|
|
|
|
flex: 3,
|
|
|
|
margin: 3,
|
|
|
|
}
|
|
|
|
})
|