diff --git a/Lieb/Pages/Raids/RaidDetails.razor b/Lieb/Pages/Raids/RaidDetails.razor index 1f3624b..72c8878 100644 --- a/Lieb/Pages/Raids/RaidDetails.razor +++ b/Lieb/Pages/Raids/RaidDetails.razor @@ -41,21 +41,7 @@ - @if(_isRaidSignUpAllowed) - { - if(_raid.RaidType == RaidType.Planned) - { - - } - else - { - - } - } - else - { - - } + diff --git a/Lieb/Pages/Raids/RaidRolesRandom.razor b/Lieb/Pages/Raids/RaidRoles.razor similarity index 57% rename from Lieb/Pages/Raids/RaidRolesRandom.razor rename to Lieb/Pages/Raids/RaidRoles.razor index 6646a0f..146465b 100644 --- a/Lieb/Pages/Raids/RaidRolesRandom.razor +++ b/Lieb/Pages/Raids/RaidRoles.razor @@ -7,7 +7,7 @@ @{ - RaidSignUp userRole = _raid.SignUps.Where(s => s.LiebUserId == _user.LiebUserId).FirstOrDefault(); + RaidSignUp userRole = _raid.SignUps.Where(s => s.LiebUserId == _liebUserId).FirstOrDefault(); bool isSignedUp = userRole != null; } @foreach (PlannedRaidRole role in _raid.Roles.OrderBy(r => r.PlannedRaidRoleId)) @@ -16,14 +16,14 @@ int usedSpots = signUps.Where(s => s.SignUpType == SignUpType.SignedUp).Count(); - + - @{bool isUser = isSignedUp && userRole.PlannedRaidRole.PlannedRaidRoleId == role.PlannedRaidRoleId && signUp.LiebUserId == _user.LiebUserId;} + @{bool isUser = isSignedUp && userRole.PlannedRaidRole.PlannedRaidRoleId == role.PlannedRaidRoleId && signUp.LiebUserId == _liebUserId;} @{string signUpStatus = string.Empty;} @if (signUp.SignUpType != SignUpType.SignedUp) signUpStatus = $" - {signUp.SignUpType}"; @@ -45,17 +45,41 @@ } } - @if (role.IsRandomSignUpRole && _raid.SignUps.Where(s => s.SignUpType == SignUpType.SignedUp).Count() < role.Spots) + @if(_liebUserId > 0) { - - - + @if(_raid.RaidType == RaidType.Planned) + { + @if (RaidService.IsRoleSignUpAllowed(_raid.RaidId, _user.LiebUserId, role.PlannedRaidRoleId, SignUpType.SignedUp, false)) + { + + + } + else + { + + + } + + @if (isSignedUp && userRole.SignUpType != SignUpType.SignedOff && _raid.RaidType == RaidType.Planned) + { + + } + } + else + { + @if (role.IsRandomSignUpRole && _raid.SignUps.Where(s => s.SignUpType == SignUpType.SignedUp).Count() < role.Spots) + { + + + + } + } } }
@role.Name (@usedSpots /@role.Spots)
@role.Description
@role.Name (@usedSpots /@role.Spots)
@role.Description
@foreach (var signUp in signUps) { @if(signUp.SignUpType != SignUpType.SignedOff) {
- + @code { @@ -63,18 +87,24 @@ public Raid _raid { get; set; } [Parameter] - public LiebUser _user { get; set; } + public LiebUser? _user { get; set; } + + private int _liebUserId { get; set; } = -1; private List _usableAccounts; protected override async Task OnParametersSetAsync() { - _usableAccounts = _user.GuildWars2Accounts.Where(a => a.EquippedBuilds.Count > 0).ToList(); + if (_user != null) + { + _usableAccounts = _user.GuildWars2Accounts.Where(a => a.EquippedBuilds.Count > 0).ToList(); + _liebUserId = _user.LiebUserId; + } } async Task SignUpClicked(PlannedRaidRole role, LiebUser liebUser, bool isSignedUp, SignUpType signUpType) { - if(isSignedUp) + if(isSignedUp && signUpType != SignUpType.Flex) { await RaidService.ChangeSignUpType(_raid.RaidId, liebUser.LiebUserId, role.PlannedRaidRoleId, signUpType); } diff --git a/Lieb/Pages/Raids/RaidRolesPlanned.razor.css b/Lieb/Pages/Raids/RaidRoles.razor.css similarity index 100% rename from Lieb/Pages/Raids/RaidRolesPlanned.razor.css rename to Lieb/Pages/Raids/RaidRoles.razor.css diff --git a/Lieb/Pages/Raids/RaidRolesNoSignUp.razor b/Lieb/Pages/Raids/RaidRolesNoSignUp.razor deleted file mode 100644 index a644c28..0000000 --- a/Lieb/Pages/Raids/RaidRolesNoSignUp.razor +++ /dev/null @@ -1,37 +0,0 @@ -@using Lieb.Models.GuildWars2.Raid - -
- - - @foreach (var role in _raid.Roles.OrderBy(r => r.PlannedRaidRoleId)) - { - Models.GuildWars2.Raid.RaidSignUp[] signUps = _raid.SignUps.Where(s => s.PlannedRaidRoleId == role.PlannedRaidRoleId).ToArray(); - int usedSpots = signUps.Where(s => s.SignUpType == SignUpType.SignedUp).Count(); - - - - - - - } - } - - - } - -
@role.Name (@usedSpots /@role.Spots)
@role.Description
- @foreach (var signUp in signUps) - { - if(signUp.SignUpType != SignUpType.SignedOff) - { - string signUpStatus = string.Empty; - if (signUp.SignUpType != SignUpType.SignedUp) signUpStatus = $" - {signUp.SignUpType}"; -
@signUp.LiebUser.Name (@signUp.GuildWars2Account.AccountName) @signUpStatus
-
- - -@code { - [Parameter] - public Raid _raid { get; set; } - -} diff --git a/Lieb/Pages/Raids/RaidRolesNoSignUp.razor.css b/Lieb/Pages/Raids/RaidRolesNoSignUp.razor.css deleted file mode 100644 index 33eccca..0000000 --- a/Lieb/Pages/Raids/RaidRolesNoSignUp.razor.css +++ /dev/null @@ -1,9 +0,0 @@ -h5 { - color: lightgrey; -} - -table { - column-width: auto; - color: lightgray; - width: max-content; -} diff --git a/Lieb/Pages/Raids/RaidRolesPlanned.razor b/Lieb/Pages/Raids/RaidRolesPlanned.razor deleted file mode 100644 index 2f72344..0000000 --- a/Lieb/Pages/Raids/RaidRolesPlanned.razor +++ /dev/null @@ -1,96 +0,0 @@ -@using Lieb.Data -@using Lieb.Models -@using Lieb.Models.GuildWars2.Raid -@inject RaidService RaidService - - - - @{ - RaidSignUp userRole = _raid.SignUps.Where(s => s.LiebUserId == _user.LiebUserId).FirstOrDefault(); - bool isSignedUp = userRole != null; - } - @foreach (var role in _raid.Roles.OrderBy(r => r.PlannedRaidRoleId)) - { - RaidSignUp[] signUps = _raid.SignUps.Where(s => s.PlannedRaidRoleId == role.PlannedRaidRoleId).ToArray(); - int usedSpots = signUps.Where(s => s.SignUpType == SignUpType.SignedUp).Count(); - - - - - @{bool isUser = isSignedUp && userRole.PlannedRaidRole.PlannedRaidRoleId == role.PlannedRaidRoleId && signUp.LiebUserId == _user.LiebUserId;} - @{string signUpStatus = string.Empty;} - @if (signUp.SignUpType != SignUpType.SignedUp) signUpStatus = $" - {signUp.SignUpType}"; - - @if (isUser && _user.GuildWars2Accounts.Count > 1) - { - - } - else - { - - } - - } - } - - - @if (RaidService.IsRoleSignUpAllowed(_raid.RaidId, _user.LiebUserId, role.PlannedRaidRoleId, SignUpType.SignedUp, false)) - { - - - } - else - { - - - } - - @if (isSignedUp && userRole.SignUpType != SignUpType.SignedOff) - { - - } - - } - -
@role.Name (@usedSpots /@role.Spots)
@role.Description
- @foreach (var signUp in signUps) - { - @if(signUp.SignUpType != SignUpType.SignedOff) - { -
@signUp.LiebUser.Name - @signUpStatus @signUp.LiebUser.Name (@signUp.GuildWars2Account.AccountName) @signUpStatus
- - -@code { - - [Parameter] - public Raid _raid { get; set; } - - [Parameter] - public LiebUser _user { get; set; } - - async Task SignUpClicked(PlannedRaidRole role, LiebUser liebUser, bool isSignedUp, SignUpType signUpType) - { - if(isSignedUp && signUpType != SignUpType.Flex) - { - await RaidService.ChangeSignUpType(_raid.RaidId, liebUser.LiebUserId, role.PlannedRaidRoleId, signUpType); - } - else - { - await RaidService.SignUp(_raid.RaidId, liebUser.LiebUserId, liebUser.GuildWars2Accounts.FirstOrDefault().GuildWars2AccountId, role.PlannedRaidRoleId, signUpType); - } - _raid = RaidService.GetRaid(_raid.RaidId); - } - - async Task ChangeAccount(LiebUser liebUser, ChangeEventArgs e) - { - int accountId = int.Parse(e.Value.ToString()); - await RaidService.ChangeAccount(_raid.RaidId, liebUser.LiebUserId, accountId); - _raid = RaidService.GetRaid(_raid.RaidId); - } -} diff --git a/Lieb/Pages/Raids/RaidRolesRandom.razor.css b/Lieb/Pages/Raids/RaidRolesRandom.razor.css deleted file mode 100644 index 33eccca..0000000 --- a/Lieb/Pages/Raids/RaidRolesRandom.razor.css +++ /dev/null @@ -1,9 +0,0 @@ -h5 { - color: lightgrey; -} - -table { - column-width: auto; - color: lightgray; - width: max-content; -}