Files
MileageTraker/Web/Views/FuelLog/Index.cshtml
T
2015-10-13 20:39:51 -04:00

68 lines
2.3 KiB
Plaintext

@using MileageTraker.Web.Utility
@model MileageTraker.Web.ViewModels.FuelLog.FuelLogResultsViewModel
@{
ViewBag.Title = "Fuel Logs";
var grid = new WebGrid(Model.FuelLogs, rowsPerPage: 45);
var queryParams = new {FiscalYear = Model.Year, Model.Month, Model.Unmatched};
}
@section Scripts {
<script type="text/javascript">
var availableLogYearMonths = @Html.Raw(Json.Encode(Model.AvailableYearMonths));
@if (Model.Year != null)
{
<text>var selectedYear = "@Model.Year";</text>
<text>var selectedMonth = "@Model.Month";</text>
}
</script>
}
@Html.Partial("_StatusMessage")
<div class="btn-toolbar pull-right" style="width:400px">
@using (Html.BeginForm("Index", "FuelLog", FormMethod.Get, new { id = "filter", @class = "form" }))
{
@Html.EditorForModel()
}
</div>
<h2 id="fuellog-title"><i class="fa fa-tachometer"></i> @ViewBag.Title</h2>
<div class="btn-toolbar clearfix">
@Html.ActionLink("Import", "ImportUpload", null, new { @class = "btn" })
@Html.ActionLink("Export", "Export", queryParams, new { @class = "btn" })
</div>
<div>
@grid.GetHtml(columns:
grid.Columns(
grid.Column("Date", format: item => item.Date.ToString("d")),
grid.Column("DriverFullName", "Driver Name"),
grid.Column("TagNumber", "Tag Number"),
grid.Column("Odometer"),
grid.Column("MPG"),
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("Log", "Matched Log", @<text>
@(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"},
numericLinksCount: 20
)
<div class="center-content webgrid-footer">
Total Results: @Model.FuelLogs.Count()
</div>
</div>
@if (!Model.FuelLogs.Any())
{
<div>
No results.
</div>
}