<@_tradeOrderList userId=userId paymentId=paymentId processed=processed status=status
            orderType=orderType pageIndex=pageNum pageSize=numPerPage>
<div class="pageHeader">
    <form class="pagerForm" autocomplete="off" onsubmit="return navTabSearch(this);" method="post">
        <#include "../include_page/parameters.html"/>
        <div class="searchBar">
            <ul class="searchContent">
                <li>
                    <label><@t.page 'user'/>:</label>
                    <#include "../include_page/userId.html"/>
                </li>
                <li>
                    <label><@t.page 'payment.id'/>:</label>
                    <input type="text" name="paymentId" value="${paymentId!}" />
                </li>
                <li>
                    <label><@t.page 'status'/>:</label>
                    <#list 0..4 as s>
                        <label style="width:auto">
                            <input <@t.compare status!'' s?string 'checked="checked"'/> name="status" value="${s}" type="checkbox"/>
                            <@t.page 'status.order.'+s/>
                        </label>
                    </#list>
                </li>
                <li>
                    <label><@t.page 'order.process'/>:</label>
                    <select class="combox" name="processed">
                        <option value=""${(!processed?has_content)?then(' selected="true"','')?no_esc}><@t.page 'order.all'/></option>
                        <option value="false"${(processed??&&"false"=processed)?then(' selected="true"','')?no_esc}><@t.page 'no'/></option>
                        <option value="true"${(processed??&&"true"=processed)?then(' selected="true"','')?no_esc}><@t.page 'yes'/></option>
                    </select>
                </li>
            </ul>
            <div class="subBar">
                <ul>
                    <li>
                        <button type="submit" class="buttonActive"><@t.page 'button.search'/></button>
                    </li>
                </ul>
            </div>
        </div>
    </form>
</div>
<@_sysAuthorized roleIds=admin.roles urls='tradeOrder/confirm,tradeOrder/invalid,tradeOrder/process,tradeOrder/close,tradeOrderHistory/list'><#assign authorizedMap=map/></@_sysAuthorized>
<div class="pageContent">
    <table class="table" width="100%" layoutH="92">
        <thead>
            <tr>
                <th width="20"><input type="checkbox" group="ids" class="checkboxCtrl"></th>
                <th><@t.page 'id'/></th>
                <th><@t.page 'user'/></th>
                <th><@t.page 'title'/></th>
                <th><@t.page 'receiver'/></th>
                <th><@t.page 'remark'/></th>
                <th><@t.page 'status'/></th>
                <th><@t.page 'order.process'/></th>
                <th><@t.page 'payment'/></th>
                <th orderField="createDate" class="<#if orderField??&&'createDate'==orderField><#if 'asc'=orderType>asc<#else>desc</#if><#else>order</#if>"><@t.page 'create_date'/></th>
                <th><@t.page 'operate'/></th>
            </tr>
        </thead>
        <tbody>
            <#list page.list as a>
                <@t.merge 'userIds' a.userId!/>
                <@t.merge 'userIds' a.processUserId!/>
            </#list>
            <@_sysUser ids=t.userIds!><#assign userMap=map!/></@_sysUser>
            <#list page.list as a>
            <tr target="sid" rel="${a.id}">
                <td class="center"><input name="ids" value="${a.id}" type="checkbox"></td>
                <td>${a.id!}</td>
                <td class="exclude-translate">
                    <div class="box">
                        <p>${(userMap[a.userId?string].nickName)!}</p>
                        <p>${a.ip!}</p>
                    </div>
                </td>
                <td class="exclude-translate">${a.title!}</td>
                <td class="exclude-translate">
                    <div class="box">
                        <p>${a.addressee!} <label><@t.page 'telephone'/>:</label>${a.telephone!}</p>
                        <p><label><@t.page 'shipping_address'/>:</label>${a.address!}</p>
                    </div>
                </td>
                <td>${a.remark!}</td>
                <td><@t.page 'status.order.'+a.status/></td>
                <td>
                    <div class="box">
                        <p>${a.processed?then(t.pageMessage('yes'),'')} ${a.processDate!}</p>
                        <p class="exclude-translate"><#if a.processInfo?has_content><label><@t.page 'order.process_info'/>:</label></#if>${a.processInfo!}</p>
                    </div>
                </td>
                <td>
                    <div class="box">
                        <p><#if a.paymentId?has_content><label><@t.page 'payment.id'/>:</label></#if>${a.paymentId!}</p>
                        <p>${a.paymentDate!}</p>
                    </div>
                </td>
                <td>${a.createDate!}</td>
                <td class="wrap">
                    <a href="tradeOrder/view.html?id=${a.id}" class="btnText edit" target="dialog" rel="viewOrder${a.id}"><@t.page 'button.view'/></a>
                <#if !a.confirmed && ( 0 = a.status || 2 = a.status)>
                    <#if authorizedMap['tradeOrder/confirm']>
                    <a href="tradeOrder/confirmParameters.html?id=${a.id}" class="btnText green" target="dialog" mask="true"><@t.page 'order.confirm'/></a>
                    </#if>
                    <#if authorizedMap['tradeOrder/invalid']>
                    <a href="tradeOrder/invalid?id=${a.id}&_csrf=<@_csrfToken admin=true/>" class="btnText red" title="<@t.page 'confirm.invalid_order'/>" target="ajaxTodo"><@t.page 'order.invalid'/></a>
                    </#if>
                </#if>
                <#if 2=a.status && a.confirmed && !a.processed && authorizedMap['tradeOrder/process']>
                    <a href="tradeOrder/processParameters.html?id=${a.id}" class="btnText green" target="dialog" mask="true"><@t.page 'order.process'/></a>
                </#if>
                <#if (0=a.status || 1=a.status || 3=a.status ) && authorizedMap['tradeOrder/close']>
                    <a href="tradeOrder/close?id=${a.id}&_csrf=<@_csrfToken admin=true/>" class="btnText warn" title="<@t.page 'confirm.close_order'/>" target="ajaxTodo"><@t.page 'button.close'/></a>
                </#if>
                <#if authorizedMap['tradeOrderHistory/list']>
                    <a href="tradeOrderHistory/list.html?queryOrderId=${a.id}" class="btnText" target="navTab" rel="tradeOrderHistory/list"><@t.page 'order.history'/></a>
                </#if>
                </td>
            </tr>
            </#list>
        </tbody>
    </table>
    <#include "../include_page/page.html"/>
</div>
</@_tradeOrderList>