mirror of
https://gitlab.com/Hukuta47/cartrix.git
synced 2026-12-05 20:40:55 +00:00
57 lines
1.4 KiB
Plaintext
57 lines
1.4 KiB
Plaintext
@page "/Locations"
|
|
@using CartriX.Web.Pages.LocationsPage.Components
|
|
@using CartriX.Web.Pages.LocationsPage.Dialog
|
|
@inject HttpClient http
|
|
@inject DialogService DialogService
|
|
@inject NavigationManager navigationManager
|
|
|
|
<RadzenFabMenu Direction="Radzen.FabMenuDirection.Top">
|
|
<RadzenFabMenuItem Text="Добавить местоположение" Click=@(args => AddPrinterClick()) />
|
|
<RadzenFabMenuItem Text="Добавить принтер" Click=@(args => AddPrinterClick()) />
|
|
</RadzenFabMenu>
|
|
|
|
|
|
@if (IsDataLoading)
|
|
{
|
|
|
|
}
|
|
else if (locationItems.Count == 0)
|
|
{
|
|
|
|
}
|
|
else
|
|
{
|
|
<RadzenStack Orientation="Orientation.Horizontal">
|
|
@foreach (var location in locationItems)
|
|
{
|
|
<LocationCard locationItem="location"/>
|
|
}
|
|
<RadzenCard>
|
|
<RadzenIcon Icon="Add" />
|
|
</RadzenCard>
|
|
</RadzenStack>
|
|
|
|
}
|
|
@code
|
|
{
|
|
bool IsDataLoading;
|
|
List<Models.Location.LocationItem> locationItems = new();
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
IsDataLoading = true;
|
|
await GetLocationItems();
|
|
IsDataLoading = false;
|
|
}
|
|
async Task GetLocationItems()
|
|
{
|
|
var responce = await http.GetAsync(ApiRoutes.Location.List);
|
|
var json = await responce.Content.ReadAsStringAsync();
|
|
|
|
locationItems = JsonConvert.DeserializeObject<List<Models.Location.LocationItem>>(json) ?? new();
|
|
}
|
|
async Task AddPrinterClick()
|
|
{
|
|
var result = await DialogService.OpenAsync<AddPrinter>("");
|
|
}
|
|
} |