<%@ include file="/common/taglibs.jsp" %>

<head>
    <title>${name} [<fmt:message key="title.projects.timereports"/>]</title>
    <meta name="heading" content="<fmt:message key='userProfile.heading'/>"/>
    <meta name="menu" content="projects"/>

</head>

<c:set var="panelContent">
            <div class="Pane">
                <form action="${ctx}/projects/${id}" method="get">
                            <input type="hidden" name="view" value="timereports"/>
                            <span class="Field"><s:select value="person" name="person" key="label.issue.time.person" list="peopleWithTimeLogs" listKey="id" listValue="fullName" multiple="false" size="1" theme="xhtml" headerKey="-1" headerValue="%{getText('label.selectone')}"/></span>
                            <span class="Field">
                                <s:textfield name="startDate" id="qStartDate" key="label.issue.time.startdate" theme="xhtml" cssClass="DateField"/>
                            </span>
                            <span class="Field">
                                <s:textfield name="endDate" id="qEndDate" key="label.issue.time.enddate" cssClass="DateField" theme="xhtml" />
                            </span>
                            <span class="Field">
                                <s:submit key="action.filter" cssClass="submit"/>
                            </span>
                            <span class="Field">
                                <c:if test="${(person != null && person > 0) || (startDate != null && fn:length(startDate) > 0) || (endDate != null && fn:length(endDate) > 0)}">
                                    <a class="removeFilter" href="${ctx}/projects/${id}?view=timereports" title="<fmt:message key="action.removefilter"/>"><fmt:message key="action.removefilter"/></a>
                                </c:if>                                
                            </span>

                </form>
                <h2 class="filterApplied">
                    <span class="strong">${totalEffort}</span> hours logged by ${totalPeople} people between <s:date name="objectStartDate" format="dd MMMMM yyyy"/> and <s:date name="objectEndDate" format="dd MMMMM yyyy"/>
			    </h2>
                <div class="GenericTable GreyTable">
                <display:table name="timeLogs"  id="timeLogReport" export="${currentUser != null}" requestURI="${ctx}/projects/${id}" excludedParams="" pagesize="30">
                    <display:column class="Date" decorator="com.hedgehoglab.fixx.renderer.decorator.SimpleDateWrapper" headerClass="first" property="createdAt" sortable="true" sortName="id" titleKey="label.issue.time.date"/>
                    <display:column class="Hours darker" property="effort" titleKey="label.issue.time.hours" sortable="true" escapeXml="true"/>
                    <display:column titleKey="label.issue.time.description" class="Description darker" property="description" sortable="true" escapeXml="true"/>
                    <display:column headerClass="first" class="Person" property="createdByUser" titleKey="label.issue.time.person"
                                    sortable="true" escapeXml="true"></display:column>
                </display:table>
                </div>                
            </div>
</c:set>
<c:if test="${fn:length(timeLogs) > 0}">
    <div class="rightPanel TimeReportRightPanel">
        <div class="PropertyPane">
                <h2><fmt:message key="heading.chart.productivity"/> </h2>
                <img src="${ctx}/chart/timeloghistory?project=${id}&startDate=${startDate}&endDate=${endDate}" class="chart"/>
            <c:if test="${(person == null || person < 1)}">            
                <h2><fmt:message key="heading.chart.personproductivity"/> </h2>
                <img src="${ctx}/chart/timelogpersonhistory?project=${id}&startDate=${startDate}&endDate=${endDate}" class="chart"/>
            </c:if>
        </div>
    </div>
</c:if>
<div class="realContent TimeReportPanel">
    <c:import url="/WEB-INF/pages/includes/projects/menu/edit.jsp">
        <c:param name="pageName" value="Timereports"/>
        <c:param name="content" value="${panelContent}"/>
        <c:param name="id" value="${id}"/>
    </c:import>
</div>