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
6afce932
Commit
6afce932
authored
Mar 21, 2024
by
Shiva Komirishetti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added pagination to my reportees
parent
4a050bfa
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
45 additions
and
14 deletions
+45
-14
index.jsx
src/components/accordion/index.jsx
+2
-2
index.jsx
src/components/header/index.jsx
+1
-1
index.jsx
src/components/leftSidebar/index.jsx
+25
-3
index.jsx
src/pages/viewReportee/index.jsx
+7
-7
commonFunctions.js
src/utils/commonFunctions.js
+10
-1
No files found.
src/components/accordion/index.jsx
View file @
6afce932
import
React
,
{
useState
}
from
"react"
;
import
Table
from
"../table"
;
import
moment
from
"moment"
;
import
ModalButton
from
"../modal/modalButton"
;
import
{
useSelector
,
useDispatch
}
from
"react-redux"
;
import
{
useEffect
}
from
"react"
;
...
...
@@ -8,6 +7,7 @@ import {useParams} from 'react-router'
import
{
fetchReportees
}
from
"../../redux/reducers/reporteesSlice"
;
import
{
calculateDefaultScore
,
calculateInitiativeScore
}
from
"../../redux/reducers/viewreporteeSlice"
;
import
Loading
from
"../loading Component/Loading"
;
import
{
convertUTCToLocal
}
from
'../../utils/commonFunctions'
;
function
Accordion
({
title
,
data
,
handleAddActivity
,
open
,
handleAccordian
})
{
...
...
@@ -41,7 +41,7 @@ function Accordion({ title, data ,handleAddActivity,open,handleAccordian}) {
}
const
headers
=
[
{
title
:
"Activity Name"
,
id
:
"aName"
},
{
title
:
"Date"
,
id
:
"recorded_date"
,
render
:
(
value
)
=>
moment
(
value
).
format
(
'DD-MM-YYYY'
)
},
{
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
>},
...
...
src/components/header/index.jsx
View file @
6afce932
...
...
@@ -42,7 +42,7 @@ function Header({ isOpen }) {
<
div
className=
"flex items-center relative"
>
<
button
ref=
{
logoutRef
}
className=
" -mt-1 text-2xl flex"
onClick=
{
()
=>
setOpen
(
!
open
)
}
>
<
img
src=
"/user.png"
width=
"35px"
height=
"35px"
className=
"mt-2 pr-2"
/>
<
div
className=
"flex flex-col"
>
<
div
className=
"flex flex-col
items-start
"
>
<
p
className=
"text-lg font-semibold"
>
{
user
?.
empName
}
</
p
>
<
p
className=
"text-xs"
>
{
user
?.
designation
}
</
p
>
</
div
>
...
...
src/components/leftSidebar/index.jsx
View file @
6afce932
...
...
@@ -5,12 +5,14 @@ import { useSelector, useDispatch } from "react-redux";
import
{
useParams
}
from
"react-router-dom"
;
import
{
scoreColor
}
from
'../../utils/commonFunctions'
;
import
Loading
from
"../loading Component/Loading"
;
import
PaginationComponent
from
"../Pagenation/Pagenation"
;
function
LeftSidebar
()
{
const
dispatch
=
useDispatch
();
const
[
currPage
,
setCurrPage
]
=
useState
(
1
);
const
[
pagesCount
,
setPagesCount
]
=
useState
(
1
);
const
[
inputValue
,
setInputValue
]
=
useState
(
null
);
const
{
reportees
,
loading
,
viewReportee
}
=
useSelector
((
state
)
=>
state
.
reportees
);
const
{
reportees
,
loading
,
viewReportee
,
totalCount
}
=
useSelector
((
state
)
=>
state
.
reportees
);
const
userDetails
=
useSelector
((
state
)
=>
state
.
userDetails
);
...
...
@@ -35,6 +37,20 @@ function LeftSidebar() {
setInputValue
(
event
.
target
.
value
);
};
useEffect
(()
=>
{
setPagesCount
(
Math
.
ceil
((
totalCount
)
/
(
10
)))
},
[
totalCount
])
const
handlePageChange
=
(
currPage
)
=>
{
let
data
=
{
reportees
:
userDetails
.
user
.
reportees
,
page
:
currPage
,
perPage
:
10
}
setCurrPage
(
currPage
)
dispatch
(
fetchReportees
(
data
))
}
return
(
<
div
className=
" w-[33%] flex flex-col px-[5px]"
>
...
...
@@ -56,7 +72,7 @@ function LeftSidebar() {
{
reportees
?.
map
(({
empName
,
score
,
empId
})
=>
(
<
button
onClick=
{
()
=>
dispatch
(
setViewReportee
(
empId
))
}
// to=
{`/
viewreportee
`}
className=
{
`flex items-center hover:bg-blue-400 hover:text-white bg-${viewReportee.empId == empId ? "blue-400 text-white" : "white"
className=
{
`flex items-center hover:bg-blue-400 hover:text-white bg-${viewReportee
?
.empId == empId ? "blue-400 text-white" : "white"
} p-2 justify-between mb-1 w-full`
}
key=
{
empId
}
>
...
...
@@ -70,7 +86,13 @@ function LeftSidebar() {
))
}
</
div
>
}
<
div
>
<
PaginationComponent
currentPage=
{
currPage
}
totalPages=
{
pagesCount
}
onPageChange=
{
handlePageChange
}
/>
</
div
>
</
div
>
);
}
...
...
src/pages/viewReportee/index.jsx
View file @
6afce932
...
...
@@ -76,15 +76,15 @@ function Viewreportee() {
}
useEffect
(()
=>
{
if
(
reportees
.
length
>
0
&&
viewReportee
)
dispatch
(
fetchReporteeActivities
({
empId
:
viewReportee
.
empId
}))
if
(
reportees
.
length
>
0
&&
viewReportee
!==
null
)
dispatch
(
fetchReporteeActivities
({
empId
:
viewReportee
?
.
empId
}))
},[
reportees
,
viewReportee
])
useEffect
(()
=>
{
if
(
reportees
.
length
){
dispatch
(
setViewReportee
(
viewReportee
.
empId
))
}
},[
reportees
])
//
useEffect(()=>{
//
if(reportees.length){
// dispatch(setViewReportee(viewReportee?
.empId))
//
}
//
},[reportees])
...
...
src/utils/commonFunctions.js
View file @
6afce932
import
moment
from
'moment'
;
export
const
scoreColor
=
(
value
)
=>
{
if
(
value
<
1
)
{
return
'bg-red-400'
;
...
...
@@ -18,7 +20,7 @@ export const scoreColor = (value) => {
export
const
debounce
=
(
func
,
delay
)
=>
{
let
timeoutId
;
return
function
(...
args
)
{
clearTimeout
(
timeoutId
);
timeoutId
=
setTimeout
(()
=>
{
...
...
@@ -26,3 +28,10 @@ export const debounce = (func, delay) => {
},
delay
);
};
}
export
const
convertUTCToLocal
=
(
utcDate
)
=>
{
const
utcDateObj
=
new
Date
(
utcDate
);
const
localTimeMillis
=
utcDateObj
.
getTime
()
+
utcDateObj
.
getTimezoneOffset
()
*
60
*
1000
;
const
localDateObj
=
new
Date
(
localTimeMillis
);
return
moment
(
localDateObj
).
format
(
'DD-MM-YYYY'
)
}
\ 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