-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnewprojectfordonation.js
More file actions
181 lines (164 loc) · 5.26 KB
/
newprojectfordonation.js
File metadata and controls
181 lines (164 loc) · 5.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
import React, { Component } from 'react';
import {Platform, StyleSheet,Text,TextInput,View,AsyncStorage,TouchableOpacity,Button,} from 'react-native';
import Constants from 'expo-constants';
import * as ImagePicker from 'expo-image-picker'
import * as Permissions from 'expo-permissions';
import {styles} from './styles';
let global = {
name:'',
longdescription: '',
shortdescription: '',
image64:''
}
export class project extends React.Component {
constructor(props) {
super(props);
this.state = { name: '', longdescription: '', shortdescription: '', image64:'' };
}
render() {
return (
<View style={styles.container}>
<View style={styles.innerContainer}>
<Text style={styles.header}>Registration for Organisations</Text>
<TextInput
style={styles.textinput}
placeholder="Name of organisation"
underlineColorAndroid={'transparent'}
onChangeText={name => this.setState({ name })}
/>
<TextInput
style={styles.textinput}
placeholder="short description"
numberOfLines={10}
multiline={true}
underlineColorAndroid={'transparent'}
onChangeText={shortdescription => this.setState({ shortdescription })}
/>
<View style={style.textAreaContainer}>
<TextInput
style={style.textArea}
underlineColorAndroid="transparent"
placeholder="Brief Description"
placeholderTextColor="grey"
numberOfLines={10}
multiline={true}
onChangeText={longdescription => this.setState({ longdescription })}
/>
</View>
<TouchableOpacity
style={styles.button}
onPress={() => {
global.name=this.state.name;
global.longdescription=this.state.longdescription;
global.shortdescription=this.state.shortdescription;
global.image64 = this.state.image64;
this.props.navigation.navigate('ban');
}}>
<Text style={styles.btntext}> Proceed </Text>
</TouchableOpacity>
</View>
</View>
);
}
componentDidMount() {
this.getPermissionAsync();
}
getPermissionAsync = async () => {
if (Constants.platform.ios) {
const { status } = await Permissions.askAsync(Permissions.CAMERA_ROLL);
if (status !== 'granted') {
alert('Sorry, we need camera roll permissions to make this work!');
}
}
}
_pickImage = async () => {
let result = await ImagePicker.launchImageLibraryAsync({
mediaTypes: ImagePicker.MediaTypeOptions.Images,
allowsEditing: true,
aspect: [4, 3],
base64: true
});
// console.log(result.base64);
if (!result.cancelled) {
this.setState({ image64: result.base64 });
}
};
_
}
export class bank extends React.Component {
constructor(props) {
super(props);
this.state = { projectbalance: 0 ,moneystatus : 'No requests so far' ,requestedbalance: 0 ,projectstatus: "Pending",requestedmsg: '' ,accountNo: '', ifscCode: '',email : '', status : 'NO', education: '', projectwithdrawn: 0, currentbalance :0, projectName:global.name ,longDescription:global.longdescription ,shortDescription: global.shortdescription};
}
async newUser(data) {
try {
let response = await fetch('http://ec2-3-14-86-69.us-east-2.compute.amazonaws.com/addProject', {
method: 'POST',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify(data),
});
let responseJson = await response.json();
return responseJson;
} catch (error) {
console.log(error);
}
}
componentDidMount() {
userMail = AsyncStorage.getItem('userMail', (err, result) => {
let maill = JSON.parse(result);
maill = maill.mail;
// console.log(maill);
this.setState({ email : maill});
});
}
render() {
return (
<View style={styles.container}>
<View style={styles.innerContainer}>
<Text style={styles.header}>Enter Bank Details</Text>
<TextInput
style={styles.textinput}
placeholder="Your Account No"
underlineColorAndroid={'transparent'}
onChangeText={accountNo => this.setState({ accountNo })}
/>
<TextInput
style={styles.textinput}
placeholder="Your IFSC Code"
underlineColorAndroid={'transparent'}
onChangeText={ifscCode => this.setState({ ifscCode })}
/>
<TextInput
style={styles.textinput}
placeholder="Your Educational Qualifications"
underlineColorAndroid={'transparent'}
onChangeText={education => this.setState({ education })}
/>
<TouchableOpacity
style={styles.button}
onPress={() => {
this.newUser(this.state);
this.props.navigation.navigate('proj');
}}>
<Text style={styles.btntext}>Submit</Text>
</TouchableOpacity>
</View>
</View>
);
}
}
const style = StyleSheet.create({
textAreaContainer: {
borderColor: '#ededed',
borderWidth: 1,
padding: 5,
alignSelf: 'stretch',
},
textArea: {
height: 150,
width:230,
},
});