diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Users/Users.razor b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Users/Users.razor
index d337781..3baff3f 100644
--- a/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Users/Users.razor
+++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Users/Users.razor
@@ -3,6 +3,7 @@
@using GameIdeas.BlazorApp.Layouts
@using GameIdeas.BlazorApp.Pages.Users.Components
@using GameIdeas.BlazorApp.Shared.Components.Popup
+@using GameIdeas.BlazorApp.Shared.Components.Popup.Components
@using GameIdeas.BlazorApp.Shared.Components.Search
@using GameIdeas.BlazorApp.Shared.Components.Select.Models
@using GameIdeas.BlazorApp.Shared.Components.SelectSearch
@@ -14,8 +15,8 @@
@@ -30,7 +31,7 @@
{
@foreach (var user in UserList.Users ?? [])
{
-
+
}
}
else
@@ -44,5 +45,5 @@
-
+
\ No newline at end of file
diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Users/Users.razor.cs b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Users/Users.razor.cs
index f6d9bbb..fc26089 100644
--- a/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Users/Users.razor.cs
+++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Users/Users.razor.cs
@@ -17,6 +17,7 @@ public partial class Users
private IEnumerable Roles = [];
private int CurrentPage = 1;
private UserDto UserAdd = new();
+ private UserDto? UserDelete;
protected override async Task OnInitializedAsync()
{
@@ -85,9 +86,11 @@ public partial class Users
}
}
- private async Task HandleRemoveUser(UserDto user)
+ private async Task HandleRemoveUser()
{
- if (user.Id == null)
+ Popup?.Close();
+
+ if (UserDelete?.Id == null)
{
return;
}
@@ -96,7 +99,7 @@ public partial class Users
{
IsLoading = true;
- await UserGateway.DeleteUser(user.Id);
+ await UserGateway.DeleteUser(UserDelete.Id);
await FetchData(false);
}
catch (Exception)
@@ -107,9 +110,24 @@ public partial class Users
{
IsLoading = false;
}
+
+ UserDelete = null;
}
private void HandleResetUser(UserDto args)
{
UserAdd = new();
}
+ private async Task HandleFilterChanged()
+ {
+ await FetchData(false);
+ }
+ private void HandleCancelPopupClicked()
+ {
+ Popup?.Close();
+ }
+ private void HandleOpenConfirmationPopup(UserDto user)
+ {
+ UserDelete = user;
+ Popup?.Open();
+ }
}
\ No newline at end of file
diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Popup/Components/ConfirmDelete.razor b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Popup/Components/ConfirmDelete.razor
new file mode 100644
index 0000000..7b1f2dd
--- /dev/null
+++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Popup/Components/ConfirmDelete.razor
@@ -0,0 +1,7 @@
+
+
@ResourcesKey.ConfirmDeleteDescription
+
+
diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Popup/Components/ConfirmDelete.razor.cs b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Popup/Components/ConfirmDelete.razor.cs
new file mode 100644
index 0000000..b5cb529
--- /dev/null
+++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Popup/Components/ConfirmDelete.razor.cs
@@ -0,0 +1,18 @@
+using Microsoft.AspNetCore.Components;
+
+namespace GameIdeas.BlazorApp.Shared.Components.Popup.Components;
+
+public partial class ConfirmDelete
+{
+ [Parameter] public EventCallback OnCancel { get; set; }
+ [Parameter] public EventCallback OnConfirm { get; set; }
+
+ private async Task HandleConfirmClicked()
+ {
+ await OnConfirm.InvokeAsync();
+ }
+ private async Task HandleCancelClicked()
+ {
+ await OnCancel.InvokeAsync();
+ }
+}
\ No newline at end of file
diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Popup/Components/ConfirmDelete.razor.css b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Popup/Components/ConfirmDelete.razor.css
new file mode 100644
index 0000000..c359f67
--- /dev/null
+++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Popup/Components/ConfirmDelete.razor.css
@@ -0,0 +1,29 @@
+.confirm-section {
+ padding: 10px 20px;
+ display: grid;
+ grid-gap: 20px;
+}
+
+.descrption {
+
+}
+
+.buttons {
+ justify-content: end;
+ display: flex;
+ gap: 8px;
+}
+
+
+.cancel, .confirm {
+ height: 28px;
+ align-content: center;
+ padding: 0 10px;
+ background: var(--violet);
+ border-radius: var(--small-radius);
+ cursor: pointer;
+}
+
+ .cancel:hover, .confirm:hover {
+ background: var(--violet-selected);
+ }
\ No newline at end of file
diff --git a/src/GameIdeas/GameIdeas.Resources/CreateStaticResourceKey.cs b/src/GameIdeas/GameIdeas.Resources/CreateStaticResourceKey.cs
index 71ca1ab..db3cccb 100644
--- a/src/GameIdeas/GameIdeas.Resources/CreateStaticResourceKey.cs
+++ b/src/GameIdeas/GameIdeas.Resources/CreateStaticResourceKey.cs
@@ -61,6 +61,9 @@ public class Translations (TranslationService translationService)
public string ErrorCreateUser => translationService.Translate(nameof(ErrorCreateUser));
public string ErrorUpdateUser => translationService.Translate(nameof(ErrorUpdateUser));
public string ErrorDeleteUser => translationService.Translate(nameof(ErrorDeleteUser));
+ public string Cancel => translationService.Translate(nameof(Cancel));
+ public string Confirm => translationService.Translate(nameof(Confirm));
+ public string ConfirmDeleteDescription => translationService.Translate(nameof(ConfirmDeleteDescription));
}
public static class ResourcesKey
@@ -130,4 +133,7 @@ public static class ResourcesKey
public static string ErrorCreateUser => _instance?.ErrorCreateUser ?? throw new InvalidOperationException("ResourcesKey.ErrorCreateUser is not initialized.");
public static string ErrorUpdateUser => _instance?.ErrorUpdateUser ?? throw new InvalidOperationException("ResourcesKey.ErrorUpdateUser is not initialized.");
public static string ErrorDeleteUser => _instance?.ErrorDeleteUser ?? throw new InvalidOperationException("ResourcesKey.ErrorDeleteUser is not initialized.");
+ public static string Cancel => _instance?.Cancel ?? throw new InvalidOperationException("ResourcesKey.Cancel is not initialized.");
+ public static string Confirm => _instance?.Confirm ?? throw new InvalidOperationException("ResourcesKey.Confirm is not initialized.");
+ public static string ConfirmDeleteDescription => _instance?.ConfirmDeleteDescription ?? throw new InvalidOperationException("ResourcesKey.ConfirmDeleteDescription is not initialized.");
}
\ No newline at end of file
diff --git a/src/GameIdeas/Server/GameIdeas.WebAPI/Files/GameIdeas.fr.json b/src/GameIdeas/Server/GameIdeas.WebAPI/Files/GameIdeas.fr.json
index 4ce3ca9..43a1047 100644
--- a/src/GameIdeas/Server/GameIdeas.WebAPI/Files/GameIdeas.fr.json
+++ b/src/GameIdeas/Server/GameIdeas.WebAPI/Files/GameIdeas.fr.json
@@ -56,5 +56,8 @@
"MissingField": "Un champs est manquant",
"ErrorCreateUser": "Erreur lors de la création d'un utilisateur",
"ErrorUpdateUser": "Erreur lors de la mise à jour d'un utilisateur",
- "ErrorDeleteUser": "Erreur lors de la suppression d'un utilisateur"
+ "ErrorDeleteUser": "Erreur lors de la suppression d'un utilisateur",
+ "Cancel": "Annuler",
+ "Confirm": "Confirmer",
+ "ConfirmDeleteDescription": "Êtes-vous sur de vouloir supprimer cet élément ?"
}
\ No newline at end of file