Added server and admin-side time limit adjustments
This commit is contained in:
@ -214,11 +214,15 @@ table.dataTable {
|
||||
font-size: 14pt;
|
||||
}
|
||||
|
||||
.result-action-buttons {
|
||||
.result-action-buttons, .test-action {
|
||||
margin: 5px auto;
|
||||
width: fit-content;
|
||||
}
|
||||
|
||||
.accordion-item {
|
||||
background-color: unset;
|
||||
}
|
||||
|
||||
/* Fallback for Edge
|
||||
-------------------------------------------------- */
|
||||
@supports (-ms-ime-align: auto) {
|
||||
|
@ -63,22 +63,27 @@ $('form[name=form-upload-questions]').submit(function(event) {
|
||||
});
|
||||
|
||||
// Edit and Delete Test Button Handlers
|
||||
$('.delete-test').click(function(event) {
|
||||
$('.test-action').click(function(event) {
|
||||
|
||||
let _id = $(this).data('_id')
|
||||
let _id = $(this).data('_id');
|
||||
let action = $(this).data('action');
|
||||
|
||||
$.ajax({
|
||||
url: `/admin/tests/delete/`,
|
||||
type: 'POST',
|
||||
data: JSON.stringify({'_id': _id}),
|
||||
contentType: 'application/json',
|
||||
success: function(response) {
|
||||
window.location.href = '/admin/tests/';
|
||||
},
|
||||
error: function(response){
|
||||
error_response(response);
|
||||
},
|
||||
});
|
||||
if (action == 'delete') {
|
||||
$.ajax({
|
||||
url: `/admin/tests/delete/`,
|
||||
type: 'POST',
|
||||
data: JSON.stringify({'_id': _id}),
|
||||
contentType: 'application/json',
|
||||
success: function(response) {
|
||||
window.location.href = '/admin/tests/';
|
||||
},
|
||||
error: function(response){
|
||||
error_response(response);
|
||||
},
|
||||
});
|
||||
} else if (action == 'edit') {
|
||||
window.location.href = `/admin/test/${_id}/`
|
||||
}
|
||||
|
||||
event.preventDefault();
|
||||
});
|
||||
@ -109,11 +114,11 @@ $('.edit-question-dataset').click(function(event) {
|
||||
|
||||
function error_response(response) {
|
||||
|
||||
var alert = $("#alert-box");
|
||||
alert.html('');
|
||||
const $alert = $("#alert-box");
|
||||
$alert.html('');
|
||||
|
||||
if (typeof response.responseJSON.error === 'string' || response.responseJSON.error instanceof String) {
|
||||
alert.html(`
|
||||
$alert.html(`
|
||||
<div class="alert alert-danger alert-dismissible fade show" role="alert">
|
||||
<i class="bi bi-exclamation-triangle-fill" title="Danger"></i>
|
||||
${response.responseJSON.error}
|
||||
@ -122,7 +127,7 @@ function error_response(response) {
|
||||
`);
|
||||
} else if (response.responseJSON.error instanceof Array) {
|
||||
for (var i = 0; i < response.responseJSON.error.length; i ++) {
|
||||
alert.html(`
|
||||
$alert.html(`
|
||||
<div class="alert alert-danger alert-dismissible fade show" role="alert">
|
||||
<i class="bi bi-exclamation-triangle-fill" title="Danger"></i>
|
||||
${response.responseJSON.error[i]}
|
||||
@ -131,6 +136,8 @@ function error_response(response) {
|
||||
`);
|
||||
}
|
||||
}
|
||||
|
||||
$alert.focus()
|
||||
}
|
||||
|
||||
// Dismiss Cookie Alert
|
||||
@ -152,13 +159,12 @@ $('#dismiss-cookie-alert').click(function(event){
|
||||
})
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
})
|
||||
|
||||
// Script for Resutlt Actions
|
||||
// Script for Result Actions
|
||||
$('.result-action-buttons').click(function(event){
|
||||
|
||||
var _id = $(this).data('_id')
|
||||
var _id = $(this).data('_id');
|
||||
|
||||
if ($(this).data('result-action') == 'generate') {
|
||||
$.ajax({
|
||||
@ -192,4 +198,32 @@ $('.result-action-buttons').click(function(event){
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
event.preventDefault();
|
||||
});
|
||||
|
||||
// Script for Deleting Time Adjustment
|
||||
$('.adjustment-delete').click(function(event){
|
||||
|
||||
var _id = $(this).data('_id');
|
||||
var location = window.location.href;
|
||||
location.replace('#', '')
|
||||
|
||||
console.log(location)
|
||||
|
||||
console.log(_id)
|
||||
$.ajax({
|
||||
url: location + 'delete-adjustment/',
|
||||
type: 'POST',
|
||||
data: JSON.stringify({'_id': _id}),
|
||||
contentType: 'application/json',
|
||||
success: function(response) {
|
||||
window.location.reload();
|
||||
},
|
||||
error: function(response){
|
||||
error_response(response);
|
||||
},
|
||||
});
|
||||
|
||||
event.preventDefault();
|
||||
});
|
Reference in New Issue
Block a user