mirror of
https://gitlab.com/Hukuta47/cartrix.git
synced 2026-12-04 20:10:55 +00:00
Сделал заглушку на пустые списки местоположений
This commit is contained in:
1 parent
a96cd0e113
commit
90f944d2de
2 files changed
+88
-64
No files matched your search
@@ -7,7 +7,7 @@
|
||||
}
|
||||
},
|
||||
"ConnectionStrings": {
|
||||
"SQL": "Data Source = C:\\Users\\Hukuta\\Videos\\db.db"
|
||||
"SQL": "Data Source = C:\\Users\\hk\\Documents\\db.db"
|
||||
},
|
||||
"PrinterScanner": {
|
||||
"IntervalMinutes": 1
|
||||
|
||||
@@ -8,76 +8,100 @@
|
||||
<PageTitle>АИС КартрИКС | Принтеры</PageTitle>
|
||||
|
||||
<style>
|
||||
.printer-grid {
|
||||
display: grid;
|
||||
margin-top: 8px;
|
||||
grid-template-columns: repeat(auto-fit, minmax(700px, 1fr));
|
||||
gap: 16px;
|
||||
overflow-x: scroll;
|
||||
}
|
||||
.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" />
|
||||
<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 Orientation="Orientation.Vertical" Style="height: 100%; flex: 1; min-height: 0;">
|
||||
<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>
|
||||
@if (IsDataLoading)
|
||||
{
|
||||
<div style="display: flex; flex-wrap: wrap; gap: 8px;">
|
||||
@for (int i = 0; i < 10; i++)
|
||||
{
|
||||
<RadzenSkeleton Style="width: 100px; height: 100px;" />
|
||||
}
|
||||
</div>
|
||||
}
|
||||
else if (locationItems.Count == 0)
|
||||
{
|
||||
<RadzenCard Style="flex: 1; display: flex; align-items: center; justify-content: center;" Variant="Variant.Text">
|
||||
<RadzenStack Orientation="Orientation.Vertical" AlignItems="AlignItems.Center" Gap="8">
|
||||
<RadzenIcon Icon="location_disabled" Style="font-size: 64px;" />
|
||||
<RadzenText Text="Нет ни одного местоположения..." Style="font-size: 18px"/>
|
||||
</RadzenStack>
|
||||
</RadzenCard>
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
<div style="flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; min-height: 0;">
|
||||
@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>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
</RadzenStack>
|
||||
|
||||
@code {
|
||||
List<Shared.Models.Location.LocationItem> locationItems = new();
|
||||
bool isPhone = false;
|
||||
@code {
|
||||
List<Shared.Models.Location.LocationItem> locationItems = new();
|
||||
bool isPhone = false;
|
||||
bool IsDataLoading = true;
|
||||
|
||||
|
||||
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>("");
|
||||
}
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
isPhone = await JS.InvokeAsync<bool>("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<List<Shared.Models.Location.LocationItem>>(json);
|
||||
locationItems = result!;
|
||||
}
|
||||
async Task AddPrinterClick()
|
||||
{
|
||||
var result = await DialogService.OpenAsync<AddPrinter>("");
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user