Add "mark as reported" to results table (#1772)

This commit adds the ability to mark a result as reported directly from the campaign results view.
pull/1813/head
Paul Werther 2020-03-15 18:38:51 +01:00 committed by GitHub
parent 053b998b84
commit c0be58aa3d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 31 additions and 3 deletions

View File

@ -777,7 +777,7 @@ function load() {
if (reported) { if (reported) {
return "<i class='fa fa-check-circle text-center text-success'></i>" return "<i class='fa fa-check-circle text-center text-success'></i>"
} }
return "<i class='fa fa-times-circle text-center text-muted'></i>" return "<i role='button' class='fa fa-times-circle text-center text-muted' onclick='report_mail(\"" + row[0] + "\", \"" + campaign.id + "\");'></i>"
} }
return reported return reported
}, },
@ -916,7 +916,35 @@ function refresh() {
setRefresh = setTimeout(refresh, 60000) setRefresh = setTimeout(refresh, 60000)
}; };
function report_mail(rid, cid) {
Swal.fire({
title: "Are you sure?",
text: "This result will be flagged as reported (RID: " + rid + ")",
type: "question",
animation: false,
showCancelButton: true,
confirmButtonText: "Continue",
confirmButtonColor: "#428bca",
reverseButtons: true,
allowOutsideClick: false,
showLoaderOnConfirm: true
}).then(function (result) {
if (result.value){
api.campaignId.get(cid).success((function(c) {
report_url = c.url;
report_url += report_url.endsWith("/") ? "" : "/";
report_url += "report?rid=" + rid;
$.ajax({
url: report_url,
method: "GET",
success: function(data) {
refresh();
}
});
}));
}
})
}
$(document).ready(function () { $(document).ready(function () {
Highcharts.setOptions({ Highcharts.setOptions({
@ -928,4 +956,4 @@ $(document).ready(function () {
// Start the polling loop // Start the polling loop
setRefresh = setTimeout(refresh, 60000) setRefresh = setTimeout(refresh, 60000)
}) })