fix(organisations): corriger executeWithRetry, accesseurs statut et XHTML détail
- OrganisationsBean : executeWithRetrySupplier → executeWithRetry (méthode correcte, compatible ECJ — Callable<T> au lieu de Supplier<T> non capturé) - OrganisationDetailBean : utiliser statutLibelle/statutSeverity si présents avant fallback sur statut brut ; supprimer revenirAListe() (redirect manuel inutile) ; propager typeLibelle en plus de typeOrganisationLibelle - detail.xhtml : remplacer les panneaux adresseComplete/dateFondation/niveauHierarchique (champs absents du DTO) par nombreEvenements qui existe dans OrganisationSummaryResponse
This commit is contained in:
@@ -1,7 +1,5 @@
|
|||||||
package dev.lions.unionflow.client.view;
|
package dev.lions.unionflow.client.view;
|
||||||
|
|
||||||
import dev.lions.unionflow.server.api.dto.organisation.response.OrganisationResponse;
|
|
||||||
import dev.lions.unionflow.server.api.dto.organisation.response.OrganisationSummaryResponse;
|
|
||||||
import dev.lions.unionflow.server.api.dto.organisation.response.OrganisationResponse;
|
import dev.lions.unionflow.server.api.dto.organisation.response.OrganisationResponse;
|
||||||
import dev.lions.unionflow.server.api.dto.organisation.response.OrganisationSummaryResponse;
|
import dev.lions.unionflow.server.api.dto.organisation.response.OrganisationSummaryResponse;
|
||||||
import dev.lions.unionflow.server.api.dto.common.PagedResponse;
|
import dev.lions.unionflow.server.api.dto.common.PagedResponse;
|
||||||
@@ -20,7 +18,6 @@ import jakarta.inject.Named;
|
|||||||
import org.eclipse.microprofile.rest.client.inject.RestClient;
|
import org.eclipse.microprofile.rest.client.inject.RestClient;
|
||||||
import org.jboss.logging.Logger;
|
import org.jboss.logging.Logger;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -89,7 +86,9 @@ public class OrganisationDetailBean implements Serializable {
|
|||||||
"chargement des détails d'une organisation"
|
"chargement des détails d'une organisation"
|
||||||
);
|
);
|
||||||
if (organisation != null) {
|
if (organisation != null) {
|
||||||
organisation.setTypeOrganisationLibelle(typeCatalogueService.resolveLibelle(organisation.getTypeOrganisation()));
|
String libelle = typeCatalogueService.resolveLibelle(organisation.getTypeOrganisation());
|
||||||
|
organisation.setTypeOrganisationLibelle(libelle);
|
||||||
|
organisation.setTypeLibelle(libelle);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOG.errorf(e, "Erreur lors du chargement de l'organisation");
|
LOG.errorf(e, "Erreur lors du chargement de l'organisation");
|
||||||
@@ -131,7 +130,9 @@ public class OrganisationDetailBean implements Serializable {
|
|||||||
);
|
);
|
||||||
organisation = maj;
|
organisation = maj;
|
||||||
if (organisation != null) {
|
if (organisation != null) {
|
||||||
organisation.setTypeOrganisationLibelle(typeCatalogueService.resolveLibelle(organisation.getTypeOrganisation()));
|
String libelle = typeCatalogueService.resolveLibelle(organisation.getTypeOrganisation());
|
||||||
|
organisation.setTypeOrganisationLibelle(libelle);
|
||||||
|
organisation.setTypeLibelle(libelle);
|
||||||
}
|
}
|
||||||
modeEdition = false;
|
modeEdition = false;
|
||||||
errorHandler.showSuccess("Succès", "Organisation modifiée avec succès.");
|
errorHandler.showSuccess("Succès", "Organisation modifiée avec succès.");
|
||||||
@@ -248,13 +249,6 @@ public class OrganisationDetailBean implements Serializable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void revenirAListe() throws IOException {
|
|
||||||
FacesContext ctx = FacesContext.getCurrentInstance();
|
|
||||||
ctx.getExternalContext().redirect(
|
|
||||||
ctx.getExternalContext().getRequestContextPath() + "/pages/secure/organisation/liste.xhtml"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ── Données pour le formulaire (DRY : même interface que OrganisationsBean) ──
|
// ── Données pour le formulaire (DRY : même interface que OrganisationsBean) ──
|
||||||
|
|
||||||
public List<SelectItem> getTypesSelectItemsForForm() {
|
public List<SelectItem> getTypesSelectItemsForForm() {
|
||||||
@@ -338,7 +332,10 @@ public class OrganisationDetailBean implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getStatutLibelle() {
|
public String getStatutLibelle() {
|
||||||
if (organisation == null || organisation.getStatut() == null) return "Non renseigné";
|
if (organisation == null) return "Non renseigné";
|
||||||
|
if (organisation.getStatutLibelle() != null && !organisation.getStatutLibelle().isBlank())
|
||||||
|
return organisation.getStatutLibelle();
|
||||||
|
if (organisation.getStatut() == null) return "Non renseigné";
|
||||||
return switch (organisation.getStatut()) {
|
return switch (organisation.getStatut()) {
|
||||||
case "ACTIVE" -> "Active";
|
case "ACTIVE" -> "Active";
|
||||||
case "INACTIVE" -> "Inactive";
|
case "INACTIVE" -> "Inactive";
|
||||||
@@ -349,7 +346,10 @@ public class OrganisationDetailBean implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getStatutSeverity() {
|
public String getStatutSeverity() {
|
||||||
if (organisation == null || organisation.getStatut() == null) return "secondary";
|
if (organisation == null) return "secondary";
|
||||||
|
if (organisation.getStatutSeverity() != null && !organisation.getStatutSeverity().isBlank())
|
||||||
|
return organisation.getStatutSeverity();
|
||||||
|
if (organisation.getStatut() == null) return "secondary";
|
||||||
return switch (organisation.getStatut()) {
|
return switch (organisation.getStatut()) {
|
||||||
case "ACTIVE" -> "success";
|
case "ACTIVE" -> "success";
|
||||||
case "INACTIVE" -> "warning";
|
case "INACTIVE" -> "warning";
|
||||||
|
|||||||
@@ -434,7 +434,7 @@ public class OrganisationsBean implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
retryService.executeWithRetrySupplier(
|
retryService.executeWithRetry(
|
||||||
() -> {
|
() -> {
|
||||||
organisationService.supprimer(organisation.getId());
|
organisationService.supprimer(organisation.getId());
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -120,12 +120,6 @@
|
|||||||
<h:outputText value="#{organisationDetailBean.organisation.siteWeb}" />
|
<h:outputText value="#{organisationDetailBean.organisation.siteWeb}" />
|
||||||
</span>
|
</span>
|
||||||
</h:panelGroup>
|
</h:panelGroup>
|
||||||
<h:panelGroup rendered="#{not empty organisationDetailBean.adresseComplete}">
|
|
||||||
<span class="flex align-items-center gap-2 text-600 text-sm">
|
|
||||||
<i class="pi pi-map-marker text-primary" />
|
|
||||||
<h:outputText value="#{organisationDetailBean.adresseComplete}" />
|
|
||||||
</span>
|
|
||||||
</h:panelGroup>
|
|
||||||
</div>
|
</div>
|
||||||
</h:panelGroup>
|
</h:panelGroup>
|
||||||
|
|
||||||
@@ -159,7 +153,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</h:panelGroup>
|
</h:panelGroup>
|
||||||
<h:panelGroup rendered="#{not empty organisationDetailBean.organisation.dateFondation}">
|
<h:panelGroup rendered="#{organisationDetailBean.organisation.nombreEvenements != null}">
|
||||||
<div class="flex align-items-center gap-2">
|
<div class="flex align-items-center gap-2">
|
||||||
<div class="flex align-items-center justify-content-center surface-200 border-round-lg"
|
<div class="flex align-items-center justify-content-center surface-200 border-round-lg"
|
||||||
style="width:2rem;height:2rem;">
|
style="width:2rem;height:2rem;">
|
||||||
@@ -167,42 +161,9 @@
|
|||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<div class="text-900 font-bold text-lg">
|
<div class="text-900 font-bold text-lg">
|
||||||
<h:outputText value="#{organisationDetailBean.organisation.dateFondation}">
|
<h:outputText value="#{organisationDetailBean.organisation.nombreEvenements}" />
|
||||||
<f:convertDateTime pattern="dd/MM/yyyy" type="localDate" />
|
|
||||||
</h:outputText>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="text-500 text-xs">Fondée le</div>
|
<div class="text-500 text-xs">Événements</div>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</h:panelGroup>
|
|
||||||
<h:panelGroup rendered="#{organisationDetailBean.organisation.niveauHierarchique != null}">
|
|
||||||
<div class="flex align-items-center gap-2">
|
|
||||||
<div class="flex align-items-center justify-content-center surface-200 border-round-lg"
|
|
||||||
style="width:2rem;height:2rem;">
|
|
||||||
<i class="pi pi-sitemap text-orange-600" />
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<div class="text-900 font-bold text-lg">
|
|
||||||
<h:outputText value="#{organisationDetailBean.organisation.niveauHierarchique}" />
|
|
||||||
</div>
|
|
||||||
<div class="text-500 text-xs">Niveau</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</h:panelGroup>
|
|
||||||
<h:panelGroup rendered="#{not empty organisationDetailBean.organisation.budgetAnnuel}">
|
|
||||||
<div class="flex align-items-center gap-2">
|
|
||||||
<div class="flex align-items-center justify-content-center surface-200 border-round-lg"
|
|
||||||
style="width:2rem;height:2rem;">
|
|
||||||
<i class="pi pi-wallet text-indigo-600" />
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<div class="text-900 font-bold text-lg">
|
|
||||||
<h:outputText value="#{organisationDetailBean.organisation.budgetAnnuel}" />
|
|
||||||
<span class="text-500 font-normal text-xs ml-1">
|
|
||||||
<h:outputText value="#{organisationDetailBean.organisation.devise}" />
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div class="text-500 text-xs">Budget annuel</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</h:panelGroup>
|
</h:panelGroup>
|
||||||
@@ -243,17 +204,6 @@
|
|||||||
</div>
|
</div>
|
||||||
<p:divider styleClass="mb-3" />
|
<p:divider styleClass="mb-3" />
|
||||||
|
|
||||||
<!-- Nom mis en valeur -->
|
|
||||||
<div class="mb-4 p-3 border-round"
|
|
||||||
style="background:var(--blue-50);border-left:3px solid var(--blue-300);">
|
|
||||||
<div style="font-size:.68rem;font-weight:700;text-transform:uppercase;letter-spacing:.09em;color:var(--blue-600);margin-bottom:.35rem;">
|
|
||||||
Nom complet
|
|
||||||
</div>
|
|
||||||
<div style="font-size:1.05rem;font-weight:700;color:var(--text-color);">
|
|
||||||
<h:outputText value="#{organisationDetailBean.organisation.nom}" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<ui:include src="/templates/components/forms/detail-field.xhtml">
|
<ui:include src="/templates/components/forms/detail-field.xhtml">
|
||||||
<ui:param name="label" value="Nom court / Sigle" />
|
<ui:param name="label" value="Nom court / Sigle" />
|
||||||
<ui:param name="value" value="#{organisationDetailBean.organisation.nomCourt}" />
|
<ui:param name="value" value="#{organisationDetailBean.organisation.nomCourt}" />
|
||||||
@@ -534,10 +484,6 @@
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<ui:include src="/templates/components/forms/detail-field.xhtml">
|
|
||||||
<ui:param name="label" value="Niveau hiérarchique" />
|
|
||||||
<ui:param name="value" value="#{organisationDetailBean.organisation.niveauHierarchique}" />
|
|
||||||
</ui:include>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -591,10 +537,6 @@
|
|||||||
<ui:param name="label" value="Montant de la cotisation annuelle" />
|
<ui:param name="label" value="Montant de la cotisation annuelle" />
|
||||||
<ui:param name="value" value="#{organisationDetailBean.organisation.montantCotisationAnnuelle}" />
|
<ui:param name="value" value="#{organisationDetailBean.organisation.montantCotisationAnnuelle}" />
|
||||||
</ui:include>
|
</ui:include>
|
||||||
<ui:include src="/templates/components/forms/detail-field.xhtml">
|
|
||||||
<ui:param name="label" value="Devise" />
|
|
||||||
<ui:param name="value" value="#{organisationDetailBean.organisation.devise}" />
|
|
||||||
</ui:include>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -673,7 +615,11 @@
|
|||||||
Rattachée à
|
Rattachée à
|
||||||
</div>
|
</div>
|
||||||
<div style="font-weight:700;color:var(--text-color);">
|
<div style="font-weight:700;color:var(--text-color);">
|
||||||
<h:outputText value="#{organisationDetailBean.organisation.nomOrganisationParente}" />
|
<h:link value="#{organisationDetailBean.organisation.nomOrganisationParente}"
|
||||||
|
outcome="/pages/secure/organisation/detail"
|
||||||
|
styleClass="text-cyan-700 font-bold no-underline hover:underline">
|
||||||
|
<f:param name="id" value="#{organisationDetailBean.organisation.organisationParenteId}" />
|
||||||
|
</h:link>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user