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
+36 -30
View File
@@ -1,4 +1,5 @@
@model IList<MileageTraker.Web.Models.FuelLog>
@using MileageTraker.Web.ViewModels.FuelLog
@model IList<ImportFuelLogViewModel>
@{
ViewBag.Title = "Import Fuel Logs";
@@ -8,58 +9,63 @@
<link href="@Url.Content("~/Content/font-awesome.min.css")" rel="stylesheet" type="text/css" />
}
@{ Html.RenderPartial("BackToLogs"); }
@Html.Partial("_StatusMessage")
<h2>@ViewBag.Title</h2>
<p>Driver: <strong>@ViewData["UserFullName"]</strong></p>
<h5>Matching Mileage Logs based on Date, Vehicle, and Gas Purchased</h5>
<p id="page-import-status"></p>
<p id="page-match-status"></p>
<table id="logs" class="table table-striped table-bordered table-hover table-condensed">
<table id="fuellogs" class="table table-striped table-bordered table-hover table-condensed">
<thead>
<tr>
<th>Import Status</th>
<th style="width:20%"></th>
<th>Vehicle ID</th>
<th>End Odometer</th>
<th>Type</th>
<th>Destination City</th>
<th>Purpose</th>
<th>Notes</th>
<th>Gas Purchased</th>
<th>Match Status</th>
<th style="width:15%"></th>
<th>Date</th>
<th>Driver</th>
<th>Tag Number</th>
<th>Odometer</th>
<th>MPG</th>
<th>Gas Purchased</th>
<th>Total Price</th>
</tr>
</thead>
@for (var i = 0; i < Model.Count; i++)
{
var viewModel = Model[i];
<tr id="log-@i">
@using (Html.BeginForm("ImportCreate", "Log", FormMethod.Post))
<tr id="fuellog-@i" @if (viewModel.PreviouslyAdded && viewModel.LogId != null) { <text>class="complete"</text>}>
@using (Html.BeginForm("Match", "FuelLog", FormMethod.Post))
{
@Html.EditorFor(x => viewModel)
<input type="hidden" name="fuelLogId" value="@viewModel.FuelLogId"/>
}
<td class="import-status"></td>
<td class="import-message"></td>
<td>@Html.ValueFor(x => viewModel.VehicleId)</td>
<td>@Html.ValueFor(x => viewModel.EndOdometer)</td>
<td>@Html.ValueFor(x => viewModel.LogType)</td>
<td>@Html.ValueFor(x => viewModel.CityName)</td>
<td>@Html.ValueFor(x => viewModel.Purpose)</td>
<td>@Html.ValueFor(x => viewModel.Notes)</td>
<td>@Html.ValueFor(x => viewModel.GasPurchased)</td>
<td>@Html.ValueFor(x => viewModel.Date)</td>
<td class="match-status">
@if (viewModel.PreviouslyAdded)
{
<span class="label label-info">Previously Imported</span>
}
@if (viewModel.LogId != null)
{
@Html.Partial("ImportMatchedLog", new ImportMatchedLogViewModel { LogId = viewModel.LogId.Value })
}
</td>
<td class="match-message"></td>
<td>@Html.ValueFor(x => viewModel.Date, "{0:d}")</td>
<td>@Html.ValueFor(x => viewModel.DriverFullName)</td>
<td>@Html.ValueFor(x => viewModel.TagNumber)</td>
<td>@Html.ValueFor(x => viewModel.Odometer)</td>
<td>@Html.ValueFor(x => viewModel.MPG)</td>
<td>@Html.ValueFor(x => viewModel.GasPurchased, "{0:0.000}")</td>
<td>@Html.ValueFor(x => viewModel.TotalPrice, "{0:C}")</td>
</tr>
}
</table>
@section Scripts
{
<script src="@Url.Content("~/Scripts/Shared/ImportCreate.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/Shared/FuelLogImport.js")" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
importLogs("@ViewData["UserFullName"]");
importFuelLogs();
});
</script>
}