@model string
<div class="current-location">
    <ul>
        <li class="left"><i class="glyphicon glyphicon-home"></i><a href="javascript:void(0)" onclick="location.href=location.href">请求信息</a></li>
        <li class="right"><a href="javascript:void(0)" onclick="LoadData()" title="刷新"><span class="glyphicon glyphicon-refresh"></span></a></li>
    </ul>
</div>
@Html.Action("Tabhead", "Friends")
<div class="main no-top-border">
    <table class="controls tb_head"  border=0 cellpadding=0 cellspacing=0>
        <tr class="clearfix">
            <td class="btn-group left">
                <button type="button" class="btn btn-default btn-sm ui-selectInvert">反选</button>
                <button type="button" class="btn btn-default dropdown-toggle btn-sm" data-toggle="dropdown" aria-expanded="false">
                    菜单<span class="caret"></span>
                </button>
                <ul class="dropdown-menu" role="menu">
                    <li><a href="javascript:void(0)" class="ui-deleteMultiple" data-custom-params="url:'@Url.Action("Delete")'">删除</a></li>
                </ul>
            </td>
            <td class="form-inline form-group-sm right">
                <select id="state" name="state" class="form-control ui-queryString">
                    <option value="">选择状态</option>
                    <option value="0">请求中</option>
                    <option value="1">已通过</option>
                    <option value="-1">已拒绝</option>
                    <option value="-2">永久拒绝</option>
                </select>
                <input type="text" id="thedate" name="thedate" placeholder="开始日期" onclick="laydate({istime:true,format:'YYYY-MM-DD'})" class="laydate-icon form-control ui-queryString">
                <input type="text" id="thedate" name="thedate" placeholder="结束日期" onclick="laydate({istime:true,format:'YYYY-MM-DD'})" class="laydate-icon form-control ui-queryString">
                <select id="field" name="field" class="form-control ui-queryString ui-setName">
                    @if (Request.QueryString["requestxx"] == "my")
                    {
                        <option value="request_uid">请求用户</option>
                    }
                    else
                    {
                        <option value="uid">请求用户</option>
                    }
                    <option value="friend_beizhu">备注信息</option>
                </select>
                <input type="text" id="keyword" name="keyword" value="" placeholder="搜索关键词" maxlength="30" style="width:100px" class="form-control ui-queryString ui-keyword">
                <button type="button" class="btn btn-default btn-sm ui-queryString-search">确定</button>
            </td>
        </tr>
    </table>
    <span class="help-block"></span>


    <table border=0 cellpadding=0 cellspacing=0 width=100% class="table table-bordered" id="tb_list">
        <thead><tr>
            <td align="center"  style="width:40px"><input type="checkbox" title="选择" class="ui-selectInvert" data-custom-params="isReverse:false"></td>
            <td align="center" width="20%">请求信息</td>
            <td align="center" width="15%">请求用户</td>
            <td align="center" width="15%">备注</td>
            <td align="center" width="15%">时间</td>
            <td align="center" width="12%">状态</td>
            <td align="center" width="20%">操作</td>
        </tr>

        <tr class="item" id="item_{id}">
            <td align="center"><input type="checkbox" id="id" name="id" value="{id}"></td>
            <td align=left>{request_info}</td>
            <td align="center">
                <div class="request_uid">
                    <span class="ui-convertTextById Member" data-custom-params="url:'@Url.Action("GetFieldByIds", "Member")',textField:'username'">{request_uid}</span>
                </div>
                <div class="uid">
                    <span class="ui-convertTextById Member1" data-custom-params="url:'@Url.Action("GetFieldByIds", "Member")',textField:'username'">{uid}</span>
                </div>
            </td>
            <td align="left">{friend_beizhu}</td>
            <td align="center">{thedate}</td>
            <td align="center" class="state">{state}</td>
            <td align="center">
                <div class="btn-group">
                    <button type="button" class="btn btn-default dropdown-toggle btn-sm gdcz" data-toggle="dropdown" aria-expanded="false">
                        操作<span class="caret"></span>
                    </button>
                    <button type="button" class="btn btn-default btn-sm ui-deleteSingle" data-custom-params="url:'@Url.Action("Delete")',id:'{id}'">删除</button>
                    <ul class="dropdown-menu" role="menu">
                        <li><a class="agree ui-updateSingle" data-custom-params="url:'@Url.Action("IsAgree")',id:'{id}',addParams:'isagree=agree&request_uid={uid}'" href="javascript:void(0)">同意</a></li>
                        <li><a class="refuse ui-updateSingle" data-custom-params="url:'@Url.Action("IsAgree")',id:'{id}',addParams:'isagree=refuse&request_uid={uid}'" href="javascript:void(0)">拒绝</a></li>
                        <li><a class="yjrefuse ui-updateSingle" data-custom-params="url:'@Url.Action("IsAgree")',id:'{id}',addParams:'isagree=yjrefuse&request_uid={uid}'" href="javascript:void(0)">永久拒绝</a></li>
                    </ul>
                </div>
            </td>
        </tr>

    </table>
</div>

<script type="text/javascript">
    function LoadData()
    {
        var url = "@Url.Action("PageListData")?requestxx=" + Request("requestxx");
        $("#tb_list").ListBind(url, {callBack: "LoadedInit" });

        $(function () {
            if (Request("requestxx") == "my") {
                $(".gdcz").attr("disabled", "disabled");
                $("div.uid").hide().siblings("div.request_uid").show();
            } else {
                $("div.request_uid").hide().siblings("div.uid").show();
            }
            ConvertText($(".Member"));
            ConvertText($(".Member1"));
            stateEdit();//状态修改
        })
    }
    LoadData();



    function stateEdit() {
        var $state = $(".state");
        $state.each(function (i) {
            var $state_text = $(this).text();
            if ($state_text == "0") {
                $state.eq(i).text("请求中");
            } else if ($state_text == "1") {
                $(".gdcz").eq(i).attr("disabled", "disabled")
                $state.eq(i).text("已同意");
            } else if ($state_text == "-1") {
                $state.eq(i).text("已拒绝");
            }else if ($state_text == "-2") {
                $state.eq(i).text("永久拒绝");
            }
        })
    }
</script>