mirror of
https://gitlab.com/Hukuta47/cartrix.git
synced 2026-12-05 04:20:55 +00:00
64 lines
1.9 KiB
Plaintext
64 lines
1.9 KiB
Plaintext
@inject HttpClient http
|
|
@inject DialogService DialogService
|
|
<RadzenStack>
|
|
<div style="height: 640px;">
|
|
<Pager DataToPrinterAdd="DataToPrinterAdd" page="page" IsPageValidChanged="OnPageValidationChanged" />
|
|
</div>
|
|
<RadzenStack Orientation="Orientation.Horizontal" JustifyContent="JustifyContent.SpaceBetween">
|
|
<RadzenButton Text="Назад" Style="width: 125px;" Click="PrevPage" Disabled="@(page == 1)" ButtonStyle="ButtonStyle.Secondary" />
|
|
@if (page == 3)
|
|
{
|
|
<RadzenButton Text="Добавить" Style="width: 125px;" ButtonStyle="ButtonStyle.Success" Click="AddPrinterClicked" />
|
|
}
|
|
else
|
|
{
|
|
<RadzenButton Text="Дальше" Style="width: 125px;" Click="NextPage" Disabled="@(!isCurrentPageValid)" ButtonStyle="ButtonStyle.Primary" />
|
|
}
|
|
</RadzenStack>
|
|
</RadzenStack>
|
|
|
|
@code {
|
|
int page = 1;
|
|
bool isCurrentPageValid = false;
|
|
|
|
Shared.Models.Printer.PrinterAdd DataToPrinterAdd = new()
|
|
{
|
|
PrinterConnetctionTypeId = 0,
|
|
Name = string.Empty,
|
|
Model = new()
|
|
{
|
|
Name = string.Empty,
|
|
Manufacturer = new()
|
|
{
|
|
Name = string.Empty
|
|
},
|
|
SupportedArticle = string.Empty
|
|
},
|
|
CountPrintedAllTime = 0,
|
|
VolumeBuiltInCartridge = 0,
|
|
LocationName = string.Empty,
|
|
PrintTypeId = 1
|
|
};
|
|
|
|
void OnPageValidationChanged(bool isValid)
|
|
{
|
|
isCurrentPageValid = isValid;
|
|
}
|
|
|
|
async Task NextPage()
|
|
{
|
|
page += (DataToPrinterAdd.PrinterConnetctionTypeId == 2) ? 2 : 1;
|
|
}
|
|
|
|
async Task PrevPage()
|
|
{
|
|
page -= (DataToPrinterAdd.PrinterConnetctionTypeId == 2) ? 2 : 1;
|
|
}
|
|
|
|
async Task AddPrinterClicked()
|
|
{
|
|
await http.PostAsJsonAsync(Shared.Classes.ApiRoutes.Printer.AddPrinter, DataToPrinterAdd);
|
|
DialogService.Close();
|
|
}
|
|
}
|