diff --git a/Lieb/Pages/Raids/RaidRoles.razor b/Lieb/Pages/Raids/RaidRoles.razor index 4e950ce..3d761aa 100644 --- a/Lieb/Pages/Raids/RaidRoles.razor +++ b/Lieb/Pages/Raids/RaidRoles.razor @@ -5,10 +5,27 @@ @inject RaidService RaidService + @{ + bool flexExists = _raid.SignUps.Where(s => s.SignUpType == SignUpType.Flex).Any(); + } - - + + + @if (flexExists) + { + + } @@ -16,28 +33,51 @@ @{ bool isSignedUp = _raid.SignUps.Where(s => s.LiebUserId == _liebUserId && s.SignUpType != SignUpType.SignedOff).Any(); } - @foreach (PlannedRaidRole role in _raid.Roles.OrderBy(r => r.PlannedRaidRoleId)) + @foreach (ExpandableRole role in _expandableRoles.OrderBy(r => r.Role.PlannedRaidRoleId)) { - + } - @if(_liebUserId > 0) + @if (flexExists) { - bool notIsRoleSignUpAllowed = !RaidService.IsRoleSignUpAllowed(_raid.RaidId, _liebUserId, role.PlannedRaidRoleId, SignUpType.SignedUp, false); + List flexSignUpTypes =new List(){SignUpType.Flex}; + + } + @if(_liebUserId > 0 && _isRaidSignUpAllowed) + { + bool notIsRoleSignUpAllowed = !RaidService.IsRoleSignUpAllowed(_raid.RaidId, _liebUserId, role.Role.PlannedRaidRoleId, SignUpType.SignedUp, false); bool notIsBackupAllowed = _raid.RaidType != RaidType.Planned && notIsRoleSignUpAllowed; - - - + + + @if (isSignedUp && _raid.RaidType == RaidType.Planned) { - + } } @@ -54,10 +94,21 @@ [Parameter] public LiebUser? _user { get; set; } + [Parameter] + public bool _isRaidSignUpAllowed { get; set; } + private int _liebUserId { get; set; } = -1; private List _usableAccounts; + private List _expandableRoles; + + private class ExpandableRole + { + public PlannedRaidRole Role; + public bool IsRowExpanded = false; + } + protected override async Task OnParametersSetAsync() { if (_user != null) @@ -72,13 +123,21 @@ } _liebUserId = _user.LiebUserId; } + _expandableRoles = new List(); + foreach(PlannedRaidRole role in _raid.Roles) + { + _expandableRoles.Add(new ExpandableRole() + { + Role = role + }); + } } async Task SignUpClicked(PlannedRaidRole role, SignUpType signUpType) { if(_raid.SignUps.Where(s => s.LiebUserId == _liebUserId).Any() && signUpType != SignUpType.Flex) { - await RaidService.ChangeSignUpType(_raid.RaidId, _liebUserId, role.PlannedRaidRoleId, signUpType); + RaidService.ChangeSignUpType(_raid.RaidId, _liebUserId, role.PlannedRaidRoleId, signUpType); } else { @@ -94,4 +153,13 @@ _raid = RaidService.GetRaid(_raid.RaidId); this.StateHasChanged(); } + + public async Task ExpandAll() + { + bool newStatus = !_expandableRoles.FirstOrDefault().IsRowExpanded; + foreach(ExpandableRole role in _expandableRoles) + { + role.IsRowExpanded = newStatus; + } + } } diff --git a/Lieb/Pages/Raids/SignedUpUsers.razor b/Lieb/Pages/Raids/SignedUpUsers.razor index e214518..9a4f573 100644 --- a/Lieb/Pages/Raids/SignedUpUsers.razor +++ b/Lieb/Pages/Raids/SignedUpUsers.razor @@ -7,15 +7,15 @@
Role
+ @if(@_expandableRoles.FirstOrDefault().IsRowExpanded) + { + + } + else + { + + } + Role + UsersFlex(@_raid.SignUps.Where(s => s.SignUpType == SignUpType.SignedUp).Count()/@_raid.Roles.Sum(r => r.Spots))
- @role.Name (@_raid.SignUps.Where(s => s.PlannedRaidRoleId == role.PlannedRaidRoleId && s.SignUpType == SignUpType.SignedUp).Count() / @role.Spots) -
@role.Description + @{ +
+ @if(@role.IsRowExpanded) + { + + } + else + { + + } + @role.Role.Name (@_raid.SignUps.Where(s => s.PlannedRaidRoleId == role.Role.PlannedRaidRoleId && s.SignUpType == SignUpType.SignedUp).Count() / @role.Role.Spots) + @if (@role.IsRowExpanded) + { +
@role.Role.Description + }
+ @{List signUpTypes =new List(){SignUpType.SignedUp, SignUpType.Maybe, SignUpType.Backup};} - + + + + +
@{RaidSignUp[] signUps = _raid.SignUps.Where(s => s.PlannedRaidRoleId == _currentRoleId).ToArray();} - @foreach (var signUp in signUps) + @foreach (var signUp in signUps.OrderBy(s => s.SignUpType)) { - @if(signUp.SignUpType != SignUpType.SignedOff) + @if(_signUpTypes.Contains(signUp.SignUpType)) { @{ bool isUser = signUp.LiebUserId == _liebUserId; string signUpStatus = string.Empty; - @if (signUp.SignUpType != SignUpType.SignedUp) signUpStatus = $" - {signUp.SignUpType}"; + @if (signUp.SignUpType != SignUpType.SignedUp && _signUpTypes.Count > 1) signUpStatus = $" - {signUp.SignUpType}"; } @if (isUser && _usableAccounts.Count > 1 && signUp.SignUpType != SignUpType.Flex) @@ -29,11 +29,24 @@ @signUpStatus } + else if(isUser) + { + + } else { } @@ -55,4 +68,10 @@ [Parameter] public int _currentRoleId { get; set; } + + [Parameter] + public List _signUpTypes { get; set; } + + [Parameter] + public bool _showToolTip { get; set; } = false; } diff --git a/Lieb/Pages/Raids/SignedUpUsers.razor.css b/Lieb/Pages/Raids/SignedUpUsers.razor.css index f2b4be0..e9227a8 100644 --- a/Lieb/Pages/Raids/SignedUpUsers.razor.css +++ b/Lieb/Pages/Raids/SignedUpUsers.razor.css @@ -1,4 +1,7 @@ - +.username { + color: lightgreen; +} + .nametooltip { position: relative; display: inline-block;
+ @signUp.GuildWars2Account.AccountName @signUpStatus + @if(_showToolTip) + { + @signUp.LiebUser.Name + } + @signUp.GuildWars2Account.AccountName @signUpStatus - @signUp.LiebUser.Name + @if(_showToolTip) + { + @signUp.LiebUser.Name + }