118 lines
5.3 KiB
Plaintext
118 lines
5.3 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"
|
|
ValidationEnabled="false"
|
|
CustomizeEditModel="CustomizeEditModel"
|
|
EditMode="GridEditMode.EditForm"
|
|
ColumnResizeMode="GridColumnResizeMode.NextColumn"
|
|
DetailExpandButtonDisplayMode="DetailExpandButtonDisplayMode">
|
|
<Columns>
|
|
<DxGridCommandColumn Width="135" MinWidth="135" DeleteButtonVisible="AcDomain.IsDeveloperVersion" EditButtonVisible="AcDomain.IsDeveloperVersion" FixedPosition="GridColumnFixedPosition.Left" />
|
|
<DxGridDataColumn FieldName="Id" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" DisplayFormat="N" />
|
|
<DxGridDataColumn FieldName="UserId" Caption="UserId" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" DisplayFormat="N" />
|
|
@{
|
|
var userEmailFieldName = $"{nameof(UserProductMapping.User)}.{nameof(User.EmailAddress)}";
|
|
}
|
|
<DxGridDataColumn FieldName="@userEmailFieldName" Caption="User email" SortIndex="0" />
|
|
@* <DxGridDataColumn FieldName="@nameof(UserProductMapping.User.EmailAddress)" Caption="User name" /> *@
|
|
<DxGridDataColumn FieldName="ProductId" Caption="ServiceId" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" DisplayFormat="N" />
|
|
@{
|
|
var productNameFieldName = $"{nameof(UserProductMapping.Product)}.{nameof(Product.Name)}";
|
|
}
|
|
<DxGridDataColumn FieldName="@productNameFieldName" Caption="Service name" />
|
|
|
|
@* <DxGridDataColumn FieldName="@nameof(UserProductMapping.Product.Name)" Caption="Service name" /> *@
|
|
@* <DxGridDataColumn FieldName="UserProductMapping.Product.Name" Caption="Service name" /> *@
|
|
@* <DxGridDataColumn FieldName="@nameof(Product.ServiceProvider.Name)" Caption="Company name" /> *@
|
|
<DxGridDataColumn FieldName="Permissions" />
|
|
<DxGridDataColumn FieldName="Created" DisplayFormat="g" Width="140" CaptionAlignment="GridTextAlignment.Center" TextAlignment="GridTextAlignment.Center" />
|
|
<DxGridDataColumn FieldName="Modified" DisplayFormat="g" Width="140" CaptionAlignment="GridTextAlignment.Center" TextAlignment="GridTextAlignment.Center" />
|
|
</Columns>
|
|
<DetailRowTemplate>
|
|
@{
|
|
<DxTabs>
|
|
<DxTabPage Text="Products">
|
|
<ProductDetailGridComponent GetAllTag="SignalRTags.GetProductsById" ContextId="((UserProductMapping)context.DataItem).ProductId" />
|
|
</DxTabPage>
|
|
</DxTabs>
|
|
}
|
|
</DetailRowTemplate>
|
|
|
|
<EditFormTemplate Context="userEditFormContext">
|
|
@{
|
|
var userProduct = (UserProductMapping)userEditFormContext.EditModel;
|
|
}
|
|
<DxFormLayout CssClass="w-100">
|
|
<DxFormLayoutItem Caption="User" 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 IProductRelation ParentData { get; set; } = null!;
|
|
|
|
[Parameter] public int GetAllTag { get; set; } = SignalRTags.GetAllUserProductMappings;
|
|
|
|
[Parameter] public GridDetailExpandButtonDisplayMode DetailExpandButtonDisplayMode { get; set; } = GridDetailExpandButtonDisplayMode.Never;
|
|
|
|
[Parameter] public Guid[]? ContextIds { get; set; }
|
|
|
|
private LoggerClient<UserProductMappingGridComponent> _logger;
|
|
|
|
List<Product> _availableProducts;
|
|
|
|
private ProductDetailGridComponent bleh;
|
|
|
|
|
|
protected override void OnInitialized()
|
|
{
|
|
_logger = new LoggerClient<UserProductMappingGridComponent>(LogWriters.ToArray());
|
|
|
|
base.OnInitialized();
|
|
}
|
|
|
|
void CustomizeEditModel(GridCustomizeEditModelEventArgs e)
|
|
{
|
|
if (!e.IsNew) return;
|
|
|
|
// var newProductMapping = new UserProductMapping
|
|
// {
|
|
// ProductId = Guid.NewGuid(),
|
|
// UserId = UserModelDtoDetail.Id,
|
|
// Permissions = 1
|
|
// };
|
|
|
|
//e.EditModel = newProductMapping;
|
|
}
|
|
} |