LocalGovIMS_localgov-ims/src/Admin/Views/MetadataKey/Create.cshtml
@model Admin.Models.MetadataKey.EditViewModel
@{
    ViewBag.Title = "Create metadata key";
}

@section Messages {
    @if (TempData.ContainsKey("Message") && TempData["Message"] != null) { Html.RenderPartial("_Message", TempData["Message"]); }
}

@section Header { Create metadata key }

@section Subheader { Metadata key details }

@using (Html.BeginForm("Create", "MetadataKey", FormMethod.Post))
{

<div>

    <div class="row mb-3">
        <div class="col-12 col-sm-6 col-md-5 col-lg-4">
            @Html.LabelFor(m => m.Name, new { @class = "form-label" })
            @Html.TextBoxFor(m => m.Name, new { @class = "form-control" })
            <div class="form__element--error">
                @Html.ValidationMessageFor(m => m.Name)
            </div>
        </div>
    </div>

    <div class="row mb-3">
        <div class="col-12 col-sm-6 col-md-5 col-lg-4">
            @Html.LabelFor(m => m.Description, new { @class = "form-label" })
            @Html.TextBoxFor(m => m.Description, new { @class = "form-control" })
            <div class="form__element--error">
                @Html.ValidationMessageFor(m => m.Description)
            </div>
        </div>
    </div>

    <div class="row mb-3">
        <div class="col-12 col-sm-6 col-md-5 col-lg-4">
            @Html.LabelFor(m => m.EntityType, new { @class = "form-label" })
            <select id="EntityType" name="EntityType">
                <option value="">None</option>
                @foreach (var item in Model.EntityTypes.Items)
                {
                    <option class="item" value="@item.Value" @(Model.EntityType.Equals(item.Value) ? "selected" : String.Empty)>@item.Text</option>
                }
            </select>
            <div class="form__element--error">
                @Html.ValidationMessageFor(m => m.EntityType)
            </div>
        </div>
    </div>

    <input type="submit" value="Save" class="btn btn-primary" />
    @Html.ActionLink("Back", "Back", "FundMessage", null, new { @class = "btn btn-secondary" })

</div>

}

@section Scripts {
    <script type="text/javascript">
        $(document).ready(function () {
            accessibleAutocomplete.enhanceSelectElement({
                displayMenu: 'overlay',
                autoSelect: false,
                confirmOnBlur: false,
                showAllValues: true,
                defaultValue: '',
                preserveNullOptions: true,
                placeholder: 'Select entity type',
                dropdownArrow: () => paymentsAdmin.controls.autocomplete.downarrow,
                selectElement: document.querySelector('#EntityType')
            });

        });
    </script>
}