Log Import for CreateLog

This commit is contained in:
2014-02-05 15:02:10 -05:00
parent 7976fe04c3
commit 042d3dd476
13 changed files with 349 additions and 27 deletions
+62
View File
@@ -0,0 +1,62 @@
@model IList<MileageTraker.Web.ViewModels.LogImportViewModel>
@{
ViewBag.Title = "Import Logs";
}
@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-import-status"></p>
<table id="logs" 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>Date</th>
</tr>
</thead>
@for (var i = 0; i < Model.Count; i++)
{
var viewModel = Model[i];
<tr id="log-@i">
@using (Html.BeginForm("ImportCreate", "CreateLog", FormMethod.Post))
{
@Html.EditorFor(x => viewModel)
}
<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>
</tr>
}
</table>
@section Scripts
{
<script src="@Url.Content("~/Scripts/Shared/ImportCreate.js")" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
importLogs(null);
});
</script>
}
+9
View File
@@ -0,0 +1,9 @@
@model MileageTraker.Web.ViewModels.LogImportViewModel
@{
Layout = null;
}
@using (Html.BeginForm("ImportFix", "CreateLog", FormMethod.Post, new{target="_blank"}))
{
@Html.EditorForModel()
<input type="submit" value="Fix" class="btn btn-mini" />
}
+20
View File
@@ -0,0 +1,20 @@
@model MileageTraker.Web.ViewModels.CreateLog.ImportUploadViewModel
@{
ViewBag.Title = "Import Logs";
}
@Html.Partial("_StatusMessage")
<h2 class="center-content">@ViewBag.Title</h2>
<p class="center-content">Download the import template: @Html.ActionLink("Excel Template", "ImportTemplate")
</p>
@using (Html.BeginForm("Import", "CreateLog", FormMethod.Post, new { enctype="multipart/form-data", @class = "form-horizontal well center-content", style="max-width:440px"}))
{
@Html.Partial("_ValidationSummary")
@Html.EditorForModel()
<div class="form-actions">
<input type="submit" value="Import" class="btn btn-primary" />
</div>
}
+4
View File
@@ -23,3 +23,7 @@
<div id="RecentLogs" class="center-content well">
</div>
<div class="center-content" style="text-align: center">
@Html.ActionLink("Import", "ImportUpload", new {}, new { @class = "btn"})
</div>
+4 -1
View File
@@ -36,7 +36,10 @@
{
var viewModel = Model[i];
<tr id="log-@i">
<form>@Html.EditorFor(x => viewModel)</form>
@using (Html.BeginForm("ImportCreate", "Log", FormMethod.Post))
{
@Html.EditorFor(x => viewModel)
}
<td class="import-status"></td>
<td class="import-message"></td>
<td>@Html.ValueFor(x => viewModel.VehicleId)</td>