Commit 5a29e61b authored by santhosh's avatar santhosh
Browse files

sorted

parent f31f3a0b
Showing with 261 additions and 167 deletions
+261 -167
...@@ -375,12 +375,12 @@ class ListItem extends Component { ...@@ -375,12 +375,12 @@ class ListItem extends Component {
</View> </View>
<View style={{ flexDirection: 'row' }}> <View style={{ flexDirection: 'row' }}>
<Text style={{ color: 'grey', width: '70%', paddingLeft: 60 }}> {getLastMsg(this.state.dataSource3, item.id)}</Text> <Text style={{ color: 'grey', width: '70%', paddingLeft: 60 }}> {item.message}</Text>
<Text style={{ color: 'grey', fontSize: 10 }}> {getLastMsgTime(this.state.dataSource3, item.id)}</Text> <Text style={{ color: 'grey', fontSize: 10 }}> {item.messaged_time}</Text>
</View> </View>
<View> <View>
</View> </View>
</View> </View>
...@@ -789,171 +789,174 @@ export default class AdminChat extends Component { ...@@ -789,171 +789,174 @@ export default class AdminChat extends Component {
// this.UserManageEmployees(); // this.UserManageEmployees();
// } // }
//to get the lsit of list of employees //to get the lsit of list of employees
UserManageEmployees() { 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) => { log("Info", "UserManageEmployees:getEmployeeList() method is used to get employee list");
const empId = res; AsyncStorage.getItem("cropcode", (err, res) => {
AsyncStorage.getItem("userName", (err, res) => { const cropcode = res;
const userName = res; // alert(cropcode)
// alert(userName) AsyncStorage.getItem("userToken", (err, res) => {
AsyncStorage.getItem("emp_role", (err, res) => { const empId = res;
const emp_role = res; AsyncStorage.getItem("userName", (err, res) => {
const userName = res;
AsyncStorage.getItem("projectId", (err, res) => {
const projectId = res;
// alert(projectId)
AsyncStorage.getItem("emp_role", (err, res) => {
const emp_role = res;
const domain = userName.split('@')[1] const domain = userName.split('@')[1]
//Checking the Internet Connection //Checking the Internet Connection
NetInfo.fetch().then(state => { NetInfo.fetch().then(state => {
if (state.type == "none" || state.type == 'unknown' || state.type == 'undefined') { if (state.type == "none" || state.type == 'unknown' || state.type == 'undefined') {
Snackbar.show({ Snackbar.show({
title: 'No Internet Connection', title: 'No Internet Connection',
backgroundColor: 'red', backgroundColor: 'red',
duration: Snackbar.LENGTH_LONG, duration: Snackbar.LENGTH_LONG,
}); });
} }
else if (domain === 'gmail.com' || domain === 'yahoo.com' || domain === 'outlook.com') { else if (domain === 'gmail.com' || domain === 'yahoo.com' || domain === 'outlook.com') {
fetch(API + 'squad_chat.php', fetch(API + 'squad_chat.php',
{ {
method: 'POST', method: 'POST',
headers: { headers: {
Accept: 'application/json', Accept: 'application/json',
'Content-Type': 'application/json', 'Content-Type': 'application/json',
}, },
body: JSON.stringify({ body: JSON.stringify({
crop: cropcode, crop: cropcode,
// projectId: projectId, projectId: projectId,
action: "get_all_employees_new", action: "get_all_employees_msg_time",
// userType: emp_role, // userType: emp_role,
// empId: empId sendBy: empId
})
}) })
.then((response) => response.json()) })
.then((response) => response.json())
// console.warn(responseJson.data) // console.warn(responseJson.data)
.then((responseJson) => { .then((responseJson) => {
// alert(JSON.stringify(responseJson)) // alert(JSON.stringify(responseJson))
// console.warn("Employees" + JSON.stringify(responseJson)); // console.warn("Employees" + JSON.stringify(responseJson));
this.addManageEmployeesList(responseJson.data, cropcode) //Store Manage Employee List in Offline this.addManageEmployeesList(responseJson.data, cropcode) //Store Manage Employee List in Offline
// this.setState({ // this.setState({
// isLoading: false, // isLoading: false,
// dataSource: responseJson.data, // dataSource: responseJson.data,
// isFetching: false // isFetching: false
// }, function () { // }, function () {
// }); // });
// this.arrayholder = responseJson.data; // this.arrayholder = responseJson.data;
// }) // })
var employee = []; var employee = [];
responseJson.data.map((x) => { responseJson.data.map((x) => {
return (x.email !== userName ? employee.push(x) : null); return (x.email !== userName ? employee.push(x) : null);
}) })
this.setState({ this.setState({
isLoading: false, isLoading: false,
dataSource: employee, dataSource: employee,
isFetching: false isFetching: false
}, },
function () { function () {
} }
); );
this.arrayholder = responseJson.data; this.arrayholder = responseJson.data;
}) })
.catch((error) => { .catch((error) => {
check.Maintenance(); check.Maintenance();
console.error(error); console.error(error);
log("Error", "error in getting employee list at user side"); log("Error", "error in getting employee list at user side");
}); });
} }
else { else {
fetch(API + 'squad_chat.php', fetch(API + 'squad_chat.php',
{ {
method: 'POST', method: 'POST',
headers: { headers: {
Accept: 'application/json', Accept: 'application/json',
'Content-Type': 'application/json', 'Content-Type': 'application/json',
}, },
body: JSON.stringify({ body: JSON.stringify({
crop: cropcode, crop: cropcode,
// projectId: projectId, projectId: projectId,
action: "get_all_employees", action: "get_all_employees_msg_time",
domain: domain, domain: domain,
// userType: emp_role, // userType: emp_role,
// empId: empId sendBy: empId
})
}) })
.then((response) => response.json()) })
.then((response) => response.json())
// console.warn(responseJson.data)
// 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({ .then((responseJson) => {
// isLoading: false, // alert(JSON.stringify(responseJson))
// dataSource: responseJson.data, // console.warn("Employees" + JSON.stringify(responseJson));
// isFetching: false this.addManageEmployeesList(responseJson.data, cropcode) //Store Manage Employee List in Offline
// }, function () {
// });
// this.arrayholder = responseJson.data; // 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, var employee = [];
dataSource: employee, responseJson.data.map((x) => {
isFetching: false return (x.email !== userName ? employee.push(x) : null);
}, })
function () {
} 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");
});
} 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 //Seperate the List date
...@@ -1044,6 +1047,10 @@ export default class AdminChat extends Component { ...@@ -1044,6 +1047,10 @@ export default class AdminChat extends Component {
); );
} }
const key = 'name';
const arrayUniqueByKey = [...new Map(this.state.dataSource.map(item =>
[item[key], item])).values()].sort((a, b) => b.sno - a.sno);
const sortedOne = (msg, emp) => { const sortedOne = (msg, emp) => {
const sortedUserIds = msg const sortedUserIds = msg
.sort() .sort()
...@@ -1061,7 +1068,11 @@ export default class AdminChat extends Component { ...@@ -1061,7 +1068,11 @@ export default class AdminChat extends Component {
return sortedEmployees; return sortedEmployees;
} }
const empSorted = sortedOne(this.state.dataSource2, this.state.dataSource); const empSorted = sortedOne(this.state.dataSource2, arrayUniqueByKey);
//alert(JSON.stringify(this.state.dataSource2))
// const empSorted = sortedOne(this.state.dataSource2, this.state.dataSource);
return ( return (
......
...@@ -474,9 +474,10 @@ export default class AdminChatUser extends Component { ...@@ -474,9 +474,10 @@ export default class AdminChatUser extends Component {
</Header> </Header>
{/* <KeyboardAvoidingView> */} {/* <KeyboardAvoidingView> */}
<View style={styles.container}> <View style={styles.container}>
<ScrollView ref="scrollView" <ScrollView
onContentSizeChange={(width, height) => this.refs.scrollView.scrollTo({ y: height })}> ref={ref => { this.scrollView = ref }}
onContentSizeChange={() => this.scrollView.scrollToEnd({ y: 0, animated: false })}
>
<FlatList style={styles.list} <FlatList style={styles.list}
...@@ -589,7 +590,7 @@ export default class AdminChatUser extends Component { ...@@ -589,7 +590,7 @@ export default class AdminChatUser extends Component {
<View style={styles.inputContainer}> <View style={styles.inputContainer}>
<TextInput style={styles.inputs} <TextInput style={styles.inputs}
autoFocus={true} // autoFocus={true}
placeholder="Message" placeholder="Message"
underlineColorAndroid='transparent' underlineColorAndroid='transparent'
multiline={true} multiline={true}
......
...@@ -807,9 +807,10 @@ export default class GroupChat extends Component { ...@@ -807,9 +807,10 @@ export default class GroupChat extends Component {
</Header> </Header>
{/* <KeyboardAvoidingView> */} {/* <KeyboardAvoidingView> */}
<View style={styles.container}> <View style={styles.container}>
<ScrollView ref="scrollView" <ScrollView
onContentSizeChange={(width, height) => this.refs.scrollView.scrollTo({ y: height })}> ref={ref => { this.scrollView = ref }}
onContentSizeChange={() => this.scrollView.scrollToEnd({ y: 0, animated: false })}
>
<FlatList style={styles.list} <FlatList style={styles.list}
......
...@@ -802,10 +802,10 @@ export default class TaskChat extends Component { ...@@ -802,10 +802,10 @@ export default class TaskChat extends Component {
</Header> </Header>
{/* <KeyboardAvoidingView> */} {/* <KeyboardAvoidingView> */}
<View style={styles.container}> <View style={styles.container}>
<ScrollView ref="scrollView" <ScrollView
onContentSizeChange={(width, height) => this.refs.scrollView.scrollTo({ y: height })}> ref={ref => { this.scrollView = ref }}
onContentSizeChange={() => this.scrollView.scrollToEnd({ y: 0, animated: false })}
>
<FlatList style={styles.list} <FlatList style={styles.list}
......
...@@ -395,10 +395,10 @@ export default class UserChat extends Component { ...@@ -395,10 +395,10 @@ export default class UserChat extends Component {
</Header> </Header>
{/* <KeyboardAvoidingView> */} {/* <KeyboardAvoidingView> */}
<View style={styles.container}> <View style={styles.container}>
<ScrollView ref="scrollView" <ScrollView
onContentSizeChange={(width, height) => this.refs.scrollView.scrollTo({ y: height })}> ref={ref => { this.scrollView = ref }}
onContentSizeChange={() => this.scrollView.scrollToEnd({ y: 0, animated: false })}
>
<FlatList style={styles.list} <FlatList style={styles.list}
......
...@@ -1002,12 +1002,12 @@ export default class CalendarDashboard extends Component { ...@@ -1002,12 +1002,12 @@ export default class CalendarDashboard extends Component {
return ( return (
timesheet.push({ timesheet.push({
start: x.StartTime || "2022-03-08 20:30:00+00", start: x.StartTime || "2022-03-08 20:30:00+00",
end: x.EndTime || "2022-03-08 20:30:00+00", end: x.EndTime || "2022-03-08 20:30:00+00",
title: x.Subject || x.Subject, title: x.Subject || x.Subject,
summary: x.assignedto || x.Members, summary: x.assignedto || x.Members,
location: "https://meet.google.com/wja-iynx-cvf", location: x.Location,
status: x.EventStatus, status: x.EventStatus,
eventdescription: x.Description, eventdescription: x.Description,
Id: x.Id, Id: x.Id,
......
...@@ -7,7 +7,7 @@ Devloper:Santosh,Mahesh Reddy ...@@ -7,7 +7,7 @@ Devloper:Santosh,Mahesh Reddy
// import { Calendar } from 'react-native-big-calendar' // import { Calendar } from 'react-native-big-calendar'
import EventCalendar from 'react-native-events-calendar'; import EventCalendar from 'react-native-events-calendar';
import React, { Component } from 'react'; import React, { Component } from 'react';
import { Alert, StyleSheet, TextInput, Text, View, Image, TouchableOpacity, Dimensions, Button, TouchableWithoutFeedbackBase } from 'react-native'; import { Alert, StyleSheet, TextInput, Text, View, Image, TouchableOpacity, Dimensions, Button, TouchableWithoutFeedbackBase,Linking } from 'react-native';
import NetInfo from '@react-native-community/netinfo'; import NetInfo from '@react-native-community/netinfo';
// import { Agenda } from 'react-native-calendars'; // import { Agenda } from 'react-native-calendars';
import AsyncStorage from '@react-native-community/async-storage'; import AsyncStorage from '@react-native-community/async-storage';
...@@ -851,6 +851,7 @@ export default class CalendarEvents extends Component { ...@@ -851,6 +851,7 @@ export default class CalendarEvents extends Component {
title: event.title, title: event.title,
start: event.start, start: event.start,
end: event.end, end: event.end,
location: event.location,
summary: event.summary, summary: event.summary,
status: event.status, status: event.status,
eventdescription: event.eventdescription, eventdescription: event.eventdescription,
...@@ -932,10 +933,10 @@ export default class CalendarEvents extends Component { ...@@ -932,10 +933,10 @@ export default class CalendarEvents extends Component {
this.state.dataSource1.map((x) => { this.state.dataSource1.map((x) => {
return ( return (
timesheet.push({ timesheet.push({
start: x.target_date || x.StartTime ||"2022-03-02 05:30:00+00",
start: x.target_date || x.EndTime, end: x.assigned_date || x.EndTime ||"2022-03-02 06:00:00+00",
end: x.assigned_date || x.StartTime,
title: x.story_title || x.Subject, title: x.story_title || x.Subject,
location: x.Location,
summary: x.assignedto || x.Members, summary: x.assignedto || x.Members,
status: x.EventStatus, status: x.EventStatus,
eventdescription: x.Description, eventdescription: x.Description,
...@@ -986,7 +987,6 @@ export default class CalendarEvents extends Component { ...@@ -986,7 +987,6 @@ export default class CalendarEvents extends Component {
{/* <EventCalendar {/* <EventCalendar
eventTapped={this._eventTapped.bind(this)} eventTapped={this._eventTapped.bind(this)}
events={timesheet} events={timesheet}
...@@ -1006,6 +1006,7 @@ export default class CalendarEvents extends Component { ...@@ -1006,6 +1006,7 @@ export default class CalendarEvents extends Component {
</View> </View>
<Text style={{ padding: 5 }}>{moment(this.state.start).format('MM.DD.YYYY hh:mm:ss')}</Text> <Text style={{ padding: 5 }}>{moment(this.state.start).format('MM.DD.YYYY hh:mm:ss')}</Text>
<Text style={{ paddingLeft: 5 }}>{this.state.summary}</Text> <Text style={{ paddingLeft: 5 }}>{this.state.summary}</Text>
<Text style={{ paddingLeft: 5,color:'#00A2C1' }} onPress={() => Linking.openURL(this.state.location)}>{this.state.location}</Text>
<Text style={{ paddingLeft: 5, paddingTop: 5 }}>{this.state.Location}</Text> <Text style={{ paddingLeft: 5, paddingTop: 5 }}>{this.state.Location}</Text>
......
...@@ -398,6 +398,7 @@ export default class UserGroupChat extends Component { ...@@ -398,6 +398,7 @@ export default class UserGroupChat extends Component {
// ProjectDescription: '', // ProjectDescription: '',
open: false, open: false,
resource: [], resource: [],
adminGroupsMsg:[],
ideaid: '', ideaid: '',
error1: '', error1: '',
error2: '', error2: '',
...@@ -468,8 +469,9 @@ export default class UserGroupChat extends Component { ...@@ -468,8 +469,9 @@ export default class UserGroupChat extends Component {
// this.userApprovedProjects() // this.userApprovedProjects()
this.GetStatus(); this.GetStatus();
this.getEmployees(); this.getEmployees();
this.getGroupDetails() this.getGroupDetails();
this.getMessages() this.getAdminGroupNew();
this.getMessages();
} }
}); });
...@@ -865,6 +867,79 @@ export default class UserGroupChat extends Component { ...@@ -865,6 +867,79 @@ export default class UserGroupChat extends Component {
}); });
} }
//to get the user approved projects in to the list
getAdminGroupNew() {
log("Info", "UserApprovedProjects:getResource() method is used to get all employee list");
// alert("hello")
AsyncStorage.getItem("userName", (err, res) => {
this.setState({ username: res });
AsyncStorage.getItem("cropcode", (err, res) => {
const cropcode = res;
AsyncStorage.getItem("projectId", (err, res) => {
const projectId = res;
AsyncStorage.getItem("userToken", (err, res) => {
const empId = res;
// alert(this.state.username)
NetInfo.fetch().then(state => {
if (state.type == "none" || state.type == 'unknown' || state.type == 'undefined') {
console.log(state.type);
Snackbar.show({
title: 'No Internet Connection',
backgroundColor: 'red',
duration: Snackbar.LENGTH_LONG,
});
} else {
fetch(API + 'group_chat.php',
{
method: 'POST',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify({
// crop: cropcode,
action: 'getAdminGroup_msg_time',
created_by: this.state.username,
projectId: projectId,
// empId: empId
})
})
.then((response) => response.json())
.then((responseJson) => {
if (responseJson.status === 'True') {
//alert(JSON.stringify(responseJson))
this.setState({
adminGroupsMsg: responseJson.data
});
this.arrayholder = responseJson.data;
}
else {
this.arrayholder = [];
this.setState({
isLoading: false,
adminGroupsMsg: []
})
}
})
.catch((error) => {
console.error(error);
log("Error", "error in listing employees");
});
}
});
});
});
});
});
}
//getting the Employees list for addind maintask //getting the Employees list for addind maintask
getEmployees() { getEmployees() {
log("Info", " getEmployees(cropcode) is used for getting the Employees list for addind maintask"); log("Info", " getEmployees(cropcode) is used for getting the Employees list for addind maintask");
...@@ -1506,6 +1581,10 @@ export default class UserGroupChat extends Component { ...@@ -1506,6 +1581,10 @@ export default class UserGroupChat extends Component {
); );
} }
const key = 'id';
const arrayUniqueByKey = [...new Map(this.state.adminGroupsMsg.map(item =>
[item[key], item])).values()].sort((a,b)=> b.sno - a.sno);
const sortedOne = (msg, emp, empId) => { const sortedOne = (msg, emp, empId) => {
const sortedUserIds = msg const sortedUserIds = msg
.sort() .sort()
...@@ -1521,7 +1600,8 @@ export default class UserGroupChat extends Component { ...@@ -1521,7 +1600,8 @@ export default class UserGroupChat extends Component {
return sortedEmployees; return sortedEmployees;
} }
const empSorted = sortedOne(this.state.dataSource2, this.state.resource, this.state.empId); // const empSorted = sortedOne(this.state.dataSource2, this.state.resource, this.state.empId);
const empSorted = sortedOne(this.state.dataSource2,arrayUniqueByKey,this.state.empId);
const { modalVisible, selectedItems } = this.state; const { modalVisible, selectedItems } = this.state;
return ( return (
......
/*****MySql********/ /*****MySql********/
//pre production environment (development) //pre production environment (development)
export const API = "https://api-single.agile24x7.com/release/"; // export const API = "https://api-single.agile24x7.com/release/";
export const CHATAPI = "https://api-single.agile24x7.com/release"; // export const CHATAPI = "https://api-single.agile24x7.com/release";
export const ReportsAPI = "https://testapiv2reporting.agile24x7.com/"; // export const ReportsAPI = "https://testapiv2reporting.agile24x7.com/";
export const Client_URL = "https://sdtest.agile24x7.com/#/"; // export const Client_URL = "https://sdtest.agile24x7.com/#/";
//production environment //production environment
// export const API = "https://api-single.agile24x7.com/Migration/"; // export const API = "https://api-single.agile24x7.com/Migration/";
...@@ -17,12 +17,12 @@ export const Client_URL = "https://sdtest.agile24x7.com/#/"; ...@@ -17,12 +17,12 @@ export const Client_URL = "https://sdtest.agile24x7.com/#/";
// //pre production environment (development) // //pre production environment (development)
// export const API = "https://api-single.agile24x7.com/pg_migration/"; export const API = "https://api-single.agile24x7.com/pg_migration/";
// export const CHATAPI = "https://api-single.agile24x7.com/pg_migration"; export const CHATAPI = "https://api-single.agile24x7.com/pg_migration";
// export const ReportsAPI = "https://pgtestreporting.agile24x7.com/"; export const ReportsAPI = "https://pgtestreporting.agile24x7.com/";
// export const Client_URL = "https://pgtest.agile24x7.com/#/"; export const Client_URL = "https://pgtest.agile24x7.com/#/";
//production environment //production environment
// export const API = "https://api-single.agile24x7.com/pg_prod/"; // export const API = "https://api-single.agile24x7.com/pg_prod/";
// export const CHATAPI = "https://api-single.agile24x7.com/pg_prod"; // export const CHATAPI = "https://api-single.agile24x7.com/pg_prod";
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment