Show elements in registry
This commit is contained in:
@ -38,16 +38,23 @@
|
|||||||
<RadzenAlert Visible="@hasError" AlertStyle="AlertStyle.Danger" Variant="Variant.Flat" Shade="Shade.Lighter" AllowClose="false">
|
<RadzenAlert Visible="@hasError" AlertStyle="AlertStyle.Danger" Variant="Variant.Flat" Shade="Shade.Lighter" AllowClose="false">
|
||||||
@errorMessage
|
@errorMessage
|
||||||
</RadzenAlert>
|
</RadzenAlert>
|
||||||
<RadzenDataGrid TItem="Registry" Data="@registries" RowSelect="@ViewRegistryAsync" IsLoading="@(state != CommonPageState.Idle)" AllowFiltering="true" AllowPaging="true" ShowPagingSummary="true" PageSizeOptions=@(new int[] { 5, 10, 20, 30 }) AllowSorting="true">
|
<RadzenDataGrid TItem="Registry" Data="@registries" RowExpand="@RowExpandAsync" IsLoading="@(state != CommonPageState.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>
|
||||||
|
<RadzenDataGridColumn Property="Code" Title="Код" SortOrder="SortOrder.Ascending" />
|
||||||
|
<RadzenDataGridColumn Property="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>
|
<Columns>
|
||||||
<RadzenDataGridColumn TItem="Registry" Property="Number" Title="Номер" Resizable="false" Width="100px" MaxWidth="100px" />
|
<RadzenDataGridColumn TItem="Registry" Property="Number" Title="Номер" Resizable="false" Width="100px" MaxWidth="100px" />
|
||||||
<RadzenDataGridColumn TItem="Registry" Property="Name" Title="Название" />
|
<RadzenDataGridColumn TItem="Registry" Property="Name" Title="Название" />
|
||||||
<RadzenDataGridColumn TItem="Registry" Filterable="false" Sortable="false" TextAlign="TextAlign.Center" Width="70px">
|
|
||||||
<Template Context="registry">
|
|
||||||
<RadzenButton Click="@(() => EditRegistryAsync(registry))" @onclick:stopPropagation="true" ButtonStyle="ButtonStyle.Primary" Icon="edit" Size="ButtonSize.Small" />
|
|
||||||
<RadzenButton Click="@(() => SyncRegistryAsync(registry))" @onclick:stopPropagation="true" ButtonStyle="ButtonStyle.Primary" Icon="sync" Size="ButtonSize.Small" />
|
|
||||||
</Template>
|
|
||||||
</RadzenDataGridColumn>
|
|
||||||
</Columns>
|
</Columns>
|
||||||
</RadzenDataGrid>
|
</RadzenDataGrid>
|
||||||
</RadzenColumn>
|
</RadzenColumn>
|
||||||
@ -117,17 +124,15 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async Task ViewRegistryAsync(Registry userWithRole)
|
async Task RowExpandAsync(Registry registry)
|
||||||
{
|
{
|
||||||
// TODO
|
if (registry.Elements == null)
|
||||||
|
{
|
||||||
|
registry.Elements = await RegistryService.GetRegistryElementsAsync(registry.Id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async Task EditRegistryAsync(Registry registry)
|
async Task ShowElementAsync(RegistryElement registryElement)
|
||||||
{
|
|
||||||
// TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
async Task SyncRegistryAsync(Registry registry)
|
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,6 +16,6 @@
|
|||||||
|
|
||||||
public virtual Operation LastSyncOperation { get; set; }
|
public virtual Operation LastSyncOperation { get; set; }
|
||||||
|
|
||||||
public virtual ICollection<RegistryElement> Elements { get; set; } = [];
|
public virtual ICollection<RegistryElement>? Elements { get; set; } = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -55,5 +55,11 @@ namespace Hcs.WebApp.Services
|
|||||||
});
|
});
|
||||||
await context.SaveChangesAsync();
|
await context.SaveChangesAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<ICollection<RegistryElement>> GetRegistryElementsAsync(Guid registryId)
|
||||||
|
{
|
||||||
|
using var context = GetNewContext();
|
||||||
|
return await context.Elements.Where(x => x.RegistryId == registryId).ToListAsync();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user