Files
MileageTraker/Web/Views/FuelLog/Match.cshtml
T
2015-09-22 21:11:47 -04:00

138 lines
4.4 KiB
Plaintext

@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)