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