feat: total members on direction line manage

This commit is contained in:
Julien Froidefond
2025-08-25 21:57:18 +02:00
parent 565fde2808
commit 3b8f3e4110
4 changed files with 42 additions and 0 deletions

View File

@@ -224,6 +224,23 @@ export function useTeamsManagement(
// Extraire les directions uniques pour les formulaires
const directions = Array.from(new Set(teams.map((team) => team.direction)));
// Calculer les stats par direction
const getDirectionStats = (direction: string) => {
const teamsInDirection = teams.filter(
(team) => team.direction === direction
);
const totalMembers = teamsInDirection.reduce((total, team) => {
const stats = getTeamStats(team.id);
return total + (stats?.totalMembers || 0);
}, 0);
return {
direction,
totalMembers,
hasMembers: totalMembers > 0,
};
};
return {
teams,
teamStats,
@@ -234,6 +251,7 @@ export function useTeamsManagement(
setTeamFormData,
resetForm,
getTeamStats,
getDirectionStats,
handleCreateTeam,
handleEditTeam,
handleUpdateTeam,