Added results CRUD and result detailed view

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

View File

@ -214,6 +214,11 @@ table.dataTable {
font-size: 14pt;
}
.result-action-buttons {
margin: 5px auto;
width: fit-content;
}
/* Fallback for Edge
-------------------------------------------------- */
@supports (-ms-ime-align: auto) {

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);
},
});
}
});