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;
}
.employeeName input {
width: 120px;
}
.form-horizontal .control-group.endOdometer {
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")
.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.ComponentModel.DataAnnotations;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Text;
using System.Web.Mvc;
@@ -170,5 +171,15 @@ namespace MileageTraker.Web.Utility
{
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);
}
}
}
+69 -46
View File
@@ -1,9 +1,9 @@
@using MileageTraker.Web.Utility
@model MileageTraker.Web.ViewModels.ConfirmCreateLogViewModel
@{
ViewBag.Title = "Confirm";
Layout = "~/Views/Shared/_Layout.cshtml";
var endOdometerStyle = Model.PreviousOdometer != null ? "style=padding-bottom:0px;" : "";
}
@section Styles
{
@@ -17,69 +17,92 @@
<p class="alert">Please <strong>confirm</strong> - entry not complete until <strong>confirm</strong> clicked</p>
@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">
<div class="display-label">
@Html.LabelFor(model => model.VehicleId)
</div>
<div class="display-field @Model.VehicleColor">
@Html.Encode(Model.VehicleId) <span class="subscript">(@Model.VehicleType)</span>
</div>
</div>
<dl class="dl-horizontal vehicle-id">
<dt>
@Html.DisplayNameFor(m => m.VehicleId)
</dt>
<dd>
@Html.DisplayTextFor(m => m.VehicleId)
<span class="label @Model.VehicleColor">@Html.DisplayTextFor(m => m.VehicleType)</span>
</dd>
</dl>
@Html.HiddenFor(m => m.VehicleId)
<div class="display-field-container endodometer" @endOdometerStyle>
<div class="display-label">
@Html.LabelFor(model => model.EndOdometer)
</div>
<div class="display-field">
@Html.Encode(Model.EndOdometer)
@if (Model.PreviousOdometer != null)
<dl class="dl-horizontal endodometer">
<dt>
@Html.DisplayNameFor(m => m.EndOdometer)
</dt>
<dd>
@Html.DisplayTextFor(m => m.EndOdometer)
@if (Model.PreviousOdometer.HasValue)
{
<br/>
<span class="subscript @if (Model.Miles == 0)
{ <text>label label-warning</text>}">@Html.Encode(Model.Miles) miles since <br />
@Html.Encode(Model.PreviousOdometer) on @Html.Encode(Model.PreviousDate.Value.ToShortDateString())</span>
<small class="muted">
@if (Model.Miles > 0)
{
@Html.DisplayTextFor(m => m.Miles) <span>miles</span>
}
</div>
</div>
<input type="hidden" name="EndOdometer" value="@Html.AttributeEncode(Model.EndOdometer)" />
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>
}
</dd>
</dl>
@Html.HiddenFor(m => m.EndOdometer)
@Html.DisplayFor(model => model.LogType)
@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">
<div class="display-label">
@Html.LabelFor(model => model.GasPurchased)
</div>
<div class="display-field">
@Html.DisplayFor(model => model.EmployeeName)
@Html.HiddenFor(model => model.EmployeeName)
@Html.DisplayFor(model => model.CityName)
@Html.HiddenFor(model => model.CityName)
<dl class="dl-horizontal gas">
<dt>
@Html.DisplayNameFor(m => m.GasPurchased)
</dt>
<dd>
@if (!string.IsNullOrEmpty(Model.GasPurchased))
{
@Model.GasPurchased <span class="units">Gallons</span>
@Html.DisplayTextFor(m => m.GasPurchased) <small class="muted">Gallons</small>
}
else
{
<text>No Gas Purchased</text>
}
<input type="hidden" name="GasPurchased" value="@Html.AttributeEncode(Model.GasPurchased)" />
</div>
</div>
<div class="display-field-container date">
<div class="display-label">
@Html.LabelFor(model => model.Date)
</div>
<div class="display-field">
@Html.Encode(Model.Date)
<span class="muted">(@Html.Encode(Model.DateHowLongAgo))</span>
<input type="hidden" name="Date" value="@Html.AttributeEncode(Model.Date)" />
</div>
</div>
</dd>
</dl>
@Html.HiddenFor(model => model.GasPurchased)
<dl class="dl-horizontal date">
<dt>
@Html.DisplayNameFor(m => m.Date)
</dt>
<dd>
@Html.DisplayTextFor(m => m.Date)
<small class="muted">(@Html.DisplayTextFor(m => m.DateHowLongAgo))</small>
</dd>
</dl>
@Html.HiddenFor(model => model.Date)
<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>
}
+5 -13
View File
@@ -5,24 +5,16 @@
Layout = "~/Views/Shared/_Layout.cshtml";
}
@section Styles
{
<link href="@Url.Content("~/Content/CreateLog.Index.css")" rel="stylesheet" type="text/css" />
}
@{
@:<fieldset>
<legend>@ViewBag.Title</legend>
<h4>@ViewBag.Title</h4>
<p>
You've successfully created an entry
for <strong>@Html.Encode(Model.EmployeeName)</strong>
traveling to <strong>@Html.Encode(Model.CityName)</strong>
on <strong>@Html.Encode(Model.Date)</strong>
in VehicleId <strong>@Html.Encode(Model.VehicleId)</strong>
for <strong>@Html.DisplayTextFor(m => m.EmployeeName)</strong>
traveling to <strong>@Html.DisplayTextFor(m => m.CityName)</strong>
on <strong>@Html.DisplayTextFor(m => m.Date)</strong>
in Vehicle Id <strong>@Html.DisplayTextFor(m => m.VehicleId)</strong>
</p>
<p>
@Html.ActionLink("Create another", "Index", null, new { @class = "btn" })
</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";
}
@@ -16,11 +17,11 @@
<div>
<dl class="inline">
<dt>Year</dt>
<dt>@Html.DisplayNameFor(m => m.Query.Year)</dt>
<dd>@Html.Encode(Model.Query.Year)</dd>
</dl>
<dl class="inline">
<dt>Month</dt>
<dt>@Html.DisplayNameFor(m => m.Query.Month)</dt>
<dd>@Html.Encode(Model.Query.Month)</dd>
</dl>
@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
@{
ViewBag.Title = "Vehicle Mileage Report";
@@ -17,11 +17,11 @@
<div>
<dl class="inline">
<dt>Year</dt>
<dt>@Html.DisplayNameFor(m => m.Query.Year)</dt>
<dd>@Html.Encode(Model.Query.Year)</dd>
</dl>
<dl class="inline">
<dt>Month</dt>
<dt>@Html.DisplayNameFor(m => m.Query.Month)</dt>
<dd>@Html.Encode(Model.Query.Month)</dd>
</dl>
@if (Model.Query.LogType.HasValue)
+5 -3
View File
@@ -21,7 +21,7 @@
Key
</th>
<th>
EthraId
Ethra Id
</th>
<th>
Model Yr
@@ -36,7 +36,7 @@
Type
</th>
<th>
TagNumber
Tag Number
</th>
<th>
Prog
@@ -67,8 +67,10 @@
<td>
@Html.DisplayTextFor(m => item.CarModel)
</td>
<td class="@item.Color">
<td>
<span class="label @item.Color">
@Html.DisplayTextFor(m => item.Type)
</span>
</td>
<td>
@Html.DisplayTextFor(m => item.TagNumber)