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

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

    <!-- Methoden in de.ivu.elect.jee.presentation.dynamicform.DynamicFormEditOrCreateView aktuell halten!!! -->
    <!--@elvariable id="msgs" type="de.ivu.elect.business.lokalisierung.control.LokalisierungResourceBundle"-->

    <!--@elvariable id="backingView" type="de.ivu.elect.jee.presentation.dynamicform.DynamicFormEditOrCreateView"-->
    <p:panel id="ctnDynaForm" widgetVar="ctnDynaFormWidget" styleClass="ui-dynaform-editpanel">
        <ui:insert name="dynaFormContent">
            <ui:insert name="first" />

            <ui:insert name="controls">
                <ui:fragment rendered="#{not empty backingView.model}">
                    <ui:decorate template="/WEB-INF/templates/dyna-form.xhtml">
                        <ui:param name="model" value="#{backingView.model}" />
                    </ui:decorate>
                </ui:fragment>

                <ui:insert />
            </ui:insert>

            <ui:insert name="last" />

            <ui:fragment rendered="#{backingView.btnShowAllFormFieldsRendered}">
                <e:inputShowAllFormFields />
            </ui:fragment>
        </ui:insert>

        <c:if test="#{footerRendered ne false}">
            <f:facet name="footer">
                <ui:insert name="dynaFormFooter">
                    <p:fragment id="ctnDynaFormFooter">
                        <ui:insert name="firstButtons" />

                        <!-- NOTE, dass die IDs der Buttons ggf. in anderen Views, bspw. ELECT-7192, referenziert werden und deshalb NICHT geändert werden sollten! -->
                        <p:commandButton id="btnSave" rendered="#{backingView.btnSaveRendered}" action="#{backingView.save}" ajax="false" onclick="PF('ctnContentBlockUI').show()" value="#{backingView.btnSaveLabel}" />

                        <ui:insert name="buttons" />

                        <p:commandButton id="btnReset" rendered="#{backingView.btnResetRendered}" action="#{backingView.reset}" ajax="false" immediate="true" onclick="PF('ctnContentBlockUI').show()" value="#{msgs['entity.edit.action.reset']}" styleClass="ui-button--flat" />

                        <p:commandButton id="btnCancel" rendered="#{backingView.btnCancelRendered}" action="#{backingView.cancel}" ajax="false" immediate="true" onclick="PF('ctnContentBlockUI').show()" value="#{msgs['entity.edit.action.cancel']}" styleClass="ui-button--flat" />
                    </p:fragment>
                </ui:insert>
            </f:facet>
        </c:if>
    </p:panel>
</ui:composition>
