<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@page import="org.ellectra.gui.utils.JSFUtils"%>
<%@page import="javax.faces.context.FacesContext"%>
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%> 

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title></title>
        <style>
            .body1 {
                
                height:300px;
                width:800px;
                overflow:auto;
                
            }
            
            .body2 {
                
                height:300px;
                width:300px;
                overflow:auto;
                
            }
            
            .body3 {
                
                height:350px;
                width:900px;
                overflow:auto;
                
            }
            
        </style>
        <link rel="stylesheet"  href="commission.css" type="text/css" >
    <link rel="stylesheet" href="ellectraweb.css" type="text/css" >
    </head>
    <body>
        <f:view>
            <h1><h:outputText value="CPV Code Selector" /></h1>
            <h:form>
                
                <h:panelGrid styleClass="gridstyle" columns="2" columnClasses="gridContent">
                    
                    <rich:panel bodyClass="body1">
                        <f:facet name="header">
                            CPV Codes
                        </f:facet>
                        <rich:tree style="width:200px" nodeSelectListener="#{cpvTreeBean.processSelection}" 
                                   reRender="selectedNodelist"  ajaxSubmitSelection="true" switchType="ajax"
                                   value="#{cpvTreeBean.treeNode}" var="item">
                        </rich:tree>
                    </rich:panel>

                    <rich:panel bodyClass="body2">
                        <h:panelGrid styleClass="gridstyle" columns="1" columnClasses="gridContent">
                        <f:facet name="header">
                            Selected CPV Codes
                        </f:facet>
                           <h:selectOneListbox style="width:200px" size="12" id="selectedNodelist" value="#{cpvTreeBean.selectedoncecode}" onchange="submit();">
                                <f:selectItems value="#{cpvTreeBean.cpvselectedcode1}"/>
                            </h:selectOneListbox>
                            <a4j:commandButton value="Remove From List" action="#{cpvTreeBean.removeFromList}" reRender="selectedNodelist" />
                         
                        </h:panelGrid>
                    </rich:panel>
                  
                </h:panelGrid>
                   
                   
                  
                        
                <rich:panel bodyClass="body3"> 
                        
                            <f:facet name="header">
                                Search for CPV Codes
                            </f:facet>
                            
                            <h:panelGrid styleClass="gridstyle" columns="2" >
                                <h:inputText value="#{cpvTreeBean.searchforcpvcodewithcpvcode}"  valueChangeListener="#{cpvTreeBean.searchforcodevcl}" />
                                <a4j:commandButton value="Search" action="#{cpvTreeBean.search}" reRender="foundcpvcodeslist" />
                            </h:panelGrid>
                        
                            <h:panelGrid styleClass="gridstyle" columns="1">
                                <h:selectOneListbox style="width:500px" size="12" id="foundcpvcodeslist" value="#{cpvTreeBean.selectedcodefromsearch}" onchange="submit();">
                                    <f:selectItems value="#{cpvTreeBean.searchfoundcodes}"/>
                                </h:selectOneListbox>
                        
                                <a4j:commandButton value="Add on CPV List" action="#{cpvTreeBean.addOnTheList}" reRender="selectedNodelist" />
                            </h:panelGrid>
                        
                </rich:panel>
            
            </h:form>
            <h:form>
                <h:commandButton value="Back" styleClass="buttonstyle" action="#{cpvTreeBean.MainCodeForCreateTender3}"></h:commandButton>
            </h:form>
        </f:view>
    </body>
</html>
