diff --git a/package-lock.json b/package-lock.json index 93a5798b43a3b4781e74a4b4f78ed8bf5e60c8dd..20794e5502a26c5869cda262a93d5ddf507bd0e3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4106,6 +4106,11 @@ } } }, + "base-64": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/base-64/-/base-64-0.1.0.tgz", + "integrity": "sha1-eAqZyE59YAJgNhURxId2E78k9rs=" + }, "base64-js": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", @@ -13236,6 +13241,14 @@ "resolved": "https://registry.npmjs.org/react-native-device-info/-/react-native-device-info-8.1.3.tgz", "integrity": "sha512-73e3wiGFL8DvIXEd8x4Aq+mO8mZvHARwfYorIEu+X0trLHY92bP5Ict8DJHDjCQ0+HtAvpA4Wda2VoUVN1zh6Q==" }, + "react-native-document-picker": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/react-native-document-picker/-/react-native-document-picker-7.1.1.tgz", + "integrity": "sha512-lEgyfl+JbU/UCDu8UdagBrC5CC71WTfqCzWyGeALLZiXGHrCJo/5BMqWbAc9PSCeiqNMnFkjcybO/kws5gMkxA==", + "requires": { + "invariant": "^2.2.4" + } + }, "react-native-drawer": { "version": "2.5.1", "resolved": "https://registry.npmjs.org/react-native-drawer/-/react-native-drawer-2.5.1.tgz", @@ -14055,6 +14068,30 @@ "glob": "^7.1.3" } }, + "rn-fetch-blob": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/rn-fetch-blob/-/rn-fetch-blob-0.12.0.tgz", + "integrity": "sha512-+QnR7AsJ14zqpVVUbzbtAjq0iI8c9tCg49tIoKO2ezjzRunN7YL6zFSFSWZm6d+mE/l9r+OeDM3jmb2tBb2WbA==", + "requires": { + "base-64": "0.1.0", + "glob": "7.0.6" + }, + "dependencies": { + "glob": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.0.6.tgz", + "integrity": "sha1-IRuvr0nlJbjNkyYNFKsTYVKz9Xo=", + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.2", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + } + } + }, "rsvp": { "version": "4.8.5", "resolved": "https://registry.npmjs.org/rsvp/-/rsvp-4.8.5.tgz", diff --git a/package.json b/package.json index 88f5bf03b5f666a126aa24f71a1174231e706a34..543a60057d928feabd7c1e6af5dc0d230ce76a84 100644 --- a/package.json +++ b/package.json @@ -28,6 +28,7 @@ "react-native-datepicker": "^1.7.2", "react-native-daterange-picker": "^1.5.1", "react-native-device-info": "^8.0.1", + "react-native-document-picker": "^7.1.1", "react-native-dropdown-menu": "^2.0.0", "react-native-dropdown-picker": "^4.0.4", "react-native-events-calendar": "^1.0.8", @@ -63,6 +64,7 @@ "react-navigation-drawer": "^2.6.0", "react-navigation-stack": "^2.10.2", "react-navigation-tabs": "^2.11.0", + "rn-fetch-blob": "^0.12.0", "sharingan-rn-modal-dropdown": "^1.3.0" }, "devDependencies": { diff --git a/src/AdminComponets/AdminProjectReports.js b/src/AdminComponets/AdminProjectReports.js new file mode 100644 index 0000000000000000000000000000000000000000..4fb9a1f8e3de3870bdf026501f3a1c77544ca50d --- /dev/null +++ b/src/AdminComponets/AdminProjectReports.js @@ -0,0 +1,584 @@ +/* +FileName:AdminReports1.js +Version:1.0.0 +Purpose:Working Hours showing in table formate +Devloper:Mahesh,Santhosh +*/ +import React, { Component } from 'react'; +import { + Platform, StyleSheet, TextPropTypes, Picker, Text, Button, View, Image, StatusBar, Dimensions, TextInput, Alert, + KeyboardAvoidingView, + TouchableWithoutFeedback, + FlatList, + Keyboard +} from 'react-native'; +// import { Chart, VerticalAxis, HorizontalAxis, Line } from 'react-native-responsive-linechart' +import { Icon, Title, Container, Content, Header, Right, Left, Body } from 'native-base'; +import { widthPercentageToDP as wp, heightPercentageToDP as hp } from 'react-native-responsive-screen'; +import { TouchableOpacity } from 'react-native-gesture-handler'; +import AsyncStorage from '@react-native-community/async-storage'; +import { ReportsAPI } from "../WebServices/RestClient"; +import { API } from "../WebServices/RestClient"; +import NetInfo from '@react-native-community/netinfo'; +import Snackbar from 'react-native-snackbar'; +import log from '../LogFile/Log'; +import ProffileOffline from '../OfflineDB/Profile'; +const db = new ProffileOffline(); +import Main from '../Maintenance/Main'; +import jwt_decode from "jwt-decode"; +import ModalSelector from 'react-native-modal-selector'; +const check = new Main() +import { + DotIndicator, +} from 'react-native-indicators'; +// import { LineChart, BarChart } from "react-native-chart-kit"; +import { ScrollView } from 'react-native-gesture-handler'; +import { PROFILE, CHANGEPASSWORD, EMPLOYEEID, USERNAME, EMAIL, MOBILE, FULLNAME1, DESIGNATION, TEAM, ROLE, FMANAGER, RMANAGER, STATUS1 } from '../CommonComponents/Header'; +import SearchableDropdown from 'react-native-searchable-dropdown'; +import PureChart from 'react-native-pure-chart'; +import moment from "moment"; +import DateRangePicker from "react-native-daterange-picker"; +import { DataTable } from 'react-native-paper'; + +class ListItem extends React.Component { + constructor(props) { + super(props); + this.state = { + isLoading: true, + // roledata: '', + } + + } + + + render() { + const { item } = this.props; + // alert("Setting") + AsyncStorage.getItem("emp_role", (err, res) => { + this.setState({ + roledata: res + }) + + }); + + + return ( + <View style={styles.container}> + + <View style={{ flexDirection: 'row' }}> + <View style={{ flexDirection: 'row', width: 140, borderWidth: 1, borderColor: 'black' }}> + <Text style={{}} >{item.story_title}</Text> + </View> + + <View style={{ flexDirection: 'row', }}> + <View style={{ flexDirection: 'row', borderWidth: 1, borderColor: 'black' }}> + <Text style={{ width: 80 }} > {item.working_hours} </Text> + </View> + + + </View> + </View> + + </View> + + ) + } +} + +export default class AdminProjectReports extends Component { + + constructor(props) { + super(props); + + this.state = { + isLoading: false, + isVisibleB: false, + sprintName: 'Select User', + epicName: 'Select Epic', + resource: [], + resource1: [], + dataSource: [], + // employee:[], + // startDate: null, + // endDate: null, + displayedDate: moment(), + startDate: moment().set("date", -15), + endDate: moment().set("date", 15), + + selectedDays: [], + selectedWeeks: [], + select: '' + } + + AsyncStorage.getItem("cropcode", (err, res) => { + this.setState({ squadName: res }); + console.warn("squadname" + this.state.squadName); + }); + + } + + setDates = (dates) => { + this.setState({ + ...dates, + }); + }; + + + // getDates = (startDate, stopDate) => { + // var dateArray = []; + // var currentDate = moment(startDate); + // stopDate = moment(stopDate); + // while (currentDate <= stopDate) { + // dateArray.push(moment(currentDate).format('MM-DD-YYYY')) + // currentDate = moment(currentDate).add(1, 'days'); + // } + // return dateArray; + // } + // getWeeks = (startDate, stopDate) => { + // var dateArray = []; + // var currentDate = moment(startDate); + // stopDate = moment(stopDate); + // while (currentDate <= stopDate) { + // dateArray.push(moment(currentDate).format('dddd')) + // currentDate = moment(currentDate).add(1, 'days'); + // } + // return dateArray; + // } + + + + + componentDidMount() { + + this.Reports(); + } + + + Reports() { + const { assignedto, sprintName, startDate, endDate } = this.state; + + + const filter = [{ + startDate: moment(this.state.startDate).format('YYYY-MM-DD[T]hh:mm:ss.SSS[Z]'), + endDate: moment(this.state.endDate).format('YYYY-MM-DD[T]hh:mm:ss.SSS[Z]'), + "key": "selection" + }] + + + NetInfo.fetch().then(state => { + if (state.type == "none") { + Snackbar.show({ + title: 'No Internet Connection', + backgroundColor: 'red', + duration: Snackbar.LENGTH_LONG, + }); + } else { + + fetch(ReportsAPI + `projectReport`, { + method: 'GET', + headers: { + 'Accept': 'application/json', + 'Content-Type': 'application/json', + }, + + + + }).then((response) => response.json()) + .then((responseJson) => { + // alert(JSON.stringify(responseJson)) + // alert("project reports" + JSON.stringify(responseJson)) + + // var sprintList = []; + // responseJson.map((sprints) => { + // return ( + // sprintList.push({ + // 'id': sprints.emp_id, 'name': sprints.fullname + // }) + // ); + // }) + + // var employee = []; + // responseJson.map((x) => { + // return (x.name !== "admin@novisync.com" ? employee.push(x) : null); + // }) + var employee = []; + responseJson.map((x) => { + return (x.name !== "admin@novisync.com" ? employee.push(x) : null); + }) + + this.setState({ + dataSource: employee, + }, + function () { + + } + ); + alert("data "+JSON.stringify(this.state.projectreports)+"test") + + }).catch((error) => { + check.Maintenance(); + console.error(error); + log("Error", "Error in getting profile data"); + + }); + } + + + }); + } + + + + render() { + const { assignedto, sprintName, startDate, endDate, displayedDate } = this.state; + + const data = { + "selectedOption": + { + "value": assignedto, + "label": sprintName + } + } + + //alert(JSON.stringify(data)); + //alert(JSON.stringify(this.state.startDate)); + + // alert("Employee "+this.state.resource1+"test") + // var filter = [{ + // "startDate": moment(this.state.startDate).format('YYYY-MM-DD'), + // "endDate": moment(this.state.endDate).format('YYYY-MM-DD'), + // // "key": "selection" + // }] + //alert(JSON.stringify(filter)); + // const { startDate, endDate, displayedDate, minDate, maxDate } = this.state; + // alert("data "+this.state.dataSource+"test") + + + + if (this.state.isLoading) { + return ( + <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}> + <DotIndicator color='#00A2C1' /> + </View> + ); + + } + + return ( + // <KeyboardAvoidingView + // style={{ flex: 1 }} + // behavior={Platform.OS === "ios" ? "padding" : "height"} + // > + <Container> + + <Header + androidStatusBarColor="#00A2C1" + style={{ + backgroundColor: '#00A2C1', + height: 60, + width: Dimensions.get('window').width, + borderBottomColor: '#ffffff', + justifyContent: 'space-between', + }}> + <View style={{ marginTop: 20 }}> + <Icon name="md-menu" size={25} style={{ color: 'white', }} onPress={() => + this.props.navigation.toggleDrawer()} /> + </View> + + <View style={{ width: 300, borderRadius: 20, height: 45, marginTop: 5, flexDirection: 'row' }}> + + <Text style={{ width: 300, borderRadius: 20, height: 45, marginTop: 20, flexDirection: 'row', color: 'white' }}>Admin Project Reports</Text> + + + + </View> + + </Header> + <Content> + + + + + + + + + + + <View style={{ paddingTop: 20, flexDirection: 'row', }}> + + + <DateRangePicker + style={{ zIndex: -100, position: 'absolute', }} + onChange={this.setDates} + startDate={startDate} + endDate={endDate} + + presetButtons={true} + completed + range + displayedDate={displayedDate} + moment={moment} + > + <Image style={{ width: wp('8%'), height: hp('4%'), margin: 5 }} source={require('../Images/calender.jpeg')} /> + + </DateRangePicker> + + <TouchableOpacity style={styles.opensave} onPress={() => { this.Reports() }}> + <Text style={{ color: 'white', padding: 5 }}>Show</Text> + </TouchableOpacity> + + </View> + + + + + + + + {/* + <View style={{ flexDirection: 'row', marginLeft: 17 }}> + <View style={{ flexDirection: 'row', width: 140, borderWidth: 1, borderColor: 'black', }}> + <Text style={styles.signUpText0} >USER STORY</Text> + </View> + + + <View style={{ flexDirection: 'row', }}> + <View style={{ flexDirection: 'row', borderWidth: 1, borderColor: 'black' }}> + <Text style={styles.signUpText0} > Completed </Text> + </View> + </View> + </View> + + <FlatList + + extraData={this.state} + keyExtractor={this._keyExtractor} + renderItem={this._renderItem} + + data={this.state.dataSource} + + refreshing={this.state.isFetching} + + ItemSeparatorComponent={this.FlatListItemSeparator} + renderItem={({ item, index }) => + <View> + + <ListItem navigation={this.props.navigation} + item={item} + ReOpenProjectAction={() => this.ReOpenProjectAction(item, index)}//For ReOpen Project + /> + </View> + } + keyExtractor={item => item.id} + ListEmptyComponent={this._listEmptyComponent} + /> */} + <ScrollView horizontal style={{ height: '40%', marginTop: 10 }}> + <View> + + <DataTable> + <DataTable.Header style={{ backgroundColor: '#333f50', color: "white" }}> + <DataTable.Title style={{ width: 200 }}><Text style={{ color: "white" }}>Project Name</Text></DataTable.Title> + <DataTable.Title style={{ width: 200 }}><Text style={{ color: "white" }}>No of total Users</Text></DataTable.Title> + <DataTable.Title style={{ width: 200 }}><Text style={{ color: "white" }}>No of active Users</Text></DataTable.Title> + <DataTable.Title style={{ width: 100 }}><Text style={{ color: "white" }}>No of inactive Users</Text></DataTable.Title> + <DataTable.Title style={{ width: 100 }}><Text style={{ color: "white" }}>No of Working Users</Text></DataTable.Title> + </DataTable.Header> + </DataTable> + {this.state.dataSource.map((item, index) => { + return ( + <DataTable> + <DataTable.Row style={{ marginLeft: -10, }} key={index}> + + <DataTable.Cell style={{ paddingLeft: 20, width: 200 }}>{item.project_name}</DataTable.Cell> + + <DataTable.Cell style={{ paddingLeft: 20, width: 200 }}>{item.Total_users_per_project}</DataTable.Cell> + <DataTable.Cell style={{ width: 200 }}>{item.active_users_per_project}</DataTable.Cell> + + <DataTable.Cell style={{ width: 200 }}>{item.Inactive_users_per_project}</DataTable.Cell> + <DataTable.Cell style={{ width: 100 }}>{item.Working_users_per_projects}</DataTable.Cell> + + </DataTable.Row> + + + </DataTable> + + + ) + }) } + + </View> + + </ScrollView> + + </Content> + + </Container> + // </KeyboardAvoidingView > + ); + } +} + +const styles = StyleSheet.create({ + container: { + flex: 1, + width: '90%', + paddingLeft: hp('2%'), + }, + footer: { + position: 'absolute', + flex: 0.1, + left: 0, + right: 0, + bottom: -10, + backgroundColor: 'green', + flexDirection: 'row', + height: 80, + alignItems: 'center', + }, + bottomButtons: { + alignItems: 'center', + justifyContent: 'center', + flex: 1, + }, + footerText: { + color: 'white', + fontWeight: 'bold', + alignItems: 'center', + fontSize: 18, + }, + buttonContainer: { + width: wp('90%'), + alignSelf: 'baseline', + marginBottom: 10, + color: '#d2691e', + marginLeft: 4, + + + + }, + signupButton: { + + backgroundColor: '#ffffff', + }, + subcontainer: { + flex: 2, + flexDirection: 'row', + paddingTop: 40 + }, + signUpText0: { + fontSize: 13, + color: 'green', + paddingTop: 10, + + }, + signUpText1: { + fontSize: 13, + color: 'green', + paddingTop: 10, + + paddingLeft: 10, + }, + end: { + + alignItems: 'flex-end', + + }, + end1: { + flex: 2, + height: '50%', + paddingTop: 20, + justifyContent: 'space-between', + + flexDirection: 'row', + }, + s: { + justifyContent: 'center', + + backgroundColor: '#ed7070', + shadowOffset: { width: 50, height: 50 }, + alignItems: 'center', + width: wp('40%'), + height: hp('12%'), + + }, + signUpText2: { + fontSize: 13, + marginLeft: 20, + + color: 'green', + paddingTop: 10, + }, + signUpText3: { + + fontSize: 13, + paddingTop: 10, + paddingLeft: 10, + + alignItems: 'center', + }, + signUpText4: { + fontSize: 13, + paddingTop: 10, + + + alignItems: 'center', + }, + signup: { + color: "#FFF", + + }, + boxone: { + flex: 1, + marginTop: 5, + + }, + boxtwo: { + flex: 1, + + }, + boxthree: { + flex: 1, + + }, + box: { + flexDirection: 'row', + position: 'relative', + marginBottom: 10, + + + }, + opensave: { + // flex: 1, + ...Platform.select({ + ios: { + backgroundColor: 'green', height: 30, margin: 5, alignItems: + "center", justifyContent: 'center' + }, + android: { + backgroundColor: 'green', height: 30, margin: 5, alignItems: + "center", justifyContent: 'center' + }, + }), + }, + + top: { + // flex: 1, + ...Platform.select({ + ios: { + flex: 1, marginTop: 10, marginBottom: 10, + }, + android: { + flex: 1, marginTop: 10, marginBottom: 10, height: 400 + }, + }), + }, + signUpText: { + fontSize: 13, + justifyContent: 'center', + + + color: 'white', + alignSelf: 'center', + }, +}); \ No newline at end of file diff --git a/src/CommonComponents/AddSprint.js b/src/CommonComponents/AddSprint.js index d7cfa3e165f7914145741bb8dd32951793106aa3..a91f5634eb5573d14ea676f01ff1510b489967c1 100644 --- a/src/CommonComponents/AddSprint.js +++ b/src/CommonComponents/AddSprint.js @@ -48,7 +48,7 @@ export default class AddSprint extends React.Component { targetdate: '', targetDate: '', }; - + this.getSprints(); } //Open the Dialog Modal modalDidOpen = () => console.log("Modal did open."); diff --git a/src/CommonComponents/AdminChat.js b/src/CommonComponents/AdminChat.js new file mode 100644 index 0000000000000000000000000000000000000000..f9b0ef8b4c61b0c0a28a6b93079ee92574a2439a --- /dev/null +++ b/src/CommonComponents/AdminChat.js @@ -0,0 +1,1219 @@ +/* +FileName:AdminChat.js +Version:1.0.0 +Purpose:Getting the List of all the employees list and Chat +Developers:Mahesh Reddy +*/ +import React, { Component } from 'react'; +import { Platform, Linking, Image, StyleSheet, Text, FlatList, TouchableOpacity, Picker, View, StatusBar, Dimensions, Alert } from 'react-native'; +import { Title, Button, Container, Content, Header, Right, Left, Body, Tab, Tabs, TabHeading, Footer, Subtitle, Item, Input, FooterTab } from 'native-base'; +import { widthPercentageToDP as wp, heightPercentageToDP as hp } from 'react-native-responsive-screen'; +import AsyncStorage from '@react-native-community/async-storage'; +import Icon from 'react-native-vector-icons/FontAwesome'; +import Communications from 'react-native-communications'; +import { API } from "../WebServices/RestClient"; +import NetInfo from '@react-native-community/netinfo'; +import Snackbar from 'react-native-snackbar'; +import log from '../LogFile/Log'; +import Toast from 'react-native-whc-toast'; +import DropDownPicker from 'react-native-dropdown-picker'; +import ModalSelector from 'react-native-modal-selector'; +// import { Dropdown } from 'react-native-material-dropdown'; +import { SwipeListView } from 'react-native-swipe-list-view'; +import { NavigationEvents } from 'react-navigation'; +import jwt_decode from "jwt-decode"; +import Main from '../Maintenance/Main'; +const check = new Main() +import UserDatabase from '../OfflineDB/UserDatabase'; +import { MANAGEEMPLOYEES, EMAIL, MOBILE, CONTACT, EMAILUSERNAME, ADDEMPLOYEE } from '../CommonComponents/Header'; + +const db = new UserDatabase(); +import { + BallIndicator, + BarIndicator, + DotIndicator, + MaterialIndicator, + PacmanIndicator, + PulseIndicator, + SkypeIndicator, + UIActivityIndicator +} from 'react-native-indicators'; + +class ListItem extends Component { + + constructor(props) { + super(props); + this.state = { + // isLoading: true, + dataSource: [], + dataSource2: [], + roledata: '', + sendBy: '', + // expanded: false, + } + + this.getMessages(); + } + getMessages() { + log("Info", " getMessages(role, userToken, cropcode) is used getting task related messages"); + // const groupId = this.state.subtaskId; + // console.warn("getmessages"); + // alert("Hello") + AsyncStorage.multiGet(["cropcode", "userToken"], (err, response) => { + const cropcode = response[0][1]; + const userToken = response[1][1]; + this.setState({ userid: userToken }); + AsyncStorage.getItem("projectId", (err, res) => { + const projectId = res; + // console.warn("userToken"+userToken) + // console.warn("cropcode"+cropcode) + + NetInfo.fetch().then(state => { + if (state.type == "none") { + log("Warn", "No internet connection"); + Snackbar.show({ + title: 'No Internet Connection', + backgroundColor: 'red', + duration: Snackbar.LENGTH_LONG, + }); + } + else { + fetch(API + "squad_chat.php", + { + method: 'POST', + headers: { + Accept: 'application/json', + 'Content-Type': 'application/json', + }, + body: JSON.stringify({ + + action: "get_all_messages", + corp_code: cropcode, + sendBy: userToken, + // projectId: projectId, + + + }) + }) + .then((response) => response.json()) + .then((responseJson) => { + console.warn("Messages For chat application" + JSON.stringify(responseJson.data)); + // alert(JSON.stringify(responseJson)) + // console.warn("Messages from users" + JSON.stringify(responseJson)) + // console.warn("Send By Name" + JSON.stringify(responseJson.data)) + if (responseJson.status === 'True') { + + console.warn("Setted Data") + + + + this.setState({ + dataSource2: responseJson.data, + }); + console.warn("Method data" + responseJson.data.sendBy) + } + else { + console.warn("Empty Data") + this.setState({ + dataSource: '', + }); + } + }) + .catch((error) => { + console.error(error); + log("Error", "getting task related messages error"); + }); + + } + }); + }); + }); + } + + //Navigates to AdminChatUser Screen + AdminChatUser(taskid, action, msgCount) { + // console.warn("msgCount" + msgCount); + // console.warn("taskid" + taskid); + log("Info", "UserPendingMyTasks:AdminChatUser(item, index) used to navigate to taskchat") + this.props.navigation.navigate("AdminChatUser", { id: taskid, action: "maintask", sno: msgCount }); + } + + + render() { + + + + const { item } = this.props; + const { emp_role } = this.props; + // alert(emp_role) + + + let button1; + // if (this.state.emp_role === "Emp" || "Manager" || "Approver") { + button1 = <TouchableOpacity style={{ marginTop: 12 }} + onPress={() => this.props.navigation.navigate("UserChat", { + empId: item.id, + // action:"send" + name: item.name, + device_id: item.device_id, + // mobile: item.mobileNumber, + // email: item.email, + // designation: item.designation, + // userName: item.userName, + // team: item.team, + // empStatus: item.empStatus, + // workingStatus: item.workingStatus, + // role: item.role + })}> + <Icon name="comments" style={{ color: '#808080', paddingRight: 5 }} size={25} /> + </TouchableOpacity> + + + // var data1=this.state.dataSource1; + const getMessagesCount = (data1, id) => { + // console.warn("ids"+JSON.stringify(data1) +id) + // alert(id) + + // var msg=this.state.dataSource1; + // console.warn("Datasource and id send by"+JSON.stringify(data1.sendBy)) + let msgCount = data1.filter(message => message.sendBy === id).map((messages, i) => { + return i,messages + + }) + + // console.warn("iiiiiiii" + msgCount) + + return ( + // console.warn("iiiiiiii" + msgCount), + <View> + <Text style={{ color: 'red', }}> {msgCount.length > 0 ? msgCount.length : null} </Text> + {/* {msgCount.length > 0 ? msgCount.length : null} */} + { + msgCount.length > 0 ? + + <Icon name="comments" style={{ color: '#808080', paddingRight: 5 }} size={25} onPress={() => this.props.navigation.navigate("AdminChatUser", { + empId: item.id, + name: item.name, + device_id: item.device_id, + sno: msgCount, + + + })} /> + // <TouchableOpacity style={{ marginTop: -20, marginLeft: 18 }} onPress={() => { this.AdminChatUser(id, "maintask", msgCount) }}> + // <Image style={{ width: 25, height: 25 }} source={require('../Images/chat.png')} /> + // </TouchableOpacity> + + : + <Icon name="comments" style={{ color: '#808080', paddingRight: 5 }} size={25} onPress={() => this.props.navigation.navigate("AdminChatUser", { + empId: item.id, + name: item.name, + device_id: item.device_id, + sno: msgCount, + + + })} /> + // <TouchableOpacity style={{ marginTop: -20, marginLeft: 18 }} onPress={() => { this.AdminChatUser(id, "maintask", msgCount) }}> + // <Image style={{ width: 25, height: 25 }} source={require('../Images/chat.png')} /> + // </TouchableOpacity> + + + } + + </View> + ) + + } + + + // const getMessagesCount = ( msg, empId) => { + // // console.warn("ids"+JSON.stringify(data1) +id) + + // // var msg=this.state.dataSource1; + // // console.warn("Datasource and id send by"+JSON.stringify(data1.sendBy)) + // const msgCount = msg.filter(message => message.sendBy === empId).map((messages, i)=> { + + // return i, messages + + // }) + + // // console.warn("iiiiiiii" + id) + // console.warn("msgcount" + msgCount) + // // alert("msgcount" + msgCount) + + // return ( + // // console.warn("iiiiiiii" + msgCount), + // <View> + // <Text style={{ color: 'green', paddingTop: -20, marginRight: 10 }}> {msgCount.length > 0 ? msgCount.length : null} </Text> + // {/* {msgCount.length > 0 ? msgCount.length : null} */} + // { + // msgCount.length > 0 ? + + // <TouchableOpacity style={{ marginTop: -20, marginLeft: 10 }} onPress={() => { this.AdminChatUser( "UserChat", msgCount) }}> + // <Image style={{ width: 25, height: 25 }} source={require('../Images/chat.png')} /> + // </TouchableOpacity> + // : + // <TouchableOpacity style={{ marginTop: -20, marginLeft: 10 }} onPress={() => { this.AdminChatUser( "UserChat", msgCount) }}> + // <Image style={{ width: 25, height: 25, }} source={require('../Images/chat.png')} /> + + // </TouchableOpacity> + + // } + + // </View> + // ) + + // } + + + + return ( + + <View style={styles.container}> + <View style={styles.signup}> + <View style={[styles.buttonContainer, styles.signupButton]} > + <View style={styles.box}> + <View style={{ flexDirection: 'row' }}> + <Text style={styles.signUpText1} >{item.name}</Text> + </View> + <View style={{ flexDirection: 'row', justifyContent: 'flex-end', alignItems: 'center' }}> + {/* {getMessagesCount(this.state.dataSource2, item.id)} */} + { getMessagesCount( this.state.dataSource2,item.id)} + </View> + </View> + </View> + + + {/* <View + style={{ + marginTop: 15, + borderBottomColor: '#C0C0C0', + borderBottomWidth: 0.2, + }} + /> */} + </View> + + + </View> + ) + } +} +export default class AdminChat extends Component { + // static navigationOptions = () => { + // return { + // tabBarOnPress({ navigation, defaultHandler }) { + // navigation.state.params.onTabFocus(); + // defaultHandler(); + // this.onRefresh(); + // } + // }; + // } + + + constructor(props) { + super(props); + props.navigation.setParams({ + onTabFocus: this.handleTabFocus + }); + let button; + this.state = { + isLoading: true, + dataSource: [], + dataSource1: [], + isFetching: false, + result: '', + emp_role: '', + squadName: '', + + + } + AsyncStorage.getItem("cropcode", (err, res) => { + this.setState({ squadName: res }); + console.warn("squadname" + this.state.squadName); + }); + this.arrayholder = []; + this.button = button; + + + } + // handleTabFocus = () => { + // this.onRefresh(); + // }; + + componentDidMount() { + log("Debug", "Employees list getting screen is loaded at user side"); + 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, + }); + this.getManageEmployeesList(); //For Getting ManageEmployeesList from offline + this.getAgileProjects(); + } else { + //to get the lsit of list of employees + this.UserManageEmployees() + // this.GetStatus(); + // this.getMessages(); + } + }); + + AsyncStorage.getItem("emp_role", (err, res) => { + console.log(res) + const emp_role1 = res; + this.setState({ emp_role: emp_role1 }) + }) + AsyncStorage.getItem("userToken", (err, res) => { + console.warn("empId" + res) + const userToken = res; + this.setState({ userToken: userToken }) + }) + } + + //For store Agile projects for offline Start + addAgileProjects(data) { + console.warn("hello naveen" + JSON.stringify(data)); + db.addAgileProjects(data).then((result) => { + console.log(result); + }).catch((err) => { + console.log(err); + }) + } + //For store Agile projects for offline End + //For Getting offline Project List Start + getAgileProjects() { + db.getAgileProjects().then((data) => { + console.warn("AgileProjectsList" + JSON.stringify(data)) + this.setState({ + data2: data, + }); + }).catch((err) => { + }) + } + //For Getting offline Project List End + + //to refresh the data + onRefresh() { + 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, + }); + this.getManageEmployeesList(); //For Getting ManageEmployeesList from offline + } else { + //to get the lsit of list of employees + this.UserManageEmployees() + // this.getMessages(); + } + }); + + } + + //get project list dropdown data + + + //get project list dropdown data + GetStatus() { + log("Info", "UserProfile:GetStatus() method is used to get status of employee"); + AsyncStorage.getItem("userToken", (err, res) => { + const empId = res; + 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, + }); + this.getAgileProjects(); + } else { + + fetch(API + 'squads.php', { + method: 'POST', + headers: { + Accept: 'application/json', + 'Content-Type': 'application/json', + }, + body: JSON.stringify({ + + empId: empId, + action: 'get_squads', + + }) + }) + .then((response) => response.json()) + .then((responseJson) => { + console.warn(responseJson) + // alert(JSON.stringify(responseJson.data)) + if (responseJson.status == 'True') { + // this.setState({ + // isLoading: false, + // dataSource1: [...responseJson.data], + // }, function () { + // // In this block you can do something with new state. + // }); + console.log("Testing" + JSON.stringify(responseJson.data)) + const data2 = []; + this.addAgileProjects(responseJson.data) //Project list store in offline + responseJson.data.map(x => { + data2.push({ label: x.value, value: x.value }) + }) + this.setState({ + data2: data2, + }) + console.warn("Hello" + JSON.stringify(data2)) + + // this.setState({ + // data2: responseJson.data + // }); + console.warn(this.state.data2); + } else { + log("Warn", "status of employee is not available"); + } + }) + .catch((error) => { + console.error(error); + log("Error", "error in getting status of employee"); + }); + } + }); + }); + + } + // Update Status of Employee + UpdateStatus(squadName) { + // const { squadName } = this.state; + log("Info", "UserProfile:UpdateStatus(status) method is used to update status of employee"); + console.warn("project" + JSON.stringify(squadName)); + + AsyncStorage.getItem("userToken", (err, res) => { + const empId = res; + console.log(res); + + AsyncStorage.getItem("projectId", (err, res) => { + const projectId = res; + + // console.log(cropcode); + 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, + }); + //for offline project switching start + this.setState({ + squadName: squadName + }); + AsyncStorage.setItem('cropcode', squadName); + this.getManageEmployeesList(); //For Getting ManageEmployeesList from offline + //for offline project switching end + } else { + + fetch(API + 'squad_login.php', { + method: 'POST', + headers: { + Accept: 'application/json', + 'Content-Type': 'application/json', + }, + body: JSON.stringify({ + username: empId, + corp: squadName, + projectId: projectId + + }) + }) + .then((response) => response.json()) + .then((responseJson) => { + console.warn(JSON.stringify(responseJson)) + + if (responseJson.status == 'TRUE') { + AsyncStorage.setItem('auth', responseJson.jwt) //store the token information with exp + const tokenDetails = jwt_decode(responseJson.jwt); + console.log(tokenDetails.data) + AsyncStorage.setItem('roleCount', tokenDetails.data.roleCount) + // dispatch(setCurrentUser(tokenDetails.data)); //store the user information + AsyncStorage.setItem('status', tokenDetails.data.empStatus) + + + AsyncStorage.setItem('userToken', tokenDetails.data.empId); + AsyncStorage.setItem('userName', tokenDetails.data.userName); + AsyncStorage.setItem('emp_role', tokenDetails.data.role); + AsyncStorage.setItem('cropcode', tokenDetails.data.corp); + AsyncStorage.setItem('projectId', tokenDetails.data.projectId); + // this.props.navigation.navigate('UserProfile'); + // console.warn("HI" + empstatus) + this.setState({ + + squadName: tokenDetails.data.corp, + + }); + this.UserManageEmployees(); + // alert("Project Changed Successfully") + + + } else { + // alert("user already exist"); + log("Warn", "status of employee is not able to update"); + } + + }) + .catch((error) => { + console.warn(error); + log("Error", "error in updating status of employee"); + }); + } + }); + }); + }); + + } + + //For getManageEmployeesList from offline + getManageEmployeesList() { + AsyncStorage.getItem("cropcode", (err, res) => { + const projectName = res; + db.getManageEmployeesList(projectName).then((data) => { + console.warn("ManageEmployeesList" + JSON.stringify(data)) + this.setState({ + dataSource: data, + isLoading: false, + }); + this.arrayholder = data; + }).catch((err) => { + console.log(err); + this.setState = { + isLoading: false + } + }) + }) + } + //For getManageEmployeesList from offline + + //For store ManageEmployeesList from offline + addManageEmployeesList(data, cropcode) { + console.warn("hello" + JSON.stringify(data)); + db.addManageEmployeesList(data, cropcode).then((result) => { + this.setState({ + isLoading: false, + }); + }).catch((err) => { + console.log(err); + this.setState({ + isLoading: false, + }); + }) + } + // componentWillReceiveProps(nextProps) { + // //to get the lsit of list of employees + // this.UserManageEmployees(); + // } + + //to get the lsit of list of employees + UserManageEmployees() { + log("Info", "UserManageEmployees:getEmployeeList() method is used to get employee list"); + AsyncStorage.getItem("cropcode", (err, res) => { + const cropcode = res; + // alert(cropcode) + + AsyncStorage.getItem("empId", (err, res) => { + const empId = res; + AsyncStorage.getItem("userName", (err, res) => { + const userName = res; + + // alert(userName) + AsyncStorage.getItem("emp_role", (err, res) => { + const emp_role = res; + //Checking the Internet Connection + NetInfo.fetch().then(state => { + if (state.type == "none" || state.type == 'unknown' || state.type == 'undefined') { + + Snackbar.show({ + title: 'No Internet Connection', + backgroundColor: 'red', + duration: Snackbar.LENGTH_LONG, + }); + } else { + + fetch(API + 'squad_chat.php', + { + method: 'POST', + headers: { + Accept: 'application/json', + 'Content-Type': 'application/json', + }, + body: JSON.stringify({ + crop: cropcode, + // projectId: projectId, + action: "get_all_employees", + // userType: emp_role, + // empId: empId + }) + }) + .then((response) => response.json()) + + // console.warn(responseJson.data) + + + .then((responseJson) => { + // alert(JSON.stringify(responseJson)) + // console.warn("Employees" + JSON.stringify(responseJson)); + this.addManageEmployeesList(responseJson.data, cropcode) //Store Manage Employee List in Offline + + // this.setState({ + // isLoading: false, + // dataSource: responseJson.data, + // isFetching: false + // }, function () { + // }); + + // this.arrayholder = responseJson.data; + + // }) + var employee = []; + responseJson.data.map((x) => { + return (x.email !== userName ? employee.push(x) : null); + }) + + this.setState({ + isLoading: false, + dataSource: employee, + isFetching: false + }, + function () { + + } + ); + + this.arrayholder = responseJson.data; + }) + .catch((error) => { + check.Maintenance(); + console.error(error); + log("Error", "error in getting employee list at user side"); + }); + + } + }); + + }); + }); + + }); + + }); + } + + + //Seperate the List date + FlatListItemSeparator = () => { + return ( + <View + style={{ + // height: .5, + width: "100%", + backgroundColor: "#000", + }} + /> + ); + } + //For Empty list + _listEmptyComponent = () => { + return ( + <View> + <Text></Text> + + </View> + ) + } + + //to filter the search data in search area + SearchFilterFunction(text) { + log("Info", "UserManageEmployees:SearchFilterFunction(text) method is used for search functionality") + const newData = this.arrayholder.filter(function (item) { + + const name = item.name.toUpperCase() + const name1 = text.toUpperCase() + const empStatus = item.empStatus.toUpperCase() + const empStatus1 = text.toUpperCase() + //const designation = item.designation.toUpperCase() + // const designation1 = text.toUpperCase() + const email = item.email.toUpperCase() + const email1 = text.toUpperCase() + const mobileNumber = item.mobileNumber.toUpperCase() + const mobileNumber1 = text.toUpperCase() + + return name.indexOf(name1) > -1 || + // date.indexOf(date1) > -1 || + empStatus.indexOf(empStatus1) > -1 || + //designation.indexOf(designation1) > -1 || + email.indexOf(email1) > -1 || + mobileNumber.indexOf(mobileNumber1) > -1 + }) + this.setState({ + dataSource: newData, + text: text + }) + } + + + + + + + render() { + // alert(this.state.dataSource) + let button; + if (this.state.emp_role === "Emp") { + button = null; + } else { + button = + <TouchableOpacity style={{ marginTop: 12 }} + onPress={(item) => this.props.navigation.navigate("UserManageEmployeesTasks", { + empId: item.id, + name: item.name, + mobile: item.mobileNumber, + email: item.email, + designation: item.designation, + userName: item.userName, + team: item.team, + empStatus: item.empStatus, + workingStatus: item.workingStatus, + role: item.role + })}> + <Icon name="chevron-right" style={{ color: '#808080', paddingRight: 5 }} size={15} /> + </TouchableOpacity> + } + + if (this.state.isLoading) { + return ( + <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}> + <DotIndicator color='#00A2C1' /> + </View> + ); + + } + + return ( + <Container style={{ height: Dimensions.get('window').height }}> + {/* <NavigationEvents + onDidFocus={() => this.onRefresh()} + /> */} + + <Header + androidStatusBarColor="#00A2C1" + style={{ + backgroundColor: '#00A2C1', + height: 60, + width: Dimensions.get('window').width, + borderBottomColor: '#ffffff', + justifyContent: 'space-between', + }}> + <Left> + <Icon name="arrow-left" size={20} style={{ color: '#fff', }} onPress={() => + this.props.navigation.push("UserDashboard")} /> + </Left> + <Body style={{ paddingLeft: 30, }}> + <Title style={{ color: '#fff', paddingTop: 20 }}>CHAT</Title> + <Subtitle></Subtitle> + </Body> + + </Header> + <Item > + + <Input placeholder="Search" + onChangeText={(text) => this.SearchFilterFunction(text)} /> + <Icon style={{ marginRight: 10, color: 'black' }} size={25} name="search" /> + </Item> + <View style={{ height: '85%' }}> + + <FlatList + extraData={this.state} + keyExtractor={this._keyExtractor} + renderItem={this._renderItem} + style={{ flex: 1, }} + data={this.state.dataSource} + onRefresh={() => this.onRefresh()} + refreshing={this.state.isFetching} + ItemSeparatorComponent={this.FlatListItemSeparator} + renderItem={({ item, index }) => + <View style={styles.container2} > + <ListItem + navigation={this.props.navigation} + emp_role={this.state.emp_role} + AdminChatUser={() => this.AdminChatUser(item, index)}//For TaskLevel Chat + item={item} + // deleteAction={() => this.deleteAction(item, index)}//delete action for employee + /> + </View> + } + keyExtractor={item => item.id} + ListEmptyComponent={this._listEmptyComponent} + /> + + {/* <SwipeListView + data={this.state.dataSource} + onRefresh={() => this.onRefresh()} + refreshing={this.state.isFetching} + renderItem={(data) => ( + + <View style={styles.container2} > + <ListItem navigation={this.props.navigation} + data={data} + deleteAction={() => this.deleteAction(data, index)}//delete action for employee + + emp_role={this.state.emp_role} + + /> + </View> + + )} + + renderHiddenItem={(data, rowMap) => ( + + <View style={styles.rowBack}> + + <Text>{data.item.empStatus}</Text> + <Text>{data.item.empStatus}</Text> + </View> + + )} + + leftOpenValue={100} + rightOpenValue={-100} + + /> */} + <View style={{ marginBottom: 5, }} /> + </View> + + {/* <View style={{ height: hp('10%') }}></View> */} + + + {/* <View style={{ height: hp('10%') }}></View> + <TouchableOpacity onPress={() => this.props.navigation.navigate("AddUser")} style={styles.bottomView}> + + <View style={styles.bottomView} > + <Text style={styles.textStyle}> {ADDEMPLOYEE}</Text> + </View> + </TouchableOpacity> */} + + </Container> + ); + } +} +//Styles for UI +const styles = StyleSheet.create({ + container: { + flex: 1, + paddingTop: 15, + backgroundColor: 'white', + + paddingRight: 20, + }, + buttonContainer: { + width: wp('95%'), + alignSelf: 'baseline', + marginBottom: 10, + color: '#d2691e', + //backgroundColor:'#fadbd8', + marginLeft: 4, + }, + signupButton: { + + + }, + subcontainer: { + flex: 2, + flexDirection: 'row', + + }, + signUpText0: { + fontSize: 15, + + paddingLeft: 20, + }, + signUpText1: { + fontSize: 16, + + paddingLeft: 10, + fontWeight: 'bold' + }, + + signUpText00: { + fontSize: 15, + + paddingLeft: 20, + }, + signUpText11: { + fontSize: 12, + paddingTop: 10, + + color: 'black', + paddingLeft: 10, + }, + signUpText11email: { + fontSize: 12, + paddingTop: 10, + + color: 'black', + paddingLeft: 10, + }, + signUpText11mobile: { + fontSize: 12, + paddingTop: 10, + //fontStyle: 'italic', + color: 'black', + paddingLeft: 10, + }, + signUpText12: { + fontSize: 15, + paddingTop: 10, + paddingBottom: 10, + color: 'black', + paddingLeft: 15, + }, + + signUpText000: { + fontSize: 12, + + paddingBottom: 10, + paddingLeft: 20, + }, + signUpText111: { + fontSize: 12, + paddingBottom: 10, + + color: 'black', + + paddingLeft: -20, + }, + end: { + + alignItems: 'flex-end', + + }, + end1: { + flex: 1, + + justifyContent: 'space-between', + + flexDirection: 'row', + }, + s: { + justifyContent: 'center', + + // backgroundColor: '#ed7070', + shadowOffset: { width: 50, height: 50 }, + alignItems: 'center', + width: wp('40%'), + height: hp('12%'), + borderTopLeftRadius: 10, + borderBottomLeftRadius: 10, + + }, + signUpText2: { + fontSize: 15, + paddingRight: 10, + + paddingLeft: 23, + color: 'black', + + justifyContent: 'center', + + }, + signUpText02: { + fontSize: 15, + paddingRight: 10, + + paddingLeft: 23, + color: 'red', + paddingBottom: 10, + + justifyContent: 'center', + + }, + signUpText022: { + fontSize: 15, + + paddingLeft: 23, + color: 'green', + paddingBottom: 10, + + justifyContent: 'center', + + }, + rowBack: { + alignItems: 'center', + backgroundColor: '#81def0', + flex: 1, + flexDirection: 'row', + justifyContent: 'space-between', + paddingLeft: 10, + }, + rowFront: { + alignItems: 'center', + backgroundColor: '#81def0', + flex: 1, + flexDirection: 'row', + justifyContent: 'space-between', + paddingRight: 10, + }, + signUpText002: { + fontSize: 12, + + paddingLeft: 23, + + paddingBottom: 10, + + justifyContent: 'center', + + }, + signUpText0002: { + fontSize: 13, + paddingRight: 45, + + paddingLeft: 23, + + paddingBottom: 10, + + justifyContent: 'center', + + }, + signUpText3: { + + paddingBottom: 10, + paddingLeft: 23, + fontSize: 15, + + paddingRight: 13, + + alignItems: 'center', + }, + signUpText4: { + paddingBottom: 10, + paddingLeft: 20, + + fontSize: 15, + alignItems: 'center', + }, + + + signUpText33: { + + paddingBottom: 10, + paddingLeft: 23, + fontSize: 12, + + paddingRight: 35, + + alignItems: 'center', + }, + signUpText44: { + paddingBottom: 10, + paddingLeft: 20, + + paddingTop: -10, + + fontSize: 12, + alignItems: 'center', + }, + + signup: { + + color: "#FFF", + }, + boxone: { + flex: 1, + marginTop: 5, + + }, + boxtwo: { + flex: 1, + + }, + boxthree: { + flex: 1, + + }, + box: { + justifyContent: 'space-between', + flexDirection: 'row', + position: 'relative', + + + }, + bottomView: { + flexDirection: 'row', + justifyContent: 'center', + position: 'absolute', + height: FOOTER_MAX_HEIGHT, + bottom: 0, + left: 0, + right: 0, + backgroundColor: 'black', + alignItems: 'center' + }, + textStyle: { + + color: '#fff', + paddingLeft: 5, + paddingRight: 5, + backgroundColor: '#00A2C1', + fontSize: 22, + marginLeft: 5, + borderRadius: 5 + + }, + signUpText: { + fontSize: 20, + justifyContent: 'center', + + + color: 'white', + alignSelf: 'center', + }, + empstatusText: { + fontSize: 12, + paddingLeft: 23, + paddingBottom: 10, + justifyContent: 'center', + // fontStyle: 'italic' + + }, + designationText: { + fontSize: 12, + paddingLeft: 23, + paddingBottom: 10, + // fontWeight:'bold', + justifyContent: 'center', + + }, +}); +const pickerSelectStyles = StyleSheet.create({ + inputIOS: { + fontSize: 2, + paddingVertical: 12, + paddingHorizontal: 10, + borderWidth: 1, + borderColor: 'blue', + borderRadius: 4, + color: 'black', + paddingRight: 30, // to ensure the text is never behind the icon + }, + inputAndroid: { + fontSize: 3, + paddingHorizontal: 10, + paddingVertical: 8, + borderWidth: 0.5, + borderColor: 'black', + borderRadius: 8, + color: 'black', + paddingRight: 30, // to ensure the text is never behind the icon + // backgroundColor:'pink' + }, +}); \ No newline at end of file diff --git a/src/CommonComponents/AdminChatUser.js b/src/CommonComponents/AdminChatUser.js new file mode 100644 index 0000000000000000000000000000000000000000..9e923fa73888782761131f8f184e1f2dea0ffed3 --- /dev/null +++ b/src/CommonComponents/AdminChatUser.js @@ -0,0 +1,492 @@ +/* +FileName:AdminChatUser.js +Version:1.0.0 +Purpose:Getting the List of task messages with GroupName and List of Group Members and also send Message +Devloper:Santhosh, Mahesh +*/ + +import React, { Component } from 'react'; +import { + StyleSheet, + Text, + View, + TouchableOpacity, + Image, + Alert, + ScrollView, + TextInput, + FlatList, + Button, + Dimensions, + KeyboardAvoidingView, + TouchableWithoutFeedback, + Keyboard +} from 'react-native'; +import Icon from 'react-native-vector-icons/FontAwesome'; +import AsyncStorage from '@react-native-community/async-storage'; + +import { Title, Container, Content, Header, Right, Left, Body, Tab, Tabs, TabHeading, Footer, Item, Input, FooterTab, Subtitle } from 'native-base'; + +import NetInfo from '@react-native-community/netinfo'; +import { API } from "../WebServices/RestClient"; +import log from '../LogFile/Log'; + + +export default class AdminChatUser extends Component { + + constructor(props) { + super(props); + this.state = { + message: '', + dataSource: [], + subtaskId: this.props.navigation.state.params.taskid, + action: this.props.navigation.state.params.action, + empId: this.props.navigation.state.params.empId, + device_id: this.props.navigation.state.params.device_id, + name: this.props.navigation.state.params.name, + sno:this.props.navigation.state.params.sno, + + userid: '', + groupName: '', + groupList: '', + }; + // alert("Msgcount"+this.props.navigation.state.params.sno) + } + + componentDidMount() { + log("Debug", "Task Chat screen is loaded"); + // this.groupMembersList();//Getting the List of GroupMembers + this.getMessages();//Getting the List of Messages based pn Task + this.updateMessages();//Update the chat count + + } + + //getting task related messages + getMessages() { + log("Info", " getMessages(role, userToken, cropcode) is used getting task related messages"); + // const groupId = this.state.subtaskId; + // alert("Hello") + AsyncStorage.multiGet(["cropcode", "userToken"], (err, response) => { + const cropcode = response[0][1]; + const userToken = response[1][1]; + this.setState({ userid: userToken }); + AsyncStorage.getItem("projectId", (err, res) => { + const projectId = res; + NetInfo.fetch().then(state => { + if (state.type == "none") { + log("Warn", "No internet connection"); + Snackbar.show({ + title: 'No Internet Connection', + backgroundColor: 'red', + duration: Snackbar.LENGTH_LONG, + }); + } + else { + fetch(API + 'squad_chat.php', + { + method: 'POST', + headers: { + Accept: 'application/json', + 'Content-Type': 'application/json', + }, + body: JSON.stringify({ + action: "get_messages", + sendBy: userToken, + receivedBy: this.props.navigation.state.params.empId, + }) + }) + .then((response) => response.json()) + .then((responseJson) => { + // alert(JSON.stringify(responseJson.data)) + if (responseJson.status === 'True') { + console.warn(responseJson); + this.setState({ + dataSource: responseJson.data, + }); + } else { + this.setState({ + dataSource: '', + }); + } + }) + .catch((error) => { + console.error(error); + log("Error", "getting task related messages error"); + }); + + } + }); + }); + }); + } + + //getting task related messages + userMessages() { + log("Info", " getMessages(role, userToken, cropcode) is used getting task related messages"); + // const groupId = this.state.subtaskId; + alert(this.props.navigation.state.params.empId) + const message = this.state.message; + AsyncStorage.multiGet(["cropcode", "userToken"], (err, response) => { + const cropcode = response[0][1]; + const userToken = response[1][1]; + this.setState({ userid: userToken }); + AsyncStorage.getItem("projectId", (err, res) => { + const projectId = res; + NetInfo.fetch().then(state => { + if (state.type == "none") { + log("Warn", "No internet connection"); + Snackbar.show({ + title: 'No Internet Connection', + backgroundColor: 'red', + duration: Snackbar.LENGTH_LONG, + }); + } + else { + fetch(API + 'squad_chat.php', + { + method: 'POST', + headers: { + Accept: 'application/json', + 'Content-Type': 'application/json', + }, + body: JSON.stringify({ + + action: 'send', + // groupId: groupId, + // corp_code: cropcode, + message: message, + messagedBy: userToken, + message: this.state.message, + receivedBy: this.props.navigation.state.params.empId, + // projectId:projectId, + + }) + }) + .then((response) => response.json()) + .then((responseJson) => { + + if (responseJson.status === 'True') { + console.warn(responseJson); + this.setState({ + dataSource: responseJson.data, + }); + } else { + this.setState({ + dataSource: '', + }); + } + }) + .catch((error) => { + console.error(error); + log("Error", "getting task related messages error"); + }); + + } + }); + }); + }); + } + + + //update task related messages + updateMessages() { + log("Info", " updateMessages(role, userToken, cropcode) is used to update task related messages"); + const groupId = this.state.subtaskId; + const sno = this.state.sno; + console.warn("sno" + sno) + // alert(JSON.stringify(sno)) + + const msgId = sno ? sno.map((msgId, index) => { + return msgId.sno + }) : null + // console.warn("Sno of the data"+this.props.navigation.state.params.sno) + + AsyncStorage.multiGet(["cropcode", "userToken"], (err, response) => { + const cropcode = response[0][1]; + const userToken = response[1][1]; + this.setState({ userid: userToken }); + + NetInfo.fetch().then(state => { + if (state.type == "none") { + log("Warn", "No internet connection"); + Snackbar.show({ + title: 'No Internet Connection', + backgroundColor: 'red', + duration: Snackbar.LENGTH_LONG, + }); + } + else { + fetch(API + 'squad_chat.php', + { + method: 'POST', + headers: { + Accept: 'application/json', + 'Content-Type': 'application/json', + }, + body: JSON.stringify({ + action: 'updateChat', + // corp_code: cropcode, + messagedBy: userToken, + + msgId: msgId ? msgId : " " + // groupId: groupId + + }) + }) + .then((response) => response.json()) + .then((responseJson) => { + console.warn("update chat" + JSON.stringify(responseJson)) + // alert(responseJson) + + + }) + .catch((error) => { + console.error(error); + log("Error", "getting task related messages error"); + }); + + } + }); + }); + } + //Sending Message without empty data added by naveen on 11 Nov + sendMessageText() { + if (this.state.message == 0) { + alert("please type message") + log("Warn", "message should not be empty"); + } + else { + this.sendMessage() + } + } + //send messages + sendMessage() { + log("Info", " sendMessage(role, userToken, cropcode) is used to send messages"); + const message = this.state.message; + // const groupId = this.state.subtaskId; + // alert(this.props.navigation.state.params.device_id) + // alert(this.props.navigation.state.params.empId) + + console.warn(message) + // alert(message) + AsyncStorage.multiGet(["cropcode", "userToken"], (err, response) => { + const cropcode = response[0][1]; + const userToken = response[1][1]; + AsyncStorage.getItem("projectId", (err, res) => { + const projectId = res; + fetch(API + 'squad_chat.php', { + method: 'POST', + headers: { + 'Accept': 'application/json', + 'Content-Type': 'application/json', + }, + body: JSON.stringify({ + action: "send", + sendBy: userToken, + message: this.state.message, + receivedBy: this.props.navigation.state.params.empId, + messagedBy: userToken, + }) + }).then((response) => response.json()) + .then((responseJson) => { + // console.log(JSON.stringify(responseJson.data)) + // alert(JSON.stringify(responseJson.data)) + this.getMessages(); + this.setState({ + message: '' + }); + + }).catch((error) => { + console.error(error); + log("Error", "send message error"); + }); + }); + }); + } + + renderDate = (date) => { + return ( + <Text style={styles.time}> + {date} + </Text> + ); + } + + render() { + + return ( + + <KeyboardAvoidingView + behavior={Platform.OS === "ios" ? "padding" : "height"} + style={styles.container} + > + <TouchableWithoutFeedback onPress={Keyboard.dismiss}> + + <Container> + <Header + androidStatusBarColor="#00A2C1" + style={{ + backgroundColor: '#00A2C1', + height: 60, + width: Dimensions.get('window').width, + borderBottomColor: '#ffffff', + justifyContent: 'space-between', + }}> + + <Icon name="arrow-left" size={20} style={{ color: '#fff', paddingTop: 15 }} + onPress={() => + this.props.navigation.goBack()} /> + <Body style={{ paddingLeft: 30, }}> + <Title style={{ color: '#fff', fontWeight: '600', paddingTop: 10 }}>{this.props.navigation.state.params.name}</Title> + <Subtitle></Subtitle> + </Body> + + </Header> + {/* <KeyboardAvoidingView> */} + <View style={styles.container}> + <ScrollView ref="scrollView" + onContentSizeChange={(width, height) => this.refs.scrollView.scrollTo({ y: height })}> + + + + <FlatList style={styles.list} + + + data={this.state.dataSource} + keyExtractor={(item) => { + return item.id; + }} + renderItem={(message) => { + const item = message.item; + let inMessage = item.messagedBy === this.state.userid; + let itemStyle = !inMessage ? styles.itemIn : styles.itemOut; + const left = <Text style={{ fontSize: 12, color: 'orange' }}>{item.username}</Text> + const right = <Text style={{ fontSize: 12, color: 'blue' }}>{item.username}</Text> + return ( + <ScrollView> + <View style={[styles.item, itemStyle]}> + <View style={{ paddingLeft: 5, }}> + {itemStyle === styles.itemOut ? left : right} + <Text>{item.message}</Text> + {!inMessage && this.renderDate(item.date)} + {inMessage && this.renderDate(item.date)} + </View> + </View> + </ScrollView> + ) + }} /> + </ScrollView> + + + + <View style={styles.footer}> + <View style={styles.inputContainer}> + <TextInput style={styles.inputs} + placeholder="Write a message..." + underlineColorAndroid='transparent' + multiline={true} + + onChangeText={(value) => this.setState({ message: value })} + value={this.state.message} /> + </View> + + <TouchableOpacity style={styles.btnSend} onPress={() => { this.sendMessageText() }}> + {/* <Image source={{uri:"https://png.icons8.com/small/75/ffffff/filled-sent.png"}} style={styles.iconSend} /> */} + <Image source={require('../Images/sent.png')} style={styles.iconSend} /> + </TouchableOpacity> + </View> + + </View> + {/* </KeyboardAvoidingView> */} + </Container> + + </TouchableWithoutFeedback> + </KeyboardAvoidingView> + + ); + } +} +//Styles fro UI +const styles = StyleSheet.create({ + container: { + flex: 1 + }, + list: { + paddingHorizontal: 17, + }, + footer: { + flexDirection: 'row', + height: 60, + backgroundColor: '#eeeeee', + paddingHorizontal: 10, + padding: 5, + }, + btnSend: { + backgroundColor: "#00BFFF", + width: 40, + height: 40, + borderRadius: 360, + alignItems: 'center', + justifyContent: 'center', + }, + iconSend: { + width: 30, + height: 30, + alignSelf: 'center', + }, + inputContainer: { + borderBottomColor: '#F5FCFF', + backgroundColor: '#FFFFFF', + borderRadius: 30, + borderBottomWidth: 1, + height: 40, + flexDirection: 'row', + alignItems: 'center', + flex: 1, + marginRight: 10, + alignItems: 'baseline', + + }, + inputs: { + height: 40, + marginLeft: 16, + borderBottomColor: '#FFFFFF', + flex: 1, + // position:'absolute', + alignItems: 'baseline', + paddingTop: 10 + }, + balloon: { + maxWidth: 200, + padding: 10, + borderRadius: 20, + }, + itemIn: { + + alignSelf: 'flex-start', + maxWidth: '98%', + // flexDirection:'row' + }, + itemOut: { + alignSelf: 'flex-end', + //paddingLeft:10, + maxWidth: '98%', + // flexDirection:'row' + }, + time: { + alignSelf: 'flex-end', + // margin: 15, + fontSize: 12, + color: "#808080", + paddingRight: 10 + }, + item: { + marginVertical: 14, + flex: 1, + flexDirection: 'row', + // paddingLeft:50, + backgroundColor: "#eeeeee", + borderRadius: 10, + padding: 5, + }, +}); \ No newline at end of file diff --git a/src/CommonComponents/TaskChat.js b/src/CommonComponents/TaskChat.js index fa0627ffc97df9818fa9d046d26a3e6cfe50eff0..b45b68b2d2df7f246a2700546239ad4a64a92598 100644 --- a/src/CommonComponents/TaskChat.js +++ b/src/CommonComponents/TaskChat.js @@ -48,6 +48,7 @@ export default class TaskChat extends Component { userid: '', groupName: '', groupList: '', + file:'', }; } @@ -670,16 +671,19 @@ export default class TaskChat extends Component { ImagePicker.openPicker({ width: 300, height: 400, - cropping: true + cropping: false, + includeBase64: true, + includeExif: true, }) .then((image) => { console.log('received image', image); + console.warn('Image Path'+image.path) this.setState({ image: { - - uri: image.path, + uri:image.path, + // data:image.data, width: image.width, height: image.height, mime: image.mime, @@ -691,29 +695,80 @@ export default class TaskChat extends Component { const userToken = response[1][1]; AsyncStorage.getItem("projectId", (err, res) => { const projectId = res; + + this.setState({ itemPressedDisabled: true }) + + // var data = { + // file: image, + // message: image.path, + // action: 'media', + // corp_code: cropcode, + // groupId: groupId, + // messagedBy: userToken, + // api:'https://api-single.agile24x7.com/pg_migration', + // groupName: this.state.groupName, + // // groupEmail: groupEmail, + // // projectId: projectId, + // } + + const data = new FormData(); + data.append('file', image); + data.append('message', image.path); + // required data for send message + data.append('action', 'media'); + data.append('corp_code', cropcode); + data.append('groupId',groupId); + data.append('messagedBy', userToken); + data.append('api','https://api-single.agile24x7.com/pg_migration'); + data.append('groupName', this.state.groupName); + data.append('groupEmail', groupEmail); + + + console.warn('Image testing data'+JSON.stringify(data)) fetch(API + 'user_story_chat1.php', { method: 'POST', headers: { Accept: 'application/json', - 'Content-Type': 'application/json', + 'Content-Type': 'multipart/form-data', }, - body: JSON.stringify({ - file: image.uri, - message: message, - action: 'media', - corp_code: cropcode, - groupId: groupId, - messagedBy: userToken, - api:'https://api-single.agile24x7.com/pg_migration', - groupName: this.state.groupName, - groupEmail: groupEmail, - projectId: projectId, + // body:data + body: ( + data + + ) + + }) + + .then((response) => response.json()) + .then((responseJson) => { + console.log(responseJson) + console.warn('Image testing '+JSON.stringify(data)) + alert(JSON.stringify(responseJson)) + if (responseJson.status == 'True') { + alert(JSON.stringify(responseJson)) + this.setState({ open: false }); + this.setState({ + itemPressedDisabled: false, + // isVisible: !this.state.isVisible, + + }) + // this.getEvent(); + //Navigate to AddModule screen + // this.props.navigation.navigate("UserTaskStatus1"); + // this.props.navigation.navigate("UserBacklog"); + Snackbar.show({ + title: 'Event Updated', + backgroundColor: 'green', + duration: Snackbar.LENGTH_LONG, + }); + } + // this.refs.toast.show('Project Modified', Toast.Duration.long, Toast.Position.center); - }) }) }) + .catch((e) => { console.log(e); Alert.alert(e.message ? e.message : e); @@ -813,7 +868,7 @@ export default class TaskChat extends Component { </View> <TouchableOpacity onPress={() => { this.uploadFile() }}> - <Text>upload file</Text> + <Text>upload file..</Text> </TouchableOpacity> <TouchableOpacity style={styles.btnSend} disabled={this.state.itemPressedDisabled} onPress={() => { this.sendMessageText() }}> diff --git a/src/Navigation/AdminDrawerComponents.js b/src/Navigation/AdminDrawerComponents.js index eded6eae01efb3a8329111260c4b83ecc592b59c..9c0e5a3bb2f6f082bab7989973c612e877141fb1 100644 --- a/src/Navigation/AdminDrawerComponents.js +++ b/src/Navigation/AdminDrawerComponents.js @@ -106,7 +106,13 @@ export default class drawerContentComponents1 extends Component { <TouchableOpacity onPress={this.navigateToScreen('AdminReports1')}> <View style={styles.screenStyle}> <Image style={{ width: wp('6%'), height: hp('3%') }} source={require('../Images/reports.png')} /> - <Text style={{ color: '#000000', marginLeft: 20 }}>AdminReports</Text> + <Text style={{ color: '#000000', marginLeft: 20 }}>Reports</Text> + </View> + </TouchableOpacity> + <TouchableOpacity onPress={this.navigateToScreen('AdminProjectReports')}> + <View style={styles.screenStyle}> + <Image style={{ width: wp('6%'), height: hp('3%') }} source={require('../Images/reports.png')} /> + <Text style={{ color: '#000000', marginLeft: 20 }}>ProjectReports</Text> </View> </TouchableOpacity> @@ -125,7 +131,7 @@ export default class drawerContentComponents1 extends Component { <TouchableOpacity onPress={this.navigateToScreen('AdminAgileSquad')}> <View style={styles.screenStyle}> <Image style={{ width: wp('6%'), height: hp('3%') }} source={require('../Images/teams.png')} /> - <Text style={{ color: '#000000', marginLeft: 20 }}>Admin Agile Squad</Text> + <Text style={{ color: '#000000', marginLeft: 20 }}>Agile Squad</Text> </View> </TouchableOpacity> <TouchableOpacity onPress={this.navigateToScreen('Settings')}> diff --git a/src/Navigation/NavigationRouter.js b/src/Navigation/NavigationRouter.js index dd774e3dec2622935a6cd5a440e278c637477865..b7db1680d6e7c69ce0fc833ae7780ab3b1b648f0 100644 --- a/src/Navigation/NavigationRouter.js +++ b/src/Navigation/NavigationRouter.js @@ -1,7 +1,7 @@ /* FileName:NavigationRouter.js Version:1.0.0 -Purpose:Navgate to all classes from Here +Purpose:Navigate to all classes from Here Devloper:Mahesh Reddy */ import React, { Component } from 'react'; @@ -48,6 +48,7 @@ import AdminRoadblock from '../AdminComponets/AdminRoadblock'; import AdminTimeSheet from '../AdminComponets/AdminTimeSheet'; import AdminGroupChat from '../AdminComponets/AdminGroupChat'; import AdminGroupChatModify from '../AdminComponets/AdminGroupChatModify'; +import AdminProjectReports from '../AdminComponets/AdminProjectReports'; import MyTask from '../UserComponents/UserMyTask'; @@ -83,6 +84,9 @@ import AddLicensesPayment from '../UserComponents/AddLicensesPayment'; import UserGroupChat from '../UserComponents/UserGroupChat'; import UserGroupChatModify from '../UserComponents/UserGroupChatModify'; import UserDashboard from '../UserComponents/UserDashboard'; +import UserImageUpload from '../UserComponents/UserImageUpload'; +import AdminChat from '../CommonComponents/AdminChat'; +import AdminChatUser from '../CommonComponents/AdminChatUser'; import AddModule from '../CommonComponents/AddModule'; import AddMainTask from '../CommonComponents/AddMainTask'; @@ -304,6 +308,7 @@ const AdminDrawer = createDrawerNavigator( // AdminReports: { screen: AdminReports }, AdminReports1: { screen: AdminReports1 }, AdminTimeSheet:{screen:AdminTimeSheet}, + AdminProjectReports:{screen:AdminProjectReports}, AdminAgileSquad: { screen: AdminAgileSquad }, Settings:{screen:Settings}, AdminGroupChat:{screen:AdminGroupChat}, @@ -357,6 +362,7 @@ UserDashboard:{screen:TabNavigation}, UserCompletedProjects: { screen: UserCompletedProjects }, RoadBlockList: { screen: RoadBlockList }, UserGroupChat:{screen:UserGroupChat}, + UserImageUpload:{screen:UserImageUpload}, //EmployeeManageTask: { screen: EmployeeManageTask }, // AddModule : {screen: AddModule}, Updates: { screen: Updates }, @@ -397,6 +403,13 @@ const adminAppStack = createStackNavigator({ header:null, }, }, + AdminProjectReports:{ + screen:AdminProjectReports, + + navigationOptions:{ + header:null, + }, + }, AdminAgileSquad:{ screen:AdminAgileSquad, navigationOptions:{ @@ -902,7 +915,12 @@ const userAppStack = createStackNavigator({ header:null, }, }, - + UserImageUpload:{ + screen:UserImageUpload, + navigationOptions:{ + header:null, + }, + }, // Maintenance: { // screen: Maintenance, // navigationOptions: { @@ -940,6 +958,20 @@ const userAppStack = createStackNavigator({ header: null, }, }, + AdminChat:{ + screen:AdminChat, + navigationOptions:{ + header:null, + }, + }, + + AdminChatUser:{ + screen:AdminChatUser, + navigationOptions:{ + header:null, + }, + }, + ReleaseOwner: { screen: ReleaseOwner, navigationOptions: { diff --git a/src/Navigation/UserDrawerComponents.js b/src/Navigation/UserDrawerComponents.js index 9cd6b6abf474222613440ac7f92d1d0a073aedf0..60aaccbef719372473812c236f538eb855fad5d2 100644 --- a/src/Navigation/UserDrawerComponents.js +++ b/src/Navigation/UserDrawerComponents.js @@ -194,6 +194,13 @@ export default class drawerContentComponents extends Component { </TouchableOpacity> {button2} + + <TouchableOpacity onPress={this.navigateToScreen('UserImageUpload')}> + <View style={styles.screenStyle}> + <Image style={{ width: wp('6%'), height: hp('3%') }} source={require('../Images/activesprint.png')} /> + <Text style={{ color: '#000000', marginLeft: 20 }}>ImageUpload</Text> + </View> + </TouchableOpacity> {/* <TouchableOpacity onPress={this.navigateToScreen('UserModules')}> <View style={styles.screenStyle}> <View style={{ width: wp('8%') }}> diff --git a/src/UserComponents/UserBacklogPending.js b/src/UserComponents/UserBacklogPending.js index 8558aee0c0e00de4ebe191cfaa400acc8acdf7c5..a52aeb5da7e7dac5d7732b0e8cba5fc86f0f376e 100644 --- a/src/UserComponents/UserBacklogPending.js +++ b/src/UserComponents/UserBacklogPending.js @@ -495,7 +495,7 @@ export default class UserBacklogPending extends Component { error1: '', error2: '', itemPressedDisabled: false, }; - this.unassignedTasksData(); + // this.unassignedTasksData(); AsyncStorage.getItem("cropcode", (err, res) => { this.setState({ squadName: res }); @@ -519,7 +519,7 @@ export default class UserBacklogPending extends Component { this.getRequestedIdeas(); this.GetStatus(); // this.getModules(); - this.getActiveSprints();//active sprint user stories + // this.getActiveSprints();//active sprint user stories // this.getSprints(); // this.getUnactiveSprintTasks(); this.getUnassigned();//Backlogs user stories @@ -683,15 +683,15 @@ export default class UserBacklogPending extends Component { // this.getActiveSprints(); // this.getUnassigned(); this.ideas(); - this.getRequestedIdeas(); + // this.getRequestedIdeas(); this.GetStatus(); this.getModules(); - this.getActiveSprints(); + // this.getActiveSprints(); this.getSprints1(); this.getUnactiveSprintTasks(); this.getUnassigned(); this.getPending(); - this.unassignedTasksData(); + // this.unassignedTasksData(); } }); @@ -1357,7 +1357,7 @@ export default class UserBacklogPending extends Component { } else { //to get the user pending my task list this.getRequestedIdeas(); - this.unassignedTasksData(); + // this.unassignedTasksData(); // this.onRefresh(); } }); @@ -1379,7 +1379,7 @@ export default class UserBacklogPending extends Component { console.log(res); this.setState({ cropcode: res }); }); - this.unassignedTasksData(); + // this.unassignedTasksData(); this.getRequestedIdeas(this.state.role, this.state.userToken, this.state.cropcode); } @@ -1402,7 +1402,7 @@ export default class UserBacklogPending extends Component { // this.getRequestedIdeas(); this.GetStatus(); // this.getModules(); - this.getActiveSprints(); + // this.getActiveSprints(); this.getSprints1(); this.getUnactiveSprintTasks(); this.getUnassigned(); diff --git a/src/UserComponents/UserDashboard.js b/src/UserComponents/UserDashboard.js index cff7f23b38fc4342a766f3a2bf35cee8737e825f..07cf5701728bdedd2fb112fc72f1d2be9b9e7ad0 100644 --- a/src/UserComponents/UserDashboard.js +++ b/src/UserComponents/UserDashboard.js @@ -56,6 +56,9 @@ export default class UserDashboard extends Component { epicName: 'Select Epic', abc: [], squadName: '', + dataSource2: [], + allMessagesUser: [], + allMessages: [], } @@ -64,6 +67,10 @@ export default class UserDashboard extends Component { // console.warn("squadname" + this.state.squadName); // }); + AsyncStorage.getItem("userToken", (err, res) => { + this.setState({ empId: res }); + }) + } moveUp = () => this.setState({ offset: -110 }); @@ -85,6 +92,7 @@ export default class UserDashboard extends Component { }); + } @@ -126,6 +134,9 @@ export default class UserDashboard extends Component { componentDidMount() { this.GetStatus(); + this.getMessages(); + this.getAllUserMessages(); + this.getAllTaskMessages(); } @@ -163,7 +174,7 @@ export default class UserDashboard extends Component { .then((responseJson) => { console.warn(responseJson) - //alert(JSON.stringify(responseJson)) + // alert(JSON.stringify(responseJson)) if (responseJson.status == 'True') { @@ -271,7 +282,7 @@ export default class UserDashboard extends Component { // alert(JSON.stringify(responseJson)) if (responseJson.status === 'True') { - // alert(responseJson.message) + // alert(responseJson.message) this.GetStatus() this.refs.toast.showBottom('Project Created Succesfully'); this.setState({ itemPressedDisabled: false }) @@ -299,6 +310,226 @@ export default class UserDashboard extends Component { }; + + + + + getMessages() { + log("Info", " getMessages(role, userToken, cropcode) is used getting task related messages"); + // const groupId = this.state.subtaskId; + // console.warn("getmessages"); + AsyncStorage.multiGet(["cropcode", "userToken"], (err, response) => { + const cropcode = response[0][1]; + const userToken = response[1][1]; + this.setState({ userid: userToken }); + // console.warn("userToken"+userToken) + // console.warn("cropcode"+cropcode) + + NetInfo.fetch().then(state => { + if (state.type == "none") { + log("Warn", "No internet connection"); + Snackbar.show({ + title: 'No Internet Connection', + backgroundColor: 'red', + duration: Snackbar.LENGTH_LONG, + }); + } + else { + fetch(API + "squad_chat.php", + { + method: 'POST', + headers: { + Accept: 'application/json', + 'Content-Type': 'application/json', + }, + body: JSON.stringify({ + + action: "get_all_messages", + // corp_code: cropcode, + sendBy: userToken, + + + }) + }) + .then((response) => response.json()) + .then((responseJson) => { + // console.warn("Messages For chat application" + JSON.stringify(responseJson.data)); + + // console.warn("Messages from users" + JSON.stringify(responseJson)) + // console.warn("Send By Name" + JSON.stringify(responseJson.data)) + // alert(JSON.stringify(responseJson.data)) + if (responseJson.status === 'True') { + + // console.warn("Setted Data") + + + + this.setState({ + dataSource2: responseJson.data, + }); + // console.warn("Method data" + responseJson.data.sendBy) + } + else { + // console.warn("Empty Data") + this.setState({ + dataSource2: [], + }); + } + }) + .catch((error) => { + console.error(error); + log("Error", "getting task related messages error"); + }); + + } + }); + }); + } + getAllUserMessages() { + log("Info", " getMessages(role, userToken, cropcode) is used getting task related messages"); + // const groupId = this.state.subtaskId; + // console.warn("getmessages"); + AsyncStorage.multiGet(["cropcode", "userToken"], (err, response) => { + const cropcode = response[0][1]; + const userToken = response[1][1]; + this.setState({ userid: userToken }); + // console.warn("userToken"+userToken) + // console.warn("cropcode"+cropcode) + + NetInfo.fetch().then(state => { + if (state.type == "none") { + log("Warn", "No internet connection"); + Snackbar.show({ + title: 'No Internet Connection', + backgroundColor: 'red', + duration: Snackbar.LENGTH_LONG, + }); + } + else { + fetch(API + "user_chat.php", + { + method: 'POST', + headers: { + Accept: 'application/json', + 'Content-Type': 'application/json', + }, + body: JSON.stringify({ + + action: "get_all_messages_dash", + // corp_code: cropcode, + sendBy: userToken, + + + }) + }) + .then((response) => response.json()) + .then((responseJson) => { + // console.warn("Messages For chat application" + JSON.stringify(responseJson.data)); + + // console.warn("Messages from users" + JSON.stringify(responseJson)) + // console.warn("Send By Name" + JSON.stringify(responseJson.data)) + // alert(JSON.stringify(responseJson.data)) + if (responseJson.status === 'True') { + + // console.warn("Setted Data") + + + + this.setState({ + allMessagesUser: responseJson.data, + }); + // console.warn("Method data" + responseJson.data.sendBy) + } + else { + // console.warn("Empty Data") + this.setState({ + allMessagesUser: [], + }); + } + }) + .catch((error) => { + console.error(error); + log("Error", "getting task related messages error"); + }); + + } + }); + }); + } + + getAllTaskMessages() { + log("Info", " getMessages(role, userToken, cropcode) is used getting task related messages"); + + AsyncStorage.multiGet(["cropcode", "userToken"], (err, response) => { + const cropcode = response[0][1]; + const userToken = response[1][1]; + this.setState({ userid: userToken }); + + + NetInfo.fetch().then(state => { + if (state.type == "none") { + log("Warn", "No internet connection"); + Snackbar.show({ + title: 'No Internet Connection', + backgroundColor: 'red', + duration: Snackbar.LENGTH_LONG, + }); + } + else { + fetch(API + "user_story_chat.php", + { + method: 'POST', + headers: { + Accept: 'application/json', + 'Content-Type': 'application/json', + }, + body: JSON.stringify({ + + action: "getAllTaskMessagesDash", + // corp_code: cropcode, + sendBy: userToken, + + + }) + }) + .then((response) => response.json()) + .then((responseJson) => { + // console.warn("Messages For chat application" + JSON.stringify(responseJson.data)); + + // console.warn("Messages from users" + JSON.stringify(responseJson)) + // console.warn("Send By Name" + JSON.stringify(responseJson.data)) + // alert(JSON.stringify(responseJson.data)) + if (responseJson.status === 'True') { + + // console.warn("Setted Data") + + + + this.setState({ + allMessages: responseJson.data, + }); + // console.warn("Method data" + responseJson.data.sendBy) + } + else { + // console.warn("Empty Data") + this.setState({ + allMessages: [], + }); + } + }) + .catch((error) => { + console.error(error); + log("Error", "getting task related messages error"); + }); + + } + }); + }); + } + + + + dashboard(projects, index) { //alert(projects); console.log(index); @@ -312,9 +543,49 @@ export default class UserDashboard extends Component { AsyncStorage.setItem('projectId', projects.id)); // { id: projects.id,squadName:projects.value }); } + + + //Navigates to TaskChat Screen + AdminChat() { + // console.warn("msgCount" + msgCount); + // console.warn("taskid" + taskid); + // alert(taskid) + // alert("taskid" + taskid) + // log("Info", "UserPendingMyTasks:TaskChat(item, index) used to navigate to taskchat") + // this.props.navigation.navigate("AdminChat"); + this.props.navigation.push("AdminChat"); + } + + render() { + const getMessagesCount = (p_id, msg, empId, userMsg) => { + + const msgCount = msg.filter(message => message.readBy.split(",").indexOf(empId) === -1 + && (message.messagedBy !== empId && message.project_id === p_id)).map((messages, i) => { + return i, messages + }) + const msgCountUser = userMsg.filter(message => message.project_id === p_id).map((messagess, index) => { + return index, messagess + }) + + // console.warn("iiiiiiii" + id) + // console.warn("msgcount" + msgCount) + // console.warn("msgCountUser" + msgCountUser) + + return ( + + <View style={{ flexDirection: 'row', backgroundColor: 'whitesmoke', flex: 1 }}> + {msgCount.length + msgCountUser.length > 0 ? ( + <View style={{ flexDirection: 'row', textAlign: 'right' }}> + <Text style={{ color: 'black', fontWeight: 'bold' }}>Messages</Text> + <Text style={{ color: 'red', }}> {msgCount.length + msgCountUser.length > 0 ? msgCount.length + msgCountUser.length : null} </Text> + </View>) : <Text></Text>} + </View> + ) + + } if (this.state.isLoading) { return ( @@ -339,13 +610,27 @@ export default class UserDashboard extends Component { borderBottomColor: '#ffffff', justifyContent: 'space-between', }}> - <View style={{ marginTop: 20, flexDirection: 'row' }}> - <Image style={{ width: 25, height: 25 }} source={require('../Images/add.png')} /> + <TouchableOpacity onPress={this.openModal}> + <View style={{ marginTop: 20, flexDirection: 'row' }}> + + <Image style={{ width: 25, height: 25 }} source={require('../Images/add.png')} /> + - <TouchableOpacity onPress={this.openModal}> <Text style={{ width: 150, borderRadius: 20, height: 45, flexDirection: 'row', color: 'white', padding: 5 }}> Add New Project </Text> + </View> + </TouchableOpacity> + + <View style={{ flexDirection: 'row', marginTop: 20, }}> + <View style={{ marginRight: 2, }} > + <Text style={{ color: 'white' }}>{this.state.dataSource2.length}</Text> + </View> + <TouchableOpacity onPress={() => { this.AdminChat() }}> + + <View> + <Image style={{ width: 25, height: 25, color: 'white' }} source={require('../Images/chat.png')} /> + </View> </TouchableOpacity> </View> <View style={{ marginTop: 20, flexDirection: 'row' }}> @@ -398,7 +683,7 @@ export default class UserDashboard extends Component { // onPress={() => this.props.navigation.navigate('UserMyTask', { id: projects.id,squadName: projects.value, })} > <DataTable.Cell style={{ backgroundColor: projects.color, width: '92%', height: 150, marginTop: 5, marginBottom: 15, justifyContent: 'center' }}><Text style={{ color: 'black', }}>{projects.value} </Text></DataTable.Cell> - + {getMessagesCount(projects.id, this.state.allMessages, this.state.empId, this.state.allMessagesUser)} </TouchableOpacity> </DataTable.Row> diff --git a/src/UserComponents/UserImageUpload.js b/src/UserComponents/UserImageUpload.js new file mode 100644 index 0000000000000000000000000000000000000000..80a3d03627c1854592b6f582b5c399889d243f76 --- /dev/null +++ b/src/UserComponents/UserImageUpload.js @@ -0,0 +1,153 @@ +import React, { useState } from 'react'; +// Import core components +import { + StyleSheet, + Text, + View, + TouchableOpacity +} from 'react-native'; +import { API } from "../WebServices/RestClient"; + +// Import Document Picker +import DocumentPicker from 'react-native-document-picker'; + +const UserImageUpload = () => { + const [singleFile, setSingleFile] = useState(null); + + const uploadImage = async () => { + // Check if any file is selected or not + if (singleFile != null) { + // If file selected then create FormData + const fileToUpload = singleFile; + const data = new FormData(); + data.append('name', 'Image Upload'); + data.append('file_attachment', fileToUpload); + // Please change file upload URL + let res = await fetch(API + "upload.php", + { + method: 'post', + body: data, + headers: { + 'Content-Type': 'multipart/form-data; ', + }, + } + ); + let responseJson = await res.json(); + if (responseJson.status == 1) { + alert('Upload Successful'); + } + } else { + // If no file selected the show alert + alert('Please Select File first'); + } + }; + + const selectFile = async () => { + // Opening Document Picker to select one file + try { + const res = await DocumentPicker.pick({ + // Provide which type of file you want user to pick + type: [DocumentPicker.types.allFiles], + // There can me more options as well + // DocumentPicker.types.allFiles + // DocumentPicker.types.images + // DocumentPicker.types.plainText + // DocumentPicker.types.audio + // DocumentPicker.types.pdf + }); + // Printing the log realted to the file + console.log('res : ' + JSON.stringify(res)); + // Setting the state to show single file attributes + setSingleFile(res); + } catch (err) { + setSingleFile(null); + // Handling any exception (If any) + if (DocumentPicker.isCancel(err)) { + // If user canceled the document selection + alert('Canceled'); + } else { + // For Unknown Error + alert('Unknown Error: ' + JSON.stringify(err)); + throw err; + } + } + }; + return ( + <View style={styles.mainBody}> + <View style={{ alignItems: 'center' }}> + <Text style={{ fontSize: 30, textAlign: 'center' }}> + React Native File Upload Example + </Text> + <Text + style={{ + fontSize: 25, + marginTop: 20, + marginBottom: 30, + textAlign: 'center', + }}> + www.aboutreact.com + </Text> + </View> + {/*Showing the data of selected Single file*/} + {singleFile != null ? ( + <Text style={styles.textStyle}> + File Name: {singleFile.name ? singleFile.name : ''} + {'\n'} + Type: {singleFile.type ? singleFile.type : ''} + {'\n'} + File Size: {singleFile.size ? singleFile.size : ''} + {'\n'} + URI: {singleFile.uri ? singleFile.uri : ''} + {'\n'} + </Text> + ) : null} + <TouchableOpacity + style={styles.buttonStyle} + activeOpacity={0.5} + onPress={selectFile}> + <Text style={styles.buttonTextStyle}>Select File</Text> + </TouchableOpacity> + <TouchableOpacity + style={styles.buttonStyle} + activeOpacity={0.5} + onPress={uploadImage}> + <Text style={styles.buttonTextStyle}>Upload File</Text> + </TouchableOpacity> + </View> + ); +}; + +const styles = StyleSheet.create({ + mainBody: { + flex: 1, + justifyContent: 'center', + padding: 20, + }, + buttonStyle: { + backgroundColor: '#307ecc', + borderWidth: 0, + color: '#FFFFFF', + borderColor: '#307ecc', + height: 40, + alignItems: 'center', + borderRadius: 30, + marginLeft: 35, + marginRight: 35, + marginTop: 15, + }, + buttonTextStyle: { + color: '#FFFFFF', + paddingVertical: 10, + fontSize: 16, + }, + textStyle: { + backgroundColor: '#fff', + fontSize: 15, + marginTop: 16, + marginLeft: 35, + marginRight: 35, + textAlign: 'center', + }, +}); + +export default UserImageUpload; \ No newline at end of file diff --git a/src/UserComponents/UserPendingMyTask.js b/src/UserComponents/UserPendingMyTask.js index 3e977be7f0fc78d8c3e64f890785c1bcd5ed12fa..4b2241b433897886d46839202d9813adea0f47a9 100644 --- a/src/UserComponents/UserPendingMyTask.js +++ b/src/UserComponents/UserPendingMyTask.js @@ -1283,10 +1283,10 @@ updateActiveTaskStatus1 = (todoStoryId,assignedTo,inProgressStoryId) => { .then((responseJson) => { console.warn(responseJson) if (responseJson.status === 'true') { - alert(responseJson.message) + // alert(responseJson.message) this.addCommentUserStory(message, todoStoryId, "1") - // alert("Success"); + alert("Updated Successfully"); } else { new Pending().onRefresh(); diff --git a/src/UserComponents/UserRoadblocksAssigned.js b/src/UserComponents/UserRoadblocksAssigned.js index b88aa9f46254435a191fea6e598221f6df16f424..e4484a6b1291e63702e296c57868c8fc0c236baf 100644 --- a/src/UserComponents/UserRoadblocksAssigned.js +++ b/src/UserComponents/UserRoadblocksAssigned.js @@ -25,7 +25,7 @@ import { SkypeIndicator, UIActivityIndicator } from 'react-native-indicators'; -import { SUBTASK, DESCRIPTION,ASSIGNED_TO,ASSIGNED_BY, ROADBLOCK_DATE,MODIFY, PRIORITY,SEVERITY, TARGET_DATE,ASSIGNED_DATE } from '../CommonComponents/Header'; +import { SUBTASK, DESCRIPTION, ASSIGNED_TO, ASSIGNED_BY, ROADBLOCK_DATE, MODIFY, PRIORITY, SEVERITY, TARGET_DATE, ASSIGNED_DATE } from '../CommonComponents/Header'; import { Collapse, CollapseHeader, CollapseBody } from "accordion-collapse-react-native"; @@ -134,14 +134,14 @@ class ListItem extends React.Component { return ( <View> - + {/* <Collapse style={styles.container}> <CollapseHeader style={styles.boxheader}> */} <View style={styles.container}> <View style={styles.boxheader}> <TouchableOpacity activeOpacity={0.8} onPress={this.changeLayout} > <View style={{ flexDirection: 'row' }}> - <View style={{ flexDirection: 'row', width: wp('70%') }}> + <View style={{ flexDirection: 'row', width: wp('70%') }}> <Text style={styles.signUpText0} >User Story Id:</Text> <Text style={styles.signUpText1} >{(this.props.cropcode).substring(0, 3).toUpperCase()}:{item.story_id.substring(0, 5).toUpperCase()}- {item.subtaskname}</Text> </View> @@ -174,7 +174,7 @@ class ListItem extends React.Component { </View> {/* </CollapseHeader> */} <View style={{ height: this.state.expanded ? null : 0, overflow: 'hidden' }}> - <CollapseBody style={{backgroundColor:'white',}}> + <CollapseBody style={{ backgroundColor: 'white', }}> <View style={{ flexDirection: 'row', paddingRight: 25, width: wp('90%') }}> @@ -242,10 +242,10 @@ class ListItem extends React.Component { <Text style={styles.signUpText000} >{TARGET_DATE}:</Text> <Text style={styles.signUpText111} >{item.target_date}</Text> {/* <Text style={styles.signUpText1} >{item.date}</Text> */} - {/* </View> */} - {/* <Text style={styles.signUpText002} >Updated On:0000-00-00 00:00:00 </Text> */} + {/* </View> */} + {/* <Text style={styles.signUpText002} >Updated On:0000-00-00 00:00:00 </Text> */} - {/* </View> */} + {/* </View> */} {/* <View style={{ flexDirection: 'row', justifyContent: 'flex-end', alignItems: 'center' }}> @@ -368,7 +368,7 @@ export default class Assigned extends Component { //navigate to ModifySubtask this.props.navigation.navigate('ModifyRoadblock', { callHome: this.userCompletedMyTasks.bind(this), - subtaskid: item.subTaskId, roadblockId: item.sno, subTaskName: item.subTaskName,priorityLevel:item.priorityLevel,severityLevel:item.severityLevel, description: item.roadBlockDescription, requested: item.requestedBy, person: item.assignedTo, + subtaskid: item.subTaskId, roadblockId: item.sno, subTaskName: item.subTaskName, priorityLevel: item.priorityLevel, severityLevel: item.severityLevel, description: item.roadBlockDescription, requested: item.requestedBy, person: item.assignedTo, name: item.assignedBy, subTaskId: item.subTaskId, days: days, hours: hours }); @@ -384,69 +384,69 @@ export default class Assigned extends Component { AsyncStorage.getItem("projectId", (err, res) => { const projectId = res; - AsyncStorage.getItem("emp_role", (err, res) => { - const emp_role = res; - //Checking the Internet Connection - NetInfo.fetch().then(state => { - if (state.type == "none" || state.type == 'unknown') { - console.log(state.type); - Snackbar.show({ - title: 'No Internet Connection', - backgroundColor: 'red', - duration: Snackbar.LENGTH_LONG, - }); - } else { - - fetch(API + 'manage_roadblocks.php', - { - method: 'POST', - headers: { - Accept: 'application/json', - 'Content-Type': 'application/json', - }, - body: JSON.stringify({ - crop: cropcode, - action: "assignedroadblocks", - projectId: projectId - // userType: emp_role, - // empId: empId - }) - }) - .then((response) => response.json()) - .then((responseJson) => { - console.log(responseJson); - console.warn(responseJson); - // alert(JSON.stringify(responseJson.data)) - if (responseJson.status === 'True') { - this.setState({ - isLoading: false, - dataSource: responseJson.data, - isFetching: false - }, function () { - }); - this.arrayholder = responseJson.data; - } else { - log("Info", "no completed my tasks at user side"); - this.arrayholder = []; - this.setState({ - isLoading: false, - }) - Snackbar.show({ - title: 'No Completed Subtasks', - backgroundColor: '#3BB9FF', - duration: Snackbar.LENGTH_LONG, - }); - } - - }) - .catch((error) => { - console.error(error); - log("Error", "Error in getting of completed my tasks at user side"); + AsyncStorage.getItem("emp_role", (err, res) => { + const emp_role = res; + //Checking the Internet Connection + NetInfo.fetch().then(state => { + if (state.type == "none" || state.type == 'unknown') { + console.log(state.type); + Snackbar.show({ + title: 'No Internet Connection', + backgroundColor: 'red', + duration: Snackbar.LENGTH_LONG, }); + } else { + + fetch(API + 'manage_roadblocks.php', + { + method: 'POST', + headers: { + Accept: 'application/json', + 'Content-Type': 'application/json', + }, + body: JSON.stringify({ + crop: cropcode, + action: "assignedroadblocks", + projectId: projectId + // userType: emp_role, + // empId: empId + }) + }) + .then((response) => response.json()) + .then((responseJson) => { + console.log(responseJson); + console.warn(responseJson); + // alert(JSON.stringify(responseJson.data)) + if (responseJson.status === 'True') { + this.setState({ + isLoading: false, + dataSource: responseJson.data, + isFetching: false + }, function () { + }); + this.arrayholder = responseJson.data; + } else { + log("Info", "no completed my tasks at user side"); + this.arrayholder = []; + this.setState({ + isLoading: false, + }) + Snackbar.show({ + title: 'No Completed Subtasks', + backgroundColor: '#3BB9FF', + duration: Snackbar.LENGTH_LONG, + }); + } + + }) + .catch((error) => { + console.error(error); + log("Error", "Error in getting of completed my tasks at user side"); + }); - } + } + }); }); - }); }); @@ -473,34 +473,24 @@ export default class Assigned extends Component { // const subTaskId1 = text.toUpperCase() const r_id = item.r_id.toUpperCase() const r_id1 = text.toUpperCase() - - const subTaskName = item.subTaskName.toUpperCase() - const subTaskName1 = text.toUpperCase() const roadblock_description = item.roadblock_description.toUpperCase() const roadblock_description1 = text.toUpperCase() const status = item.status.toUpperCase() const status1 = text.toUpperCase() - const assignedTo = item.assignedTo.toUpperCase() - const assignedTo1 = text.toUpperCase() - const roadblock_date = item.roadblock_date.toUpperCase() - const roadblock_date1 = text.toUpperCase() - const assignedBy = item.assignedBy.toUpperCase() - const assignedBy1 = text.toUpperCase() const assigned_date = item.assigned_date.toUpperCase() const assigned_date1 = text.toUpperCase() - const target_date = item.target_date.toUpperCase() - const target_date1 = text.toUpperCase() - return r_id.indexOf(r_id1) > -1 || + const assignedto = item.assignedto.toUpperCase() + const assignedto1 = text.toUpperCase() + const assignedby = item.assignedby.toUpperCase() + const assignedby1 = text.toUpperCase() - subTaskName.indexOf(subTaskName1) > -1 || + return r_id.indexOf(r_id1) > -1 || roadblock_description.indexOf(roadblock_description1) > -1 || - target_date.indexOf(target_date1) > -1 || status.indexOf(status1) > -1 || - assigned_date.indexOf(assigned_date1) > -1 || - assignedBy.indexOf(assignedBy1) > -1 - assignedTo.indexOf(assignedTo1) > -1 || - targetDate.indexOf(targetDate1) > -1 - // dependencyTitle.indexOf(dependencyTitle1) > -1 + assignedto.indexOf(assignedto1) > -1 || + assignedby.indexOf(assignedby1) > -1 || + assigned_date.indexOf(assigned_date1) > -1 + }) this.setState({ @@ -521,7 +511,7 @@ export default class Assigned extends Component { return ( <Container style={{ height: Dimensions.get('window').height }}> <Item> - + <Input placeholder="Search" onChangeText={(text) => this.SearchFilterFunction(text)} /> <Icon name="search" size={20} /> @@ -808,7 +798,7 @@ const styles = StyleSheet.create({ alignSelf: 'center', }, boxheader: { - backgroundColor:'white', + backgroundColor: 'white', justifyContent: 'space-between', flexDirection: 'column', position: 'relative', diff --git a/src/UserComponents/UserRoadblocksTobeAssigned.js b/src/UserComponents/UserRoadblocksTobeAssigned.js index 0833331faaf3d6bea618de2e0c4d66820ca8bc68..92aa0537fd107c213752a8ad3dc7a45b3d46d8ab 100644 --- a/src/UserComponents/UserRoadblocksTobeAssigned.js +++ b/src/UserComponents/UserRoadblocksTobeAssigned.js @@ -1,5 +1,5 @@ /* -FileName:TobeAssigned.js +FileName:UserRoadblockTobeAssigned.js Version:1.0.0 Purpose:Getting the List of user pending my task list Devloper:Rishitha,Naveen,Harsha,Mahesh @@ -211,7 +211,7 @@ class ListItem extends React.Component { <Text style={styles.signUpText0} >User Story Id:</Text> <Text style={styles.signUpText1} >{(this.props.cropcode).substring(0, 3).toUpperCase()}:{item.story_id.substring(0, 5).toUpperCase()}- {item.subtaskname}</Text> </View> - + </View> {/* <Text style={styles.signUpText02} >{item.status} </Text> */} @@ -264,7 +264,7 @@ class ListItem extends React.Component { <View style={{ flexDirection: 'row', justifyContent: 'flex-end', alignItems: 'center' }}> <TouchableOpacity onPress={this.props.RoadBlock} style={{ width: 80, backgroundColor: 'black', borderRadius: 30, marginRight: 5 }}><Text style={{ color: '#fff', textAlign: 'center' }}>{ASSIGN}</Text></TouchableOpacity> - + </View> <View style={{ @@ -450,7 +450,7 @@ export default class TobeAssigned extends Component { }) .then((response) => response.json()) .then((responseJson) => { - //alert(JSON.stringify(responseJson)) + // alert(JSON.stringify(responseJson)) console.warn(responseJson); if (responseJson.status === 'True') { this.setState({ @@ -629,40 +629,21 @@ export default class TobeAssigned extends Component { log("Info", "UserCompletedMyTasks:SearchFilterFunction(text) for search functionality"); console.log(text); const newData = this.arrayholder.filter(function (item) { - //const subTaskId = item.subTaskId.toUpperCase() - //const subTaskId1 = text.toUpperCase() const r_id = item.r_id.toUpperCase() const r_id1 = text.toUpperCase() - const subTaskName = item.subTaskName.toUpperCase() - const subTaskName1 = text.toUpperCase() const roadblock_description = item.roadblock_description.toUpperCase() const roadblock_description1 = text.toUpperCase() const status = item.status.toUpperCase() const status1 = text.toUpperCase() - const assignedTo = item.assignedTo.toUpperCase() - const assignedTo1 = text.toUpperCase() - const roadblock_date = item.roadblock_date.toUpperCase() - const roadblock_date1 = text.toUpperCase() - const assignedBy = item.assignedBy.toUpperCase() - const assignedBy1 = text.toUpperCase() - const assigned_date = item.assigned_date.toUpperCase() - const assigned_date1 = text.toUpperCase() - const target_date = item.target_date.toUpperCase() - const target_date1 = text.toUpperCase() - // - // subTaskId.indexOf(subTaskId1) > -1 || - // r_id.indexOf(r_id1) > -1 || + const requestedby = item.requestedby.toUpperCase() + const requestedby1 = text.toUpperCase() + return r_id.indexOf(r_id1) > -1 || - subTaskName.indexOf(subTaskName1) > -1 || roadblock_description.indexOf(roadblock_description1) > -1 || - target_date.indexOf(target_date1) > -1 || status.indexOf(status1) > -1 || - assigned_date.indexOf(assigned_date1) > -1 || - assignedBy.indexOf(assignedBy1) > -1 - assignedTo.indexOf(assignedTo1) > -1 || - targetDate.indexOf(targetDate1) > -1 - // dependencyTitle.indexOf(dependencyTitle1) > -1 + requestedby.indexOf(requestedby1) > -1 + }) this.setState({ @@ -978,7 +959,7 @@ const styles = StyleSheet.create({ fontSize: 13, paddingRight: 5, color: 'red', - textAlign:'right' + textAlign: 'right' // paddingBottom: 10, diff --git a/src/splash.js b/src/splash.js index 07aba52ad4b3d0b272ef06eb35b901efd1352055..e17e0da5eded7cb25bcf5faf495b90bf12ed8b51 100644 --- a/src/splash.js +++ b/src/splash.js @@ -123,7 +123,7 @@ export default class App extends React.Component { <Image style={{ width: 400, height: 162 }} source={require('./Images/agile2.png')} /> <Text style={styles.text}>Powered by Novisync</Text> <Text></Text> - <Text style={styles.text1}>1.0.1 11-30-2021</Text> + <Text style={styles.text1}>1.0.1 12-13-2021</Text> </View> ); };