Finish confirm page

This commit is contained in:
2012-12-16 15:06:57 -05:00
parent 7f7ae6d3c2
commit 5be12d783b
8 changed files with 120 additions and 79 deletions
+16 -4
View File
@@ -50,11 +50,23 @@ body {
margin-bottom: 10px; margin-bottom: 10px;
} }
.employeeName input {
width: 120px;
}
.form-horizontal .control-group.endOdometer { .form-horizontal .control-group.endOdometer {
margin-bottom: 0; margin-bottom: 0;
} }
.employeeName input {
width: 120px;
}
}
@media (max-width: 767px) {
.dl-horizontal dt {
float: left;
width: 110px;
text-align: right;
}
.dl-horizontal dd {
margin-left: 120px;
}
} }
+1 -1
View File
@@ -58,7 +58,7 @@ $(function () {
}); });
}); });
if ($("input#EmployeeName").length > 0) { if ($("input#EmployeeName").filter(':not(:hidden)').length > 0) {
$("input#EmployeeName") $("input#EmployeeName")
.after('<span id="icon-employee-history" class="add-on"><i class="icon-search" /></span>') .after('<span id="icon-employee-history" class="add-on"><i class="icon-search" /></span>')
+11
View File
@@ -2,6 +2,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.Linq; using System.Linq;
using System.Linq.Expressions;
using System.Reflection; using System.Reflection;
using System.Text; using System.Text;
using System.Web.Mvc; using System.Web.Mvc;
@@ -170,5 +171,15 @@ namespace MileageTraker.Web.Utility
{ {
return MvcHtmlString.Create(f + s); return MvcHtmlString.Create(f + s);
} }
public static MvcHtmlString DisplayNameFor<TModel, TProperty>(
this HtmlHelper<TModel> htmlHelper,
Expression<Func<TModel, TProperty>> expression
)
{
var metaData = ModelMetadata.FromLambdaExpression(expression, htmlHelper.ViewData);
var value = metaData.DisplayName ?? (metaData.PropertyName ?? ExpressionHelper.GetExpressionText(expression));
return MvcHtmlString.Create(value);
}
} }
} }
+72 -49
View File
@@ -1,9 +1,9 @@
@using MileageTraker.Web.Utility
@model MileageTraker.Web.ViewModels.ConfirmCreateLogViewModel @model MileageTraker.Web.ViewModels.ConfirmCreateLogViewModel
@{ @{
ViewBag.Title = "Confirm"; ViewBag.Title = "Confirm";
Layout = "~/Views/Shared/_Layout.cshtml"; Layout = "~/Views/Shared/_Layout.cshtml";
var endOdometerStyle = Model.PreviousOdometer != null ? "style=padding-bottom:0px;" : "";
} }
@section Styles @section Styles
{ {
@@ -17,69 +17,92 @@
<p class="alert">Please <strong>confirm</strong> - entry not complete until <strong>confirm</strong> clicked</p> <p class="alert">Please <strong>confirm</strong> - entry not complete until <strong>confirm</strong> clicked</p>
@if (Model.Miles == 0) @if (Model.Miles == 0)
{ {
<p class="alert"><span class="label label-important">Warning</span> No mileage being logged - <strong>is this a duplicate?</strong></p> <p class="alert"><span class="label label-warning">Warning</span> No mileage being logged - <strong>is this a duplicate?</strong></p>
} }
<div class="display-field-container vehicle-id"> <dl class="dl-horizontal vehicle-id">
<div class="display-label"> <dt>
@Html.LabelFor(model => model.VehicleId) @Html.DisplayNameFor(m => m.VehicleId)
</div> </dt>
<div class="display-field @Model.VehicleColor"> <dd>
@Html.Encode(Model.VehicleId) <span class="subscript">(@Model.VehicleType)</span> @Html.DisplayTextFor(m => m.VehicleId)
</div> <span class="label @Model.VehicleColor">@Html.DisplayTextFor(m => m.VehicleType)</span>
</div> </dd>
</dl>
@Html.HiddenFor(m => m.VehicleId) @Html.HiddenFor(m => m.VehicleId)
<div class="display-field-container endodometer" @endOdometerStyle> <dl class="dl-horizontal endodometer">
<div class="display-label"> <dt>
@Html.LabelFor(model => model.EndOdometer) @Html.DisplayNameFor(m => m.EndOdometer)
</div> </dt>
<div class="display-field"> <dd>
@Html.Encode(Model.EndOdometer) @Html.DisplayTextFor(m => m.EndOdometer)
@if (Model.PreviousOdometer != null) @if (Model.PreviousOdometer.HasValue)
{ {
<br/> <br/>
<span class="subscript @if (Model.Miles == 0) <small class="muted">
{ <text>label label-warning</text>}">@Html.Encode(Model.Miles) miles since <br /> @if (Model.Miles > 0)
@Html.Encode(Model.PreviousOdometer) on @Html.Encode(Model.PreviousDate.Value.ToShortDateString())</span> {
@Html.DisplayTextFor(m => m.Miles) <span>miles</span>
}
else
{
<span class="label label-warning">
@Html.DisplayTextFor(m => m.Miles) <span>miles</span>
</span>
}
since @Html.DisplayTextFor(m => m.PreviousOdometer)
on @Html.Encode(Model.PreviousDate.Value.ToShortDateString())
</small>
} }
</div> </dd>
</div> </dl>
<input type="hidden" name="EndOdometer" value="@Html.AttributeEncode(Model.EndOdometer)" /> @Html.HiddenFor(m => m.EndOdometer)
@Html.DisplayFor(model => model.LogType) @Html.DisplayFor(model => model.LogType)
@Html.HiddenFor(model => model.LogType.Value) @Html.HiddenFor(model => model.LogType.Value)
@Html.DisplayFor(model => model.EmployeeName)
<input type="hidden" name="EmployeeName" value="@Html.AttributeEncode(Model.EmployeeName)" />
@Html.DisplayFor(model => model.CityName)
<input type="hidden" name="CityName" value="@Html.AttributeEncode(Model.CityName)" />
<div class="display-field-container gas"> @Html.DisplayFor(model => model.EmployeeName)
<div class="display-label"> @Html.HiddenFor(model => model.EmployeeName)
@Html.LabelFor(model => model.GasPurchased)
</div> @Html.DisplayFor(model => model.CityName)
<div class="display-field"> @Html.HiddenFor(model => model.CityName)
<dl class="dl-horizontal gas">
<dt>
@Html.DisplayNameFor(m => m.GasPurchased)
</dt>
<dd>
@if (!string.IsNullOrEmpty(Model.GasPurchased)) @if (!string.IsNullOrEmpty(Model.GasPurchased))
{ {
@Model.GasPurchased <span class="units">Gallons</span> @Html.DisplayTextFor(m => m.GasPurchased) <small class="muted">Gallons</small>
} }
else else
{ {
<text>No Gas Purchased</text> <text>No Gas Purchased</text>
} }
<input type="hidden" name="GasPurchased" value="@Html.AttributeEncode(Model.GasPurchased)" /> </dd>
</div> </dl>
</div> @Html.HiddenFor(model => model.GasPurchased)
<div class="display-field-container date">
<div class="display-label">
@Html.LabelFor(model => model.Date) <dl class="dl-horizontal date">
</div> <dt>
<div class="display-field"> @Html.DisplayNameFor(m => m.Date)
@Html.Encode(Model.Date) </dt>
<span class="muted">(@Html.Encode(Model.DateHowLongAgo))</span> <dd>
<input type="hidden" name="Date" value="@Html.AttributeEncode(Model.Date)" /> @Html.DisplayTextFor(m => m.Date)
</div> <small class="muted">(@Html.DisplayTextFor(m => m.DateHowLongAgo))</small>
</div> </dd>
</dl>
<input type="submit" name="Edit" value="Back" class="btn" /> @Html.HiddenFor(model => model.Date)
<input type="submit" name="Confirm" value="Confirm" class="btn btn-primary" />
<dl class="dl-horizontal">
<dt>
<input type="submit" name="Edit" value="Back" class="btn" />
</dt>
<dd>
<input type="submit" name="Confirm" value="Confirm" class="btn btn-primary" />
</dd>
</dl>
</fieldset> </fieldset>
} }
+7 -15
View File
@@ -5,24 +5,16 @@
Layout = "~/Views/Shared/_Layout.cshtml"; Layout = "~/Views/Shared/_Layout.cshtml";
} }
@section Styles
{
<link href="@Url.Content("~/Content/CreateLog.Index.css")" rel="stylesheet" type="text/css" />
}
@{ @{
@:<fieldset> <h4>@ViewBag.Title</h4>
<legend>@ViewBag.Title</legend>
<p> <p>
You've successfully created an entry You've successfully created an entry
for <strong>@Html.Encode(Model.EmployeeName)</strong> for <strong>@Html.DisplayTextFor(m => m.EmployeeName)</strong>
traveling to <strong>@Html.Encode(Model.CityName)</strong> traveling to <strong>@Html.DisplayTextFor(m => m.CityName)</strong>
on <strong>@Html.Encode(Model.Date)</strong> on <strong>@Html.DisplayTextFor(m => m.Date)</strong>
in VehicleId <strong>@Html.Encode(Model.VehicleId)</strong> in Vehicle Id <strong>@Html.DisplayTextFor(m => m.VehicleId)</strong>
</p> </p>
<p> <p>
@Html.ActionLink("Create another", "Index", null, new { @class = "btn" }) @Html.ActionLink("Create another", "Index", null, new { @class = "btn" })
</p> </p>
@:</fieldset>
} }
+4 -3
View File
@@ -1,4 +1,5 @@
@model MileageTraker.Web.ViewModels.EmployeeMileageViewModel @using MileageTraker.Web.Utility
@model MileageTraker.Web.ViewModels.EmployeeMileageViewModel
@{ @{
ViewBag.Title = "Employee Mileage Report"; ViewBag.Title = "Employee Mileage Report";
} }
@@ -16,11 +17,11 @@
<div> <div>
<dl class="inline"> <dl class="inline">
<dt>Year</dt> <dt>@Html.DisplayNameFor(m => m.Query.Year)</dt>
<dd>@Html.Encode(Model.Query.Year)</dd> <dd>@Html.Encode(Model.Query.Year)</dd>
</dl> </dl>
<dl class="inline"> <dl class="inline">
<dt>Month</dt> <dt>@Html.DisplayNameFor(m => m.Query.Month)</dt>
<dd>@Html.Encode(Model.Query.Month)</dd> <dd>@Html.Encode(Model.Query.Month)</dd>
</dl> </dl>
@if (Model.Query.LogType.HasValue) @if (Model.Query.LogType.HasValue)
+3 -3
View File
@@ -1,4 +1,4 @@
@using System.Globalization @using MileageTraker.Web.Utility
@model MileageTraker.Web.ViewModels.VehicleMileageViewModel @model MileageTraker.Web.ViewModels.VehicleMileageViewModel
@{ @{
ViewBag.Title = "Vehicle Mileage Report"; ViewBag.Title = "Vehicle Mileage Report";
@@ -17,11 +17,11 @@
<div> <div>
<dl class="inline"> <dl class="inline">
<dt>Year</dt> <dt>@Html.DisplayNameFor(m => m.Query.Year)</dt>
<dd>@Html.Encode(Model.Query.Year)</dd> <dd>@Html.Encode(Model.Query.Year)</dd>
</dl> </dl>
<dl class="inline"> <dl class="inline">
<dt>Month</dt> <dt>@Html.DisplayNameFor(m => m.Query.Month)</dt>
<dd>@Html.Encode(Model.Query.Month)</dd> <dd>@Html.Encode(Model.Query.Month)</dd>
</dl> </dl>
@if (Model.Query.LogType.HasValue) @if (Model.Query.LogType.HasValue)
+6 -4
View File
@@ -21,7 +21,7 @@
Key Key
</th> </th>
<th> <th>
EthraId Ethra Id
</th> </th>
<th> <th>
Model Yr Model Yr
@@ -36,7 +36,7 @@
Type Type
</th> </th>
<th> <th>
TagNumber Tag Number
</th> </th>
<th> <th>
Prog Prog
@@ -67,8 +67,10 @@
<td> <td>
@Html.DisplayTextFor(m => item.CarModel) @Html.DisplayTextFor(m => item.CarModel)
</td> </td>
<td class="@item.Color"> <td>
@Html.DisplayTextFor(m => item.Type) <span class="label @item.Color">
@Html.DisplayTextFor(m => item.Type)
</span>
</td> </td>
<td> <td>
@Html.DisplayTextFor(m => item.TagNumber) @Html.DisplayTextFor(m => item.TagNumber)