From 6cf118f8b2ad04d731b7cfe5eaaa0bd3642f2b9d Mon Sep 17 00:00:00 2001 From: Kevin MONDEJAR Date: Wed, 8 Jan 2025 11:34:45 +0100 Subject: [PATCH 1/4] debut modif citation --- .../WF-WebAdmin/Pages/ModifQuote.razor | 45 +++++++++++++++++++ .../WF-WebAdmin/Pages/ModifQuote.razor.cs | 21 +++++++++ WF-WebAdmin/WF-WebAdmin/Shared/NavMenu.razor | 7 +++ WF-WebAdmin/WF-WebAdmin/wwwroot/css/site.css | 8 ++++ .../wwwroot/fake-dataModifQuote.json | 24 ++++++++++ 5 files changed, 105 insertions(+) create mode 100644 WF-WebAdmin/WF-WebAdmin/Pages/ModifQuote.razor create mode 100644 WF-WebAdmin/WF-WebAdmin/Pages/ModifQuote.razor.cs create mode 100644 WF-WebAdmin/WF-WebAdmin/wwwroot/fake-dataModifQuote.json diff --git a/WF-WebAdmin/WF-WebAdmin/Pages/ModifQuote.razor b/WF-WebAdmin/WF-WebAdmin/Pages/ModifQuote.razor new file mode 100644 index 0000000..85dbd8b --- /dev/null +++ b/WF-WebAdmin/WF-WebAdmin/Pages/ModifQuote.razor @@ -0,0 +1,45 @@ +@page "/modifquote" + +Corection des citation + +

Corection des citation

+ +

Ajouter une recherche

