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
3c650f35
Commit
3c650f35
authored
Mar 20, 2024
by
Shiva Komirishetti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added autoFocus
parent
efa2471f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
8 deletions
+18
-8
index.jsx
src/pages/dashboard/index.jsx
+4
-1
index.jsx
src/pages/home/index.jsx
+14
-7
No files found.
src/pages/dashboard/index.jsx
View file @
3c650f35
...
@@ -76,7 +76,6 @@ function Dashboard() {
...
@@ -76,7 +76,6 @@ function Dashboard() {
{
{
title
:
"Employee Name"
,
title
:
"Employee Name"
,
id
:
"empName"
,
id
:
"empName"
,
renderHeader
:
(
value
)
=>
<
div
><
span
>
{
value
}
</
span
>
<
input
placeholder=
"Search Employee"
value=
{
inputValue
}
onChange=
{
handleChange
}
type=
"text"
className=
"p-2 mi-2 border rounded"
/></
div
>,
render
:
(
value
)
=>
<
span
className=
"flex items-center"
>
render
:
(
value
)
=>
<
span
className=
"flex items-center"
>
{
/* <img className="pr-2" src="/man.png" width="30px" height="30px" /> */
}
{
/* <img className="pr-2" src="/man.png" width="30px" height="30px" /> */
}
{
value
}
</
span
>
{
value
}
</
span
>
...
@@ -113,6 +112,10 @@ function Dashboard() {
...
@@ -113,6 +112,10 @@ function Dashboard() {
return
(
return
(
<
div
>
<
div
>
<
div
className=
"mb-2"
>
<
div
className=
"mb-2"
>
<
div
className=
"flex justify-end my-1 mr-2 items-center"
>
<
label
>
Search Employee:
</
label
>
<
input
placeholder=
"Enter value"
value=
{
inputValue
}
onChange=
{
handleChange
}
type=
"text"
className=
"p-1 px-2 border rounded ml-2"
/>
</
div
>
<
Table
headers=
{
headers
}
data=
{
reportees
}
loading=
{
loading
}
maxHeight=
{
88
}
/>
<
Table
headers=
{
headers
}
data=
{
reportees
}
loading=
{
loading
}
maxHeight=
{
88
}
/>
<
div
className=
""
>
<
div
className=
""
>
...
...
src/pages/home/index.jsx
View file @
3c650f35
import
React
,
{
useEffect
,
useState
}
from
"react"
;
import
React
,
{
useEffect
,
useState
,
useRef
}
from
"react"
;
import
{
useNavigate
}
from
"react-router-dom"
;
import
{
useNavigate
}
from
"react-router-dom"
;
import
axios
from
'axios'
;
import
axios
from
'axios'
;
import
{
base_url
}
from
"../../utils/constants"
;
import
{
base_url
}
from
"../../utils/constants"
;
...
@@ -7,6 +7,7 @@ import {useDispatch,useSelector} from 'react-redux'
...
@@ -7,6 +7,7 @@ import {useDispatch,useSelector} from 'react-redux'
import
Loading
from
'../../components/loading Component/Loading'
import
Loading
from
'../../components/loading Component/Loading'
function
Home
()
{
function
Home
()
{
const
inputRef
=
useRef
(
null
);
const
navigate
=
useNavigate
();
const
navigate
=
useNavigate
();
const
dispatch
=
useDispatch
()
const
dispatch
=
useDispatch
()
const
[
id
,
setId
]
=
useState
(
null
);
const
[
id
,
setId
]
=
useState
(
null
);
...
@@ -15,10 +16,11 @@ function Home() {
...
@@ -15,10 +16,11 @@ function Home() {
const
userDetails
=
useSelector
((
state
)
=>
state
.
userDetails
);
const
userDetails
=
useSelector
((
state
)
=>
state
.
userDetails
);
const
handleNavigate
=
async
()
=>
{
const
handleSubmit
=
async
(
e
)
=>
{
e
.
preventDefault
();
setLoading
(
true
)
setLoading
(
true
)
if
(
id
!==
null
){
if
(
id
!==
null
){
await
axios
.
post
(
`
${
base_url
}
/login`
,{
empId
:
Number
(
i
d
)})
await
axios
.
post
(
`
${
base_url
}
/login`
,{
empId
:
Number
(
i
nputRef
.
current
.
value
)})
.
then
((
res
)
=>
{
.
then
((
res
)
=>
{
setLoading
(
false
)
setLoading
(
false
)
dispatch
(
loginUser
(
res
.
data
.
user
))
dispatch
(
loginUser
(
res
.
data
.
user
))
...
@@ -35,6 +37,7 @@ function Home() {
...
@@ -35,6 +37,7 @@ function Home() {
};
};
useEffect
(()
=>
{
useEffect
(()
=>
{
setLoading
(
false
)
setLoading
(
false
)
inputRef
.
current
.
focus
();
},[])
},[])
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
userDetails
?.
user
!=
null
)
if
(
userDetails
?.
user
!=
null
)
...
@@ -47,8 +50,7 @@ function Home() {
...
@@ -47,8 +50,7 @@ function Home() {
<
div
className=
"container py-10 px-10 mx-0 min-w-full h-screen flex items-center justify-center bg-blue-100 "
>
<
div
className=
"container py-10 px-10 mx-0 min-w-full h-screen flex items-center justify-center bg-blue-100 "
>
<
div
className=
""
>
<
div
className=
""
>
<
h1
className=
"text-4xl font-extrabold leading-none tracking-tight md:text-5xl lg:text-6xl text-purple-900 mb-10 "
>
SCORE CARD
</
h1
>
<
h1
className=
"text-4xl font-extrabold leading-none tracking-tight md:text-5xl lg:text-6xl text-purple-900 mb-10 "
>
SCORE CARD
</
h1
>
{
/* {
<
form
>
(loading)?<Loading/>: */
}
<
div
className=
"max-w-sm p-10 bg-white border border-gray-400 rounded-lg shadow "
>
<
div
className=
"max-w-sm p-10 bg-white border border-gray-400 rounded-lg shadow "
>
<
label
<
label
htmlFor=
"email"
htmlFor=
"email"
...
@@ -63,6 +65,7 @@ function Home() {
...
@@ -63,6 +65,7 @@ function Home() {
placeholder=
"Enter Employee ID"
placeholder=
"Enter Employee ID"
required
required
onChange=
{
(
e
)
=>
setId
(
e
.
target
.
value
)
}
onChange=
{
(
e
)
=>
setId
(
e
.
target
.
value
)
}
ref=
{
inputRef
}
/>
/>
{
{
...
@@ -75,17 +78,21 @@ function Home() {
...
@@ -75,17 +78,21 @@ function Home() {
<
div
className=
"flex justify-between"
>
<
div
className=
"flex justify-between"
>
<
button
<
button
className=
"bg-purple-900 text-white disabled:bg-purple-900 hover:bg-blue-400 font-bold py-2 px-4 mt-6 rounded text-center"
className=
"bg-purple-900 text-white disabled:bg-purple-900 hover:bg-blue-400 font-bold py-2 px-4 mt-6 rounded text-center"
onClick=
{
handleNavigate
}
onClick=
{
(
e
)
=>
handleSubmit
(
e
)
}
disabled=
{
!
id
}
disabled=
{
!
id
}
type=
"submit"
>
>
Submit
Submit
</
button
>
</
button
>
{
{
(
loading
)?<
img
src=
"/Loader2.gif"
className=
""
width=
{
100
}
height=
{
100
}
/>:
null
(
loading
)?<
img
src=
"/Loader2.gif"
className=
""
width=
{
100
}
height=
{
100
}
/>:
null
}
}
</
div
>
</
div
>
</
div
>
</
div
>
{
/* } */
}
</
form
>
</
div
>
</
div
>
</
div
>
</
div
>
);
);
...
...
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