90 lines
4.1 KiB
Plaintext
90 lines
4.1 KiB
Plaintext
@page "/objects/houses"
|
|
|
|
@using Hcs.WebApp.Components.Dialogs
|
|
@using Hcs.WebApp.Services
|
|
@using Microsoft.AspNetCore.Authorization
|
|
@using System.Security.Claims
|
|
|
|
@inherits SyncedPageBase<House>
|
|
|
|
@attribute [Authorize]
|
|
|
|
@inject HouseService HouseService
|
|
@inject DialogService DialogService
|
|
|
|
<PageTitle>Жилищный фонд</PageTitle>
|
|
|
|
<AuthorizedContent Roles="@($"{AppRole.ADMINISTRATOR_TYPE},{AppRole.OPERATOR_TYPE}")">
|
|
<Content>
|
|
<RadzenStack>
|
|
<RadzenRow AlignItems="AlignItems.Center">
|
|
<RadzenColumn Size="12" SizeMD="6">
|
|
<RadzenText Text="Жилищный фонд" TextStyle="TextStyle.H5" class="rz-m-0" />
|
|
</RadzenColumn>
|
|
<RadzenColumn Size="12" SizeMD="6">
|
|
<RadzenStack Orientation="Orientation.Horizontal" AlignItems="AlignItems.Center" JustifyContent="JustifyContent.End" Gap="0.5rem">
|
|
<RadzenButton Icon="sync" Text="@syncButtonText" Disabled="@(state != SyncedPageState.Idle)" Click="@SyncDataAsync" ButtonStyle="ButtonStyle.Primary" />
|
|
</RadzenStack>
|
|
</RadzenColumn>
|
|
</RadzenRow>
|
|
<RadzenRow>
|
|
<RadzenColumn SizeMD="12">
|
|
<RadzenDataGrid TItem="House" Data="@data" RowExpand="@RowExpandAsync" IsLoading="@(state != SyncedPageState.Idle)" AllowFiltering="true" AllowPaging="true" ShowPagingSummary="true" PageSizeOptions=@(new int[] { 5, 10, 20, 30 }) AllowSorting="true" ExpandMode="DataGridExpandMode.Single">
|
|
@* <Template Context="house">
|
|
<RadzenDataGrid Data="@registry.Elements" AllowFiltering="true" AllowSorting="true">
|
|
<Columns>
|
|
<RadzenDataGridColumn Property="@nameof(RegistryElement.Code)" Title="Код" SortOrder="SortOrder.Ascending" Resizable="false" Width="100px" MaxWidth="100px" />
|
|
<RadzenDataGridColumn Property="@nameof(RegistryElement.GUID)" Title="Идентификатор" />
|
|
<RadzenDataGridColumn Filterable="false" Sortable="false" TextAlign="TextAlign.Center" Width="70px">
|
|
<Template Context="registryElement">
|
|
<RadzenButton Click="@(() => ShowElementAsync(registryElement))" @onclick:stopPropagation="true" ButtonStyle="ButtonStyle.Primary" Icon="visibility" Size="ButtonSize.Small" />
|
|
</Template>
|
|
</RadzenDataGridColumn>
|
|
</Columns>
|
|
</RadzenDataGrid>
|
|
</Template> *@
|
|
<Columns>
|
|
<RadzenDataGridColumn TItem="Registry" Property="@nameof(Registry.Number)" Title="Номер" Resizable="false" Width="100px" MaxWidth="100px" />
|
|
<RadzenDataGridColumn TItem="Registry" Property="@nameof(Registry.Name)" Title="Название" />
|
|
</Columns>
|
|
</RadzenDataGrid>
|
|
</RadzenColumn>
|
|
</RadzenRow>
|
|
</RadzenStack>
|
|
</Content>
|
|
</AuthorizedContent>
|
|
|
|
@code {
|
|
protected override Campaign.CampaignType CampaignType => Campaign.CampaignType.ExportHousesData_15_7_0_1;
|
|
|
|
protected override bool HasPermission(ClaimsPrincipal user)
|
|
{
|
|
return user.IsOperatorOrHigher();
|
|
}
|
|
|
|
protected override Task<IEnumerable<House>> GetDataAsync()
|
|
{
|
|
return HouseService.GetAllHousesAsync();
|
|
}
|
|
|
|
async Task RowExpandAsync(House house)
|
|
{
|
|
// TODO
|
|
}
|
|
|
|
async Task ShowElementAsync(RegistryElement registryElement)
|
|
{
|
|
// await DialogService.OpenAsync<ViewRegistryElement>(
|
|
// "Просмотр записи",
|
|
// new Dictionary<string, object>()
|
|
// {
|
|
// { nameof(ViewRegistryElement.RegistryElement), registryElement }
|
|
// },
|
|
// new DialogOptions()
|
|
// {
|
|
// Width = "420px",
|
|
// Height = "600px"
|
|
// });
|
|
}
|
|
}
|