Skip to content
Snippets Groups Projects
Commit f028ba8c authored by henry anand's avatar henry anand
Browse files

feat : add notification for assignment

parent 99963d1e
Branches
Tags
No related merge requests found
...@@ -13,6 +13,9 @@ ...@@ -13,6 +13,9 @@
</div> </div>
</form> </form>
</div> </div>
<div id="notification">
<!-- Inject from js -->
</div>
</div> </div>
<script> <script>
......
...@@ -97,6 +97,29 @@ ...@@ -97,6 +97,29 @@
margin-top: 20px; margin-top: 20px;
} }
.notification {
padding: 10px;
margin-top: 10px;
border-radius: 5px;
display: flex;
align-items: center;
}
.success {
background-color: #4CAF50;
color: white;
}
.error {
background-color: #f44336;
color: white;
}
.fas {
margin-right: 10px;
}
@media screen and (max-width: 450px) { @media screen and (max-width: 450px) {
.add-document { .add-document {
padding-top: 400px; padding-top: 400px;
......
...@@ -4,8 +4,6 @@ const render = () => { ...@@ -4,8 +4,6 @@ const render = () => {
xhr.setRequestHeader("user_id", uid); xhr.setRequestHeader("user_id", uid);
xhr.onload = () => { xhr.onload = () => {
const res = JSON.parse(xhr.response); const res = JSON.parse(xhr.response);
console.log(res.data);
console.log(res.data.assignments[0])
if (res.status === 'success') { if (res.status === 'success') {
title.innerHTML = res.data.assignments[0].assignment_name title.innerHTML = res.data.assignments[0].assignment_name
...@@ -33,11 +31,14 @@ const submitForm = () => { ...@@ -33,11 +31,14 @@ const submitForm = () => {
xhr.onload = () => { xhr.onload = () => {
const res = JSON.parse(xhr.response); const res = JSON.parse(xhr.response);
const notificationElement = document.getElementById('notification');
if (res.status === 'success') { if (res.status === 'success') {
// Update the HTML elements with the response data notificationElement.classList.add('success');
document.getElementById('assignment_name').innerHTML = res.data.assignment_name; notificationElement.innerHTML = '<i class="fas fa-check-circle"></i> Berhasil Mengupload assignment';
document.getElementById('description').innerHTML = res.data.assignment_description; } else {
notificationElement.classList.add('error');
notificationElement.innerHTML = '<i class="fas fa-times-circle"></i> Gagal Mengupload Assignment';
} }
} }
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment