@using Common;
@model string
<div class="main">
    <form method="post" class="form-horizontal form ui-validForm" action="@Url.Action()">
        <div class="control-group">
            <label class="control-label"><span class="bgname">好友</span></label>
            <div class="controls">
                <input type="text" name="owner" id="owner" maxlength="100" class="form-control ui-edit-readonly" placeholder="填写好友的用户名，务必填写正确" data-validate="dataType:'*" nullMsg:'请填写好友用户名">
                <input type="hidden" name="owner_uid" id="owner_uid" class="ui-convertTextById Member" data-custom-params="url:'@Url.Action("GetFieldByIds", "Member")',textField:'username'">
                <span class="help-block"></span>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label">好友分组</label>
            <div class="controls">
                <select id="sortid" name="sortid" class="form-control">
                    <option value="0">无分组</option>
                </select>
                <span class="help-block"></span>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label">好友备注</label>
            <div class="controls">
                <input type="text" id="remark" name="remark" class="form-control" maxlength="100" PlaceHolder="选填">
                <span class="help-block"></span>
            </div>
        </div>

        <div class="postarea">
            <div class="control-group">
                <div class="controls">
                    <input type="hidden" id="id" name="id" value="">
                    <input type="hidden" id="uid" name="uid" class="form-control" maxlength="100" value="@PA.GetCurrentUser().Uid">
                    <button type="button" class="btn btn-primary btn-sm ui-pagePost" data-custom-params="url:'@Url.Action()',callBack:'PostRefreshBack'">提交</button>
                    <button type="button" class="btn btn-default btn-sm ui-closeDialog">关闭</button>
                </div>
            </div>
        </div>
    </form>
</div>
<script type="text/javascript">
    var params = { valueField: "id", textField: "name" }
    var sortid = eval(CallAjax("get", false, "@Url.Action("ListData", "FriendsSort")"))
    $("#sortid").FillSelect(sortid, params);

    //绑定数据
    var id =Request("id");
    if (id != "")
    {
        var data = @Html.Raw(Model??"null");
        $(".form").FormBind(data);
    }
    $(function () {
        ConvertText($(".Member"));
        $("#owner").val($("#owner_uid").val());
    })

</script>