Files
hcs/Hcs.WebApp/Components/Pages/Objects/SupplyContracts.razor

59 lines
2.8 KiB
Plaintext

@page "/objects/supply-contracts"
@using Hcs.WebApp.Services
@using Microsoft.AspNetCore.Authorization
@using System.Security.Claims
@inherits DataPageBase<SupplyContract>
@attribute [Authorize]
@inject SupplyContractService SupplyContractService
<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 != DataPageState.Idle)" Click="@SyncDataAsync" ButtonStyle="ButtonStyle.Primary" />
</RadzenStack>
</RadzenColumn>
</RadzenRow>
<RadzenRow>
<RadzenColumn SizeMD="12">
<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 ГИС ЖКХ" />
<RadzenDataGridColumn TItem="SupplyContract" Property="@nameof(SupplyContract.ThirdPartyId)" Title="ID интеграции" />
<RadzenDataGridColumn TItem="SupplyContract" 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<SupplyContract>> GetDataAsync()
{
return SupplyContractService.GetAllSupplyContractsAsync();
}
}