From 750450f1f9f6e037a42997db54aa120a5c93b5f9 Mon Sep 17 00:00:00 2001 From: James Kolpack Date: Wed, 21 May 2014 10:55:24 -0400 Subject: [PATCH] Correct reports not having all query parameters Other small corrections --- Web/Scripts/Shared/Site.js | 3 +- Web/Views/City/Index.cshtml | 4 +- Web/Views/Log/Index.cshtml | 7 ++-- Web/Views/Log/MonthlyDriverMileage.cshtml | 18 +-------- Web/Views/Log/MonthlyVehicleMileage.cshtml | 18 +-------- Web/Views/Purpose/Index.cshtml | 2 + Web/Views/{Log => Shared}/BackToLogs.cshtml | 0 .../DisplayTemplates/LogQueryViewModel.cshtml | 37 +++++++++++++++++++ .../LogResultsViewModel.cshtml | 5 +-- Web/Web.csproj | 3 +- 10 files changed, 54 insertions(+), 43 deletions(-) rename Web/Views/{Log => Shared}/BackToLogs.cshtml (100%) create mode 100644 Web/Views/Shared/DisplayTemplates/LogQueryViewModel.cshtml diff --git a/Web/Scripts/Shared/Site.js b/Web/Scripts/Shared/Site.js index 67d4577..a298ddc 100644 --- a/Web/Scripts/Shared/Site.js +++ b/Web/Scripts/Shared/Site.js @@ -92,7 +92,7 @@ $(function() { // Add active class to nav $(function() { var idNavActiveRegex = { - 'log-nav': /\/log/i, + 'log-nav': /\/log|\/City|\/Purpose/i, 'vehicle-nav': /\/vehicle/i, 'user-nav': /\/user/i }; @@ -116,6 +116,7 @@ function addButtonIcons () { 'Delete': 'trash', 'Add': 'plus', 'Export': 'download', + 'Import': 'upload', 'Driver Mileage': 'user', 'Vehicle Mileage': 'car' }; diff --git a/Web/Views/City/Index.cshtml b/Web/Views/City/Index.cshtml index e96a520..bac13a0 100644 --- a/Web/Views/City/Index.cshtml +++ b/Web/Views/City/Index.cshtml @@ -4,8 +4,10 @@ ViewBag.Title = "Cities by County"; } -@Html.Partial("_StatusMessage") +@{ Html.RenderPartial("BackToLogs"); } +@Html.Partial("_StatusMessage") +

@ViewBag.Title

diff --git a/Web/Views/Log/Index.cshtml b/Web/Views/Log/Index.cshtml index ae44678..be45f57 100644 --- a/Web/Views/Log/Index.cshtml +++ b/Web/Views/Log/Index.cshtml @@ -4,6 +4,7 @@ @{ 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 { @@ -34,7 +35,7 @@
@Html.ActionLink("Add New Log", "Create", null, new { @class = "btn" }) - @Html.ActionLink("Export", "Export", new { Model.Year, Model.Month, Model.LogType, Model.MonthRange, Model.VehicleId, Model.EmployeeName }, new { @class = "btn" }) + @Html.ActionLink("Export", "Export", parameters, new { @class = "btn" }) @Html.ActionLink("Purposes", "Index", "Purpose", null, new { @class = "btn" }) @Html.ActionLink("Cities", "Index", "City", null, new { @class = "btn" }) @Html.ActionLink("Import", "ImportUpload", null, new { @class = "btn"}) @@ -43,10 +44,10 @@ Report
diff --git a/Web/Views/Log/MonthlyDriverMileage.cshtml b/Web/Views/Log/MonthlyDriverMileage.cshtml index 0c36d66..bd09a2d 100644 --- a/Web/Views/Log/MonthlyDriverMileage.cshtml +++ b/Web/Views/Log/MonthlyDriverMileage.cshtml @@ -9,23 +9,7 @@

@ViewBag.Title

-
-
-
@Html.DisplayNameFor(m => m.Query.Year)
-
@Html.Encode(Model.Query.Year)
-
-
-
@Html.DisplayNameFor(m => m.Query.Month)
-
@Html.Encode(Model.Query.Month)
-
- @if (Model.Query.LogType.HasValue) - { -
-
Type
-
@Html.Encode(Model.Query.LogType)
-
- } -
+@Html.DisplayFor(m => m.Query) diff --git a/Web/Views/Log/MonthlyVehicleMileage.cshtml b/Web/Views/Log/MonthlyVehicleMileage.cshtml index 0541b42..51b0fc1 100644 --- a/Web/Views/Log/MonthlyVehicleMileage.cshtml +++ b/Web/Views/Log/MonthlyVehicleMileage.cshtml @@ -9,23 +9,7 @@

@ViewBag.Title

-
-
-
@Html.DisplayNameFor(m => m.Query.Year)
-
@Html.Encode(Model.Query.Year)
-
-
-
@Html.DisplayNameFor(m => m.Query.Month)
-
@Html.Encode(Model.Query.Month)
-
- @if (Model.Query.LogType.HasValue) - { -
-
Type
-
@Html.Encode(Model.Query.LogType)
-
- } -
+@Html.DisplayFor(m => m.Query)
diff --git a/Web/Views/Purpose/Index.cshtml b/Web/Views/Purpose/Index.cshtml index c777480..556d60b 100644 --- a/Web/Views/Purpose/Index.cshtml +++ b/Web/Views/Purpose/Index.cshtml @@ -5,6 +5,8 @@ var grid = new WebGrid(Model, canSort: false, canPage: false); } +@{ Html.RenderPartial("BackToLogs"); } + @Html.Partial("_StatusMessage")

@ViewBag.Title

diff --git a/Web/Views/Log/BackToLogs.cshtml b/Web/Views/Shared/BackToLogs.cshtml similarity index 100% rename from Web/Views/Log/BackToLogs.cshtml rename to Web/Views/Shared/BackToLogs.cshtml diff --git a/Web/Views/Shared/DisplayTemplates/LogQueryViewModel.cshtml b/Web/Views/Shared/DisplayTemplates/LogQueryViewModel.cshtml new file mode 100644 index 0000000..82a2f6b --- /dev/null +++ b/Web/Views/Shared/DisplayTemplates/LogQueryViewModel.cshtml @@ -0,0 +1,37 @@ +@model MileageTraker.Web.ViewModels.Log.LogQueryViewModel + +
+
+
@Html.DisplayNameFor(m => m.Year)
+
@Html.Encode(Model.Year)
+
+
+
@Html.DisplayNameFor(m => m.Month)
+
@Html.Encode(Model.Month)
+
+
+
@Html.DisplayNameFor(m => m.MonthRange)
+
@Html.Encode(Model.MonthRange)
+
+ @if (Model.LogType.HasValue) + { +
+
Type
+
@Html.Encode(Model.LogType)
+
+ } + @if (!string.IsNullOrEmpty(Model.VehicleId)) + { +
+
Vehicle
+
@Html.Encode(Model.VehicleId)
+
+ } + @if (!string.IsNullOrEmpty(Model.EmployeeName)) + { +
+
Driver
+
@Html.Encode(Model.EmployeeName)
+
+ } +
\ No newline at end of file diff --git a/Web/Views/Shared/EditorTemplates/LogResultsViewModel.cshtml b/Web/Views/Shared/EditorTemplates/LogResultsViewModel.cshtml index f3ee738..15d802f 100644 --- a/Web/Views/Shared/EditorTemplates/LogResultsViewModel.cshtml +++ b/Web/Views/Shared/EditorTemplates/LogResultsViewModel.cshtml @@ -1,5 +1,4 @@ -@using System.Xml -@using MileageTraker.Web.Models +@using MileageTraker.Web.Models @using MileageTraker.Web.Utility @model MileageTraker.Web.ViewModels.Log.LogResultsViewModel @{ @@ -33,7 +32,7 @@ @Html.TextBoxFor(m => m.VehicleId, new {@class="search-query input-mini", placeholder="Vehicle"})
- @Html.Label("EmployeeName", "User") + @Html.Label("EmployeeName", "Driver") @Html.TextBoxFor(m => m.EmployeeName, new {@class="search-query input-small", placeholder="User"})
diff --git a/Web/Web.csproj b/Web/Web.csproj index a3df36c..b90ce12 100644 --- a/Web/Web.csproj +++ b/Web/Web.csproj @@ -263,6 +263,7 @@ + @@ -332,7 +333,7 @@ - +