<%@page import="com.capgemini.framework.common.SettingsHelper" %>
<%@page import="com.capgemini.reports.ReportEnum"%>
<%@page import="com.capgemini.reports.common.scheduling.view.UpdateSchedulingFormatter"%>
<%! final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger("com.capgemini.report.scheduling_update.jsp"); %>
<%
    ////<!-- '/kurt-web/frames/scheduling_report.jsp?type=create&page='+page+'&uid'+id; -->
    response.setHeader("Cache-Control", "no-cache, no-store, must-revalidate"); // HTTP 1.1
    response.setHeader("Pragma", "no-cache"); // HTTP 1.0
    response.setDateHeader("Expires", 0); // Proxies


    boolean isDevMode = SettingsHelper.isDevMode();
    // Useless?
    String tempCurrentReportNumber = request.getParameter("activeSchedulingList");

    String idStr = request.getParameter("id");
    Long idLong = Long.valueOf(idStr);
    String curReportCode = request.getParameter("reportCode");
    String curReportNumber = curReportCode.replace("R", "");

    ReportEnum reportEntryEnum = ReportEnum.fromCode(curReportCode);
    String reportTitleCanonicalName = curReportCode.concat(" - ").concat( reportEntryEnum.getReportTitle() );

    String jspReportToCall = "template_r" + curReportNumber + ".jsp";

    log.trace("devMode         = " + isDevMode);
    log.trace("tempRepNumber   = " + tempCurrentReportNumber);
    log.trace("idStr           = " + idStr);
    log.trace("curReportCode   = " + curReportCode);
    log.trace("curReportNumber = " + curReportNumber);
    log.trace("jspReportToCall = " + jspReportToCall);
    log.trace("idLong          = " + idLong);

    String theSchedulingName = "";
    String thePeriod = "";
    String theDaily = "";
    String theWeekly = "";
    String theMonthly = "";
    String theWeekEnd = "";
    String theDate = "";
    String theMonthlyValue = "";
%>
<html>
<head>

    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Planification -</title>


    <link rel="stylesheet" href="/kurt-web/css/pikaday.css">
<link rel="stylesheet" href="/kurt-web/css/kurt-style.css">
<link rel="stylesheet" href="/kurt-web/css/kurt-style-frame.css">
<link rel="stylesheet" href="/kurt-web/css/scheduling.css">

    <script src="/kurt-web/js/kurt-common-submit.js"></script>
<script src="/kurt-web/js/moment.js"></script>
<script src="/kurt-web/js/pikaday.js"></script>
<script src="/kurt-web/js/post_form.js"></script>
<script src="/kurt-web/js/schedulingReport.js"></script>
<script src="/kurt-web/js/obtain_data.js"></script>

    <!--[if IE 8]> <style > input { padding-bottom:0; } </style> <![endif]-->

    <!-- Load specific script in IE8 for JSON support -->
<!--[if lt IE 9]> <script src="/kurt-web/js/json2.js" type="text/javascript"> </script> <![endif]-->

</head>
<body id="body_frame">

<!-- TITLE -->
<img src="/kurt-web/ihm/calendar_planification.png" align="left" width="64" height="64" hspace="12" />
<br />
<h1>Planification <%=reportTitleCanonicalName%> (Modification)</h1>

<div align="left" style="margin-left: 220px;">
    <form class="form" id="reportSchedulingForm" method="post" onsubmit="return false;">

        <div id="functionnal">
            <div id="title_functionnal">

                <div id="div_title_scheduling">
                    <p class="title_planification">D&eacute;finition du Rapport</p>
                </div>

            </div>
            <div id="content_functionnal">
                <jsp:include page="<%=jspReportToCall%>">
                    <jsp:param name="isActiveButtonSubmit" value="false" />
                    <jsp:param name="isUpdateReport" value="true" />
                    <jsp:param name="isCheckAuthorized" value="false" />
                    <jsp:param name="idReport" value="<%=idLong%>" />
                </jsp:include>
            </div>
        </div>
        <div id="temporal">
            <script src="/kurt-web/js/schedulingReportsCreaUpd.js"></script>
        </div>

        <!-- ZONE DYNAMIQUE RAPPORT -->
        <div id="div_title_scheduling">
            <%-- <p class="title_planification">Planification du Rapport R<%=curReportCode%></p> --%>
            <p class="title_planification"> Crit&egrave;res de la planification</p>
        </div>

        <br />
        <!--  START_SCHEDULING -->
        <%=new UpdateSchedulingFormatter(idLong).showReportUpdatePage()%>
        <!--  END_SCHEDULING -->
        <br />
        <br />
        <div id="loading" style="display: none; text-align: center;">
            <i>Traitement en cours...</i>
            <br />
            <img src="/kurt-web/ihm/progress.gif" vspace="6" width="129" height="20">
        </div>
        <div id="div_buttons" align="center">
            <button class="formButton" onclick="sendSchedulingReport('/kurt-web/scheduling/modify', '&report_code=<%=curReportCode%>&scheduling_report_id=<%=idStr%>')">Enregistrement</button>
            <button class="formButton" onclick="getReport('<%=curReportCode%>')">Retour</button>
        </div>

        <script>
            initPicker('datepicker_planification', 'container_planification');
        </script>
    </form>
</div>
</body>
</html>
