@model PantheonApi.Data.DbModels.Pantheon.tPA_SyncTableStatus

@{
    Layout = null;
}

<div id="SyncParameterEdit">
@using (Ajax.BeginForm("EditSyncParameter", "SyncManager",
    new AjaxOptions { UpdateTargetId = "SyncParameterEdit", OnBegin = "startLoading('SyncParameterEdit')" }))
{
    @Html.AntiForgeryToken()
    <div class="form-horizontal">
        <h4>Edit parameter with ID: @Model.anId</h4>
        <hr />

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

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

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

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

                <div class="form-group">
                    @Html.LabelFor(model => model.acTransferDirection, "Transfer direction", htmlAttributes: new { @class = "control-label col-md-3" })
                    <div class="col-md-9">
                        <label class="col-md-12">
                            @Html.RadioButtonFor(model => model.acTransferDirection, "LOCAL_TO_CENTRAL")
                            LOCAL TO CENTRAL
                        </label>
                        <label class="col-md-12">
                            @Html.RadioButtonFor(model => model.acTransferDirection, "CENTRAL_TO_LOCAL")
                            CENTRAL TO LOCAL
                        </label>
                        <label class="col-md-12">
                            @Html.RadioButtonFor(model => model.acTransferDirection, "TWO_WAY")
                            TWO WAY
                        </label>
                        @Html.ValidationMessageFor(model => model.acTransferDirection, "", new { @class = "text-danger" })
                    </div>
                </div>
            </div>
        </div>

        <div class="form-group">
            <div class="text-right">
                @Ajax.ActionLink("Cancel", "SyncParameters", "SyncManager",
                    new { page = Model.Page, searchString = Model.SearchString, deviceId = Model.anDeviceId },
                    new AjaxOptions
                    {
                        UpdateTargetId = "SyncParameterEdit",
                        InsertionMode = InsertionMode.Replace,
                        OnBegin = "startLoading('SyncParameterEdit')"
                    }, 
                    new { @class = "btn btn-default" })
                <input type="submit" value="Save" class="btn btn-success" />
            </div>
        </div>
    </div>
}
    </div>
