@page "/Printers" @using CartriX.Web.Pages.PrintersPage.Components @using CartriX.Web.Pages.PrintersPage.Dialog @inject HttpClient http @inject IJSRuntime JS @inject DialogService DialogService АИС КартрИКС | Принтеры @if (isPhone) { } @if (!isPhone) { } @if (IsDataLoading) {
@for (int i = 0; i < 10; i++) { }
} else if (locationItems.Count == 0) { } else {
@foreach (var location in locationItems) {
@foreach (var printer in location.Printers) { }
}
}
@code { List locationItems = new(); bool isPhone = false; bool IsDataLoading = true; protected override async Task OnInitializedAsync() { isPhone = await JS.InvokeAsync("getDeviceInfo"); await GetLocations(); IsDataLoading = false; } async Task GetLocations() { var responce = await http.GetAsync(Shared.Classes.ApiRoutes.Location.List); var json = await responce.Content.ReadAsStringAsync(); var result = JsonConvert.DeserializeObject>(json); locationItems = result!; } async Task AddPrinterClick() { var result = await DialogService.OpenAsync(""); } }