diff --git a/WF-WebAdmin/WF-WebAdmin/Pages/Accueil.cs b/WF-WebAdmin/WF-WebAdmin/Pages/Accueil.razor.cs similarity index 100% rename from WF-WebAdmin/WF-WebAdmin/Pages/Accueil.cs rename to WF-WebAdmin/WF-WebAdmin/Pages/Accueil.razor.cs diff --git a/WF-WebAdmin/WF-WebAdmin/Pages/DeleteUser.cs b/WF-WebAdmin/WF-WebAdmin/Pages/DeleteUser.cs deleted file mode 100644 index e913791..0000000 --- a/WF-WebAdmin/WF-WebAdmin/Pages/DeleteUser.cs +++ /dev/null @@ -1,21 +0,0 @@ -using Microsoft.AspNetCore.Components; -using WF_WebAdmin.Model; - -namespace WF_WebAdmin.Pages -{ - public partial class DeleteUser - { - private User[] users; - - [Inject] - public HttpClient Http { get; set; } - - [Inject] - public NavigationManager NavigationManager { get; set; } - - protected override async Task OnInitializedAsync() - { - users = await Http.GetFromJsonAsync($"{NavigationManager.BaseUri}fake-dataUser.json"); - } - } -} diff --git a/WF-WebAdmin/WF-WebAdmin/Pages/DeleteUser.razor b/WF-WebAdmin/WF-WebAdmin/Pages/DeleteUser.razor index 933820d..96790a9 100644 --- a/WF-WebAdmin/WF-WebAdmin/Pages/DeleteUser.razor +++ b/WF-WebAdmin/WF-WebAdmin/Pages/DeleteUser.razor @@ -2,12 +2,13 @@ Gestion utilisateur +

Gestion des utilisateurs

+ + + @if(users != null) { -

Gestion des utilisateurs

-

Utilisateurs présents:

- @foreach (var user in users) {
@@ -16,11 +17,29 @@

Nom d'utilisateur : @user.Name

Email de l'utilisateur : @user.Email

Date de création de l'utilisateur : @user.DateCreation.ToShortDateString()

- + +
+ } + + @if (showPopup) + { +
+
+

Êtes-vous sûr de vouloir supprimer cet utilisateur ?

+ + +
} + + +} +else +{ +

Aucun utilisateurs présents sur le site

} -@code { +@code { + } diff --git a/WF-WebAdmin/WF-WebAdmin/Pages/DeleteUser.razor.cs b/WF-WebAdmin/WF-WebAdmin/Pages/DeleteUser.razor.cs new file mode 100644 index 0000000..da26421 --- /dev/null +++ b/WF-WebAdmin/WF-WebAdmin/Pages/DeleteUser.razor.cs @@ -0,0 +1,52 @@ +using Microsoft.AspNetCore.Components; +using Microsoft.Extensions.Configuration.UserSecrets; +using WF_WebAdmin.Model; + +namespace WF_WebAdmin.Pages +{ + public partial class DeleteUser + { + private List users; + + + private bool showPopup = false; + private User userToDelete = null; + [Inject] + public HttpClient Http { get; set; } + + [Inject] + public NavigationManager NavigationManager { get; set; } + + protected override async Task OnInitializedAsync() + { + users = await Http.GetFromJsonAsync>($"{NavigationManager.BaseUri}fake-dataUser.json"); + } + + + + + private void ShowConfirmation(User user) + { + // Afficher la modale et mémoriser l'utilisateur à supprimer + userToDelete = user; + showPopup = true; + } + + + + private async Task RemoveUser() + { + if(userToDelete != null) + { + users.RemoveAll(u => u.Id == userToDelete.Id); + ClosePopup(); + } + } + + private void ClosePopup() + { + showPopup = false; + } + } + +} diff --git a/WF-WebAdmin/WF-WebAdmin/Pages/ValidQuote.razor b/WF-WebAdmin/WF-WebAdmin/Pages/ValidQuote.razor index 595445f..01ee40e 100644 --- a/WF-WebAdmin/WF-WebAdmin/Pages/ValidQuote.razor +++ b/WF-WebAdmin/WF-WebAdmin/Pages/ValidQuote.razor @@ -2,7 +2,7 @@ @if(quotes != null){

Citations non validées

-

Citations en attente de validation:

+

Citations en attente de validation par un administrateur:

@foreach(var quote in quotes) { diff --git a/WF-WebAdmin/WF-WebAdmin/Pages/ValidQuote.cs b/WF-WebAdmin/WF-WebAdmin/Pages/ValidQuote.razor.cs similarity index 100% rename from WF-WebAdmin/WF-WebAdmin/Pages/ValidQuote.cs rename to WF-WebAdmin/WF-WebAdmin/Pages/ValidQuote.razor.cs diff --git a/WF-WebAdmin/WF-WebAdmin/wwwroot/css/site.css b/WF-WebAdmin/WF-WebAdmin/wwwroot/css/site.css index d91bb8d..95cefc3 100644 --- a/WF-WebAdmin/WF-WebAdmin/wwwroot/css/site.css +++ b/WF-WebAdmin/WF-WebAdmin/wwwroot/css/site.css @@ -88,4 +88,29 @@ button { .pseudo, .mail, .idUser, .dateCrea, .idQuote, .contentQuote, .CaracterQuote, .SourceQuote, .langueQuote, .UserPropositionQuote { margin-left: 10px; +} + + +/*Popup DeleteUser*/ +.divPopup { + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + background-color: white border-radius:20px; + display: flex; + justify-content: center; + align-items: center; + z-index: 2; +} +.contentPopup { + background-color: white; + padding: 20px; + border-radius: 20px; + display: flex; + flex-direction: column; + gap: 10px; + width: 300px; + text-align: center; } \ No newline at end of file