reworked RaidDetails Layout
This commit is contained in:
parent
2e92bdee5f
commit
e22eea7fca
9 changed files with 92 additions and 142 deletions
|
@ -210,12 +210,18 @@ namespace Lieb.Data
|
|||
}
|
||||
}
|
||||
|
||||
public async Task SignOff(int raidId, int liebUserId, int plannedRoleId)
|
||||
public async Task SignOff(int raidId, int liebUserId)
|
||||
{
|
||||
await ChangeSignUpType(raidId, liebUserId, plannedRoleId, SignUpType.SignedOff);
|
||||
using var context = _contextFactory.CreateDbContext();
|
||||
List<RaidSignUp> signUps = context.RaidSignUps.Where(x => x.RaidId == raidId && x.LiebUserId == liebUserId && x.SignUpType == SignUpType.Flex).ToList();
|
||||
context.RaidSignUps.RemoveRange(signUps);
|
||||
|
||||
RaidSignUp? signUp = context.RaidSignUps.FirstOrDefault(x => x.RaidId == raidId && x.LiebUserId == liebUserId && x.SignUpType != SignUpType.Flex);
|
||||
if (signUp != null)
|
||||
{
|
||||
signUp.SignUpType = SignUpType.SignedOff;
|
||||
}
|
||||
|
||||
await context.SaveChangesAsync();
|
||||
}
|
||||
|
||||
|
|
|
@ -59,6 +59,7 @@
|
|||
|
||||
|
||||
<AuthorizeView Policy="@Constants.Roles.RaidLead">
|
||||
<td><button @onclick="() => SignOffClicked()">Sign Off</button></td>
|
||||
<div class="nav-item px-3">
|
||||
@{string navLink = $"raidedit/{_raid.RaidId}";}
|
||||
<NavLink class="nav-link" href="@navLink">
|
||||
|
@ -96,22 +97,9 @@
|
|||
_freeForAllTime = await TimeZoneService.GetLocalDateTime(_raid.FreeForAllTimeUTC);
|
||||
}
|
||||
|
||||
async Task SignUpClicked(PlannedRaidRole role, LiebUser liebUser, bool isSignedUp, SignUpType signUpType)
|
||||
async Task SignOffClicked()
|
||||
{
|
||||
if(isSignedUp)
|
||||
{
|
||||
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 SignOffClicked(PlannedRaidRole role, LiebUser liebUser)
|
||||
{
|
||||
await RaidService.SignOff(_raid.RaidId, liebUser.LiebUserId, role.PlannedRaidRoleId);
|
||||
await RaidService.SignOff(_raid.RaidId, _user.LiebUserId);
|
||||
_raid = RaidService.GetRaid(_raid.RaidId);
|
||||
}
|
||||
|
||||
|
@ -120,11 +108,4 @@
|
|||
await RaidRandomizerService.RandomizeRaid(_raid.RaidId);
|
||||
_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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
background-color: rgb(38 38 38);
|
||||
border-radius: 25px;
|
||||
padding: 25px;
|
||||
width: 700px;
|
||||
width: 900px;
|
||||
/*width: fit-content;*/
|
||||
color: lightgray;
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ h5 {
|
|||
.details {
|
||||
float: left;
|
||||
display: inline;
|
||||
width: 150px;
|
||||
width: 33%;
|
||||
padding-top: 15px;
|
||||
}
|
||||
|
||||
|
|
|
@ -9,19 +9,21 @@
|
|||
int usedSpots = signUps.Where(s => s.SignUpType == SignUpType.SignedUp).Count();
|
||||
|
||||
<tr>
|
||||
<td><h5>@role.Name: @role.Description (@usedSpots /@role.Spots)</h5></td>
|
||||
<td><b>@role.Name</b> (@usedSpots /@role.Spots) <br> @role.Description </td>
|
||||
<td>
|
||||
@foreach (var signUp in signUps)
|
||||
{
|
||||
if(signUp.SignUpType != SignUpType.SignedOff)
|
||||
{
|
||||
string signUpStatus = string.Empty;
|
||||
if (signUp.SignUpType != SignUpType.SignedUp) signUpStatus = $" - {signUp.SignUpType}";
|
||||
<tr>
|
||||
<td>@signUp.LiebUser.Name (@signUp.GuildWars2Account.AccountName) @signUpStatus</td>
|
||||
</tr>
|
||||
}
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
@foreach (var signUp in signUps)
|
||||
{
|
||||
if(signUp.SignUpType != SignUpType.SignedOff)
|
||||
{
|
||||
string signUpStatus = string.Empty;
|
||||
if (signUp.SignUpType != SignUpType.SignedUp) signUpStatus = $" - {signUp.SignUpType}";
|
||||
<tr>
|
||||
<td>@signUp.LiebUser.Name (@signUp.GuildWars2Account.AccountName) @signUpStatus</td>
|
||||
</tr>
|
||||
}
|
||||
}
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
|
@ -15,6 +15,36 @@
|
|||
int usedSpots = signUps.Where(s => s.SignUpType == SignUpType.SignedUp).Count();
|
||||
|
||||
<tr>
|
||||
<td><b>@role.Name</b> (@usedSpots /@role.Spots) <br> @role.Description </td>
|
||||
<td>
|
||||
@foreach (var signUp in signUps)
|
||||
{
|
||||
@if(signUp.SignUpType != SignUpType.SignedOff)
|
||||
{
|
||||
<tr>
|
||||
@{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)
|
||||
{
|
||||
<td>@signUp.LiebUser.Name
|
||||
<select value=@signUp.GuildWars2AccountId @onchange="args => ChangeAccount(_user, args)">
|
||||
@foreach (var account in _user.GuildWars2Accounts)
|
||||
{
|
||||
<option value=@account.GuildWars2AccountId>@account.AccountName</option>
|
||||
}
|
||||
</select> @signUpStatus </td>
|
||||
}
|
||||
else
|
||||
{
|
||||
<td>@signUp.LiebUser.Name (@signUp.GuildWars2Account.AccountName) @signUpStatus</td>
|
||||
}
|
||||
</tr>
|
||||
}
|
||||
}
|
||||
|
||||
</td>
|
||||
@if (RaidService.IsRoleSignUpAllowed(_raid.RaidId, _user.LiebUserId, role.PlannedRaidRoleId, SignUpType.SignedUp, false))
|
||||
{
|
||||
<td><button @onclick="() => SignUpClicked(role, _user, isSignedUp, SignUpType.SignedUp)">Sign Up</button></td>
|
||||
|
@ -30,49 +60,7 @@
|
|||
{
|
||||
<td><button @onclick="() => SignUpClicked(role, _user, isSignedUp, SignUpType.Flex)">Flex</button></td>
|
||||
}
|
||||
<td><h5>@role.Name: @role.Description (@usedSpots /@role.Spots)</h5></td>
|
||||
</tr>
|
||||
|
||||
@foreach (var signUp in signUps)
|
||||
{
|
||||
@if(signUp.SignUpType != SignUpType.SignedOff)
|
||||
{
|
||||
<tr>
|
||||
@{bool isUser = isSignedUp && userRole.PlannedRaidRole.PlannedRaidRoleId == role.PlannedRaidRoleId && signUp.LiebUserId == _user.LiebUserId;}
|
||||
<td></td>
|
||||
<td></td>
|
||||
@if (isSignedUp && userRole.SignUpType != SignUpType.SignedOff)
|
||||
{
|
||||
<td></td>
|
||||
}
|
||||
@if(isUser)
|
||||
{
|
||||
<td><button @onclick="() => SignOffClicked(role, _user)">Sign Off</button></td>
|
||||
}
|
||||
else
|
||||
{
|
||||
<td></td>
|
||||
}
|
||||
@{string signUpStatus = string.Empty;}
|
||||
@if (signUp.SignUpType != SignUpType.SignedUp) signUpStatus = $" - {signUp.SignUpType}";
|
||||
|
||||
@if (isUser && _user.GuildWars2Accounts.Count > 1)
|
||||
{
|
||||
<td>@signUp.LiebUser.Name
|
||||
<select value=@signUp.GuildWars2AccountId @onchange="args => ChangeAccount(_user, args)">
|
||||
@foreach (var account in _user.GuildWars2Accounts)
|
||||
{
|
||||
<option value=@account.GuildWars2AccountId>@account.AccountName</option>
|
||||
}
|
||||
</select> @signUpStatus </td>
|
||||
}
|
||||
else
|
||||
{
|
||||
<td>@signUp.LiebUser.Name (@signUp.GuildWars2Account.AccountName) @signUpStatus</td>
|
||||
}
|
||||
</tr>
|
||||
}
|
||||
}
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
|
@ -99,12 +87,6 @@
|
|||
_raid = RaidService.GetRaid(_raid.RaidId);
|
||||
}
|
||||
|
||||
async Task SignOffClicked(PlannedRaidRole role, LiebUser liebUser)
|
||||
{
|
||||
await RaidService.SignOff(_raid.RaidId, liebUser.LiebUserId, role.PlannedRaidRoleId);
|
||||
_raid = RaidService.GetRaid(_raid.RaidId);
|
||||
}
|
||||
|
||||
async Task ChangeAccount(LiebUser liebUser, ChangeEventArgs e)
|
||||
{
|
||||
int accountId = int.Parse(e.Value.ToString());
|
||||
|
|
|
@ -16,57 +16,42 @@
|
|||
int usedSpots = signUps.Where(s => s.SignUpType == SignUpType.SignedUp).Count();
|
||||
|
||||
<tr>
|
||||
@if (role.IsRandomSignUpRole && _raid.SignUps.Where(s => s.SignUpType == SignUpType.SignedUp).Count() < 10)
|
||||
<td> <b>@role.Name</b> (@usedSpots /@role.Spots) <br> @role.Description </td>
|
||||
<td>
|
||||
@foreach (var signUp in signUps)
|
||||
{
|
||||
@if(signUp.SignUpType != SignUpType.SignedOff)
|
||||
{
|
||||
<tr>
|
||||
@{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 && _usableAccounts.Count > 1)
|
||||
{
|
||||
<td>@signUp.LiebUser.Name
|
||||
<select value=@signUp.GuildWars2AccountId @onchange="args => ChangeAccount(_user, args)">
|
||||
@foreach (var account in _usableAccounts)
|
||||
{
|
||||
<option value=@account.GuildWars2AccountId>@account.AccountName</option>
|
||||
}
|
||||
</select> @signUpStatus </td>
|
||||
}
|
||||
else
|
||||
{
|
||||
<td>@signUp.LiebUser.Name (@signUp.GuildWars2Account.AccountName) @signUpStatus</td>
|
||||
}
|
||||
</tr>
|
||||
}
|
||||
}
|
||||
</td>
|
||||
@if (role.IsRandomSignUpRole && _raid.SignUps.Where(s => s.SignUpType == SignUpType.SignedUp).Count() < role.Spots)
|
||||
{
|
||||
<td><button @onclick="() => SignUpClicked(role, _user, isSignedUp, SignUpType.SignedUp)">Sign Up</button></td>
|
||||
<td><button @onclick="() => SignUpClicked(role, _user, isSignedUp, SignUpType.Maybe)">Maybe</button></td>
|
||||
<td><button @onclick="() => SignUpClicked(role, _user, isSignedUp, SignUpType.Backup)">Backup</button></td>
|
||||
}
|
||||
else
|
||||
{
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
}
|
||||
<td><h5>@role.Name: @role.Description (@usedSpots /@role.Spots)</h5></td>
|
||||
</tr>
|
||||
|
||||
@foreach (var signUp in signUps)
|
||||
{
|
||||
@if(signUp.SignUpType != SignUpType.SignedOff)
|
||||
{
|
||||
<tr>
|
||||
@{bool isUser = isSignedUp && userRole.PlannedRaidRole.PlannedRaidRoleId == role.PlannedRaidRoleId && signUp.LiebUserId == _user.LiebUserId;}
|
||||
<td></td>
|
||||
<td></td>
|
||||
@if(isUser)
|
||||
{
|
||||
<td><button @onclick="() => SignOffClicked(role, _user)">Sign Off</button></td>
|
||||
}
|
||||
else
|
||||
{
|
||||
<td></td>
|
||||
}
|
||||
@{string signUpStatus = string.Empty;}
|
||||
@if (signUp.SignUpType != SignUpType.SignedUp) signUpStatus = $" - {signUp.SignUpType}";
|
||||
|
||||
@if (isUser && _usableAccounts.Count > 1)
|
||||
{
|
||||
<td>@signUp.LiebUser.Name
|
||||
<select value=@signUp.GuildWars2AccountId @onchange="args => ChangeAccount(_user, args)">
|
||||
@foreach (var account in _usableAccounts)
|
||||
{
|
||||
<option value=@account.GuildWars2AccountId>@account.AccountName</option>
|
||||
}
|
||||
</select> @signUpStatus </td>
|
||||
}
|
||||
else
|
||||
{
|
||||
<td>@signUp.LiebUser.Name (@signUp.GuildWars2Account.AccountName) @signUpStatus</td>
|
||||
}
|
||||
</tr>
|
||||
}
|
||||
}
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
|
@ -100,12 +85,6 @@
|
|||
_raid = RaidService.GetRaid(_raid.RaidId);
|
||||
}
|
||||
|
||||
async Task SignOffClicked(PlannedRaidRole role, LiebUser liebUser)
|
||||
{
|
||||
await RaidService.SignOff(_raid.RaidId, liebUser.LiebUserId, role.PlannedRaidRoleId);
|
||||
_raid = RaidService.GetRaid(_raid.RaidId);
|
||||
}
|
||||
|
||||
async Task ChangeAccount(LiebUser liebUser, ChangeEventArgs e)
|
||||
{
|
||||
int accountId = int.Parse(e.Value.ToString());
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
@foreach (var role in _template.Roles.OrderBy(r => r.PlannedRaidRoleId))
|
||||
{
|
||||
<tr>
|
||||
<td><h5>@role.Name: @role.Description (@role.Spots)</h5></td>
|
||||
<td><Label> <b>@role.Name</b> (@role.Spots) <br> @role.Description </Label></td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
|
|
|
@ -22,7 +22,7 @@ h5 {
|
|||
.details {
|
||||
float: left;
|
||||
display: inline;
|
||||
width: 150px;
|
||||
width: 33%;
|
||||
padding-top: 15px;
|
||||
}
|
||||
|
||||
|
|
|
@ -52,10 +52,10 @@
|
|||
}
|
||||
</select>
|
||||
</label>
|
||||
<table>
|
||||
<table id="classTable">
|
||||
<tr>
|
||||
<th>Equipped</th>
|
||||
<th>can Tank</th>
|
||||
<th>Tank</th>
|
||||
<th>Build</th>
|
||||
<th>Class</th>
|
||||
<th>Elite</th>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue