feat(TeamPlanningBoard, TeamManagementView): add team conversion functionality
All checks were successful
Deploy tt-tagebuch / deploy (push) Successful in 43s
All checks were successful
Deploy tt-tagebuch / deploy (push) Successful in 43s
- Introduced a new button in TeamPlanningBoard for converting planning teams to regular teams, enhancing team management capabilities. - Implemented the `convertPlanningTeamToRegular` method in TeamManagementView to handle the conversion process, including validation and UI updates. - Updated event handling to ensure seamless integration of the new feature within the existing team management workflow.
This commit is contained in:
@@ -61,6 +61,14 @@
|
||||
:placeholder="t('teamManagement.teamName')"
|
||||
@input="$emit('update-team-field', team.id, 'name', $event.target.value)"
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
class="btn-secondary btn-upload-sm"
|
||||
:title="t('teamManagement.editTeam')"
|
||||
@click="$emit('convert-planning-team', team.id)"
|
||||
>
|
||||
↗
|
||||
</button>
|
||||
<button type="button" class="btn-secondary btn-upload-sm" @click="$emit('remove-planning-team', team.id)">×</button>
|
||||
</div>
|
||||
<div v-if="getTeamStatusLabel(team.id)" class="planning-team-status" :class="`state-${getTeamStatusState(team.id)}`">
|
||||
@@ -189,6 +197,7 @@ export default {
|
||||
'remove-member-from-team',
|
||||
'update-team-field',
|
||||
'remove-planning-team',
|
||||
'convert-planning-team',
|
||||
'mark-member-interested'
|
||||
],
|
||||
methods: {
|
||||
|
||||
@@ -61,6 +61,7 @@
|
||||
@mark-member-interested="onPlanningMarkMemberInterested"
|
||||
@update-team-field="updatePlanningTeamField"
|
||||
@remove-planning-team="removePlanningTeam"
|
||||
@convert-planning-team="convertPlanningTeamToRegular"
|
||||
/>
|
||||
|
||||
<div v-if="activeMainSection === 'overview'" class="newteam">
|
||||
@@ -1488,6 +1489,25 @@ export default {
|
||||
}
|
||||
};
|
||||
|
||||
const convertPlanningTeamToRegular = async (teamId) => {
|
||||
const team = teams.value.find((entry) => Number(entry.id) === Number(teamId));
|
||||
if (!team) return;
|
||||
|
||||
activeMainSection.value = 'overview';
|
||||
await editTeam(team);
|
||||
teamFormIsOpen.value = true;
|
||||
activeEditorSection.value = 'basic';
|
||||
|
||||
if (!team.leagueId) {
|
||||
await showInfo(
|
||||
t('teamManagement.editTeam'),
|
||||
t('teamManagement.leagueFieldRequired'),
|
||||
'',
|
||||
'info'
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
const toggleNewTeam = () => {
|
||||
teamFormIsOpen.value = !teamFormIsOpen.value;
|
||||
if (!teamFormIsOpen.value) {
|
||||
@@ -1551,13 +1571,18 @@ export default {
|
||||
if (!newTeamName.value.trim() || !selectedClub.value || !selectedSeasonId.value) return;
|
||||
|
||||
try {
|
||||
const normalizedLeagueId = newLeagueId.value || null;
|
||||
const shouldClearPlannedLeague =
|
||||
!!teamToEdit.value &&
|
||||
!!normalizedLeagueId &&
|
||||
!!String(teamToEdit.value?.plannedLeagueName || '').trim();
|
||||
const teamData = {
|
||||
name: newTeamName.value.trim(),
|
||||
leagueId: newLeagueId.value || null,
|
||||
leagueId: normalizedLeagueId,
|
||||
seasonId: selectedSeasonId.value,
|
||||
teamGender: newTeamGender.value,
|
||||
teamAgeGroup: newTeamAgeGroup.value,
|
||||
plannedLeagueName: newPlannedLeagueName.value.trim() || null
|
||||
plannedLeagueName: shouldClearPlannedLeague ? null : (newPlannedLeagueName.value.trim() || null)
|
||||
};
|
||||
|
||||
if (teamToEdit.value) {
|
||||
@@ -2874,6 +2899,7 @@ export default {
|
||||
editTeam,
|
||||
deleteTeam,
|
||||
removePlanningTeam,
|
||||
convertPlanningTeamToRegular,
|
||||
uploadCodeList,
|
||||
uploadPinList,
|
||||
loadTeamDocuments,
|
||||
|
||||
Reference in New Issue
Block a user