Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Santhosh
Agile24X7-Mobile-singledb
Commits
a4c44eae
Commit
a4c44eae
authored
3 years ago
by
tejaswi
Browse files
Options
Download
Email Patches
Plain Diff
All changes
parent
b4e82409
This commit is part of merge request
!2
. Comments created here will be created in the context of that merge request.
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/CommonComponents/AdminChat.js
+47
-5
src/CommonComponents/AdminChat.js
src/CommonComponents/AdminChatUser.js
+6
-5
src/CommonComponents/AdminChatUser.js
src/UserComponents/UserDashboard.js
+82
-1
src/UserComponents/UserDashboard.js
with
135 additions
and
11 deletions
+135
-11
src/CommonComponents/AdminChat.js
Edit
View file @
a4c44eae
...
...
@@ -172,11 +172,12 @@ class ListItem extends Component {
// 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
return
i
,
messages
})
...
...
@@ -194,7 +195,7 @@ class ListItem extends Component {
empId
:
item
.
id
,
name
:
item
.
name
,
device_id
:
item
.
device_id
,
sno
:
this
.
state
.
sno
,
sno
:
msgCount
,
})}
/
>
...
...
@@ -207,7 +208,7 @@ class ListItem extends Component {
empId
:
item
.
id
,
name
:
item
.
name
,
device_id
:
item
.
device_id
,
sno
:
item
.
sno
,
sno
:
msgCount
,
})}
/
>
...
...
@@ -224,6 +225,47 @@ class ListItem extends Component {
}
// 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
}
>
...
...
@@ -234,8 +276,8 @@ class ListItem extends Component {
<
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)}
*/
}
{
getMessagesCount
(
this
.
state
.
dataSource2
,
item
.
id
)}
<
/View
>
<
/View
>
<
/View
>
...
...
This diff is collapsed.
Click to expand it.
src/CommonComponents/AdminChatUser.js
Edit
View file @
a4c44eae
/*
FileName:User
Chat
.js
FileName:
AdminChat
User.js
Version:1.0.0
Purpose:Getting the List of task messages with GroupName and List of Group Members and also send Message
Devloper:
Naveen
, Mahesh
Devloper:
Santhosh
, Mahesh
*/
import
React
,
{
Component
}
from
'
react
'
;
...
...
@@ -44,12 +44,13 @@ export default class AdminChatUser extends Component {
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,
sno
:
this
.
props
.
navigation
.
state
.
params
.
sno
,
userid
:
''
,
groupName
:
''
,
groupList
:
''
,
};
// alert("Msgcount"+this.props.navigation.state.params.sno)
}
componentDidMount
()
{
...
...
@@ -193,7 +194,7 @@ export default class AdminChatUser extends Component {
const
groupId
=
this
.
state
.
subtaskId
;
const
sno
=
this
.
state
.
sno
;
console
.
warn
(
"
sno
"
+
sno
)
// alert(sno)
// alert(
JSON.stringify(
sno)
)
const
msgId
=
sno
?
sno
.
map
((
msgId
,
index
)
=>
{
return
msgId
.
sno
...
...
@@ -215,7 +216,7 @@ export default class AdminChatUser extends Component {
});
}
else
{
fetch
(
API
+
'
squad_chat.php
"
'
,
fetch
(
API
+
'
squad_chat.php
'
,
{
method
:
'
POST
'
,
headers
:
{
...
...
This diff is collapsed.
Click to expand it.
src/UserComponents/UserDashboard.js
Edit
View file @
a4c44eae
...
...
@@ -56,6 +56,7 @@ export default class UserDashboard extends Component {
epicName
:
'
Select Epic
'
,
abc
:
[],
squadName
:
''
,
dataSource2
:[],
}
...
...
@@ -126,6 +127,7 @@ export default class UserDashboard extends Component {
componentDidMount
()
{
this
.
GetStatus
();
this
.
getMessages
();
}
...
...
@@ -299,6 +301,84 @@ 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
"
);
});
}
});
});
}
dashboard
(
projects
,
index
)
{
//alert(projects);
console
.
log
(
index
);
...
...
@@ -359,8 +439,9 @@ export default class UserDashboard extends Component {
<
/Text
>
<
/TouchableOpacity
>
<
/View
>
<
View
>
<
View
style
=
{{
flexDirection
:
'
row
'
}}
>
<
TouchableOpacity
style
=
{{
marginTop
:
20
,
marginLeft
:
18
}}
onPress
=
{()
=>
{
this
.
AdminChat
()
}}
>
<
Text
style
=
{{
color
:
'
white
'
}}
>
{
this
.
state
.
dataSource2
.
length
}
<
/Text
>
<
Image
style
=
{{
width
:
25
,
height
:
25
,
color
:
'
white
'
}}
source
=
{
require
(
'
../Images/chat.png
'
)}
/
>
<
/TouchableOpacity
>
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help