fix(client): Corrections composants JSF - expressions EL et formulaires imbriqués
This commit is contained in:
@@ -0,0 +1,131 @@
|
|||||||
|
<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"
|
||||||
|
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core">
|
||||||
|
|
||||||
|
<p:panel header="#{mode == 'create' ? 'Nouveau Rôle' : 'Modifier Rôle'}"
|
||||||
|
styleClass="w-full">
|
||||||
|
|
||||||
|
<p:panelGrid columns="2" styleClass="w-full" columnClasses="col-12 md:col-6">
|
||||||
|
|
||||||
|
<!-- Nom du rôle -->
|
||||||
|
<p:outputLabel for="roleName" value="Nom du rôle *" />
|
||||||
|
<p:inputText id="roleName"
|
||||||
|
value="#{role.name}"
|
||||||
|
required="true"
|
||||||
|
readonly="#{readonly}"
|
||||||
|
placeholder="ADMIN, USER, MODERATOR..."
|
||||||
|
styleClass="w-full">
|
||||||
|
<f:validateLength minimum="2" maximum="100" />
|
||||||
|
<f:validateRegex pattern="^[A-Z_]+$" />
|
||||||
|
</p:inputText>
|
||||||
|
|
||||||
|
<!-- Description -->
|
||||||
|
<p:outputLabel for="description" value="Description" />
|
||||||
|
<p:inputTextarea id="description"
|
||||||
|
value="#{role.description}"
|
||||||
|
readonly="#{readonly}"
|
||||||
|
placeholder="Description du rôle..."
|
||||||
|
rows="3"
|
||||||
|
styleClass="w-full" />
|
||||||
|
|
||||||
|
<!-- Type de rôle -->
|
||||||
|
<p:outputLabel for="typeRole" value="Type de rôle *" />
|
||||||
|
<p:selectOneMenu id="typeRole"
|
||||||
|
value="#{role.typeRole}"
|
||||||
|
required="true"
|
||||||
|
readonly="#{readonly or mode == 'edit'}"
|
||||||
|
styleClass="w-full">
|
||||||
|
<f:selectItem itemLabel="Sélectionner..." itemValue="" />
|
||||||
|
<f:selectItem itemLabel="Rôle Realm" itemValue="REALM_ROLE" />
|
||||||
|
<f:selectItem itemLabel="Rôle Client" itemValue="CLIENT_ROLE" />
|
||||||
|
<f:selectItem itemLabel="Rôle Composite" itemValue="COMPOSITE_ROLE" />
|
||||||
|
</p:selectOneMenu>
|
||||||
|
|
||||||
|
<!-- Realm (si affiché) -->
|
||||||
|
<c:if test="#{showRealmSelector}">
|
||||||
|
<p:outputLabel for="realmName" value="Realm *" />
|
||||||
|
<p:selectOneMenu id="realmName"
|
||||||
|
value="#{role.realmName}"
|
||||||
|
required="#{showRealmSelector}"
|
||||||
|
readonly="#{readonly}"
|
||||||
|
styleClass="w-full">
|
||||||
|
<f:selectItem itemLabel="Sélectionner..." itemValue="" />
|
||||||
|
<f:selectItems value="#{roleBean.availableRealms}" />
|
||||||
|
</p:selectOneMenu>
|
||||||
|
</c:if>
|
||||||
|
|
||||||
|
<!-- Client (si affiché) -->
|
||||||
|
<c:if test="#{showClientSelector}">
|
||||||
|
<p:outputLabel for="clientId" value="Client *" />
|
||||||
|
<p:selectOneMenu id="clientId"
|
||||||
|
value="#{role.clientId}"
|
||||||
|
required="#{showClientSelector}"
|
||||||
|
readonly="#{readonly}"
|
||||||
|
styleClass="w-full">
|
||||||
|
<f:selectItem itemLabel="Sélectionner..." itemValue="" />
|
||||||
|
<f:selectItems value="#{roleBean.availableClients}" />
|
||||||
|
</p:selectOneMenu>
|
||||||
|
</c:if>
|
||||||
|
|
||||||
|
<!-- Rôle composite -->
|
||||||
|
<c:if test="#{showCompositeOptions}">
|
||||||
|
<p:outputLabel for="composite" value="Rôle composite" />
|
||||||
|
<p:selectBooleanCheckbox id="composite"
|
||||||
|
value="#{role.composite}"
|
||||||
|
readonly="#{readonly}" />
|
||||||
|
</c:if>
|
||||||
|
|
||||||
|
</p:panelGrid>
|
||||||
|
|
||||||
|
<!-- Boutons d'action -->
|
||||||
|
<f:facet name="footer">
|
||||||
|
<div class="flex gap-2 justify-content-end">
|
||||||
|
<c:if test="#{not readonly}">
|
||||||
|
<c:choose>
|
||||||
|
<!-- Si hasSubmitAction est explicitement défini à true, utiliser action -->
|
||||||
|
<c:when test="#{hasSubmitAction == true}">
|
||||||
|
<p:commandButton
|
||||||
|
value="#{mode == 'create' ? 'Créer' : 'Modifier'}"
|
||||||
|
icon="pi pi-check"
|
||||||
|
styleClass="p-button-success"
|
||||||
|
action="#{submitAction}"
|
||||||
|
update="#{not empty update ? update : '@form'}"
|
||||||
|
process="@form" />
|
||||||
|
</c:when>
|
||||||
|
<!-- Si submitOutcome est fourni, utiliser outcome -->
|
||||||
|
<c:when test="#{not empty submitOutcome}">
|
||||||
|
<p:commandButton
|
||||||
|
value="#{mode == 'create' ? 'Créer' : 'Modifier'}"
|
||||||
|
icon="pi pi-check"
|
||||||
|
styleClass="p-button-success"
|
||||||
|
outcome="#{submitOutcome}"
|
||||||
|
update="#{not empty update ? update : '@form'}"
|
||||||
|
process="@form" />
|
||||||
|
</c:when>
|
||||||
|
<!-- Sinon, essayer d'utiliser submitAction si fourni -->
|
||||||
|
<c:otherwise>
|
||||||
|
<p:commandButton
|
||||||
|
value="#{mode == 'create' ? 'Créer' : 'Modifier'}"
|
||||||
|
icon="pi pi-check"
|
||||||
|
styleClass="p-button-success"
|
||||||
|
action="#{submitAction}"
|
||||||
|
update="#{not empty update ? update : '@form'}"
|
||||||
|
process="@form" />
|
||||||
|
</c:otherwise>
|
||||||
|
</c:choose>
|
||||||
|
</c:if>
|
||||||
|
<p:commandButton
|
||||||
|
value="Annuler"
|
||||||
|
icon="pi pi-times"
|
||||||
|
styleClass="p-button-secondary"
|
||||||
|
onclick="PF('createRealmRoleDialog').hide(); PF('createClientRoleDialog').hide();"
|
||||||
|
immediate="true" />
|
||||||
|
</div>
|
||||||
|
</f:facet>
|
||||||
|
</p:panel>
|
||||||
|
|
||||||
|
</ui:composition>
|
||||||
|
|
||||||
@@ -49,106 +49,44 @@
|
|||||||
<c:set var="showClientSelector" value="#{empty showClientSelector ? false : showClientSelector}" />
|
<c:set var="showClientSelector" value="#{empty showClientSelector ? false : showClientSelector}" />
|
||||||
<c:set var="showCompositeOptions" value="#{empty showCompositeOptions ? true : showCompositeOptions}" />
|
<c:set var="showCompositeOptions" value="#{empty showCompositeOptions ? true : showCompositeOptions}" />
|
||||||
<c:set var="readonly" value="#{empty readonly ? false : readonly}" />
|
<c:set var="readonly" value="#{empty readonly ? false : readonly}" />
|
||||||
|
<c:set var="useParentForm" value="#{empty useParentForm ? false : useParentForm}" />
|
||||||
|
|
||||||
<h:form id="#{formId}">
|
<c:choose>
|
||||||
<p:panel header="#{mode == 'create' ? 'Nouveau Rôle' : 'Modifier Rôle'}"
|
<c:when test="#{useParentForm}">
|
||||||
styleClass="w-full">
|
<!-- Utiliser le formulaire parent (pas de h:form ici) -->
|
||||||
|
<ui:include src="/templates/components/role-management/role-form-content.xhtml">
|
||||||
<p:panelGrid columns="2" styleClass="w-full" columnClasses="col-12 md:col-6">
|
<ui:param name="role" value="#{role}" />
|
||||||
|
<ui:param name="mode" value="#{mode}" />
|
||||||
<!-- Nom du rôle -->
|
<ui:param name="showRealmSelector" value="#{showRealmSelector}" />
|
||||||
<p:outputLabel for="roleName" value="Nom du rôle *" />
|
<ui:param name="showClientSelector" value="#{showClientSelector}" />
|
||||||
<p:inputText id="roleName"
|
<ui:param name="showCompositeOptions" value="#{showCompositeOptions}" />
|
||||||
value="#{role.name}"
|
<ui:param name="readonly" value="#{readonly}" />
|
||||||
required="true"
|
<ui:param name="hasSubmitAction" value="#{hasSubmitAction}" />
|
||||||
readonly="#{readonly}"
|
<ui:param name="submitAction" value="#{submitAction}" />
|
||||||
placeholder="ADMIN, USER, MODERATOR..."
|
<ui:param name="submitOutcome" value="#{submitOutcome}" />
|
||||||
styleClass="w-full">
|
<ui:param name="update" value="#{update}" />
|
||||||
<f:validateLength minimum="2" maximum="100" />
|
<ui:param name="cancelOutcome" value="#{cancelOutcome}" />
|
||||||
<f:validateRegex pattern="^[A-Z_]+$" />
|
</ui:include>
|
||||||
</p:inputText>
|
</c:when>
|
||||||
|
<c:otherwise>
|
||||||
<!-- Description -->
|
<!-- Créer son propre formulaire -->
|
||||||
<p:outputLabel for="description" value="Description" />
|
<h:form id="#{formId}">
|
||||||
<p:inputTextarea id="description"
|
<ui:include src="/templates/components/role-management/role-form-content.xhtml">
|
||||||
value="#{role.description}"
|
<ui:param name="role" value="#{role}" />
|
||||||
readonly="#{readonly}"
|
<ui:param name="mode" value="#{mode}" />
|
||||||
placeholder="Description du rôle..."
|
<ui:param name="showRealmSelector" value="#{showRealmSelector}" />
|
||||||
rows="3"
|
<ui:param name="showClientSelector" value="#{showClientSelector}" />
|
||||||
styleClass="w-full" />
|
<ui:param name="showCompositeOptions" value="#{showCompositeOptions}" />
|
||||||
|
<ui:param name="readonly" value="#{readonly}" />
|
||||||
<!-- Type de rôle -->
|
<ui:param name="hasSubmitAction" value="#{hasSubmitAction}" />
|
||||||
<p:outputLabel for="typeRole" value="Type de rôle *" />
|
<ui:param name="submitAction" value="#{submitAction}" />
|
||||||
<p:selectOneMenu id="typeRole"
|
<ui:param name="submitOutcome" value="#{submitOutcome}" />
|
||||||
value="#{role.typeRole}"
|
<ui:param name="update" value="#{update}" />
|
||||||
required="true"
|
<ui:param name="cancelOutcome" value="#{cancelOutcome}" />
|
||||||
readonly="#{readonly or mode == 'edit'}"
|
</ui:include>
|
||||||
styleClass="w-full">
|
</h:form>
|
||||||
<f:selectItem itemLabel="Sélectionner..." itemValue="" />
|
</c:otherwise>
|
||||||
<f:selectItem itemLabel="Rôle Realm" itemValue="REALM_ROLE" />
|
</c:choose>
|
||||||
<f:selectItem itemLabel="Rôle Client" itemValue="CLIENT_ROLE" />
|
|
||||||
<f:selectItem itemLabel="Rôle Composite" itemValue="COMPOSITE_ROLE" />
|
|
||||||
</p:selectOneMenu>
|
|
||||||
|
|
||||||
<!-- Realm (si affiché) -->
|
|
||||||
<c:if test="#{showRealmSelector}">
|
|
||||||
<p:outputLabel for="realmName" value="Realm *" />
|
|
||||||
<p:selectOneMenu id="realmName"
|
|
||||||
value="#{role.realmName}"
|
|
||||||
required="#{showRealmSelector}"
|
|
||||||
readonly="#{readonly}"
|
|
||||||
styleClass="w-full">
|
|
||||||
<f:selectItem itemLabel="Sélectionner..." itemValue="" />
|
|
||||||
<f:selectItems value="#{roleBean.availableRealms}" />
|
|
||||||
</p:selectOneMenu>
|
|
||||||
</c:if>
|
|
||||||
|
|
||||||
<!-- Client (si affiché) -->
|
|
||||||
<c:if test="#{showClientSelector}">
|
|
||||||
<p:outputLabel for="clientId" value="Client *" />
|
|
||||||
<p:selectOneMenu id="clientId"
|
|
||||||
value="#{role.clientId}"
|
|
||||||
required="#{showClientSelector}"
|
|
||||||
readonly="#{readonly}"
|
|
||||||
styleClass="w-full">
|
|
||||||
<f:selectItem itemLabel="Sélectionner..." itemValue="" />
|
|
||||||
<f:selectItems value="#{roleBean.availableClients}" />
|
|
||||||
</p:selectOneMenu>
|
|
||||||
</c:if>
|
|
||||||
|
|
||||||
<!-- Rôle composite -->
|
|
||||||
<c:if test="#{showCompositeOptions}">
|
|
||||||
<p:outputLabel for="composite" value="Rôle composite" />
|
|
||||||
<p:selectBooleanCheckbox id="composite"
|
|
||||||
value="#{role.composite}"
|
|
||||||
readonly="#{readonly}" />
|
|
||||||
</c:if>
|
|
||||||
|
|
||||||
</p:panelGrid>
|
|
||||||
|
|
||||||
<!-- Boutons d'action -->
|
|
||||||
<f:facet name="footer">
|
|
||||||
<div class="flex gap-2 justify-content-end">
|
|
||||||
<c:if test="#{not readonly}">
|
|
||||||
<p:commandButton
|
|
||||||
value="#{mode == 'create' ? 'Créer' : 'Modifier'}"
|
|
||||||
icon="pi pi-check"
|
|
||||||
styleClass="p-button-success"
|
|
||||||
action="#{not empty submitAction ? submitAction : null}"
|
|
||||||
outcome="#{not empty submitOutcome ? submitOutcome : null}"
|
|
||||||
update="#{not empty update ? update : '@form'}"
|
|
||||||
process="@form" />
|
|
||||||
</c:if>
|
|
||||||
<p:commandButton
|
|
||||||
value="Annuler"
|
|
||||||
icon="pi pi-times"
|
|
||||||
styleClass="p-button-secondary"
|
|
||||||
outcome="#{not empty cancelOutcome ? cancelOutcome : '/pages/user-manager/roles/list'}"
|
|
||||||
immediate="true" />
|
|
||||||
</div>
|
|
||||||
</f:facet>
|
|
||||||
</p:panel>
|
|
||||||
</h:form>
|
|
||||||
|
|
||||||
</ui:composition>
|
</ui:composition>
|
||||||
|
|
||||||
|
|||||||
@@ -45,6 +45,8 @@
|
|||||||
<c:set var="size" value="#{empty size ? 'normal' : size}" />
|
<c:set var="size" value="#{empty size ? 'normal' : size}" />
|
||||||
<c:set var="disabled" value="#{empty disabled ? false : disabled}" />
|
<c:set var="disabled" value="#{empty disabled ? false : disabled}" />
|
||||||
<c:set var="process" value="#{empty process ? '@this' : process}" />
|
<c:set var="process" value="#{empty process ? '@this' : process}" />
|
||||||
|
<c:set var="hasAction" value="#{not empty action}" />
|
||||||
|
<c:set var="hasOutcome" value="#{not empty outcome}" />
|
||||||
|
|
||||||
<!-- Déterminer la classe selon la severity -->
|
<!-- Déterminer la classe selon la severity -->
|
||||||
<c:choose>
|
<c:choose>
|
||||||
@@ -81,15 +83,36 @@
|
|||||||
<c:set var="buttonClass" value="#{buttonClass} #{styleClass}" />
|
<c:set var="buttonClass" value="#{buttonClass} #{styleClass}" />
|
||||||
</c:if>
|
</c:if>
|
||||||
|
|
||||||
<p:commandButton
|
<c:choose>
|
||||||
value="#{value}"
|
<c:when test="#{hasAction}">
|
||||||
icon="#{not empty icon ? icon : ''}"
|
<p:commandButton
|
||||||
styleClass="#{buttonClass}"
|
value="#{value}"
|
||||||
disabled="#{disabled}"
|
icon="#{not empty icon ? icon : ''}"
|
||||||
action="#{not empty action ? action : null}"
|
styleClass="#{buttonClass}"
|
||||||
outcome="#{not empty outcome ? outcome : null}"
|
disabled="#{disabled}"
|
||||||
update="#{not empty update ? update : '@form'}"
|
action="#{action}"
|
||||||
process="#{process}" />
|
update="#{not empty update ? update : '@form'}"
|
||||||
|
process="#{process}" />
|
||||||
|
</c:when>
|
||||||
|
<c:when test="#{hasOutcome}">
|
||||||
|
<p:commandButton
|
||||||
|
value="#{value}"
|
||||||
|
icon="#{not empty icon ? icon : ''}"
|
||||||
|
styleClass="#{buttonClass}"
|
||||||
|
disabled="#{disabled}"
|
||||||
|
outcome="#{outcome}"
|
||||||
|
update="#{not empty update ? update : '@form'}"
|
||||||
|
process="#{process}" />
|
||||||
|
</c:when>
|
||||||
|
<c:otherwise>
|
||||||
|
<p:commandButton
|
||||||
|
value="#{value}"
|
||||||
|
icon="#{not empty icon ? icon : ''}"
|
||||||
|
styleClass="#{buttonClass}"
|
||||||
|
disabled="true"
|
||||||
|
title="Aucune action définie" />
|
||||||
|
</c:otherwise>
|
||||||
|
</c:choose>
|
||||||
|
|
||||||
</ui:composition>
|
</ui:composition>
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,7 @@
|
|||||||
</ui:include>
|
</ui:include>
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<c:set var="var" value="#{empty var ? 'user' : var}" />
|
<c:set var="varName" value="#{empty var ? 'user' : var}" />
|
||||||
<c:set var="tableId" value="#{empty tableId ? 'userTable' : tableId}" />
|
<c:set var="tableId" value="#{empty tableId ? 'userTable' : tableId}" />
|
||||||
<c:set var="paginator" value="#{empty paginator ? true : paginator}" />
|
<c:set var="paginator" value="#{empty paginator ? true : paginator}" />
|
||||||
<c:set var="rows" value="#{empty rows ? 20 : rows}" />
|
<c:set var="rows" value="#{empty rows ? 20 : rows}" />
|
||||||
@@ -57,7 +57,7 @@
|
|||||||
<p:dataTable
|
<p:dataTable
|
||||||
id="#{tableId}"
|
id="#{tableId}"
|
||||||
value="#{users}"
|
value="#{users}"
|
||||||
var="#{var}"
|
var="user"
|
||||||
paginator="#{paginator}"
|
paginator="#{paginator}"
|
||||||
rows="#{rows}"
|
rows="#{rows}"
|
||||||
selection="#{selection}"
|
selection="#{selection}"
|
||||||
@@ -73,32 +73,32 @@
|
|||||||
</c:if>
|
</c:if>
|
||||||
|
|
||||||
<!-- Colonne Username -->
|
<!-- Colonne Username -->
|
||||||
<p:column headerText="Nom d'utilisateur" sortBy="#{var.username}" style="width: 15%">
|
<p:column headerText="Nom d'utilisateur" sortBy="#{user.username}" style="width: 15%">
|
||||||
<div class="flex align-items-center gap-2">
|
<div class="flex align-items-center gap-2">
|
||||||
<p:avatar
|
<p:avatar
|
||||||
label="#{var.firstName != null ? var.firstName.substring(0,1) : 'U'}#{var.lastName != null ? var.lastName.substring(0,1) : ''}"
|
label="#{user.prenom != null ? user.prenom.substring(0,1) : 'U'}#{user.nom != null ? user.nom.substring(0,1) : ''}"
|
||||||
styleClass="user-avatar-small" />
|
styleClass="user-avatar-small" />
|
||||||
<span class="font-semibold">#{var.username}</span>
|
<span class="font-semibold">#{user.username}</span>
|
||||||
</div>
|
</div>
|
||||||
</p:column>
|
</p:column>
|
||||||
|
|
||||||
<!-- Colonne Nom complet -->
|
<!-- Colonne Nom complet -->
|
||||||
<p:column headerText="Nom complet" sortBy="#{var.lastName}">
|
<p:column headerText="Nom complet" sortBy="#{user.nom}">
|
||||||
<div class="flex flex-column">
|
<div class="flex flex-column">
|
||||||
<span class="font-semibold">#{var.firstName} #{var.lastName}</span>
|
<span class="font-semibold">#{user.prenom} #{user.nom}</span>
|
||||||
<c:if test="#{not empty var.fonction}">
|
<c:if test="#{not empty user.fonction}">
|
||||||
<span class="text-color-secondary text-xs">#{var.fonction}</span>
|
<span class="text-color-secondary text-xs">#{user.fonction}</span>
|
||||||
</c:if>
|
</c:if>
|
||||||
</div>
|
</div>
|
||||||
</p:column>
|
</p:column>
|
||||||
|
|
||||||
<!-- Colonne Email -->
|
<!-- Colonne Email -->
|
||||||
<c:if test="#{showEmail}">
|
<c:if test="#{showEmail}">
|
||||||
<p:column headerText="Email" sortBy="#{var.email}">
|
<p:column headerText="Email" sortBy="#{user.email}">
|
||||||
<div class="flex align-items-center gap-2">
|
<div class="flex align-items-center gap-2">
|
||||||
<i class="pi pi-envelope text-color-secondary"></i>
|
<i class="pi pi-envelope text-color-secondary"></i>
|
||||||
<span>#{var.email}</span>
|
<span>#{user.email}</span>
|
||||||
<c:if test="#{var.emailVerified}">
|
<c:if test="#{user.emailVerified}">
|
||||||
<i class="pi pi-check-circle text-green-500" title="Email vérifié"></i>
|
<i class="pi pi-check-circle text-green-500" title="Email vérifié"></i>
|
||||||
</c:if>
|
</c:if>
|
||||||
</div>
|
</div>
|
||||||
@@ -107,15 +107,15 @@
|
|||||||
|
|
||||||
<!-- Colonne Statut -->
|
<!-- Colonne Statut -->
|
||||||
<c:if test="#{showStatus}">
|
<c:if test="#{showStatus}">
|
||||||
<p:column headerText="Statut" sortBy="#{var.statut}">
|
<p:column headerText="Statut" sortBy="#{user.statut}">
|
||||||
<div class="flex align-items-center gap-2">
|
<div class="flex align-items-center gap-2">
|
||||||
<p:tag
|
<p:tag
|
||||||
value="#{var.statut != null ? var.statut : 'INCONNU'}"
|
value="#{user.statut != null ? user.statut : 'INCONNU'}"
|
||||||
severity="#{var.enabled ? 'success' : 'danger'}" />
|
severity="#{user.enabled ? 'success' : 'danger'}" />
|
||||||
<c:if test="#{var.enabled}">
|
<c:if test="#{user.enabled}">
|
||||||
<i class="pi pi-check-circle text-green-500" title="Compte activé"></i>
|
<i class="pi pi-check-circle text-green-500" title="Compte activé"></i>
|
||||||
</c:if>
|
</c:if>
|
||||||
<c:if test="#{not var.enabled}">
|
<c:if test="#{not user.enabled}">
|
||||||
<i class="pi pi-times-circle text-red-500" title="Compte désactivé"></i>
|
<i class="pi pi-times-circle text-red-500" title="Compte désactivé"></i>
|
||||||
</c:if>
|
</c:if>
|
||||||
</div>
|
</div>
|
||||||
@@ -126,13 +126,13 @@
|
|||||||
<c:if test="#{showRoles}">
|
<c:if test="#{showRoles}">
|
||||||
<p:column headerText="Rôles">
|
<p:column headerText="Rôles">
|
||||||
<div class="flex flex-wrap gap-1">
|
<div class="flex flex-wrap gap-1">
|
||||||
<c:forEach var="role" items="#{var.realmRoles}" varStatus="status">
|
<c:forEach var="role" items="#{user.realmRoles}" varStatus="status">
|
||||||
<c:if test="#{status.index < 3}">
|
<c:if test="#{status.index < 3}">
|
||||||
<p:tag value="#{role}" severity="info" styleClass="text-xs" />
|
<p:tag value="#{role}" severity="info" styleClass="text-xs" />
|
||||||
</c:if>
|
</c:if>
|
||||||
</c:forEach>
|
</c:forEach>
|
||||||
<c:if test="#{var.realmRoles != null and var.realmRoles.size() > 3}">
|
<c:if test="#{user.realmRoles != null and user.realmRoles.size() > 3}">
|
||||||
<p:tag value="+#{var.realmRoles.size() - 3}" severity="secondary" styleClass="text-xs" />
|
<p:tag value="+#{user.realmRoles.size() - 3}" severity="secondary" styleClass="text-xs" />
|
||||||
</c:if>
|
</c:if>
|
||||||
</div>
|
</div>
|
||||||
</p:column>
|
</p:column>
|
||||||
@@ -142,7 +142,7 @@
|
|||||||
<c:if test="#{showActions}">
|
<c:if test="#{showActions}">
|
||||||
<p:column headerText="Actions" style="width: 150px">
|
<p:column headerText="Actions" style="width: 150px">
|
||||||
<ui:include src="/templates/components/user-management/user-actions.xhtml">
|
<ui:include src="/templates/components/user-management/user-actions.xhtml">
|
||||||
<ui:param name="user" value="#{var}" />
|
<ui:param name="user" value="#{user}" />
|
||||||
<ui:param name="layout" value="dropdown" />
|
<ui:param name="layout" value="dropdown" />
|
||||||
<ui:param name="update" value="#{not empty update ? update : tableId}" />
|
<ui:param name="update" value="#{not empty update ? update : tableId}" />
|
||||||
</ui:include>
|
</ui:include>
|
||||||
|
|||||||
@@ -66,6 +66,13 @@
|
|||||||
<c:set var="showResetPassword" value="#{empty showResetPassword ? true : showResetPassword}" />
|
<c:set var="showResetPassword" value="#{empty showResetPassword ? true : showResetPassword}" />
|
||||||
<c:set var="showLogoutSessions" value="#{empty showLogoutSessions ? false : showLogoutSessions}" />
|
<c:set var="showLogoutSessions" value="#{empty showLogoutSessions ? false : showLogoutSessions}" />
|
||||||
|
|
||||||
|
<!-- Définir les actions par défaut si non fournies -->
|
||||||
|
<c:set var="defaultActivateAction" value="#{userBean.activateUser(user.id)}" />
|
||||||
|
<c:set var="defaultDeactivateAction" value="#{userBean.deactivateUser(user.id)}" />
|
||||||
|
<c:set var="defaultDeleteAction" value="#{userBean.deleteUser(user.id)}" />
|
||||||
|
<c:set var="defaultResetPasswordAction" value="#{userBean.resetPassword(user.id)}" />
|
||||||
|
<c:set var="defaultLogoutSessionsAction" value="#{userBean.logoutAllSessions(user.id)}" />
|
||||||
|
|
||||||
<c:choose>
|
<c:choose>
|
||||||
<!-- Layout Dropdown -->
|
<!-- Layout Dropdown -->
|
||||||
<c:when test="#{layout == 'dropdown'}">
|
<c:when test="#{layout == 'dropdown'}">
|
||||||
@@ -102,30 +109,66 @@
|
|||||||
<p:separator />
|
<p:separator />
|
||||||
|
|
||||||
<c:if test="#{showActivate and not user.enabled}">
|
<c:if test="#{showActivate and not user.enabled}">
|
||||||
<p:menuitem
|
<c:choose>
|
||||||
value="Activer"
|
<c:when test="#{not empty activateAction}">
|
||||||
icon="pi pi-check"
|
<p:menuitem
|
||||||
styleClass="text-green-600"
|
value="Activer"
|
||||||
action="#{not empty activateAction ? activateAction : userBean.activateUser(user.id)}"
|
icon="pi pi-check"
|
||||||
update="#{update}" />
|
styleClass="text-green-600"
|
||||||
|
action="#{activateAction}"
|
||||||
|
update="#{update}" />
|
||||||
|
</c:when>
|
||||||
|
<c:otherwise>
|
||||||
|
<p:menuitem
|
||||||
|
value="Activer"
|
||||||
|
icon="pi pi-check"
|
||||||
|
styleClass="text-green-600"
|
||||||
|
action="#{userBean.activateUser(user.id)}"
|
||||||
|
update="#{update}" />
|
||||||
|
</c:otherwise>
|
||||||
|
</c:choose>
|
||||||
</c:if>
|
</c:if>
|
||||||
|
|
||||||
<c:if test="#{showDeactivate and user.enabled}">
|
<c:if test="#{showDeactivate and user.enabled}">
|
||||||
<p:menuitem
|
<c:choose>
|
||||||
value="Désactiver"
|
<c:when test="#{not empty deactivateAction}">
|
||||||
icon="pi pi-times"
|
<p:menuitem
|
||||||
styleClass="text-orange-600"
|
value="Désactiver"
|
||||||
action="#{not empty deactivateAction ? deactivateAction : userBean.deactivateUser(user.id)}"
|
icon="pi pi-times"
|
||||||
update="#{update}" />
|
styleClass="text-orange-600"
|
||||||
|
action="#{deactivateAction}"
|
||||||
|
update="#{update}" />
|
||||||
|
</c:when>
|
||||||
|
<c:otherwise>
|
||||||
|
<p:menuitem
|
||||||
|
value="Désactiver"
|
||||||
|
icon="pi pi-times"
|
||||||
|
styleClass="text-orange-600"
|
||||||
|
action="#{userBean.deactivateUser(user.id)}"
|
||||||
|
update="#{update}" />
|
||||||
|
</c:otherwise>
|
||||||
|
</c:choose>
|
||||||
</c:if>
|
</c:if>
|
||||||
|
|
||||||
<c:if test="#{showLogoutSessions}">
|
<c:if test="#{showLogoutSessions}">
|
||||||
<p:menuitem
|
<c:choose>
|
||||||
value="Déconnecter toutes les sessions"
|
<c:when test="#{not empty logoutSessionsAction}">
|
||||||
icon="pi pi-sign-out"
|
<p:menuitem
|
||||||
styleClass="text-blue-600"
|
value="Déconnecter toutes les sessions"
|
||||||
action="#{not empty logoutSessionsAction ? logoutSessionsAction : userBean.logoutAllSessions(user.id)}"
|
icon="pi pi-sign-out"
|
||||||
update="#{update}" />
|
styleClass="text-blue-600"
|
||||||
|
action="#{logoutSessionsAction}"
|
||||||
|
update="#{update}" />
|
||||||
|
</c:when>
|
||||||
|
<c:otherwise>
|
||||||
|
<p:menuitem
|
||||||
|
value="Déconnecter toutes les sessions"
|
||||||
|
icon="pi pi-sign-out"
|
||||||
|
styleClass="text-blue-600"
|
||||||
|
action="#{userBean.logoutAllSessions(user.id)}"
|
||||||
|
update="#{update}" />
|
||||||
|
</c:otherwise>
|
||||||
|
</c:choose>
|
||||||
</c:if>
|
</c:if>
|
||||||
|
|
||||||
<c:if test="#{showDelete}">
|
<c:if test="#{showDelete}">
|
||||||
@@ -172,30 +215,66 @@
|
|||||||
</c:if>
|
</c:if>
|
||||||
|
|
||||||
<c:if test="#{showActivate and not user.enabled}">
|
<c:if test="#{showActivate and not user.enabled}">
|
||||||
<p:commandButton
|
<c:choose>
|
||||||
icon="pi pi-check"
|
<c:when test="#{not empty activateAction}">
|
||||||
title="Activer"
|
<p:commandButton
|
||||||
styleClass="p-button-text p-button-sm p-button-success"
|
icon="pi pi-check"
|
||||||
action="#{not empty activateAction ? activateAction : userBean.activateUser(user.id)}"
|
title="Activer"
|
||||||
update="#{update}" />
|
styleClass="p-button-text p-button-sm p-button-success"
|
||||||
|
action="#{activateAction}"
|
||||||
|
update="#{update}" />
|
||||||
|
</c:when>
|
||||||
|
<c:otherwise>
|
||||||
|
<p:commandButton
|
||||||
|
icon="pi pi-check"
|
||||||
|
title="Activer"
|
||||||
|
styleClass="p-button-text p-button-sm p-button-success"
|
||||||
|
action="#{userBean.activateUser(user.id)}"
|
||||||
|
update="#{update}" />
|
||||||
|
</c:otherwise>
|
||||||
|
</c:choose>
|
||||||
</c:if>
|
</c:if>
|
||||||
|
|
||||||
<c:if test="#{showDeactivate and user.enabled}">
|
<c:if test="#{showDeactivate and user.enabled}">
|
||||||
<p:commandButton
|
<c:choose>
|
||||||
icon="pi pi-times"
|
<c:when test="#{not empty deactivateAction}">
|
||||||
title="Désactiver"
|
<p:commandButton
|
||||||
styleClass="p-button-text p-button-sm p-button-warning"
|
icon="pi pi-times"
|
||||||
action="#{not empty deactivateAction ? deactivateAction : userBean.deactivateUser(user.id)}"
|
title="Désactiver"
|
||||||
update="#{update}" />
|
styleClass="p-button-text p-button-sm p-button-warning"
|
||||||
|
action="#{deactivateAction}"
|
||||||
|
update="#{update}" />
|
||||||
|
</c:when>
|
||||||
|
<c:otherwise>
|
||||||
|
<p:commandButton
|
||||||
|
icon="pi pi-times"
|
||||||
|
title="Désactiver"
|
||||||
|
styleClass="p-button-text p-button-sm p-button-warning"
|
||||||
|
action="#{userBean.deactivateUser(user.id)}"
|
||||||
|
update="#{update}" />
|
||||||
|
</c:otherwise>
|
||||||
|
</c:choose>
|
||||||
</c:if>
|
</c:if>
|
||||||
|
|
||||||
<c:if test="#{showLogoutSessions}">
|
<c:if test="#{showLogoutSessions}">
|
||||||
<p:commandButton
|
<c:choose>
|
||||||
icon="pi pi-sign-out"
|
<c:when test="#{not empty logoutSessionsAction}">
|
||||||
title="Déconnecter toutes les sessions"
|
<p:commandButton
|
||||||
styleClass="p-button-text p-button-sm p-button-info"
|
icon="pi pi-sign-out"
|
||||||
action="#{not empty logoutSessionsAction ? logoutSessionsAction : userBean.logoutAllSessions(user.id)}"
|
title="Déconnecter toutes les sessions"
|
||||||
update="#{update}" />
|
styleClass="p-button-text p-button-sm p-button-info"
|
||||||
|
action="#{logoutSessionsAction}"
|
||||||
|
update="#{update}" />
|
||||||
|
</c:when>
|
||||||
|
<c:otherwise>
|
||||||
|
<p:commandButton
|
||||||
|
icon="pi pi-sign-out"
|
||||||
|
title="Déconnecter toutes les sessions"
|
||||||
|
styleClass="p-button-text p-button-sm p-button-info"
|
||||||
|
action="#{userBean.logoutAllSessions(user.id)}"
|
||||||
|
update="#{update}" />
|
||||||
|
</c:otherwise>
|
||||||
|
</c:choose>
|
||||||
</c:if>
|
</c:if>
|
||||||
|
|
||||||
<c:if test="#{showDelete}">
|
<c:if test="#{showDelete}">
|
||||||
@@ -216,13 +295,26 @@
|
|||||||
message="Êtes-vous sûr de vouloir supprimer l'utilisateur #{user.username} ?"
|
message="Êtes-vous sûr de vouloir supprimer l'utilisateur #{user.username} ?"
|
||||||
header="Confirmation de suppression"
|
header="Confirmation de suppression"
|
||||||
severity="warn">
|
severity="warn">
|
||||||
<p:commandButton
|
<c:choose>
|
||||||
value="Oui"
|
<c:when test="#{not empty deleteAction}">
|
||||||
icon="pi pi-check"
|
<p:commandButton
|
||||||
styleClass="p-button-danger"
|
value="Oui"
|
||||||
action="#{not empty deleteAction ? deleteAction : userBean.deleteUser(user.id)}"
|
icon="pi pi-check"
|
||||||
update="#{update}"
|
styleClass="p-button-danger"
|
||||||
oncomplete="PF('confirmDeleteDialog').hide()" />
|
action="#{deleteAction}"
|
||||||
|
update="#{update}"
|
||||||
|
oncomplete="PF('confirmDeleteDialog').hide()" />
|
||||||
|
</c:when>
|
||||||
|
<c:otherwise>
|
||||||
|
<p:commandButton
|
||||||
|
value="Oui"
|
||||||
|
icon="pi pi-check"
|
||||||
|
styleClass="p-button-danger"
|
||||||
|
action="#{userBean.deleteUser(user.id)}"
|
||||||
|
update="#{update}"
|
||||||
|
oncomplete="PF('confirmDeleteDialog').hide()" />
|
||||||
|
</c:otherwise>
|
||||||
|
</c:choose>
|
||||||
<p:commandButton
|
<p:commandButton
|
||||||
value="Non"
|
value="Non"
|
||||||
icon="pi pi-times"
|
icon="pi pi-times"
|
||||||
@@ -257,14 +349,28 @@
|
|||||||
|
|
||||||
<f:facet name="footer">
|
<f:facet name="footer">
|
||||||
<div class="flex gap-2 justify-content-end">
|
<div class="flex gap-2 justify-content-end">
|
||||||
<p:commandButton
|
<c:choose>
|
||||||
value="Réinitialiser"
|
<c:when test="#{not empty resetPasswordAction}">
|
||||||
icon="pi pi-check"
|
<p:commandButton
|
||||||
styleClass="p-button-primary"
|
value="Réinitialiser"
|
||||||
action="#{not empty resetPasswordAction ? resetPasswordAction : userBean.resetPassword(user.id)}"
|
icon="pi pi-check"
|
||||||
update="#{update}"
|
styleClass="p-button-primary"
|
||||||
oncomplete="PF('resetPasswordDialog').hide()"
|
action="#{resetPasswordAction}"
|
||||||
process="@form" />
|
update="#{update}"
|
||||||
|
oncomplete="PF('resetPasswordDialog').hide()"
|
||||||
|
process="@form" />
|
||||||
|
</c:when>
|
||||||
|
<c:otherwise>
|
||||||
|
<p:commandButton
|
||||||
|
value="Réinitialiser"
|
||||||
|
icon="pi pi-check"
|
||||||
|
styleClass="p-button-primary"
|
||||||
|
action="#{userBean.resetPassword(user.id)}"
|
||||||
|
update="#{update}"
|
||||||
|
oncomplete="PF('resetPasswordDialog').hide()"
|
||||||
|
process="@form" />
|
||||||
|
</c:otherwise>
|
||||||
|
</c:choose>
|
||||||
<p:commandButton
|
<p:commandButton
|
||||||
value="Annuler"
|
value="Annuler"
|
||||||
icon="pi pi-times"
|
icon="pi pi-times"
|
||||||
|
|||||||
@@ -19,9 +19,10 @@
|
|||||||
- showRealmSelector: Boolean (défaut: false) - Afficher le sélecteur de realm
|
- showRealmSelector: Boolean (défaut: false) - Afficher le sélecteur de realm
|
||||||
- showPasswordFields: Boolean (défaut: true) - Afficher les champs mot de passe
|
- showPasswordFields: Boolean (défaut: true) - Afficher les champs mot de passe
|
||||||
- readonly: Boolean (défaut: false) - Mode lecture seule
|
- readonly: Boolean (défaut: false) - Mode lecture seule
|
||||||
- submitAction: String (optionnel) - Action à exécuter à la soumission
|
- submitAction: String (optionnel) - Expression de méthode JSF à exécuter (ex: "#{bean.method}")
|
||||||
- submitOutcome: String (optionnel) - Page de redirection après soumission
|
- submitOutcome: String (optionnel) - Page de redirection après soumission
|
||||||
- update: String (optionnel) - Composants à mettre à jour après soumission
|
- update: String (optionnel) - Composants à mettre à jour après soumission
|
||||||
|
- hasSubmitAction: Boolean (optionnel) - Indicateur si submitAction est fourni (pour éviter l'évaluation)
|
||||||
|
|
||||||
Exemples d'utilisation:
|
Exemples d'utilisation:
|
||||||
|
|
||||||
@@ -218,14 +219,38 @@
|
|||||||
<f:facet name="footer">
|
<f:facet name="footer">
|
||||||
<div class="flex gap-2 justify-content-end">
|
<div class="flex gap-2 justify-content-end">
|
||||||
<c:if test="#{not readonly}">
|
<c:if test="#{not readonly}">
|
||||||
<p:commandButton
|
<c:choose>
|
||||||
value="#{mode == 'create' ? 'Créer' : 'Modifier'}"
|
<!-- Si hasSubmitAction est explicitement défini à true, utiliser action -->
|
||||||
icon="pi pi-check"
|
<c:when test="#{hasSubmitAction == true}">
|
||||||
styleClass="p-button-success"
|
<p:commandButton
|
||||||
action="#{not empty submitAction ? submitAction : null}"
|
value="#{mode == 'create' ? 'Créer' : 'Modifier'}"
|
||||||
outcome="#{not empty submitOutcome ? submitOutcome : null}"
|
icon="pi pi-check"
|
||||||
update="#{not empty update ? update : '@form'}"
|
styleClass="p-button-success"
|
||||||
process="@form" />
|
action="#{submitAction}"
|
||||||
|
update="#{not empty update ? update : '@form'}"
|
||||||
|
process="@form" />
|
||||||
|
</c:when>
|
||||||
|
<!-- Si submitOutcome est fourni, utiliser outcome -->
|
||||||
|
<c:when test="#{not empty submitOutcome}">
|
||||||
|
<p:commandButton
|
||||||
|
value="#{mode == 'create' ? 'Créer' : 'Modifier'}"
|
||||||
|
icon="pi pi-check"
|
||||||
|
styleClass="p-button-success"
|
||||||
|
outcome="#{submitOutcome}"
|
||||||
|
update="#{not empty update ? update : '@form'}"
|
||||||
|
process="@form" />
|
||||||
|
</c:when>
|
||||||
|
<!-- Sinon, essayer d'utiliser submitAction si fourni -->
|
||||||
|
<c:otherwise>
|
||||||
|
<p:commandButton
|
||||||
|
value="#{mode == 'create' ? 'Créer' : 'Modifier'}"
|
||||||
|
icon="pi pi-check"
|
||||||
|
styleClass="p-button-success"
|
||||||
|
action="#{submitAction}"
|
||||||
|
update="#{not empty update ? update : '@form'}"
|
||||||
|
process="@form" />
|
||||||
|
</c:otherwise>
|
||||||
|
</c:choose>
|
||||||
</c:if>
|
</c:if>
|
||||||
<p:commandButton
|
<p:commandButton
|
||||||
value="Annuler"
|
value="Annuler"
|
||||||
|
|||||||
@@ -0,0 +1,181 @@
|
|||||||
|
<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"
|
||||||
|
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core">
|
||||||
|
|
||||||
|
<p:panel styleClass="w-full mb-3">
|
||||||
|
<f:facet name="header">
|
||||||
|
<div class="flex align-items-center justify-content-between">
|
||||||
|
<span>Recherche d'utilisateurs</span>
|
||||||
|
<p:commandButton
|
||||||
|
icon="pi pi-filter"
|
||||||
|
styleClass="p-button-text p-button-sm"
|
||||||
|
onclick="PF('advancedSearchDialog').toggle()"
|
||||||
|
rendered="#{showAdvanced}"
|
||||||
|
title="Options avancées" />
|
||||||
|
</div>
|
||||||
|
</f:facet>
|
||||||
|
|
||||||
|
<!-- Recherche rapide -->
|
||||||
|
<div class="flex gap-2 align-items-end">
|
||||||
|
<div class="flex-1">
|
||||||
|
<p:outputLabel for="searchText" value="Rechercher" />
|
||||||
|
<p:inputText id="searchText"
|
||||||
|
value="#{searchCriteria.searchTerm}"
|
||||||
|
placeholder="Nom, prénom, email, username..."
|
||||||
|
styleClass="w-full">
|
||||||
|
<p:ajax event="keyup"
|
||||||
|
delay="500"
|
||||||
|
listener="#{searchAction}"
|
||||||
|
update="#{update}" />
|
||||||
|
</p:inputText>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Filtre Realm -->
|
||||||
|
<c:if test="#{showRealmFilter}">
|
||||||
|
<div style="width: 200px;">
|
||||||
|
<p:outputLabel for="realmFilter" value="Realm" />
|
||||||
|
<p:selectOneMenu id="realmFilter"
|
||||||
|
value="#{searchCriteria.realmName}"
|
||||||
|
styleClass="w-full">
|
||||||
|
<f:selectItem itemLabel="Tous les realms" itemValue="" />
|
||||||
|
<f:selectItems value="#{userBean.availableRealms}" />
|
||||||
|
</p:selectOneMenu>
|
||||||
|
</div>
|
||||||
|
</c:if>
|
||||||
|
|
||||||
|
<!-- Filtre Statut -->
|
||||||
|
<c:if test="#{showStatusFilter}">
|
||||||
|
<div style="width: 180px;">
|
||||||
|
<p:outputLabel for="statusFilter" value="Statut" />
|
||||||
|
<p:selectOneMenu id="statusFilter"
|
||||||
|
value="#{searchCriteria.statut}"
|
||||||
|
styleClass="w-full">
|
||||||
|
<f:selectItem itemLabel="Tous les statuts" itemValue="" />
|
||||||
|
<f:selectItems value="#{userBean.statutOptions}" />
|
||||||
|
</p:selectOneMenu>
|
||||||
|
</div>
|
||||||
|
</c:if>
|
||||||
|
|
||||||
|
<!-- Bouton Rechercher -->
|
||||||
|
<div>
|
||||||
|
<p:commandButton
|
||||||
|
value="Rechercher"
|
||||||
|
icon="pi pi-search"
|
||||||
|
styleClass="p-button-primary"
|
||||||
|
action="#{searchAction}"
|
||||||
|
update="#{update}"
|
||||||
|
process="@form" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Bouton Réinitialiser -->
|
||||||
|
<div>
|
||||||
|
<p:commandButton
|
||||||
|
value="Réinitialiser"
|
||||||
|
icon="pi pi-refresh"
|
||||||
|
styleClass="p-button-secondary"
|
||||||
|
action="#{userBean.resetSearch}"
|
||||||
|
update="#{update}"
|
||||||
|
process="@form" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</p:panel>
|
||||||
|
|
||||||
|
<!-- Options avancées (Dialog) -->
|
||||||
|
<c:if test="#{showAdvanced}">
|
||||||
|
<p:dialog id="advancedSearchDialog"
|
||||||
|
header="Options de recherche avancées"
|
||||||
|
widgetVar="advancedSearchDialog"
|
||||||
|
modal="true"
|
||||||
|
resizable="false"
|
||||||
|
styleClass="w-full md:w-6">
|
||||||
|
|
||||||
|
<p:panelGrid columns="2" styleClass="w-full" columnClasses="col-12 md:col-6">
|
||||||
|
<!-- Email -->
|
||||||
|
<p:outputLabel for="emailFilter" value="Email" />
|
||||||
|
<p:inputText id="emailFilter"
|
||||||
|
value="#{searchCriteria.email}"
|
||||||
|
placeholder="email@example.com"
|
||||||
|
styleClass="w-full" />
|
||||||
|
|
||||||
|
<!-- Téléphone -->
|
||||||
|
<p:outputLabel for="phoneFilter" value="Téléphone" />
|
||||||
|
<p:inputText id="phoneFilter"
|
||||||
|
value="#{searchCriteria.telephone}"
|
||||||
|
placeholder="+225 07 12 34 56 78"
|
||||||
|
styleClass="w-full" />
|
||||||
|
|
||||||
|
<!-- Organisation -->
|
||||||
|
<p:outputLabel for="orgFilter" value="Organisation" />
|
||||||
|
<p:inputText id="orgFilter"
|
||||||
|
value="#{searchCriteria.organisation}"
|
||||||
|
placeholder="Nom de l'organisation"
|
||||||
|
styleClass="w-full" />
|
||||||
|
|
||||||
|
<!-- Ville -->
|
||||||
|
<p:outputLabel for="cityFilter" value="Ville" />
|
||||||
|
<p:inputText id="cityFilter"
|
||||||
|
value="#{searchCriteria.ville}"
|
||||||
|
placeholder="Nom de la ville"
|
||||||
|
styleClass="w-full" />
|
||||||
|
|
||||||
|
<!-- Rôle (si affiché) -->
|
||||||
|
<c:if test="#{showRoleFilter}">
|
||||||
|
<p:outputLabel for="roleFilter" value="Rôle Realm" />
|
||||||
|
<p:selectManyMenu id="roleFilter"
|
||||||
|
value="#{searchCriteria.realmRoles}"
|
||||||
|
styleClass="w-full">
|
||||||
|
<f:selectItem itemLabel="Tous les rôles" itemValue="" />
|
||||||
|
<f:selectItems value="#{userBean.availableRoles}" />
|
||||||
|
</p:selectManyMenu>
|
||||||
|
</c:if>
|
||||||
|
|
||||||
|
<!-- Date de création (début) -->
|
||||||
|
<p:outputLabel for="dateDebut" value="Date de création (début)" />
|
||||||
|
<p:calendar id="dateDebut"
|
||||||
|
value="#{searchCriteria.dateCreationMin}"
|
||||||
|
pattern="dd/MM/yyyy"
|
||||||
|
styleClass="w-full" />
|
||||||
|
|
||||||
|
<!-- Date de création (fin) -->
|
||||||
|
<p:outputLabel for="dateFin" value="Date de création (fin)" />
|
||||||
|
<p:calendar id="dateFin"
|
||||||
|
value="#{searchCriteria.dateCreationMax}"
|
||||||
|
pattern="dd/MM/yyyy"
|
||||||
|
styleClass="w-full" />
|
||||||
|
|
||||||
|
<!-- Enabled -->
|
||||||
|
<p:outputLabel for="enabledFilter" value="Compte activé" />
|
||||||
|
<p:selectOneMenu id="enabledFilter"
|
||||||
|
value="#{searchCriteria.enabled}"
|
||||||
|
styleClass="w-full">
|
||||||
|
<f:selectItem itemLabel="Tous" itemValue="" />
|
||||||
|
<f:selectItem itemLabel="Activé" itemValue="true" />
|
||||||
|
<f:selectItem itemLabel="Désactivé" itemValue="false" />
|
||||||
|
</p:selectOneMenu>
|
||||||
|
</p:panelGrid>
|
||||||
|
|
||||||
|
<f:facet name="footer">
|
||||||
|
<div class="flex gap-2 justify-content-end">
|
||||||
|
<p:commandButton
|
||||||
|
value="Appliquer"
|
||||||
|
icon="pi pi-check"
|
||||||
|
styleClass="p-button-primary"
|
||||||
|
action="#{searchAction}"
|
||||||
|
update="#{update}"
|
||||||
|
onclick="PF('advancedSearchDialog').hide()"
|
||||||
|
process="@form" />
|
||||||
|
<p:commandButton
|
||||||
|
value="Annuler"
|
||||||
|
icon="pi pi-times"
|
||||||
|
styleClass="p-button-secondary"
|
||||||
|
onclick="PF('advancedSearchDialog').hide()" />
|
||||||
|
</div>
|
||||||
|
</f:facet>
|
||||||
|
</p:dialog>
|
||||||
|
</c:if>
|
||||||
|
|
||||||
|
</ui:composition>
|
||||||
|
|
||||||
@@ -21,6 +21,7 @@
|
|||||||
- showStatusFilter: Boolean (défaut: true) - Afficher le filtre statut
|
- showStatusFilter: Boolean (défaut: true) - Afficher le filtre statut
|
||||||
- showRoleFilter: Boolean (défaut: true) - Afficher le filtre rôle
|
- showRoleFilter: Boolean (défaut: true) - Afficher le filtre rôle
|
||||||
- formId: String (défaut: "searchForm") - ID du formulaire
|
- formId: String (défaut: "searchForm") - ID du formulaire
|
||||||
|
- useParentForm: Boolean (défaut: false) - Si true, n'crée pas de formulaire (utilise le formulaire parent)
|
||||||
|
|
||||||
Exemples d'utilisation:
|
Exemples d'utilisation:
|
||||||
|
|
||||||
@@ -31,13 +32,15 @@
|
|||||||
<ui:param name="update" value="userTable" />
|
<ui:param name="update" value="userTable" />
|
||||||
</ui:include>
|
</ui:include>
|
||||||
|
|
||||||
2. Recherche avec options avancées:
|
2. Recherche avec formulaire parent:
|
||||||
<ui:include src="/templates/components/user-management/user-search-bar.xhtml">
|
<h:form id="formUsers">
|
||||||
<ui:param name="searchCriteria" value="#{userBean.searchCriteria}" />
|
<ui:include src="/templates/components/user-management/user-search-bar.xhtml">
|
||||||
<ui:param name="searchAction" value="#{userBean.search}" />
|
<ui:param name="searchCriteria" value="#{userBean.searchCriteria}" />
|
||||||
<ui:param name="showAdvanced" value="true" />
|
<ui:param name="searchAction" value="#{userBean.search}" />
|
||||||
<ui:param name="update" value="userTable" />
|
<ui:param name="update" value="userTable" />
|
||||||
</ui:include>
|
<ui:param name="useParentForm" value="true" />
|
||||||
|
</ui:include>
|
||||||
|
</h:form>
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<c:set var="formId" value="#{empty formId ? 'searchForm' : formId}" />
|
<c:set var="formId" value="#{empty formId ? 'searchForm' : formId}" />
|
||||||
@@ -46,180 +49,35 @@
|
|||||||
<c:set var="showRealmFilter" value="#{empty showRealmFilter ? true : showRealmFilter}" />
|
<c:set var="showRealmFilter" value="#{empty showRealmFilter ? true : showRealmFilter}" />
|
||||||
<c:set var="showStatusFilter" value="#{empty showStatusFilter ? true : showStatusFilter}" />
|
<c:set var="showStatusFilter" value="#{empty showStatusFilter ? true : showStatusFilter}" />
|
||||||
<c:set var="showRoleFilter" value="#{empty showRoleFilter ? true : showRoleFilter}" />
|
<c:set var="showRoleFilter" value="#{empty showRoleFilter ? true : showRoleFilter}" />
|
||||||
|
<c:set var="useParentForm" value="#{empty useParentForm ? false : useParentForm}" />
|
||||||
|
|
||||||
<h:form id="#{formId}">
|
<c:choose>
|
||||||
<p:panel styleClass="w-full mb-3">
|
<c:when test="#{useParentForm}">
|
||||||
<f:facet name="header">
|
<!-- Utiliser le formulaire parent - pas de formulaire ici -->
|
||||||
<div class="flex align-items-center justify-content-between">
|
<ui:include src="/templates/components/user-management/user-search-bar-content.xhtml">
|
||||||
<span>Recherche d'utilisateurs</span>
|
<ui:param name="searchCriteria" value="#{searchCriteria}" />
|
||||||
<p:commandButton
|
<ui:param name="searchAction" value="#{searchAction}" />
|
||||||
icon="pi pi-filter"
|
<ui:param name="update" value="#{update}" />
|
||||||
styleClass="p-button-text p-button-sm"
|
<ui:param name="showAdvanced" value="#{showAdvanced}" />
|
||||||
onclick="PF('advancedSearchDialog').toggle()"
|
<ui:param name="showRealmFilter" value="#{showRealmFilter}" />
|
||||||
rendered="#{showAdvanced}"
|
<ui:param name="showStatusFilter" value="#{showStatusFilter}" />
|
||||||
title="Options avancées" />
|
<ui:param name="showRoleFilter" value="#{showRoleFilter}" />
|
||||||
</div>
|
</ui:include>
|
||||||
</f:facet>
|
</c:when>
|
||||||
|
<c:otherwise>
|
||||||
<!-- Recherche rapide -->
|
<!-- Créer son propre formulaire -->
|
||||||
<div class="flex gap-2 align-items-end">
|
<h:form id="#{formId}">
|
||||||
<div class="flex-1">
|
<ui:include src="/templates/components/user-management/user-search-bar-content.xhtml">
|
||||||
<p:outputLabel for="searchText" value="Rechercher" />
|
<ui:param name="searchCriteria" value="#{searchCriteria}" />
|
||||||
<p:inputText id="searchText"
|
<ui:param name="searchAction" value="#{searchAction}" />
|
||||||
value="#{searchCriteria.searchText}"
|
<ui:param name="update" value="#{update}" />
|
||||||
placeholder="Nom, prénom, email, username..."
|
<ui:param name="showAdvanced" value="#{showAdvanced}" />
|
||||||
styleClass="w-full">
|
<ui:param name="showRealmFilter" value="#{showRealmFilter}" />
|
||||||
<p:ajax event="keyup"
|
<ui:param name="showStatusFilter" value="#{showStatusFilter}" />
|
||||||
delay="500"
|
<ui:param name="showRoleFilter" value="#{showRoleFilter}" />
|
||||||
listener="#{searchAction}"
|
</ui:include>
|
||||||
update="#{update}" />
|
</h:form>
|
||||||
</p:inputText>
|
</c:otherwise>
|
||||||
</div>
|
</c:choose>
|
||||||
|
|
||||||
<!-- Filtre Realm -->
|
|
||||||
<c:if test="#{showRealmFilter}">
|
|
||||||
<div style="width: 200px;">
|
|
||||||
<p:outputLabel for="realmFilter" value="Realm" />
|
|
||||||
<p:selectOneMenu id="realmFilter"
|
|
||||||
value="#{searchCriteria.realmName}"
|
|
||||||
styleClass="w-full">
|
|
||||||
<f:selectItem itemLabel="Tous les realms" itemValue="" />
|
|
||||||
<f:selectItems value="#{userBean.availableRealms}" />
|
|
||||||
</p:selectOneMenu>
|
|
||||||
</div>
|
|
||||||
</c:if>
|
|
||||||
|
|
||||||
<!-- Filtre Statut -->
|
|
||||||
<c:if test="#{showStatusFilter}">
|
|
||||||
<div style="width: 180px;">
|
|
||||||
<p:outputLabel for="statusFilter" value="Statut" />
|
|
||||||
<p:selectOneMenu id="statusFilter"
|
|
||||||
value="#{searchCriteria.statut}"
|
|
||||||
styleClass="w-full">
|
|
||||||
<f:selectItem itemLabel="Tous les statuts" itemValue="" />
|
|
||||||
<f:selectItems value="#{userBean.statutOptions}" />
|
|
||||||
</p:selectOneMenu>
|
|
||||||
</div>
|
|
||||||
</c:if>
|
|
||||||
|
|
||||||
<!-- Bouton Rechercher -->
|
|
||||||
<div>
|
|
||||||
<p:commandButton
|
|
||||||
value="Rechercher"
|
|
||||||
icon="pi pi-search"
|
|
||||||
styleClass="p-button-primary"
|
|
||||||
action="#{searchAction}"
|
|
||||||
update="#{update}"
|
|
||||||
process="@form" />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Bouton Réinitialiser -->
|
|
||||||
<div>
|
|
||||||
<p:commandButton
|
|
||||||
value="Réinitialiser"
|
|
||||||
icon="pi pi-refresh"
|
|
||||||
styleClass="p-button-secondary"
|
|
||||||
action="#{userBean.resetSearch}"
|
|
||||||
update="#{update}"
|
|
||||||
process="@form" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</p:panel>
|
|
||||||
|
|
||||||
<!-- Options avancées (Dialog) -->
|
|
||||||
<c:if test="#{showAdvanced}">
|
|
||||||
<p:dialog id="advancedSearchDialog"
|
|
||||||
header="Options de recherche avancées"
|
|
||||||
widgetVar="advancedSearchDialog"
|
|
||||||
modal="true"
|
|
||||||
resizable="false"
|
|
||||||
styleClass="w-full md:w-6">
|
|
||||||
|
|
||||||
<p:panelGrid columns="2" styleClass="w-full" columnClasses="col-12 md:col-6">
|
|
||||||
<!-- Email -->
|
|
||||||
<p:outputLabel for="emailFilter" value="Email" />
|
|
||||||
<p:inputText id="emailFilter"
|
|
||||||
value="#{searchCriteria.email}"
|
|
||||||
placeholder="email@example.com"
|
|
||||||
styleClass="w-full" />
|
|
||||||
|
|
||||||
<!-- Téléphone -->
|
|
||||||
<p:outputLabel for="phoneFilter" value="Téléphone" />
|
|
||||||
<p:inputText id="phoneFilter"
|
|
||||||
value="#{searchCriteria.telephone}"
|
|
||||||
placeholder="+225 07 12 34 56 78"
|
|
||||||
styleClass="w-full" />
|
|
||||||
|
|
||||||
<!-- Organisation -->
|
|
||||||
<p:outputLabel for="orgFilter" value="Organisation" />
|
|
||||||
<p:inputText id="orgFilter"
|
|
||||||
value="#{searchCriteria.organisation}"
|
|
||||||
placeholder="Nom de l'organisation"
|
|
||||||
styleClass="w-full" />
|
|
||||||
|
|
||||||
<!-- Ville -->
|
|
||||||
<p:outputLabel for="cityFilter" value="Ville" />
|
|
||||||
<p:inputText id="cityFilter"
|
|
||||||
value="#{searchCriteria.ville}"
|
|
||||||
placeholder="Nom de la ville"
|
|
||||||
styleClass="w-full" />
|
|
||||||
|
|
||||||
<!-- Rôle (si affiché) -->
|
|
||||||
<c:if test="#{showRoleFilter}">
|
|
||||||
<p:outputLabel for="roleFilter" value="Rôle" />
|
|
||||||
<p:selectOneMenu id="roleFilter"
|
|
||||||
value="#{searchCriteria.roleName}"
|
|
||||||
styleClass="w-full">
|
|
||||||
<f:selectItem itemLabel="Tous les rôles" itemValue="" />
|
|
||||||
<f:selectItems value="#{userBean.availableRoles}" />
|
|
||||||
</p:selectOneMenu>
|
|
||||||
</c:if>
|
|
||||||
|
|
||||||
<!-- Date de création (début) -->
|
|
||||||
<p:outputLabel for="dateDebut" value="Date de création (début)" />
|
|
||||||
<p:calendar id="dateDebut"
|
|
||||||
value="#{searchCriteria.dateCreationDebut}"
|
|
||||||
pattern="dd/MM/yyyy"
|
|
||||||
styleClass="w-full" />
|
|
||||||
|
|
||||||
<!-- Date de création (fin) -->
|
|
||||||
<p:outputLabel for="dateFin" value="Date de création (fin)" />
|
|
||||||
<p:calendar id="dateFin"
|
|
||||||
value="#{searchCriteria.dateCreationFin}"
|
|
||||||
pattern="dd/MM/yyyy"
|
|
||||||
styleClass="w-full" />
|
|
||||||
|
|
||||||
<!-- Enabled -->
|
|
||||||
<p:outputLabel for="enabledFilter" value="Compte activé" />
|
|
||||||
<p:selectOneMenu id="enabledFilter"
|
|
||||||
value="#{searchCriteria.enabled}"
|
|
||||||
styleClass="w-full">
|
|
||||||
<f:selectItem itemLabel="Tous" itemValue="" />
|
|
||||||
<f:selectItem itemLabel="Activé" itemValue="true" />
|
|
||||||
<f:selectItem itemLabel="Désactivé" itemValue="false" />
|
|
||||||
</p:selectOneMenu>
|
|
||||||
</p:panelGrid>
|
|
||||||
|
|
||||||
<f:facet name="footer">
|
|
||||||
<div class="flex gap-2 justify-content-end">
|
|
||||||
<p:commandButton
|
|
||||||
value="Appliquer"
|
|
||||||
icon="pi pi-check"
|
|
||||||
styleClass="p-button-primary"
|
|
||||||
action="#{searchAction}"
|
|
||||||
update="#{update}"
|
|
||||||
onclick="PF('advancedSearchDialog').hide()"
|
|
||||||
process="@form" />
|
|
||||||
<p:commandButton
|
|
||||||
value="Annuler"
|
|
||||||
icon="pi pi-times"
|
|
||||||
styleClass="p-button-secondary"
|
|
||||||
onclick="PF('advancedSearchDialog').hide()" />
|
|
||||||
</div>
|
|
||||||
</f:facet>
|
|
||||||
</p:dialog>
|
|
||||||
</c:if>
|
|
||||||
</h:form>
|
|
||||||
|
|
||||||
</ui:composition>
|
</ui:composition>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user