<?xml version="1.0" encoding="UTF-8"?>

<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://xmlns.jcp.org/jsf/core" xmlns:h="http://xmlns.jcp.org/jsf/html" xmlns:ui="http://xmlns.jcp.org/jsf/facelets" xmlns:p="http://primefaces.org/ui"
    xmlns:e="http://www.ivu.de/elect/tags">

    <!--@elvariable id="msgs" type="de.ivu.elect.business.lokalisierung.control.LokalisierungResourceBundle"-->

    <!--@elvariable id="bulkExportSearchView" type="de.ivu.elect.presentation.dokumente.exchange.AbstractDokumentBulkExportSearchView"-->
    <!--@elvariable id="bulkExportSearchMenu" type="de.ivu.elect.jee.presentation.menu.AbstractMenuModelBuilder"-->

    <ui:insert name="bulkExportSearchActions">
        <ui:fragment rendered="#{not empty bulkExportSearchMenu and not empty bulkExportSearchMenu.menuModel}">
            <nav role="navigation" aria-label="#{msgs['page.search.actions.label']}">
                <h:form id="frmBulkExportSearchActions">
                    <f:attribute name="role" value="presentation" />
                    <p:menubar id="menubarBulkExportSearchActions" model="#{bulkExportSearchMenu.menuModel}" />
                </h:form>
            </nav>
        </ui:fragment>
    </ui:insert>

    <h:form>
        <e:searchTable searchView="#{bulkExportSearchView}" actionMenu="#{dokumentBulkExportSearchEntryActionMenu}" columnBuilder="#{dokumentBulkExportSearchEntryColumnBuilder}" />

        <div class="ui-state-hidden">
            <p:commandButton rendered="#{bulkExportSearchView.dokumentDownloadable}" widgetVar="btnDownloadDokumentWidget" action="#{bulkExportSearchView.downloadDokument}" ajax="false" value="#{msgs['datei.export.action.download']}" />
            <p:remoteCommand name="triggerBtnDownloadDokument" autoRun="#{bulkExportSearchView.dokumentDownloadable}" oncomplete="PF('btnDownloadDokumentWidget').jq.click();" />
        </div>
    </h:form>

    <!--@elvariable id="bulkExportSearchView#exportDokumentDialog" type="de.ivu.elect.presentation.exchange.ExportViewConfirmDialog"-->
    <e:modalDialog dialogName="ExportDokumentDialog" updateContentOnClose="false" visible="#{bulkExportSearchView.exportDokumentDialog.visible}" header="#{bulkExportSearchView.exportDokumentDialog.header}">
        <p:panel id="ctnExportDokumentDialog">
            <h:outputText rendered="#{bulkExportSearchView.exportDokumentDialog.messageRendered}" value="#{bulkExportSearchView.exportDokumentDialog.message}" />

            <ui:fragment rendered="#{bulkExportSearchView.exportDokumentDialog.modelRendered}">
                <ui:decorate template="/WEB-INF/templates/dyna-form.xhtml">
                    <ui:param name="model" value="#{bulkExportSearchView.exportDokumentDialog.model}" />
                </ui:decorate>
            </ui:fragment>

            <f:facet name="footer">
                <p:commandButton id="btnBulkExport" action="#{bulkExportSearchView.exportDokumentConfirmed}" ajax="false" onclick="PF('ctnContentBlockUI').show(); PF('dlgExportDokumentDialogWidget').hide();"
                    value="#{msgs['dokument.erzeugen.action.erzeugen']}" />

                <p:commandButton id="btnCancel" action="#{bulkExportSearchView.exportDokumentCanceled}" ajax="false" onclick="PF('ctnContentBlockUI').show(); PF('dlgExportDokumentDialogWidget').hide();"
                    value="#{msgs['entity.edit.action.cancel']}" styleClass="ui-button--flat" />
            </f:facet>
        </p:panel>
    </e:modalDialog>
</ui:composition>
