Add accounts page

This commit is contained in:
2025-11-27 09:37:18 +09:00
parent 28cfe99c78
commit bca845296a
11 changed files with 164 additions and 47 deletions

View File

@ -0,0 +1,59 @@
@page "/objects/accounts"
@using Hcs.WebApp.Services
@using Microsoft.AspNetCore.Authorization
@using System.Security.Claims
@inherits DataPageBase<Account>
@attribute [Authorize]
@inject AccountService AccountService
<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="upload_file" Text="@parseButtonText" Disabled="@(state != DataPageState.Idle)" Click="@ParseDataAsync" ButtonStyle="ButtonStyle.Primary" />
<RadzenButton Icon="sync" Text="@syncButtonText" Disabled="@(state != DataPageState.Idle)" Click="@SyncDataAsync" ButtonStyle="ButtonStyle.Primary" />
</RadzenStack>
</RadzenColumn>
</RadzenRow>
<RadzenRow>
<RadzenColumn SizeMD="12">
<RadzenDataGrid TItem="Account" Data="@data" IsLoading="@(state != DataPageState.Idle)" AllowFiltering="true" AllowPaging="true" ShowPagingSummary="true" PageSizeOptions=@(new int[] { 5, 10, 20, 30 }) AllowSorting="true">
<Columns>
<RadzenDataGridColumn TItem="Account" Property="@nameof(SupplyContract.Id)" Title="ID" SortOrder="SortOrder.Descending" Resizable="false" Width="100px" MaxWidth="100px" />
<RadzenDataGridColumn TItem="Account" Property="@nameof(SupplyContract.HcsId)" Title="ID ГИС ЖКХ" />
<RadzenDataGridColumn TItem="Account" Property="@nameof(SupplyContract.ThirdPartyId)" Title="ID интеграции" />
<RadzenDataGridColumn TItem="Account" Property="@nameof(SupplyContract.SyncedAt)" Title="Дата синхронизации" />
</Columns>
</RadzenDataGrid>
</RadzenColumn>
</RadzenRow>
</RadzenStack>
</Content>
</AuthorizedContent>
@code {
protected override Campaign.CampaignType? SyncCampaignType => Campaign.CampaignType.ExportSupplyContracts_15_7_0_1;
protected override Campaign.CampaignType? ParseCampaignType => null;
protected override bool HasPermission(ClaimsPrincipal user)
{
return user.IsOperatorOrHigher();
}
protected override Task<IEnumerable<Account>> GetDataAsync()
{
return AccountService.GetAllAccountsAsync();
}
}

View File

