<%@page import="com.capgemini.framework.common.DateHelper" %>
<%@page import="com.capgemini.reports.ReportEnum" %>
<%@page import="com.capgemini.reports.database.stats.GenJspStats" %>
<%
    /* Retreive parameter */
    String theStartPeriod = DateHelper.getDate();
    String theEndPeriod = DateHelper.getDate();
    if ((request.getParameter("startPeriod") != null) && (request.getParameter("endPeriod") != null)) {
        theStartPeriod = String.valueOf(request.getParameter("startPeriod"));
        theEndPeriod = String.valueOf(request.getParameter("endPeriod"));
    }
    String theJsStatArray1 = GenJspStats.generateTimingsTableAsJS(theStartPeriod, theEndPeriod);
    int nbReports = ReportEnum.values().length;
%>
<!DOCTYPE html>
<html>
<head>
    <!-- Disable client browser cache -->
    <meta http-equiv="cache-control" content="no-cache"/>
    <meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT"/>
    <meta http-equiv="pragma" content="no-cache"/>

    <title>Statistiques par rapport</title>
    <link rel="stylesheet" href="/kurt-web/css/kurt-style-frame.css">
    <link rel="stylesheet" href="/kurt-web/css/pikaday.css">

    <script src="/kurt-web/js/moment.js"></script>
    <script src="/kurt-web/js/pikaday.js"></script>
    <script src="/kurt-web/js/statistics.js"></script>
    <script src="/kurt-web/js/post_form.js"></script>
    <script src="/kurt-web/js/kurt-common-submit.js"></script>
    <script>
        var nbReports = <%=nbReports%>;
        var reportStatArray = new Array();
        <%= theJsStatArray1 %>
    </script>
</head>
<body>

<img src="/kurt-web/ihm/ico-report-stats.png" align="left" width="64" height="64" hspace="12"/><br/>
<h1>Statistiques par rapport</h1>

<div align="right">
    <form class="form" id="downloadForm" method="get" onsubmit="return true;">
        <table cellspacing="0" cellpadding="3" border="0">
            <tbody>
            <tr>
                <td><input id="startPeriod" type="text" name="startPeriod" style="cursor:hand;width:200px;"
                           value="<%=theStartPeriod%>"/>
                    <div class="flow-element">
                        <div id="container-start-period">
                        </div>
                    </div>
                </td>
                <td>/</td>
                <td>
                    <input id="endPeriod" type="text" name="endPeriod" style="cursor:hand;width:200px;"
                           value="<%=theEndPeriod%>"/>
                    <div class="flow-element">
                        <div id="container-end-period">
                        </div>
                    </div>
                </td>
                <td>
                    <input type="submit" value="OK" style="width:25px;"/>
                </td>
            </tr>
            </tbody>
        </table>
    </form>
    <br/>
</div>

<center>
    <div align="center">
        <table cellspacing="0" cellpadding="1" border="0" width="95%" style="border:1px solid #9EC8DE">
            <tr>
                <th class="reportTable">Code du rapport</th>
                <th class="reportTable">Nombre d'ex�cutions</th>
                <th class="reportTable">Erreurs de saisie</th>
                <th class="reportTable">Erreurs techniques</th>
                <th class="reportTable">Dur�e minimale</th>
                <th class="reportTable">Dur�e moyenne</th>
                <th class="reportTable">Dur�e maximale</th>
            </tr>
            <script>
                DisplayTablePerReport();
            </script>
        </table>

        <br/><br/>


        <br/><br/>
        <button class="formButton" onclick="downloadTable(2)">Export CSV par rapport</button>
        <button class="formButton" onclick="closeWindow()">Annuler</button>
    </div>
</center>
<script>
    initPicker('startPeriod', 'container-start-period');
    initPicker('endPeriod', 'container-end-period');
</script>
</body>
</html>