New version

This commit is contained in:
2025-07-11 00:18:14 +02:00
parent 6b6c90272c
commit 49038de2b5
341 changed files with 18364 additions and 0 deletions

25
Drab/Ui/App.razor Normal file
View File

@@ -0,0 +1,25 @@
@using Drab.Ui.components
@using Microsoft.AspNetCore.Components.Web
@using Radzen
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<base href="/"/>
<RadzenTheme Theme="standard" @rendermode="RenderMode.InteractiveServer"/>
<link rel="stylesheet" href="/css/common.css"/>
<ImportMap/>
<title>Brzęczek - Zamówienia</title>
<HeadOutlet/>
</head>
<body>
<Routes @rendermode="RenderMode.InteractiveServer"/>
<script src="_content/Radzen.Blazor/Radzen.Blazor.js?v=@(typeof(Colors).Assembly.GetName().Version)"></script>
<script src="_framework/blazor.web.js"></script>
</body>
</html>

109
Drab/Ui/Pages/Index.razor Normal file
View File

@@ -0,0 +1,109 @@
@page "/"
@using Drab.LocalDb
@using Drab.LocalDb.Entities
@using Drab.Logic.Services
@using Drab.Ui.components
@using Radzen
@inject LocalDbContext LocalDbContext
@inject DialogService DialogService
@inject OrderEventBus EventBus
@implements IDisposable
<RadzenDataGrid Data="@_orders"
TItem="OrderDb"
@ref="_dataGridRef"
AllowFiltering="true"
AllowColumnResize="false"
AllowAlternatingRows="false"
AllowColumnReorder="false"
Density="Density.Default"
FilterCaseSensitivity="FilterCaseSensitivity.CaseInsensitive"
AllowSorting="true"
PageSize="20"
AllowPaging="true"
GridLines="DataGridGridLines.Both"
PagerHorizontalAlign="HorizontalAlign.Center"
ShowPagingSummary="true"
LogicalFilterOperator="LogicalFilterOperator.Or"
SelectionMode="DataGridSelectionMode.Single"
RowClick="@(RowClick)">
<Columns>
<RadzenDataGridColumn Property="@nameof(OrderDb.Shop)"
Filterable="true"
Title="Sklep"
Width="200px"
FilterMode="FilterMode.CheckBoxList"/>
<RadzenDataGridColumn Property="@nameof(OrderDb.Created)"
Title="Data"
Filterable="false"
SortOrder="SortOrder.Descending"
TextAlign="TextAlign.Center"
Width="160px"/>
<RadzenDataGridColumn Property="@nameof(OrderDb.IsPrinted)"
Title="Wydrukowane"
FilterMode="FilterMode.CheckBoxList"
TextAlign="TextAlign.Center"
Width="100px">
<Template Context="order">
@if (order.IsPrinted)
{
<RadzenIcon IconStyle="IconStyle.Success" Icon="check_circle"/>
}
else
{
<RadzenIcon IconStyle="IconStyle.Danger" Icon="highlight_off"/>
}
</Template>
</RadzenDataGridColumn>
<RadzenDataGridColumn Property="@nameof(OrderDb.OrderNumber)"
FilterMode="FilterMode.CheckBoxList"
Title="Numer"
Width="150px"/>
</Columns>
</RadzenDataGrid>
@code {
IQueryable<OrderDb> _orders;
private RadzenDataGrid<OrderDb>? _dataGridRef;
protected override void OnInitialized()
{
EventBus.OrdersChanged += OnOrdersChanged;
_orders = LocalDbContext.Orders;
}
private async Task RowClick(DataGridRowMouseEventArgs<OrderDb> obj)
{
await DialogService.OpenAsync<PdfViewer>($"Zamówienie {obj.Data.OrderNumber} - Sklep {obj.Data.Shop}",
new Dictionary<string, object>() {{nameof(PdfViewer.Filename), obj.Data.Filename}},
new DialogOptions()
{
CloseDialogOnEsc = true,
CloseDialogOnOverlayClick = true,
Resizable = false,
Draggable = false,
Width = "80%",
Height = "90vh"
});
}
private void OnOrdersChanged()
{
InvokeAsync(() =>
{
_orders = LocalDbContext.Orders;
_dataGridRef?.Reload();
StateHasChanged();
return Task.CompletedTask;
});
}
public void Dispose()
{
EventBus.OrdersChanged -= OnOrdersChanged;
LocalDbContext?.Dispose();
DialogService?.Dispose();
}
}

1
Drab/Ui/_Imports.razor Normal file
View File

@@ -0,0 +1 @@
@using Radzen.Blazor

View File

@@ -0,0 +1,18 @@
@inherits LayoutComponentBase
<RadzenLayout>
<RadzenBody>
<div class="rz-p-0" style="margin: auto; width: 100%; max-width: 1900px !important;">
@Body
</div>
</RadzenBody>
</RadzenLayout>
<div id="blazor-error-ui" data-nosnippet>
An unhandled error has occurred.
<a href="." class="reload">Reload</a>
<span class="dismiss">🗙</span>
</div>
<RadzenDialog/>
<RadzenNotification/>
<RadzenTooltip/>
<RadzenContextMenu/>

View File

@@ -0,0 +1,9 @@
<object data="@($"/pdf/{Filename}")"
style="width: 100%; height: 80vh; border: 1px solid gray"
type="application/pdf" width="100%" height="500px">
</object>
@code {
[Parameter]
public string Filename { get; set; } = string.Empty;
}

View File

@@ -0,0 +1,12 @@
@using Microsoft.AspNetCore.Components.Routing
<Router AppAssembly="@typeof(App).Assembly">
<Found Context="routeData">
<RouteView RouteData="routeData" DefaultLayout="@typeof(MainLayout)"/>
</Found>
<NotFound>
<LayoutView Layout="@typeof(MainLayout)">
<p>404 nie znaleziono strony</p>
</LayoutView>
</NotFound>
</Router>