Browse Source

Fixing issue where campaigns aren't showing up in the archived tab if they have been marked as completed.

Fixes #1892
pull/1914/head
Jordan Wright 1 year ago
parent
commit
b684fb4ebd
2 changed files with 18 additions and 14 deletions
  1. +1
    -1
      static/js/dist/app/campaigns.min.js
  2. +17
    -13
      static/js/src/app/campaigns.js

+ 1
- 1
static/js/dist/app/campaigns.min.js
File diff suppressed because it is too large
View File


+ 17
- 13
static/js/src/app/campaigns.js View File

@ -343,7 +343,7 @@ $(document).ready(function () {
$("#campaignTable").show()
$("#campaignTableArchive").show()
campaignTableOriginal = $("#campaignTable").DataTable({
activeCampaignsTable = $("#campaignTable").DataTable({
columnDefs: [{
orderable: false,
targets: "no-sort"
@ -352,7 +352,7 @@ $(document).ready(function () {
[1, "desc"]
]
});
campaignTableArchive = $("#campaignTableArchive").DataTable({
archivedCampaignsTable = $("#campaignTableArchive").DataTable({
columnDefs: [{
orderable: false,
targets: "no-sort"
@ -361,13 +361,11 @@ $(document).ready(function () {
[1, "desc"]
]
});
campaignRows = []
rows = {
'active': [],
'archived': []
}
$.each(campaigns, function (i, campaign) {
campaignTable = campaignTableOriginal
if (campaign.status === "Completed") {
campaignTable = campaignTableArchive
}
label = labels[campaign.status] || "label-default";
//section for tooltips on the status of a campaign to show some quick stats
@ -377,10 +375,10 @@ $(document).ready(function () {
var quickStats = launchDate + "<br><br>" + "Number of recipients: " + campaign.stats.total
} else {
launchDate = "Launch Date: " + moment(campaign.launch_date).format('MMMM Do YYYY, h:mm:ss a')
var quickStats = launchDate + "<br><br>" + "Number of recipients: " + campaign.stats.total + "<br><br>" + "Emails opened: " + campaign.stats.opened + "<br><br>" + "Emails clicked: " + campaign.stats.clicked + "<br><br>" + "Submitted Credentials: " + campaign.stats.submitted_data + "<br><br>" + "Errors : " + campaign.stats.error + "Reported : " + campaign.stats.reported
var quickStats = launchDate + "<br><br>" + "Number of recipients: " + campaign.stats.total + "<br><br>" + "Emails opened: " + campaign.stats.opened + "<br><br>" + "Emails clicked: " + campaign.stats.clicked + "<br><br>" + "Submitted Credentials: " + campaign.stats.submitted_data + "<br><br>" + "Errors : " + campaign.stats.error + "<br><br>" + "Reported : " + campaign.stats.email_reported
}
campaignRows.push([
var row = [
escapeHtml(campaign.name),
moment(campaign.created_date).format('MMMM Do YYYY, h:mm:ss a'),
"<span class=\"label " + label + "\" data-toggle=\"tooltip\" data-placement=\"right\" data-html=\"true\" title=\"" + quickStats + "\">" + campaign.status + "</span>",
@ -393,10 +391,16 @@ $(document).ready(function () {
<button class='btn btn-danger' onclick='deleteCampaign(" + i + ")' data-toggle='tooltip' data-placement='left' title='Delete Campaign'>\
<i class='fa fa-trash-o'></i>\
</button></div>"
])
$('[data-toggle="tooltip"]').tooltip()
]
if (campaign.status == 'Completed') {
rows['archived'].push(row)
} else {
rows['active'].push(row)
}
})
campaignTable.rows.add(campaignRows).draw()
activeCampaignsTable.rows.add(rows['active']).draw()
archivedCampaignsTable.rows.add(rows['archived']).draw()
$('[data-toggle="tooltip"]').tooltip()
} else {
$("#emptyMessage").show()
}

Loading…
Cancel
Save