@using PantheonRA.BackOffice.Models
@model PantheonRA.BackOffice.Models.MeasurementUnitCreateViewModel
@{
    ViewBag.Title = string.IsNullOrEmpty(Model.Id) ? Loc.CreateNewMeasureUnit : Loc.EditMeasureUnit;
}

@using (Html.BeginForm())
{
    <div class="tabs-container">
        @Html.Partial("~/Views/Products/_CodeListTabNavigation.cshtml")
        <div class="tab-content">
            <div class="row buttons-tabbed">
                @Html.Partial("_FormButtons", new FormButtonsViewModel {
                    BackUrl = @Url.Action("Index", "MeasurementUnits"),
                    SaveButtonGroup = new FormButtonGroup
                    {
                        Buttons = new List<FormButton>
                        {
                            new FormButton { Text = Loc.Save, Icon = "fa fa-save fa-lg", IsSubmit = true }
                        }
                    }
                })
            </div>
            <div class="divided-content">
                <div class="divided-content-main divided-content-full">
                    <div class="form-horizontal form-md m-t-md">
                        <div class="row">
                            <div class="col-xs-12 col-md-6 col-lg-4">
                                <div class="row">
                                    <div class="col-xs-12">
                                        <h3>@Loc.MeasureUnit</h3>
                                        <div class="form-group">
                                            @Html.LabelFor(model => model.Id, Loc.Code, new { @class = "col-md-4 control-label" })
                                            <div class="col-md-8">
                                                @Html.HiddenFor(model => model.IsEdit)
                                                @Html.TextBoxFor(model => model.Id,
                                                    HtmlAttributesHelper.CreateInputAttributes("form-control", "Id", Model.IsEdit ? true : false, Loc.Code, false, new { @maxlength = 3 }))
                                                @Html.ValidationMessageFor(model => model.Id, "", new { @class = "text-danger" })
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="col-xs-12">
                                        <div class="form-group">
                                            @Html.LabelFor(model => model.InterCode, Loc.InternationalCode, new { @class = "col-md-4 control-label" })
                                            <div class="col-md-8">
                                                @Html.DropDownListFor(model => model.InterCode, new List<SelectListItem>
                                                {
                                                    new SelectListItem{ Text="ACR - Acre (4840 sq yd)", Value = "ACR" },
                                                    new SelectListItem{ Text="AMT - Amount", Value = "AMT" },
                                                    new SelectListItem{ Text="ANN - Year", Value = "ANN" },
                                                    new SelectListItem{ Text="APZ - Troy ounce or apothecaries' ounce (31.1 g)", Value = "APZ" },
                                                    new SelectListItem{ Text="ASM - Alcoholic strength by weight", Value = "ASM" },
                                                    new SelectListItem{ Text="ASU - Alcoholic strength by volume", Value = "ASU" },
                                                    new SelectListItem{ Text="BTU - British thermal unit (1.055 kilojoules)", Value = "BTU" },
                                                    new SelectListItem{ Text="C0 - Call", Value = "C0" },
                                                    new SelectListItem{ Text="C62 - Piece", Value = "C62" },
                                                    new SelectListItem{ Text="CEL - Degree Celsius", Value = "CEL" },
                                                    new SelectListItem{ Text="CMK - Square centimetre", Value = "CMK" },
                                                    new SelectListItem{ Text="CMT - Centimetre", Value = "CMT" },
                                                    new SelectListItem{ Text="DAY - Day", Value = "DAY" },
                                                    new SelectListItem{ Text="DMT - Decimetre", Value = "DMT" },
                                                    new SelectListItem{ Text="EA - Each", Value = "EA" },
                                                    new SelectListItem{ Text="FAH - Degree Fahrenheit", Value = "FAH" },
                                                    new SelectListItem{ Text="FOT - Foot", Value = "FOT" },
                                                    new SelectListItem{ Text="GLI - Imperial gallon (4.54 l)", Value = "GLI" },
                                                    new SelectListItem{ Text="GRM - Gram", Value = "GRM" },
                                                    new SelectListItem{ Text="GWH - Gigawatt hour (1 million kWh)", Value = "GWH" },
                                                    new SelectListItem{ Text="GV - Gigajoule", Value = "GV" },
                                                    new SelectListItem{ Text="H87 - Piece", Value = "H87" },
                                                    new SelectListItem{ Text="HLT - Hectolitre", Value = "HLT" },
                                                    new SelectListItem{ Text="HUR - Hour", Value = "HUR" },
                                                    new SelectListItem{ Text="INH - Inch", Value = "INH" },
                                                    new SelectListItem{ Text="JOU - Joule", Value = "JOU" },
                                                    new SelectListItem{ Text="KBA - Kilobar", Value = "KBA" },
                                                    new SelectListItem{ Text="KEL - Kelvin", Value = "KEL" },
                                                    new SelectListItem{ Text="KGM - Kilogram", Value = "KGM" },
                                                    new SelectListItem{ Text="KHZ - Kilohertz", Value = "KHZ" },
                                                    new SelectListItem{ Text="KJO - Kilojoule", Value = "KJO" },
                                                    new SelectListItem{ Text="KMT - Kilometre", Value = "KMT" },
                                                    new SelectListItem{ Text="KVT - Kilovolt", Value = "KVT" },
                                                    new SelectListItem{ Text="KWH - Kilowatt hour", Value = "KWH" },
                                                    new SelectListItem{ Text="KWT - Kilowatt", Value = "KWT" },
                                                    new SelectListItem{ Text="LBR - Pound", Value = "LBR" },
                                                    new SelectListItem{ Text="LTR - Litre", Value = "LTR" },
                                                    new SelectListItem{ Text="MAL - Mega litre", Value = "MAL" },
                                                    new SelectListItem{ Text="MAW - Megawatt", Value = "MAW" },
                                                    new SelectListItem{ Text="MGM - Milligram", Value = "MGM" },
                                                    new SelectListItem{ Text="MHZ - Megahertz", Value = "MHZ" },
                                                    new SelectListItem{ Text="MIN - Minute", Value = "MIN" },
                                                    new SelectListItem{ Text="MLT - Millilitre", Value = "MLT" },
                                                    new SelectListItem{ Text="MMT - Millimetre", Value = "MMT" },
                                                    new SelectListItem{ Text="MON - Month", Value = "MON" },
                                                    new SelectListItem{ Text="MTK - Square metre", Value = "MTK" },
                                                    new SelectListItem{ Text="MTQ - Cubic metre", Value = "MTQ" },
                                                    new SelectListItem{ Text="MTR - Metre", Value = "MTR" },
                                                    new SelectListItem{ Text="MWH - Megawatt hour (1000 kWh)", Value = "MWH" },
                                                    new SelectListItem{ Text="N2 - Number of lines", Value = "N2" },
                                                    new SelectListItem{ Text="NAR - Number of articles", Value = "NAR" },
                                                    new SelectListItem{ Text="NRL - Number of rolls", Value = "NRL" },
                                                    new SelectListItem{ Text="ONZ - Ounce (28.3 g)", Value = "ONZ" },
                                                    new SelectListItem{ Text="OZA - US fluid ounce (29.57 ml)", Value = "OZA" },
                                                    new SelectListItem{ Text="OZI - Imperial fluid ounce (28.41 ml)", Value = "OZI" },
                                                    new SelectListItem{ Text="P1 - Percent", Value = "P1" },
                                                    new SelectListItem{ Text="PCE - Piece", Value = "PCE" },
                                                    new SelectListItem{ Text="PTI - Imperial pint (568 ml)", Value = "PTI" },
                                                    new SelectListItem{ Text="PTN - Installment", Value = "PTN" },
                                                    new SelectListItem{ Text="QAN - Quarter (of a year)", Value = "QAN" },
                                                    new SelectListItem{ Text="QTI - Imperial quart (1.14 l)", Value = "QTI" },
                                                    new SelectListItem{ Text="RTO - Quotient", Value = "RTO" },
                                                    new SelectListItem{ Text="SEC - Second", Value = "SEC" },
                                                    new SelectListItem{ Text="ST - Sheet", Value = "ST" },
                                                    new SelectListItem{ Text="TNE - Tonne", Value = "TNE" },
                                                    new SelectListItem{ Text="VLT - Volt", Value = "VLT" },
                                                    new SelectListItem{ Text="WHR - Watt hour", Value = "WHR" },
                                                    new SelectListItem{ Text="WRD - Word", Value = "WRD" },
                                                    new SelectListItem{ Text="WTT - Watt", Value = "WTT" },
                                                    new SelectListItem{ Text="YRD - Yard", Value = "YRD" },
                                                    new SelectListItem{ Text="ZP - Page", Value = "ZP" }
                                                }, HtmlAttributesHelper.CreateInputAttributes("form-control custom-select", "InterCode", false, Loc.InternationalCode, false))
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="col-xs-12">
                                        <div class="form-group">
                                            @Html.LabelFor(model => model.Name, Loc.Name, new { @class = "col-md-4 control-label" })
                                            <div class="col-md-8">
                                                @Html.TextBoxFor(model => model.Name, new { @id = "Name", @class = "form-control", @placeholder = Loc.Name, @autocomplete = "off", @maxlength = 40 })
                                                @Html.ValidationMessageFor(model => model.Name, "", new { @class = "text-danger" })
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
}

@section pageScripts{
    @Scripts.Render("~/bundles/product")
    <script>
        $(document).ready(function () {
            initializeMeasurementUnitsEdit();
        });
    </script>
}