From bca069db78b31b6c9ecf5905465da45db7d73b91 Mon Sep 17 00:00:00 2001 From: "t.ruspekhofer" Date: Tue, 15 Mar 2022 22:24:42 +0100 Subject: [PATCH] Changed Formatting, Added SignedUpUSers.razor to split up RaidRoles.razor --- Lieb/Pages/Raids/RaidDetails.razor | 10 +-- Lieb/Pages/Raids/RaidDetails.razor.css | 6 +- Lieb/Pages/Raids/RaidEdit.razor | 2 +- Lieb/Pages/Raids/RaidEdit.razor.css | 2 + Lieb/Pages/Raids/RaidRoles.razor | 69 +++++-------------- Lieb/Pages/Raids/RaidRoles.razor.css | 21 ++++++ Lieb/Pages/Raids/SignedUpUsers.razor | 60 ++++++++++++++++ Lieb/Pages/User/ManageGuildWars2Account.razor | 4 +- 8 files changed, 111 insertions(+), 63 deletions(-) create mode 100644 Lieb/Pages/Raids/RaidEdit.razor.css create mode 100644 Lieb/Pages/Raids/SignedUpUsers.razor diff --git a/Lieb/Pages/Raids/RaidDetails.razor b/Lieb/Pages/Raids/RaidDetails.razor index ebd078f..e0f1513 100644 --- a/Lieb/Pages/Raids/RaidDetails.razor +++ b/Lieb/Pages/Raids/RaidDetails.razor @@ -14,7 +14,7 @@
@_raid.Title
-
@_raid.Description
+
@@ -44,13 +44,13 @@ -
- +
+ - + @if(_raid.RaidType != RaidType.Planned) { - + }
diff --git a/Lieb/Pages/Raids/RaidDetails.razor.css b/Lieb/Pages/Raids/RaidDetails.razor.css index b288231..a2ddf23 100644 --- a/Lieb/Pages/Raids/RaidDetails.razor.css +++ b/Lieb/Pages/Raids/RaidDetails.razor.css @@ -2,8 +2,8 @@ background-color: rgb(38 38 38); border-radius: 25px; padding: 25px; - width: 900px; - /*width: fit-content;*/ + /*width: 900px;*/ + width: stretch; color: lightgray; } @@ -27,7 +27,7 @@ h5 { } -.controlButtons { +.controlButton { margin-right: 10px; } diff --git a/Lieb/Pages/Raids/RaidEdit.razor b/Lieb/Pages/Raids/RaidEdit.razor index 3968704..502aaaa 100644 --- a/Lieb/Pages/Raids/RaidEdit.razor +++ b/Lieb/Pages/Raids/RaidEdit.razor @@ -28,7 +28,7 @@

diff --git a/Lieb/Pages/Raids/RaidEdit.razor.css b/Lieb/Pages/Raids/RaidEdit.razor.css new file mode 100644 index 0000000..46800d1 --- /dev/null +++ b/Lieb/Pages/Raids/RaidEdit.razor.css @@ -0,0 +1,2 @@ +body { +} diff --git a/Lieb/Pages/Raids/RaidRoles.razor b/Lieb/Pages/Raids/RaidRoles.razor index d0502cd..39bcb0b 100644 --- a/Lieb/Pages/Raids/RaidRoles.razor +++ b/Lieb/Pages/Raids/RaidRoles.razor @@ -14,56 +14,28 @@ @{ - RaidSignUp userRole = _raid.SignUps.Where(s => s.LiebUserId == _liebUserId).FirstOrDefault(); - bool isSignedUp = userRole != null; + bool isSignedUp = _raid.SignUps.Where(s => s.LiebUserId == _liebUserId && s.SignUpType != SignUpType.SignedOff).Any(); } @foreach (PlannedRaidRole role in _raid.Roles.OrderBy(r => r.PlannedRaidRoleId)) { - RaidSignUp[] signUps = _raid.SignUps.Where(s => s.PlannedRaidRoleId == role.PlannedRaidRoleId).ToArray(); - int usedSpots = signUps.Where(s => s.SignUpType == SignUpType.SignedUp).Count(); - - @role.Name (@usedSpots / @role.Spots)
@role.Description - - - @foreach (var signUp in signUps) - { - @if(signUp.SignUpType != SignUpType.SignedOff) - { - - @{bool isUser = isSignedUp && userRole.PlannedRaidRole.PlannedRaidRoleId == role.PlannedRaidRoleId && signUp.LiebUserId == _liebUserId;} - @{string signUpStatus = string.Empty;} - @if (signUp.SignUpType != SignUpType.SignedUp) signUpStatus = $" - {signUp.SignUpType}"; - - @if (isUser && _usableAccounts.Count > 1) - { - - } - else - { - - } - - } - } -
@signUp.LiebUser.Name - @signUpStatus @signUp.LiebUser.Name (@signUp.GuildWars2Account.AccountName) @signUpStatus
+ + @role.Name (@_raid.SignUps.Where(s => s.PlannedRaidRoleId == role.PlannedRaidRoleId && s.SignUpType == SignUpType.SignedUp).Count() / @role.Spots) +
@role.Description + + + @if(_liebUserId > 0) { - bool notIsRoleSignUpAllowed = !RaidService.IsRoleSignUpAllowed(_raid.RaidId, _user.LiebUserId, role.PlannedRaidRoleId, SignUpType.SignedUp, false); + bool notIsRoleSignUpAllowed = !RaidService.IsRoleSignUpAllowed(_raid.RaidId, _liebUserId, role.PlannedRaidRoleId, SignUpType.SignedUp, false); bool notIsBackupAllowed = _raid.RaidType != RaidType.Planned && notIsRoleSignUpAllowed; - - - - @if (isSignedUp && userRole.SignUpType != SignUpType.SignedOff && _raid.RaidType == RaidType.Planned) + + + + @if (isSignedUp && _raid.RaidType == RaidType.Planned) { - + } } @@ -93,23 +65,16 @@ } } - async Task SignUpClicked(PlannedRaidRole role, LiebUser liebUser, bool isSignedUp, SignUpType signUpType) + async Task SignUpClicked(PlannedRaidRole role, SignUpType signUpType) { - if(isSignedUp && signUpType != SignUpType.Flex) + if(_raid.SignUps.Where(s => s.LiebUserId == _liebUserId).Any() && signUpType != SignUpType.Flex) { - await RaidService.ChangeSignUpType(_raid.RaidId, liebUser.LiebUserId, role.PlannedRaidRoleId, signUpType); + await RaidService.ChangeSignUpType(_raid.RaidId, _liebUserId, role.PlannedRaidRoleId, signUpType); } else { - await RaidService.SignUp(_raid.RaidId, liebUser.LiebUserId, _usableAccounts.FirstOrDefault().GuildWars2AccountId, role.PlannedRaidRoleId, signUpType); + await RaidService.SignUp(_raid.RaidId, _liebUserId, _usableAccounts.FirstOrDefault().GuildWars2AccountId, role.PlannedRaidRoleId, signUpType); } _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/RaidRoles.razor.css b/Lieb/Pages/Raids/RaidRoles.razor.css index 67347ff..d46b8f3 100644 --- a/Lieb/Pages/Raids/RaidRoles.razor.css +++ b/Lieb/Pages/Raids/RaidRoles.razor.css @@ -6,10 +6,31 @@ h5 { table { column-width: auto; color: lightgray; + width: fit-content; /* border-top: none; border-bottom: none;*/ } +button { + width: max-content; +} + +.signUpButton{ + width: 30px; +} + +.tdSignUp { + max-width: 400px; + width: fit-content; +} + + +.tdRole { + max-width: 500px; + width: fit-content; +} + + /*.roleTable table tr:not(:first-child) > td { border-top: none; } diff --git a/Lieb/Pages/Raids/SignedUpUsers.razor b/Lieb/Pages/Raids/SignedUpUsers.razor new file mode 100644 index 0000000..509a5cc --- /dev/null +++ b/Lieb/Pages/Raids/SignedUpUsers.razor @@ -0,0 +1,60 @@ +@using Lieb.Data +@using Lieb.Models +@using Lieb.Models.GuildWars2 +@using Lieb.Models.GuildWars2.Raid +@inject RaidService RaidService + + + + @{RaidSignUp[] signUps = _raid.SignUps.Where(s => s.PlannedRaidRoleId == _currentRoleId).ToArray();} + @foreach (var signUp in signUps) + { + @if(signUp.SignUpType != SignUpType.SignedOff) + { + + @{ + bool isUser = signUp.LiebUserId == _liebUserId; + string signUpStatus = string.Empty; + @if (signUp.SignUpType != SignUpType.SignedUp) signUpStatus = $" - {signUp.SignUpType}"; + } + + @if (isUser && _usableAccounts.Count > 1) + { + + } + else + { + + } + + } + } +
@signUp.LiebUser.Name + @signUpStatus @signUp.LiebUser.Name (@signUp.GuildWars2Account.AccountName) @signUpStatus
+@code { + + [Parameter] + public Raid _raid { get; set; } + + [Parameter] + public int _liebUserId { get; set; } = -1; + + [Parameter] + public List _usableAccounts { get; set; } + + [Parameter] + public int _currentRoleId { get; set; } + + + async Task ChangeAccount(ChangeEventArgs e) + { + int accountId = int.Parse(e.Value.ToString()); + await RaidService.ChangeAccount(_raid.RaidId, _liebUserId, accountId); + _raid = RaidService.GetRaid(_raid.RaidId); + } +} diff --git a/Lieb/Pages/User/ManageGuildWars2Account.razor b/Lieb/Pages/User/ManageGuildWars2Account.razor index 6cafd42..d77656c 100644 --- a/Lieb/Pages/User/ManageGuildWars2Account.razor +++ b/Lieb/Pages/User/ManageGuildWars2Account.razor @@ -75,8 +75,8 @@ } - - + + @build.BuildName @build.Class.ToString() @build.EliteSpecialization.ToString()