@using MileageTraker.Web.Utility
@{
    Layout = null;
	var lowerPropertyName = @CustomExtensions.LowercaseFirst(ViewData.ModelMetadata.PropertyName);
    var values = ViewData.ModelMetadata.AdditionalValues;
    var units = values.ContainsKey("Units") ? (string)values["Units"] : null;
	var currency = values.ContainsKey("Currency") ? (string)values["Currency"] : null;
	var formatHint = values.ContainsKey("FormatHint") ? (string)values["FormatHint"] : null;
    var editLabel = values.ContainsKey("EditLabel") ? (bool) values["EditLabel"] : true;
}

<div class="control-group @lowerPropertyName">
    @if (editLabel) {
	    <div class="control-label">
		    @Html.LabelForModel()
	    </div>
	}
    <div class="controls">
        @if (!string.IsNullOrEmpty(units))
        {
            <div class="input-append">
                @RenderBody()
                <span class="add-on">@units</span>
            </div>
        }
		else if (!string.IsNullOrEmpty(currency))
        {
	        <div class="input-prepend">
		        <span class="add-on">@currency</span>
		        @RenderBody()
	        </div>
        }
        else
        {
            @RenderBody()
        }
        @if (!string.IsNullOrEmpty(formatHint)) {
			<div><small><em>@formatHint</em></small></div>
		}
        <span class="help-block">@Html.ValidationMessage("")</span>
    </div>
</div>
