mirror of
https://gitlab.com/Hukuta47/cartrix.git
synced 2026-12-05 12:30:55 +00:00
84 lines
3.0 KiB
Plaintext
84 lines
3.0 KiB
Plaintext
@page "/Printers"
|
|
@using CartriX.Web.Pages.PrintersPage.Components
|
|
@using CartriX.Web.Pages.PrintersPage.Dialog
|
|
@inject HttpClient http
|
|
@inject IJSRuntime JS
|
|
@inject DialogService DialogService
|
|
|
|
<PageTitle>АИС КартрИКС | Принтеры</PageTitle>
|
|
|
|
<style>
|
|
.printer-grid {
|
|
display: grid;
|
|
margin-top: 8px;
|
|
grid-template-columns: repeat(auto-fit, minmax(700px, 1fr));
|
|
gap: 16px;
|
|
overflow-x: scroll;
|
|
}
|
|
</style>
|
|
|
|
@if (isPhone)
|
|
{
|
|
<RadzenFab Icon="add" Text="Добавить принтер" Click="AddPrinterClick" />
|
|
}
|
|
|
|
<RadzenStack AlignItems="AlignItems.Stretch">
|
|
<RadzenCard Style="padding: 8px;">
|
|
<RadzenStack Orientation="Orientation.Horizontal" AlignItems="AlignItems.Center" JustifyContent="JustifyContent.SpaceBetween">
|
|
<RadzenText Text="Местоположения" TextStyle="TextStyle.DisplayH5" />
|
|
@if (!isPhone)
|
|
{
|
|
<RadzenButton Text="Добавить принтер" Click="AddPrinterClick" Style="width: 210px" />
|
|
}
|
|
</RadzenStack>
|
|
</RadzenCard>
|
|
@foreach (var location in locationItems)
|
|
{
|
|
<RadzenPanel AllowCollapse="true" Collapsed="true" Style="padding: 8px;">
|
|
<HeaderTemplate>
|
|
<RadzenStack Orientation="Orientation.Horizontal" JustifyContent="JustifyContent.SpaceBetween">
|
|
<RadzenStack Orientation="Orientation.Horizontal" Gap="8" Wrap="FlexWrap.Wrap">
|
|
<RadzenStack Orientation="Orientation.Horizontal" AlignItems="AlignItems.Center" Gap="8">
|
|
<RadzenIcon Icon="deployed_code" />
|
|
<RadzenText Text="@($"{location.Name}")" TextStyle="TextStyle.DisplayH6" />
|
|
</RadzenStack>
|
|
<RadzenBadge Text="@($"Количесво принтеров: {location.Printers.Count}")" Style="margin-right: 8px" />
|
|
</RadzenStack>
|
|
</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();
|
|
bool isPhone = false;
|
|
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
isPhone = await JS.InvokeAsync<bool>("getDeviceInfo");
|
|
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!;
|
|
}
|
|
async Task AddPrinterClick()
|
|
{
|
|
var result = await DialogService.OpenAsync<AddPrinter>("");
|
|
}
|
|
}
|