Products -> Layers
This commit is contained in:
@@ -4,8 +4,6 @@
|
||||
@inject AuthService AuthService
|
||||
@inject NavigationManager NavigationManager
|
||||
|
||||
<MudText Typo="Typo.body1" Class="mt-4">Witaj w DiunaBI!</MudText>
|
||||
|
||||
@if (AuthService.IsAuthenticated && AuthService.CurrentUser != null)
|
||||
{
|
||||
<MudCard Class="mt-4" Elevation="2">
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
@using MudBlazor.Internal
|
||||
<MudText Typo="Typo.h4" Class="mb-4">Lista Produktów</MudText>
|
||||
|
||||
<MudExpansionPanels Class="mb-4">
|
||||
<MudExpansionPanel Icon="@Icons.Material.Filled.FilterList"
|
||||
Text="Filtry"
|
||||
@@ -9,10 +7,10 @@
|
||||
<MudItem xs="12" sm="6" md="4">
|
||||
<MudTextField @bind-Value="filterRequest.Search"
|
||||
Label="Szukaj"
|
||||
Placeholder="Nazwa, Kod, EAN..."
|
||||
Placeholder="Nazwa, numer..."
|
||||
Immediate="true"
|
||||
DebounceInterval="500"
|
||||
OnDebounceIntervalElapsed="SearchProducts"
|
||||
OnDebounceIntervalElapsed="SearchLayers"
|
||||
Clearable="true"/>
|
||||
|
||||
</MudItem>
|
||||
@@ -36,27 +34,15 @@
|
||||
Loading="isLoading"
|
||||
LoadingProgressColor="Color.Info">
|
||||
<HeaderContent>
|
||||
<MudTh>Nazwa</MudTh>
|
||||
<MudTh>Kod</MudTh>
|
||||
<MudTh>EAN</MudTh>
|
||||
<MudTh>Akcje</MudTh>
|
||||
<MudTh>Name</MudTh>
|
||||
<MudTh>Type</MudTh>
|
||||
</HeaderContent>
|
||||
<RowTemplate>
|
||||
<MudTd DataLabel="Nazwa">@context.Name</MudTd>
|
||||
<MudTd DataLabel="Kod">KOD</MudTd>
|
||||
<MudTd DataLabel="EAN"></MudTd>
|
||||
<MudTd DataLabel="Akcje">
|
||||
<MudIconButton Icon="@Icons.Material.Filled.Edit"
|
||||
Size="Size.Small"
|
||||
OnClick="() => EditProduct(context.Id)"/>
|
||||
<MudIconButton Icon="@Icons.Material.Filled.Delete"
|
||||
Size="Size.Small"
|
||||
Color="Color.Error"
|
||||
OnClick="() => DeleteProduct(context.Id)"/>
|
||||
</MudTd>
|
||||
<MudTd DataLabel="Name">@context.Name</MudTd>
|
||||
<MudTd DataLabel="Type">@context.Type</MudTd>
|
||||
</RowTemplate>
|
||||
<NoRecordsContent>
|
||||
<MudText>Brak produktów do wyświetlenia</MudText>
|
||||
<MudText>No layers to display</MudText>
|
||||
</NoRecordsContent>
|
||||
<LoadingContent>
|
||||
Ładowanie...
|
||||
|
||||
@@ -18,10 +18,10 @@ public partial class LayerListComponent : ComponentBase
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await LoadProducts();
|
||||
await LoadLayers();
|
||||
}
|
||||
|
||||
private async Task LoadProducts()
|
||||
private async Task LoadLayers()
|
||||
{
|
||||
isLoading = true;
|
||||
|
||||
@@ -31,7 +31,7 @@ public partial class LayerListComponent : ComponentBase
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"Loading products failed: {ex.Message}");
|
||||
Console.WriteLine($"Loading layers failed: {ex.Message}");
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -39,33 +39,21 @@ public partial class LayerListComponent : ComponentBase
|
||||
}
|
||||
}
|
||||
|
||||
private async Task SearchProducts()
|
||||
private async Task SearchLayers()
|
||||
{
|
||||
filterRequest.Page = 1;
|
||||
await LoadProducts();
|
||||
await LoadLayers();
|
||||
}
|
||||
|
||||
private async Task OnPageChanged(int page)
|
||||
{
|
||||
filterRequest.Page = page;
|
||||
await LoadProducts();
|
||||
await LoadLayers();
|
||||
}
|
||||
|
||||
private async Task ClearFilters()
|
||||
{
|
||||
filterRequest = new LayerFilterRequest();
|
||||
await LoadProducts();
|
||||
}
|
||||
|
||||
private async Task EditProduct(Guid productId)
|
||||
{
|
||||
// TODO
|
||||
Console.WriteLine($"Edytuj produkt: {productId}");
|
||||
}
|
||||
|
||||
private async Task DeleteProduct(Guid productId)
|
||||
{
|
||||
// TODO
|
||||
Console.WriteLine($"Usuń produkt: {productId}");
|
||||
await LoadLayers();
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@
|
||||
<MudNavLink href="dashboard" Icon="@Icons.Material.Filled.Dashboard" Match="NavLinkMatch.All">
|
||||
Dashboard
|
||||
</MudNavLink>
|
||||
<MudNavLink Href="products" Icon="@Icons.Material.Filled.List" Match="NavLinkMatch.All">
|
||||
Produkty
|
||||
<MudNavLink Href="layers" Icon="@Icons.Material.Filled.List" Match="NavLinkMatch.All">
|
||||
Layers
|
||||
</MudNavLink>
|
||||
</MudNavMenu>
|
||||
@@ -27,7 +27,7 @@
|
||||
Class="mud-width-250">
|
||||
<MudNavMenu>
|
||||
<MudNavLink Href="/dashboard" Icon="@Icons.Material.Filled.Dashboard">Dashboard</MudNavLink>
|
||||
<MudNavLink Href="/products" Icon="@Icons.Material.Filled.Inventory">Products</MudNavLink>
|
||||
<MudNavLink Href="/layers" Icon="@Icons.Material.Filled.Inventory">Layers</MudNavLink>
|
||||
</MudNavMenu>
|
||||
</MudDrawer>
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
@page "/products"
|
||||
@page "/layers"
|
||||
@using DiunaBI.UI.Shared.Components
|
||||
|
||||
<PageTitle>Warstwy</PageTitle>
|
||||
<PageTitle>Layers</PageTitle>
|
||||
|
||||
<MudContainer MaxWidth="MaxWidth.ExtraExtraLarge">
|
||||
<LayerListComponent />
|
||||
|
||||
Reference in New Issue
Block a user