improvements, fixes, etc...
This commit is contained in:
parent
2847f3ad2f
commit
fec32f6642
|
|
@ -118,6 +118,7 @@ namespace TIAM.Database.DataLayers.Admins
|
||||||
public Task<bool> RemoveUserAsync(Guid userId) => TransactionAsync(ctx => ctx.RemoveUser(userId));
|
public Task<bool> RemoveUserAsync(Guid userId) => TransactionAsync(ctx => ctx.RemoveUser(userId));
|
||||||
|
|
||||||
public Product? GetProductById(Guid contextId, bool includeUsers = true) => Session(ctx => ctx.GetProductById(contextId, includeUsers));
|
public Product? GetProductById(Guid contextId, bool includeUsers = true) => Session(ctx => ctx.GetProductById(contextId, includeUsers));
|
||||||
|
public Task<Product?> GetProductByIdAsync(Guid contextId, bool includeUsers = true) => SessionAsync(ctx => ctx.GetProductById(contextId, includeUsers));
|
||||||
|
|
||||||
public string GetProductsJson(bool includeUsers = true) => Session(ctx => ctx.ProductsWithUserRelations(includeUsers).ToJson());
|
public string GetProductsJson(bool includeUsers = true) => Session(ctx => ctx.ProductsWithUserRelations(includeUsers).ToJson());
|
||||||
public List<Product> GetProductsByServiceProviderId(Guid serviceProviderId, bool includeUsers = true) => Session(ctx => ctx.GetProductsByCompanyId(serviceProviderId, includeUsers).ToList());
|
public List<Product> GetProductsByServiceProviderId(Guid serviceProviderId, bool includeUsers = true) => Session(ctx => ctx.GetProductsByCompanyId(serviceProviderId, includeUsers).ToList());
|
||||||
|
|
|
||||||
|
|
@ -19,10 +19,11 @@ public class SignalRTags : AcSignalRTags
|
||||||
|
|
||||||
public const int GetCompany = 12;
|
public const int GetCompany = 12;
|
||||||
public const int GetCompanies = 13;
|
public const int GetCompanies = 13;
|
||||||
public const int GetCompaniesByContextId = 14;
|
public const int GetCompaniesById = 14;
|
||||||
public const int UpdateCompany = 15;
|
public const int GetCompaniesByContextId = 15;
|
||||||
public const int AddCompany = 16;
|
public const int UpdateCompany = 16;
|
||||||
public const int RemoveCompany = 17;
|
public const int AddCompany = 17;
|
||||||
|
public const int RemoveCompany = 18;
|
||||||
|
|
||||||
public const int GetTransferToDriver = 22;
|
public const int GetTransferToDriver = 22;
|
||||||
//public const int GetTransferToDrivers = 23;
|
//public const int GetTransferToDrivers = 23;
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
|
|
||||||
<CarDetailGrid Logger="_logger"
|
<CarDetailGrid Logger="_logger"
|
||||||
ContextIds="ContextIds"
|
ContextIds="new [] {ContextId}"
|
||||||
GetAllMessageTag="GetAllTag"
|
GetAllMessageTag="GetAllTag"
|
||||||
SignalRClient="AdminSignalRClient"
|
SignalRClient="AdminSignalRClient"
|
||||||
PageSize="10"
|
PageSize="10"
|
||||||
|
|
@ -29,10 +29,11 @@
|
||||||
CustomizeEditModel="CustomizeEditModel"
|
CustomizeEditModel="CustomizeEditModel"
|
||||||
EditMode="GridEditMode.EditForm"
|
EditMode="GridEditMode.EditForm"
|
||||||
ColumnResizeMode="GridColumnResizeMode.NextColumn"
|
ColumnResizeMode="GridColumnResizeMode.NextColumn"
|
||||||
|
DetailExpandButtonDisplayMode="DetailExpandButtonDisplayMode"
|
||||||
ShowFilterRow="true">
|
ShowFilterRow="true">
|
||||||
<Columns>
|
<Columns>
|
||||||
<DxGridCommandColumn NewButtonVisible="true" Width="8%" FixedPosition="GridColumnFixedPosition.Left" />
|
<DxGridCommandColumn Width="135" MinWidth="135" FixedPosition="GridColumnFixedPosition.Left" />
|
||||||
<DxGridDataColumn FieldName="Id" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" />
|
<DxGridDataColumn FieldName="Id" SortIndex="0" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" DisplayFormat="N" />
|
||||||
<DxGridDataColumn FieldName="UserProductMappingId" />
|
<DxGridDataColumn FieldName="UserProductMappingId" />
|
||||||
<DxGridDataColumn FieldName="CountryCode"/>
|
<DxGridDataColumn FieldName="CountryCode"/>
|
||||||
<DxGridDataColumn FieldName="LicencePlate"/>
|
<DxGridDataColumn FieldName="LicencePlate"/>
|
||||||
|
|
@ -45,88 +46,65 @@
|
||||||
</Columns>
|
</Columns>
|
||||||
<DetailRowTemplate>
|
<DetailRowTemplate>
|
||||||
@{
|
@{
|
||||||
if (ShowNestedRows)
|
<DxTabs>
|
||||||
{
|
|
||||||
<DxTabs>
|
|
||||||
|
|
||||||
<DxTabPage Text="Driving permissions assigned">
|
<DxTabPage Text="Driving permissions assigned">
|
||||||
<UserProductMappingGridComponent GetAllTag="SignalRTags.GetUserProductMappingById" ContextId="((Car)context.DataItem).UserProductMappingId" KeyboardNavigationEnabled="true" />
|
<UserProductMappingGridComponent GetAllTag="SignalRTags.GetUserProductMappingById" ContextIds="new[] { ((Car)context.DataItem).UserProductMappingId }" KeyboardNavigationEnabled="true"/>
|
||||||
</DxTabPage>
|
</DxTabPage>
|
||||||
|
|
||||||
</DxTabs>
|
</DxTabs>
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</DetailRowTemplate>
|
</DetailRowTemplate>
|
||||||
|
|
||||||
<EditFormTemplate Context="UserEditFormContext">
|
<EditFormTemplate Context="userEditFormContext">
|
||||||
@{
|
@{
|
||||||
var car = (Car)UserEditFormContext.EditModel;
|
var car = (Car)userEditFormContext.EditModel;
|
||||||
}
|
}
|
||||||
<DxFormLayout CssClass="w-100">
|
<DxFormLayout CssClass="w-100">
|
||||||
<DxFormLayoutItem Caption="Country code" ColSpanMd="4">
|
<DxFormLayoutItem Caption="Country code" ColSpanMd="4">
|
||||||
@UserEditFormContext.GetEditor("CountryCode")
|
@userEditFormContext.GetEditor("CountryCode")
|
||||||
</DxFormLayoutItem>
|
</DxFormLayoutItem>
|
||||||
<DxFormLayoutItem Caption="Licence plate" ColSpanMd="4">
|
<DxFormLayoutItem Caption="Licence plate" ColSpanMd="4">
|
||||||
@UserEditFormContext.GetEditor("LicencePlate")
|
@userEditFormContext.GetEditor("LicencePlate")
|
||||||
</DxFormLayoutItem>
|
</DxFormLayoutItem>
|
||||||
<DxFormLayoutItem Caption="Color" ColSpanMd="4">
|
<DxFormLayoutItem Caption="Color" ColSpanMd="4">
|
||||||
@UserEditFormContext.GetEditor("Color")
|
@userEditFormContext.GetEditor("Color")
|
||||||
</DxFormLayoutItem>
|
</DxFormLayoutItem>
|
||||||
<DxFormLayoutItem Caption="Manufacturer" ColSpanMd="4">
|
<DxFormLayoutItem Caption="Manufacturer" ColSpanMd="4">
|
||||||
@UserEditFormContext.GetEditor("Manufacture")
|
@userEditFormContext.GetEditor("Manufacture")
|
||||||
</DxFormLayoutItem>
|
</DxFormLayoutItem>
|
||||||
<DxFormLayoutItem Caption="Car model" ColSpanMd="4">
|
<DxFormLayoutItem Caption="Car model" ColSpanMd="4">
|
||||||
@UserEditFormContext.GetEditor("CarModel")
|
@userEditFormContext.GetEditor("CarModel")
|
||||||
</DxFormLayoutItem>
|
</DxFormLayoutItem>
|
||||||
<DxFormLayoutItem Caption="Year of make" ColSpanMd="4">
|
<DxFormLayoutItem Caption="Year of make" ColSpanMd="4">
|
||||||
@UserEditFormContext.GetEditor("YearOfMake")
|
@userEditFormContext.GetEditor("YearOfMake")
|
||||||
</DxFormLayoutItem>
|
</DxFormLayoutItem>
|
||||||
<DxFormLayoutItem Caption="Seat number" ColSpanMd="4">
|
<DxFormLayoutItem Caption="Seat number" ColSpanMd="4">
|
||||||
@UserEditFormContext.GetEditor("SeatNumber")
|
@userEditFormContext.GetEditor("SeatNumber")
|
||||||
</DxFormLayoutItem>
|
</DxFormLayoutItem>
|
||||||
<DxFormLayoutItem Caption="Motor type" ColSpanMd="4">
|
<DxFormLayoutItem Caption="Motor type" ColSpanMd="4">
|
||||||
@UserEditFormContext.GetEditor("CarMotorType")
|
@userEditFormContext.GetEditor("CarMotorType")
|
||||||
</DxFormLayoutItem>
|
</DxFormLayoutItem>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</DxFormLayout>
|
</DxFormLayout>
|
||||||
</EditFormTemplate>
|
</EditFormTemplate>
|
||||||
|
|
||||||
</CarDetailGrid>
|
</CarDetailGrid>
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
[Parameter]
|
[Parameter] public Guid ContextId { get; set; }
|
||||||
public bool KeyboardNavigationEnabled { get; set; }
|
[Parameter] public bool KeyboardNavigationEnabled { get; set; }
|
||||||
|
|
||||||
[Parameter] public ICarRelation ParentData { get; set; } = null!;
|
[Parameter] public ICarRelation ParentData { get; set; } = null!;
|
||||||
|
|
||||||
[Parameter] public int GetAllTag { get; set; } = SignalRTags.GetAllCars;
|
[Parameter] public int GetAllTag { get; set; } = SignalRTags.GetAllCars;
|
||||||
|
[Parameter] public GridDetailExpandButtonDisplayMode DetailExpandButtonDisplayMode { get; set; } = GridDetailExpandButtonDisplayMode.Never;
|
||||||
|
|
||||||
[Parameter] public bool ShowNestedRows { get; set; } = false;
|
private LoggerClient<CarDetailGridComponent> _logger = null!;
|
||||||
|
|
||||||
[Parameter] public Guid? ContextId { get; set; }
|
protected override void OnInitialized()
|
||||||
|
|
||||||
private Guid[] ContextIds = new Guid[0];
|
|
||||||
|
|
||||||
private LoggerClient<CarDetailGridComponent> _logger;
|
|
||||||
|
|
||||||
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<CarDetailGridComponent>(LogWriters.ToArray());
|
_logger = new LoggerClient<CarDetailGridComponent>(LogWriters.ToArray());
|
||||||
|
|
||||||
|
base.OnInitialized();
|
||||||
//_logger.Info($"DetailGridData: {_detailGridData.Count}");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CustomizeEditModel(GridCustomizeEditModelEventArgs e)
|
void CustomizeEditModel(GridCustomizeEditModelEventArgs e)
|
||||||
|
|
@ -134,53 +112,25 @@
|
||||||
if (e.IsNew)
|
if (e.IsNew)
|
||||||
{
|
{
|
||||||
var newCar = new Car
|
var newCar = new Car
|
||||||
{
|
{
|
||||||
Id = Guid.NewGuid(),
|
Id = Guid.NewGuid(),
|
||||||
UserProductMappingId = (Guid)ContextId,
|
UserProductMappingId = ContextId!,
|
||||||
CountryCode = 1,
|
CountryCode = 1,
|
||||||
LicencePlate = "ABC123",
|
LicencePlate = "ABC123",
|
||||||
Color = "White",
|
Color = "White",
|
||||||
Manufacture = "Manufacturer",
|
Manufacture = "Manufacturer",
|
||||||
CarModel = "Car model",
|
CarModel = "Car model",
|
||||||
YearOfMake = DateTime.Now.Year,
|
YearOfMake = DateTime.Now.Year,
|
||||||
SeatNumber = 5,
|
SeatNumber = 5,
|
||||||
CarMotorType = TIAM.Core.Enums.CarMotorType.Electric
|
CarMotorType = TIAM.Core.Enums.CarMotorType.Electric
|
||||||
};
|
};
|
||||||
|
|
||||||
e.EditModel = newCar;
|
e.EditModel = newCar;
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
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");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
|
|
||||||
<CarGrid Logger="_logger"
|
<CarGrid Logger="_logger"
|
||||||
ContextIds="ContextIds"
|
ContextIds="new [] {ContextId}"
|
||||||
GetAllMessageTag="GetAllTag"
|
GetAllMessageTag="GetAllTag"
|
||||||
SignalRClient="AdminSignalRClient"
|
SignalRClient="AdminSignalRClient"
|
||||||
PageSize="10"
|
PageSize="10"
|
||||||
|
|
@ -29,10 +29,11 @@
|
||||||
CustomizeEditModel="CustomizeEditModel"
|
CustomizeEditModel="CustomizeEditModel"
|
||||||
EditMode="GridEditMode.EditForm"
|
EditMode="GridEditMode.EditForm"
|
||||||
ColumnResizeMode="GridColumnResizeMode.NextColumn"
|
ColumnResizeMode="GridColumnResizeMode.NextColumn"
|
||||||
|
DetailExpandButtonDisplayMode="DetailExpandButtonDisplayMode"
|
||||||
ShowFilterRow="true">
|
ShowFilterRow="true">
|
||||||
<Columns>
|
<Columns>
|
||||||
<DxGridCommandColumn NewButtonVisible="true" Width="8%" FixedPosition="GridColumnFixedPosition.Left" />
|
<DxGridCommandColumn Width="135" MinWidth="135" FixedPosition="GridColumnFixedPosition.Left" />
|
||||||
<DxGridDataColumn FieldName="Id" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" />
|
<DxGridDataColumn FieldName="Id" SortIndex="0" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" DisplayFormat="N" />
|
||||||
<DxGridDataColumn FieldName="UserProductMappingId" />
|
<DxGridDataColumn FieldName="UserProductMappingId" />
|
||||||
<DxGridDataColumn FieldName="CountryCode"/>
|
<DxGridDataColumn FieldName="CountryCode"/>
|
||||||
<DxGridDataColumn FieldName="LicencePlate"/>
|
<DxGridDataColumn FieldName="LicencePlate"/>
|
||||||
|
|
@ -45,127 +46,69 @@
|
||||||
</Columns>
|
</Columns>
|
||||||
<DetailRowTemplate>
|
<DetailRowTemplate>
|
||||||
@{
|
@{
|
||||||
if (ShowNestedRows)
|
<DxTabs>
|
||||||
{
|
|
||||||
<DxTabs>
|
|
||||||
|
|
||||||
<DxTabPage Text="Driving permissions assigned">
|
<DxTabPage Text="Driving permissions assigned">
|
||||||
<UserProductMappingGridComponent GetAllTag="SignalRTags.GetUserProductMappingById" ContextId="((Car)context.DataItem).UserProductMappingId" KeyboardNavigationEnabled="true" />
|
<UserProductMappingGridComponent GetAllTag="SignalRTags.GetUserProductMappingById" ContextIds="new[] { ((Car)context.DataItem).UserProductMappingId }" KeyboardNavigationEnabled="true"/>
|
||||||
</DxTabPage>
|
</DxTabPage>
|
||||||
|
|
||||||
</DxTabs>
|
</DxTabs>
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</DetailRowTemplate>
|
</DetailRowTemplate>
|
||||||
|
|
||||||
<EditFormTemplate Context="UserEditFormContext">
|
<EditFormTemplate Context="userEditFormContext">
|
||||||
@{
|
@{
|
||||||
var car = (Car)UserEditFormContext.EditModel;
|
var car = (Car)userEditFormContext.EditModel;
|
||||||
}
|
}
|
||||||
<DxFormLayout CssClass="w-100">
|
<DxFormLayout CssClass="w-100">
|
||||||
<DxFormLayoutItem Caption="Country code" ColSpanMd="4">
|
<DxFormLayoutItem Caption="Country code" ColSpanMd="4">
|
||||||
@UserEditFormContext.GetEditor("CountryCode")
|
@userEditFormContext.GetEditor("CountryCode")
|
||||||
</DxFormLayoutItem>
|
</DxFormLayoutItem>
|
||||||
<DxFormLayoutItem Caption="Licence plate" ColSpanMd="4">
|
<DxFormLayoutItem Caption="Licence plate" ColSpanMd="4">
|
||||||
@UserEditFormContext.GetEditor("LicencePlate")
|
@userEditFormContext.GetEditor("LicencePlate")
|
||||||
</DxFormLayoutItem>
|
</DxFormLayoutItem>
|
||||||
<DxFormLayoutItem Caption="Color" ColSpanMd="4">
|
<DxFormLayoutItem Caption="Color" ColSpanMd="4">
|
||||||
@UserEditFormContext.GetEditor("Color")
|
@userEditFormContext.GetEditor("Color")
|
||||||
</DxFormLayoutItem>
|
</DxFormLayoutItem>
|
||||||
<DxFormLayoutItem Caption="Manufacturer" ColSpanMd="4">
|
<DxFormLayoutItem Caption="Manufacturer" ColSpanMd="4">
|
||||||
@UserEditFormContext.GetEditor("Manufacture")
|
@userEditFormContext.GetEditor("Manufacture")
|
||||||
</DxFormLayoutItem>
|
</DxFormLayoutItem>
|
||||||
<DxFormLayoutItem Caption="Licence plate" ColSpanMd="4">
|
<DxFormLayoutItem Caption="Licence plate" ColSpanMd="4">
|
||||||
@UserEditFormContext.GetEditor("CarModel")
|
@userEditFormContext.GetEditor("CarModel")
|
||||||
</DxFormLayoutItem>
|
</DxFormLayoutItem>
|
||||||
<DxFormLayoutItem Caption="Licence plate" ColSpanMd="4">
|
<DxFormLayoutItem Caption="Licence plate" ColSpanMd="4">
|
||||||
@UserEditFormContext.GetEditor("YearOfMake")
|
@userEditFormContext.GetEditor("YearOfMake")
|
||||||
</DxFormLayoutItem>
|
</DxFormLayoutItem>
|
||||||
<DxFormLayoutItem Caption="Licence plate" ColSpanMd="4">
|
<DxFormLayoutItem Caption="Licence plate" ColSpanMd="4">
|
||||||
@UserEditFormContext.GetEditor("SeatNumber")
|
@userEditFormContext.GetEditor("SeatNumber")
|
||||||
</DxFormLayoutItem>
|
</DxFormLayoutItem>
|
||||||
<DxFormLayoutItem Caption="Licence plate" ColSpanMd="4">
|
<DxFormLayoutItem Caption="Licence plate" ColSpanMd="4">
|
||||||
@UserEditFormContext.GetEditor("CarMotorType")
|
@userEditFormContext.GetEditor("CarMotorType")
|
||||||
</DxFormLayoutItem>
|
</DxFormLayoutItem>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</DxFormLayout>
|
</DxFormLayout>
|
||||||
</EditFormTemplate>
|
</EditFormTemplate>
|
||||||
|
|
||||||
</CarGrid>
|
</CarGrid>
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
[Parameter]
|
[Parameter] public Guid ContextId { get; set; }
|
||||||
public bool KeyboardNavigationEnabled { get; set; }
|
[Parameter] public bool KeyboardNavigationEnabled { get; set; }
|
||||||
|
|
||||||
[Parameter] public ICarRelation ParentData { get; set; } = null!;
|
[Parameter] public ICarRelation ParentData { get; set; } = null!;
|
||||||
|
|
||||||
[Parameter] public int GetAllTag { get; set; } = SignalRTags.GetAllCars;
|
[Parameter] public int GetAllTag { get; set; } = SignalRTags.GetAllCars;
|
||||||
|
[Parameter] public GridDetailExpandButtonDisplayMode DetailExpandButtonDisplayMode { get; set; } = GridDetailExpandButtonDisplayMode.Never;
|
||||||
|
|
||||||
[Parameter] public bool ShowNestedRows { get; set; } = false;
|
private LoggerClient<CarGridComponent> _logger = null!;
|
||||||
|
|
||||||
[Parameter] public Guid? ContextId { get; set; }
|
protected override void OnInitialized()
|
||||||
|
|
||||||
private Guid[] ContextIds = new Guid[0];
|
|
||||||
|
|
||||||
private LoggerClient<CarGridComponent> _logger;
|
|
||||||
|
|
||||||
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<CarGridComponent>(LogWriters.ToArray());
|
_logger = new LoggerClient<CarGridComponent>(LogWriters.ToArray());
|
||||||
|
|
||||||
|
base.OnInitialized();
|
||||||
//_logger.Info($"DetailGridData: {_detailGridData.Count}");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CustomizeEditModel(GridCustomizeEditModelEventArgs e)
|
void CustomizeEditModel(GridCustomizeEditModelEventArgs e)
|
||||||
{
|
{
|
||||||
if (!e.IsNew) return;
|
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");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -12,6 +12,7 @@
|
||||||
@using AyCode.Core.Loggers
|
@using AyCode.Core.Loggers
|
||||||
@using AyCode.Services.Loggers
|
@using AyCode.Services.Loggers
|
||||||
@using AyCode.Core
|
@using AyCode.Core
|
||||||
|
@using AyCode.Core.Extensions
|
||||||
@inject IServiceProviderDataService ServiceProviderDataService
|
@inject IServiceProviderDataService ServiceProviderDataService
|
||||||
@inject IEnumerable<IAcLogWriterClientBase> LogWriters
|
@inject IEnumerable<IAcLogWriterClientBase> LogWriters
|
||||||
@inject AdminSignalRClient AdminSignalRClient
|
@inject AdminSignalRClient AdminSignalRClient
|
||||||
|
|
@ -31,14 +32,14 @@
|
||||||
<label for="emailID" class="demo-text mt-4 mb-1">
|
<label for="emailID" class="demo-text mt-4 mb-1">
|
||||||
Put user email here
|
Put user email here
|
||||||
</label>
|
</label>
|
||||||
<DxMaskedInput @ref="emailInput"
|
<DxMaskedInput @ref="_emailInput"
|
||||||
@bind-Value="@Email"
|
@bind-Value="@Email"
|
||||||
CssClass="cw-320"
|
CssClass="cw-320"
|
||||||
Mask="@EmailMask"
|
Mask="@EmailMask"
|
||||||
InputId="emailID"
|
InputId="emailID"
|
||||||
MaskMode="MaskMode.RegEx" />
|
MaskMode="MaskMode.RegEx" />
|
||||||
<DxButton @ref="button1" CssClass="popup-button my-1 ms-2" Visible="true" RenderStyle="ButtonRenderStyle.Primary" Text="Find user" Click="@FindUser" />
|
<DxButton @ref="_button1" CssClass="popup-button my-1 ms-2" Visible="true" RenderStyle="ButtonRenderStyle.Primary" Text="Find user" Click="@FindUser" />
|
||||||
<div style="@errorCss" @ref="errorMessage"><p>User not found, type another email please</p></div>
|
<div style="@_errorCss" @ref="_errorMessage"><p>User not found, type another email please</p></div>
|
||||||
<DxGrid Data="@FoundUsers" RowClick="@OnRowClick">
|
<DxGrid Data="@FoundUsers" RowClick="@OnRowClick">
|
||||||
<Columns>
|
<Columns>
|
||||||
<DxGridDataColumn FieldName="Id" Caption="ID" />
|
<DxGridDataColumn FieldName="Id" Caption="ID" />
|
||||||
|
|
@ -54,9 +55,10 @@
|
||||||
</div>
|
</div>
|
||||||
</FooterContentTemplate>
|
</FooterContentTemplate>
|
||||||
</DxPopup>
|
</DxPopup>
|
||||||
|
|
||||||
<UserProductMappingDriverGrid Logger="_logger"
|
<UserProductMappingDriverGrid Logger="_logger"
|
||||||
@ref="_driverGrid"
|
@ref="_driverGrid"
|
||||||
ContextIds="ContextIds"
|
ContextIds="new [] {ContextId}"
|
||||||
GetAllMessageTag="GetAllTag"
|
GetAllMessageTag="GetAllTag"
|
||||||
SignalRClient="AdminSignalRClient"
|
SignalRClient="AdminSignalRClient"
|
||||||
PageSize="10"
|
PageSize="10"
|
||||||
|
|
@ -68,18 +70,17 @@
|
||||||
CustomizeEditModel="CustomizeEditModel"
|
CustomizeEditModel="CustomizeEditModel"
|
||||||
EditMode="GridEditMode.EditForm"
|
EditMode="GridEditMode.EditForm"
|
||||||
ColumnResizeMode="GridColumnResizeMode.NextColumn"
|
ColumnResizeMode="GridColumnResizeMode.NextColumn"
|
||||||
|
DetailExpandButtonDisplayMode="DetailExpandButtonDisplayMode"
|
||||||
ShowFilterRow="true">
|
ShowFilterRow="true">
|
||||||
<Columns>
|
<Columns>
|
||||||
<DxGridCommandColumn NewButtonVisible="true" Width="8%" FixedPosition="GridColumnFixedPosition.Left" />
|
<DxGridCommandColumn Width="135" MinWidth="135" FixedPosition="GridColumnFixedPosition.Left" />
|
||||||
<DxGridDataColumn FieldName="Id" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" />
|
<DxGridDataColumn FieldName="Id" SortIndex="0" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" DisplayFormat="N" />
|
||||||
<DxGridDataColumn FieldName="UserId" />
|
<DxGridDataColumn FieldName="UserId" />
|
||||||
<DxGridDataColumn FieldName="ProductId" Width="40%" />
|
<DxGridDataColumn FieldName="ProductId" Width="40%" />
|
||||||
<DxGridDataColumn FieldName="Permissions" />
|
<DxGridDataColumn FieldName="Permissions" />
|
||||||
</Columns>
|
</Columns>
|
||||||
<DetailRowTemplate>
|
<DetailRowTemplate>
|
||||||
@{
|
@{
|
||||||
if (ShowNestedRows)
|
|
||||||
{
|
|
||||||
<DxTabs>
|
<DxTabs>
|
||||||
|
|
||||||
<DxTabPage Text="Products">
|
<DxTabPage Text="Products">
|
||||||
|
|
@ -89,7 +90,6 @@
|
||||||
<CarDetailGridComponent GetAllTag="SignalRTags.GetCarsForUserProductMapping" ContextId="((UserProductMapping)context.DataItem).Id" KeyboardNavigationEnabled="true" />
|
<CarDetailGridComponent GetAllTag="SignalRTags.GetCarsForUserProductMapping" ContextId="((UserProductMapping)context.DataItem).Id" KeyboardNavigationEnabled="true" />
|
||||||
</DxTabPage>
|
</DxTabPage>
|
||||||
</DxTabs>
|
</DxTabs>
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</DetailRowTemplate>
|
</DetailRowTemplate>
|
||||||
|
|
||||||
|
|
@ -122,114 +122,76 @@
|
||||||
</UserProductMappingDriverGrid>
|
</UserProductMappingDriverGrid>
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
[Parameter]
|
[Parameter] public Guid ContextId { get; set; }
|
||||||
public bool KeyboardNavigationEnabled { get; set; }
|
[Parameter] public bool KeyboardNavigationEnabled { get; set; }
|
||||||
|
|
||||||
[Parameter] public IProductRelation ParentData { get; set; } = null!;
|
[Parameter] public IProductRelation ParentData { get; set; } = null!;
|
||||||
|
|
||||||
[Parameter] public int GetAllTag { get; set; } = SignalRTags.GetAllUserProductMappings;
|
[Parameter] public int GetAllTag { get; set; } = SignalRTags.GetAllUserProductMappings;
|
||||||
|
[Parameter] public GridDetailExpandButtonDisplayMode DetailExpandButtonDisplayMode { get; set; } = GridDetailExpandButtonDisplayMode.Never;
|
||||||
[Parameter] public bool ShowNestedRows { get; set; } = false;
|
|
||||||
|
|
||||||
[Parameter] public Guid? ContextId { get; set; }
|
|
||||||
|
|
||||||
private Guid[] ContextIds = new Guid[0];
|
|
||||||
|
|
||||||
private LoggerClient<UserProductMappingGridComponent> _logger;
|
private LoggerClient<UserProductMappingGridComponent> _logger;
|
||||||
|
|
||||||
List<Product> _availableProducts;
|
List<Product> _availableProducts;
|
||||||
|
|
||||||
private UserProductMappingDriverGrid _driverGrid;
|
private UserProductMappingDriverGrid _driverGrid;
|
||||||
|
|
||||||
private UserProductMapping tempProductMapping;
|
private UserProductMapping _tempProductMapping;
|
||||||
|
|
||||||
bool PopupVisible { get; set; }
|
bool PopupVisible { get; set; }
|
||||||
private DxMaskedInput<string> emailInput;
|
private DxMaskedInput<string> _emailInput;
|
||||||
private DxButton button1;
|
private DxButton _button1;
|
||||||
private ElementReference errorMessage;
|
private ElementReference _errorMessage;
|
||||||
private string errorCss = "display: none;";
|
private string _errorCss = "display: none;";
|
||||||
private List<UserModelDto> FoundUsers { get; set; } = new List<UserModelDto>();
|
private List<UserModelDto> FoundUsers { get; set; } = new List<UserModelDto>();
|
||||||
|
|
||||||
|
|
||||||
private string Email { get; set; } = "email@email.com";
|
private string Email { get; set; } = "email@email.com";
|
||||||
string EmailMask { get; set; } = @"(\w|[.-])+@(\w|-)+\.(\w|-){2,4}";
|
string EmailMask { get; set; } = @"(\w|[.-])+@(\w|-)+\.(\w|-){2,4}";
|
||||||
UserModelDto ChosenUser = null;
|
UserModelDto _chosenUser = null!;
|
||||||
|
|
||||||
protected override void OnParametersSet()
|
protected override void OnInitialized()
|
||||||
{
|
|
||||||
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 = new LoggerClient<UserProductMappingGridComponent>(LogWriters.ToArray());
|
||||||
|
|
||||||
|
base.OnInitialized();
|
||||||
//_logger.Info($"DetailGridData: {_detailGridData.Count}");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CustomizeEditModel(GridCustomizeEditModelEventArgs e)
|
void CustomizeEditModel(GridCustomizeEditModelEventArgs e)
|
||||||
{
|
{
|
||||||
if (!e.IsNew) return;
|
if (!e.IsNew) return;
|
||||||
UserProductMapping newUPM = (UserProductMapping)e.EditModel;
|
|
||||||
newUPM.ProductId = (Guid)ContextId!;
|
if (ContextId.IsNullOrEmpty())
|
||||||
|
{
|
||||||
|
_logger.Warning($"ContextId.IsNullOrEmpty()");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var newUpm = (UserProductMapping)e.EditModel;
|
||||||
|
newUpm.ProductId = ContextId;
|
||||||
|
|
||||||
var newProductMapping = new UserProductMapping
|
var newProductMapping = new UserProductMapping
|
||||||
{
|
{
|
||||||
Id = Guid.NewGuid(),
|
Id = Guid.NewGuid(),
|
||||||
ProductId = (Guid)ContextId,
|
ProductId = (Guid)ContextId,
|
||||||
Permissions = 2
|
Permissions = 2
|
||||||
};
|
};
|
||||||
|
|
||||||
//e.EditModel = newProductMapping;
|
//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");
|
|
||||||
}
|
|
||||||
|
|
||||||
async Task FindUser()
|
async Task FindUser()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var userModelDto = await UserDataService.GetUserByEmailAsync(Email);
|
var userModelDto = await UserDataService.GetUserByEmailAsync(Email);
|
||||||
if (userModelDto != null)
|
if (userModelDto != null)
|
||||||
{
|
{
|
||||||
ChosenUser = userModelDto;
|
_chosenUser = userModelDto;
|
||||||
FoundUsers.Add(ChosenUser);
|
FoundUsers.Add(_chosenUser);
|
||||||
emailInput.Enabled = false;
|
_emailInput.Enabled = false;
|
||||||
button1.Visible = false;
|
_button1.Visible = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
emailInput.Value = "email@email.com";
|
_emailInput.Value = "email@email.com";
|
||||||
errorCss = "display: block";
|
_errorCss = "display: block";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -249,17 +211,18 @@
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task SubmitForm(object result)
|
public Task SubmitForm(object result)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
_logger.Info($"Submitted nested form: {result.GetType().FullName}");
|
_logger.Info($"Submitted nested form: {result.GetType().FullName}");
|
||||||
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task ShowPopup(UserProductMapping emptyProductMapping)
|
public Task ShowPopup(UserProductMapping emptyProductMapping)
|
||||||
{
|
{
|
||||||
tempProductMapping = emptyProductMapping;
|
_tempProductMapping = emptyProductMapping;
|
||||||
PopupVisible = true;
|
PopupVisible = true;
|
||||||
|
|
||||||
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task OnUserSelected(Guid userId)
|
private async Task OnUserSelected(Guid userId)
|
||||||
|
|
@ -269,13 +232,15 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task OnRowClick(GridRowClickEventArgs e)
|
private async Task OnRowClick(GridRowClickEventArgs e)
|
||||||
{
|
{
|
||||||
await SelectUser((Guid)e.Grid.GetRowValue(e.VisibleIndex, "Id"));
|
await SelectUser((Guid)e.Grid.GetRowValue(e.VisibleIndex, "Id"));
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task SelectUser(Guid id)
|
private async Task SelectUser(Guid id)
|
||||||
{
|
{
|
||||||
PopupVisible = false;
|
PopupVisible = false;
|
||||||
tempProductMapping.UserId = id;
|
_tempProductMapping.UserId = id;
|
||||||
|
|
||||||
await OnUserSelected(id);
|
await OnUserSelected(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -283,7 +248,7 @@
|
||||||
{
|
{
|
||||||
if (e.ElementType == GridElementType.DataRow && (int)e.Grid.GetRowValue(e.VisibleIndex, "Permissions") == 1)
|
if (e.ElementType == GridElementType.DataRow && (int)e.Grid.GetRowValue(e.VisibleIndex, "Permissions") == 1)
|
||||||
{
|
{
|
||||||
e.Style="display: none";
|
e.Style = "display: none";
|
||||||
}
|
}
|
||||||
// else if (e.ElementType == GridElementType.HeaderCell)
|
// else if (e.ElementType == GridElementType.HeaderCell)
|
||||||
// {
|
// {
|
||||||
|
|
@ -291,7 +256,4 @@
|
||||||
|
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -37,7 +37,7 @@
|
||||||
Click="ColumnChooserButton_Click" />
|
Click="ColumnChooserButton_Click" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<CarGridComponent ShowNestedRows="true" GetAllTag="SignalRTags.GetAllCars"></CarGridComponent>
|
<CarGridComponent DetailExpandButtonDisplayMode="GridDetailExpandButtonDisplayMode.Auto" GetAllTag="SignalRTags.GetAllCars"></CarGridComponent>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@
|
||||||
Click="ColumnChooserButton_Click" />
|
Click="ColumnChooserButton_Click" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<DriverGridComponent ShowNestedRows="true" ContextId="Guid.Parse(TransferProductId)" GetAllTag="SignalRTags.GetUserProductMappingsByProductId"></DriverGridComponent>
|
<DriverGridComponent DetailExpandButtonDisplayMode="GridDetailExpandButtonDisplayMode.Auto" ContextId="Guid.Parse(TransferProductId)" GetAllTag="SignalRTags.GetUserProductMappingsByProductId"></DriverGridComponent>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@
|
||||||
Click="ColumnChooserButton_Click" />
|
Click="ColumnChooserButton_Click" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<UserProductMappingGridComponent ShowNestedRows="true" GetAllTag="SignalRTags.GetAllUserProductMappings"></UserProductMappingGridComponent>
|
<UserProductMappingGridComponent DetailExpandButtonDisplayMode="GridDetailExpandButtonDisplayMode.Auto" GetAllTag="SignalRTags.GetAllUserProductMappings"></UserProductMappingGridComponent>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,16 +18,13 @@
|
||||||
@using AyCode.Interfaces.Addresses
|
@using AyCode.Interfaces.Addresses
|
||||||
@using AyCode.Core
|
@using AyCode.Core
|
||||||
@inject IStringLocalizer<TIAMResources> Localizer
|
@inject IStringLocalizer<TIAMResources> Localizer
|
||||||
@inject IServiceProviderDataService serviceProviderDataService
|
|
||||||
@inject IUserDataService userDataService
|
|
||||||
@inject ITransferDataService transferDataService
|
|
||||||
@inject IEnumerable<IAcLogWriterClientBase> LogWriters
|
@inject IEnumerable<IAcLogWriterClientBase> LogWriters
|
||||||
@inject AdminSignalRClient AdminSignalRClient;
|
@inject AdminSignalRClient AdminSignalRClient;
|
||||||
|
|
||||||
|
|
||||||
<ProductDetailGrid @ref="_productGrid"
|
<ProductDetailGrid @ref="_productGrid"
|
||||||
ContextIds="new[] {ContextId}"
|
ContextIds="new[] {ContextId}"
|
||||||
DataSource="ParentData.Products"
|
DataSource="ParentData?.Products ?? []"
|
||||||
GetAllMessageTag="GetAllTag"
|
GetAllMessageTag="GetAllTag"
|
||||||
Logger="_logger"
|
Logger="_logger"
|
||||||
SignalRClient="AdminSignalRClient"
|
SignalRClient="AdminSignalRClient"
|
||||||
|
|
@ -54,7 +51,7 @@
|
||||||
<DetailRowTemplate>
|
<DetailRowTemplate>
|
||||||
<DxTabs>
|
<DxTabs>
|
||||||
<DxTabPage Text="Permissions">
|
<DxTabPage Text="Permissions">
|
||||||
<UserProductMappingGridComponent ShowNestedRows="false" ContextId="((Product)context.DataItem).Id" GetAllTag="SignalRTags.GetUserProductMappingsByProductId">
|
<UserProductMappingGridComponent DetailExpandButtonDisplayMode="GridDetailExpandButtonDisplayMode.Never" ContextIds="new [] {((Product)context.DataItem).Id}" GetAllTag="SignalRTags.GetUserProductMappingsByProductId">
|
||||||
</UserProductMappingGridComponent>
|
</UserProductMappingGridComponent>
|
||||||
</DxTabPage>
|
</DxTabPage>
|
||||||
<DxTabPage Text="Profile">
|
<DxTabPage Text="Profile">
|
||||||
|
|
@ -62,22 +59,22 @@
|
||||||
</DxTabPage>
|
</DxTabPage>
|
||||||
</DxTabs>
|
</DxTabs>
|
||||||
</DetailRowTemplate>
|
</DetailRowTemplate>
|
||||||
<EditFormTemplate Context="EditFormContext">
|
<EditFormTemplate Context="editFormContext">
|
||||||
@{
|
@{
|
||||||
var transfer2 = (Product)EditFormContext.EditModel;
|
var transfer2 = (Product)editFormContext.EditModel;
|
||||||
}
|
}
|
||||||
<DxFormLayout CssClass="w-100">
|
<DxFormLayout CssClass="w-100">
|
||||||
<DxFormLayoutItem Caption=@Localizer.GetString(ResourceKeys.ProductName) ColSpanMd="4">
|
<DxFormLayoutItem Caption=@Localizer.GetString(ResourceKeys.ProductName) ColSpanMd="4">
|
||||||
@EditFormContext.GetEditor("Name")
|
@editFormContext.GetEditor("Name")
|
||||||
</DxFormLayoutItem>
|
</DxFormLayoutItem>
|
||||||
<DxFormLayoutItem Caption=@Localizer.GetString(ResourceKeys.ProductType) ColSpanMd="4">
|
<DxFormLayoutItem Caption=@Localizer.GetString(ResourceKeys.ProductType) ColSpanMd="4">
|
||||||
@EditFormContext.GetEditor("ProductType")
|
@editFormContext.GetEditor("ProductType")
|
||||||
</DxFormLayoutItem>
|
</DxFormLayoutItem>
|
||||||
<DxFormLayoutItem Caption=@Localizer.GetString(ResourceKeys.Price) ColSpanMd="4">
|
<DxFormLayoutItem Caption=@Localizer.GetString(ResourceKeys.Price) ColSpanMd="4">
|
||||||
@EditFormContext.GetEditor("Price")
|
@editFormContext.GetEditor("Price")
|
||||||
</DxFormLayoutItem>
|
</DxFormLayoutItem>
|
||||||
<DxFormLayoutItem Caption=@Localizer.GetString(ResourceKeys.ProductDescription) ColSpanMd="4">
|
<DxFormLayoutItem Caption=@Localizer.GetString(ResourceKeys.ProductDescription) ColSpanMd="4">
|
||||||
@EditFormContext.GetEditor("Description")
|
@editFormContext.GetEditor("Description")
|
||||||
</DxFormLayoutItem>
|
</DxFormLayoutItem>
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -89,13 +86,12 @@
|
||||||
@code {
|
@code {
|
||||||
[Parameter] public bool KeyboardNavigationEnabled { get; set; }
|
[Parameter] public bool KeyboardNavigationEnabled { get; set; }
|
||||||
[Parameter] public Guid ContextId { get; set; }
|
[Parameter] public Guid ContextId { get; set; }
|
||||||
[Parameter] public IProductsRelation ParentData { get; set; } = null!;
|
[Parameter] public IProductsRelation? ParentData { get; set; } = null!;
|
||||||
[Parameter] public EventCallback<GridEditModelSavingEventArgs> OnGridEditModelSaving { get; set; }
|
[Parameter] public EventCallback<GridEditModelSavingEventArgs> OnGridEditModelSaving { get; set; }
|
||||||
[Parameter] public int GetAllTag { get; set; } = SignalRTags.GetProductsByContextId;
|
[Parameter] public int GetAllTag { get; set; } = SignalRTags.GetProductsByContextId;
|
||||||
[Parameter] public GridDetailExpandButtonDisplayMode DetailExpandButtonDisplayMode { get; set; } = GridDetailExpandButtonDisplayMode.Never;
|
[Parameter] public GridDetailExpandButtonDisplayMode DetailExpandButtonDisplayMode { get; set; } = GridDetailExpandButtonDisplayMode.Never;
|
||||||
|
|
||||||
private ProductDetailGrid _productGrid;
|
private ProductDetailGrid _productGrid = null!;
|
||||||
private List<Product> productList = new List<Product>();
|
|
||||||
private LoggerClient<ProductDetailGridComponent> _logger = null!;
|
private LoggerClient<ProductDetailGridComponent> _logger = null!;
|
||||||
protected override void OnInitialized()
|
protected override void OnInitialized()
|
||||||
{
|
{
|
||||||
|
|
@ -121,31 +117,12 @@
|
||||||
// }
|
// }
|
||||||
// else
|
// else
|
||||||
|
|
||||||
base.OnParametersSet();
|
await base.OnParametersSetAsync();
|
||||||
}
|
|
||||||
|
|
||||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
|
||||||
{
|
|
||||||
// if(firstRender)
|
|
||||||
// {
|
|
||||||
|
|
||||||
// _productGrid.GetAllMessageTag = GetAllTag;
|
|
||||||
|
|
||||||
// // if (ParentData != null)
|
|
||||||
// // {
|
|
||||||
// // _productGrid.DataSource = new List<Product>();
|
|
||||||
// // _productGrid.DataSource = ParentData.Products;
|
|
||||||
// // }
|
|
||||||
|
|
||||||
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DataItemChanged(GridDataItemChangedEventArgs<Product> args)
|
private void DataItemChanged(GridDataItemChangedEventArgs<Product> args)
|
||||||
{
|
{
|
||||||
_logger.Debug($"Saving: {args.DataItem.Name}, {args.DataItem.ServiceProviderId}");
|
_logger.Debug($"Saving: {args.DataItem.Name}, {args.DataItem.ServiceProviderId}");
|
||||||
|
|
||||||
//ProductGrid.SaveChangesAsync();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task DataItemSaving(GridEditModelSavingEventArgs e)
|
public async Task DataItemSaving(GridEditModelSavingEventArgs e)
|
||||||
|
|
|
||||||
|
|
@ -29,47 +29,40 @@
|
||||||
CustomizeEditModel="CustomizeEditModel"
|
CustomizeEditModel="CustomizeEditModel"
|
||||||
EditMode="GridEditMode.EditForm"
|
EditMode="GridEditMode.EditForm"
|
||||||
ColumnResizeMode="GridColumnResizeMode.NextColumn"
|
ColumnResizeMode="GridColumnResizeMode.NextColumn"
|
||||||
|
DetailExpandButtonDisplayMode="DetailExpandButtonDisplayMode"
|
||||||
ShowFilterRow="true">
|
ShowFilterRow="true">
|
||||||
<Columns>
|
<Columns>
|
||||||
<DxGridCommandColumn NewButtonVisible="true" Width="8%" FixedPosition="GridColumnFixedPosition.Left" />
|
<DxGridCommandColumn Width="135" MinWidth="135" DeleteButtonVisible="AcDomain.IsDeveloperVersion" EditButtonVisible="AcDomain.IsDeveloperVersion" FixedPosition="GridColumnFixedPosition.Left" />
|
||||||
<DxGridDataColumn FieldName="Id" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" />
|
<DxGridDataColumn FieldName="Id" SortIndex="0" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" DisplayFormat="N" />
|
||||||
<DxGridDataColumn FieldName="UserId" />
|
<DxGridDataColumn FieldName="UserId" />
|
||||||
<DxGridDataColumn FieldName="ProductId" Width="40%" />
|
<DxGridDataColumn FieldName="ProductId" Width="40%" />
|
||||||
<DxGridDataColumn FieldName="Permissions" />
|
<DxGridDataColumn FieldName="Permissions" />
|
||||||
</Columns>
|
</Columns>
|
||||||
<DetailRowTemplate>
|
<DetailRowTemplate>
|
||||||
@{
|
@{
|
||||||
if (ShowNestedRows)
|
<DxTabs>
|
||||||
{
|
<DxTabPage Text="Products">
|
||||||
<DxTabs>
|
<ProductDetailGridComponent GetAllTag="SignalRTags.GetProductsById" ContextId="((UserProductMapping)context.DataItem).ProductId" KeyboardNavigationEnabled="true"/>
|
||||||
|
</DxTabPage>
|
||||||
<DxTabPage Text="Products">
|
</DxTabs>
|
||||||
<ProductDetailGridComponent GetAllTag="SignalRTags.GetProductsById" ContextId="((UserProductMapping)context.DataItem).ProductId" KeyboardNavigationEnabled="true" />
|
|
||||||
</DxTabPage>
|
|
||||||
|
|
||||||
|
|
||||||
</DxTabs>
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</DetailRowTemplate>
|
</DetailRowTemplate>
|
||||||
|
|
||||||
<EditFormTemplate Context="UserEditFormContext">
|
<EditFormTemplate Context="userEditFormContext">
|
||||||
@{
|
@{
|
||||||
var transfer2 = (UserProductMapping)UserEditFormContext.EditModel;
|
var transfer2 = (UserProductMapping)userEditFormContext.EditModel;
|
||||||
}
|
}
|
||||||
<DxFormLayout CssClass="w-100">
|
<DxFormLayout CssClass="w-100">
|
||||||
<DxFormLayoutItem Caption="UserId" ColSpanMd="4">
|
<DxFormLayoutItem Caption="UserId" ColSpanMd="4">
|
||||||
@UserEditFormContext.GetEditor("UserId")
|
@userEditFormContext.GetEditor("UserId")
|
||||||
</DxFormLayoutItem>
|
</DxFormLayoutItem>
|
||||||
<DxFormLayoutItem Caption="Product:" ColSpanMd="4">
|
<DxFormLayoutItem Caption="Product:" ColSpanMd="4">
|
||||||
<DxComboBox Data="@_availableProducts" TextFieldName="Name" @bind-Value="((UserProductMapping)UserEditFormContext.EditModel).ProductId" />
|
<DxComboBox Data="@_availableProducts" TextFieldName="Name" @bind-Value="((UserProductMapping)userEditFormContext.EditModel).ProductId" />
|
||||||
</DxFormLayoutItem>
|
</DxFormLayoutItem>
|
||||||
<DxFormLayoutItem Caption="Permissions" ColSpanMd="4">
|
<DxFormLayoutItem Caption="Permissions" ColSpanMd="4">
|
||||||
@UserEditFormContext.GetEditor("Permissions")
|
@userEditFormContext.GetEditor("Permissions")
|
||||||
</DxFormLayoutItem>
|
</DxFormLayoutItem>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</DxFormLayout>
|
</DxFormLayout>
|
||||||
</EditFormTemplate>
|
</EditFormTemplate>
|
||||||
|
|
||||||
|
|
@ -83,11 +76,9 @@
|
||||||
|
|
||||||
[Parameter] public int GetAllTag { get; set; } = SignalRTags.GetAllUserProductMappings;
|
[Parameter] public int GetAllTag { get; set; } = SignalRTags.GetAllUserProductMappings;
|
||||||
|
|
||||||
[Parameter] public bool ShowNestedRows { get; set; } = false;
|
[Parameter] public GridDetailExpandButtonDisplayMode DetailExpandButtonDisplayMode { get; set; } = GridDetailExpandButtonDisplayMode.Never;
|
||||||
|
|
||||||
[Parameter] public Guid? ContextId { get; set; }
|
[Parameter] public Guid[]? ContextIds { get; set; }
|
||||||
|
|
||||||
private Guid[] ContextIds = new Guid[0];
|
|
||||||
|
|
||||||
private LoggerClient<UserProductMappingGridComponent> _logger;
|
private LoggerClient<UserProductMappingGridComponent> _logger;
|
||||||
|
|
||||||
|
|
@ -95,22 +86,12 @@
|
||||||
|
|
||||||
private ProductDetailGridComponent bleh;
|
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()
|
protected override void OnInitialized()
|
||||||
{
|
{
|
||||||
_logger = new LoggerClient<UserProductMappingGridComponent>(LogWriters.ToArray());
|
_logger = new LoggerClient<UserProductMappingGridComponent>(LogWriters.ToArray());
|
||||||
|
|
||||||
|
base.OnInitialized();
|
||||||
//_logger.Info($"DetailGridData: {_detailGridData.Count}");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CustomizeEditModel(GridCustomizeEditModelEventArgs e)
|
void CustomizeEditModel(GridCustomizeEditModelEventArgs e)
|
||||||
|
|
@ -126,30 +107,4 @@
|
||||||
|
|
||||||
//e.EditModel = newProductMapping;
|
//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");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -114,24 +114,24 @@ namespace TIAMWebApp.Server.Controllers
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[Route(APIUrls.GetServiceProviderByIdRouteName)]
|
[Route(APIUrls.GetServiceProviderByIdRouteName)]
|
||||||
[SignalR(SignalRTags.GetCompany)]
|
[SignalR(SignalRTags.GetCompany)]
|
||||||
public async Task<string> GetServiceProviderById([FromBody] Guid id)
|
public Task<Company?> GetServiceProviderById([FromBody] Guid id)
|
||||||
{
|
{
|
||||||
_logger.Info($@"GetServiceProviderById called with id: {id}");
|
_logger.Info($@"GetServiceProviderById called with id: {id}");
|
||||||
|
|
||||||
return await adminDal.GetCompanyByIdAsync(id);
|
return adminDal.GetCompanyByIdAsync(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[NonAction]
|
||||||
[Route(APIUrls.GetServiceProvidersByIdRouteName)]
|
[ApiExplorerSettings(IgnoreApi = true)]
|
||||||
[SignalR(SignalRTags.GetCompanys)]
|
[SignalR(SignalRTags.GetCompaniesById)]
|
||||||
public async Task<string> GetServiceProvidersById([FromBody] Guid id)
|
public async Task<List<Company>> GetServiceProvidersById(Guid id)
|
||||||
{
|
{
|
||||||
_logger.Info($@"GetServiceProviderById called with id: {id}");
|
_logger.Info($@"GetServiceProvidersById called with id: {id}");
|
||||||
List<Company> compList = new List<Company>();
|
|
||||||
var result = await adminDal.GetServiceProviderByIdAsync(id);
|
var company = await GetServiceProviderById(id);
|
||||||
compList.Add(result);
|
return company == null ? [] : [company];
|
||||||
return compList.ToJson();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//17.
|
//17.
|
||||||
[Authorize]
|
[Authorize]
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
|
|
@ -486,14 +486,11 @@ namespace TIAMWebApp.Server.Controllers
|
||||||
[Route(APIUrls.GetProductByIdRouteName)]
|
[Route(APIUrls.GetProductByIdRouteName)]
|
||||||
[Tags("In-Progress", "Product")]
|
[Tags("In-Progress", "Product")]
|
||||||
[SignalR(SignalRTags.GetProductById)]
|
[SignalR(SignalRTags.GetProductById)]
|
||||||
public async Task<Product> GetProductById(Guid productId)
|
public Task<Product?> GetProductById(Guid productId)
|
||||||
{
|
{
|
||||||
_logger.Info("GetAllProducts called");
|
_logger.Info("GetAllProducts called");
|
||||||
|
|
||||||
var products = adminDal.GetProductById(productId);
|
return adminDal.GetProductByIdAsync(productId);
|
||||||
|
|
||||||
return products;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -503,14 +500,9 @@ namespace TIAMWebApp.Server.Controllers
|
||||||
public async Task<List<Product>> GetProductsById(Guid productId)
|
public async Task<List<Product>> GetProductsById(Guid productId)
|
||||||
{
|
{
|
||||||
_logger.Info("GetAllProducts called");
|
_logger.Info("GetAllProducts called");
|
||||||
|
|
||||||
var product = await GetProductById(productId);
|
|
||||||
var products = new List<Product>();
|
|
||||||
if (product != null) {
|
|
||||||
products.Add(product);
|
|
||||||
}
|
|
||||||
return products;
|
|
||||||
|
|
||||||
|
var product = await GetProductById(productId);
|
||||||
|
return product == null ? [] : [product];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue