mirror of
https://gitlab.com/Hukuta47/cartrix.git
synced 2026-12-05 12:30:55 +00:00
Слегка изменил сущности Добавил страницу в Web Сделал компонент с карточками для принетров
54 lines
1.7 KiB
Plaintext
54 lines
1.7 KiB
Plaintext
@page "/Printers"
|
|
@using CartriX.Web.Pages.PrintersPage.Components
|
|
@inject HttpClient http
|
|
|
|
<style>
|
|
.printer-grid {
|
|
display: grid;
|
|
margin-top: 8px;
|
|
grid-template-columns: repeat(auto-fit, minmax(700px, 1fr));
|
|
gap: 16px;
|
|
overflow-x: scroll;
|
|
}
|
|
</style>
|
|
|
|
<RadzenStack AlignItems="AlignItems.Stretch">
|
|
@foreach (var location in locationItems)
|
|
{
|
|
<RadzenPanel AllowCollapse="true" Style="padding: 8px;">
|
|
<HeaderTemplate>
|
|
<RadzenStack Orientation="Orientation.Horizontal" AlignItems="AlignItems.Center">
|
|
<RadzenText Text="@($"{location.Name}")" TextStyle="TextStyle.DisplayH6" />
|
|
<RadzenBadge Text="@($"Количесво принтеров: {location.Printers.Count}")" />
|
|
</RadzenStack>
|
|
</HeaderTemplate>
|
|
<ChildContent>
|
|
<div class="printer-grid">
|
|
@foreach (var printer in location.Printers)
|
|
{
|
|
<PrinterCard Printer="printer" />
|
|
}
|
|
</div>
|
|
</ChildContent>
|
|
</RadzenPanel>
|
|
}
|
|
</RadzenStack>
|
|
|
|
@code {
|
|
|
|
List<Shared.Models.Location.LocationItem> locationItems = new();
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
await GetLocations();
|
|
}
|
|
|
|
async Task GetLocations()
|
|
{
|
|
var responce = await http.GetAsync(Shared.Classes.ApiRoutes.Location.List);
|
|
var json = await responce.Content.ReadAsStringAsync();
|
|
var result = JsonConvert.DeserializeObject<List<Shared.Models.Location.LocationItem>>(json);
|
|
locationItems = result!;
|
|
}
|
|
}
|