@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>
<div class="head-tab head-tab_hasa">
    <ul>
        <li class="tabhead current" num="0"><a href="@Url.Action("Index","FriendsRequest")?num=0">所有请求</a></li>
        <li class="tabhead" num="1"><a href="@Url.Action("Index","FriendsRequest")?num=1&state=1">已通过</a></li>
        <li class="tabhead" num="2"><a href="@Url.Action("Index","FriendsRequest")?num=2&state=0">请求中</a></li>
        <li class="tabhead" num="3"><a href="@Url.Action("Index","FriendsRequest")?num=3&state=-1">已拒绝</a></li>
        <li class="tabhead" num="4"><a href="@Url.Action("Index","FriendsRequest")?num=4&state=-2">永久拒绝</a></li>
    </ul>
</div>
<div class="main no-top-border">
    <table class="tb-head" cellpadding="0" cellspacing="0" border="0">
        <tr>
            <td class="btn-group left">
                <button type="button" class="btn btn-default btn-sm ui-selectInvert">反选</button>
                <button type="button" class="btn btn-default btn-sm ui-deleteMultiple" data-custom-params="url:'@Url.Action("Delete")'">删除</button>
            </td>
            <td class="form-inline form-group-sm right">
                <select id="order" name="order" class="form-control ui-queryString option_jj">
                    <option value="">选择排序方式</option>
                    <option value="thedate desc">按时间↓</option>
                    <option value="thedate asc">按时间↑</option>
                </select>
                <input type="text" id="thedate" name="thedate" maxlength="30" placeholder="开始日期" style="width:105px" onclick="laydate({istime:true,format:'YYYY-MM-DD'})" class="laydate-icon form-control ui-queryString">
                <input type="text" id="thedate" name="thedate" maxlength="30" placeholder="结束日期" style="width:105px" 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 option_jj">
                    <option value="username">请求用户</option>
                    <option value="request_username">被请求用户</option>
                    <option value="request_info">请求信息</option>
                </select>
                <input type="text" id="keyword" value="" maxlength="30" style="width:100px" placeholder="输入关键词" 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="27%">请求信息</td>
            <td align="center" width="10%">请求用户</td>
            <td align="center" width="10%">好友备注</td>
            <td align="center" width="10%">被请求用户</td>
            <td align="center" width="18%">时间</td>
            <td align="center" width="10%">状态</td>
            <td align="center" width="12%">操作</td>
        </tr>
        <tr class="item" id="item_{id}">
            <td align="center" width="30px"><input type="checkbox" id="id" name="id" value="{id}"></td>
            <td align=left>{request_info}</td>
            <td align="center">{username}</td>
            <td align="center">{friend_beizhu}</td>
            <td align="center">{request_username}</td>
            <td align="center">{thedate}</td>
            <td align="center" class="state">{state}</td>
            <td align="center">
                <div class="btn-group btn-group-sm">
                    <a href="javascript:void(0)" class="btn btn-default btn-sm ui-deleteSingle" data-custom-params="url:'@Url.Action("Delete")',id:'{id}'">删除</a>
                </div>
            </td>
        </tr>

    </table>
</div>
<script type="text/javascript">
    document.write('<' + 'script type="text/javascript" src="' + baseUrl + '/js/list.js"></' + 'script>');
    function LoadData()
    {
        var url = "@Url.Action("PageListData")?state=" + Request("state")
        $("#tb_list").ListBind(url, {callBack: "LoadedInit" });
        stateEdit();//状态修改
        $(".tabhead").eq(parseInt(Request("num"))).addClass("current").siblings().removeClass("current")
    }
    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>