-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8462543
commit 0dac50c
Showing
9 changed files
with
143 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Position Form</title> | ||
</head> | ||
|
||
<body> | ||
<h1 style="text-align: center;">Staff Position</h1> | ||
<h3 style="text-align: center;" id="responseShow"></h3> | ||
|
||
<form id="updateForm" style="font-size: 2.5rem;text-align: center;align-items: center;align-content: center;"> | ||
|
||
<input type="text" placeholder="position" name="position" /><br /> | ||
<input type="checkbox" placeholder="enabled" name="enabled" value="true">Enabled<br> | ||
|
||
<button type="reset">Clear</button> | ||
<button type="button" onclick="updateStaffPosition()">Submit</button> | ||
</form> | ||
</body> | ||
<script> | ||
function updateStaffPosition() { | ||
var responseShow = document.getElementById("responseShow"); | ||
|
||
var formData = { | ||
position: document.querySelector('input[name="position"]').value, | ||
enabled: document.querySelector('input[name="enabled"]').checked | ||
}; | ||
|
||
fetch('http://localhost:8080/api/v1/staff/updateStaffPosition?staffId=3', { | ||
method: 'PATCH', | ||
headers: { | ||
'Content-Type': 'application/json' | ||
}, | ||
body: JSON.stringify(formData) | ||
}).then(response => response.json()) | ||
.then(data => { | ||
if (typeof data === 'object') { | ||
responseshow.innerText = JSON.stringify(data); | ||
} else { | ||
responseshow.innerText = data; | ||
} | ||
}) | ||
.catch(error => { | ||
responseshow.innerText = 'Error ' + error; | ||
}); | ||
} | ||
|
||
</script> | ||
<style> | ||
input { | ||
font-size: 1.5rem; | ||
} | ||
</style> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters