diff --git a/app/views/assignments/submit.php b/app/views/assignments/submit.php index 24de200ab55d80660fb9ecd116c0258208fb146f..a6fc01568703331103ec23c803cdd457448cf9cd 100644 --- a/app/views/assignments/submit.php +++ b/app/views/assignments/submit.php @@ -13,6 +13,9 @@ </div> </form> </div> + <div id="notification"> + <!-- Inject from js --> + </div> </div> <script> diff --git a/public/css/addDocument.css b/public/css/addDocument.css index 679521dd57f86df07518231d4c069f981b704de1..0ae757b7b8aed6f0b02db8f9ecc6523f24e769ec 100644 --- a/public/css/addDocument.css +++ b/public/css/addDocument.css @@ -97,6 +97,29 @@ 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) { .add-document { padding-top: 400px; diff --git a/public/js/submit.js b/public/js/submit.js index d0071ea0f1ca65b944fcd99274af30a69caa9b78..0eaa90598c8639f91762b310cdf637faf61450f1 100644 --- a/public/js/submit.js +++ b/public/js/submit.js @@ -4,8 +4,6 @@ const render = () => { xhr.setRequestHeader("user_id", uid); xhr.onload = () => { const res = JSON.parse(xhr.response); - console.log(res.data); - console.log(res.data.assignments[0]) if (res.status === 'success') { title.innerHTML = res.data.assignments[0].assignment_name @@ -33,11 +31,14 @@ const submitForm = () => { xhr.onload = () => { const res = JSON.parse(xhr.response); + const notificationElement = document.getElementById('notification'); if (res.status === 'success') { - // Update the HTML elements with the response data - document.getElementById('assignment_name').innerHTML = res.data.assignment_name; - document.getElementById('description').innerHTML = res.data.assignment_description; + notificationElement.classList.add('success'); + notificationElement.innerHTML = '<i class="fas fa-check-circle"></i> Berhasil Mengupload assignment'; + } else { + notificationElement.classList.add('error'); + notificationElement.innerHTML = '<i class="fas fa-times-circle"></i> Gagal Mengupload Assignment'; } }