feat(TeamManagementView): enhance league validation logic for team management
All checks were successful
Deploy tt-tagebuch / deploy (push) Successful in 43s

- Updated league validation to consider both leagueId and plannedLeagueName, allowing for more flexible team management workflows.
- Adjusted missing items logic to reflect the new validation criteria, improving user feedback on required fields.
- Enhanced tooltip and state management to accurately represent league requirements based on the updated validation rules.
This commit is contained in:
Torsten Schulz (local)
2026-05-06 09:55:53 +02:00
parent 95bfbf86a4
commit 25c3b90972

View File

@@ -1498,7 +1498,7 @@ export default {
teamFormIsOpen.value = true;
activeEditorSection.value = 'basic';
if (!team.leagueId) {
if (!team.leagueId && !String(team?.plannedLeagueName || '').trim()) {
await showInfo(
t('teamManagement.editTeam'),
t('teamManagement.leagueFieldRequired'),
@@ -2235,6 +2235,9 @@ export default {
const hasTeamId = !!team.myTischtennisTeamId;
const hasLeague = !!team.league;
const hasPlannedLeague = !!String(team?.plannedLeagueName || '').trim();
// Für den Planungs-Workflow gilt ein geplanter Liga-Text als valider Zwischenstand.
const hasLeagueForWorkflow = hasLeague || hasPlannedLeague;
const hasLeagueConfig = hasLeague &&
!!team.league.myTischtennisGroupId &&
!!team.league.association &&
@@ -2242,13 +2245,13 @@ export default {
const missingItems = [];
if (!hasTeamId) missingItems.push(t('teamManagement.teamId'));
if (!hasLeague) missingItems.push(t('teamManagement.league'));
if (!hasLeagueForWorkflow) missingItems.push(t('teamManagement.league'));
if (hasLeague && !team.league.myTischtennisGroupId) missingItems.push(t('teamManagement.groupId'));
if (hasLeague && !team.league.association) missingItems.push(t('teamManagement.association'));
if (hasLeague && !team.league.groupname) missingItems.push(t('teamManagement.groupName'));
const complete = hasTeamId && hasLeagueConfig;
const partial = (hasTeamId || hasLeagueConfig) && !complete;
const partial = (hasTeamId || hasLeagueConfig || hasPlannedLeague) && !complete;
let tooltip = '';
if (complete) {
@@ -2267,7 +2270,7 @@ export default {
missing: missingItems.length > 0 ? t('teamManagement.missingItems', { items: missingItems.join(', ') }) : '',
missingItemLabels: [...missingItems],
tooltip,
needsLeague: !hasLeague,
needsLeague: !hasLeagueForWorkflow,
needsTeamId: !hasTeamId,
needsLeagueGroupId: !!(hasLeague && !team.league.myTischtennisGroupId),
needsLeagueAssociation: !!(hasLeague && !team.league.association),