From 0d936eb80aaf759c3392ef4449b4f458f0faad74 Mon Sep 17 00:00:00 2001 From: dahoud <41957584+DahoudG@users.noreply.github.com> Date: Thu, 9 Apr 2026 15:08:48 +0000 Subject: [PATCH] feat: formulaire types organisation avec categorie et modules requis MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - TypeOrganisationsAdminBean: gestion List modulesSelectionnes (sync CSV↔List), constantes CATEGORIES/MODULES_DISPONIBLES, getters JSF, CreateTypeReferenceRequest et UpdateTypeReferenceRequest mis à jour (11 args) - organisations.xhtml: dropdown catégorie + selectManyCheckbox modules (16), colonnes Catégorie et Modules requis dans le DataTable, dialogue 750px - pom.xml: unionflow-server-api 1.0.0 → 1.0.3 --- pom.xml | 4 +- .../view/TypeOrganisationsAdminBean.java | 52 +++++++++++++++++-- .../super-admin/types/organisations.xhtml | 51 ++++++++++++++++-- 3 files changed, 99 insertions(+), 8 deletions(-) diff --git a/pom.xml b/pom.xml index ea7083e..d404540 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ dev.lions.unionflow unionflow-parent - 1.0.0 + 1.0.3 ../unionflow-server-api/parent-pom.xml @@ -129,7 +129,7 @@ dev.lions.unionflow unionflow-server-api - 1.0.0 + 1.0.3 diff --git a/src/main/java/dev/lions/unionflow/client/view/TypeOrganisationsAdminBean.java b/src/main/java/dev/lions/unionflow/client/view/TypeOrganisationsAdminBean.java index 6874e21..ad3abd5 100644 --- a/src/main/java/dev/lions/unionflow/client/view/TypeOrganisationsAdminBean.java +++ b/src/main/java/dev/lions/unionflow/client/view/TypeOrganisationsAdminBean.java @@ -13,6 +13,7 @@ import jakarta.inject.Inject; import jakarta.inject.Named; import java.io.Serializable; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import java.util.UUID; import org.eclipse.microprofile.rest.client.inject.RestClient; @@ -52,12 +53,25 @@ public class TypeOrganisationsAdminBean implements Serializable { @Inject TypeCatalogueService typeCatalogueService; + private static final List CATEGORIES_DISPONIBLES = Arrays.asList( + "ASSOCIATIF", "FINANCIER_SOLIDAIRE", "RELIGIEUX", "PROFESSIONNEL", "RESEAU_FEDERATION" + ); + + private static final List MODULES_DISPONIBLES = Arrays.asList( + "COTISATIONS", "EVENEMENTS", "SOLIDARITE", "COMPTABILITE", "DOCUMENTS", + "NOTIFICATIONS", "CREDIT_EPARGNE", "AYANTS_DROIT", "TONTINE", "ONG_PROJETS", + "COOP_AGRICOLE", "VOTE_INTERNE", "COLLECTE_FONDS", "REGISTRE_PROFESSIONNEL", + "CULTES_RELIGIEUX", "GOUVERNANCE_MULTI" + ); + private List types = new ArrayList<>(); /** Type actuellement édité dans le dialogue (nouveau ou existant). */ private TypeReferenceResponse typeCourant; private TypeReferenceResponse typeSelectionne; /** ID du type à supprimer (pour dialogue de confirmation explicite). */ private UUID typeASupprimerId; + /** Modules sélectionnés dans le dialogue (synchronisé avec typeCourant.modulesRequis CSV). */ + private List modulesSelectionnes = new ArrayList<>(); @PostConstruct public void init() { @@ -82,6 +96,7 @@ public class TypeOrganisationsAdminBean implements Serializable { typeCourant = new TypeReferenceResponse(); typeCourant.setActif(true); typeSelectionne = null; + modulesSelectionnes = new ArrayList<>(); } private void creerType() { @@ -93,6 +108,9 @@ public class TypeOrganisationsAdminBean implements Serializable { try { LOG.infof("Tentative de création d'un type d'organisation: %s", typeCourant); + String modulesRequisCsv = modulesSelectionnes.isEmpty() + ? null : String.join(",", modulesSelectionnes); + CreateTypeReferenceRequest request = CreateTypeReferenceRequest.builder() .domaine("TYPE_ORGANISATION") .code(typeCourant.getCode()) @@ -102,6 +120,8 @@ public class TypeOrganisationsAdminBean implements Serializable { .estDefaut(false) .estSysteme(false) .organisationId(null) + .categorie(typeCourant.getCategorie()) + .modulesRequis(modulesRequisCsv) .build(); TypeReferenceResponse cree = retryService.executeWithRetrySupplier( @@ -156,6 +176,9 @@ public class TypeOrganisationsAdminBean implements Serializable { } try { + String modulesRequisCsv = modulesSelectionnes.isEmpty() + ? null : String.join(",", modulesSelectionnes); + UpdateTypeReferenceRequest request = new UpdateTypeReferenceRequest( typeCourant.getCode(), typeCourant.getLibelle(), @@ -165,7 +188,9 @@ public class TypeOrganisationsAdminBean implements Serializable { null, // severity typeCourant.getOrdreAffichage(), null, // estDefaut - typeCourant.getActif() + typeCourant.getActif(), + typeCourant.getCategorie(), + modulesRequisCsv ); TypeReferenceResponse maj = retryService.executeWithRetrySupplier( @@ -248,6 +273,11 @@ public class TypeOrganisationsAdminBean implements Serializable { public void setTypeSelectionne(TypeReferenceResponse typeSelectionne) { this.typeSelectionne = typeSelectionne; this.typeCourant = typeSelectionne; + // Reconvertir le CSV en liste pour les checkboxes + String csv = (typeSelectionne != null) ? typeSelectionne.getModulesRequis() : null; + modulesSelectionnes = (csv != null && !csv.isBlank()) + ? new ArrayList<>(Arrays.asList(csv.split(","))) + : new ArrayList<>(); } /** @@ -263,7 +293,23 @@ public class TypeOrganisationsAdminBean implements Serializable { return typeCourant; } - public void setTypeCourant(TypeReferenceResponse typeCourant) { - this.typeCourant = typeCourant; + public void setTypeCourant(TypeReferenceResponse typeCourant) { + this.typeCourant = typeCourant; + } + + public List getModulesSelectionnes() { + return modulesSelectionnes; + } + + public void setModulesSelectionnes(List modulesSelectionnes) { + this.modulesSelectionnes = modulesSelectionnes; + } + + public List getCategoriesDisponibles() { + return CATEGORIES_DISPONIBLES; + } + + public List getModulesDisponibles() { + return MODULES_DISPONIBLES; } } diff --git a/src/main/resources/META-INF/resources/pages/super-admin/types/organisations.xhtml b/src/main/resources/META-INF/resources/pages/super-admin/types/organisations.xhtml index 528cb0a..97b008e 100644 --- a/src/main/resources/META-INF/resources/pages/super-admin/types/organisations.xhtml +++ b/src/main/resources/META-INF/resources/pages/super-admin/types/organisations.xhtml @@ -62,6 +62,14 @@ + + + + + + + + @@ -117,7 +125,7 @@ modal="true" resizable="false" responsive="true" - width="600"> + width="750">
@@ -146,18 +154,55 @@ rows="3" maxlength="500" />
-
+
+ + + + + + + + + +
+
-
+
+
+ + + + + + + + + + + + + + + + + + + +