<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:h="http://xmlns.jcp.org/jsf/html"
                xmlns:f="http://xmlns.jcp.org/jsf/core"
                xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
                xmlns:p="http://primefaces.org/ui">
    
    <!-- 
        Composant bouton primaire réutilisable (WOU/DRY)
        Usage: <ui:include src="/templates/components/buttons/button-primary.xhtml">
                  <ui:param name="value" value="Texte du bouton" />
                  <ui:param name="icon" value="pi pi-icon-name" />
                  <ui:param name="action" value="#{bean.method}" />
                  <ui:param name="outcome" value="/page" />
                  <ui:param name="update" value="componentId" />
                  <ui:param name="onclick" value="javascript" />
                  <ui:param name="disabled" value="false" />
                  <ui:param name="styleClass" value="" />
                </ui:include>
    -->
    
    <ui:fragment rendered="#{empty rendered or rendered}">
        <ui:fragment rendered="#{empty outcome}">
            <ui:fragment rendered="#{not empty update and update != 'none'}">
                <p:commandButton 
                    value="#{value}"
                    icon="#{icon}"
                    action="#{action}"
                    update="#{update}"
                    onclick="#{onclick}"
                    oncomplete="#{oncomplete}"
                    disabled="#{not empty disabled and disabled}"
                    styleClass="ui-button-primary #{not empty outlined and outlined ? 'ui-button-outlined' : ''} #{not empty styleClass ? styleClass : ''}"
                    title="#{title}" />
            </ui:fragment>
            <ui:fragment rendered="#{empty update or update == 'none'}">
                <p:commandButton 
                    value="#{value}"
                    icon="#{icon}"
                    action="#{action}"
                    ajax="false"
                    onclick="#{onclick}"
                    oncomplete="#{oncomplete}"
                    disabled="#{not empty disabled and disabled}"
                    styleClass="ui-button-primary #{not empty outlined and outlined ? 'ui-button-outlined' : ''} #{not empty styleClass ? styleClass : ''}"
                    title="#{title}" />
            </ui:fragment>
        </ui:fragment>
        <ui:fragment rendered="#{not empty outcome}">
            <p:button 
                value="#{value}"
                icon="#{icon}"
                outcome="#{outcome}"
                styleClass="ui-button-primary #{not empty outlined and outlined ? 'ui-button-outlined' : ''} #{not empty styleClass ? styleClass : ''}"
                title="#{title}" />
        </ui:fragment>
    </ui:fragment>
</ui:composition>

