<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>

<%@taglib prefix="a4j" uri="http://richfaces.org/a4j"%>
<%@taglib prefix="rich" uri="http://richfaces.org/rich"%>

<%@taglib prefix="p" uri="http://primefaces.prime.com.tr/ui"%>
<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<f:subview id="reporting">
    <html>
        <body>
            <a4j:keepAlive beanName="clients" ajaxOnly="true"/>
            <p:panel header="Reporting" >
                <h:form id="reportForm">
                    <h:panelGrid columns="2">
                        <h:outputText value="Zvoľte pobočku:" />
                        <h:selectOneMenu id="selectClientForReport"
                                         value="#{clients.selectedClient}"
                                         valueChangeListener="#{clients.selectListener}"
                                         style="text-size: 8px;">
                            <a4j:support event="onchange" reRender="reportForm" />
                            <f:selectItems value="#{clients.clientsToSelectList}" />
                        </h:selectOneMenu>
                    </h:panelGrid>

                    <h:outputText value="Údaje pre pobočku: #{clients.client.clientName}" />
                    <p:dataTable id="reportData" var="backup" value="#{clients.selectedClientBackups}"
                                 styleClass="center">

                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="Uspešná" />
                            </f:facet>
                            <center>
                                <h:graphicImage value="images/active.png" width="18" height="18" rendered="#{backup.success == 1}"/>
                                <h:graphicImage value="images/deactive.png" width="18" height="18" rendered="#{backup.success == 0}"/>
                            </center>
                        </p:column>

                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="Súbor" />
                            </f:facet>
                            <h:outputText value="#{backup.path}">

                            </h:outputText>
                        </p:column>

                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="Typ" />
                            </f:facet>
                            <h:outputText value="#{backup.type}">

                            </h:outputText>
                        </p:column>

                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="Datum uloženia" />
                            </f:facet>
                            <h:outputText value="#{backup.uploadDateString}">

                            </h:outputText>
                        </p:column>

                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="Čas uloženia" />
                            </f:facet>
                            <h:outputText value="#{backup.uploadTimeString}">

                            </h:outputText>
                        </p:column>

                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="Veľkosť" />
                            </f:facet>
                            <h:outputText value="#{backup.size} MB">

                            </h:outputText>
                        </p:column>

                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="Počet dokumentov" />
                            </f:facet>
                            <h:outputText value="#{backup.documentsCount}">
                            </h:outputText>
                        </p:column>
                    </p:dataTable>
                </h:form>
            </p:panel>
        </body>
    </html>
</f:subview>
