Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
prof21
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TALENT
TALENT
prof21
Commits
e737dd3e
Commit
e737dd3e
authored
3 years ago
by
mperezsa
Browse files
Options
Downloads
Patches
Plain Diff
Upload New File
parent
f62db4b7
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
PROF-XXI FW Tool/client/src/components/pages/TrackUnits.js
+114
-0
114 additions, 0 deletions
PROF-XXI FW Tool/client/src/components/pages/TrackUnits.js
with
114 additions
and
0 deletions
PROF-XXI FW Tool/client/src/components/pages/TrackUnits.js
0 → 100644
+
114
−
0
View file @
e737dd3e
import
React
,
{
useState
,
useEffect
}
from
"
react
"
;
import
{
Link
}
from
"
react-router-dom
"
;
import
Footer
from
"
../../components/Footer
"
;
import
"
./Default.css
"
;
import
"
./Tracking.css
"
;
import
axios
from
"
axios
"
;
function
TrackUnits
()
{
const
[
unit
,
setUnit
]
=
useState
({
unitId
:
""
,
unitName
:
""
,
unitType
:
""
,
unitDescription
:
""
,
accessType
:
""
,
});
const
[
units
,
setUnits
]
=
useState
([]);
const
[
participants
,
setParticipants
]
=
useState
([]);
const
handleChange
=
(
e
)
=>
{
const
fieldName
=
e
.
target
.
name
;
const
fieldValue
=
e
.
target
.
value
;
setUnit
({
...
unit
,
[
fieldName
]:
fieldValue
});
};
const
[
profile
,
setProfile
]
=
useState
(
JSON
.
parse
(
localStorage
.
getItem
(
"
profile
"
))
);
const
config
=
{
headers
:
{
"
Content-Type
"
:
"
application/json
"
,
Authorization
:
`Bearer
${
profile
.
token
}
`
,
},
};
const
fetchData
=
async
(
e
)
=>
{
const
{
data
}
=
await
axios
.
get
(
"
/api/units/manageunit
"
,
config
);
setUnits
(
data
.
unitsResult
);
};
const
fetchParticipants
=
async
()
=>
{
const
{
data
}
=
await
axios
.
get
(
`/api/links/participants/
${
unit
.
unitId
}
`
,
config
);
setParticipants
(
data
.
participantsResult
);
};
useEffect
(()
=>
{
document
.
title
=
"
Track your units
"
;
setProfile
(
JSON
.
parse
(
localStorage
.
getItem
(
"
profile
"
)));
if
(
!
profile
?.
token
)
{
window
.
location
=
"
/login
"
;
}
fetchData
();
fetchParticipants
();
},
[
unit
.
unitId
]);
return
(
<>
<
h2
>
Track
units
participants
<
/h2
>
<
div
className
=
"
table-container
"
>
<
div
>
<
form
className
=
"
form
"
>
<
label
htmlFor
=
"
unit
"
>
Change
Unit
:
<
/label
>
<
select
id
=
"
unitId
"
name
=
"
unitId
"
value
=
{
unit
.
unitId
}
onChange
=
{
handleChange
}
>
<
option
>
Select
your
unit
Please
<
/option
>
{
units
?.
map
((
unit
)
=>
(
<
option
key
=
{
unit
.
idunit
}
value
=
{
unit
.
idunit
}
>
{
unit
.
name
}
<
/option
>
))}
<
/select
>
<
Link
to
=
"
/workingarea
"
>
<
button
className
=
"
btn
"
>
Working
area
<
/button
>
<
/Link
>
<
/form
>
<
/div
>
<
div
>
<
table
className
=
"
track
"
>
<
tr
>
<
th
>
Participant
full
name
<
/th
>
<
th
>
Email
<
/th
>
<
th
>
Date
of
Answering
the
scan
<
/th
>
<
/tr
>
{
participants
.
map
((
e
)
=>
{
return
(
<
tr
key
=
{
e
.
date
}
>
<
td
>
{
e
.
participantfirstname
}
{
e
.
participantlastname
}
<
/td
>
<
td
>
{
e
.
participantemail
}
<
/td
>
<
td
>
{
e
.
date
}
<
/td
>
<
/tr
>
);
})}
<
/table
>
<
/div
>
<
/div
>
<
Footer
/>
<
/
>
);
}
export
default
TrackUnits
;
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment