Fuel Log Match
This commit is contained in:
@@ -34,7 +34,7 @@
|
||||
{
|
||||
var viewModel = Model[i];
|
||||
<tr id="fuellog-@i" @if (viewModel.PreviouslyAdded && viewModel.LogId != null) { <text>class="complete"</text>}>
|
||||
@using (Html.BeginForm("Match", "FuelLog", FormMethod.Post))
|
||||
@using (Html.BeginForm("ImportMatch", "FuelLog", FormMethod.Post))
|
||||
{
|
||||
<input type="hidden" name="fuelLogId" value="@viewModel.FuelLogId"/>
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
@{
|
||||
ViewBag.Title = "Fuel Logs";
|
||||
var grid = new WebGrid(Model.Logs, rowsPerPage: 45);
|
||||
var grid = new WebGrid(Model.FuelLogs, rowsPerPage: 45);
|
||||
var parameters = new {Model.Year, Model.Month};
|
||||
}
|
||||
@section Styles {
|
||||
@@ -43,23 +43,21 @@
|
||||
grid.Columns(
|
||||
grid.Column("Date", format: item => item.Date.ToString("d")),
|
||||
grid.Column("DriverFullName", "Driver Name"),
|
||||
grid.Column("TagNumber"),
|
||||
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.Log != null
|
||||
? Html.ActionLink("View Log", "Details", "Log", new {id = item.Log.LogId}, new {@class = "btn btn-mini", target="_blank"})
|
||||
@(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"}))
|
||||
</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>)),
|
||||
</text>)),
|
||||
htmlAttributes: new { @class = "table table-striped table-bordered table-hover table-condensed"},
|
||||
numericLinksCount: 20
|
||||
)
|
||||
</div>
|
||||
@if (!Model.Logs.Any())
|
||||
@if (!Model.FuelLogs.Any())
|
||||
{
|
||||
<div>
|
||||
No results.
|
||||
|
||||
@@ -0,0 +1,137 @@
|
||||
@using MileageTraker.Web.ViewModels.FuelLog
|
||||
@model MatchViewModel
|
||||
|
||||
@{
|
||||
ViewBag.Title = "Match Fuel Log";
|
||||
var fuelLog = Model.FuelLog;
|
||||
var matchedLogs = Model.MatchedLogs;
|
||||
var currentlyMatchedLog = Model.CurrentlyMatchedLog;
|
||||
var logViewModel = fuelLog.GetLogViewModel();
|
||||
//logViewModel.LogType = MileageLogType.GasPurchase;
|
||||
}
|
||||
@section Styles
|
||||
{
|
||||
<link href="@Url.Content("~/Content/font-awesome.min.css")" rel="stylesheet" type="text/css" />
|
||||
}
|
||||
|
||||
@Html.Partial("_StatusMessage")
|
||||
|
||||
<h2>@ViewBag.Title</h2>
|
||||
|
||||
<p id="page-match-status"></p>
|
||||
|
||||
<table id="fuellogs" class="table table-striped table-bordered table-hover table-condensed">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Date</th>
|
||||
<th>Driver</th>
|
||||
<th>Tag Number</th>
|
||||
<th>Odometer</th>
|
||||
<th>Gas Purchased</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>@Html.ValueFor(x => fuelLog.Date, "{0:d}")</td>
|
||||
<td>@Html.ValueFor(x => fuelLog.DriverFullName)</td>
|
||||
<td>@Html.ValueFor(x => fuelLog.TagNumber) @if(string.IsNullOrEmpty(fuelLog.VehicleId)) { <span class="label label-warning"><i class="icon-warning-sign warning"></i> No Matching Vehicle</span>} </td>
|
||||
<td>@Html.ValueFor(x => fuelLog.Odometer)</td>
|
||||
<td>@Html.ValueFor(x => fuelLog.GasPurchased, "{0:0.000}")</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@if (currentlyMatchedLog != null)
|
||||
{
|
||||
<h5>Currently Matched Mileage Log</h5>
|
||||
|
||||
<table id="currentlymatchedlog" class="table table-striped table-bordered table-hover table-condensed">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Date</th>
|
||||
<th>Driver</th>
|
||||
<th>Tag Number</th>
|
||||
<th>Odometer</th>
|
||||
<th>Gas Purchased</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="@if (!currentlyMatchedLog.DateMatch)
|
||||
{<text>nomatch</text>}else{<text>match</text>}">@Html.ValueFor(x => currentlyMatchedLog.Date, "{0:d}")</td>
|
||||
<td class="@if (!currentlyMatchedLog.UserFullNameMatch)
|
||||
{<text>nomatch</text>}else{<text>match</text>}">@Html.ValueFor(x => currentlyMatchedLog.UserFullName)</td>
|
||||
<td class="@if (!currentlyMatchedLog.VehicleTagMatch)
|
||||
{<text>nomatch</text>}else{<text>match</text>}">@Html.ValueFor(x => currentlyMatchedLog.VehicleTagNumber)</td>
|
||||
<td class="@if (!currentlyMatchedLog.OdometerMatch)
|
||||
{<text>nomatch</text>}else{<text>match</text>}">@Html.ValueFor(x => currentlyMatchedLog.EndOdometer)</td>
|
||||
<td class="@if (!currentlyMatchedLog.GasPurchasedMatch)
|
||||
{<text>nomatch</text>}else{<text>match</text>}">@Html.ValueFor(x => currentlyMatchedLog.GasPurchased, "{0:0.000}")</td>
|
||||
<td>@Html.ActionLink("Details", "Details", "Log", new { id = currentlyMatchedLog.LogId }, new { @class = "btn btn-mini", target="_blank" })</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
|
||||
@if (!matchedLogs.Any())
|
||||
{
|
||||
if (currentlyMatchedLog == null)
|
||||
{
|
||||
<p>
|
||||
No matches.
|
||||
</p>
|
||||
}
|
||||
else
|
||||
{
|
||||
<p>
|
||||
No additional matches.
|
||||
</p>
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
<h5>Matching Mileage Logs based on Date, Vehicle, and Gas Purchased</h5>
|
||||
|
||||
<table id="matchedlogs" class="table table-striped table-bordered table-hover table-condensed">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Date</th>
|
||||
<th>Driver</th>
|
||||
<th>Tag Number</th>
|
||||
<th>Odometer</th>
|
||||
<th>Gas Purchased</th>
|
||||
<th>Match</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var matchedLog in matchedLogs)
|
||||
{
|
||||
<tr>
|
||||
|
||||
<td class="@if (!matchedLog.DateMatch)
|
||||
{<text>nomatch</text>}else{<text>match</text>}">@Html.ValueFor(x => matchedLog.Date, "{0:d}")</td>
|
||||
<td class="@if (!matchedLog.UserFullNameMatch)
|
||||
{<text>nomatch</text>}else{<text>match</text>}">@Html.ValueFor(x => matchedLog.UserFullName)</td>
|
||||
<td class="@if (!matchedLog.VehicleTagMatch)
|
||||
{<text>nomatch</text>}else{<text>match</text>}">@Html.ValueFor(x => matchedLog.VehicleTagNumber)</td>
|
||||
<td class="@if (!matchedLog.OdometerMatch)
|
||||
{<text>nomatch</text>}else{<text>match</text>}">@Html.ValueFor(x => matchedLog.EndOdometer)</td>
|
||||
<td class="@if (!matchedLog.GasPurchasedMatch)
|
||||
{<text>nomatch</text>}else{<text>match</text>}">@Html.ValueFor(x => matchedLog.GasPurchased, "{0:0.000}")</td>
|
||||
<td>@using (Html.BeginForm("Match", "FuelLog", FormMethod.Post))
|
||||
{
|
||||
<input type="hidden" name="fuelLogId" value="@fuelLog.FuelLogId"/>
|
||||
<input type="hidden" name="logId" value="@matchedLog.LogId"/>
|
||||
<input type="submit" class="btn btn-mini" value="Match"/>
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
@Html.Partial("MatchLogViewModelPartial", logViewModel)
|
||||
@@ -0,0 +1,17 @@
|
||||
@using MileageTraker.Web.ViewModels.Log
|
||||
@model LogViewModel
|
||||
|
||||
@{
|
||||
Layout = null;
|
||||
}
|
||||
|
||||
@using (Html.BeginForm("Create", "Log", FormMethod.Post, new {@class="form-inline"}))
|
||||
{
|
||||
@Html.HiddenFor(m => m.CityName)
|
||||
@Html.HiddenFor(m => m.UserFullName)
|
||||
@Html.HiddenFor(m => m.EndOdometer)
|
||||
@Html.HiddenFor(m => m.VehicleId)
|
||||
@Html.TextBoxFor(m => m.Date, "{0:d}", new { @type = "hidden" })
|
||||
@Html.HiddenFor(m => m.GasPurchased)
|
||||
<p>Correct mileage log doesn't exist? <input type="submit" class="btn" value="Create New Mileage Log"/></p>
|
||||
}
|
||||
@@ -19,7 +19,8 @@
|
||||
<script src="@Url.Content("~/Scripts/jquery.numeric.js")" type="text/javascript"></script>
|
||||
<script src="@Url.Content("~/Scripts/jquery-ui-1.10.4.custom.min.js")" type="text/javascript"></script>
|
||||
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
|
||||
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
|
||||
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
|
||||
<script src="@Url.Content("~/Scripts/jquery.qtip.min.js")" type="text/javascript"></script>
|
||||
<script src="@Url.Content("~/Scripts/Shared/Site.js")" type="text/javascript"></script>
|
||||
@RenderSection("Scripts", false)
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user