Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 | <template> <div class="admin-panel" data-testid="admin-panel"> <!-- Admin Access Check --> <div v-if="!authStore.isAdmin.value && !authStore.isClubManager.value" class="text-center py-12" data-testid="admin-access-denied" > <div class="max-w-md mx-auto"> <div class="text-red-600 text-6xl mb-4">🚫</div> <h2 class="text-2xl font-bold text-gray-900 mb-2">Access Denied</h2> <p class="text-gray-600"> You need administrator privileges to access this page. </p> </div> </div> <!-- Admin Content (only for admins) --> <div v-else> <!-- Admin Description --> <div class="mb-6"> <p class="text-gray-600">Manage league data and configurations</p> </div> <!-- Admin Navigation --> <div class="mb-8" data-testid="admin-nav"> <nav class="flex space-x-1 bg-gray-100 p-1 rounded-lg" aria-label="Admin sections" > <button v-for="section in adminSections" :key="section.id" @click="currentSection = section.id" :data-testid="`admin-tab-${section.id}`" :class="[ currentSection === section.id ? 'bg-white text-gray-900 shadow' : 'text-gray-600 hover:text-gray-900', 'px-4 py-2 text-sm font-medium rounded-md transition-colors', ]" > {{ section.name }} </button> </nav> </div> <!-- Section Content --> <div class="bg-white rounded-lg shadow-sm border border-gray-200" data-testid="admin-content" > <!-- Invite Requests Management --> <div v-if="currentSection === 'invite-requests'" class="p-6" data-testid="admin-section-invite-requests" > <AdminInviteRequests /> </div> <!-- Channel Access Requests --> <div v-if="currentSection === 'channel-requests'" class="p-6" data-testid="admin-section-channel-requests" > <AdminChannelRequests /> </div> <!-- Age Groups Management --> <div v-if="currentSection === 'age-groups'" class="p-6" data-testid="admin-section-age-groups" > <AdminAgeGroups /> </div> <!-- Seasons Management --> <div v-if="currentSection === 'seasons'" class="p-6" data-testid="admin-section-seasons" > <AdminSeasons /> </div> <!-- Leagues Management --> <div v-if="currentSection === 'leagues'" class="p-6" data-testid="admin-section-leagues" > <AdminLeagues /> </div> <!-- Divisions Management --> <div v-if="currentSection === 'divisions'" class="p-6" data-testid="admin-section-divisions" > <AdminDivisions /> </div> <!-- Clubs Management --> <div v-if="currentSection === 'clubs'" class="p-6" data-testid="admin-section-clubs" > <AdminClubs /> </div> <!-- Teams Management --> <div v-if="currentSection === 'teams'" class="p-6" data-testid="admin-section-teams" > <AdminTeams /> </div> <!-- Players Management --> <div v-if="currentSection === 'players'" class="p-6" data-testid="admin-section-players" > <AdminPlayers /> </div> <!-- Matches Management --> <div v-if="currentSection === 'matches'" class="p-6" data-testid="admin-section-matches" > <AdminMatches /> </div> <!-- Goals Management --> <div v-if="currentSection === 'goals'" class="p-6" data-testid="admin-section-goals" > <AdminGoals /> </div> <!-- Playoffs Management --> <div v-if="currentSection === 'playoffs'" class="p-6" data-testid="admin-section-playoffs" > <AdminPlayoffs /> </div> <!-- Invites Management --> <div v-if="currentSection === 'invites'" class="p-6" data-testid="admin-section-invites" > <AdminInvites /> </div> <!-- Tournaments Management --> <div v-if="currentSection === 'tournaments'" class="p-6" data-testid="admin-section-tournaments" > <AdminTournaments /> </div> <!-- Cache Management --> <div v-if="currentSection === 'cache'" class="p-6" data-testid="admin-section-cache" > <AdminCache /> </div> <!-- Users / Login Activity --> <div v-if="currentSection === 'users'" class="p-6" data-testid="admin-section-users" > <AdminUsers /> </div> </div> </div> </div> </template> <script> import { ref, computed } from 'vue'; import { useAuthStore } from '@/stores/auth'; import AdminAgeGroups from './admin/AdminAgeGroups.vue'; import AdminSeasons from './admin/AdminSeasons.vue'; import AdminLeagues from './admin/AdminLeagues.vue'; import AdminDivisions from './admin/AdminDivisions.vue'; import AdminClubs from './admin/AdminClubs.vue'; import AdminTeams from './admin/AdminTeams.vue'; import AdminPlayers from './admin/AdminPlayers.vue'; import AdminMatches from './admin/AdminMatches.vue'; import AdminGoals from './admin/AdminGoals.vue'; import AdminInvites from './admin/AdminInvites.vue'; import AdminChannelRequests from './admin/AdminChannelRequests.vue'; import AdminInviteRequests from './admin/AdminInviteRequests.vue'; import AdminPlayoffs from './admin/AdminPlayoffs.vue'; import AdminCache from './admin/AdminCache.vue'; import AdminUsers from './admin/AdminUsers.vue'; import AdminTournaments from './admin/AdminTournaments.vue'; export default { name: 'AdminPanel', components: { AdminAgeGroups, AdminSeasons, AdminLeagues, AdminDivisions, AdminClubs, AdminTeams, AdminPlayers, AdminMatches, AdminGoals, AdminInvites, AdminChannelRequests, AdminInviteRequests, AdminPlayoffs, AdminCache, AdminUsers, AdminTournaments, }, setup() { const authStore = useAuthStore(); const currentSection = ref('invite-requests'); // Define all sections with role requirements const allAdminSections = [ { id: 'invite-requests', name: 'Requests', adminOnly: true }, { id: 'channel-requests', name: 'Channel Requests', adminOnly: false }, { id: 'age-groups', name: 'Age Groups', adminOnly: true }, { id: 'seasons', name: 'Seasons', adminOnly: true }, { id: 'leagues', name: 'Leagues', adminOnly: true }, { id: 'divisions', name: 'Divisions', adminOnly: true }, { id: 'clubs', name: 'Clubs', adminOnly: true }, { id: 'teams', name: 'Teams', adminOnly: false }, { id: 'players', name: 'Players', adminOnly: false }, { id: 'matches', name: 'Matches', adminOnly: false }, { id: 'goals', name: 'Goals', adminOnly: false }, { id: 'playoffs', name: 'Playoffs', adminOnly: true }, { id: 'tournaments', name: 'Tournaments', adminOnly: true }, { id: 'invites', name: 'Invites', adminOnly: false }, { id: 'cache', name: 'Cache', adminOnly: true }, { id: 'users', name: 'Users', adminOnly: true }, ]; // Filter sections based on user role const adminSections = computed(() => { if (authStore.isAdmin.value) { return allAdminSections; } // Club managers only see Teams, Matches, Invites return allAdminSections.filter(section => !section.adminOnly); }); // Update current section when role changes if ( !authStore.isAdmin.value && currentSection.value === 'invite-requests' ) { currentSection.value = 'teams'; } return { authStore, currentSection, adminSections, }; }, }; </script> <style scoped> .admin-panel { max-width: 1200px; margin: 0 auto; } </style> |