Add filtering

Improve matching
This commit is contained in:
2015-09-25 11:15:57 -04:00
parent 5e90c6d330
commit 46dfaba731
14 changed files with 157 additions and 86 deletions
+10 -8
View File
@@ -1,12 +1,13 @@
function importFuelLogs() {
function matchFuelLogs() {
$('.breadcrumb').hide();
$('tr:not(.complete) .match-status').append('<span class="label">Pending</span');
var total = $("#fuellogs > tbody > tr:not(.complete)").length;
$('#page-match-status').html('<span class="label label-warning"><i class="fa fa-spinner fa-spin"></i> Matching In Progress</span> <strong>Keep page open until complete.</strong>');
$('#page-match-status').html('<span class="label label-warning"><i class="fa fa-spinner fa-spin"></i> Matching In Progress</span> for ' + total + ' fuel logs. <strong>Keep page open until complete.</strong>');
$('#page-match-status').after('<div class="progress progress-striped active"><div class="bar" style="width:0%"></div><div>');
submitNext();
var failureCount = 0;
var unmatchedCount = 0;
var errorCount = 0;
function submitNext() {
var $fuelLogs = $("#fuellogs > tbody > tr:not(.complete)");
@@ -32,12 +33,13 @@
else if (result.Status == "NoMatch" || result.Status == "Error") {
if (result.Status == "NoMatch") {
$('.match-status', $row).html('<span class="label label-warning">No Match</span>');
unmatchedCount++;
} else {
$('.match-status', $row).html('<span class="label label-important">Error</span>');
errorCount++;
$('.progress .bar').addClass('bar-warning');
}
$('.match-message', $row).text(result.Message);
failureCount++;
$('.progress .bar').addClass('bar-warning');
}
if (result.Action != undefined && result.Action != null) {
$('.match-status', $row).append(" " + result.Action);
@@ -50,11 +52,11 @@
$('.breadcrumb').show();
$('.progress').removeClass('progress-striped');
$('.progress').removeClass('active');
if (failureCount == 0) {
$('#page-match-status').html('<span class="label">Complete</span> with all matches.');
if (errorCount == 0) {
$('#page-match-status').html('<span class="label">Complete</span> ' + total + ' total with <strong>' + unmatchedCount + '</strong> left unmatched.');
$('.progress .bar').addClass('bar-success');
} else {
$('#page-match-status').html('<span class="label label-warning">Complete</span> but with errors. See details below.');
$('#page-match-status').html('<span class="label label-warning">Complete</span> with errors. See below.');
}
}
}