Added results CRUD and result detailed view

This commit is contained in:
2021-12-04 12:20:03 +00:00
parent 64f1da772a
commit 998ec597b1
18 changed files with 576 additions and 59 deletions

View File

@ -153,4 +153,43 @@ $('#dismiss-cookie-alert').click(function(event){
event.preventDefault();
})
})
// Script for Resutlt Actions
$('.result-action-buttons').click(function(event){
var _id = $(this).data('_id')
if ($(this).data('result-action') == 'generate') {
$.ajax({
url: '/admin/certificate/',
type: 'POST',
data: JSON.stringify({'_id': _id}),
contentType: 'application/json',
dataType: 'html',
success: function(response) {
var display_window = window.open();
display_window.document.write(response);
},
error: function(response){
error_response(response);
},
});
} else {
var action = $(this).data('result-action')
$.ajax({
url: window.location.href,
type: 'POST',
data: JSON.stringify({'_id': _id, 'action': action}),
contentType: 'application/json',
success: function(response) {
if (action == 'delete') {
window.location.href = '/admin/results/';
} else window.location.reload();
},
error: function(response){
error_response(response);
},
});
}
});