@using Lieb.Data @using Lieb.Models @using Lieb.Models.GuildWars2 @using Lieb.Models.GuildWars2.Raid @inject RaidService RaidService @{ bool isSignedUp = _raid.SignUps.Where(s => s.LiebUserId == _liebUserId && s.SignUpType != SignUpType.SignedOff).Any(); } @foreach (PlannedRaidRole role in _raid.Roles.OrderBy(r => r.PlannedRaidRoleId)) { @if(_liebUserId > 0) { bool notIsRoleSignUpAllowed = !RaidService.IsRoleSignUpAllowed(_raid.RaidId, _liebUserId, role.PlannedRaidRoleId, SignUpType.SignedUp, false); bool notIsBackupAllowed = _raid.RaidType != RaidType.Planned && notIsRoleSignUpAllowed; @if (isSignedUp && _raid.RaidType == RaidType.Planned) { } } }
Role Users (@_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
@code { [Parameter] public Raid _raid { get; set; } [Parameter] public LiebUser? _user { get; set; } private int _liebUserId { get; set; } = -1; private List _usableAccounts; protected override async Task OnParametersSetAsync() { if (_user != null) { _usableAccounts = _user.GuildWars2Accounts.Where(a => a.EquippedBuilds.Count > 0).ToList(); _liebUserId = _user.LiebUserId; } } 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); } else { await RaidService.SignUp(_raid.RaidId, _liebUserId, _usableAccounts.FirstOrDefault().GuildWars2AccountId, role.PlannedRaidRoleId, signUpType); } _raid = RaidService.GetRaid(_raid.RaidId); } }