From c298f4d20eb592a23659b002a0fc58a7e874b196 Mon Sep 17 00:00:00 2001 From: "t.ruspekhofer" Date: Wed, 9 Mar 2022 23:25:01 +0100 Subject: [PATCH] split the role tables from RaidDetails into their own razor files --- Lieb/Pages/Raids/RaidDetails.razor | 134 ++++--------------- Lieb/Pages/Raids/RaidRolesNoSignUp.razor | 35 +++++ Lieb/Pages/Raids/RaidRolesNoSignUp.razor.css | 9 ++ Lieb/Pages/Raids/RaidRolesPlanned.razor | 114 ++++++++++++++++ Lieb/Pages/Raids/RaidRolesPlanned.razor.css | 19 +++ 5 files changed, 204 insertions(+), 107 deletions(-) create mode 100644 Lieb/Pages/Raids/RaidRolesNoSignUp.razor create mode 100644 Lieb/Pages/Raids/RaidRolesNoSignUp.razor.css create mode 100644 Lieb/Pages/Raids/RaidRolesPlanned.razor create mode 100644 Lieb/Pages/Raids/RaidRolesPlanned.razor.css diff --git a/Lieb/Pages/Raids/RaidDetails.razor b/Lieb/Pages/Raids/RaidDetails.razor index 1c22b12..8b5e57b 100644 --- a/Lieb/Pages/Raids/RaidDetails.razor +++ b/Lieb/Pages/Raids/RaidDetails.razor @@ -7,6 +7,9 @@ @inject RaidRandomizerService RaidRandomizerService + + +
@_raid.Title
@_raid.Description
@@ -37,115 +40,23 @@ - - - @{ - ulong discordId = ulong.Parse(@context.User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.NameIdentifier).Value); - LiebUser user = UserService.GetLiebUser(discordId); - RaidSignUp userRole = _raid.SignUps.Where(s => s.LiebUserId == user.LiebUserId).FirstOrDefault(); - bool isSignedUp = userRole != null; - bool isRaidSignUpAllowed = RaidService.IsRaidSignUpAllowed(user.LiebUserId, _raid.RaidId, out string errorMessage); + @if(_isRaidSignUpAllowed) + { + if(_raid.RaidType == RaidType.Planned) + { + } - - - - @foreach (var role in _raid.Roles) - { - RaidSignUp[] signUps = _raid.SignUps.Where(s => s.PlannedRaidRoleId == role.PlannedRaidRoleId).ToArray(); - int usedSpots = signUps.Where(s => s.SignUpType == SignUpType.SignedUp).Count(); + else + { + + } + } + else + { + + } - - @if (isRaidSignUpAllowed) - { - @if (RaidService.IsRoleSignUpAllowed(_raid.RaidId, user.LiebUserId, role.PlannedRaidRoleId, SignUpType.SignedUp, false)) - { - - - } - else - { - - - } - - - } - - - - @foreach (var signUp in signUps) - { - @if(signUp.SignUpType != SignUpType.SignedOff) - { - - @{bool isUser = isSignedUp && userRole.PlannedRaidRole.PlannedRaidRoleId == role.PlannedRaidRoleId && signUp.LiebUserId == user.LiebUserId;} - @if (isRaidSignUpAllowed) - { - - - - @if(isUser) - { - - } - else - { - - } - } - @{string signUpStatus = string.Empty;} - @if (signUp.SignUpType != SignUpType.SignedUp) signUpStatus = $" - {signUp.SignUpType}"; - - @if (isUser) - { - - } - else - { - - } - - } - } - } - -
@role.Name: @role.Description (@usedSpots /@role.Spots)
@signUp.LiebUser.Name - @signUpStatus @signUp.LiebUser.Name (@signUp.GuildWars2Account.AccountName) @signUpStatus
-
- -
- - - @foreach (var role in _raid.Roles) - { - Models.GuildWars2.Raid.RaidSignUp[] signUps = _raid.SignUps.Where(s => s.PlannedRaidRoleId == role.PlannedRaidRoleId).ToArray(); - int usedSpots = signUps.Where(s => s.SignUpType == SignUpType.SignedUp).Count(); - - - - - @foreach (var signUp in signUps) - { - if(signUp.SignUpType != SignUpType.SignedOff) - { - string signUpStatus = string.Empty; - if (signUp.SignUpType != SignUpType.SignedUp) signUpStatus = $" - {signUp.SignUpType}"; - - - - } - } - } - -
@role.Name: @role.Description (@usedSpots /@role.Spots)
@signUp.LiebUser.Name (@signUp.GuildWars2Account.AccountName) @signUpStatus
-
-
-
+