@model PantheonApi.Data.DbModels.Pantheon.tPA_SyncServer

@{
    ViewBag.Title = "EditConnectedDevice";
}

@Html.Hidden("DisconnectDeviceUrl", Url.Action("DisconnectConnectedDevice", "SyncManager"))
@Html.Hidden("ConnectedDevicesUrl", Url.Action("ConnectedDevices", "SyncManager"))

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

        @if (TempData["Edit-Device"] != 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-Device"]</span>
            </div>
        }

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

        <div class="row">
            <div class="col-md-6">
                <div class="form-group">
                    @Html.LabelFor(model => model.anQId, "Device ID", htmlAttributes: new { @class = "control-label col-md-3" })
                    <div class="col-md-9">
                        @Html.EditorFor(model => model.anQId, new { htmlAttributes = new { @class = "form-control", @readonly = "readonly" } })
                        @Html.ValidationMessageFor(model => model.anQId, "", new { @class = "text-danger" })
                    </div>
                </div>
                <div class="form-group">
                    @Html.LabelFor(model => model.acDocType, "Document type", htmlAttributes: new { @class = "control-label col-md-3" })
                    <div class="col-md-9">
                        @Html.EditorFor(model => model.acDocType, new { htmlAttributes = new { @class = "form-control", @readonly = "readonly" } })
                        @Html.ValidationMessageFor(model => model.acDocType, "", new { @class = "text-danger" })
                    </div>
                </div>
                <div class="form-group">
                    @Html.LabelFor(model => model.acServerName, "Server", htmlAttributes: new { @class = "control-label col-md-3" })
                    <div class="col-md-9">
                        @Html.EditorFor(model => model.acServerName, new { htmlAttributes = new { @class = "form-control" } })
                        @Html.ValidationMessageFor(model => model.acServerName, "", new { @class = "text-danger" })
                    </div>
                </div>
            </div>

            <div class="col-md-6">
                <div class="form-group">
                    @Html.LabelFor(model => model.acDatabaseName, "Database", htmlAttributes: new { @class = "control-label col-md-3" })
                    <div class="col-md-9">
                        @Html.EditorFor(model => model.acDatabaseName, new { htmlAttributes = new { @class = "form-control" } })
                        @Html.ValidationMessageFor(model => model.acDatabaseName, "", new { @class = "text-danger" })
                    </div>
                </div>
                <div class="form-group">
                    @Html.LabelFor(model => model.anTimePeriod, "Time period (min)", htmlAttributes: new { @class = "control-label col-md-3" })
                    <div class="col-md-9">
                        @Html.EditorFor(model => model.anTimePeriod, new { htmlAttributes = new { @class = "form-control" } })
                        @Html.ValidationMessageFor(model => model.anTimePeriod, "", new { @class = "text-danger" })
                    </div>
                </div>
                <div class="form-group">
                    @Html.LabelFor(model => model.abIsSyncEnabled, "Active", htmlAttributes: new { @class = "control-label col-md-3" })
                    <div class="col-md-9">
                        @Html.CheckBoxFor(model => model.NoNullExclusive, new { @class = "form-control" })
                        @Html.ValidationMessageFor(model => model.abIsSyncEnabled, "", new { @class = "text-danger" })
                    </div>
                </div>
            </div>
        </div>

        <div class="form-group">
            <div class="text-right">
                <a class="btn btn-default" onclick="disconnectDevice('@Model.anQId', '@Model.acDocType')">Disconnect</a>
                <a class="btn btn-default" href="~/SyncManager/ConnectedDevices">Cancel</a>
                <input type="submit" value="Save" class="btn btn-success" />
            </div>
        </div>
    </div>
}

