@model Alpha.Coordinador.WebApp.Models.CreateUserViewModel

@{
    ViewBag.Title = "Create";
}

<h2>Crear usuario</h2>
<script>
    function showHidePass(checkBox) {
        var div = document.getElementById('passDiv');
        if (checkBox.checked)
            div.style.display = 'none';
        else
            div.style.display = 'block';
    }
</script>
@using (Html.BeginForm())
{
    @Html.AntiForgeryToken()

<div class="form-horizontal">
    <hr />
    <div class="form-group">
        <label class="control-label col-md-2">Existe en Alpha</label>
        <div class="col-md-10">
            <input type="checkbox" onclick="showHidePass(this)" id="showHidePassCheck" />
        </div>
    </div>

    @Html.ValidationSummary(true, "", new { @class = "text-danger" })
    <div class="form-group">
        @Html.LabelFor(model => model.Username, htmlAttributes: new { @class = "control-label col-md-2" })
        <div class="col-md-10">
            @Html.EditorFor(model => model.Username, new { htmlAttributes = new { @class = "form-control" } })
            @Html.ValidationMessageFor(model => model.Username, "", new { @class = "text-danger" })
        </div>
    </div>
    <div class="form-group" id="passDiv">
        @Html.LabelFor(model => model.Password, htmlAttributes: new { @class = "control-label col-md-2" })
        <div class="col-md-10">
            @Html.EditorFor(model => model.Password, new { htmlAttributes = new { @class = "form-control" } })
            @Html.ValidationMessageFor(model => model.Password, "", new { @class = "text-danger" })
        </div>
    </div>
    <div class="form-group">
        @Html.LabelFor(model => model.Admin, htmlAttributes: new { @class = "control-label col-md-2" })
        <div class="col-md-10">
            @Html.CheckBoxFor(model => model.Admin, new { htmlAttributes = new { @class = "form-control" } })
            @Html.ValidationMessageFor(model => model.Admin, "", new { @class = "text-danger" })
        </div>
    </div>
    <div class="form-group">
        @Html.LabelFor(model => model.Services, htmlAttributes: new { @class = "control-label col-md-2" })
        <div class="col-md-10">
            @{var Services = (IEnumerable<Alpha.Coordinador.Interfaces.Models.Service>)ViewBag.Services;}
            @Html.ListBoxFor(m => m.SelectedServices, new SelectList(Services, "Id", "ServiceName"), new { @class = "dropdown" })
            @Html.ValidationMessageFor(model => model.Services, "", new { @class = "text-danger" })
        </div>
    </div>
    <div class="form-group">
        @Html.LabelFor(model => model.VirtualMachines, htmlAttributes: new { @class = "control-label col-md-2" })
        <div class="col-md-10">
            @{var VirtualMachines = (IEnumerable<Alpha.Coordinador.Interfaces.Models.VirtualMachine>)ViewBag.VirtualMachines;}
            @Html.ListBoxFor(m => m.SelectedVirtualMachines, new SelectList(VirtualMachines, "ID", "Nombre"), new { @class = "dropdown" })
            @Html.ValidationMessageFor(model => model.VirtualMachines, "", new { @class = "text-danger" })
        </div>
    </div>
    <div class="form-group">
        <div class="col-md-offset-2 col-md-10">
            <input type="submit" value="Create" class="btn btn-default" />
        </div>
    </div>
</div>
}

<div>
    @Html.ActionLink("Volver", "Index")
</div>
