Change button colours on export table

This commit is contained in:
JonnyWong16 2020-08-03 18:12:59 -07:00
parent e256d2080d
commit 7627f025ed
No known key found for this signature in database
GPG key ID: B1F1F9807184697A
2 changed files with 13 additions and 24 deletions

View file

@ -473,21 +473,6 @@ fieldset[disabled] .btn-bright.active {
background-color: #ac2925; background-color: #ac2925;
border-color: #761c19; border-color: #761c19;
} }
.btn-dark.btn-download:hover {
color: #fff;
background-color: #449d44;
border-color: #398439;
}
.btn-dark.btn-download.active {
color: #fff;
background-color: #449d44;
border-color: #398439;
}
.btn-dark.btn-download.active:hover {
color: #fff;
background-color: #398439;
border-color: #255625;
}
.btn-group select { .btn-group select {
margin-top: 0; margin-top: 0;
} }

View file

@ -90,12 +90,14 @@ export_table_options = {
"targets": [5], "targets": [5],
"data": "complete", "data": "complete",
"createdCell": function (td, cellData, rowData, row, col) { "createdCell": function (td, cellData, rowData, row, col) {
if (cellData === 0) { if (cellData === 1 && rowData['exists']) {
$(td).html('<button class="btn btn-xs btn-dark btn-download pull-left" data-id="' + rowData['row_id'] + '" disabled><i class="fa fa-spinner fa-spin fa-fw"></i> Processing</button>'); $(td).html('<button class="btn btn-xs btn-success pull-left" data-id="' + rowData['row_id'] + '"><i class="fa fa-file-download fa-fw"></i> Download</button>');
} else if (cellData === 1 && rowData['exists']) { } else if (cellData === 0) {
$(td).html('<button class="btn btn-xs btn-dark btn-download pull-left" data-id="' + rowData['row_id'] + '"><i class="fa fa-file-download fa-fw"></i> Download</button>'); $(td).html('<span class="btn btn-xs btn-dark pull-left" data-id="' + rowData['row_id'] + '" disabled><i class="fa fa-spinner fa-spin fa-fw"></i> Processing</span>');
} else if (cellData === -1) {
$(td).html('<span class="btn btn-xs btn-dark pull-left" data-id="' + rowData['row_id'] + '" disabled><i class="fa fa-exclamation-circle fa-fw"></i> Failed</span>');
} else { } else {
$(td).html('<button class="btn btn-xs btn-dark pull-left" data-id="' + rowData['row_id'] + '" disabled><i class="fa fa-question-circle fa-fw"></i> Not Found</button>'); $(td).html('<span class="btn btn-xs btn-dark pull-left" data-id="' + rowData['row_id'] + '" disabled><i class="fa fa-question-circle fa-fw"></i> Not Found</span>');
} }
}, },
"width": "8%", "width": "8%",
@ -105,9 +107,11 @@ export_table_options = {
"targets": [6], "targets": [6],
"data": null, "data": null,
"createdCell": function (td, cellData, rowData, row, col) { "createdCell": function (td, cellData, rowData, row, col) {
var disabled = ''; if (rowData['complete'] !== 0) {
if (!rowData['complete']) { disabled = 'disabled'; } $(td).html('<button class="btn btn-xs btn-danger pull-left" data-id="' + rowData['row_id'] + '"><i class="fa fa-trash-o fa-fw"></i> Delete</button>');
$(td).html('<button class="btn btn-xs btn-danger btn-edit pull-left" data-id="' + rowData['row_id'] + '" ' + disabled + '><i class="fa fa-trash-o fa-fw"></i> Delete</button>'); } else {
$(td).html('<span class="btn btn-xs btn-danger pull-left" data-id="' + rowData['row_id'] + '" disabled><i class="fa fa-trash-o fa-fw"></i> Delete</span>');
}
}, },
"width": "8%", "width": "8%",
"className": "export_delete" "className": "export_delete"
@ -123,7 +127,7 @@ export_table_options = {
showMsg(msg, false, false, 0) showMsg(msg, false, false, 0)
}, },
"rowCallback": function (row, rowData, rowIndex) { "rowCallback": function (row, rowData, rowIndex) {
if (rowData['complete'] !== 1) { if (rowData['complete'] === 0) {
$(row).addClass('current-activity-row'); $(row).addClass('current-activity-row');
} }
} }