Start editQuote method

pull/26/head
tomivt 3 months ago
parent 85aeeb061c
commit f79e01ea05

@ -54,13 +54,14 @@ else
}
</div>
}
@*
<DataGrid TItem="User"
Data="@users"
PageSize="@MaxValue">
</DataGrid>
</DataGrid>*@
<!-- Fenêtre de confirmation de suppression -->
@if (showPopupDelete)

@ -7,7 +7,7 @@
<p>Ajouter une recherche</p>
<DataGrid TItem="Quote"
<DataGrid TItem="Quote"
Data="@quotes"
PageSize="@MaxValue"
ReadData="@OnReadData"
@ -23,7 +23,28 @@
<DataGridColumn TItem="Quote" Field="@nameof(Quote.DateSrc)" Caption="Date" DisplayFormat="{0:d}" DisplayFormatProvider="@System.Globalization.CultureInfo.GetCultureInfo("fr-FR")" />
<DataGridColumn TItem="Quote" Field="@nameof(Quote.Id)" Caption="Action">
<DisplayTemplate>
<a href="Edit/@(context.Id)" class="btn btn-primary"><i class="fa fa-edit"></i> Editer</a>
<button @onclick="() => OnEditButtonClicked(context) " style="background-color: lightgray; padding: 0">
<img alt="Bouton Modifier" src="edit.png" width="30" height="30"/>
</button>
@*<a href="Edit/@(context.Id)" class="btn btn-primary"><i class="fa fa-edit"></i> Editer</a>*@
</DisplayTemplate>
</DataGridColumn>
</DataGrid>
</DataGrid>
@if (showEditQuote && selectedQuote != null)
{
<div class="divPopup">
<div class="contentPopup">
<p>Modifier les informations de l'utilisateur :</p>
<label>Citation:</label>
<input type="text" @bind="selectedQuote.Content"/>
<label>Personnage:</label>
<input type="text" @bind="selectedQuote.Charac" />
<label>Source:</label>
<input type="text" @bind="selectedQuote.TitleSrc" />
<button @onclick="EditQuote">Sauvegarder </button>
<button @onclick="ClosePopup">Annuler</button>
</div>
</div>
}

@ -13,6 +13,10 @@ namespace WF_WebAdmin.Pages
private int totalItem;
private bool showEditQuote = false;
private Quote? selectedQuote;
[Inject]
public IQuoteService QuoteService { get; set; }
@ -23,7 +27,6 @@ namespace WF_WebAdmin.Pages
return;
}
var response = await QuoteService.getSomeQuote(e.PageSize, e.Page);
if (!e.CancellationToken.IsCancellationRequested)
@ -32,5 +35,25 @@ namespace WF_WebAdmin.Pages
quotes = response.ToArray();
}
}
private void OnEditButtonClicked(Quote quote)
{
if (selectedQuote == null) return;
selectedQuote = quote;
showEditQuote = true;
}
private void ClosePopup()
{
showEditQuote = false;
selectedQuote = null;
}
private async Task EditQuote()
{
await QuoteService.updateQuote(selectedQuote);
selectedQuote = null;
ClosePopup();
}
}
}

@ -83,8 +83,18 @@ button {
background-color: #C3C4C5;
}
.imgProfil, .imgQuote {
.imgProfil {
border-radius: 25px;
width: 150px; /* Taille standard */
height: 150px; /* Taille standard */
object-fit: cover;
}
.imgQuote {
border-radius: 20px;
width: 300px; /* Taille standard */
height: 300px; /* Taille standard */
object-fit: cover;
}
.pseudo, .mail, .idUser, .dateCrea, .idQuote, .contentQuote, .CaracterQuote, .SourceQuote, .langueQuote, .UserPropositionQuote {

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

@ -1,7 +1,7 @@
[
{
"Id": 1,
"Image": "https://tse4.mm.bing.net/th/id/OIP.fc5TQflh0cbxB1GUeOdk6gHaK8?w=123\u0026h=180\u0026c=7\u0026r=0\u0026o=5\u0026pid=1.7",
"Image": "https://assets.audiomack.com/merlijnmuziek/80c977f3a319cf2826af53c9faa7a46f787ba806ca3f783d23bbb7123942b697.jpeg?width=1000\u0026height=1000\u0026max=true",
"Name": "admin",
"Email": "adminop@gmail.com",
"DateCreation": "2024-12-12T00:00:00",

Loading…
Cancel
Save