<#if !startVisitDate??>
    <#assign startVisitDate=(.now?long-7*24*3600*1000)?number_to_date/>
</#if>
<@visit.sessionList sessionId=sessionId ip=ip startVisitDate=startVisitDate endVisitDate=endVisitDate orderType=orderType pageIndex=pageNum pageSize=numPerPage>
<div class="pageHeader card">
    <form class="pagerForm"  action="visit/session.html" autocomplete="off" onsubmit="return divSearch(this,'visitBox');" method="post">
        <#include "../include_page/parameters.html"/>
        <div class="searchBar">
            <ul class="searchContent">
                <li>
                    <label><@t.page 'visit.session'/>:</label>
                    <input type="text" name="sessionId" value="${sessionId!}" size="20"/>
                </li>
                <li>
                    <label><@t.page 'visit.ip'/>:</label>
                    <input type="text" name="ip" value="${ip!}" size="20"/>
                </li>
                <li>
                    <label><@t.page 'visit.visit_date'/>:</label>
                    <input type="text" name="startVisitDate" class="date" size="10" dateFmt="yyyy-MM-dd" maxDate="{%y}-%M-{%d}" value="${startVisitDate!}"/>
                    <a class="inputDateButton" href="javascript:void(0);"></a>
                    <span>-</span>
                    <input type="text" name="endVisitDate" class="date" size="10" dateFmt="yyyy-MM-dd" maxDate="{%y}-%M-{%d+1}" value="${endVisitDate!}"/>
                    <a class="inputDateButton" href="javascript:void(0);"></a>
                </li>
            </ul>
            <div class="subBar">
                <ul>
                    <li>
                        <button type="submit" class="buttonActive"><@t.page 'button.search'/></button>
                    </li>
                    <li>
                        <a class="button" href="visit/exportSession?_csrf=<@tools.csrfToken admin=true/>" target="dwzExport" targetType="navTab"><i class="bi bi-cloud-download"></i><@t.page "button.export"/></a>
                    </li>
                </ul>
            </div>
        </div>
    </form>
</div>
<div class="card">
    <div class="panelBar">
        <ul class="toolBar">
        </ul>
    </div>
    <table class="table" width="100%" layoutH targetType="ajax" rel="visitBox" orderField="${orderField!}" orderType="${orderType!}">
        <thead>
            <tr>
                <th><@t.page 'visit.session'/></th>
                <th orderField="lastVisitDate"><@t.page 'visit.visit_date.last'/></th>
                <th><@t.page 'visit.visit_date.first'/></th>
                <th><@t.page 'visit.ip'/></th>
                <th>PV</th>
            </tr>
        </thead>
        <tbody>
            <#list page.list as a>
            <tr>
                <td><a href="visit/history.html?sessionId=${a.id.sessionId!}" target="navTab" rel="visit/history">${a.id.sessionId!}</a></td>
                <td>${a.lastVisitDate!}</td>
                <td>${a.firstVisitDate!}</td>
                <td>
                    <div class="box">
                        <p>${a.ip!}</p>
                        <p>${(getIpRegion(a.ip).address)!}</p>
                    </div>
                </td>
                <td class="center">${a.pv!}</td>
            </tr>
            </#list>
        </tbody>
    </table>
    <#assign rel='visitBox'/>
    <#include "../include_page/page.html"/>
</div>
</@visit.sessionList>