feat: formulaire types organisation avec categorie et modules requis
- TypeOrganisationsAdminBean: gestion List<String> 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
This commit is contained in:
@@ -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<String> CATEGORIES_DISPONIBLES = Arrays.asList(
|
||||
"ASSOCIATIF", "FINANCIER_SOLIDAIRE", "RELIGIEUX", "PROFESSIONNEL", "RESEAU_FEDERATION"
|
||||
);
|
||||
|
||||
private static final List<String> 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<TypeReferenceResponse> 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<String> 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<String> getModulesSelectionnes() {
|
||||
return modulesSelectionnes;
|
||||
}
|
||||
|
||||
public void setModulesSelectionnes(List<String> modulesSelectionnes) {
|
||||
this.modulesSelectionnes = modulesSelectionnes;
|
||||
}
|
||||
|
||||
public List<String> getCategoriesDisponibles() {
|
||||
return CATEGORIES_DISPONIBLES;
|
||||
}
|
||||
|
||||
public List<String> getModulesDisponibles() {
|
||||
return MODULES_DISPONIBLES;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user