Match count update for import too
This commit is contained in:
@@ -43,6 +43,8 @@
|
|||||||
}
|
}
|
||||||
if (result.Action != undefined && result.Action != null) {
|
if (result.Action != undefined && result.Action != null) {
|
||||||
$('.match-status', $row).append(" " + result.Action);
|
$('.match-status', $row).append(" " + result.Action);
|
||||||
|
var $action = $("a[matchcount]", $row);
|
||||||
|
matchCountFunc.apply($action);
|
||||||
}
|
}
|
||||||
|
|
||||||
submitNext();
|
submitNext();
|
||||||
|
|||||||
@@ -83,12 +83,11 @@ $(function () {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// add get match count for all the current items
|
var matchCountFunc = function() {
|
||||||
$(function () {
|
|
||||||
var $requests = $("a[matchcount]").map(function() {
|
|
||||||
var $link = $(this);
|
var $link = $(this);
|
||||||
|
var url = $link.attr("matchcount");
|
||||||
return $.ajax({
|
return $.ajax({
|
||||||
url: $link.attr("matchcount"),
|
url: url,
|
||||||
success: function(matchcount) {
|
success: function(matchcount) {
|
||||||
if (matchcount > 0) {
|
if (matchcount > 0) {
|
||||||
$link.append(" <span class='badge badge-info'>" + matchcount + "</span>");
|
$link.append(" <span class='badge badge-info'>" + matchcount + "</span>");
|
||||||
@@ -97,7 +96,11 @@ $(function () {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
};
|
||||||
|
|
||||||
|
// add get match count for all the current items
|
||||||
|
$(function () {
|
||||||
|
var $requests = $("a[matchcount]").map(matchCountFunc);
|
||||||
$.when.apply($, $requests);
|
$.when.apply($, $requests);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,12 @@
|
|||||||
LogId = fuelLog.Log.LogId;
|
LogId = fuelLog.Log.LogId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MatchLinkViewModel(int fuelLogId, int? logId)
|
||||||
|
{
|
||||||
|
FuelLogId = fuelLogId;
|
||||||
|
LogId = logId;
|
||||||
|
}
|
||||||
|
|
||||||
public MatchLinkViewModel(ImportFuelLogViewModel viewModel)
|
public MatchLinkViewModel(ImportFuelLogViewModel viewModel)
|
||||||
{
|
{
|
||||||
FuelLogId = viewModel.FuelLogId;
|
FuelLogId = viewModel.FuelLogId;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
@using MileageTraker.Web.Utility
|
@using MileageTraker.Web.Utility
|
||||||
|
@using MileageTraker.Web.ViewModels.FuelLog
|
||||||
@model MileageTraker.Web.ViewModels.FuelLog.FuelLogResultsViewModel
|
@model MileageTraker.Web.ViewModels.FuelLog.FuelLogResultsViewModel
|
||||||
|
|
||||||
@{
|
@{
|
||||||
@@ -44,15 +45,7 @@
|
|||||||
grid.Column("MPG"),
|
grid.Column("MPG"),
|
||||||
grid.Column("GasPurchased", "Gas Purchased", @<text>@String.Format("{0:0.000}", item.GasPurchased)</text>),
|
grid.Column("GasPurchased", "Gas Purchased", @<text>@String.Format("{0:0.000}", item.GasPurchased)</text>),
|
||||||
grid.Column("TotalPrice", "Total Price", @<text>@String.Format("{0:C}", item.TotalPrice)</text>),
|
grid.Column("TotalPrice", "Total Price", @<text>@String.Format("{0:C}", item.TotalPrice)</text>),
|
||||||
grid.Column("Log", "Matched Log", @<text>
|
grid.Column("Log", "Matched Log", item => @Html.Partial("MatchLink", new MatchLinkViewModel (item.FuelLogId, item.LogId)))),
|
||||||
@(item.LogId != null
|
|
||||||
? Html.ActionLink("View Match", "Match", new {id = item.FuelLogId}, new {@class = "btn btn-mini", target="_blank"})
|
|
||||||
: Html.ActionLink("Match", "Match", new {id = item.FuelLogId},
|
|
||||||
new {@class = "btn btn-warning btn-mini",
|
|
||||||
target="_blank",
|
|
||||||
matchcount=Url.Action("AvailableMatchCount", "FuelLog", new {id = item.FuelLogId})
|
|
||||||
}))
|
|
||||||
</text>)),
|
|
||||||
htmlAttributes: new { @class = "table table-striped table-bordered table-hover table-condensed"},
|
htmlAttributes: new { @class = "table table-striped table-bordered table-hover table-condensed"},
|
||||||
numericLinksCount: 20
|
numericLinksCount: 20
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user