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
c56f7716
Commit
c56f7716
authored
3 years ago
by
tejaswi
Browse files
Options
Download
Email Patches
Plain Diff
Project Adding
parent
cd0855bc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/UserComponents/UserDashboard.js
+266
-35
src/UserComponents/UserDashboard.js
src/UserComponents/UserManageProjects1.js
+97
-96
src/UserComponents/UserManageProjects1.js
with
363 additions
and
131 deletions
+363
-131
src/UserComponents/UserDashboard.js
View file @
c56f7716
...
@@ -22,10 +22,11 @@ import { API } from "../WebServices/RestClient";
...
@@ -22,10 +22,11 @@ import { API } from "../WebServices/RestClient";
import
NetInfo
from
'
@react-native-community/netinfo
'
;
import
NetInfo
from
'
@react-native-community/netinfo
'
;
import
Snackbar
from
'
react-native-snackbar
'
;
import
Snackbar
from
'
react-native-snackbar
'
;
import
log
from
'
../LogFile/Log
'
;
import
log
from
'
../LogFile/Log
'
;
import
ProffileOfflin
e
from
'
../OfflineDB/
Profile
'
;
import
UserDatabas
e
from
"
../OfflineDB/
UserDatabase
"
;
const
db
=
new
ProffileOfflin
e
();
const
db
=
new
UserDatabas
e
();
import
Main
from
'
../Maintenance/Main
'
;
import
Main
from
'
../Maintenance/Main
'
;
import
jwt_decode
from
"
jwt-decode
"
;
import
jwt_decode
from
"
jwt-decode
"
;
import
Modal
from
"
react-native-simple-modal
"
;
import
ModalSelector
from
'
react-native-modal-selector
'
;
import
ModalSelector
from
'
react-native-modal-selector
'
;
// const check = new Main()
// const check = new Main()
import
{
import
{
...
@@ -53,6 +54,7 @@ export default class UserDashboard extends Component {
...
@@ -53,6 +54,7 @@ export default class UserDashboard extends Component {
sprintName
:
'
Select User
'
,
sprintName
:
'
Select User
'
,
epicName
:
'
Select Epic
'
,
epicName
:
'
Select Epic
'
,
abc
:
[],
abc
:
[],
squadName
:
''
,
}
}
...
@@ -62,6 +64,62 @@ export default class UserDashboard extends Component {
...
@@ -62,6 +64,62 @@ export default class UserDashboard extends Component {
// });
// });
}
}
moveUp
=
()
=>
this
.
setState
({
offset
:
-
110
});
resetPosition
=
()
=>
this
.
setState
({
offset
:
0
});
openModal
=
()
=>
this
.
setState
({
open
:
true
});
closeModal
=
()
=>
{
//this.props.navigation.goBack();
this
.
setState
({
open
:
false
,
// ProjectTitle: '',
// ProjectDescription: '',
error1
:
''
,
error2
:
''
,
error3
:
''
,
group_name
:
''
,
});
}
//this methos is used to ask the user about confirm about
logOutOption
()
{
Alert
.
alert
(
'
Alert
'
,
'
Do you want to Logout
'
,
[
{
text
:
'
Cancel
'
,
onPress
:
()
=>
console
.
log
(
'
Cancel Pressed
'
),
style
:
'
cancel
'
,
},
{
text
:
'
OK
'
,
onPress
:
()
=>
this
.
logOut
()
},
],
{
cancelable
:
false
},
);
}
//this method is used for logout the application and also clear the asyncstorage .
logOut
()
{
AsyncStorage
.
clear
();
db
.
deleteUser
();
console
.
warn
(
"
result
"
);
this
.
props
.
navigation
.
navigate
(
'
Auth
'
);
}
navigateToScreen
=
(
route
)
=>
(
()
=>
{
const
navigateAction
=
NavigationActions
.
navigate
({
routeName
:
route
});
this
.
props
.
navigation
.
dispatch
(
navigateAction
);
// this.props.navigation.dispatch(DrawerActions.closeDrawer());
})
componentDidMount
()
{
componentDidMount
()
{
...
@@ -134,18 +192,117 @@ export default class UserDashboard extends Component {
...
@@ -134,18 +192,117 @@ export default class UserDashboard extends Component {
}
}
dashboard
(
projects
,
index
){
console
.
log
(
projects
);
isValid
()
{
console
.
log
(
index
);
const
{
squadName
}
=
this
.
state
;
// alert(projects.value)
log
(
"
Info
"
,
"
ReassignStory() method is used to navigate User My Taskscreen
"
);
this
.
props
.
navigation
.
navigate
(
'
MyTask
'
,
let
valid
=
false
;
// this.setState({
// squadName: projects.value
if
(
squadName
.
length
===
0
)
{
// })
this
.
setState
({
error1
:
'
project name should not be empty
'
});
AsyncStorage
.
setItem
(
'
cropcode
'
,
projects
.
value
))
log
(
"
Warn
"
,
"
project name should not be empty
"
);
// { id: projects.id,squadName:projects.value });
// alert("project title should not be empty ");
}
}
else
{
valid
=
true
;
}
return
valid
;
}
//isValid method end
verifyProjectTitle
(
ProjectTitle
)
{
var
reg
=
/^
[^
!-
\\/
:-@
\\
[-`{-~
]
+$/
;
return
reg
.
test
(
ProjectTitle
);
}
//to add the new project from user
addGroup
=
()
=>
{
log
(
"
Info
"
,
"
addGroup() method is used to add new project 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
,
});
}
else
{
const
{
squadName
,
}
=
this
.
state
;
if
(
this
.
isValid
())
{
// alert(group_name)
// alert(this.state.selectedItems)
this
.
setState
({
itemPressedDisabled
:
true
})
AsyncStorage
.
multiGet
([
"
userToken
"
,
"
userName
"
,
"
fullName
"
],
(
err
,
response
)
=>
{
const
empId
=
response
[
0
][
1
];
const
userName
=
response
[
1
][
1
];
// console.warn("userToken" + userToken)
const
fullName
=
response
[
2
][
1
];
fetch
(
API
+
'
squads.php
'
,
{
method
:
'
POST
'
,
headers
:
{
'
Accept
'
:
'
application/json
'
,
'
Content-Type
'
:
'
application/json
'
,
},
body
:
JSON
.
stringify
({
squadName
:
squadName
,
username
:
userName
,
//Async
action
:
"
new_squad
"
,
empId
:
empId
})
}).
then
((
response
)
=>
response
.
json
())
.
then
((
responseJson
)
=>
{
console
.
log
(
JSON
.
stringify
(
responseJson
));
console
.
log
(
responseJson
);
// alert(JSON.stringify(responseJson))
if
(
responseJson
.
status
===
'
True
'
)
{
alert
(
responseJson
.
message
)
this
.
GetStatus
()
this
.
refs
.
toast
.
showBottom
(
'
Project Created Succesfully
'
);
this
.
setState
({
itemPressedDisabled
:
false
})
console
.
log
(
"
done
"
)
this
.
setState
({
open
:
false
,
squadName
:
''
,
})
}
}).
catch
((
error
)
=>
{
console
.
error
(
error
);
log
(
"
Error
"
,
"
error in project adding
"
);
});
});
this
.
closeModal
();
}
}
});
};
dashboard
(
projects
,
index
)
{
console
.
log
(
projects
);
console
.
log
(
index
);
// alert(projects.value)
log
(
"
Info
"
,
"
ReassignStory() method is used to navigate User My Taskscreen
"
);
this
.
props
.
navigation
.
navigate
(
'
MyTask
'
,
// this.setState({
// squadName: projects.value
// })
AsyncStorage
.
setItem
(
'
cropcode
'
,
projects
.
value
))
// { id: projects.id,squadName:projects.value });
}
render
()
{
render
()
{
...
@@ -162,8 +319,31 @@ dashboard(projects,index){
...
@@ -162,8 +319,31 @@ dashboard(projects,index){
var
height
=
Dimensions
.
get
(
'
window
'
).
height
;
//full height
var
height
=
Dimensions
.
get
(
'
window
'
).
height
;
//full height
return
(
return
(
<
Container
style
=
{{
width
:
width
}}
>
<
Container
style
=
{{
width
:
width
}}
>
{
/*
<
Header
androidStatusBarColor
=
"
#00A2C1
"
style
=
{{
backgroundColor
:
'
#00A2C1
'
,
height
:
60
,
width
:
Dimensions
.
get
(
'
window
'
).
width
,
borderBottomColor
:
'
#ffffff
'
,
justifyContent
:
'
space-between
'
,
}}
>
<
View
style
=
{{
marginTop
:
20
}}
>
<
TouchableOpacity
onPress
=
{
this
.
openModal
}
>
<
Text
style
=
{{
width
:
300
,
borderRadius
:
20
,
height
:
45
,
flexDirection
:
'
row
'
,
color
:
'
white
'
}}
>
Add
Project
<
/Text
>
<
/TouchableOpacity
>
<
/View
>
<
View
style
=
{{
marginTop
:
20
}}
>
<
TouchableOpacity
onPress
=
{
this
.
logOutOption
.
bind
(
this
)}
>
<
Text
style
=
{{
width
:
300
,
borderRadius
:
20
,
height
:
45
,
flexDirection
:
'
row
'
,
color
:
'
white
'
}}
>
Logout
<
/Text
>
<
/TouchableOpacity
>
<
/View
>
<
/Header
>
{
/*
<Header
<Header
androidStatusBarColor="#00A2C1"
androidStatusBarColor="#00A2C1"
style={{
style={{
...
@@ -187,40 +367,78 @@ dashboard(projects,index){
...
@@ -187,40 +367,78 @@ dashboard(projects,index){
</View>
</View>
</Header> */
}
</Header> */
}
<
Content
style
=
{{
width
:
width
}}
>
<
Content
style
=
{{
width
:
width
}}
>
<
View
style
=
{{
width
:
width
}}
>
<
View
style
=
{{
width
:
width
}}
>
{
this
.
state
.
abc
.
map
((
projects
,
index
)
=>
(
<
DataTable
>
<
DataTable
.
Row
style
=
{{
margin
:
1
,
width
:
width
}}
key
=
{
index
}
>
<
TouchableOpacity
style
=
{{
width
:
width
,}}
onPress
=
{()
=>
this
.
dashboard
(
projects
,
index
)}
// 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
>
<
/TouchableOpacity
>
<
/DataTable.Row
>
{
this
.
state
.
abc
.
map
((
projects
,
index
)
=>
(
<
DataTable
>
<
DataTable
.
Row
style
=
{{
margin
:
1
,
width
:
width
}}
key
=
{
index
}
>
<
TouchableOpacity
style
=
{{
width
:
width
,
}}
onPress
=
{()
=>
this
.
dashboard
(
projects
,
index
)}
// 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
>
<
/TouchableOpacity
>
<
/DataTable
>
<
/DataTable.Row
>
)
)}
<
/View
>
<
/DataTable
>
)
)}
<
/View
>
<
/Content
>
<
/Content
>
<
Modal
// offset={this.state.offset}
open
=
{
this
.
state
.
open
}
closeOnTouchOutside
=
{
false
}
modalDidOpen
=
{
this
.
modalDidOpen
}
modalDidClose
=
{
this
.
modalDidClose
}
style
=
{{
alignItems
:
"
center
"
}}
// disableOnBackPress={false}
>
<
View
style
=
{{
alignItems
:
"
center
"
,
}}
>
<
Text
>
Project
Name
<
/Text
>
<
TextInput
placeholder
=
'
Project Name
'
style
=
{{
height
:
40
,
borderBottomWidth
:
1
,
borderBottomColor
:
'
black
'
,
width
:
300
,
marginTop
:
10
}}
maxLength
=
{
50
}
onChangeText
=
{(
text
)
=>
this
.
setState
({
squadName
:
text
})}
value
=
{
this
.
state
.
squadName
}
/
>
<
Text
style
=
{{
color
:
'
red
'
,
alignItems
:
'
flex-start
'
,
alignSelf
:
'
flex-start
'
,
justifyContent
:
'
flex-start
'
,
marginLeft
:
25
}}
>
{
this
.
state
.
error1
}
<
/Text
>
<
Text
style
=
{{
color
:
'
red
'
,
alignItems
:
'
flex-start
'
,
alignSelf
:
'
flex-start
'
,
justifyContent
:
'
flex-start
'
,
marginLeft
:
25
}}
>
{
this
.
state
.
error3
}
<
/Text
>
<
/View
>
<
View
style
=
{{
flexDirection
:
'
row
'
,
marginBottom
:
20
,
alignItems
:
'
center
'
,
justifyContent
:
'
center
'
,
alignSelf
:
'
center
'
,
}}
>
<
TouchableOpacity
style
=
{
styles
.
opensave
}
onPress
=
{
this
.
addGroup
}
disabled
=
{
this
.
state
.
itemPressedDisabled
}
>
<
Text
style
=
{{
color
:
'
white
'
}}
>
SAVE
<
/Text
>
<
/TouchableOpacity
>
<
TouchableOpacity
style
=
{
styles
.
opencancel
}
onPress
=
{
this
.
closeModal
}
>
<
Text
style
=
{{
color
:
'
black
'
}}
>
CANCEL
<
/Text
>
<
/TouchableOpacity
>
<
/View
>
<
/Modal
>
<
/Container
>
<
/Container
>
// </KeyboardAvoidingView >
// </KeyboardAvoidingView >
);
);
...
@@ -355,6 +573,19 @@ const styles = StyleSheet.create({
...
@@ -355,6 +573,19 @@ const styles = StyleSheet.create({
marginBottom
:
10
,
marginBottom
:
10
,
},
opencancel
:
{
flex
:
1
,
...
Platform
.
select
({
ios
:
{
backgroundColor
:
'
red
'
,
margin
:
20
,
height
:
30
,
alignItems
:
"
center
"
,
justifyContent
:
'
center
'
},
android
:
{
backgroundColor
:
'
red
'
,
margin
:
20
,
height
:
30
,
alignItems
:
"
center
"
,
justifyContent
:
'
center
'
},
}),
},
},
opensave
:
{
opensave
:
{
// flex: 1,
// flex: 1,
...
...
This diff is collapsed.
Click to expand it.
src/UserComponents/UserManageProjects1.js
View file @
c56f7716
...
@@ -125,101 +125,6 @@ class ListItem extends React.Component {
...
@@ -125,101 +125,6 @@ class ListItem extends React.Component {
});
});
}
}
// delete Employee start
deleteAction
(
idea_id
)
{
// alert("delete"+item)
// alert(email+""+empid)
log
(
"
Info
"
,
"
UserManageProjects1:deleteAction(idea_id) method is used to give alert
"
);
Alert
.
alert
(
'
Alert..!
'
,
'
Do you want to delete Epic
'
,
[
{
text
:
'
Cancel
'
,
onPress
:
()
=>
console
.
log
(
'
Cancel Pressed
'
),
style
:
'
cancel
'
,
},
{
text
:
'
OK
'
,
onPress
:
()
=>
this
.
deleteProject
(
idea_id
)
},
],
{
cancelable
:
false
},
);
}
//delete Employee end
//delete the Project
deleteProject
(
idea_id
)
{
//alert("Helllo");
// alert(email)
log
(
"
Info
"
,
"
deleteProject() method is used to delete project
"
);
AsyncStorage
.
multiGet
([
"
cropcode
"
,
"
userToken
"
,
"
emp_role
"
],
(
err
,
response
)
=>
{
const
cropcode
=
response
[
0
][
1
];
const
userToken
=
response
[
1
][
1
];
console
.
warn
(
"
userToken
"
+
userToken
)
const
role
=
response
[
2
][
1
];
AsyncStorage
.
getItem
(
"
projectId
"
,
(
err
,
res
)
=>
{
const
projectId
=
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
,
});
}
else
{
// console.warn(item)
// alert(this.state.email)
fetch
(
API
+
'
manage_epics.php
'
,
{
method
:
'
POST
'
,
headers
:
{
'
Accept
'
:
'
application/json
'
,
'
Content-Type
'
:
'
application/json
'
,
},
body
:
JSON
.
stringify
({
empId
:
userToken
,
corp
:
cropcode
,
action
:
'
delete
'
,
idea_id
:
idea_id
,
projectId
:
projectId
,
// username:email,
})
}).
then
((
response
)
=>
response
.
json
())
.
then
((
responseJson
)
=>
{
console
.
log
(
JSON
.
stringify
(
responseJson
));
console
.
log
(
responseJson
);
alert
(
JSON
.
stringify
(
responseJson
));
if
(
responseJson
.
status
===
'
True
'
)
{
// this.refs.toast.showCenter('Epic Squad is Deactivated', Toast.Duration.long, Toast.Position.center);
console
.
log
(
"
done
"
)
// this.deactiveEmployee(email);
alert
(
responseJson
.
message
);
//alert("Employee is Deleted");
//this.refs.toast.showBottom('Employee is Deleted');
this
.
setState
({
open
:
false
})
// this.props.navigation.navigate('Aproved');
// this.UserManageEmployees();
}
else
{
alert
(
responseJson
.
message
);
// this.refs.toast.showCenter('Epic Squad is not Deactivated', Toast.Duration.long, Toast.Position.center);
}
}).
catch
((
error
)
=>
{
console
.
error
(
error
);
//alert("Hello");
log
(
"
Error
"
,
"
error in employee deletion
"
);
});
}
});
});
});
};
//Delete Employee end
render
()
{
render
()
{
// const { item } = this.props;
// const { item } = this.props;
const
{
item
}
=
this
.
props
;
const
{
item
}
=
this
.
props
;
...
@@ -261,7 +166,7 @@ class ListItem extends React.Component {
...
@@ -261,7 +166,7 @@ class ListItem extends React.Component {
// button6 = null;
// button6 = null;
button6
=
button6
=
<
TouchableOpacity
onPress
=
{()
=>
this
.
deleteAction
(
item
.
idea_id
)}
>
<
TouchableOpacity
onPress
=
{()
=>
this
.
props
.
deleteAction
()}
>
<
Icon
name
=
"
trash-o
"
style
=
{{
color
:
'
red
'
,
marginRight
:
20
,
marginTop
:
12
}}
size
=
{
18
}
/
>
<
Icon
name
=
"
trash-o
"
style
=
{{
color
:
'
red
'
,
marginRight
:
20
,
marginTop
:
12
}}
size
=
{
18
}
/
>
<
/TouchableOpacity
>
<
/TouchableOpacity
>
}
}
...
@@ -635,6 +540,102 @@ export default class UserManageProjects1 extends Component {
...
@@ -635,6 +540,102 @@ export default class UserManageProjects1 extends Component {
// delete Employee start
deleteAction
(
item
,
index
)
{
// alert("delete"+item)
// alert(email+""+empid)
log
(
"
Info
"
,
"
UserManageProjects1:deleteAction(idea_id) method is used to give alert
"
);
Alert
.
alert
(
'
Alert..!
'
,
'
Do you want to delete Epic
'
,
[
{
text
:
'
Cancel
'
,
onPress
:
()
=>
console
.
log
(
'
Cancel Pressed
'
),
style
:
'
cancel
'
,
},
{
text
:
'
OK
'
,
onPress
:
()
=>
this
.
deleteProject
(
item
,
index
)
},
],
{
cancelable
:
false
},
);
}
//delete Employee end
//delete the Project
deleteProject
(
item
,
index
)
{
//alert("Helllo");
// alert(email)
log
(
"
Info
"
,
"
deleteProject() method is used to delete project
"
);
AsyncStorage
.
multiGet
([
"
cropcode
"
,
"
userToken
"
,
"
emp_role
"
],
(
err
,
response
)
=>
{
const
cropcode
=
response
[
0
][
1
];
const
userToken
=
response
[
1
][
1
];
console
.
warn
(
"
userToken
"
+
userToken
)
const
role
=
response
[
2
][
1
];
AsyncStorage
.
getItem
(
"
projectId
"
,
(
err
,
res
)
=>
{
const
projectId
=
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
,
});
}
else
{
// console.warn(item)
// alert(this.state.email)
fetch
(
API
+
'
manage_epics.php
'
,
{
method
:
'
POST
'
,
headers
:
{
'
Accept
'
:
'
application/json
'
,
'
Content-Type
'
:
'
application/json
'
,
},
body
:
JSON
.
stringify
({
empId
:
userToken
,
corp
:
cropcode
,
action
:
'
delete
'
,
idea_id
:
item
.
idea_id
,
projectId
:
projectId
,
// username:email,
})
}).
then
((
response
)
=>
response
.
json
())
.
then
((
responseJson
)
=>
{
console
.
log
(
JSON
.
stringify
(
responseJson
));
console
.
log
(
responseJson
);
// alert(JSON.stringify(responseJson));
if
(
responseJson
.
status
===
'
True
'
)
{
// this.refs.toast.showCenter('Epic Squad is Deactivated', Toast.Duration.long, Toast.Position.center);
console
.
log
(
"
done
"
)
// this.deactiveEmployee(email);
alert
(
responseJson
.
message
);
//alert("Employee is Deleted");
//this.refs.toast.showBottom('Employee is Deleted');
this
.
userApprovedProjects
();
this
.
setState
({
open
:
false
})
// this.props.navigation.navigate('Aproved');
// this.UserManageEmployees();
}
else
{
alert
(
responseJson
.
message
);
// this.refs.toast.showCenter('Epic Squad is not Deactivated', Toast.Duration.long, Toast.Position.center);
}
}).
catch
((
error
)
=>
{
console
.
error
(
error
);
//alert("Hello");
log
(
"
Error
"
,
"
error in employee deletion
"
);
});
}
});
});
});
};
//Delete Employee end
//For Approved Projects from offline
//For Approved Projects from offline
getApprovedProjectsListOffline
()
{
getApprovedProjectsListOffline
()
{
...
...
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