demand group OK

This commit is contained in:
Brice Zele 2020-08-25 06:39:28 +01:00
parent 04c20dd6f8
commit bca8f308b2
6 changed files with 81 additions and 13 deletions

View File

@ -55,6 +55,7 @@ import { IlinkEmitter } from '../../utils/events';
import { Typography } from '../../config/typography';
import { ScrollView } from 'react-native-gesture-handler';
import { Color } from '../../config/Color';
import { color } from 'react-native-reanimated';
class DemandValidationGroup extends React.Component {
@ -143,8 +144,29 @@ class DemandValidationGroup extends React.Component {
_closeMenu = () => this.setState({ visibleMenu: false });
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'
}
}
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
}
}
renderDemandItem = (item) => {
let dateFormat = moment.tz(item.date_creation, 'Etc/GMT+0').format();
let dateFormat = moment.tz(item.date_creation_demande, 'Etc/GMT+0').format();
dateFormat = moment(dateFormat).fromNow();
return (
@ -152,8 +174,15 @@ class DemandValidationGroup extends React.Component {
this.props.navigation.push(route.demandGroupNanoCreditDetail, {
id: item.id
});
}
}>
}}
style={[styles.paymentItem]}>
<View style={{ flexDirection: 'row', alignItems: 'center', }}>
<View style={styles.iconContent}>
<Icon name={this.getDemandTypeIcon(item.type)} color={this.getDemandTypeColor(item.type)} size={35} />
</View>
</View>
<View style={styles.content}>
<Text style={styles.title}>{item.nom}</Text>
@ -189,7 +218,6 @@ class DemandValidationGroup extends React.Component {
</View>
<View style={styles.bottomSeparator} />
</View>
</TouchableOpacity>
)
@ -399,8 +427,6 @@ const styles = StyleSheet.create({
fontWeight: 'bold'
},
content: {
width: responsiveWidth(100),
borderBottomColor: '#FFFFFF',
flex: 1,
flexDirection: 'column',
paddingTop: 10,
@ -440,4 +466,17 @@ const styles = StyleSheet.create({
marginBottom: 10,
color: theme.accent,
},
paymentItem: {
flexDirection: "row",
alignItems: "center",
justifyContent: "space-between",
width: "100%",
borderBottomColor: '#EEE',
borderBottomWidth: 1
},
iconContent: {
width: 40,
marginRight: 5,
alignItems: "center"
}
});

View File

@ -97,7 +97,7 @@ class DemandGroupNanoCreditDetail extends Component {
displayToast = (message) => {
Toast.show(message, {
duration: Toast.durations.SHORT,
duration: Toast.durations.LONG,
position: Toast.positions.BOTTOM,
backgroundColor: Color.primaryColor,
shadow: true,
@ -298,14 +298,28 @@ class DemandGroupNanoCreditDetail extends Component {
)
}
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'
}
}
renderDetail = () => {
const { resultGetUniqueDemand } = this.props;
let ago = moment.tz(resultGetUniqueDemand.response.date_creation, 'Etc/GMT+0').format();
ago = moment(ago)
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();
ago = moment(ago);
dateDemand = moment(dateDemand);
return (<View style={styles.container}>
<CardView
style={styles.cardcontainer1}
style={styles.cardcontainer}
>
<Text style={{
fontSize: 17,
@ -315,6 +329,19 @@ class DemandGroupNanoCreditDetail extends Component {
}}>
{resultGetUniqueDemand.response.nom}
</Text>
<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>
<View style={{
flexDirection: 'row',
justifyContent: 'flex-start'
@ -461,7 +488,7 @@ class DemandGroupNanoCreditDetail extends Component {
fontSize: 16,
color: theme.accent
}}>{ago.fromNow()}</Text>
}}>{dateDemand.fromNow()}</Text>
</View>
</CardView>

View File

@ -110,7 +110,7 @@ class MyNanoCreditGroup extends Component {
displayToast = (message) => {
Toast.show(message, {
duration: Toast.durations.SHORT,
duration: Toast.durations.LONG,
position: Toast.positions.BOTTOM,
backgroundColor: Color.primaryColor,
shadow: true,

View File

@ -29,7 +29,7 @@ export const isNormalInteger = (str) => {
export const displayToast = (message) => {
Toast.show(message, {
duration: Toast.durations.SHORT,
duration: Toast.durations.LONG,
position: Toast.positions.BOTTOM,
backgroundColor: Color.primaryColor,
shadow: true,

View File

@ -108,6 +108,7 @@
"MANAGE_GROUP": "Manage group",
"VALIDATION_DEMAND": "Validation request",
"DELETE_DEMAND": "Deletion request",
"TYPE_DEMAND": "Demand type",
"GROUP_INFOS": "Fill in the group information",
"GROUP_CODE": "Group code",
"NOM_GROUP": "Group name",

View File

@ -109,6 +109,7 @@
"MANAGE_GROUP": "Gérer le groupe",
"VALIDATION_DEMAND": "Demandes de validation",
"DELETE_DEMAND": "Demande de suppression",
"TYPE_DEMAND": "Type de demande",
"GROUP_INFOS": "Renseigner les informations du groupe",
"GROUP_CODE": "Code du groupe",
"SUCCESS_CREATION_GROUP": "Informations sur la création",