@model MileageTraker.Web.ViewModels.CreateLog.ConfirmCreateLogViewModel

@{
    ViewBag.Title = "Confirm";
}
@section Styles
{
    <link href="@Url.Content("~/Content/VehicleColors.css")" rel="stylesheet" type="text/css" />    
}

<h2 class="center-content">@ViewBag.Title</h2>

<p class="alert center-content">Please <strong>confirm</strong> - entry not complete until <strong>confirm</strong> clicked</p>

@* ReSharper disable Mvc.ActionNotResolved *@
@using (Html.BeginForm("Action", "CreateLog", FormMethod.Post, new { @class = "form-horizontal well center-content" } ))
{
@* ReSharper restore Mvc.ActionNotResolved *@
        <fieldset>
        <legend></legend>
        
        @if (Model.Miles == 0)
        {
            <p class="alert"><span class="label label-warning">Warning</span> No mileage being logged - <strong>is this a duplicate?</strong></p>
        }
        <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)
        <dl class="dl-horizontal endodometer">
            <dt>
                @Html.DisplayNameFor(m => m.EndOdometer)
            </dt>
            <dd>
                @Html.DisplayTextFor(m => m.EndOdometer) 
                @if (Model.PreviousOdometer.HasValue)
                {
                    <br/>
                    <small class="muted">
                        @if (Model.Miles > 0)
                        {
                            @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>
                }
            </dd>
        </dl>
        @Html.HiddenFor(m => m.EndOdometer)

        @Html.DisplayFor(model => model.LogType)
        @Html.HiddenFor(model => model.LogType.Value)

        @Html.DisplayFor(model => model.CityName)
        @* // Html.HiddenFor(model => model.CityName) is losing capitalization  *@
        <input type="hidden" name="CityName" value="@Model.CityName"/>
        
        @Html.DisplayFor(model => model.Purpose)
        @Html.HiddenFor(model => model.Purpose.Selected)

        @Html.DisplayFor(model => model.Notes)
        @Html.HiddenFor(model => model.Notes)

        <dl class="dl-horizontal gas">
            <dt>
                @Html.DisplayNameFor(m => m.GasPurchased)
            </dt>
            <dd>
                @if (!string.IsNullOrEmpty(Model.GasPurchased))
                {
                    @Html.DisplayTextFor(m => m.GasPurchased) <small class="muted">Gallons</small>
                }
                else
                {
                    <text>No Gas Purchased</text>
                }
            </dd>
        </dl>
        @Html.HiddenFor(model => model.GasPurchased)
        
        <dl class="dl-horizontal date">
            <dt>
                @Html.DisplayNameFor(m => m.Date)
            </dt>
            <dd>
                @Html.Encode(Model.Date.ToShortDateString()) 
                <small class="muted">(@Html.DisplayTextFor(m => m.DateHowLongAgo))</small>
            </dd>
        </dl>
        @Html.HiddenFor(model => model.Date)
        
        <div class="form-actions">
            <input type="submit" name="Confirm" value="Confirm" class="btn btn-primary" />
            <input type="submit" name="Edit" value="Back" class="btn" />
        </div>

    </fieldset>
}
