<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 champ date réutilisable (WOU/DRY)
        Usage: <ui:include src="/templates/components/forms/form-field-calendar.xhtml">
                  <ui:param name="id" value="fieldId" />
                  <ui:param name="label" value="Label du champ" />
                  <ui:param name="value" value="#{bean.property}" />
                  <ui:param name="required" value="true" />
                  <ui:param name="pattern" value="dd/MM/yyyy" />
                </ui:include>
    -->
    
    <div class="field">
        <p:outputLabel for="#{id}" value="#{label}" />
        <p:calendar id="#{id}" 
                   value="#{value}" 
                   showIcon="true" 
                   navigator="true" 
                   required="#{not empty required and required}"
                   locale="fr" 
                   pattern="#{not empty pattern ? pattern : 'dd/MM/yyyy'}"
                   styleClass="w-full">
            <p:ajax event="dateSelect" 
                   update="#{not empty update ? update : '@form'}" />
        </p:calendar>
    </div>
</ui:composition>

