<%@ Page Title="" Language="C#" MasterPageFile="~/Master/UserMaster.master" CodeBehind="BorrowList.aspx.cs" Inherits="WAP2P.Web.PC.User.Borrow.BorrowList" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="content" runat="server">
    <div class="m-userbox m-buserbox">
        <form action="?action=search" method="get" class="search">
            <table class="m-filter js-filter mt20">
                <tr class="filter-date">
                    <th style="width: 12%;">日期范围</th>
                    <td>
                        <input type="text" class="text w130 ui-date" name="startAt" id="startAt" value="<% =Request.QueryString["startAt"].UrlEncode() %>" data-maxdate="#endAt" />
                        <span>-</span>
                        <input type="text" class="text w130 ui-date" name="endAt" id="endAt" value="<% =Request.QueryString["endAt"].UrlEncode() %>" data-mindate="#startAt" data-maxdate="<%= DateTime.Now.AddDays(1).ToDateString() %>" />
                        <a href="javascript:void(0);" data-filter-to="#startAt|#endAt" data-filter-value="<%= DateTime.Now.AddDays(-7).ToDateString() %>|<%= DateTime.Now.AddDays(1).ToDateString() %>">近一周</a>
                        <a href="javascript:void(0);" data-filter-to="#startAt|#endAt" data-filter-value="<%= DateTime.Now.AddMonths(-1).ToDateString() %>|<%= DateTime.Now.AddDays(1).ToDateString() %>">近一月</a>
                        <a href="javascript:void(0);" data-filter-to="#startAt|#endAt" data-filter-value="<%= DateTime.Now.AddMonths(-3).ToDateString() %>|<%= DateTime.Now.AddDays(1).ToDateString() %>">近三月</a>
                        <a href="javascript:void(0);" data-filter-to="#startAt|#endAt" data-filter-value="<%= DateTime.Now.AddYears(-1).ToDateString() %>|<%= DateTime.Now.AddDays(1).ToDateString() %>">近一年</a>
                    </td>
                </tr>
                <tr class="filter-style">
                    <th style="width: 12%; vertical-align: top">交易状态</th>
                    <td>
                        <a href="javascrip:void(0);" class="on" data-filter-to="#status" data-filter-value="">全部</a>
                        <asp:Repeater runat="server" ID="rptStatusFilter">
                            <ItemTemplate>
                                <a href="javascrip:void(0);" data-filter-to="#status" data-filter-value="<%# Eval("Key") %>"><%# Eval("Value") %></a>
                            </ItemTemplate>
                        </asp:Repeater>
                        <input type="hidden" name="status" id="status" value="<% =Request.QueryString["status"].UrlEncode() %>" />
                    </td>
                </tr>
                <tr class="filter-style">
                    <th style="width: 12%; vertical-align: top">借款类型</th>
                    <td>
                        <a href="javascrip:void(0);" class="on" data-filter-to="#borrowType" data-filter-value="">全部</a>
                        <asp:Repeater runat="server" ID="rptBorrowType" ItemType="WAP2P.Sys.BorrowType">
                            <ItemTemplate>
                                <a href="javascrip:void(0);" data-filter-to="#borrowType" data-filter-value="<%# Item.Id %>"><%# Item.Name %></a>
                            </ItemTemplate>
                        </asp:Repeater>
                        <input type="hidden" name="borrowType" id="borrowType" value="<% =Request.QueryString["borrowType"].UrlEncode() %>" />
                    </td>
                </tr>
            </table>
        </form>
        <table class="table-normal mt25 js-ajaxlist">
            <tr>
                <th style="width:10%;">类型</th>
                <th style="width:20%;">借款名称</th>
                <th style="width:15%;">借款金额</th>
                <th style="width:10%;">年化率</th>
                <th style="width:10%;">周期</th>
                <th style="width:20%;">借款时间</th>
                <th style="width:15%;">状态及操作</th>
            </tr>
        </table>
    </div>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="script" runat="server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="list" runat="server">
    <ruson:Repater runat="server" ID="rptList" ItemType="WAP2P.BorrowLoan.Borrow">
        <ItemTemplate>
            <tr>
                <td><%# BorrowType.LoadOrNew(Item.TypeId).Name %></td>
                <td class="g-fleft"><%# Item.Status != WAP2P.BorrowLoan.Borrow.BorrowStatus.发布待审核 && Item.Status != WAP2P.BorrowLoan.Borrow.BorrowStatus.发布审核未通过 ? string.Format("<a href=\"{0}\" target=\"_blank\">{1}</a>", WAP2P.Web.Extensions.GetBorrowUrl(Item.Id), Item.Name.LeftX(20)) : Item.Name.LeftX(20) %></td>
                <td class="fcred-3"><%# Item.LoanAmount.ToMoneyString() %>元</td>
                <td><%# (Item.YearRate * 100).ToInterestString() %>%</td>
                <td><%# Item.LoanDate %><%# Item.LoanDateUnit.GetDescription() %></td>
                <td><%# Item.CreateAt.ToDateTimeString() %></td>
                <td><%# Item.StatusDisplay.GetDescription() %><%# Item.StatusDisplay == WAP2P.BorrowLoan.Borrow.BorrowStatusDisplay.投标中 && !Item.BidPushAccount ? "<input type='button' value='撤标' class='ml5 btn-bordmini c-minibtn'  onclick=\"member.pay('" + (int)WAP2P.Account.AccountActionType.用户撤标 + "', 'bid=" + WAP2P.Web.Extensions.GetBorrowId(Item.Id) + "&vamount=false', function () { $.jSuccess('撤标成功', function() { $('form.search').trigger('submit'); }); });\" />" : string.Empty %></td>
            </tr>
        </ItemTemplate>
        <EmptyTemplate>
            <tr>
                <td colspan="7" class="g-fleft">暂无数据。</td>
            </tr>
        </EmptyTemplate>
    </ruson:Repater>
    <tr class="pager">
        <td colspan="7">
            <div class="ui-pages g-fright">
                <ruson:Pager runat="server" ID="pages" CssClass="pages" />
                <a href="<% =Request.RawUrl.UrlEncodeParam() %>" class="g-hide"></a>
            </div>
        </td>
    </tr>    
</asp:Content>