+ +@if (quotes != null) +{ + + + + + + + + + + + + + + + @foreach (var quote in quotes) + { + + + + + + + + + + + } + + +
ImageIdContenuPersonageTitre SourceLikesLangueDate Source
@quote.Id + + @quote.Charac@quote.TitleSrc@quote.Like@quote.Langue@quote.DateSrc.ToShortDateString()
+} \ No newline at end of file diff --git a/WF-WebAdmin/WF-WebAdmin/Pages/ModifQuote.razor.cs b/WF-WebAdmin/WF-WebAdmin/Pages/ModifQuote.razor.cs new file mode 100644 index 0000000..4abe969 --- /dev/null +++ b/WF-WebAdmin/WF-WebAdmin/Pages/ModifQuote.razor.cs @@ -0,0 +1,21 @@ +using Microsoft.AspNetCore.Components; +using WF_WebAdmin.Model; + +namespace WF_WebAdmin.Pages +{ + public partial class ModifQuote + { + private Quote[] quotes; + + [Inject] + public HttpClient Http { get; set; } + + [Inject] + public NavigationManager NavigationManager { get; set; } + + protected override async Task OnInitializedAsync() + { + quotes = await Http.GetFromJsonAsync($"{NavigationManager.BaseUri}fake-dataModifQuote.json"); + } + } +} diff --git a/WF-WebAdmin/WF-WebAdmin/Shared/NavMenu.razor b/WF-WebAdmin/WF-WebAdmin/Shared/NavMenu.razor index 2e82fc0..5464a8c 100644 --- a/WF-WebAdmin/WF-WebAdmin/Shared/NavMenu.razor +++ b/WF-WebAdmin/WF-WebAdmin/Shared/NavMenu.razor @@ -31,6 +31,13 @@ + + + diff --git a/WF-WebAdmin/WF-WebAdmin/wwwroot/css/site.css b/WF-WebAdmin/WF-WebAdmin/wwwroot/css/site.css index d91bb8d..8246181 100644 --- a/WF-WebAdmin/WF-WebAdmin/wwwroot/css/site.css +++ b/WF-WebAdmin/WF-WebAdmin/wwwroot/css/site.css @@ -88,4 +88,12 @@ button { .pseudo, .mail, .idUser, .dateCrea, .idQuote, .contentQuote, .CaracterQuote, .SourceQuote, .langueQuote, .UserPropositionQuote { margin-left: 10px; +} + +/*ModifQuote*/ + +.imgTab{ + width: 5vw; + height: 5vw; + object-fit: contain; } \ No newline at end of file diff --git a/WF-WebAdmin/WF-WebAdmin/wwwroot/fake-dataModifQuote.json b/WF-WebAdmin/WF-WebAdmin/wwwroot/fake-dataModifQuote.json new file mode 100644 index 0000000..61477e9 --- /dev/null +++ b/WF-WebAdmin/WF-WebAdmin/wwwroot/fake-dataModifQuote.json @@ -0,0 +1,24 @@ +[ + { + "Id": 1, + "ImgPath": "https://tse2.mm.bing.net/th/id/OIP.MMpXBB5RDRYQm05FJmevGAHaKl?w=137&h=195&c=7&r=0&o=5&pid=1.7", + "Content": "Harry POTTER JE SUIS TON PERE", + "Charac": "Sirius Black", + "TitleSrc": "Harry Potter", + "Langue": "fr", + "UserProposition": "demo", + "DateSrc": "2001-01-01", + "Like": 20 + }, + { + "Id": 2, + "ImgPath": "https://tse2.mm.bing.net/th/id/OIP.zR4rzkK7q2wCcNwZd6jjegHaIC?w=163&h=180&c=7&r=0&o=5&pid=1.7", + "Content": "'Une autre citation'", + "Charac": "Un personnage", + "TitleSrc": "Un super film", + "Langue": "fr", + "DateSrc": "2002-02-02", + "Like": 0, + "UserProposition": "exploit" + } +] \ No newline at end of file From 0176d13e3d643c29a7a2557043c24718367ebeba Mon Sep 17 00:00:00 2001 From: Kevin MONDEJAR Date: Wed, 8 Jan 2025 11:58:34 +0100 Subject: [PATCH 2/4] datagrid --- .../WF-WebAdmin/Pages/ModifQuote.razor | 49 ++++---------- .../WF-WebAdmin/Pages/ModifQuote.razor.cs | 2 + WF-WebAdmin/WF-WebAdmin/Pages/_Layout.cshtml | 5 ++ WF-WebAdmin/WF-WebAdmin/Program.cs | 8 +++ WF-WebAdmin/WF-WebAdmin/WF-WebAdmin.csproj | 7 ++ WF-WebAdmin/WF-WebAdmin/_Imports.razor | 1 + .../wwwroot/fake-dataModifQuote.json | 66 +++++++++++++++++++ 7 files changed, 103 insertions(+), 35 deletions(-) diff --git a/WF-WebAdmin/WF-WebAdmin/Pages/ModifQuote.razor b/WF-WebAdmin/WF-WebAdmin/Pages/ModifQuote.razor index 85dbd8b..d562f7a 100644 --- a/WF-WebAdmin/WF-WebAdmin/Pages/ModifQuote.razor +++ b/WF-WebAdmin/WF-WebAdmin/Pages/ModifQuote.razor @@ -1,4 +1,5 @@ -@page "/modifquote" +@using WF_WebAdmin.Model +@page "/modifquote" Corection des citation @@ -8,38 +9,16 @@ @if (quotes != null) { - - - - - - - - - - - - - - - @foreach (var quote in quotes) - { - - - - - - - - - - - } - - -
ImageIdContenuPersonageTitre SourceLikesLangueDate Source
@quote.Id - - @quote.Charac@quote.TitleSrc@quote.Like@quote.Langue@quote.DateSrc.ToShortDateString()
+ + + + + + + + + } \ No newline at end of file diff --git a/WF-WebAdmin/WF-WebAdmin/Pages/ModifQuote.razor.cs b/WF-WebAdmin/WF-WebAdmin/Pages/ModifQuote.razor.cs index 4abe969..6bb7933 100644 --- a/WF-WebAdmin/WF-WebAdmin/Pages/ModifQuote.razor.cs +++ b/WF-WebAdmin/WF-WebAdmin/Pages/ModifQuote.razor.cs @@ -7,6 +7,8 @@ namespace WF_WebAdmin.Pages { private Quote[] quotes; + private int MaxValue = 5; + [Inject] public HttpClient Http { get; set; } diff --git a/WF-WebAdmin/WF-WebAdmin/Pages/_Layout.cshtml b/WF-WebAdmin/WF-WebAdmin/Pages/_Layout.cshtml index dd71165..bc00141 100644 --- a/WF-WebAdmin/WF-WebAdmin/Pages/_Layout.cshtml +++ b/WF-WebAdmin/WF-WebAdmin/Pages/_Layout.cshtml @@ -28,5 +28,10 @@ + + + + + diff --git a/WF-WebAdmin/WF-WebAdmin/Program.cs b/WF-WebAdmin/WF-WebAdmin/Program.cs index cdcdbeb..fa0d376 100644 --- a/WF-WebAdmin/WF-WebAdmin/Program.cs +++ b/WF-WebAdmin/WF-WebAdmin/Program.cs @@ -1,3 +1,6 @@ +using Blazorise; +using Blazorise.Bootstrap; +using Blazorise.Icons.FontAwesome; using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components.Web; using WF_WebAdmin.Data; @@ -11,6 +14,11 @@ builder.Services.AddSingleton(); builder.Services.AddHttpClient(); +builder.Services + .AddBlazorise() + .AddBootstrapProviders() + .AddFontAwesomeIcons(); + var app = builder.Build(); // Configure the HTTP request pipeline. diff --git a/WF-WebAdmin/WF-WebAdmin/WF-WebAdmin.csproj b/WF-WebAdmin/WF-WebAdmin/WF-WebAdmin.csproj index 9c94761..48f59a7 100644 --- a/WF-WebAdmin/WF-WebAdmin/WF-WebAdmin.csproj +++ b/WF-WebAdmin/WF-WebAdmin/WF-WebAdmin.csproj @@ -7,4 +7,11 @@ WF_WebAdmin + + + + + + + diff --git a/WF-WebAdmin/WF-WebAdmin/_Imports.razor b/WF-WebAdmin/WF-WebAdmin/_Imports.razor index 5f99f58..f261bea 100644 --- a/WF-WebAdmin/WF-WebAdmin/_Imports.razor +++ b/WF-WebAdmin/WF-WebAdmin/_Imports.razor @@ -8,3 +8,4 @@ @using Microsoft.JSInterop @using WF_WebAdmin @using WF_WebAdmin.Shared +@using Blazorise.DataGrid diff --git a/WF-WebAdmin/WF-WebAdmin/wwwroot/fake-dataModifQuote.json b/WF-WebAdmin/WF-WebAdmin/wwwroot/fake-dataModifQuote.json index 61477e9..20f7d2a 100644 --- a/WF-WebAdmin/WF-WebAdmin/wwwroot/fake-dataModifQuote.json +++ b/WF-WebAdmin/WF-WebAdmin/wwwroot/fake-dataModifQuote.json @@ -1,4 +1,70 @@ [ + { + "Id": 1, + "ImgPath": "https://tse2.mm.bing.net/th/id/OIP.MMpXBB5RDRYQm05FJmevGAHaKl?w=137&h=195&c=7&r=0&o=5&pid=1.7", + "Content": "Harry POTTER JE SUIS TON PERE", + "Charac": "Sirius Black", + "TitleSrc": "Harry Potter", + "Langue": "fr", + "UserProposition": "demo", + "DateSrc": "2001-01-01", + "Like": 20 + }, + { + "Id": 2, + "ImgPath": "https://tse2.mm.bing.net/th/id/OIP.zR4rzkK7q2wCcNwZd6jjegHaIC?w=163&h=180&c=7&r=0&o=5&pid=1.7", + "Content": "'Une autre citation'", + "Charac": "Un personnage", + "TitleSrc": "Un super film", + "Langue": "fr", + "DateSrc": "2002-02-02", + "Like": 0, + "UserProposition": "exploit" + }, + { + "Id": 1, + "ImgPath": "https://tse2.mm.bing.net/th/id/OIP.MMpXBB5RDRYQm05FJmevGAHaKl?w=137&h=195&c=7&r=0&o=5&pid=1.7", + "Content": "Harry POTTER JE SUIS TON PERE", + "Charac": "Sirius Black", + "TitleSrc": "Harry Potter", + "Langue": "fr", + "UserProposition": "demo", + "DateSrc": "2001-01-01", + "Like": 20 + }, + { + "Id": 2, + "ImgPath": "https://tse2.mm.bing.net/th/id/OIP.zR4rzkK7q2wCcNwZd6jjegHaIC?w=163&h=180&c=7&r=0&o=5&pid=1.7", + "Content": "'Une autre citation'", + "Charac": "Un personnage", + "TitleSrc": "Un super film", + "Langue": "fr", + "DateSrc": "2002-02-02", + "Like": 0, + "UserProposition": "exploit" + }, + { + "Id": 1, + "ImgPath": "https://tse2.mm.bing.net/th/id/OIP.MMpXBB5RDRYQm05FJmevGAHaKl?w=137&h=195&c=7&r=0&o=5&pid=1.7", + "Content": "Harry POTTER JE SUIS TON PERE", + "Charac": "Sirius Black", + "TitleSrc": "Harry Potter", + "Langue": "fr", + "UserProposition": "demo", + "DateSrc": "2001-01-01", + "Like": 20 + }, + { + "Id": 2, + "ImgPath": "https://tse2.mm.bing.net/th/id/OIP.zR4rzkK7q2wCcNwZd6jjegHaIC?w=163&h=180&c=7&r=0&o=5&pid=1.7", + "Content": "'Une autre citation'", + "Charac": "Un personnage", + "TitleSrc": "Un super film", + "Langue": "fr", + "DateSrc": "2002-02-02", + "Like": 0, + "UserProposition": "exploit" + }, { "Id": 1, "ImgPath": "https://tse2.mm.bing.net/th/id/OIP.MMpXBB5RDRYQm05FJmevGAHaKl?w=137&h=195&c=7&r=0&o=5&pid=1.7", From af07002098e022c62687609009eb626f6810535e Mon Sep 17 00:00:00 2001 From: lebeaulato Date: Wed, 8 Jan 2025 15:55:23 +0100 Subject: [PATCH 3/4] fusion branche --- .../WF-WebAdmin/Pages/DeleteUser.razor | 29 +++++++++++--- .../WF-WebAdmin/Pages/DeleteUser.razor.cs | 39 +++++++++++++++++-- WF-WebAdmin/WF-WebAdmin/wwwroot/css/site.css | 25 ++++++++++++ 3 files changed, 84 insertions(+), 9 deletions(-) diff --git a/WF-WebAdmin/WF-WebAdmin/Pages/DeleteUser.razor b/WF-WebAdmin/WF-WebAdmin/Pages/DeleteUser.razor index 933820d..47af991 100644 --- a/WF-WebAdmin/WF-WebAdmin/Pages/DeleteUser.razor +++ b/WF-WebAdmin/WF-WebAdmin/Pages/DeleteUser.razor @@ -2,12 +2,13 @@ Gestion utilisateur -@if(users != null) -{ -

Gestion des utilisateurs

+

Gestion des utilisateurs

-

Utilisateurs présents:

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

Utilisateurs présents:

@foreach (var user in users) {
@@ -16,10 +17,28 @@

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 { diff --git a/WF-WebAdmin/WF-WebAdmin/Pages/DeleteUser.razor.cs b/WF-WebAdmin/WF-WebAdmin/Pages/DeleteUser.razor.cs index 27d0084..0743f27 100644 --- a/WF-WebAdmin/WF-WebAdmin/Pages/DeleteUser.razor.cs +++ b/WF-WebAdmin/WF-WebAdmin/Pages/DeleteUser.razor.cs @@ -1,12 +1,16 @@ using Microsoft.AspNetCore.Components; +using Microsoft.Extensions.Configuration.UserSecrets; using WF_WebAdmin.Model; namespace WF_WebAdmin.Pages { public partial class DeleteUser { - private User[] users; - + private List users; + + + private bool showPopup = false; + private User userToDelete = null; [Inject] public HttpClient Http { get; set; } @@ -15,7 +19,34 @@ namespace WF_WebAdmin.Pages protected override async Task OnInitializedAsync() { - users = await Http.GetFromJsonAsync($"{NavigationManager.BaseUri}fake-dataUser.json"); + 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/wwwroot/css/site.css b/WF-WebAdmin/WF-WebAdmin/wwwroot/css/site.css index 8246181..9f8f5cf 100644 --- a/WF-WebAdmin/WF-WebAdmin/wwwroot/css/site.css +++ b/WF-WebAdmin/WF-WebAdmin/wwwroot/css/site.css @@ -96,4 +96,29 @@ button { width: 5vw; height: 5vw; object-fit: contain; +} + +/*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 From 5853ad70040636ca8de3bca8527cf09cfd9a4a41 Mon Sep 17 00:00:00 2001 From: Kevin MONDEJAR Date: Wed, 8 Jan 2025 17:31:38 +0100 Subject: [PATCH 4/4] Interface service Quote/User + Debut Stub Service Quote --- .../WF-WebAdmin/Service/IQuoteService.cs | 27 ++++++++ .../WF-WebAdmin/Service/IUserService.cs | 21 ++++++ .../WF-WebAdmin/Service/QuoteServiceStub.cs | 65 +++++++++++++++++++ 3 files changed, 113 insertions(+) create mode 100644 WF-WebAdmin/WF-WebAdmin/Service/IQuoteService.cs create mode 100644 WF-WebAdmin/WF-WebAdmin/Service/IUserService.cs create mode 100644 WF-WebAdmin/WF-WebAdmin/Service/QuoteServiceStub.cs diff --git a/WF-WebAdmin/WF-WebAdmin/Service/IQuoteService.cs b/WF-WebAdmin/WF-WebAdmin/Service/IQuoteService.cs new file mode 100644 index 0000000..e4a165e --- /dev/null +++ b/WF-WebAdmin/WF-WebAdmin/Service/IQuoteService.cs @@ -0,0 +1,27 @@ +using WF_WebAdmin.Model; + +namespace WF_WebAdmin.Service +{ + public interface IQuoteService + { + public void addQuote(Quote quote); + + public void removeQuote(Quote quote); + + public void validQuote(Quote quote); + + public void updateQuote(Quote quote); + + public List getAllQuote(); + + public List getSomeQuote(int nb, int page); + + public Quote getOnequote(int id); + + public List reserchQuote(string reserch, List argument); + + public List getAllQuoteInvalid(); + + public List getSomeQuoteInvalid(int nb, int page); + } +} diff --git a/WF-WebAdmin/WF-WebAdmin/Service/IUserService.cs b/WF-WebAdmin/WF-WebAdmin/Service/IUserService.cs new file mode 100644 index 0000000..1742e10 --- /dev/null +++ b/WF-WebAdmin/WF-WebAdmin/Service/IUserService.cs @@ -0,0 +1,21 @@ +using WF_WebAdmin.Model; + +namespace WF_WebAdmin.Service +{ + public interface IUserService + { + public void removeUser(User user); + + public void updateRole(User user); + + public void downgradeRole(User user); + + public List getAllUser(); + + public List getSomeUser(int nb, int page); + + public User getOneUser(int id); + + public List reserchUsers(string reserch, List args); + } +} diff --git a/WF-WebAdmin/WF-WebAdmin/Service/QuoteServiceStub.cs b/WF-WebAdmin/WF-WebAdmin/Service/QuoteServiceStub.cs new file mode 100644 index 0000000..74cf398 --- /dev/null +++ b/WF-WebAdmin/WF-WebAdmin/Service/QuoteServiceStub.cs @@ -0,0 +1,65 @@ +using Microsoft.AspNetCore.Components; +using WF_WebAdmin.Model; +using static System.Net.WebRequestMethods; + +namespace WF_WebAdmin.Service +{ + public class QuoteServiceStub : IQuoteService + { + [Inject] + public HttpClient Http { get; set; } + + [Inject] + public NavigationManager NavigationManager { get; set; } + + public void addQuote(Quote quote) + { + + } + + public List getAllQuote() + { + throw new NotImplementedException(); + } + + public List getAllQuoteInvalid() + { + throw new NotImplementedException(); + } + + public Quote getOnequote(int id) + { + throw new NotImplementedException(); + } + + public List getSomeQuote(int nb, int page) + { + throw new NotImplementedException(); + } + + public List getSomeQuoteInvalid(int nb, int page) + { + throw new NotImplementedException(); + } + + public void removeQuote(Quote quote) + { + throw new NotImplementedException(); + } + + public List reserchQuote(string reserch, List argument) + { + throw new NotImplementedException(); + } + + public void updateQuote(Quote quote) + { + throw new NotImplementedException(); + } + + public void validQuote(Quote quote) + { + throw new NotImplementedException(); + } + } +}