refactor: Suppression de 13 écrans redondants
Nettoyage des doublons pour éviter la redondance : Suppressions (liste.xhtml redondants avec écrans racine): - devis/liste.xhtml - employes/liste.xhtml - equipes/liste.xhtml - factures/liste.xhtml - maintenance/liste.xhtml - materiels/liste.xhtml - messages/liste.xhtml - notifications/liste.xhtml - planning/liste.xhtml - rapports/liste.xhtml - stock/liste.xhtml Suppressions (inconsistance nouveau/nouvelle): - equipes/nouvelle.xhtml - factures/nouvelle.xhtml Stratégie: - Un seul écran liste par module (racine) - Standardisation sur nouveau.xhtml Résultat: 163 écrans restants (vs 176 avant)
This commit is contained in:
@@ -181,5 +181,93 @@ public interface BtpXpressApiClient {
|
||||
@GET
|
||||
@Path("/factures")
|
||||
Response getFactures();
|
||||
|
||||
// === ENDPOINTS EMPLOYÉS ===
|
||||
|
||||
/**
|
||||
* Récupère la liste des employés.
|
||||
* Correspond à {@code EmployeResource.getAllEmployes()} dans le serveur.
|
||||
*
|
||||
* @return Réponse HTTP contenant la liste des employés.
|
||||
*/
|
||||
@GET
|
||||
@Path("/employes")
|
||||
Response getEmployes();
|
||||
|
||||
/**
|
||||
* Récupère un employé par son identifiant.
|
||||
*
|
||||
* @param id L'identifiant de l'employé.
|
||||
* @return Réponse HTTP contenant l'employé.
|
||||
*/
|
||||
@GET
|
||||
@Path("/employes/{id}")
|
||||
Response getEmploye(@PathParam("id") String id);
|
||||
|
||||
// === ENDPOINTS ÉQUIPES ===
|
||||
|
||||
/**
|
||||
* Récupère la liste des équipes.
|
||||
* Correspond à {@code EquipeResource.getAllEquipes()} dans le serveur.
|
||||
*
|
||||
* @return Réponse HTTP contenant la liste des équipes.
|
||||
*/
|
||||
@GET
|
||||
@Path("/equipes")
|
||||
Response getEquipes();
|
||||
|
||||
/**
|
||||
* Récupère une équipe par son identifiant.
|
||||
*
|
||||
* @param id L'identifiant de l'équipe.
|
||||
* @return Réponse HTTP contenant l'équipe.
|
||||
*/
|
||||
@GET
|
||||
@Path("/equipes/{id}")
|
||||
Response getEquipe(@PathParam("id") String id);
|
||||
|
||||
// === ENDPOINTS MATÉRIELS ===
|
||||
|
||||
/**
|
||||
* Récupère la liste des matériels.
|
||||
* Correspond à {@code MaterielResource.getAllMateriels()} dans le serveur.
|
||||
*
|
||||
* @return Réponse HTTP contenant la liste des matériels.
|
||||
*/
|
||||
@GET
|
||||
@Path("/materiels")
|
||||
Response getMateriels();
|
||||
|
||||
/**
|
||||
* Récupère un matériel par son identifiant.
|
||||
*
|
||||
* @param id L'identifiant du matériel.
|
||||
* @return Réponse HTTP contenant le matériel.
|
||||
*/
|
||||
@GET
|
||||
@Path("/materiels/{id}")
|
||||
Response getMateriel(@PathParam("id") String id);
|
||||
|
||||
// === ENDPOINTS STOCKS ===
|
||||
|
||||
/**
|
||||
* Récupère la liste des stocks.
|
||||
* Correspond à {@code StockResource.getAllStocks()} dans le serveur.
|
||||
*
|
||||
* @return Réponse HTTP contenant la liste des stocks.
|
||||
*/
|
||||
@GET
|
||||
@Path("/stocks")
|
||||
Response getStocks();
|
||||
|
||||
/**
|
||||
* Récupère un stock par son identifiant.
|
||||
*
|
||||
* @param id L'identifiant du stock.
|
||||
* @return Réponse HTTP contenant le stock.
|
||||
*/
|
||||
@GET
|
||||
@Path("/stocks/{id}")
|
||||
Response getStock(@PathParam("id") String id);
|
||||
}
|
||||
|
||||
|
||||
@@ -42,9 +42,8 @@ public class ChantierService {
|
||||
LOG.debug("Récupération de la liste des chantiers depuis l'API backend.");
|
||||
Response response = apiClient.getChantiers();
|
||||
if (response.getStatus() == Response.Status.OK.getStatusCode()) {
|
||||
Map<String, Object> data = response.readEntity(Map.class);
|
||||
@SuppressWarnings("unchecked")
|
||||
List<Map<String, Object>> chantiers = (List<Map<String, Object>>) data.get("chantiers");
|
||||
List<Map<String, Object>> chantiers = response.readEntity(List.class);
|
||||
LOG.debug("Chantiers récupérés avec succès : {} élément(s)", chantiers != null ? chantiers.size() : 0);
|
||||
return chantiers != null ? chantiers : new ArrayList<>();
|
||||
} else {
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package dev.lions.btpxpress.view;
|
||||
|
||||
import dev.lions.btpxpress.service.ChantierService;
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import jakarta.faces.view.ViewScoped;
|
||||
import jakarta.inject.Inject;
|
||||
import jakarta.inject.Named;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
@@ -13,6 +15,7 @@ import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
@Named("chantiersView")
|
||||
@@ -20,9 +23,12 @@ import java.util.function.Predicate;
|
||||
@Getter
|
||||
@Setter
|
||||
public class ChantiersView extends BaseListView<ChantiersView.Chantier, Long> implements Serializable {
|
||||
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(ChantiersView.class);
|
||||
|
||||
@Inject
|
||||
ChantierService chantierService;
|
||||
|
||||
private String filtreNom;
|
||||
private String filtreClient;
|
||||
private String filtreStatut;
|
||||
@@ -48,23 +54,78 @@ public class ChantiersView extends BaseListView<ChantiersView.Chantier, Long> im
|
||||
loading = true;
|
||||
try {
|
||||
items = new ArrayList<>();
|
||||
for (int i = 1; i <= 20; i++) {
|
||||
|
||||
// Récupération depuis l'API backend
|
||||
List<Map<String, Object>> chantiersData = chantierService.getAllChantiers();
|
||||
|
||||
for (Map<String, Object> data : chantiersData) {
|
||||
Chantier c = new Chantier();
|
||||
c.setId((long) i);
|
||||
c.setNom("Chantier " + i);
|
||||
c.setClient("Client " + (i % 5 + 1));
|
||||
c.setAdresse("123 Rue Exemple " + i + ", 75001 Paris");
|
||||
c.setDateDebut(LocalDate.now().minusDays(i * 10));
|
||||
c.setDateFinPrevue(LocalDate.now().plusDays((20 - i) * 10));
|
||||
c.setStatut(i % 3 == 0 ? "TERMINE" : (i % 3 == 1 ? "EN_COURS" : "PLANIFIE"));
|
||||
c.setAvancement(i * 5);
|
||||
c.setBudget(i * 15000.0);
|
||||
c.setCoutReel(i * 12000.0);
|
||||
|
||||
// Mapping des données de l'API vers l'objet Chantier
|
||||
c.setId(data.get("id") != null ? Long.valueOf(data.get("id").toString().hashCode()) : null);
|
||||
c.setNom((String) data.get("nom"));
|
||||
|
||||
// Le client peut être un objet ou une chaîne
|
||||
Object clientObj = data.get("client");
|
||||
if (clientObj instanceof Map) {
|
||||
Map<String, Object> clientData = (Map<String, Object>) clientObj;
|
||||
c.setClient((String) clientData.get("raisonSociale"));
|
||||
} else if (clientObj instanceof String) {
|
||||
c.setClient((String) clientObj);
|
||||
} else {
|
||||
c.setClient("N/A");
|
||||
}
|
||||
|
||||
c.setAdresse((String) data.get("adresse"));
|
||||
|
||||
// Conversion des dates
|
||||
if (data.get("dateDebut") != null) {
|
||||
c.setDateDebut(LocalDate.parse(data.get("dateDebut").toString()));
|
||||
}
|
||||
if (data.get("dateFinPrevue") != null) {
|
||||
c.setDateFinPrevue(LocalDate.parse(data.get("dateFinPrevue").toString()));
|
||||
}
|
||||
|
||||
c.setStatut((String) data.get("statut"));
|
||||
|
||||
// Avancement en pourcentage
|
||||
Object avancementObj = data.get("avancement");
|
||||
if (avancementObj != null) {
|
||||
c.setAvancement(avancementObj instanceof Integer ?
|
||||
(Integer) avancementObj :
|
||||
Integer.parseInt(avancementObj.toString()));
|
||||
} else {
|
||||
c.setAvancement(0);
|
||||
}
|
||||
|
||||
// Budget et coût réel
|
||||
Object montantObj = data.get("montant");
|
||||
if (montantObj != null) {
|
||||
c.setBudget(montantObj instanceof Number ?
|
||||
((Number) montantObj).doubleValue() :
|
||||
Double.parseDouble(montantObj.toString()));
|
||||
} else {
|
||||
c.setBudget(0.0);
|
||||
}
|
||||
|
||||
Object coutReelObj = data.get("coutReel");
|
||||
if (coutReelObj != null) {
|
||||
c.setCoutReel(coutReelObj instanceof Number ?
|
||||
((Number) coutReelObj).doubleValue() :
|
||||
Double.parseDouble(coutReelObj.toString()));
|
||||
} else {
|
||||
c.setCoutReel(0.0);
|
||||
}
|
||||
|
||||
items.add(c);
|
||||
}
|
||||
|
||||
LOG.info("Chantiers chargés depuis l'API : {} élément(s)", items.size());
|
||||
applyFilters(items, buildFilters());
|
||||
} catch (Exception e) {
|
||||
LOG.error("Erreur chargement chantiers", e);
|
||||
LOG.error("Erreur chargement chantiers depuis l'API", e);
|
||||
// En cas d'erreur, on garde une liste vide
|
||||
items = new ArrayList<>();
|
||||
} finally {
|
||||
loading = false;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package dev.lions.btpxpress.view;
|
||||
|
||||
import dev.lions.btpxpress.service.ClientService;
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import jakarta.faces.view.ViewScoped;
|
||||
import jakarta.inject.Inject;
|
||||
import jakarta.inject.Named;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
@@ -12,6 +14,7 @@ import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
@Named("clientsView")
|
||||
@@ -19,9 +22,12 @@ import java.util.function.Predicate;
|
||||
@Getter
|
||||
@Setter
|
||||
public class ClientsView extends BaseListView<ClientsView.Client, Long> implements Serializable {
|
||||
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(ClientsView.class);
|
||||
|
||||
@Inject
|
||||
ClientService clientService;
|
||||
|
||||
private String filtreNom;
|
||||
private String filtreEmail;
|
||||
private String filtreVille;
|
||||
@@ -37,27 +43,63 @@ public class ClientsView extends BaseListView<ClientsView.Client, Long> implemen
|
||||
loading = true;
|
||||
try {
|
||||
items = new ArrayList<>();
|
||||
for (int i = 1; i <= 25; i++) {
|
||||
|
||||
// Récupération depuis l'API backend
|
||||
List<Map<String, Object>> clientsData = clientService.getAllClients();
|
||||
|
||||
for (Map<String, Object> data : clientsData) {
|
||||
Client c = new Client();
|
||||
c.setId((long) i);
|
||||
c.setRaisonSociale("Entreprise " + i);
|
||||
c.setNomContact("Contact " + i);
|
||||
c.setEmail("contact" + i + "@example.com");
|
||||
c.setTelephone("+33 1 " + String.format("%02d", i) + " " +
|
||||
String.format("%02d", i * 2) + " " +
|
||||
String.format("%02d", i * 3) + " " +
|
||||
String.format("%02d", i * 4));
|
||||
c.setAdresse(i + " Rue Client, " + (75000 + i) + " Paris");
|
||||
c.setVille("Paris");
|
||||
c.setCodePostal(String.valueOf(75000 + i));
|
||||
c.setNombreChantiers(i % 5 + 1);
|
||||
c.setChiffreAffairesTotal(i * 25000.0);
|
||||
c.setDateCreation(LocalDateTime.now().minusDays(i * 30));
|
||||
|
||||
// Mapping des données de l'API vers l'objet Client
|
||||
c.setId(data.get("id") != null ? Long.valueOf(data.get("id").toString().hashCode()) : null);
|
||||
|
||||
// Raison sociale : entreprise ou "Particulier" si vide
|
||||
String entreprise = (String) data.get("entreprise");
|
||||
c.setRaisonSociale(entreprise != null && !entreprise.trim().isEmpty() ?
|
||||
entreprise : "Particulier");
|
||||
|
||||
// Nom complet du contact : prénom + nom
|
||||
String prenom = (String) data.get("prenom");
|
||||
String nom = (String) data.get("nom");
|
||||
c.setNomContact((prenom != null ? prenom + " " : "") + (nom != null ? nom : ""));
|
||||
|
||||
c.setEmail((String) data.get("email"));
|
||||
c.setTelephone((String) data.get("telephone"));
|
||||
c.setAdresse((String) data.get("adresse"));
|
||||
c.setVille((String) data.get("ville"));
|
||||
c.setCodePostal((String) data.get("codePostal"));
|
||||
|
||||
// Nombre de chantiers (relation)
|
||||
Object chantiersObj = data.get("chantiers");
|
||||
if (chantiersObj instanceof List) {
|
||||
c.setNombreChantiers(((List<?>) chantiersObj).size());
|
||||
} else {
|
||||
c.setNombreChantiers(0);
|
||||
}
|
||||
|
||||
// Chiffre d'affaires total (à calculer ou récupérer)
|
||||
// Pour l'instant, on met 0 car cette donnée n'est pas dans l'API
|
||||
c.setChiffreAffairesTotal(0.0);
|
||||
|
||||
// Date de création
|
||||
if (data.get("dateCreation") != null) {
|
||||
c.setDateCreation(LocalDateTime.parse(data.get("dateCreation").toString()));
|
||||
}
|
||||
|
||||
// Date de modification
|
||||
if (data.get("dateModification") != null) {
|
||||
c.setDateModification(LocalDateTime.parse(data.get("dateModification").toString()));
|
||||
}
|
||||
|
||||
items.add(c);
|
||||
}
|
||||
|
||||
LOG.info("Clients chargés depuis l'API : {} élément(s)", items.size());
|
||||
applyFilters(items, buildFilters());
|
||||
} catch (Exception e) {
|
||||
LOG.error("Erreur chargement clients", e);
|
||||
LOG.error("Erreur chargement clients depuis l'API", e);
|
||||
// En cas d'erreur, on garde une liste vide
|
||||
items = new ArrayList<>();
|
||||
} finally {
|
||||
loading = false;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -64,6 +64,10 @@ public class GuestPreferences implements Serializable {
|
||||
return this.inputStyle.equals("filled") ? "ui-input-filled" : "";
|
||||
}
|
||||
|
||||
public void setComponentTheme(String componentTheme) {
|
||||
this.componentTheme = componentTheme;
|
||||
}
|
||||
|
||||
public void onMenuTypeChange() {
|
||||
if ("layout-horizontal".equals(menuMode)) {
|
||||
menuTheme = topbarTheme;
|
||||
|
||||
Reference in New Issue
Block a user