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
d3282f1f
Commit
d3282f1f
authored
Mar 20, 2024
by
Shiva Komirishetti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
routing changes
parent
bf04a87a
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
72 additions
and
56 deletions
+72
-56
App.js
src/App.js
+2
-2
index.jsx
src/components/leftSidebar/index.jsx
+13
-12
index.jsx
src/components/table/index.jsx
+1
-1
index.jsx
src/pages/dashboard/index.jsx
+4
-4
index.jsx
src/pages/home/index.jsx
+0
-1
index.jsx
src/pages/viewReportee/index.jsx
+36
-35
reporteesSlice.js
src/redux/reducers/reporteesSlice.js
+16
-1
No files found.
src/App.js
View file @
d3282f1f
...
@@ -2,7 +2,7 @@ import {BrowserRouter, Routes, Route} from 'react-router-dom';
...
@@ -2,7 +2,7 @@ import {BrowserRouter, Routes, Route} from 'react-router-dom';
import
Home
from
"./pages/home"
;
import
Home
from
"./pages/home"
;
import
Dashboard
from
'./pages/dashboard'
;
import
Dashboard
from
'./pages/dashboard'
;
import
Layout
from
'./pages/layout'
;
import
Layout
from
'./pages/layout'
;
import
Reports
from
'./pages/reports
'
;
import
Viewreportee
from
'./pages/viewReportee
'
;
import
'./App.css'
;
import
'./App.css'
;
import
PageNotFound
from
'./pages/pagenotfound/PageNotFound'
;
import
PageNotFound
from
'./pages/pagenotfound/PageNotFound'
;
...
@@ -12,7 +12,7 @@ function App() {
...
@@ -12,7 +12,7 @@ function App() {
<
Routes
>
<
Routes
>
<
Route
path
=
'/'
element
=
{
<
Home
/>
}
/
>
<
Route
path
=
'/'
element
=
{
<
Home
/>
}
/
>
<
Route
path
=
"/dashboard"
element
=
{
<
Layout
><
Dashboard
/><
/Layout>}/
>
<
Route
path
=
"/dashboard"
element
=
{
<
Layout
><
Dashboard
/><
/Layout>}/
>
<
Route
path
=
"/viewreportee
/:id"
element
=
{
<
Layout
><
Reports
/><
/Layout>}/
>
<
Route
path
=
"/viewreportee
"
element
=
{
<
Layout
><
Viewreportee
/><
/Layout>}/
>
<
Route
path
=
"/*"
element
=
{
<
PageNotFound
/>
}
/
>
<
Route
path
=
"/*"
element
=
{
<
PageNotFound
/>
}
/
>
<
/Routes
>
<
/Routes
>
<
/BrowserRouter
>
<
/BrowserRouter
>
...
...
src/components/leftSidebar/index.jsx
View file @
d3282f1f
import
React
,
{
useEffect
,
useState
}
from
"react"
;
import
React
,
{
useEffect
,
useState
}
from
"react"
;
import
{
fetchReportees
}
from
"../../redux/reducers/reporteesSlice"
;
import
{
fetchReportees
,
setViewReportee
}
from
"../../redux/reducers/reporteesSlice"
;
import
{
Link
}
from
"react-router-dom"
;
import
{
Link
}
from
"react-router-dom"
;
import
{
useSelector
,
useDispatch
}
from
"react-redux"
;
import
{
useSelector
,
useDispatch
}
from
"react-redux"
;
import
{
useParams
}
from
"react-router-dom"
;
import
{
useParams
}
from
"react-router-dom"
;
...
@@ -10,9 +10,9 @@ function LeftSidebar() {
...
@@ -10,9 +10,9 @@ function LeftSidebar() {
const
dispatch
=
useDispatch
();
const
dispatch
=
useDispatch
();
const
[
currPage
,
setCurrPage
]
=
useState
(
1
);
const
[
currPage
,
setCurrPage
]
=
useState
(
1
);
const
[
inputValue
,
setInputValue
]
=
useState
(
''
);
const
[
inputValue
,
setInputValue
]
=
useState
(
''
);
const
{
reportees
,
loading
}
=
useSelector
((
state
)
=>
state
.
reportees
);
const
{
reportees
,
loading
,
viewReportee
}
=
useSelector
((
state
)
=>
state
.
reportees
);
const
userDetails
=
useSelector
((
state
)
=>
state
.
userDetails
);
const
userDetails
=
useSelector
((
state
)
=>
state
.
userDetails
);
const
{
id
}
=
useParams
();
useEffect
(()
=>
{
useEffect
(()
=>
{
const
debounceTimeout
=
setTimeout
(()
=>
{
const
debounceTimeout
=
setTimeout
(()
=>
{
...
@@ -51,18 +51,19 @@ function LeftSidebar() {
...
@@ -51,18 +51,19 @@ function LeftSidebar() {
(
loading
)
?
<
Loading
/>
:
(
loading
)
?
<
Loading
/>
:
<
div
className=
"p-2 bg-[#E9EDEE] mt-4 max-h-[80vh] overflow-auto"
>
<
div
className=
"p-2 bg-[#E9EDEE] mt-4 max-h-[80vh] overflow-auto"
>
{
reportees
?.
map
(({
empName
,
score
,
empId
})
=>
(
{
reportees
?.
map
(({
empName
,
score
,
empId
})
=>
(
<
Link
<
button
onClick=
{
()
=>
dispatch
(
setViewReportee
(
empId
))
}
to=
{
`/viewreportee/${empId}
`
}
// to=
{`/
viewreportee
`}
className=
{
`flex items-center hover:bg-blue-400 hover:text-white
hover:rounded-2xl bg-${Number(id)
== empId ? "blue-400 text-white rounded-2xl" : "white"
className=
{
`flex items-center hover:bg-blue-400 hover:text-white
bg-${viewReportee.empId
== empId ? "blue-400 text-white rounded-2xl" : "white"
} p-2 justify-between mb-1 w-full`
}
} p-2 justify-between mb-1 w-full`
}
key=
{
empId
}
key=
{
empId
}
>
>
{
/* <img src="/man.png" width="18px" height="18px" /> */
}
<
p
className=
"w-[80%] text-left"
>
{
empName
}
</
p
>
<
p
className=
"w-[80%] text-left"
>
{
empName
}
</
p
>
<
p
className=
{
`w-[30px] h-[30px] rounded-full flex items-center text-white justify-center ${scoreColor(score)}`
}
>
<
p
className=
{
`w-[30px] h-[30px] rounded-full flex items-center text-white justify-center ${scoreColor(score)}`
}
>
{
score
}
{
score
}
</
p
>
</
p
>
</
Link
>
</
button
>
))
}
))
}
</
div
>
</
div
>
}
}
...
...
src/components/table/index.jsx
View file @
d3282f1f
...
@@ -23,7 +23,7 @@ function Table({headers, data,loading, maxHeight}) {
...
@@ -23,7 +23,7 @@ function Table({headers, data,loading, maxHeight}) {
<
tr
key=
{
item
.
id
}
className=
"bg-white hover:bg-gray-300 "
>
<
tr
key=
{
item
.
id
}
className=
"bg-white hover:bg-gray-300 "
>
{
{
headers
?.
map
(({
render
,
id
})
=>
(
headers
?.
map
(({
render
,
id
})
=>
(
<
td
key=
{
`${item.id}_${id}`
}
className=
"px-6 py-2 "
>
<
td
className=
"px-6 py-2 "
>
{
render
?
render
(
item
[
id
])
:
item
[
id
]
===
""
?
"NA"
:
item
[
id
]
}
{
render
?
render
(
item
[
id
])
:
item
[
id
]
===
""
?
"NA"
:
item
[
id
]
}
</
td
>
</
td
>
))
))
...
...
src/pages/dashboard/index.jsx
View file @
d3282f1f
import
React
,
{
useEffect
,
useState
}
from
"react"
;
import
React
,
{
useEffect
,
useState
}
from
"react"
;
import
{
Link
,
useNavigate
}
from
"react-router-dom"
;
import
{
Link
,
useNavigate
}
from
"react-router-dom"
;
import
{
useDispatch
,
useSelector
}
from
"react-redux"
;
import
{
useDispatch
,
useSelector
}
from
"react-redux"
;
import
{
fetchReportees
}
from
"../../redux/reducers/reporteesSlice"
;
import
{
fetchReportees
,
setViewReportee
}
from
"../../redux/reducers/reporteesSlice"
;
import
Table
from
'../../components/table'
;
import
Table
from
'../../components/table'
;
import
RightArrowIcon
from
'../../assets/icons/rightArrowIcon'
;
import
RightArrowIcon
from
'../../assets/icons/rightArrowIcon'
;
import
{
scoreColor
}
from
'../../utils/commonFunctions'
;
import
{
scoreColor
}
from
'../../utils/commonFunctions'
;
...
@@ -107,8 +107,8 @@ function Dashboard() {
...
@@ -107,8 +107,8 @@ function Dashboard() {
{
{
title
:
"Action"
,
title
:
"Action"
,
id
:
"empId"
,
id
:
"empId"
,
render
:
(
value
)
=>
<
Link
to=
{
`/viewreportee
/${value}
`
}
>
render
:
(
value
)
=>
<
Link
to=
{
`/viewreportee`
}
>
<
button
className=
"bg-blue-400 text-white rounded-md px-2 py-1 flex items-center justify-center w-[40px]"
>
<
button
className=
"bg-blue-400 text-white rounded-md px-2 py-1 flex items-center justify-center w-[40px]"
onClick=
{
()
=>
dispatch
(
setViewReportee
(
value
))
}
>
<
RightArrowIcon
/>
<
RightArrowIcon
/>
</
button
>
</
button
>
</
Link
>
</
Link
>
...
@@ -125,7 +125,7 @@ function Dashboard() {
...
@@ -125,7 +125,7 @@ function Dashboard() {
{
reportees
&&
(
{
reportees
&&
(
<
div
className=
"flex justify-center mt-2"
>
<
div
className=
"flex justify-center mt-2"
>
{
/* <div className="text-blue-500">Total Results: {pagesCount}</div> */
}
{
/* <div className="text-blue-500">Total Results: {pagesCount}</div> */
}
{
pagesCount
>
1
&&
(
{
pagesCount
>
=
1
&&
(
<
PaginationComponent
<
PaginationComponent
currentPage=
{
currPage
}
currentPage=
{
currPage
}
totalPages=
{
pagesCount
}
totalPages=
{
pagesCount
}
...
...
src/pages/home/index.jsx
View file @
d3282f1f
...
@@ -22,7 +22,6 @@ function Home() {
...
@@ -22,7 +22,6 @@ function Home() {
.
then
((
res
)
=>
{
.
then
((
res
)
=>
{
setLoading
(
false
)
setLoading
(
false
)
dispatch
(
loginUser
(
res
.
data
.
user
))
dispatch
(
loginUser
(
res
.
data
.
user
))
navigate
(
`/dashboard`
);
})
})
.
catch
((
error
)
=>
{
.
catch
((
error
)
=>
{
setLoading
(
false
)
setLoading
(
false
)
...
...
src/pages/
reports
/index.jsx
→
src/pages/
viewReportee
/index.jsx
View file @
d3282f1f
...
@@ -9,19 +9,20 @@ import Accordion from "../../components/accordion";
...
@@ -9,19 +9,20 @@ import Accordion from "../../components/accordion";
import
{
scoreColor
}
from
'../../utils/commonFunctions'
;
import
{
scoreColor
}
from
'../../utils/commonFunctions'
;
import
DateRangePicker
from
"../../components/dateRangePicker/DateRangePicker"
;
import
DateRangePicker
from
"../../components/dateRangePicker/DateRangePicker"
;
function
Reports
()
{
function
Viewreportee
()
{
const
dispatch
=
useDispatch
();
const
dispatch
=
useDispatch
();
const
navigate
=
useNavigate
();
const
navigate
=
useNavigate
();
const
{
id
}
=
useParams
();
//
const { id } = useParams();
const
empId
=
Number
(
id
)
//
const empId = Number(id)
const
reportees
=
useSelector
((
state
)
=>
state
.
reportees
.
reportees
);
const
{
reportees
,
viewReportee
}
=
useSelector
((
state
)
=>
state
.
reportees
);
const
user
=
useSelector
((
state
)
=>
state
.
userDetails
.
user
)
const
user
=
useSelector
((
state
)
=>
state
.
userDetails
.
user
)
const
[
empDetails
,
setEmpDetails
]
=
useState
(
null
);
//
const [empDetails, setEmpDetails] = useState(null);
const
{
reports
,
loading
,
error
}
=
useSelector
((
state
)
=>
state
.
reports
);
const
{
reports
,
loading
,
error
}
=
useSelector
((
state
)
=>
state
.
reports
);
const
[
open
,
setOpen
]
=
useState
({
"accordianOne"
:
false
,
"accordianTwo"
:
false
});
const
[
open
,
setOpen
]
=
useState
({
"accordianOne"
:
false
,
"accordianTwo"
:
false
});
/*Example post data
/*Example post data
{
{
"empId":41689,
"empId":41689,
...
@@ -34,7 +35,7 @@ function Reports() {
...
@@ -34,7 +35,7 @@ function Reports() {
const
filtered
=
Object
.
groupBy
(
reports
,
({
type
})
=>
type
);
const
filtered
=
Object
.
groupBy
(
reports
,
({
type
})
=>
type
);
return
filtered
;
return
filtered
;
}
}
},
[
reports
,
id
]);
},
[
reports
,
viewReportee
]);
const
handleAccordian
=
(
value
)
=>
{
const
handleAccordian
=
(
value
)
=>
{
switch
(
value
)
{
switch
(
value
)
{
...
@@ -63,9 +64,9 @@ function Reports() {
...
@@ -63,9 +64,9 @@ function Reports() {
}
}
const
handleAddActivity
=
async
(
activityData
)
=>
{
const
handleAddActivity
=
async
(
activityData
)
=>
{
if
(
id
)
{
if
(
viewReportee
)
{
let
newData
=
{
let
newData
=
{
"empId"
:
empId
,
"empId"
:
viewReportee
.
empId
,
"data"
:
activityData
"data"
:
activityData
}
}
await
axios
.
post
(
`
${
base_url
}
/createActivity`
,
newData
)
await
axios
.
post
(
`
${
base_url
}
/createActivity`
,
newData
)
...
@@ -78,31 +79,31 @@ function Reports() {
...
@@ -78,31 +79,31 @@ function Reports() {
}
}
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
id
!==
undefined
||
null
&&
reportees
.
length
>
0
)
{
// if (viewReportee
!== undefined || null && reportees.length > 0) {
const
emp
=
reportees
?.
filter
((
item
)
=>
item
.
empId
===
Number
(
i
d
));
// const emp = reportees?.filter((item) => item.empId === Number(viewReportee.empI
d));
setEmpDetails
(
emp
[
0
]);
//
setEmpDetails(emp[0]);
const
data
=
{
//
const data = {
"empId"
:
Number
(
i
d
),
// "empId": Number(viewReportee.empI
d),
"fromDate"
:
""
,
//
"fromDate": "",
"toDate"
:
""
//
"toDate": ""
}
//
}
dispatch
(
fetchReports
(
data
))
//
dispatch(fetchReports(data))
}
//
}
return
(()
=>
{
//
return (() => {
setEmpDetails
(
null
)
//
setEmpDetails(null)
})
//
})
},
[
id
,
reportees
]);
},
[
viewReportee
,
reportees
]);
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
user
)
{
if
(
user
)
{
navigate
(
`/viewreportee
/
${
id
}
`
)
navigate
(
`/viewreportee`
)
setOpen
({
"accordianOne"
:
false
,
"accordianTwo"
:
false
})
setOpen
({
"accordianOne"
:
false
,
"accordianTwo"
:
false
})
}
else
{
}
else
{
navigate
(
"/"
)
navigate
(
"/"
)
}
}
},
[
id
]);
},
[]);
if
(
empDetails
&&
reportees
.
length
)
if
(
viewReportee
&&
reportees
.
length
)
return
(
return
(
<
div
className=
"p-4"
>
<
div
className=
"p-4"
>
<
div
className=
"bg-white p-3 rounded-md"
>
<
div
className=
"bg-white p-3 rounded-md"
>
...
@@ -110,33 +111,33 @@ function Reports() {
...
@@ -110,33 +111,33 @@ function Reports() {
{
/* <img src="/generic-male-avatar-rectangular.jpg" width="100px" height="100px" /> */
}
{
/* <img src="/generic-male-avatar-rectangular.jpg" width="100px" height="100px" /> */
}
<
div
className=
"my-1"
>
<
div
className=
"my-1"
>
<
p
>
<
p
>
<
span
className=
"font-medium"
>
Employee Name :
</
span
>
{
empDetails
?.
empName
}
<
span
className=
"font-medium"
>
Employee Name :
</
span
>
{
viewReportee
?.
empName
}
</
p
>
</
p
>
<
p
>
<
p
>
<
span
className=
"font-medium"
>
Designation :
</
span
>
{
empDetails
?.
designation
}
<
span
className=
"font-medium"
>
Designation :
</
span
>
{
viewReportee
?.
designation
}
</
p
>
</
p
>
{
/* <p>
{
/* <p>
<span className="font-medium">Email Id: </span> {
empDetails
?.empEmail}
<span className="font-medium">Email Id: </span> {
viewReportee
?.empEmail}
</p> */
}
</p> */
}
</
div
>
</
div
>
<
div
className=
"my-1"
>
<
div
className=
"my-1"
>
<
p
>
<
p
>
<
span
className=
"font-medium"
>
Role :
</
span
>
{
empDetails
?.
techStack
}
<
span
className=
"font-medium"
>
Role :
</
span
>
{
viewReportee
?.
techStack
}
</
p
>
</
p
>
<
p
>
<
p
>
<
span
className=
"font-medium"
>
Employee Id:
</
span
>
{
empDetails
?.
empId
}
<
span
className=
"font-medium"
>
Employee Id:
</
span
>
{
viewReportee
?.
empId
}
</
p
>
</
p
>
{
/* <p>
{
/* <p>
<span className="font-medium">Total Score : </span> {
empDetails
?.score}
<span className="font-medium">Total Score : </span> {
viewReportee
?.score}
</p> */
}
</p> */
}
{
/* <p>
{
/* <p>
<span className="font-medium">Allocated To : </span> {
empDetails
?.project}
<span className="font-medium">Allocated To : </span> {
viewReportee
?.project}
</p> */
}
</p> */
}
</
div
>
</
div
>
<
div
className=
"flex flex-col justify-center items-center"
>
<
div
className=
"flex flex-col justify-center items-center"
>
<
div
className=
{
`w-[40px] h-[40px] rounded-full flex items-center text-white justify-center ${scoreColor(
empDetails
?.score)}`
}
>
<
div
className=
{
`w-[40px] h-[40px] rounded-full flex items-center text-white justify-center ${scoreColor(
viewReportee
?.score)}`
}
>
<
span
className=
"text-lg font-bold"
>
{
empDetails
?.
score
}
</
span
>
<
span
className=
"text-lg font-bold"
>
{
viewReportee
?.
score
}
</
span
>
</
div
>
</
div
>
<
div
className=
""
>
<
div
className=
""
>
<
span
className=
"text-blue-400 font-semibold"
>
Total Score
</
span
>
<
span
className=
"text-blue-400 font-semibold"
>
Total Score
</
span
>
...
@@ -162,4 +163,4 @@ function Reports() {
...
@@ -162,4 +163,4 @@ function Reports() {
}
}
export
default
Reports
;
export
default
Viewreportee
;
src/redux/reducers/reporteesSlice.js
View file @
d3282f1f
...
@@ -4,6 +4,7 @@ import axios from "axios";
...
@@ -4,6 +4,7 @@ import axios from "axios";
const
initialState
=
{
const
initialState
=
{
reportees
:
[],
reportees
:
[],
viewReportee
:
null
,
totalCount
:
0
,
totalCount
:
0
,
loading
:
false
,
loading
:
false
,
error
:
null
,
error
:
null
,
...
@@ -20,6 +21,20 @@ const reporteesSlice = createSlice({
...
@@ -20,6 +21,20 @@ const reporteesSlice = createSlice({
reducers
:
{
reducers
:
{
resetReportees
:()
=>
{
resetReportees
:()
=>
{
return
initialState
return
initialState
},
setViewReportee
:(
state
,
action
)
=>
{
const
reportee
=
state
.
reportees
.
find
((
reportee
)
=>
reportee
.
empId
==
action
.
payload
)
if
(
!
reportee
){
return
{
...
state
,
viewReportee
:
null
}
}
else
{
return
{
...
state
,
viewReportee
:
reportee
}
}
}
}
},
},
extraReducers
:
(
builder
)
=>
{
extraReducers
:
(
builder
)
=>
{
...
@@ -41,6 +56,6 @@ const reporteesSlice = createSlice({
...
@@ -41,6 +56,6 @@ const reporteesSlice = createSlice({
},
},
});
});
export
const
{
resetReportees
}
=
reporteesSlice
.
actions
;
export
const
{
resetReportees
,
setViewReportee
}
=
reporteesSlice
.
actions
;
export
default
reporteesSlice
.
reducer
;
export
default
reporteesSlice
.
reducer
;
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