<%@ taglib prefix="c" uri="/WEB-INF/common" %>

<%@ taglib prefix="t" uri="http://myfaces.apache.org/tomahawk" %>
<%@ taglib prefix="h" uri="http://java.sun.com/jsf/html" %>
<%@ taglib prefix="f" uri="http://java.sun.com/jsf/core" %>
<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%>

<f:loadBundle var="bundle" basename="tvark.Resources"/>

<c:body step="#{5}">
    
    <h:outputFormat value="#{bundle.formatStepTitle}" styleClass="float-title">
        <f:param value="5" />
        <f:param value="#{bundle.titleResults}" />
    </h:outputFormat>
    
    <h:panelGroup styleClass="marginBottom">
	    <h:outputLink target="_blank" value="download.jsp">
	        <h:outputText value="#{bundle.downloadZip}" />
	    </h:outputLink>
    </h:panelGroup>
        
    <h:panelGrid columns="2" styleClass="panel" columnClasses="panel" cellspacing="0">
        <h:outputText value="#{bundle.schedules}" />
        
        <h:selectOneMenu value="#{resultsBean.displayMode}">
            <f:selectItem itemLabel="#{bundle.initialSchedule}" itemValue="#{resultsBean.displayMode.initial}"/>
            <f:selectItem itemLabel="#{bundle.optimizedSchedule}" itemValue="#{resultsBean.displayMode.final}"/>
            <f:selectItem itemLabel="#{bundle.initialOptimizedSchedule}" itemValue="#{resultsBean.displayMode.both}"/>
        </h:selectOneMenu>
        
        <h:outputText value="#{bundle.owner}" />
		<t:panelGrid columnClasses="paddingBottom" cellspacing="0">
			<h:selectOneMenu value="#{resultsBean.scheduleOwner}" onchange="showOnly(selectedIndex - 1, 'id1', 'id2', 'id3', 'id4')">
	            <f:selectItem itemLabel="#{bundle.school}" itemValue="#{resultsBean.scheduleOwner.school}"/>
	            <f:selectItem itemLabel="#{bundle.group}" itemValue="#{resultsBean.scheduleOwner.group}"/>
	            <f:selectItem itemLabel="#{bundle.student}" itemValue="#{resultsBean.scheduleOwner.student}"/>
	            <f:selectItem itemLabel="#{bundle.teacher}" itemValue="#{resultsBean.scheduleOwner.teacher}"/>
	            <f:selectItem itemLabel="#{bundle.room}" itemValue="#{resultsBean.scheduleOwner.room}"/>
	        </h:selectOneMenu>

            <h:panelGroup>
	            <t:selectOneMenu value="#{resultsBean.groupId}" forceId="true" id="id1" style="#{resultsBean.scheduleOwner.isGroup ? '' : 'display: none;'}">
	                <f:selectItems value="#{utilsBean.items[resultsBean.initial.groupIds]}" />
	                <f:converter converterId="tvark.StringConverter"/>
	            </t:selectOneMenu>
		
				<t:selectOneMenu value="#{resultsBean.studentId}" forceId="true" id="id2" style="#{resultsBean.scheduleOwner.isStudent ? '' : 'display: none;'}">
					<f:selectItems value="#{utilsBean.items[resultsBean.initial.studentIds]}" />
					<f:converter converterId="tvark.StringConverter"/>
		        </t:selectOneMenu>
		
				<t:selectOneMenu value="#{resultsBean.teacherId}" forceId="true" id="id3" style="#{resultsBean.scheduleOwner.isTeacher ? '' : 'display: none;'}">
					<f:selectItems value="#{utilsBean.items[resultsBean.initial.teacherIds]}" />
					<f:converter converterId="tvark.StringConverter"/>
		        </t:selectOneMenu>
		
				<t:selectOneMenu value="#{resultsBean.roomId}" forceId="true" id="id4" style="#{resultsBean.scheduleOwner.isRoom ? '' : 'display: none;'}">
					<f:selectItems value="#{utilsBean.items[resultsBean.initial.roomIds]}" />
					<f:converter converterId="tvark.StringConverter"/>
		        </t:selectOneMenu>
	        </h:panelGroup>
	
    	</t:panelGrid>

    </h:panelGrid>
    
    <h:commandButton value="#{bundle.view}" action="results" styleClass="button" />
    

</c:body>
