feat: Add CMS and Member Area screens with ViewModels
- Implemented CmsViewModel to manage CMS data loading and state. - Created MemberAreaDetailScreens for displaying member information and news. - Added MembersViewModel and MemberNewsViewModel for managing member data and news. - Developed MemberAreaScreen to provide navigation and display member-related options. - Introduced ProfileScreen and ProfileViewModel for user profile management. - Implemented state management for loading, error handling, and form updates across screens.
This commit is contained in:
@@ -117,6 +117,22 @@
|
||||
</div>
|
||||
</td>
|
||||
<td class="px-4 py-3 whitespace-nowrap text-right text-sm font-medium space-x-3">
|
||||
<button
|
||||
class="p-2 border border-gray-300 rounded-lg hover:bg-gray-50 text-gray-600 disabled:opacity-50 disabled:cursor-not-allowed mr-1"
|
||||
title="Nach oben"
|
||||
:disabled="isSaving || index === 0"
|
||||
@click="moveMannschaftUp(index)"
|
||||
>
|
||||
<ChevronUp :size="18" />
|
||||
</button>
|
||||
<button
|
||||
class="p-2 border border-gray-300 rounded-lg hover:bg-gray-50 text-gray-600 disabled:opacity-50 disabled:cursor-not-allowed mr-2"
|
||||
title="Nach unten"
|
||||
:disabled="isSaving || index === mannschaften.length - 1"
|
||||
@click="moveMannschaftDown(index)"
|
||||
>
|
||||
<ChevronDown :size="18" />
|
||||
</button>
|
||||
<button
|
||||
class="text-gray-600 hover:text-gray-900"
|
||||
title="Bearbeiten"
|
||||
@@ -577,6 +593,29 @@ const saveCSV = async () => {
|
||||
})
|
||||
}
|
||||
|
||||
const moveMannschaft = async (index, delta) => {
|
||||
const to = index + delta
|
||||
if (index < 0 || to < 0 || to >= mannschaften.value.length) return
|
||||
isSaving.value = true
|
||||
try {
|
||||
const arr = mannschaften.value
|
||||
const item = arr[index]
|
||||
arr.splice(index, 1)
|
||||
arr.splice(to, 0, item)
|
||||
await saveCSV()
|
||||
await loadMannschaften().catch(() => {})
|
||||
if (window.showSuccessModal) window.showSuccessModal('Erfolg', 'Reihenfolge gespeichert')
|
||||
} catch (err) {
|
||||
console.error('Fehler beim Verschieben der Mannschaft:', err)
|
||||
if (window.showErrorModal) window.showErrorModal('Fehler', 'Reihenfolge konnte nicht gespeichert werden')
|
||||
} finally {
|
||||
isSaving.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const moveMannschaftUp = (index) => moveMannschaft(index, -1)
|
||||
const moveMannschaftDown = (index) => moveMannschaft(index, 1)
|
||||
|
||||
const createNextSeason = async () => {
|
||||
const baseSeason = selectedSeason.value || seasons.value[0]
|
||||
const nextSeason = getNextSeasonSlug(baseSeason)
|
||||
|
||||
Reference in New Issue
Block a user