Fuel Log Import basic functionality

This commit is contained in:
2015-09-18 13:02:15 -04:00
parent 4987215f0b
commit e3590b29e5
18 changed files with 438 additions and 59 deletions
+67
View File
@@ -0,0 +1,67 @@
@using MileageTraker.Web.Utility
@model MileageTraker.Web.ViewModels.FuelLog.ResultsViewModel
@{
ViewBag.Title = "Fuel Logs";
var grid = new WebGrid(Model.Logs, rowsPerPage: 45);
var parameters = new {Model.Year, Model.Month};
}
@section Styles {
<link href="@Url.Content("~/Content/VehicleColors.css")" rel="stylesheet" type="text/css" />
}
@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">
@using (Html.BeginForm("Index", "Log", FormMethod.Get, new { id = "filter", @class = "form" }))
{
<div class="">
@*@Html.EditorForModel()*@
</div>
}
</div>
<h2 id="log-title">@ViewBag.Title</h2>
<div class="btn-toolbar clearfix">
@Html.ActionLink("Import", "ImportUpload", null, new { @class = "btn" })
@Html.ActionLink("Export", "Export", parameters, 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"),
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.Log != null
? Html.ActionLink("View Log", "Details", "Log", new {id = item.Log.LogId}, new {@class = "btn btn-mini", target="_blank"})
: Html.ActionLink("Match", "Match", new {id = item.FuelLogId}, new {@class = "btn btn-warning btn-mini", target="_blank"}))
</text>),
grid.Column("Total Results: " + Model.Logs.Count(), canSort:false, format:
@<div class='btn-group'> @Html.ActionLink("Details", "Details", new { id = item.FuelLogId }, new { @class = "btn btn-mini" }) </div>)),
htmlAttributes: new { @class = "table table-striped table-bordered table-hover table-condensed"},
numericLinksCount: 20
)
</div>
@if (!Model.Logs.Any())
{
<div>
No results.
</div>
}