Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
ASE_Y2S1_CP_G4
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
Joshua Gill
ASE_Y2S1_CP_G4
Commits
cecf7c18
Commit
cecf7c18
authored
3 years ago
by
Seb Barnard
Browse files
Options
Downloads
Patches
Plain Diff
Added validation to staff member input
parent
7aad4cef
No related branches found
No related tags found
3 merge requests
!114
LoggingService service class, new method to add a log to the "Logs" table when...
,
!104
Branch Update
,
!103
Issue thirty four
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/resources/static/js/manageStaff.js
+35
-15
35 additions, 15 deletions
src/main/resources/static/js/manageStaff.js
src/main/resources/templates/fragments/manageStaff.html
+2
-1
2 additions, 1 deletion
src/main/resources/templates/fragments/manageStaff.html
with
37 additions
and
16 deletions
src/main/resources/static/js/manageStaff.js
+
35
−
15
View file @
cecf7c18
...
@@ -3,25 +3,25 @@ function submit(shopId, email={"value":""}){
...
@@ -3,25 +3,25 @@ function submit(shopId, email={"value":""}){
if
(
email
.
parentElement
.
children
[
0
].
classList
.
contains
(
"
subtitle
"
)){
if
(
email
.
parentElement
.
children
[
0
].
classList
.
contains
(
"
subtitle
"
)){
emailValue
=
email
.
parentElement
.
children
[
0
].
innerHTML
emailValue
=
email
.
parentElement
.
children
[
0
].
innerHTML
email
.
parentElement
.
parentElement
.
remove
()
}
else
{
}
else
{
emailValue
=
email
.
parentElement
.
children
[
0
].
value
emailValue
=
email
.
parentElement
.
children
[
0
].
value
document
.
getElementById
(
"
staffManagement
"
).
innerHTML
+=
emailArray
=
[]
`<div id="staffManagement">
<div class="staffManagementContainer">
document
.
getElementsByName
(
"
staffEmail
"
).
forEach
(
x
=>
emailArray
.
push
(
x
.
innerHTML
))
<p class="subtitle is-6" style="width:50%; margin-bottom: 0">
${
emailValue
}
</p>
<button class="button is-danger is-outlined" style="border-bottom: 1px solid black"
if
(
emailArray
.
includes
(
emailValue
)){
onclick="submit(
${
document
.
getElementById
(
"
shopId
"
).
value
}
,this);">
document
.
getElementById
(
"
emailErrorField
"
).
innerHTML
=
"
User already added
"
<span class="icon is-small">
return
<i class="fas fa-times is-danger"></i>
}
</span>
}
</button>
</div>
if
(
emailValue
==
""
){
<p id="blackLine" class="subtitle is-6" style="border-bottom: 1px solid #00b89c; margin-bottom:1%; width:50%"></p>
document
.
getElementById
(
"
emailErrorField
"
).
innerHTML
=
"
Field blank
"
</div>`
return
}
}
let
params
=
"
shopId=
"
+
shopId
let
params
=
"
shopId=
"
+
shopId
if
(
emailValue
==
""
)
{
if
(
emailValue
==
""
)
{
params
+=
"
&email=
"
+
document
.
getElementById
(
"
emailAddress
"
).
value
params
+=
"
&email=
"
+
document
.
getElementById
(
"
emailAddress
"
).
value
...
@@ -33,7 +33,27 @@ function submit(shopId, email={"value":""}){
...
@@ -33,7 +33,27 @@ function submit(shopId, email={"value":""}){
xhttp
.
onload
=
function
()
{
xhttp
.
onload
=
function
()
{
if
(
xhttp
.
readyState
===
4
&&
xhttp
.
status
===
200
)
{
if
(
xhttp
.
readyState
===
4
&&
xhttp
.
status
===
200
)
{
var
response
=
xhttp
.
responseText
var
response
=
xhttp
.
responseText
if
(
response
==
"
success
"
){
if
(
response
==
"
OK
"
||
response
==
"
USER REMOVED
"
){
if
(
email
.
parentElement
.
children
[
0
].
classList
.
contains
(
"
subtitle
"
)){
email
.
parentElement
.
parentElement
.
remove
()
}
else
{
document
.
getElementById
(
"
staffManagement
"
).
innerHTML
+=
`<div id="staffManagement">
<div class="staffManagementContainer">
<p class="subtitle is-6" style="width:50%; margin-bottom: 0">
${
emailValue
}
</p>
<button class="button is-danger is-outlined" style="border-bottom: 1px solid"
onclick="submit(
${
document
.
getElementById
(
"
shopId
"
).
value
}
,this);">
<span class="icon is-small">
<i class="fas fa-times is-danger"></i>
</span>
</button>
</div>
<p id="blackLine" class="subtitle is-6" style="border-bottom: 1px solid #00b89c; margin-bottom:1%; width:50%"></p>
</div>`
}
}
else
{
}
else
{
}
}
}
else
{
}
else
{
...
...
This diff is collapsed.
Click to expand it.
src/main/resources/templates/fragments/manageStaff.html
+
2
−
1
View file @
cecf7c18
...
@@ -17,11 +17,12 @@
...
@@ -17,11 +17,12 @@
</span>
</span>
</button>
</button>
</div>
</div>
<p
class=
"help is-danger"
id=
"emailErrorField"
></p>
<p><br>
Current Admins
</p>
<p><br>
Current Admins
</p>
<div
id=
"staffManagement"
></div>
<div
id=
"staffManagement"
></div>
<div
id=
"staffManagement"
th:each=
"user : ${staffMembers}"
>
<div
id=
"staffManagement"
th:each=
"user : ${staffMembers}"
>
<div
class=
"staffManagementContainer"
>
<div
class=
"staffManagementContainer"
>
<p
class=
"subtitle is-6"
th:text=
"${user.userEmail}"
style=
"width:50%; margin-bottom: 0"
></p>
<p
class=
"subtitle is-6"
name=
"staffEmail"
th:text=
"${user.userEmail}"
style=
"width:50%; margin-bottom: 0"
></p>
<button
class=
"button is-danger is-outlined"
style=
"border-bottom: 1px solid black"
th:onclick=
"'submit('+${shop.shopId}+',this);'"
>
<button
class=
"button is-danger is-outlined"
style=
"border-bottom: 1px solid black"
th:onclick=
"'submit('+${shop.shopId}+',this);'"
>
<span
class=
"icon is-small"
>
<span
class=
"icon is-small"
>
<i
class=
"fas fa-times is-danger"
></i>
<i
class=
"fas fa-times is-danger"
></i>
...
...
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