@{string navLink = $"raidedit/{_raid.RaidId}";}
@@ -168,6 +79,15 @@
[Parameter]
public LiebUser? _user { get; set; }
+ bool _isRaidSignUpAllowed;
+
+ string _errorMessage;
+
+ protected override async Task OnInitializedAsync()
+ {
+ _isRaidSignUpAllowed = _user != null && RaidService.IsRaidSignUpAllowed(_user.LiebUserId, _raid.RaidId, out string _errorMessage);
+ }
+
async Task SignUpClicked(PlannedRaidRole role, LiebUser liebUser, bool isSignedUp, SignUpType signUpType)
{
if(isSignedUp)
diff --git a/Lieb/Pages/Raids/RaidRolesNoSignUp.razor b/Lieb/Pages/Raids/RaidRolesNoSignUp.razor
new file mode 100644
index 0000000..e705299
--- /dev/null
+++ b/Lieb/Pages/Raids/RaidRolesNoSignUp.razor
@@ -0,0 +1,35 @@
+@using Lieb.Models.GuildWars2.Raid
+
+
+
+
+ @foreach (var role in _raid.Roles)
+ {
+ 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: @role.Description (@usedSpots /@role.Spots) |
+
+ @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
new file mode 100644
index 0000000..33eccca
--- /dev/null
+++ b/Lieb/Pages/Raids/RaidRolesNoSignUp.razor.css
@@ -0,0 +1,9 @@
+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
new file mode 100644
index 0000000..067a90b
--- /dev/null
+++ b/Lieb/Pages/Raids/RaidRolesPlanned.razor
@@ -0,0 +1,114 @@
+@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)
+ {
+ RaidSignUp[] signUps = _raid.SignUps.Where(s => s.PlannedRaidRoleId == role.PlannedRaidRoleId).ToArray();
+ int usedSpots = signUps.Where(s => s.SignUpType == SignUpType.SignedUp).Count();
+
+
+ @if (RaidService.IsRoleSignUpAllowed(_raid.RaidId, _user.LiebUserId, role.PlannedRaidRoleId, SignUpType.SignedUp, false))
+ {
+ |
+ |
+ }
+ else
+ {
+ |
+ |
+ }
+ |
+ @if (isSignedUp && userRole.SignUpType != SignUpType.SignedOff)
+ {
+ |
+ }
+ @role.Name: @role.Description (@usedSpots /@role.Spots) |
+
+
+ @foreach (var signUp in signUps)
+ {
+ @if(signUp.SignUpType != SignUpType.SignedOff)
+ {
+
+ @{bool isUser = isSignedUp && userRole.PlannedRaidRole.PlannedRaidRoleId == role.PlannedRaidRoleId && signUp.LiebUserId == _user.LiebUserId;}
+ |
+ |
+ @if (isSignedUp && userRole.SignUpType != SignUpType.SignedOff)
+ {
+ |
+ }
+ @if(isUser)
+ {
+ |
+ }
+ else
+ {
+ |
+ }
+ @{string signUpStatus = string.Empty;}
+ @if (signUp.SignUpType != SignUpType.SignedUp) signUpStatus = $" - {signUp.SignUpType}";
+
+ @if (isUser)
+ {
+ @signUp.LiebUser.Name
+ @signUpStatus |
+ }
+ else
+ {
+ @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 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());
+ await RaidService.ChangeAccount(_raid.RaidId, liebUser.LiebUserId, accountId);
+ _raid = RaidService.GetRaid(_raid.RaidId);
+ }
+}
diff --git a/Lieb/Pages/Raids/RaidRolesPlanned.razor.css b/Lieb/Pages/Raids/RaidRolesPlanned.razor.css
new file mode 100644
index 0000000..67347ff
--- /dev/null
+++ b/Lieb/Pages/Raids/RaidRolesPlanned.razor.css
@@ -0,0 +1,19 @@
+
+h5 {
+ color: lightgrey;
+}
+
+table {
+ column-width: auto;
+ color: lightgray;
+/* border-top: none;
+ border-bottom: none;*/
+}
+
+/*.roleTable table tr:not(:first-child) > td {
+ border-top: none;
+}
+
+.roleTable table tr:not(:last-child) > td {
+ border-bottom: none;
+}*/
\ No newline at end of file