Group demand detail
This commit is contained in:
parent
c1e666d02d
commit
2b3d33ef99
|
@ -1,4 +1,4 @@
|
|||
import { CREATE_GROUP_PENDING, CREATE_GROUP_SUCCESS, CREATE_GROUP_ERROR, CREATE_GROUP_RESET, GET_DEMAND_GROUP_PENDING, GET_DEMAND_GROUP_SUCCESS, GET_DEMAND_GROUP_ERROR, GET_DEMAND_GROUP_RESET } from "../types/NanoCreditType";
|
||||
import { CREATE_GROUP_PENDING, CREATE_GROUP_SUCCESS, CREATE_GROUP_ERROR, CREATE_GROUP_RESET, GET_DEMAND_GROUP_PENDING, GET_DEMAND_GROUP_SUCCESS, GET_DEMAND_GROUP_ERROR, GET_DEMAND_GROUP_RESET, GET_UNIQUE_DEMAND_GROUP_PENDING, GET_UNIQUE_DEMAND_GROUP_RESET } from "../types/NanoCreditType";
|
||||
|
||||
export const fetchCreateGroupPending = () => ({
|
||||
type: CREATE_GROUP_PENDING
|
||||
|
@ -35,3 +35,21 @@ export const fetchGetDemandsGroupError = (error) => ({
|
|||
export const fetchGetDemandsGroupReset = () => ({
|
||||
type: GET_DEMAND_GROUP_RESET
|
||||
});
|
||||
|
||||
export const fetchGetUniqueDemandsGroupPending = () => ({
|
||||
type: GET_UNIQUE_DEMAND_GROUP_PENDING
|
||||
});
|
||||
|
||||
export const fetchGetUniqueDemandsGroupSuccess = (res) => ({
|
||||
type: GET_UNIQUE_DEMAND_GROUP_SUCCESS,
|
||||
result: res,
|
||||
});
|
||||
|
||||
export const fetchGetUniqueDemandsGroupError = (error) => ({
|
||||
type: GET_UNIQUE_DEMAND_GROUP_ERROR,
|
||||
result: error
|
||||
});
|
||||
|
||||
export const fetchGetUniqueDemandsGroupReset = () => ({
|
||||
type: GET_UNIQUE_DEMAND_GROUP_RESET
|
||||
});
|
|
@ -0,0 +1,33 @@
|
|||
import { GET_UNIQUE_DEMAND_GROUP_PENDING, GET_UNIQUE_DEMAND_GROUP_SUCCESS, GET_UNIQUE_DEMAND_GROUP_RESET, GET_UNIQUE_DEMAND_GROUP_ERROR } from "../types/NanoCreditType";
|
||||
|
||||
const initialState = {
|
||||
loading: false,
|
||||
result: null,
|
||||
error: null
|
||||
};
|
||||
|
||||
export default (state = initialState, action) => {
|
||||
switch (action.type) {
|
||||
case GET_UNIQUE_DEMAND_GROUP_PENDING: return {
|
||||
...state,
|
||||
loading: true
|
||||
}
|
||||
case GET_UNIQUE_DEMAND_GROUP_SUCCESS: return {
|
||||
...state,
|
||||
loading: false,
|
||||
result: action.result.data,
|
||||
error: null
|
||||
}
|
||||
case GET_UNIQUE_DEMAND_GROUP_ERROR: return {
|
||||
...state,
|
||||
loading: false,
|
||||
result: null,
|
||||
error: action.result
|
||||
}
|
||||
case GET_UNIQUE_DEMAND_GROUP_RESET: return initialState;
|
||||
|
||||
default: {
|
||||
return state;
|
||||
}
|
||||
}
|
||||
};
|
|
@ -27,6 +27,7 @@ import RetraitCashAgentIdVerificationReducer from "./RetraitCashAgentIdVerificat
|
|||
import CreateGroupReducer from "./CreateGroupReducer";
|
||||
import SaveOnesignalReducer from "./SaveOnesignalReducer";
|
||||
import GetDemandsGroupReducer from "./GetDemandsGroupReducer";
|
||||
import GetUniqueDemandsGroupReducer from "./GetUniqueDemandsGroupReducer";
|
||||
|
||||
const persistConfig = {
|
||||
key: 'root',
|
||||
|
@ -63,7 +64,8 @@ const rootReducer = persistCombineReducers(persistConfig, {
|
|||
retraitCashAgentIdVerificationReducer: RetraitCashAgentIdVerificationReducer,
|
||||
createGroupReducer: CreateGroupReducer,
|
||||
saveOnesignalReducer: SaveOnesignalReducer,
|
||||
getDemandsGroupReducer: GetDemandsGroupReducer
|
||||
getDemandsGroupReducer: GetDemandsGroupReducer,
|
||||
getUniqueDemandsGroupReducer: GetUniqueDemandsGroupReducer
|
||||
});
|
||||
|
||||
export default rootReducer;
|
|
@ -7,3 +7,8 @@ export const GET_DEMAND_GROUP_PENDING = 'GET_DEMAND_GROUP_PENDING';
|
|||
export const GET_DEMAND_GROUP_SUCCESS = 'GET_DEMAND_GROUP_SUCCESS';
|
||||
export const GET_DEMAND_GROUP_ERROR = 'GET_DEMAND_GROUP_ERROR';
|
||||
export const GET_DEMAND_GROUP_RESET = 'GET_DEMAND_GROUP_RESET';
|
||||
|
||||
export const GET_UNIQUE_DEMAND_GROUP_PENDING = 'GET_UNIQUE_DEMAND_GROUP_PENDING';
|
||||
export const GET_UNIQUE_DEMAND_GROUP_SUCCESS = 'GET_UNIQUE_DEMAND_GROUP_SUCCESS';
|
||||
export const GET_UNIQUE_DEMAND_GROUP_ERROR = 'GET_UNIQUE_DEMAND_GROUP_ERROR';
|
||||
export const GET_UNIQUE_DEMAND_GROUP_RESET = 'GET_UNIQUE_DEMAND_GROUP_RESET';
|
||||
|
|
|
@ -54,5 +54,7 @@
|
|||
"envoiCashVersCashAgent": "envoiCashVersCashAgent",
|
||||
"modifyIdentificationUser": "modifyIdentificationUser",
|
||||
"createGroupNanoCredit": "createGroupNanoCredit",
|
||||
"groupNanoCredit": "groupNanoCredit"
|
||||
"groupNanoCredit": "groupNanoCredit",
|
||||
"demandGroupNanoCreditDetail": "demandGroupNanoCreditDetail",
|
||||
"demandGroupDetail": "demandGroupDetail",
|
||||
}
|
||||
|
|
|
@ -0,0 +1,513 @@
|
|||
import React, { Component } from 'react'
|
||||
import { StyleSheet, View, Text, Alert, Platform } 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 Icons from 'react-native-vector-icons/Ionicons'
|
||||
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 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'
|
||||
import { getNanoCreditUniqueDemandsReset, getNanoCreditUniqueDemandsAction } from '../../webservice/user/NanoCreditApi'
|
||||
|
||||
class DemandGroupDetail extends Component {
|
||||
|
||||
static navigatorStyle = {
|
||||
navBarBackgroundColor: theme.accentLight,
|
||||
statusBarColor: theme.accent,
|
||||
navBarTextColor: '#FFFFFF',
|
||||
navBarButtonColor: '#FFFFFF',
|
||||
};
|
||||
static navigationOptions = ({ navigation }) => {
|
||||
return {
|
||||
drawerLabel: () => null,
|
||||
title: "Transaction N°" + navigation.getParam("item", { id: "-" }).id
|
||||
}
|
||||
};
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
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')
|
||||
}
|
||||
|
||||
this.state = {
|
||||
displayAmountModifyDialog: false,
|
||||
statut: sta,
|
||||
user: null,
|
||||
networks: [],
|
||||
loadingTreat: false,
|
||||
loadingCancel: false,
|
||||
triggerTreatmentClick: false,
|
||||
triggerCancelClick: false,
|
||||
color: colorback,
|
||||
montant: null,
|
||||
isBtnModifyAmountEnabled: false,
|
||||
id: this.props.navigation.getParam("id", null)
|
||||
}
|
||||
|
||||
this.props.getNanoCreditUniqueDemandsReset();
|
||||
this.props.getNanoCreditUniqueDemandsAction(this.state.id);
|
||||
|
||||
this.currentLocale = DeviceInfo.getDeviceLocale().includes("fr") ? "fr" : "en-gb";
|
||||
moment.locale(this.currentLocale);
|
||||
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
onCancelDemand = () => {
|
||||
if (this.item !== "1") {
|
||||
this.props.treatCancelDemand(this.item.id);
|
||||
}
|
||||
}
|
||||
|
||||
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') {
|
||||
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();
|
||||
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();
|
||||
this.props.navigation.state.params.onGoBack();
|
||||
this.props.creditCancelResetReducer();
|
||||
this.props.creditDemandResetReducer();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
renderBtn() {
|
||||
const { user } = this.state
|
||||
console.warn("ITEM ITEM", this.item);
|
||||
if (user) {
|
||||
if (this.item.code_parrain === user.code_membre) {
|
||||
if (this.item.status === '1') {
|
||||
return (<Button
|
||||
style={{
|
||||
borderColor: 'transparent',
|
||||
borderRadius: 6,
|
||||
marginLeft: 5,
|
||||
marginRight: 5,
|
||||
backgroundColor: this.state.color
|
||||
}}
|
||||
isLoading={this.props.loadingTreatDemand}
|
||||
onPress={() => {
|
||||
}}
|
||||
disabled={true}
|
||||
textStyle={styles.textbtnstyle}
|
||||
>
|
||||
{this.state.statut}
|
||||
</Button>
|
||||
)
|
||||
}
|
||||
else if (this.item.status === '2') {
|
||||
return (<Button
|
||||
style={{
|
||||
borderColor: 'transparent',
|
||||
borderRadius: 6,
|
||||
marginLeft: 5,
|
||||
marginRight: 5,
|
||||
backgroundColor: this.state.color
|
||||
}}
|
||||
onPress={() => {
|
||||
}}
|
||||
disabled={true}
|
||||
textStyle={styles.textbtnstyle}
|
||||
>
|
||||
{this.state.statut}
|
||||
</Button>
|
||||
)
|
||||
}
|
||||
|
||||
else {
|
||||
return (<View style={{
|
||||
flexDirection: 'row',
|
||||
paddingTop: 10
|
||||
}}>
|
||||
|
||||
<View style={{
|
||||
flex: 1,
|
||||
alignItems: 'center'
|
||||
}}>
|
||||
<Button
|
||||
style={{
|
||||
borderColor: 'transparent',
|
||||
borderRadius: 6,
|
||||
marginLeft: 5,
|
||||
marginRight: 5,
|
||||
backgroundColor: this.state.color
|
||||
}}
|
||||
isLoading={this.props.loadingTreatDemand}
|
||||
onPress={() => {
|
||||
this.setState({
|
||||
triggerTreatmentClick: true
|
||||
});
|
||||
this.onTreatDemand()
|
||||
}}
|
||||
textStyle={styles.textbtnstyle}
|
||||
>
|
||||
{this.state.statut}
|
||||
</Button>
|
||||
</View>
|
||||
|
||||
<View style={{
|
||||
flex: 1,
|
||||
alignItems: 'center'
|
||||
}}>
|
||||
<Button
|
||||
style={{
|
||||
borderColor: 'transparent',
|
||||
borderRadius: 6,
|
||||
marginLeft: 5,
|
||||
marginRight: 5,
|
||||
backgroundColor: Color.redColor
|
||||
}}
|
||||
isLoading={this.props.loadingCancelDemand}
|
||||
onPress={() => {
|
||||
this.setState({
|
||||
triggerCancelClick: true
|
||||
});
|
||||
this.onCancelDemand();
|
||||
}}
|
||||
textStyle={styles.textbtnstyle}
|
||||
>
|
||||
{I18n.t('REFUSER_DEMANDE')}
|
||||
</Button>
|
||||
</View>
|
||||
</View>)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
console.log("DEMAND GROUP PROPS", this.props);
|
||||
let ago = moment.tz(this.item.date_creation, 'Etc/GMT+0').format();
|
||||
ago = moment(ago)
|
||||
return (
|
||||
<View style={styles.container}>
|
||||
{this.renderPromptModifyAmountToSend()}
|
||||
{(this.state.triggerTreatmentClick || this.state.triggerCancelClick) && this.renderAlertErrorTreatOrCancelDemand()}
|
||||
<CardView
|
||||
style={styles.cardcontainer1}
|
||||
><Text style={{
|
||||
fontSize: 17,
|
||||
fontWeight: 'bold',
|
||||
color: 'black',
|
||||
marginLeft: responsiveWidth(5)
|
||||
}}>{I18n.t('MEMBER_INFO')}</Text>
|
||||
<View style={{
|
||||
flexDirection: 'row',
|
||||
justifyContent: 'flex-start'
|
||||
}}>
|
||||
<Icons name='md-call'
|
||||
size={28}
|
||||
color={theme.accent}
|
||||
style={{
|
||||
marginLeft: 20
|
||||
}}
|
||||
/>
|
||||
<Text style={styles.simpleuser}>{this.item.phone}</Text>
|
||||
</View>
|
||||
<View style={{
|
||||
flexDirection: 'row',
|
||||
justifyContent: 'flex-start'
|
||||
}}>
|
||||
<Icons name='md-person'
|
||||
size={28}
|
||||
color={theme.accent}
|
||||
style={{
|
||||
marginLeft: 20
|
||||
}}
|
||||
/>
|
||||
<Text style={styles.simpleuser}>{this.item.code_membre}</Text>
|
||||
</View>
|
||||
</CardView>
|
||||
<CardView
|
||||
style={styles.cardcontainer}
|
||||
>
|
||||
<Text style={{
|
||||
fontSize: 17,
|
||||
fontWeight: 'bold',
|
||||
color: 'black',
|
||||
marginLeft: responsiveWidth(5)
|
||||
}}>{I18n.t('DEMAND_INFO')}</Text>
|
||||
<View style={{
|
||||
flexDirection: 'row',
|
||||
justifyContent: 'flex-start'
|
||||
}}>
|
||||
<Icons name='md-git-branch'
|
||||
size={28}
|
||||
color={theme.accent}
|
||||
style={{
|
||||
marginLeft: 20
|
||||
}}
|
||||
/>
|
||||
<Text style={styles.simpleuser}>{this.item.code_parrain}</Text>
|
||||
</View>
|
||||
<View style={{
|
||||
flexDirection: 'row',
|
||||
justifyContent: 'flex-start'
|
||||
}}>
|
||||
<Icons name='md-code-working'
|
||||
size={28}
|
||||
color={theme.accent}
|
||||
style={{
|
||||
marginLeft: 20
|
||||
}}
|
||||
/>
|
||||
<Text style={styles.simpleuser}>{this.item.reseau}</Text>
|
||||
</View>
|
||||
<View style={{
|
||||
flexDirection: 'row',
|
||||
justifyContent: 'flex-start'
|
||||
}}>
|
||||
<Icons name='md-wallet'
|
||||
size={28}
|
||||
color={theme.accent}
|
||||
style={{
|
||||
marginLeft: 20
|
||||
}}
|
||||
/>
|
||||
<Text style={styles.simpleuser}>{this.item.montant}</Text>
|
||||
</View>
|
||||
<View style={{
|
||||
flexDirection: 'row',
|
||||
justifyContent: 'flex-start'
|
||||
}}>
|
||||
<Icons name='md-calendar'
|
||||
size={28}
|
||||
color={theme.accent}
|
||||
style={{
|
||||
marginLeft: 20
|
||||
}}
|
||||
/>
|
||||
<Text style={styles.simpleuser}>{ago.format(" Do MMMM YYYY à HH:mm")}</Text>
|
||||
</View>
|
||||
<View style={{
|
||||
flexDirection: 'row',
|
||||
alignSelf: 'flex-end',
|
||||
marginRight: 20,
|
||||
justifyContent: 'flex-start'
|
||||
}}>
|
||||
<Icons name='md-time'
|
||||
size={28}
|
||||
color={theme.accent}
|
||||
/>
|
||||
<Text style={{
|
||||
marginLeft: responsiveWidth(2),
|
||||
fontSize: 16,
|
||||
color: theme.accent
|
||||
|
||||
}}>{ago.fromNow()}</Text>
|
||||
</View>
|
||||
</CardView>
|
||||
{this.state.user ? this.renderBtn() : null}
|
||||
</View>)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
const mapStateToProps = state => ({
|
||||
loadingGetUniqueDemand: state.getUniqueDemandsGroupReducer.loading,
|
||||
resultGetUniqueDemand: state.getUniqueDemandsGroupReducer.result,
|
||||
errorGetUniqueDemand: state.getUniqueDemandsGroupReducer.error,
|
||||
|
||||
loadingTreatDemand: state.creditTreatDemandReducer.loadingTreatDemand,
|
||||
resultTreatDemand: state.creditTreatDemandReducer.resultTreatDemand,
|
||||
errorTreatDemand: state.creditTreatDemandReducer.errorTreatDemand,
|
||||
|
||||
loadingCancelDemand: state.creditCancelDemandReducer.loadingCancelDemand,
|
||||
resultCancelDemand: state.creditCancelDemandReducer.resultCancelDemand,
|
||||
errorCancelDemand: state.creditCancelDemandReducer.errorCancelDemand
|
||||
});
|
||||
|
||||
const mapDispatchToProps = dispatch => bindActionCreators({
|
||||
getNanoCreditUniqueDemandsAction: getNanoCreditUniqueDemandsAction,
|
||||
getNanoCreditUniqueDemandsReset: getNanoCreditUniqueDemandsReset,
|
||||
treatCreditDemand: treatCreditDemand,
|
||||
creditDemandResetReducer: creditDemandResetReducer,
|
||||
|
||||
treatCancelDemand: treatCancelDemand,
|
||||
creditCancelResetReducer: creditCancelResetReducer
|
||||
}, dispatch);
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(DemandGroupDetail);
|
||||
|
||||
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,
|
||||
}
|
||||
})
|
|
@ -172,8 +172,12 @@ class DemandValidationGroup extends React.Component {
|
|||
dateFormat = moment(dateFormat).fromNow();
|
||||
|
||||
return (
|
||||
<TouchableOpacity onPress={() =>
|
||||
this.props.navigator.navigate(route.historyItemDetails)}>
|
||||
<TouchableOpacity onPress={() => {
|
||||
this.props.navigation.push(route.demandGroupDetail, {
|
||||
id: item.id
|
||||
});
|
||||
}
|
||||
}>
|
||||
<View style={styles.content}>
|
||||
|
||||
<Text style={styles.title}>{item.nom}</Text>
|
||||
|
|
|
@ -4,7 +4,7 @@ import I18n from 'react-native-i18n';
|
|||
import { store } from "../../redux/store";
|
||||
import { idVerificationUrl, getCreditDemand } from "../IlinkConstants";
|
||||
import { fetchRetraitCashAgentIdVerificationPending, fetchRetraitCashAgentIdVerificationSuccess, fetchRetraitCashAgentIdVerificationError, fetchRetraitCashAgentIdVerificationReset } from "../../redux/actions/EnvoieAgentAction";
|
||||
import { fetchGetDemandsGroupSuccess, fetchGetDemandsGroupPending, fetchGetDemandsGroupError, fetchGetDemandsGroupReset } from "../../redux/actions/NanoCreditAction";
|
||||
import { fetchGetDemandsGroupSuccess, fetchGetDemandsGroupPending, fetchGetDemandsGroupError, fetchGetDemandsGroupReset, fetchGetUniqueDemandsGroupPending, fetchGetUniqueDemandsGroupSuccess } from "../../redux/actions/NanoCreditAction";
|
||||
|
||||
export const getNanoCreditDemandsAction = (id) => {
|
||||
|
||||
|
@ -42,3 +42,40 @@ export const getNanoCreditDemandsReset = () => {
|
|||
dispatch(fetchGetDemandsGroupReset());
|
||||
}
|
||||
}
|
||||
|
||||
export const getNanoCreditUniqueDemandsAction = (id) => {
|
||||
|
||||
const auth = store.getState().authKeyReducer;
|
||||
const authKey = auth !== null ? `${auth.authKey.token_type} ${auth.authKey.access_token}` : '';
|
||||
|
||||
return dispatch => {
|
||||
dispatch(fetchGetUniqueDemandsGroupPending());
|
||||
|
||||
axios({
|
||||
url: `${getCreditDemand}/${id}`,
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Authorization': authKey,
|
||||
'X-Localization': I18n.currentLocale()
|
||||
}
|
||||
})
|
||||
.then(response => {
|
||||
console.log(response);
|
||||
dispatch(fetchGetUniqueDemandsGroupSuccess(response));
|
||||
})
|
||||
.catch(error => {
|
||||
if (error.response)
|
||||
dispatch(fetchGetUniqueDemandsGroupError(error.response));
|
||||
else if (error.request)
|
||||
dispatch(fetchGetUniqueDemandsGroupError(error.request))
|
||||
else
|
||||
dispatch(fetchGetUniqueDemandsGroupError(error.message))
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export const getNanoCreditUniqueDemandsReset = () => {
|
||||
return dispatch => {
|
||||
dispatch(fetchGetUniqueDemandsGroupReset());
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue