Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nisum-scorecard
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Venkaiah Naidu Singamchetty
nisum-scorecard
Commits
748b9923
Commit
748b9923
authored
Apr 03, 2024
by
Ramadevi Guduri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
admin profile
parent
32c2f310
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
119 additions
and
85 deletions
+119
-85
index.jsx
src/pages/adminProfile/index.jsx
+2
-4
tabs.jsx
src/pages/adminProfile/tabs.jsx
+102
-60
index.jsx
src/pages/dashboard/index.jsx
+1
-1
index.jsx
src/pages/home/index.jsx
+4
-4
index.jsx
src/pages/viewReportee/index.jsx
+2
-9
profileSlice.js
src/redux/reducers/profileSlice.js
+6
-7
clearStore.js
src/utils/clearStore.js
+2
-0
No files found.
src/pages/adminProfile/index.jsx
View file @
748b9923
...
@@ -6,9 +6,7 @@ import Tabs from "./tabs";
...
@@ -6,9 +6,7 @@ import Tabs from "./tabs";
const
AdminProfile
=
()
=>
{
const
AdminProfile
=
()
=>
{
const
dispatch
=
useDispatch
();
const
dispatch
=
useDispatch
();
const
{
user
,
loading
,
error
}
=
useSelector
((
state
)
=>
state
.
userDetails
);
// Get user data from Redux store
const
{
user
,
error
,
loading
}
=
useSelector
((
state
)
=>
state
.
userDetails
);
// Get user data from Redux store
if
(
loading
)
return
<
div
>
Loading...
</
div
>;
if
(
loading
)
return
<
div
>
Loading...
</
div
>;
if
(
error
)
return
<
div
>
Error:
{
error
}
</
div
>;
if
(
error
)
return
<
div
>
Error:
{
error
}
</
div
>;
...
...
src/pages/adminProfile/tabs.jsx
View file @
748b9923
import
React
,
{
useState
}
from
"react"
;
import
React
,
{
use
Effect
,
use
State
}
from
"react"
;
import
{
useSelector
,
useDispatch
}
from
"react-redux"
;
import
{
useSelector
,
useDispatch
}
from
"react-redux"
;
import
{
fetchReporteeActivities
}
from
'../../redux/reducers/viewreporteeSlice'
import
{
fetchProfileReporteeActivities
}
from
"../../redux/reducers/profileSlice"
;
import
Accordion
from
"../../components/accordion
"
;
import
Table
from
"../../components/table/index
"
;
import
profileSlice
from
"../../redux/reducers/profileSlice
"
;
import
{
convertUTCToLocal
}
from
"../../utils/commonFunctions
"
;
import
Loading
from
"../../components/loading Component/Loading"
;
const
Tabs
=
()
=>
{
const
Tabs
=
()
=>
{
const
[
index
,
setIndex
]
=
useState
(
0
);
const
[
index
,
setIndex
]
=
useState
(
0
);
const
dispatch
=
useDispatch
();
const
dispatch
=
useDispatch
();
const
{
reports
,
loading
,
error
,
dutiesReports
,
initiativeReports
}
=
useSelector
((
state
)
=>
state
.
reports
);
const
{
reports
,
loading
,
error
,
dutiesReports
,
initiativeReports
}
=
const
{
reportees
,
viewReportee
,
currPage
,
reporteeId
}
=
useSelector
((
state
)
=>
state
.
reportees
);
useSelector
((
state
)
=>
state
.
reports
);
const
{
user
}
=
useSelector
((
state
)
=>
state
.
userDetails
);
// console.log(dutiesReports);
// console.log(initiativeReports);
const
fetchActivities
=
(
type
)
=>
{
const
fetchActivities
=
(
type
)
=>
{
const
data
=
{
const
data
=
{
empId
:
viewReportee
?.
empId
,
empId
:
user
?.
empId
,
types
:[
type
],
types
:
[
type
],
page
:
1
,
page
:
1
,
perPage
:
5
perPage
:
5
,
}
};
dispatch
(
fetchReporteeActivities
(
data
))
console
.
log
(
data
);
}
dispatch
(
fetchProfileReporteeActivities
(
data
));
};
console
.
log
(
fetchActivities
)
useEffect
(()
=>
{
fetchActivities
(
"duties"
);
},
[]);
const
headers
=
[
{
title
:
"Activity Name"
,
id
:
"aName"
},
{
title
:
"Date"
,
id
:
"recorded_date"
,
render
:
(
value
)
=>
convertUTCToLocal
(
value
),
},
{
title
:
"Rated By"
,
id
:
"ratedBy"
},
{
title
:
"Score"
,
id
:
"score"
,
render
:
(
value
)
=>
(
<
div
className=
"w-[35px] px-3 bg-blue-400 rounded-full text-white font-bold text-center p-[4px]"
>
{
value
}
</
div
>
),
},
{
title
:
"Comments"
,
id
:
"comments"
,
render
:
(
value
)
=>
(
<
span
className=
"listData"
title=
{
value
}
>
{
value
}
</
span
>
),
},
];
return
(
return
(
<>
<>
<
div
className=
"text-sm font-medium text-center text-gray-500 border-b border-gray-200 dark:text-gray-400 "
>
<
div
className=
"text-sm font-medium text-center text-gray-500 border-b border-gray-200 dark:text-gray-400 "
>
<
ul
className=
"flex flex-wrap -mb-px"
>
<
ul
className=
"flex flex-wrap -mb-px"
>
<
li
className=
"me-2"
onClick=
{
()
=>
{}
}
>
<
li
className=
"me-2"
onClick=
{
()
=>
{}
}
>
<
button
<
button
onClick=
{
()
=>
{
setIndex
(
0
);
fetchActivities
(
'duties'
)}
}
className=
"inline-block p-4 text-blue-600 border-b-2 border-blue-600 dark:text-blue-500 "
>
Duties
</
button
>
onClick=
{
()
=>
{
setIndex
(
0
);
fetchActivities
(
"duties"
);
}
}
className=
"inline-block p-4 text-blue-600 border-b-2 border-blue-600 dark:text-blue-500 "
>
Duties
</
button
>
</
li
>
</
li
>
<
li
className=
"me-2"
>
<
li
className=
"me-2"
>
<
button
onClick=
{
()
=>
{
setIndex
(
index
+
1
);
fetchActivities
(
'initiative'
)}
}
className=
"inline-block p-4 border-b-2 border-transparent hover:text-gray-600 hover:border-gray-300 "
>
Initiatives
</
button
>
<
button
onClick=
{
()
=>
{
setIndex
(
index
+
1
);
fetchActivities
(
"initiative"
);
}
}
className=
"inline-block p-4 border-b-2 border-transparent hover:text-gray-600 hover:border-gray-300 "
>
Initiatives
</
button
>
</
li
>
</
li
>
</
ul
>
</
ul
>
{
index
===
0
?
<
div
>
{
/* <Accordion data={dutiesReports} /> */
}
Duties
</
div
>
:
<
div
>
<
p
>
Intiatives
</
p
>
</
div
>
}
</
div
>
</
div
>
<
div
className=
""
>
{
index
===
0
?
(
<
div
>
<
Table
headers=
{
headers
}
loading=
{
loading
}
data=
{
dutiesReports
}
/>
</
div
>
)
:
(
<
div
>
<
Table
headers=
{
headers
}
loading=
{
loading
}
data=
{
initiativeReports
}
/>
</
div
>
)
}
</
div
>
</>
</>
)
);
};
}
export
default
Tabs
;
export
default
Tabs
;
src/pages/dashboard/index.jsx
View file @
748b9923
...
@@ -63,7 +63,7 @@ function Dashboard() {
...
@@ -63,7 +63,7 @@ function Dashboard() {
},
[
userDetails
]);
},
[
userDetails
]);
useEffect
(()
=>
{
useEffect
(()
=>
{
debugger
if
(
inputValue
!==
null
){
if
(
inputValue
!==
null
){
const
debounceTimeout
=
setTimeout
(()
=>
{
const
debounceTimeout
=
setTimeout
(()
=>
{
const
data
=
{
const
data
=
{
...
...
src/pages/home/index.jsx
View file @
748b9923
...
@@ -6,7 +6,7 @@ import { loginUser } from "../../redux/reducers/userSlice";
...
@@ -6,7 +6,7 @@ import { loginUser } from "../../redux/reducers/userSlice";
import
{
useDispatch
,
useSelector
}
from
'react-redux'
import
{
useDispatch
,
useSelector
}
from
'react-redux'
function
Home
()
{
function
Home
()
{
debugger
const
inputRef
=
useRef
(
null
);
const
inputRef
=
useRef
(
null
);
const
navigate
=
useNavigate
();
const
navigate
=
useNavigate
();
const
dispatch
=
useDispatch
()
const
dispatch
=
useDispatch
()
...
@@ -17,7 +17,7 @@ function Home() {
...
@@ -17,7 +17,7 @@ function Home() {
const
handleSubmit
=
async
(
e
)
=>
{
const
handleSubmit
=
async
(
e
)
=>
{
debugger
e
.
preventDefault
();
e
.
preventDefault
();
setLoading
(
true
)
setLoading
(
true
)
if
(
id
!==
null
){
if
(
id
!==
null
){
...
@@ -37,12 +37,12 @@ function Home() {
...
@@ -37,12 +37,12 @@ function Home() {
};
};
useEffect
(()
=>
{
useEffect
(()
=>
{
debugger
setLoading
(
false
)
setLoading
(
false
)
inputRef
.
current
.
focus
();
inputRef
.
current
.
focus
();
},[])
},[])
useEffect
(()
=>
{
useEffect
(()
=>
{
debugger
if
(
userDetails
?.
user
!=
null
)
if
(
userDetails
?.
user
!=
null
)
navigate
(
"/dashboard"
)
navigate
(
"/dashboard"
)
else
else
...
...
src/pages/viewReportee/index.jsx
View file @
748b9923
...
@@ -9,7 +9,7 @@ import {scoreColor} from '../../utils/commonFunctions';
...
@@ -9,7 +9,7 @@ import {scoreColor} from '../../utils/commonFunctions';
function
Viewreportee
()
{
function
Viewreportee
()
{
debugger
const
dispatch
=
useDispatch
();
const
dispatch
=
useDispatch
();
const
navigate
=
useNavigate
();
const
navigate
=
useNavigate
();
const
{
reportees
,
viewReportee
,
currPage
,
reporteeId
}
=
useSelector
((
state
)
=>
state
.
reportees
);
const
{
reportees
,
viewReportee
,
currPage
,
reporteeId
}
=
useSelector
((
state
)
=>
state
.
reportees
);
...
@@ -101,14 +101,7 @@ function Viewreportee() {
...
@@ -101,14 +101,7 @@ function Viewreportee() {
<
div
className=
"p-4"
>
<
div
className=
"p-4"
>
<
div
className=
"bg-white p-3 rounded-md"
>
<
div
className=
"bg-white p-3 rounded-md"
>
<
div
className=
"flex justify-between"
>
<
div
className=
"flex justify-between"
>
{
/* <div className="my-1">
<p>
<span className="font-medium">Employee Name: </span> {viewReportee?.empName}
</p>
<p>
<span className="font-medium">Designation: </span> {viewReportee?.designation}
</p>
</div> */
}
<
div
className=
"flex items-center"
>
<
div
className=
"flex items-center"
>
<
div
>
<
div
>
<
p
className=
"font-medium mb-2"
>
<
p
className=
"font-medium mb-2"
>
...
...
src/redux/reducers/profileSlice.js
View file @
748b9923
...
@@ -2,10 +2,9 @@ import { createSlice, createAsyncThunk } from "@reduxjs/toolkit";
...
@@ -2,10 +2,9 @@ import { createSlice, createAsyncThunk } from "@reduxjs/toolkit";
import
axiosApi
from
'../../api/axiosConfig'
import
axiosApi
from
'../../api/axiosConfig'
const
initialState
=
{
const
initialState
=
{
reports
:
null
,
reports
:
null
,
dutiesReports
:
null
,
dutiesReports
:
null
,
initiativeReports
:
null
,
initiativeReports
:
null
,
loading
:
false
,
loading
:
false
,
error
:
null
,
error
:
null
,
};
};
...
@@ -18,11 +17,11 @@ export const fetchProfileReporteeActivities = createAsyncThunk("getReports", asy
...
@@ -18,11 +17,11 @@ export const fetchProfileReporteeActivities = createAsyncThunk("getReports", asy
const
report
Slice
=
createSlice
({
const
profile
Slice
=
createSlice
({
name
:
"reportees"
,
name
:
"reportees"
,
initialState
,
initialState
,
reducers
:
{
reducers
:
{
reset
Report
s
:()
=>
{
reset
Activitie
s
:()
=>
{
return
initialState
return
initialState
},
},
},
},
...
@@ -42,6 +41,6 @@ const reportSlice = createSlice({
...
@@ -42,6 +41,6 @@ const reportSlice = createSlice({
},
},
});
});
export
const
{
reset
Reports
}
=
report
Slice
.
actions
;
export
const
{
reset
Activities
}
=
profile
Slice
.
actions
;
export
default
report
Slice
.
reducer
;
export
default
profile
Slice
.
reducer
;
src/utils/clearStore.js
View file @
748b9923
...
@@ -2,11 +2,13 @@ import {resetUser} from '../redux/reducers/userSlice';
...
@@ -2,11 +2,13 @@ import {resetUser} from '../redux/reducers/userSlice';
import
{
resetReportees
}
from
'../redux/reducers/reporteesSlice'
;
import
{
resetReportees
}
from
'../redux/reducers/reporteesSlice'
;
import
{
resetReports
}
from
'../redux/reducers/viewreporteeSlice'
;
import
{
resetReports
}
from
'../redux/reducers/viewreporteeSlice'
;
import
{
resetReporteesTableData
}
from
'../redux/reducers/exporttableslice'
;
import
{
resetReporteesTableData
}
from
'../redux/reducers/exporttableslice'
;
import
{
resetActivities
}
from
'../redux/reducers/profileSlice'
;
const
clearStore
=
(
dispatch
)
=>
{
const
clearStore
=
(
dispatch
)
=>
{
dispatch
(
resetUser
());
dispatch
(
resetUser
());
dispatch
(
resetReportees
());
dispatch
(
resetReportees
());
dispatch
(
resetReports
())
dispatch
(
resetReports
())
dispatch
(
resetReporteesTableData
())
dispatch
(
resetReporteesTableData
())
dispatch
(
resetActivities
())
};
};
export
default
clearStore
;
export
default
clearStore
;
\ No newline at end of file
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