@ -4,7 +4,7 @@
@using Microsoft.AspNetCore.Authorization
@using System.Security.Claims
@inherits SyncedPageBase<House>
@inherits DataPageBase<House>
@attribute [Authorize]
@ -21,13 +21,13 @@
</RadzenColumn>
<RadzenColumn Size="12" SizeMD="6">
<RadzenStack Orientation="Orientation.Horizontal" AlignItems="AlignItems.Center" JustifyContent="JustifyContent.End" Gap="0.5rem">
<RadzenButton Icon="upload_file" Text="@parseButtonText" Disabled="@(state != SyncedPageState.Idle)" Click="@ParseDataAsync" ButtonStyle="ButtonStyle.Primary" />
<RadzenButton Icon="upload_file" Text="@parseButtonText" Disabled="@(state != DataPageState.Idle)" Click="@ParseDataAsync" ButtonStyle="ButtonStyle.Primary" />
</RadzenStack>
</RadzenColumn>
</RadzenRow>
<RadzenRow>
<RadzenColumn SizeMD="12">
<RadzenDataGrid TItem="House" Data="@data" IsLoading="@(state != SyncedPageState.Idle)" AllowFiltering="true" AllowPaging="true" ShowPagingSummary="true" PageSizeOptions=@(new int[] { 5, 10, 20, 30 }) AllowSorting="true">
<RadzenDataGrid TItem="House" Data="@data" IsLoading="@(state != DataPageState.Idle)" AllowFiltering="true" AllowPaging="true" ShowPagingSummary="true" PageSizeOptions=@(new int[] { 5, 10, 20, 30 }) AllowSorting="true">
<Columns>
<RadzenDataGridColumn TItem="House" Property="@nameof(House.Id)" Title="ID" SortOrder="SortOrder.Descending" Resizable="false" Width="100px" MaxWidth="100px" />
<RadzenDataGridColumn TItem="House" Property="@nameof(House.FiasId)" Title="ID ФИАС" />
@ -59,7 +59,9 @@
</AuthorizedContent>
@code {
protected override Campaign.CampaignType CampaignType => Campaign.CampaignType.ParseHousesData_15_7_0_1;
protected override Campaign.CampaignType? SyncCampaignType => null;
protected override Campaign.CampaignType? ParseCampaignType => Campaign.CampaignType.ParseHousesData_15_7_0_1;
protected override bool HasPermission(ClaimsPrincipal user)
{

View File

@ -4,7 +4,7 @@
@using Microsoft.AspNetCore.Authorization
@using System.Security.Claims
@inherits SyncedPageBase<SupplyContract>
@inherits DataPageBase<SupplyContract>
@attribute [Authorize]
@ -21,13 +21,13 @@
</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" />
<RadzenButton Icon="sync" Text="@syncButtonText" Disabled="@(state != DataPageState.Idle)" Click="@SyncDataAsync" ButtonStyle="ButtonStyle.Primary" />
</RadzenStack>
</RadzenColumn>
</RadzenRow>
<RadzenRow>
<RadzenColumn SizeMD="12">
<RadzenDataGrid TItem="SupplyContract" Data="@data" IsLoading="@(state != SyncedPageState.Idle)" AllowFiltering="true" AllowPaging="true" ShowPagingSummary="true" PageSizeOptions=@(new int[] { 5, 10, 20, 30 }) AllowSorting="true">
<RadzenDataGrid TItem="SupplyContract" Data="@data" IsLoading="@(state != DataPageState.Idle)" AllowFiltering="true" AllowPaging="true" ShowPagingSummary="true" PageSizeOptions=@(new int[] { 5, 10, 20, 30 }) AllowSorting="true">
<Columns>
<RadzenDataGridColumn TItem="SupplyContract" Property="@nameof(SupplyContract.Id)" Title="ID" SortOrder="SortOrder.Descending" Resizable="false" Width="100px" MaxWidth="100px" />
<RadzenDataGridColumn TItem="SupplyContract" Property="@nameof(SupplyContract.HcsId)" Title="ID ГИС ЖКХ" />
@ -42,7 +42,9 @@
</AuthorizedContent>
@code {
protected override Campaign.CampaignType CampaignType => Campaign.CampaignType.ExportSupplyContracts_15_7_0_1;
protected override Campaign.CampaignType? SyncCampaignType => Campaign.CampaignType.ExportSupplyContracts_15_7_0_1;
protected override Campaign.CampaignType? ParseCampaignType => null;
protected override bool HasPermission(ClaimsPrincipal user)
{

View File

@ -5,7 +5,7 @@
@using Microsoft.AspNetCore.Authorization
@using System.Security.Claims
@inherits SyncedPageBase<Registry>
@inherits DataPageBase<Registry>
@attribute [Authorize]
@ -22,13 +22,13 @@
</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" />
<RadzenButton Icon="sync" Text="@syncButtonText" Disabled="@(state != DataPageState.Idle)" Click="@SyncDataAsync" ButtonStyle="ButtonStyle.Primary" />
</RadzenStack>
</RadzenColumn>
</RadzenRow>
<RadzenRow>
<RadzenColumn SizeMD="12">
<RadzenDataGrid TItem="Registry" 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">
<RadzenDataGrid TItem="Registry" Data="@data" RowExpand="@RowExpandAsync" IsLoading="@(state != DataPageState.Idle)" AllowFiltering="true" AllowPaging="true" ShowPagingSummary="true" PageSizeOptions=@(new int[] { 5, 10, 20, 30 }) AllowSorting="true" ExpandMode="DataGridExpandMode.Single">
<Template Context="registry">
<RadzenDataGrid Data="@registry.Elements" AllowFiltering="true" AllowSorting="true">
<Columns>
@ -55,7 +55,9 @@
</AuthorizedContent>
@code {
protected override Campaign.CampaignType CampaignType => Campaign.CampaignType.ExportCommonRegistryElements_15_7_0_1;
protected override Campaign.CampaignType? SyncCampaignType => Campaign.CampaignType.ExportCommonRegistryElements_15_7_0_1;
protected override Campaign.CampaignType? ParseCampaignType => null;
protected override bool HasPermission(ClaimsPrincipal user)
{

View File

@ -5,7 +5,7 @@
@using Microsoft.AspNetCore.Authorization
@using System.Security.Claims
@inherits SyncedPageBase<Registry>
@inherits DataPageBase<Registry>
@attribute [Authorize]
@ -22,13 +22,13 @@
</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" />
<RadzenButton Icon="sync" Text="@syncButtonText" Disabled="@(state != DataPageState.Idle)" Click="@SyncDataAsync" ButtonStyle="ButtonStyle.Primary" />
</RadzenStack>
</RadzenColumn>
</RadzenRow>
<RadzenRow>
<RadzenColumn SizeMD="12">
<RadzenDataGrid TItem="Registry" 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">
<RadzenDataGrid TItem="Registry" Data="@data" RowExpand="@RowExpandAsync" IsLoading="@(state != DataPageState.Idle)" AllowFiltering="true" AllowPaging="true" ShowPagingSummary="true" PageSizeOptions=@(new int[] { 5, 10, 20, 30 }) AllowSorting="true" ExpandMode="DataGridExpandMode.Single">
<Template Context="registry">
<RadzenDataGrid Data="@registry.Elements" AllowFiltering="true" AllowSorting="true">
<Columns>
@ -55,7 +55,9 @@
</AuthorizedContent>
@code {
protected override Campaign.CampaignType CampaignType => Campaign.CampaignType.ExportPrivateRegistryElements_15_7_0_1;
protected override Campaign.CampaignType? SyncCampaignType => Campaign.CampaignType.ExportPrivateRegistryElements_15_7_0_1;
protected override Campaign.CampaignType? ParseCampaignType => null;
protected override bool HasPermission(ClaimsPrincipal user)
{