TourIAm/TIAMSharedUI/Pages/User/SysAdmins/ProfileGridComponent.razor

111 lines
3.3 KiB
Plaintext

@using TIAM.Entities.Products
@using TIAM.Entities.ServiceProviders
@using TIAM.Models.Dtos.Users
@using TIAMSharedUI.Shared.Components.Grids
@using TIAMWebApp.Shared.Application.Interfaces
@using TIAMWebApp.Shared.Application.Services
@using TIAMWebApp.Shared.Application.Utility
@using AyCode.Services.Loggers
@using TIAM.Core.Loggers
@using AyCode.Core
@using Profile = TIAM.Entities.Profiles.Profile
@inject IServiceProviderDataService serviceProviderDataService
@inject IUserDataService userDataService
@inject IEnumerable<IAcLogWriterClientBase> LogWriters
@inject AdminSignalRClient AdminSignalRClient
<ProfileDetailGrid @ref="_profileGrid"
ContextId="ProfileId"
Logger="_logger"
SignalRClient="AdminSignalRClient"
PageSize="5"
AutoExpandAllGroupRows="true"
KeyboardNavigationEnabled="KeyboardNavigationEnabled"
KeyFieldName="Id"
ValidationEnabled="false"
CustomizeEditModel="CustomizeEditModel"
EditMode="GridEditMode.EditForm"
ColumnResizeMode="GridColumnResizeMode.NextColumn"
ShowFilterRow="false">
<Columns>
<DxGridCommandColumn NewButtonVisible="false" Width="8%" FixedPosition="GridColumnFixedPosition.Left" />
<DxGridDataColumn FieldName="Id" GroupIndex="0" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" />
<DxGridDataColumn FieldName="Name" />
<DxGridDataColumn FieldName="FullName" />
<DxGridDataColumn FieldName="Created" Width="40%" />
<DxGridDataColumn FieldName="Modified" />
</Columns>
<DetailRowTemplate>
<DxTabs>
<DxTabPage Text="Address">
<AddressDetailGridComponent ParentData="((Profile)context.DataItem)" KeyboardNavigationEnabled="true" />
</DxTabPage>
</DxTabs>
</DetailRowTemplate>
</ProfileDetailGrid>
@code {
[Parameter]
public bool KeyboardNavigationEnabled { get; set; }
[Parameter]
public Guid ProfileId { get; set; } = Guid.Empty;
private ProfileDetailGrid _profileGrid = null!;
private LoggerClient<ProfileGridComponent> _logger = null!;
protected override async Task OnInitializedAsync()
{
_logger = new LoggerClient<ProfileGridComponent>(LogWriters.ToArray());
}
protected override void OnParametersSet()
{
_logger.DebugConditional(ProfileId.ToString());
base.OnParametersSet();
}
void CustomizeEditModel(GridCustomizeEditModelEventArgs e)
{
if (!e.IsNew) return;
//editmodel customize
}
async Task EditModelSaving(GridEditModelSavingEventArgs e)
{
if (e.IsNew)
//add new orderData to orderData array
_logger.Info("Data added");
else
_logger.Info("Data updated");
await UpdateDataAsync();
}
async Task DataItemDeleting(GridDataItemDeletingEventArgs e)
{
_logger.Info("orderData deleted");
}
async Task UpdateDataAsync()
{
//refresh grid
_logger.Info("orderData grid refreshed");
StateHasChanged();
}
}