Commit c6e847a3 authored by tejaswi's avatar tejaswi
Browse files

Changes

parent 1fb68f05
Showing with 1142 additions and 343 deletions
+1142 -343
This diff is collapsed.
/*
FileName:ReportBug.js
Version:1.0.0
Purpose: Report Bug 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';
export default class ReportBug extends Component {
constructor(props) {
super(props);
this.state = {
email_to_contact:'',
bug_one_sen:'',
steps_for_bug:'',
};
}
//Adding the new Employee
onSignIn() {
log("Info", " onSignIn( usertype, user_status, password) is used to Adding the new Employee");
if (this.isValid()) {
console.log("staredt.,.................");
// console.log(this.state.designation);
// console.log(this.state.team);
// console.warn(this.state.usertype);
// console.warn("empId" + this.state.empId + "fulllname" + this.state.fullname + "username" + this.state.username + "mobile" + this.state.mobile + "emp_role" + this.state.emp_role);
console.log(this.state.email_to_contact);
console.warn(this.state.bug_one_sen);
console.log(this.state.steps_for_bug);
const { empId, email_to_contact, bug_one_sen, steps_for_bug } = this.state;
AsyncStorage.getItem("cropcode", (err, res) => {
const cropcode = res;
AsyncStorage.getItem("userToken", (err, res) => {
const userToken = res;
AsyncStorage.getItem("projectId", (err, res) => {
const projectId = res;
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',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify({
empId: empId,
fullname: this.state.fullname,
email: this.state.email,
username: this.state.username,
mobile: this.state.mobile,
action: "check_user",
corp: cropcode,
password: pass_code,
// team: team,
// functionalManager: fmanager,
// reportingManager: rmanager,
// designation: designation,
userType: usertype,
// user_status: user_status,
// created_by: "admin",
// created_by: userToken,
projectId: projectId,
})
}).then((response) => response.json())
.then((responseJson) => {
//alert(responseJson);
console.log(JSON.stringify(responseJson));
console.log(responseJson);
// alert(JSON.stringify(responseJson));
if (responseJson.status === 'True') {
this.props.navigation.navigate('UserManageEmployees');
}
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");
}
else 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 {
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="arrow-left" size={25} style={{ color: '#fff', }} onPress={() =>
this.props.navigation.navigate('UserManageEmployees')} />
</Left>
<Body>
<Title style={{ color: '#fff', fontWeight: '600' }}>Report Bug</Title>
</Body>
<Right></Right>
</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>
When The Bug Is Resolved, Which Email Should We Contact You At?*
</Text>
</View>
<View>
<TextInput style={{ width: wp('95%'), height: 45, borderBottomWidth: 1, }}
placeholder="Enter Emai"
underlineColorAndroid='transparent'
value={this.state.email_to_contact}
onChangeText={(email_to_contact) => this.setState({ email_to_contact })}
/>
</View>
</View>
<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>
<View style={{ flexDirection: 'row', marginTop: 10, justifyContent: "space-between" }}>
<TouchableOpacity style={styles.opensave}
onPress={() => this.onSignIn()} >
<Text style={{ color: 'white' }}>ADD</Text>
</TouchableOpacity>
<TouchableOpacity style={styles.opencancel} onPress={() => this.props.navigation.navigate('UserDashboard')}>
<Text style={{ color: 'white' }}>CANCEL</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'
},
}),
},
});
\ No newline at end of file
......@@ -90,6 +90,7 @@ import UserGroupChat from '../UserComponents/UserGroupChat';
import UserGroupChatModify from '../UserComponents/UserGroupChatModify';
import UserDashboard from '../UserComponents/UserDashboard';
import Instruction from '../UserComponents/Instruction';
import UserSupport from '../UserComponents/UserSupport';
import AddModule from '../CommonComponents/AddModule';
import AddMainTask from '../CommonComponents/AddMainTask';
......@@ -149,6 +150,7 @@ import ViewTask from '../CommonComponents/ViewTask';
import AssignTemplate from '../CommonComponents/AssignTemplate';
import ModifyPersonalTodo from '../CommonComponents/ModifyPersonalTodo';
import AssignTodo from '../CommonComponents/AssignTodo';
import ReportBug from '../CommonComponents/ReportBug';
......@@ -655,7 +657,12 @@ const adminAppStack = createStackNavigator({
header: null,
},
},
ReportBug:{
screen:ReportBug,
navigationOptions:{
header:null,
},
},
AddRoadblock: {
screen: AddRoadblock,
......@@ -1137,6 +1144,12 @@ const userAppStack = createStackNavigator({
header: null,
},
},
UserSupport:{
screen:UserSupport,
navigationOptions:{
header:null,
},
},
RoadBlockList: {
screen: RoadBlockList,
navigationOptions: {
......@@ -1177,6 +1190,12 @@ const userAppStack = createStackNavigator({
header: null,
},
},
ReportBug:{
screen:ReportBug,
navigationOptions:{
header:null,
},
},
UserManageProjects1: {
screen: UserManageProjects1,
navigationOptions: {
......
......@@ -310,6 +310,13 @@ export default class drawerContentComponents extends Component {
<Text style={{ color: '#000000', marginLeft: 20 }}>Chat Room</Text>
</View>
</TouchableOpacity>
<TouchableOpacity onPress={this.navigateToScreen('UserSupport')}>
<View style={styles.screenStyle}>
<Image style={{ width: wp('6%'), height: hp('3%') }} source={require('../Images/groupchat.png')} />
<Text style={{ color: '#000000', marginLeft: 20 }}>Support</Text>
</View>
</TouchableOpacity>
{/* <TouchableOpacity onPress={this.navigateToScreen('Updates')}>
<View style={styles.screenStyle}>
<Icon size={25} name="history" style={{ color: '#000000', width: wp('8%') }} />
......
This diff is collapsed.
......@@ -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
......
......@@ -104,15 +104,15 @@ class ListItem extends React.Component {
}
let buttonMessage;
if (item.notification_belongs === '') {
buttonMessage =
<View style={{ flexDirection: 'row', paddingRight: 25, }}>
<Text style={styles.signUpText4} >Notification Message : </Text>
<Text style={styles.signUpText3} >{item.notification_message}</Text>
</View>
buttonMessage =
<View style={{ flexDirection: 'row', paddingRight: 25, }}>
<Text style={styles.signUpText4} >Notification Message : </Text>
<Text style={styles.signUpText3} >{item.notification_message}</Text>
</View>
}
else {
buttonMessage =
<View style={{ flexDirection: 'column', paddingRight: 25, }}>
<View style={{ flexDirection: 'row', paddingRight: 25, }}>
<Text style={styles.signUpText4} >Notification Message : </Text>
<Text style={styles.signUpText3} >{item.notification_message}</Text>
</View>
......@@ -123,15 +123,15 @@ class ListItem extends React.Component {
{/* <TouchableOpacity onPress={this.props.MainTask}> */}
<View style={{ borderRadius: 2, margin: 6, borderColor: 'grey', borderWidth: 0.5, marginTop: 10 }}>
<View style={styles.box}>
{item.notification_belongs !== "User Squad" ?
<View style={{ flexDirection: 'row', width: wp('60%') }}>
<Text style={styles.signUpText0} >Project Name : </Text>
<Text style={styles.signUpText1}>{item.project_name}</Text>
</View>
:
<View style={{ flexDirection: 'row', width: wp('60%') }}>
<Text style={styles.signUpText0} >General Chat Message</Text>
</View>}
{item.notification_belongs !== "User Squad" ?
<View style={{ flexDirection: 'row', width: wp('60%') }}>
<Text style={styles.signUpText0} >Project Name : </Text>
<Text style={styles.signUpText1}>{item.project_name}</Text>
</View>
:
<View style={{ flexDirection: 'row', width: wp('60%') }}>
<Text style={styles.signUpText0} >General Chat Message</Text>
</View>}
<Text style={styles.signUpText2}>{moment(item.date).format('MM-DD-YYYY hh:mm:ss')}</Text>
</View>
......@@ -139,11 +139,11 @@ class ListItem extends React.Component {
{buttonMessage}
{item.notification_belongs !== "" ?
<View style={{ flexDirection: 'row', paddingRight: 25, }}>
<Text style={styles.signUpText4} >Notification Belongs:</Text>
<Text style={styles.signUpText3} >{item.notification_belongs !== "User Squad" ? item.notification_belongs : "Header Chat"}</Text>
</View>
:null}
<View style={{ flexDirection: 'row', paddingRight: 25, }}>
<Text style={styles.signUpText4} >Notification Belongs:</Text>
<Text style={styles.signUpText3} >{item.notification_belongs !== "User Squad" ? item.notification_belongs : "Header Chat"}</Text>
</View>
: null}
<View style={{ flexDirection: 'row', paddingRight: 25, marginBottom: 10 }}>
<Text style={styles.signUpText4} >Notification From:</Text>
<Text style={styles.signUpText3} >{item.notification_from}</Text>
......@@ -522,25 +522,25 @@ export default class UserNotification extends React.Component {
duration: Snackbar.LENGTH_LONG,
});
} else {
fetch(API + 'user_notifications.php', {
method: 'POST',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify({
action: 'getCompletedSprints',
emp_id: empId,
// userType: role,
// idea_id: idea_id,
crop: cropcode,
// projectId: projectId,
})
fetch(API + 'user_notifications.php', {
method: 'POST',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify({
action: 'getCompletedSprints',
emp_id: empId,
// userType: role,
// idea_id: idea_id,
crop: cropcode,
// projectId: projectId,
})
})
.then((response) => response.json())
.then((responseJson) => {
//alert(JSON.stringify(responseJson));
//alert(JSON.stringify(responseJson));
if (responseJson.status === 'True') {
// this.addArchivesList(responseJson.data, cropcode) //Store Approved Projects List Offline
this.setState({
......@@ -688,9 +688,9 @@ export default class UserNotification extends React.Component {
return project_name.indexOf(project_name1) > -1 ||
date.indexOf(date1) > -1 ||
notification_belongs.indexOf(notification_belongs1) > -1 ||
notification_from.indexOf(notification_from1) > -1
date.indexOf(date1) > -1 ||
notification_belongs.indexOf(notification_belongs1) > -1 ||
notification_from.indexOf(notification_from1) > -1
})
......@@ -750,7 +750,7 @@ export default class UserNotification extends React.Component {
</View>
</ModalSelector> */}
<Text style={{ marginTop: 15, color: 'white', marginLeft:20,fontSize:16 }}>Notifications</Text>
<Text style={{ marginTop: 15, color: 'white', marginLeft: 20, fontSize: 16 }}>Notifications</Text>
</View>
</Header>
......@@ -968,17 +968,19 @@ const styles = StyleSheet.create(
fontSize: 12,
paddingTop: 10,
paddingLeft: 10,
width: '75%',
width: '55%',
alignItems: 'center',
paddingRight:20,
},
signUpText4: {
fontSize: 12,
paddingTop: 10,
paddingLeft: 5,
width: '45%',
// backgroundColor:'#f8f8f8',
alignItems: 'center',
// alignItems: 'center',
},
signup: {
......
/*
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';
export default class UserSupport extends Component {
constructor(props) {
super(props);
this.state = {
email_to_contact:'',
bug_one_sen:'',
steps_for_bug:'',
docFile:'',
};
}
//Adding the new Employee
onSignIn() {
log("Info", " onSignIn( usertype, user_status, password) is used to Adding the new Employee");
if (this.isValid()) {
console.log("staredt.,.................");
// console.log(this.state.designation);
// console.log(this.state.team);
// console.warn(this.state.usertype);
// console.warn("empId" + this.state.empId + "fulllname" + this.state.fullname + "username" + this.state.username + "mobile" + this.state.mobile + "emp_role" + this.state.emp_role);
// console.log(this.state.email_to_contact);
console.warn(this.state.bug_one_sen);
console.log(this.state.steps_for_bug);
const { empId, bug_one_sen, steps_for_bug,docFile } = this.state;
const data = new FormData();
data.append('file', docFile);
data.append('action', 'releaseBug');
// data.append('api', CHATAPI);
data.append('bug_one_sen', bug_one_sen);
// data.append('email_to_contact', getUser.user.userName);
// data.append('useful_links', dataReport.useful_links);
data.append('steps_for_bug', steps_for_bug);
// alert("Testing"+JSON.stringify(data))
console.log("Support Data"+JSON.stringify(data))
AsyncStorage.getItem("cropcode", (err, res) => {
const cropcode = res;
AsyncStorage.getItem("userToken", (err, res) => {
const userToken = res;
AsyncStorage.getItem("projectId", (err, res) => {
const projectId = res;
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',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify(
data
)
}).then((response) => response.json())
.then((responseJson) => {
//alert(responseJson);
console.log(JSON.stringify(responseJson));
console.log(responseJson);
alert(JSON.stringify(responseJson));
if (responseJson.status === 'True') {
this.props.navigation.navigate('MyTask');
}
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' }}>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>
When The Bug Is Resolved, Which Email Should We Contact You At?*
</Text>
</View>
<View>
<TextInput style={{ width: wp('95%'), height: 45, borderBottomWidth: 1, }}
placeholder="Enter Emai"
underlineColorAndroid='transparent'
value={this.state.email_to_contact}
onChangeText={(email_to_contact) => this.setState({ email_to_contact })}
/>
</View>
</View> */}
<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>
<View style={{ flexDirection: 'row', marginTop: 10, justifyContent: "space-between" }}>
<TouchableOpacity style={styles.opensave}
onPress={() => this.onSignIn()} >
<Text style={{ color: 'white' }}>ADD</Text>
</TouchableOpacity>
<TouchableOpacity style={styles.opencancel} onPress={() => this.props.navigation.navigate('UserDashboard')}>
<Text style={{ color: 'white' }}>CANCEL</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'
},
}),
},
});
\ 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