@model PantheonApi.SyncApi.ViewModels.ColumnValueViewModel

@{ 
    var deviceList = Model.DeviceIdsList
                    .Select(s => new { DeviceId = s.anQId, Description = string.Format("{0} - {1}", s.acDatabaseName, s.acDocType) })
                    .ToList();
    var defaultDevice = new { DeviceId = 0, Description = "Default device" };
    deviceList.Add(defaultDevice);
}

<!-- MODAL-->
<div id="column-value-div">
    <div class="modal fade" id="column-value-modal" tabindex="-1" role="dialog" data-backdrop="true" data-keyboard="true" aria-hidden="true">
        <div class="modal-dialog modal-lg">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal">&times;</button>
                    <h4 class="modal-title">Add new column value</h4>
                </div>
                <div class="modal-body">
                    <form action="/PartialSync/AddSyncFilterColumnValue" method="post">
                        <div class="form-horizontal">
                            <div class="row">
                                <div class="col-md-6">
                                    <div class="form-group">
                                        @Html.LabelFor(model => model.SourceTableName, "Source table name", htmlAttributes: new { @class = "control-label col-md-3" })
                                        <div class="col-md-9">
                                            @Html.EditorFor(model => model.SourceTableName, new { htmlAttributes = new { @class = "form-control", @readonly = "readonly" } })
                                            @Html.ValidationMessageFor(model => model.SourceTableName, "", new { @class = "text-danger" })
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        @Html.LabelFor(model => model.SourceColumnName, "Source column name", htmlAttributes: new { @class = "control-label col-md-3" })
                                        <div class="col-md-9">
                                            @Html.DropDownListFor(model => model.SourceColumnName,
                                                new SelectList(Model.ColumnNamesList),
                                                "Select column",
                                                new { @class = "form-control", @required = "required" })
                                            @Html.ValidationMessageFor(model => model.SourceColumnName, "", new { @class = "text-danger" })
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        @Html.LabelFor(model => model.Value, "Value", htmlAttributes: new { @class = "control-label col-md-3" })
                                        <div class="col-md-9">
                                            @Html.EditorFor(model => model.Value, new { htmlAttributes = new { @class = "form-control", @required = "required" } })
                                            @Html.ValidationMessageFor(model => model.Value, "", new { @class = "text-danger" })
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        @Html.LabelFor(model => model.Type, "Type", htmlAttributes: new { @class = "control-label col-md-3", @required = "required" })
                                        <div class="col-md-9">
                                            @Html.DropDownListFor(model => model.Type,
                                                new SelectList(Enum.GetValues(typeof(ColumnDataTypes))),
                                                "Select column data type",
                                                new { @class = "form-control", @required = "required" })

                                            @Html.ValidationMessageFor(model => model.Type, "", new { @class = "text-danger" })
                                        </div>
                                    </div>
                                </div>
                                <div class="col-md-6">
                                    <div class="form-group">
                                        @Html.LabelFor(model => model.DocType, "Document type", htmlAttributes: new { @class = "control-label col-md-3" })
                                        <div class="col-md-9">
                                            @Html.DropDownListFor(model => model.DocType,
                                                new SelectList(Model.DocumentTypesList),
                                                "Select document type",
                                                new { @class = "form-control" })
                                            @Html.ValidationMessageFor(model => model.DocType, "", new { @class = "text-danger" })
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        @Html.LabelFor(model => model.DeviceId, "Device id", htmlAttributes: new { @class = "control-label col-md-3" })
                                        <div class="col-md-9">
                                            @Html.DropDownListFor(model => model.DeviceId,
                                                new SelectList(deviceList,
                                                    "DeviceId",
                                                    "Description"),
                                                new { @class = "form-control" })
                                            @Html.ValidationMessageFor(model => model.DeviceId, "", new { @class = "text-danger" })
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        @Html.LabelFor(model => model.Criteria, "Criteria", htmlAttributes: new { @class = "control-label col-md-3" })
                                        <div class="col-md-9">
                                            @Html.EditorFor(model => model.Criteria, new { htmlAttributes = new { @class = "form-control" } })
                                            @Html.ValidationMessageFor(model => model.Criteria, "", new { @class = "text-danger" })
                                        </div>
                                    </div>
                                    @Html.LabelFor(model => model.Active, "Active", htmlAttributes: new { @class = "control-label col-md-3" })
                                    <div class="col-md-9">
                                        <div class="checkbox">
                                            @Html.CheckBox("Active", true)
                                            @Html.ValidationMessageFor(model => model.Active, "", new { @class = "text-danger" })
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <div class="form-group">
                                <div class="col-md-6 text-left">
                                    <p>Note: If entering multiple values into <b>Criteria</b> field, set <b>Value</b> field to <i>accriteria</i>.</p>
                                </div>
                            </div>
                        </div>

                        <div class="modal-footer">
                            <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                            <input type="submit" value="Save" class="btn btn-success" />
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>

</div>
<!-- /MODAL-->
