Inventory update
continuous-integration/drone/push Build is passing Details

Projet
Dorian HODIN 2 years ago
parent 9d7db8b7d5
commit 817e8a2faa

@ -1,8 +1,7 @@
{
"ExpandedNodes": [
"",
"\\Code",
"\\Code\\ProjetBlazor"
"\\Code"
],
"SelectedNode": "\\Code\\BlazorApp.sln",
"PreviewInSolutionExplorer": false

Binary file not shown.

Binary file not shown.

@ -1,46 +1,58 @@
<CascadingValue Value="@this">
@using Models
<CascadingValue Value="@this">
<div class="container">
<div class="row">
<div class="col-6">
<div>Available items:</div>
<div>All items:</div>
<div>
<div class="css-grid">
@foreach (var item in Items)
<DataGrid TItem="Item"
Data="@items"
ReadData="@OnReadData"
TotalItems="@totalItem"
PageSize="10"
ShowPager
Responsive>
<DataGridColumn TItem="Item" Field="●" Caption="●"/>
<DataGridColumn TItem="Item" Field="@nameof(Item.Id)" Caption="Image">
<DisplayTemplate>
@if (!string.IsNullOrWhiteSpace(context.ImageBase64))
{
<img src="data:image/png;base64, @(context.ImageBase64)" class="img-thumbnail" title="@context.DisplayName" alt="@context.DisplayName" style ="min-width: 50px; max-width: 150px" />
}
else
{
<CraftingItem Item="item" NoDrop="true" />
<img src="images/default.png" class="img-thumbnail" title="@context.DisplayName" alt="@context.DisplayName" style="max-width: 150px" />
}
</DisplayTemplate>
</DataGridColumn>
<DataGridColumn TItem="Item" Field="@nameof(Item.DisplayName)" Caption="Nom" />
<DataGridColumn TItem="Item" Field="@nameof(Item.StackSize)" Caption="Taille Stack" />
</DataGrid>
</div>
</div>
</div>
<div class="col-6">
<div>Recipe</div>
<div>Inventaire</div>
<div>
<div class="css-recipe">
<CraftingItem Index="0" />
<CraftingItem Index="1" />
<CraftingItem Index="2" />
<CraftingItem Index="3" />
<CraftingItem Index="4" />
<CraftingItem Index="5" />
<CraftingItem Index="6" />
<CraftingItem Index="7" />
<CraftingItem Index="8" />
</div>
</div>
@for (int i=0;i<36;i++)
{
<CraftingItem Index="@i" />
<div>Result</div>
<div>
<CraftingItem Item="RecipeResult" />
}
</div>
</div>
</div>
<div class="col-12">
<div class="col-18">
<div>Actions</div>
<div class="actions" id="actions">
</div>

@ -1,6 +1,12 @@
using Microsoft.AspNetCore.Components;
using Blazored.Modal;
using Blazored.Modal.Services;
using Blazorise.DataGrid;
using Microsoft.AspNetCore.Components;
using Microsoft.Extensions.Localization;
using Microsoft.JSInterop;
using ProjetBlazor.Modals;
using ProjetBlazor.Models;
using ProjetBlazor.Services;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
@ -8,7 +14,6 @@ namespace ProjetBlazor.Components
{
public partial class Crafting
{
private Item _recipeResult;
public Crafting()
{
@ -25,6 +30,9 @@ namespace ProjetBlazor.Components
public List<Item> RecipeItems { get; set; }
private Item _recipeResult;
public Item RecipeResult
{
get => this._recipeResult;
@ -76,5 +84,55 @@ namespace ProjetBlazor.Components
{
JavaScriptRuntime.InvokeVoidAsync("Crafting.AddActions", e.NewItems);
}
private List<Item>? items;
private int totalItem;
[Inject]
public IDataService DataService { get; set; }
[Inject]
public IWebHostEnvironment WebHostEnvironment { get; set; }
[Inject]
public NavigationManager NavigationManager { get; set; }
[CascadingParameter]
public IModalService Modal { get; set; }
private async Task OnReadData(DataGridReadDataEventArgs<Item> e)
{
if (e.CancellationToken.IsCancellationRequested)
{
return;
}
if (!e.CancellationToken.IsCancellationRequested)
{
items = await DataService.List(e.Page, e.PageSize);
totalItem = await DataService.Count();
}
}
private async void OnDelete(int id)
{
var parameters = new ModalParameters();
parameters.Add(nameof(Item.Id), id);
var modal = Modal.Show<DeleteConfirmation>("Delete Confirmation", parameters);
var result = await modal.Result;
if (result.Cancelled)
{
return;
}
await DataService.Delete(id);
// Reload the page
NavigationManager.NavigateTo("list", true);
}
}
}

@ -1,15 +1,12 @@
.css-grid {
grid-template-columns: repeat(4,minmax(0,1fr));
gap: 10px;
display: grid;
width: 286px;
}
.css-recipe {
grid-template-columns: repeat(3,minmax(0,1fr));
grid-template-columns: repeat(9,minmax(0,1fr));
gap: 10px;
display: grid;
width: 212px;
width: 600px;
}
.actions {

@ -4,15 +4,8 @@
@page "/"
<PageTitle>Index</PageTitle>
<PageTitle>Inventory</PageTitle>
<h1>Hello world!</h1>
Bienvenue sur ce site representant les différents TP de Blazor.
<p>
<b>Langue Actuelle :</b>: @CultureInfo.CurrentCulture
</p>
<div>
<Crafting Items="Items" Recipes="Recipes" />

@ -16,7 +16,7 @@ namespace ProjetBlazor.Pages
protected override async Task OnAfterRenderAsync(bool firstRender)
{
base.OnAfterRenderAsync(firstRender);
_ = base.OnAfterRenderAsync(firstRender);
if (!firstRender)
{

@ -11,12 +11,12 @@
<nav class="flex-column">
<div class="nav-item px-3">
<NavLink class="nav-link" href="" Match="NavLinkMatch.All">
<span class="oi oi-home" aria-hidden="true"></span> Table de Craft
<span class="oi oi-home" aria-hidden="true"></span> Inventaire
</NavLink>
</div>
<div class="nav-item px-3">
<NavLink class="nav-link" href="list">
<span class="oi oi-list-rich" aria-hidden="true"></span> Inventaire
<span class="oi oi-list-rich" aria-hidden="true"></span> Liste des Items
</NavLink>
</div>
</nav>

@ -1 +1 @@
378a3996c280508abfb7a9c5880d00df74d276a6
23d3138046335a8c8f03ebb1ed1a665d5ca0e63d

File diff suppressed because one or more lines are too long

@ -1,15 +1,12 @@
.css-grid[b-c5pe2f0rgk] {
grid-template-columns: repeat(4,minmax(0,1fr));
gap: 10px;
display: grid;
width: 286px;
}
.css-recipe[b-c5pe2f0rgk] {
grid-template-columns: repeat(3,minmax(0,1fr));
grid-template-columns: repeat(9,minmax(0,1fr));
gap: 10px;
display: grid;
width: 212px;
width: 600px;
}
.actions[b-c5pe2f0rgk] {

@ -2,17 +2,14 @@
/* _content/ProjetBlazor/Components/Crafting.razor.rz.scp.css */
.css-grid[b-c5pe2f0rgk] {
grid-template-columns: repeat(4,minmax(0,1fr));
gap: 10px;
display: grid;
width: 286px;
}
.css-recipe[b-c5pe2f0rgk] {
grid-template-columns: repeat(3,minmax(0,1fr));
grid-template-columns: repeat(9,minmax(0,1fr));
gap: 10px;
display: grid;
width: 212px;
width: 600px;
}
.actions[b-c5pe2f0rgk] {

@ -1,16 +1,13 @@
/* _content/ProjetBlazor/Components/Crafting.razor.rz.scp.css */
.css-grid[b-c5pe2f0rgk] {
grid-template-columns: repeat(4,minmax(0,1fr));
gap: 10px;
display: grid;
width: 286px;
}
.css-recipe[b-c5pe2f0rgk] {
grid-template-columns: repeat(3,minmax(0,1fr));
grid-template-columns: repeat(9,minmax(0,1fr));
gap: 10px;
display: grid;
width: 212px;
width: 600px;
}
.actions[b-c5pe2f0rgk] {

@ -28,10 +28,6 @@ build_metadata.AdditionalFiles.CssScope =
build_metadata.AdditionalFiles.TargetPath = UGFnZXNcQWRkLnJhem9y
build_metadata.AdditionalFiles.CssScope =
[C:/Users/Dorian/Documents/Blazor/Code/ProjetBlazor/Pages/CreateLog.razor]
build_metadata.AdditionalFiles.TargetPath = UGFnZXNcQ3JlYXRlTG9nLnJhem9y
build_metadata.AdditionalFiles.CssScope =
[C:/Users/Dorian/Documents/Blazor/Code/ProjetBlazor/Pages/Edit.razor]
build_metadata.AdditionalFiles.TargetPath = UGFnZXNcRWRpdC5yYXpvcg==
build_metadata.AdditionalFiles.CssScope =

@ -3,7 +3,8 @@
"LogLevel": {
"Default": "Trace",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
"Microsoft.Hosting.Lifetime": "Information",
"DetailedErrors": "Information"
}
}
}
Loading…
Cancel
Save