@model PantheonApi.Contracts.DataContracts.Pantheon.GetUserConnectionString

@{
    ViewBag.Title = "EditConnection";
}

<h2>Edit connection</h2>
@using (Html.BeginForm())
{
    @Html.AntiForgeryToken()
    <div class="form-horizontal">
        <h4>@Model.Username</h4>
        <hr />

        @if (TempData["Edit-Connection"] != null)
                {
            <div class="alert alert-danger no-border">
                <button type="button" class="close" data-dismiss="alert"><span>×</span><span class="sr-only">Close</span></button>
                <span class="text-semibold">@TempData["Edit-Connection"]</span>
            </div>
        }

        @Html.ValidationSummary(true, "", new { @class = "text-danger" })
        @Html.HiddenFor(model => model.Username)

    <div class="row">
        <div class="col-md-6">
            <div class="form-group">
                @Html.LabelFor(model => model.Username, "User name", htmlAttributes: new { @class = "control-label col-md-3" })
                <div class="col-md-9">
                    @Html.EditorFor(model => model.Username, new { htmlAttributes = new { @class = "form-control", @readonly = "readonly" } })
                    @Html.ValidationMessageFor(model => model.Username, "", new { @class = "text-danger" })
                </div>
            </div>
        </div>

        <div class="col-md-6">
            <div class="form-group">
                @Html.LabelFor(model => model.DataSource, "Data source", htmlAttributes: new { @class = "control-label col-md-3" })
                <div class="col-md-9">
                    @Html.EditorFor(model => model.DataSource, new { htmlAttributes = new { @class = "form-control" } })
                    @Html.ValidationMessageFor(model => model.DataSource, "", new { @class = "text-danger" })
                </div>
            </div>
        </div>

        <div class="col-md-6">
            <div class="form-group">
                @Html.LabelFor(model => model.InitialCatalog, "Initial catalog", htmlAttributes: new { @class = "control-label col-md-3" })
                <div class="col-md-9">
                    @Html.EditorFor(model => model.InitialCatalog, new { htmlAttributes = new { @class = "form-control" } })
                    @Html.ValidationMessageFor(model => model.InitialCatalog, "", new { @class = "text-danger" })
                </div>
            </div>
        </div>

        <div class="col-md-6">
            <div class="form-group">
                @Html.LabelFor(model => model.PersistSecurityInfo, "Persist security info", htmlAttributes: new { @class = "control-label col-md-3" })
                <div class="col-md-9">
                    @Html.CheckBoxFor(model => model.PersistSecurityInfo, new { @class = "form-control" })
                    @Html.ValidationMessageFor(model => model.PersistSecurityInfo, "", new { @class = "text-danger" })
                </div>
            </div>
        </div>

        <div class="col-md-6">
            <div class="form-group">
                @Html.LabelFor(model => model.UserId, "User ID", htmlAttributes: new { @class = "control-label col-md-3" })
                <div class="col-md-9">
                    @Html.EditorFor(model => model.UserId, new { htmlAttributes = new { @class = "form-control" } })
                    @Html.ValidationMessageFor(model => model.UserId, "", new { @class = "text-danger" })
                </div>
            </div>
        </div>

        <div class="col-md-6">
            <div class="form-group">
                @Html.LabelFor(model => model.Password, "Password", htmlAttributes: new { @class = "control-label col-md-3" })
                <div class="col-md-9">
                    @Html.EditorFor(model => model.Password, new { htmlAttributes = new { @class = "form-control" } })
                    @Html.ValidationMessageFor(model => model.Password, "", new { @class = "text-danger" })
                </div>
            </div>
        </div>
    </div>

        <div class="form-group">
            <div class="text-right">
                <a class="btn btn-default" href="~/SyncManager/ConnectionSettings">Cancel</a>
                <input type="submit" value="Save" class="btn btn-success" />
            </div>
        </div>
    </div>
}

