155 lines
4.8 KiB
Plaintext
155 lines
4.8 KiB
Plaintext
@using TIAM.Entities.Products
|
|
@using TIAM.Entities.Transfers
|
|
@using TIAM.Entities.Drivers
|
|
@using TIAM.Entities.Users
|
|
@using TIAM.Models.Dtos.Users
|
|
@using TIAM.Services
|
|
@using TIAMSharedUI.Shared.Components.Grids
|
|
@using TIAMWebApp.Shared.Application.Interfaces
|
|
@using TIAMWebApp.Shared.Application.Services
|
|
@using TIAMWebApp.Shared.Application.Utility
|
|
@using TIAM.Core.Loggers
|
|
@using AyCode.Core.Loggers
|
|
@using AyCode.Services.Loggers
|
|
@using AyCode.Core
|
|
@inject IServiceProviderDataService ServiceProviderDataService
|
|
@inject IEnumerable<IAcLogWriterClientBase> LogWriters
|
|
@inject AdminSignalRClient AdminSignalRClient
|
|
|
|
|
|
<UserProductMappingGrid Logger="_logger"
|
|
ContextIds="ContextIds"
|
|
GetAllMessageTag="GetAllTag"
|
|
SignalRClient="AdminSignalRClient"
|
|
PageSize="10"
|
|
AutoExpandAllGroupRows="true"
|
|
KeyboardNavigationEnabled="KeyboardNavigationEnabled"
|
|
KeyFieldName="Id"
|
|
ValidationEnabled="false"
|
|
CustomizeEditModel="CustomizeEditModel"
|
|
EditMode="GridEditMode.EditForm"
|
|
ColumnResizeMode="GridColumnResizeMode.NextColumn"
|
|
ShowFilterRow="true">
|
|
<Columns>
|
|
<DxGridCommandColumn NewButtonVisible="true" Width="8%" FixedPosition="GridColumnFixedPosition.Left" />
|
|
<DxGridDataColumn FieldName="Id" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" />
|
|
<DxGridDataColumn FieldName="UserId" />
|
|
<DxGridDataColumn FieldName="ProductId" Width="40%" />
|
|
<DxGridDataColumn FieldName="Permissions" />
|
|
</Columns>
|
|
<DetailRowTemplate>
|
|
@{
|
|
if (ShowNestedRows)
|
|
{
|
|
<DxTabs>
|
|
|
|
<DxTabPage Text="Products">
|
|
<ProductDetailGridComponent GetAllTag="SignalRTags.GetProductsById" ContextId="((UserProductMapping)context.DataItem).ProductId" KeyboardNavigationEnabled="true" />
|
|
</DxTabPage>
|
|
|
|
|
|
</DxTabs>
|
|
}
|
|
}
|
|
</DetailRowTemplate>
|
|
|
|
<EditFormTemplate Context="UserEditFormContext">
|
|
@{
|
|
var transfer2 = (UserProductMapping)UserEditFormContext.EditModel;
|
|
}
|
|
<DxFormLayout CssClass="w-100">
|
|
<DxFormLayoutItem Caption="UserId" ColSpanMd="4">
|
|
@UserEditFormContext.GetEditor("UserId")
|
|
</DxFormLayoutItem>
|
|
<DxFormLayoutItem Caption="Product:" ColSpanMd="4">
|
|
<DxComboBox Data="@_availableProducts" TextFieldName="Name" @bind-Value="((UserProductMapping)UserEditFormContext.EditModel).ProductId" />
|
|
</DxFormLayoutItem>
|
|
<DxFormLayoutItem Caption="Permissions" ColSpanMd="4">
|
|
@UserEditFormContext.GetEditor("Permissions")
|
|
</DxFormLayoutItem>
|
|
|
|
|
|
|
|
</DxFormLayout>
|
|
</EditFormTemplate>
|
|
|
|
</UserProductMappingGrid>
|
|
|
|
@code {
|
|
[Parameter]
|
|
public bool KeyboardNavigationEnabled { get; set; }
|
|
|
|
[Parameter] public IProductRelation ParentData { get; set; } = null!;
|
|
|
|
[Parameter] public int GetAllTag { get; set; } = SignalRTags.GetAllUserProductMappings;
|
|
|
|
[Parameter] public bool ShowNestedRows { get; set; } = false;
|
|
|
|
[Parameter] public Guid? ContextId { get; set; }
|
|
|
|
private Guid[] ContextIds = new Guid[0];
|
|
|
|
private LoggerClient<UserProductMappingGridComponent> _logger;
|
|
|
|
List<Product> _availableProducts;
|
|
|
|
private ProductDetailGridComponent bleh;
|
|
|
|
protected override void OnParametersSet()
|
|
{
|
|
if (ContextId != null)
|
|
{
|
|
ContextIds = new Guid[1];
|
|
ContextIds[0] = (Guid)ContextId;
|
|
}
|
|
base.OnParametersSet();
|
|
}
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
_logger = new LoggerClient<UserProductMappingGridComponent>(LogWriters.ToArray());
|
|
|
|
|
|
//_logger.Info($"DetailGridData: {_detailGridData.Count}");
|
|
}
|
|
|
|
void CustomizeEditModel(GridCustomizeEditModelEventArgs e)
|
|
{
|
|
if (!e.IsNew) return;
|
|
|
|
// var newProductMapping = new UserProductMapping
|
|
// {
|
|
// ProductId = Guid.NewGuid(),
|
|
// UserId = UserModelDtoDetail.Id,
|
|
// Permissions = 1
|
|
// };
|
|
|
|
//e.EditModel = newProductMapping;
|
|
}
|
|
|
|
|
|
async Task EditModelSaving(GridEditModelSavingEventArgs e)
|
|
{
|
|
if (e.IsNew)
|
|
|
|
_logger.Info("New orderData added");
|
|
else
|
|
_logger.Info("orderData updated");
|
|
|
|
await UpdateDataAsync();
|
|
}
|
|
|
|
async Task DataItemDeleting(GridDataItemDeletingEventArgs e)
|
|
{
|
|
|
|
_logger.Info("orderData deleted");
|
|
|
|
}
|
|
|
|
async Task UpdateDataAsync()
|
|
{
|
|
//refresh grid
|
|
_logger.Info("orderData grid refreshed");
|
|
}
|
|
|
|
} |