Renamed RaidRole and RaidSignUpHistory
This commit is contained in:
parent
2bf630f3a1
commit
bae69648d0
15 changed files with 144 additions and 121 deletions
|
@ -126,9 +126,9 @@
|
|||
<th>Role name</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
@foreach( PlannedRaidRole role in _raid.Roles)
|
||||
@foreach( RaidRole role in _raid.Roles)
|
||||
{
|
||||
bool disableEdit = _raid.SignUps.Where(s => s.PlannedRaidRoleId == role.PlannedRaidRoleId).Any();
|
||||
bool disableEdit = _raid.SignUps.Where(s => s.PlannedRaidRoleId == role.RaidRoleId).Any();
|
||||
<tr>
|
||||
<td><InputNumber @bind-Value="role.Spots" disabled="@disableEdit" /></td>
|
||||
<td><InputText @bind-Value="role.Name" disabled="@disableEdit" /></td>
|
||||
|
@ -167,7 +167,7 @@
|
|||
private DateTimeOffset _freeForAllDate = DateTime.Now.Date;
|
||||
private DateTimeOffset _freeForAllTime;
|
||||
|
||||
private List<PlannedRaidRole> _rolesToDelete = new List<PlannedRaidRole>();
|
||||
private List<RaidRole> _rolesToDelete = new List<RaidRole>();
|
||||
|
||||
|
||||
|
||||
|
@ -210,13 +210,13 @@
|
|||
|
||||
async Task AddRoleClicked()
|
||||
{
|
||||
_raid.Roles.Add(new PlannedRaidRole());
|
||||
_raid.Roles.Add(new RaidRole());
|
||||
}
|
||||
|
||||
|
||||
async Task DeleteRoleClicked(PlannedRaidRole role)
|
||||
async Task DeleteRoleClicked(RaidRole role)
|
||||
{
|
||||
if(role.PlannedRaidRoleId != 0)
|
||||
if(role.RaidRoleId != 0)
|
||||
{
|
||||
_rolesToDelete.Add(role);
|
||||
}
|
||||
|
@ -237,17 +237,21 @@
|
|||
{
|
||||
if(_raid.RaidType != RaidType.Planned)
|
||||
{
|
||||
PlannedRaidRole? role = _raid.Roles.FirstOrDefault(r => r.IsRandomSignUpRole);
|
||||
int randomRoleId = role != null ? role.PlannedRaidRoleId : 0;
|
||||
_raid.Roles.Clear();
|
||||
_raid.Roles.Add(new PlannedRaidRole()
|
||||
if(!_raid.Roles.Where(r => r.IsRandomSignUpRole).Any())
|
||||
{
|
||||
_raid.Roles.Add(new RaidRole()
|
||||
{
|
||||
Spots = 10,
|
||||
Name = "Random",
|
||||
Description = _raid.RaidType.ToString(),
|
||||
IsRandomSignUpRole = true,
|
||||
PlannedRaidRoleId = randomRoleId
|
||||
IsRandomSignUpRole = true
|
||||
});
|
||||
}
|
||||
|
||||
foreach(RaidRole role in _raid.Roles.Where(r => !r.IsRandomSignUpRole))
|
||||
{
|
||||
_rolesToDelete.Add(role);
|
||||
}
|
||||
}
|
||||
|
||||
if(_raid.Roles.Count == 0)
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
@{
|
||||
bool isSignedUp = _raid.SignUps.Where(s => s.LiebUserId == _liebUserId && s.SignUpType != SignUpType.SignedOff).Any();
|
||||
}
|
||||
@foreach (ExpandableRole role in _expandableRoles.OrderBy(r => r.Role.PlannedRaidRoleId))
|
||||
@foreach (ExpandableRole role in _expandableRoles.OrderBy(r => r.Role.RaidRoleId))
|
||||
{
|
||||
<tr>
|
||||
@{
|
||||
|
@ -46,7 +46,7 @@
|
|||
{
|
||||
<span class="oi oi-chevron-bottom" style="margin-right:7px"> </span>
|
||||
}
|
||||
<b>@role.Role.Name</b> (@_raid.SignUps.Where(s => s.PlannedRaidRoleId == role.Role.PlannedRaidRoleId && s.SignUpType == SignUpType.SignedUp).Count() / @role.Role.Spots)
|
||||
<b>@role.Role.Name</b> (@_raid.SignUps.Where(s => s.PlannedRaidRoleId == role.Role.RaidRoleId && s.SignUpType == SignUpType.SignedUp).Count() / @role.Role.Spots)
|
||||
@if (@role.IsRowExpanded)
|
||||
{
|
||||
<br> @role.Role.Description
|
||||
|
@ -56,7 +56,7 @@
|
|||
<td class="tdSignUp">
|
||||
@{List<SignUpType> signUpTypes =new List<SignUpType>(){SignUpType.SignedUp, SignUpType.Maybe, SignUpType.Backup};}
|
||||
<CascadingValue Value="this">
|
||||
<SignedUpUsers _raid=@_raid _usableAccounts=@_usableAccounts _liebUserId=@_liebUserId _currentRoleId=@role.Role.PlannedRaidRoleId _signUpTypes=@signUpTypes _showToolTip=@true _showUserColor=@true></SignedUpUsers>
|
||||
<SignedUpUsers _raid=@_raid _usableAccounts=@_usableAccounts _liebUserId=@_liebUserId _currentRoleId=@role.Role.RaidRoleId _signUpTypes=@signUpTypes _showToolTip=@true _showUserColor=@true></SignedUpUsers>
|
||||
</CascadingValue>
|
||||
</td>
|
||||
@if (flexExists)
|
||||
|
@ -64,13 +64,13 @@
|
|||
List<SignUpType> flexSignUpTypes =new List<SignUpType>(){SignUpType.Flex};
|
||||
<td class="tdSignUp">
|
||||
<CascadingValue Value="this">
|
||||
<SignedUpUsers _raid=@_raid _usableAccounts=@_usableAccounts _liebUserId=@_liebUserId _currentRoleId=@role.Role.PlannedRaidRoleId _signUpTypes=@flexSignUpTypes></SignedUpUsers>
|
||||
<SignedUpUsers _raid=@_raid _usableAccounts=@_usableAccounts _liebUserId=@_liebUserId _currentRoleId=@role.Role.RaidRoleId _signUpTypes=@flexSignUpTypes></SignedUpUsers>
|
||||
</CascadingValue>
|
||||
</td>
|
||||
}
|
||||
@if(_liebUserId > 0 && _isRaidSignUpAllowed)
|
||||
{
|
||||
bool notIsRoleSignUpAllowed = !RaidService.IsRoleSignUpAllowed(_raid.RaidId, _liebUserId, role.Role.PlannedRaidRoleId, SignUpType.SignedUp, false);
|
||||
bool notIsRoleSignUpAllowed = !RaidService.IsRoleSignUpAllowed(_raid.RaidId, _liebUserId, role.Role.RaidRoleId, SignUpType.SignedUp, false);
|
||||
bool notIsBackupAllowed = _raid.RaidType != RaidType.Planned && notIsRoleSignUpAllowed;
|
||||
<td><button class="raidButton" @onclick="() => SignUpClicked(role.Role, SignUpType.SignedUp)" disabled="@notIsRoleSignUpAllowed">Sign Up</button></td>
|
||||
<td><button class="raidButton" @onclick="() => SignUpClicked(role.Role, SignUpType.Maybe)" disabled="@notIsRoleSignUpAllowed">Maybe</button></td>
|
||||
|
@ -109,7 +109,7 @@
|
|||
|
||||
private class ExpandableRole
|
||||
{
|
||||
public PlannedRaidRole Role;
|
||||
public RaidRole Role;
|
||||
public bool IsRowExpanded = false;
|
||||
}
|
||||
|
||||
|
@ -128,7 +128,7 @@
|
|||
_liebUserId = _user.LiebUserId;
|
||||
}
|
||||
_expandableRoles = new List<ExpandableRole>();
|
||||
foreach(PlannedRaidRole role in _raid.Roles)
|
||||
foreach(RaidRole role in _raid.Roles)
|
||||
{
|
||||
_expandableRoles.Add(new ExpandableRole()
|
||||
{
|
||||
|
@ -137,15 +137,15 @@
|
|||
}
|
||||
}
|
||||
|
||||
async Task SignUpClicked(PlannedRaidRole role, SignUpType signUpType)
|
||||
async Task SignUpClicked(RaidRole role, SignUpType signUpType)
|
||||
{
|
||||
if(_raid.SignUps.Where(s => s.LiebUserId == _liebUserId).Any() && signUpType != SignUpType.Flex)
|
||||
{
|
||||
RaidService.ChangeSignUpType(_raid.RaidId, _liebUserId, role.PlannedRaidRoleId, signUpType);
|
||||
RaidService.ChangeSignUpType(_raid.RaidId, _liebUserId, role.RaidRoleId, signUpType);
|
||||
}
|
||||
else
|
||||
{
|
||||
await RaidService.SignUp(_raid.RaidId, _liebUserId, _usableAccounts.FirstOrDefault().GuildWars2AccountId, role.PlannedRaidRoleId, signUpType);
|
||||
await RaidService.SignUp(_raid.RaidId, _liebUserId, _usableAccounts.FirstOrDefault().GuildWars2AccountId, role.RaidRoleId, signUpType);
|
||||
}
|
||||
_Parent.HasChanged();
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
<div>
|
||||
<table class="table">
|
||||
<tbody>
|
||||
@foreach (var role in _template.Roles.OrderBy(r => r.PlannedRaidRoleId))
|
||||
@foreach (var role in _template.Roles.OrderBy(r => r.RaidRoleId))
|
||||
{
|
||||
<tr>
|
||||
<td><Label> <b>@role.Name</b> (@role.Spots) <br> @role.Description </Label></td>
|
||||
|
|
|
@ -151,7 +151,7 @@
|
|||
<th>Role name</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
@foreach( PlannedRaidRole role in _template.Roles)
|
||||
@foreach( RaidRole role in _template.Roles)
|
||||
{
|
||||
<tr>
|
||||
<td><InputNumber @bind-Value="role.Spots" /></td>
|
||||
|
@ -190,7 +190,7 @@
|
|||
private DateTimeOffset _freeForAllTime;
|
||||
private string _userTimeZone = string.Empty;
|
||||
|
||||
private List<PlannedRaidRole> _rolesToDelete = new List<PlannedRaidRole>();
|
||||
private List<RaidRole> _rolesToDelete = new List<RaidRole>();
|
||||
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
|
@ -233,13 +233,13 @@
|
|||
|
||||
async Task AddRoleClicked()
|
||||
{
|
||||
_template.Roles.Add(new PlannedRaidRole());
|
||||
_template.Roles.Add(new RaidRole());
|
||||
}
|
||||
|
||||
|
||||
async Task DeleteRoleClicked(PlannedRaidRole role)
|
||||
async Task DeleteRoleClicked(RaidRole role)
|
||||
{
|
||||
if(role.PlannedRaidRoleId != 0)
|
||||
if(role.RaidRoleId != 0)
|
||||
{
|
||||
_rolesToDelete.Add(role);
|
||||
}
|
||||
|
@ -261,7 +261,7 @@
|
|||
if(_template.RaidType != RaidType.Planned)
|
||||
{
|
||||
_template.Roles.Clear();
|
||||
_template.Roles.Add(new PlannedRaidRole()
|
||||
_template.Roles.Add(new RaidRole()
|
||||
{
|
||||
Spots = 10,
|
||||
Name = "Random",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue