@using MileageTraker.Web.Utility
@model MileageTraker.Web.ViewModels.Log.LogResultsViewModel
@{
ViewBag.Title = "Logs";
var grid = new WebGrid(Model.Logs, rowsPerPage: 45);
var parameters = new {Model.Year, Model.Month, Model.LogType, Model.MonthRange, Model.VehicleId, Model.EmployeeName};
}
@section Styles {
}
@section Scripts {
}
@Html.Partial("_StatusMessage")
@grid.GetHtml(columns:
grid.Columns(
grid.Column("VehicleId", "Vehicle ID", item => Html.ActionLink((string)item.VehicleId, "DetailsPartial", "Vehicle", new { id = item.VehicleId }, new { @class = "qtip-modal" })),
grid.Column("EndOdometer", "End ODO"),
grid.Column("Miles", canSort: false, format: item =>
{
if (item.PreviousLogId != null)
{
string miles = (item.Miles).ToString();
return Html.ActionLink(miles, "DetailsPartial", new { id = item.PreviousLogId }, new { @class = "qtip-modal" });
}
return Html.Raw("
? ");
}),
grid.Column("LogType", "Type", item => ((Enum)item.LogType).GetDisplayShortName()),
grid.Column("GasPurchased", "Gas", item => item.GasPurchased > 0 ? String.Format("{0:0.000}", item.GasPurchased) : string.Empty),
grid.Column("Date", format: item => item.Date.ToString("d")),
grid.Column("CityName", "City Name"),
grid.Column("PurposePurpose", "Purpose", item =>
{
if (item.Notes != null)
{
return Html.Raw("
" + Html.Encode(item.PurposePurpose) + " ");
}
return item.PurposePurpose;
}),
grid.Column("Driver Name", format: item => item.UserFullName),
grid.Column("Total Results: " + Model.Logs.Count(), canSort:false, format:
@
@Html.ActionLink("Edit", "Edit", new { id = item.LogId }, new { @class = "btn btn-mini" })
@Html.ActionLink("Details", "Details", new { id = item.LogId }, new { @class = "btn btn-mini" })
@Html.ActionLink("Delete", "Delete", new { id = item.LogId }, new { @class = "btn btn-mini" })
)
),
htmlAttributes: new { @class = "table table-striped table-bordered table-hover table-condensed"},
numericLinksCount: 20
)
@if (!Model.Logs.Any())
{