Commit d0dc2b5f authored by santhosh's avatar santhosh
Browse files

support

Showing with 513 additions and 88 deletions
+513 -88
......@@ -49,6 +49,7 @@ class ListItem extends Component {
dataSource2: [],
roledata: '',
sendBy: '',
dataSource3: []
// expanded: false,
}
......@@ -111,7 +112,7 @@ class ListItem extends Component {
this.setState({
dataSource3: responseJson.data,
});
alert("Method data" + dataSource3)
}
else {
console.warn("Empty Data")
......@@ -246,13 +247,14 @@ class ListItem extends Component {
const getLastMsg = (message, emp) => {
const groupMsg = message.filter(msg => msg.sendBy === emp.id || msg.receivedBy === emp.id).map((mg, i) => {
// alert("Method data" + JSON.stringify(emp))
const groupMsg = message.filter(msg => msg.sendBy === emp || msg.receivedBy === emp).map((mg, i) => {
return mg.message
});
return groupMsg[groupMsg.length - 1]
}
const getLastMsgTime = (message, emp) => {
const groupMsg = message.filter(msg => msg.sendBy === emp.id || msg.receivedBy === emp.id).map((mg, i) => {
const groupMsg = message.filter(msg => msg.sendBy === emp || msg.receivedBy === emp).map((mg, i) => {
return mg.messagedTime
});
return groupMsg[groupMsg.length - 1]
......@@ -366,26 +368,30 @@ class ListItem extends Component {
<Text style={styles.iconSend} >{(item.name).substring(0, 2).toUpperCase()}</Text>
</View>
<Text style={styles.signUpText1} >{item.name}</Text>
</View>
<View>
{getLastMsg(this.state.dataSource2, item.id)}
</View>
{/* <View style={{ flexDirection: 'row', justifyContent: 'flex-end', alignItems: 'center' }}> */}
{getMessagesCount(this.state.dataSource2, item.id)}
{/* </View> */}
</View>
<View style={{ flexDirection: 'row' }}>
<Text style={{ color: 'grey', width: '70%', paddingLeft: 60 }}> {getLastMsg(this.state.dataSource3, item.id)}</Text>
<Text style={{ color: 'grey', fontSize: 10 }}> {getLastMsgTime(this.state.dataSource3, item.id)}</Text>
</View>
<View>
</View>
</View>
{/* <View
style={{
marginTop: 15,
borderBottomColor: '#C0C0C0',
borderBottomWidth: 0.2,
}}
/> */}
style={{
marginTop: 15,
borderBottomColor: '#C0C0C0',
borderBottomWidth: 0.2,
}}
/> */}
</View>
......@@ -1503,4 +1509,4 @@ const pickerSelectStyles = StyleSheet.create({
},
});
\ No newline at end of file
});
......@@ -550,6 +550,11 @@ export default class Login extends Component {
<Text style={styles.signUpTextforgot}>Forgot Password ?</Text>
<Text style={styles.signUpTextforgotred}>Click here</Text>
</TouchableOpacity>
<TouchableOpacity onPress={() => this.props.navigation.navigate("Support")} style={[styles.buttonContainerforgot,]}>
<Text style={styles.signUpTextforgot}>Support</Text>
<Icon name="handshake-o" size={20} style={{ color: '#fff',}} />
</TouchableOpacity>
<View >
{/* <Text style={{ color: 'white' }} onPress={()=>this.props.navigation.navigate('RegisterUser')}> New User ? </Text> */}
</View>
......
/*
FileName:UserSupport.js
Version:1.0.0
Purpose: User Support Screen
Devloper:Mahesh Reddy
*/
import React, { Component } from 'react';
import { Platform, StyleSheet, Text, View, StatusBar, Dimensions, Picker, TouchableOpacity, Linking, TextInput, Alert } from 'react-native';
import { Title, Button, Container, Content, Header, Right, Left, Body, Tab, Tabs, TabHeading, Footer, Item, Input, FooterTab } from 'native-base';
import { widthPercentageToDP as wp, heightPercentageToDP as hp } from 'react-native-responsive-screen';
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
import SearchableDropdown from 'react-native-searchable-dropdown';
import AsyncStorage from '@react-native-community/async-storage';
// import { tsMethodSignature } from '@babel/types';
import { API } from "../WebServices/RestClient";
import NetInfo from '@react-native-community/netinfo';
import Snackbar from 'react-native-snackbar';
import ModalSelector from 'react-native-modal-selector';
// import { Dropdown } from 'react-native-material-dropdown';
import log from '../LogFile/Log';
import Toast from 'react-native-whc-toast';
import { MAINTASKINFO, MAINTASKTITLE, DESCRIPTION, } from '../CommonComponents/Header';
import { ScrollView } from 'react-native-gesture-handler';
import { EMPLOYEEID1, FULLNAME, USERNAME1, EMAIL1, MOBILE1, ADDEMPLOYEE, EMPLOYEEDETAILS } from '../CommonComponents/Header';
import RadioButtonRN from 'radio-buttons-react-native';
import { launchCamera, launchImageLibrary } from 'react-native-image-picker';
const options = {
title: 'Select Image',
type: 'library',
options: {
maxHeight: 200,
maxWidth: 200,
selectionLimit: 1,
mediaType: 'photo',
includeBase64: false
},
}
export default class UserSupport extends Component {
constructor(props) {
super(props);
this.state = {
email_to_contact: '',
bug_one_sen: '',
steps_for_bug: '',
docFile: '',
};
}
//upload Report
reportBugimage = async () => {
log("Info", " onSignIn( usertype, user_status, password) is used to Adding the new Employee");
const images = await launchImageLibrary(options);
if (this.isValid()) {
AsyncStorage.multiGet(["cropcode", "userName", "fullName"], (err, response) => {
const cropcode = response[0][1];
const userName = response[1][1];
const { empId, bug_one_sen, steps_for_bug, docFile } = this.state;
const data = new FormData();
data.append('file', {
uri: images.assets[0].uri,
type: images.assets[0].type,
name: images.assets[0].fileName,
})
data.append('action', 'releaseBug');
data.append('api', 'https://api-single.agile24x7.com/release');
data.append('bug_one_sen', bug_one_sen);
data.append('email_to_contact', userName);
data.append('steps_for_bug', steps_for_bug);
NetInfo.fetch().then(state => {
if (state.type == "none") {
console.log(state.type);
log("Warn", "No internet connection");
Snackbar.show({
title: 'No Internet Connection',
backgroundColor: 'red',
duration: Snackbar.LENGTH_LONG,
});
} else {
fetch(API + 'report_bug.php', {
method: 'post',
body: data,
headers: {
'Content-Type': 'multipart/form-data; ',
},
}).then((response) => response.json())
.then((responseJson) => {
//alert(responseJson);
console.log(JSON.stringify(responseJson));
console.log(responseJson);
alert("Your report was sent successfully")
if (responseJson.status === 'True') {
this.props.navigation.navigate('Login');
}
else {
console.log(JSON.stringify(responseJson));
log("Warn", "Error found");
// alert("error");
// alert(responseJson.message)
}
}).catch((error) => {
console.error(error);
log("Error", "Adding the new Employee error");
});
}
});
});
}
}
//upload Report
reportBug(){
if (this.isValid()) {
AsyncStorage.multiGet(["cropcode", "userName", "fullName"], (err, response) => {
const cropcode = response[0][1];
const userName = response[1][1];
const { empId, bug_one_sen, steps_for_bug, docFile } = this.state;
const data = new FormData();
data.append('file', '')
data.append('action', 'releaseBug');
data.append('api', 'https://api-single.agile24x7.com/release');
data.append('bug_one_sen', bug_one_sen);
data.append('email_to_contact', userName);
data.append('steps_for_bug', steps_for_bug);
NetInfo.fetch().then(state => {
if (state.type == "none") {
console.log(state.type);
log("Warn", "No internet connection");
Snackbar.show({
title: 'No Internet Connection',
backgroundColor: 'red',
duration: Snackbar.LENGTH_LONG,
});
} else {
fetch(API + 'report_bug.php', {
method: 'post',
body: data,
headers: {
'Content-Type': 'multipart/form-data; ',
},
}).then((response) => response.json())
.then((responseJson) => {
//alert(responseJson);
console.log(JSON.stringify(responseJson));
console.log(responseJson);
alert("Your report was sent successfully")
if (responseJson.status === 'True') {
this.props.navigation.navigate('Login');
}
else {
console.log(JSON.stringify(responseJson));
log("Warn", "Error found");
// alert("error");
// alert(responseJson.message)
}
}).catch((error) => {
console.error(error);
log("Error", "Adding the new Employee error");
});
}
});
});
}
}
//Checking the Validations start
isValid() {
var { email_to_contact, bug_one_sen, steps_for_bug } = this.state;
let valid = false;
// if (empId.length === 0) {
// log("Warn", "empId should not be empty");
// alert("Enter Employee Id");
// }
// if (!this.verifyEmail(email_to_contact)) {
// log("Warn", "Email should not be empty");
// alert("Enter Email");
// }
if (bug_one_sen.length === 0) {
log("Warn", "Bug should not be empty");
// alert("Enter Bug Report");
}
else if (steps_for_bug.length === 0) {
log("Warn", "Steps should not be empty");
// alert("Enter Steps of Bugs");
}
// else if (mobile.length === 0) {
// log("Warn", "mobile should not be empty");
// alert("Enter phonenumber");
// }
// else if (mobile.length > 10) {
// log("Warn", "mobile should not be greater than 10");
// alert("Invalid phonenumber");
// }
// else if (mobile.length < 10) {
// log("Warn", "mobile should not be less than 10");
// alert("Invalid phonenumber");
// }
else {
valid = true;
}
return valid;
}
verifyEmail(email_to_contact) {
var reg = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
return reg.test(email_to_contact);
}
//Checking the Validations end
//Add or Mpdify the Maintask close
// componentDidMount() {
// //Getting Employees List
// log("Debug", "Add Task screen is loaded");
// }
render() {
return (
<Container>
<Header
androidStatusBarColor="#00A2C1"
style={{
backgroundColor: '#00A2C1',
height: 60,
width: Dimensions.get('window').width,
borderBottomColor: '#ffffff',
justifyContent: 'space-between',
}}>
{/* <Left>
<Icon name="menu" size={25} style={{ color: '#fff' }} onPress={() =>
this.props.navigation.toggleDrawer()} />
</Left> */}
<Body>
<Title style={{ color: '#fff', fontWeight: '600',paddingLeft:20 }}>Support</Title>
</Body>
</Header>
<Content>
<Toast ref="toast" />
<View style={{ paddingTop: 20, }}>
<Text style={{ paddingTop: 10, paddingLeft: 20 }}>
Tell us about the bug you found!
</Text>
</View>
<View style={{ paddingTop: 20, }}>
<View style={{ paddingLeft: 10, }}>
<View style={{ width: wp('95%'), }}>
<Text>
Could You Please Describe This Bug In One Sentence?* </Text>
</View>
<View>
<TextInput style={{ width: wp('95%'), height: 45, borderBottomWidth: 1, }}
placeholder="Scrum board or Active Sprint: Sprint Name not displaying "
underlineColorAndroid='transparent'
value={this.state.bug_one_sen}
onChangeText={(bug_one_sen) => this.setState({ bug_one_sen })}
/>
</View>
</View>
<View style={{ paddingLeft: 10, }}>
<View style={{ width: wp('95%'), }}>
<Text>
Let Us Know How To Reproduce The Bug For Us To Work On?*
</Text>
</View>
<View>
<TextInput style={{ width: wp('95%'), height: 45, borderBottomWidth: 1, }}
placeholder="1. Go to Dashboards | 2. Add a new Project "
// maxLength={10}
// keyboardType={"number-pad"}
underlineColorAndroid='transparent'
value={this.state.steps_for_bug}
onChangeText={(steps_for_bug) => this.setState({ steps_for_bug })}
/>
</View>
</View>
<TouchableOpacity style={styles.upload}
onPress={this.reportBugimage} >
<Text style={{ color: 'white' }}>Uplaod</Text>
</TouchableOpacity>
<View style={{ flexDirection: 'row', marginTop: 10, justifyContent: "space-between" }}>
<TouchableOpacity style={styles.opensave}
onPress={this.reportBug()} >
<Text style={{ color: 'white' }}>Submit</Text>
</TouchableOpacity>
</View>
</View>
</Content>
</Container>
);
}
}
//Styles for UI
const styles = StyleSheet.create({
opencancel: {
flex: 1,
...Platform.select({
ios: {
backgroundColor: 'red', margin: 20, height: 30, alignItems:
"center", justifyContent: 'center'
},
android: {
backgroundColor: 'red', margin: 20, height: 30, alignItems:
"center", justifyContent: 'center'
},
}),
},
opensave: {
flex: 1,
...Platform.select({
ios: {
backgroundColor: 'green', margin: 20, height: 30, alignItems:
"center", justifyContent: 'center'
},
android: {
backgroundColor: 'green', margin: 20, height: 30, alignItems:
"center", justifyContent: 'center'
},
}),
},
upload: {
flex: 1,
...Platform.select({
ios: {
backgroundColor: '#f1f0ef', margin: 20, height: 30, alignItems:
"center", justifyContent: 'center'
},
android: {
backgroundColor: '#f1f0ef', margin: 20, height: 30, alignItems:
"center", justifyContent: 'center'
},
}),
},
});
\ No newline at end of file
......@@ -22,6 +22,7 @@ import UserDashboardTodo from '../UserComponents/UserDashboardTodo';
import Login from '../LaunchScreens/Login';
import RegisterUser from '../LaunchScreens/RegisterUser';
import Forgot from '../LaunchScreens/Forgot';
import Support from '../LaunchScreens/Support';
import Maintenance from '../Maintenance/Maintenance';
// import drawerContentComponents from './UserDrawerComponents';
......@@ -1263,6 +1264,12 @@ const AuthStack = createStackNavigator({
header: null,
},
},
Support: {
screen: Support,
navigationOptions: {
header: null,
},
},
// Maintenance: {
// screen: Maintenance,
......
......@@ -252,13 +252,28 @@ class ListItem extends React.Component {
}
const getLastMsg = (message, id) => {
const groupMsg = message.filter(msg => msg.groupId === id).map((mg, i) => {
return mg.message
});
return groupMsg[groupMsg.length - 1]
}
const getLastMsgTime = (message, id) => {
const groupMsg = message.filter(msg => msg.groupId === id).map((mg, i) => {
return mg.messaged_time
});
return groupMsg[groupMsg.length - 1]
}
const getLastMsgSendBy = (message, id) => {
const groupMsg = message.filter(msg => msg.groupId === id).map((mg, i) => {
return mg.fullname
});
return groupMsg[groupMsg.length - 1]
}
// alert(JSON.stringify(item))
// alert(JSON.stringify(this.props.empId))
// var data1=this.state.dataSource1;
const getMessagesCount = (id, msg, empId) => {
// console.warn("ids"+JSON.stringify(data1) +id)
//alert("ids"+JSON.stringify(msg))
// var msg=this.state.dataSource1;
// console.warn("Datasource and id send by"+JSON.stringify(data1.sendBy))
......@@ -325,25 +340,20 @@ class ListItem extends React.Component {
<Text style={styles.signUpText1} >{item.group_name}</Text>
</View>
</View>
</View>
<View style={{ flexDirection: 'row', justifyContent: 'flex-end' }}>
{/* <TouchableOpacity style={{ padding: 5, backgroundColor: '#43EA78', marginLeft: 10, borderRadius: 10 }} onPress={() => this.props.UserGroupChatModify()}>
<Text style={{ color: 'white', fontSize: 12 }} >Edit Group</Text>
</TouchableOpacity> */}
{buttonDelete}
<View style={{ flexDirection: 'row', justifyContent: 'flex-end', alignItems: 'center' }}>
<TouchableOpacity style={{ padding: 5, backgroundColor: '#214274', marginLeft: 10, borderRadius: 10 }} onPress={() => this.props.exitGroup()}>
<Text style={{ color: 'white', fontSize: 12 }}>Exit Group</Text>
</TouchableOpacity>
<Text style={{width:'60%',color:'grey'}}> {getLastMsg(this.state.dataSource2, item.id)}</Text>
<View style={{ justifyContent: 'flex-end',flexDirection: 'row' }}>
{buttonDelete}
<View style={{ flexDirection: 'row', justifyContent: 'flex-end', alignItems: 'center' }}>
<TouchableOpacity style={{ padding: 5, backgroundColor: '#214274', marginLeft: 10, borderRadius: 10 }} onPress={() => this.props.exitGroup()}>
<Text style={{ color: 'white', fontSize: 12 }}>Exit Group</Text>
</TouchableOpacity>
</View>
{getMessagesCount(item.id, this.state.dataSource2, this.props.empId)}
</View>
{getMessagesCount(item.id, this.state.dataSource2, this.props.empId)}
</View>
</View>
</View>
......@@ -792,62 +802,62 @@ export default class UserGroupChat extends Component {
const projectId = res;
AsyncStorage.getItem("userToken", (err, res) => {
const empId = res;
// alert(this.state.username)
NetInfo.fetch().then(state => {
if (state.type == "none" || state.type == 'unknown' || state.type == 'undefined') {
console.log(state.type);
Snackbar.show({
title: 'No Internet Connection',
backgroundColor: 'red',
duration: Snackbar.LENGTH_LONG,
});
} else {
fetch(API + 'group_chat.php',
{
method: 'POST',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify({
// crop: cropcode,
action: 'getGroupDetails',
created_by: this.state.username,
projectId: projectId,
empId:empId
})
})
.then((response) => response.json())
.then((responseJson) => {
if (responseJson.status === 'True') {
// alert(JSON.stringify(responseJson))
this.setState({
resource: responseJson.data
});
this.arrayholder = responseJson.data;
}
else {
this.arrayholder = [];
// alert(this.state.username)
NetInfo.fetch().then(state => {
if (state.type == "none" || state.type == 'unknown' || state.type == 'undefined') {
console.log(state.type);
Snackbar.show({
title: 'No Internet Connection',
backgroundColor: 'red',
duration: Snackbar.LENGTH_LONG,
});
} else {
fetch(API + 'group_chat.php',
{
method: 'POST',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify({
// crop: cropcode,
action: 'getGroupDetails',
created_by: this.state.username,
projectId: projectId,
empId: empId
this.setState({
isLoading: false,
resource: []
})
}
})
.then((response) => response.json())
.then((responseJson) => {
if (responseJson.status === 'True') {
// alert(JSON.stringify(responseJson))
this.setState({
resource: responseJson.data
});
this.arrayholder = responseJson.data;
}
else {
this.arrayholder = [];
this.setState({
isLoading: false,
resource: []
})
}
})
.catch((error) => {
console.error(error);
log("Error", "error in listing employees");
});
}
})
.catch((error) => {
console.error(error);
log("Error", "error in listing employees");
});
}
});
});
});
});
});
});
}
//getting the Employees list for addind maintask
......
......@@ -316,14 +316,14 @@ render() {
</View>
</View>
<TouchableOpacity style={styles.upload}
onPress={this.reportBugimage} >
<Text style={{ color: 'white' }}>Uplaod</Text>
</TouchableOpacity>
<View style={{ flexDirection: 'row', marginTop: 10, justifyContent: "space-between" }}>
<TouchableOpacity style={styles.opensave}
onPress={this.reportBugimage} >
<Text style={{ color: 'white' }}>Uplaod</Text>
</TouchableOpacity>
<TouchableOpacity style={styles.opensave}
onPress={this.reportBug()} >
......@@ -365,4 +365,17 @@ const styles = StyleSheet.create({
},
}),
},
upload: {
flex: 1,
...Platform.select({
ios: {
backgroundColor: '#f1f0ef', margin: 20, height: 30, alignItems:
"center", justifyContent: 'center'
},
android: {
backgroundColor: '#f1f0ef', margin: 20, height: 30, alignItems:
"center", justifyContent: 'center'
},
}),
},
});
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment