cars, drivers, permissions
This commit is contained in:
parent
d06349ae1e
commit
448428a756
|
|
@ -33,6 +33,7 @@ namespace TIAM.Database.DataLayers.Admins
|
|||
}
|
||||
|
||||
#region Car
|
||||
public Task<List<Car>> GetAllCarsAsync() => SessionAsync(ctx => ctx.Cars.OrderBy(x => x.Manufacture).ThenBy(x => x.CarModel).ToList());
|
||||
public Car? GetCarById(Guid carId) => Session(ctx => ctx.Cars.FirstOrDefault(x => x.Id == carId));
|
||||
public List<Car> GetCarByUserProductMappingId(Guid userProductMappingId) => Session(ctx => ctx.Cars.Where(x => x.UserProductMappingId == userProductMappingId).ToList());
|
||||
public Task<bool> AddCarAsync(Car car) => TransactionAsync(ctx => ctx.Cars.Add(car).State == EntityState.Added);
|
||||
|
|
|
|||
|
|
@ -52,11 +52,13 @@ public class SignalRTags : AcSignalRTags
|
|||
public const int GetAllUserProductMappings = 43;
|
||||
public const int GetUserProductMappingsByProductId = 44;
|
||||
public const int GetUserProductMappingsByUserId = 45;
|
||||
public const int GetUserProductMappingById = 46;
|
||||
|
||||
public const int GetCarsForUserProductMapping = 50;
|
||||
public const int CreateCar = 51;
|
||||
public const int UpdateCar = 52;
|
||||
public const int DeleteCar = 53;
|
||||
public const int GetAllCars = 54;
|
||||
|
||||
public const int GetMessagesByContextId = 60;
|
||||
public const int GetAllMessages = 61;
|
||||
|
|
|
|||
|
|
@ -25,8 +25,6 @@
|
|||
KeyFieldName="Id"
|
||||
ValidationEnabled="false"
|
||||
CustomizeEditModel="CustomizeEditModel"
|
||||
EditModelSaving="EditModelSaving"
|
||||
DataItemDeleting="DataItemDeleting"
|
||||
EditMode="GridEditMode.EditForm"
|
||||
ColumnResizeMode="GridColumnResizeMode.NextColumn"
|
||||
ShowFilterRow="true">
|
||||
|
|
|
|||
|
|
@ -0,0 +1,186 @@
|
|||
@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
|
||||
|
||||
|
||||
<CarDetailGrid 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="UserProductMappingId" />
|
||||
<DxGridDataColumn FieldName="CountryCode"/>
|
||||
<DxGridDataColumn FieldName="LicencePlate"/>
|
||||
<DxGridDataColumn FieldName="Color"/>
|
||||
<DxGridDataColumn FieldName="Manufacture"/>
|
||||
<DxGridDataColumn FieldName="CarModel"/>
|
||||
<DxGridDataColumn FieldName="YearOfMake"/>
|
||||
<DxGridDataColumn FieldName="SeatNumber"/>
|
||||
<DxGridDataColumn FieldName="CarMotorType"/>
|
||||
</Columns>
|
||||
<DetailRowTemplate>
|
||||
@{
|
||||
if (ShowNestedRows)
|
||||
{
|
||||
<DxTabs>
|
||||
|
||||
<DxTabPage Text="Driving permissions assigned">
|
||||
<UserProductMappingGridComponent GetAllTag="SignalRTags.GetUserProductMappingById" ContextId="((Car)context.DataItem).UserProductMappingId" KeyboardNavigationEnabled="true" />
|
||||
</DxTabPage>
|
||||
|
||||
</DxTabs>
|
||||
}
|
||||
}
|
||||
</DetailRowTemplate>
|
||||
|
||||
<EditFormTemplate Context="UserEditFormContext">
|
||||
@{
|
||||
var car = (Car)UserEditFormContext.EditModel;
|
||||
}
|
||||
<DxFormLayout CssClass="w-100">
|
||||
<DxFormLayoutItem Caption="Country code" ColSpanMd="4">
|
||||
@UserEditFormContext.GetEditor("CountryCode")
|
||||
</DxFormLayoutItem>
|
||||
<DxFormLayoutItem Caption="Licence plate" ColSpanMd="4">
|
||||
@UserEditFormContext.GetEditor("LicencePlate")
|
||||
</DxFormLayoutItem>
|
||||
<DxFormLayoutItem Caption="Color" ColSpanMd="4">
|
||||
@UserEditFormContext.GetEditor("Color")
|
||||
</DxFormLayoutItem>
|
||||
<DxFormLayoutItem Caption="Manufacturer" ColSpanMd="4">
|
||||
@UserEditFormContext.GetEditor("Manufacture")
|
||||
</DxFormLayoutItem>
|
||||
<DxFormLayoutItem Caption="Car model" ColSpanMd="4">
|
||||
@UserEditFormContext.GetEditor("CarModel")
|
||||
</DxFormLayoutItem>
|
||||
<DxFormLayoutItem Caption="Year of make" ColSpanMd="4">
|
||||
@UserEditFormContext.GetEditor("YearOfMake")
|
||||
</DxFormLayoutItem>
|
||||
<DxFormLayoutItem Caption="Seat number" ColSpanMd="4">
|
||||
@UserEditFormContext.GetEditor("SeatNumber")
|
||||
</DxFormLayoutItem>
|
||||
<DxFormLayoutItem Caption="Motor type" ColSpanMd="4">
|
||||
@UserEditFormContext.GetEditor("CarMotorType")
|
||||
</DxFormLayoutItem>
|
||||
|
||||
|
||||
|
||||
</DxFormLayout>
|
||||
</EditFormTemplate>
|
||||
|
||||
</CarDetailGrid>
|
||||
|
||||
@code {
|
||||
[Parameter]
|
||||
public bool KeyboardNavigationEnabled { get; set; }
|
||||
|
||||
[Parameter] public ICarRelation ParentData { get; set; } = null!;
|
||||
|
||||
[Parameter] public int GetAllTag { get; set; } = SignalRTags.GetAllCars;
|
||||
|
||||
[Parameter] public bool ShowNestedRows { get; set; } = false;
|
||||
|
||||
[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()
|
||||
{
|
||||
_logger = new LoggerClient<CarDetailGridComponent>(LogWriters.ToArray());
|
||||
|
||||
|
||||
//_logger.Info($"DetailGridData: {_detailGridData.Count}");
|
||||
}
|
||||
|
||||
void CustomizeEditModel(GridCustomizeEditModelEventArgs e)
|
||||
{
|
||||
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
|
||||
};
|
||||
|
||||
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");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,171 @@
|
|||
@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
|
||||
|
||||
|
||||
<CarGrid 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="UserProductMappingId" />
|
||||
<DxGridDataColumn FieldName="CountryCode"/>
|
||||
<DxGridDataColumn FieldName="LicencePlate"/>
|
||||
<DxGridDataColumn FieldName="Color"/>
|
||||
<DxGridDataColumn FieldName="Manufacture"/>
|
||||
<DxGridDataColumn FieldName="CarModel"/>
|
||||
<DxGridDataColumn FieldName="YearOfMake"/>
|
||||
<DxGridDataColumn FieldName="SeatNumber"/>
|
||||
<DxGridDataColumn FieldName="CarMotorType"/>
|
||||
</Columns>
|
||||
<DetailRowTemplate>
|
||||
@{
|
||||
if (ShowNestedRows)
|
||||
{
|
||||
<DxTabs>
|
||||
|
||||
<DxTabPage Text="Driving permissions assigned">
|
||||
<UserProductMappingGridComponent GetAllTag="SignalRTags.GetUserProductMappingById" ContextId="((Car)context.DataItem).UserProductMappingId" KeyboardNavigationEnabled="true" />
|
||||
</DxTabPage>
|
||||
|
||||
</DxTabs>
|
||||
}
|
||||
}
|
||||
</DetailRowTemplate>
|
||||
|
||||
<EditFormTemplate Context="UserEditFormContext">
|
||||
@{
|
||||
var car = (Car)UserEditFormContext.EditModel;
|
||||
}
|
||||
<DxFormLayout CssClass="w-100">
|
||||
<DxFormLayoutItem Caption="Country code" ColSpanMd="4">
|
||||
@UserEditFormContext.GetEditor("CountryCode")
|
||||
</DxFormLayoutItem>
|
||||
<DxFormLayoutItem Caption="Licence plate" ColSpanMd="4">
|
||||
@UserEditFormContext.GetEditor("LicencePlate")
|
||||
</DxFormLayoutItem>
|
||||
<DxFormLayoutItem Caption="Color" ColSpanMd="4">
|
||||
@UserEditFormContext.GetEditor("Color")
|
||||
</DxFormLayoutItem>
|
||||
<DxFormLayoutItem Caption="Manufacturer" ColSpanMd="4">
|
||||
@UserEditFormContext.GetEditor("Manufacture")
|
||||
</DxFormLayoutItem>
|
||||
<DxFormLayoutItem Caption="Licence plate" ColSpanMd="4">
|
||||
@UserEditFormContext.GetEditor("CarModel")
|
||||
</DxFormLayoutItem>
|
||||
<DxFormLayoutItem Caption="Licence plate" ColSpanMd="4">
|
||||
@UserEditFormContext.GetEditor("YearOfMake")
|
||||
</DxFormLayoutItem>
|
||||
<DxFormLayoutItem Caption="Licence plate" ColSpanMd="4">
|
||||
@UserEditFormContext.GetEditor("SeatNumber")
|
||||
</DxFormLayoutItem>
|
||||
<DxFormLayoutItem Caption="Licence plate" ColSpanMd="4">
|
||||
@UserEditFormContext.GetEditor("CarMotorType")
|
||||
</DxFormLayoutItem>
|
||||
|
||||
|
||||
|
||||
</DxFormLayout>
|
||||
</EditFormTemplate>
|
||||
|
||||
</CarGrid>
|
||||
|
||||
@code {
|
||||
[Parameter]
|
||||
public bool KeyboardNavigationEnabled { get; set; }
|
||||
|
||||
[Parameter] public ICarRelation ParentData { get; set; } = null!;
|
||||
|
||||
[Parameter] public int GetAllTag { get; set; } = SignalRTags.GetAllCars;
|
||||
|
||||
[Parameter] public bool ShowNestedRows { get; set; } = false;
|
||||
|
||||
[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()
|
||||
{
|
||||
_logger = new LoggerClient<CarGridComponent>(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");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,297 @@
|
|||
@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
|
||||
@inject IWizardProcessor WizardProcessor
|
||||
@inject IUserDataService UserDataService
|
||||
|
||||
<DxPopup CssClass="popup-demo-events"
|
||||
@bind-Visible="@PopupVisible"
|
||||
ShowFooter="true"
|
||||
CloseOnEscape="true"
|
||||
CloseOnOutsideClick="false"
|
||||
ShowCloseButton="false"
|
||||
HeaderText="Select driver"
|
||||
Closing="SelectDriverPopupClosing"
|
||||
Closed="SelectDriverPopupClosed">
|
||||
<BodyContentTemplate>
|
||||
<label for="emailID" class="demo-text mt-4 mb-1">
|
||||
Put user email here
|
||||
</label>
|
||||
<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>
|
||||
<DxGrid Data="@FoundUsers" RowClick="@OnRowClick">
|
||||
<Columns>
|
||||
<DxGridDataColumn FieldName="Id" Caption="ID" />
|
||||
</Columns>
|
||||
</DxGrid>
|
||||
</BodyContentTemplate>
|
||||
<FooterContentTemplate Context="PopupContext">
|
||||
<div class="popup-demo-events-footer">
|
||||
|
||||
|
||||
<!--DxButton CssClass="popup-demo-events-button ms-2" RenderStyle="ButtonRenderStyle.Primary" Text="OK" Click="Context.CloseCallback" /-->
|
||||
<DxButton CssClass="popup-demo-events-button ms-2" RenderStyle="ButtonRenderStyle.Secondary" Text="Cancel" Click="CancelCreateClick" />
|
||||
</div>
|
||||
</FooterContentTemplate>
|
||||
</DxPopup>
|
||||
<UserProductMappingDriverGrid Logger="_logger"
|
||||
@ref="_driverGrid"
|
||||
ContextIds="ContextIds"
|
||||
GetAllMessageTag="GetAllTag"
|
||||
SignalRClient="AdminSignalRClient"
|
||||
PageSize="10"
|
||||
AutoExpandAllGroupRows="true"
|
||||
KeyboardNavigationEnabled="KeyboardNavigationEnabled"
|
||||
KeyFieldName="Id"
|
||||
ValidationEnabled="false"
|
||||
CustomizeElement="Grid_CustomizeElement"
|
||||
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>
|
||||
<DxTabPage Text="Cars">
|
||||
<CarDetailGridComponent GetAllTag="SignalRTags.GetCarsForUserProductMapping" ContextId="((UserProductMapping)context.DataItem).Id" KeyboardNavigationEnabled="true" />
|
||||
</DxTabPage>
|
||||
</DxTabs>
|
||||
}
|
||||
}
|
||||
</DetailRowTemplate>
|
||||
|
||||
<EditFormTemplate Context="UserEditFormContext">
|
||||
|
||||
|
||||
@{
|
||||
var transfer2 = (UserProductMapping)UserEditFormContext.EditModel;
|
||||
}
|
||||
<DxFormLayout CssClass="w-100">
|
||||
|
||||
<DxFormLayoutItem Caption="UserId" ColSpanLg="6" ColSpanMd="12">
|
||||
@transfer2.UserId
|
||||
@{
|
||||
var a = UserEditFormContext.GetEditor("UserId");
|
||||
}
|
||||
@* <DxButton Click="() => ShowPopup((UserProductMapping)UserEditFormContext.EditModel)" Context="ButtonContext">Select user</DxButton> *@
|
||||
<DxButton Click="@(async (MouseEventArgs e) => await ShowPopup((UserProductMapping)UserEditFormContext.EditModel))" Context="ButtonContext">Select user</DxButton>
|
||||
</DxFormLayoutItem>
|
||||
|
||||
<DxFormLayoutItem Caption="Permissions" ColSpanMd="4">
|
||||
@UserEditFormContext.GetEditor("Permissions")
|
||||
</DxFormLayoutItem>
|
||||
|
||||
|
||||
|
||||
</DxFormLayout>
|
||||
</EditFormTemplate>
|
||||
|
||||
</UserProductMappingDriverGrid>
|
||||
|
||||
@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 UserProductMappingDriverGrid _driverGrid;
|
||||
|
||||
private UserProductMapping tempProductMapping;
|
||||
|
||||
bool PopupVisible { get; set; }
|
||||
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;
|
||||
|
||||
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;
|
||||
UserProductMapping newUPM = (UserProductMapping)e.EditModel;
|
||||
newUPM.ProductId = (Guid)ContextId!;
|
||||
var newProductMapping = new UserProductMapping
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
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;
|
||||
}
|
||||
else
|
||||
{
|
||||
emailInput.Value = "email@email.com";
|
||||
errorCss = "display: block";
|
||||
}
|
||||
}
|
||||
|
||||
void CancelCreateClick()
|
||||
{
|
||||
PopupVisible = false;
|
||||
}
|
||||
|
||||
void SelectDriverPopupClosed()
|
||||
{
|
||||
//cancel clicked
|
||||
}
|
||||
|
||||
void SelectDriverPopupClosing(PopupClosingEventArgs args)
|
||||
{
|
||||
//myModel = new TransferWizardModel();
|
||||
|
||||
}
|
||||
|
||||
public async Task SubmitForm(object result)
|
||||
{
|
||||
|
||||
|
||||
_logger.Info($"Submitted nested form: {result.GetType().FullName}");
|
||||
}
|
||||
|
||||
public async Task ShowPopup(UserProductMapping emptyProductMapping)
|
||||
{
|
||||
tempProductMapping = emptyProductMapping;
|
||||
PopupVisible = true;
|
||||
}
|
||||
|
||||
private async Task OnUserSelected(Guid userId)
|
||||
{
|
||||
// Logic after the user is selected
|
||||
await Task.Run(() => Console.WriteLine($"Selected User ID: {userId}"));
|
||||
}
|
||||
|
||||
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;
|
||||
await OnUserSelected(id);
|
||||
}
|
||||
|
||||
void Grid_CustomizeElement(GridCustomizeElementEventArgs e)
|
||||
{
|
||||
if (e.ElementType == GridElementType.DataRow && (int)e.Grid.GetRowValue(e.VisibleIndex, "Permissions") == 1)
|
||||
{
|
||||
e.Style="display: none";
|
||||
}
|
||||
// else if (e.ElementType == GridElementType.HeaderCell)
|
||||
// {
|
||||
// e.Style = "background-color: rgba(0, 0, 0, 0.08); font-style=bold";
|
||||
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,186 @@
|
|||
@page "/sysadmin/cars"
|
||||
@using BlazorAnimation
|
||||
@using TIAM.Models.Dtos.Users
|
||||
@using TIAM.Resources
|
||||
@using TIAM.Services
|
||||
@using TIAMSharedUI.Pages.Components
|
||||
@using TIAMSharedUI.Shared
|
||||
@using TIAMWebApp.Shared.Application.Interfaces
|
||||
@using TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels
|
||||
@using TIAMWebApp.Shared.Application.Models.PageModels
|
||||
@using TIAMWebApp.Shared.Application.Utility
|
||||
@using AyCode.Services.Loggers
|
||||
@layout AdminLayout
|
||||
@inject IEnumerable<IAcLogWriterClientBase> LogWriters
|
||||
@inject IStringLocalizer<TIAMResources> Localizer
|
||||
@inject ISessionService SessionService
|
||||
@inject IWizardProcessor WizardProcessor
|
||||
@inject IUserDataService UserDataService
|
||||
<PageTitle>Car list</PageTitle>
|
||||
|
||||
<div class="text-center m-5">
|
||||
<h1>Car list</h1>
|
||||
<h2 style="font-size:small">Manage cars here!</h2>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class=" col-12">
|
||||
<Animation Effect="@Effect.FadeInUp" Class="glass" Speed="@Speed.Fast" Delay="@TimeSpan.FromMilliseconds(250)">
|
||||
<div class="card">
|
||||
<div class="d-flex flex-column mb-4 pb-2">
|
||||
<div class="align-self-end pl-2 pb-2">
|
||||
<DxButton Text="Column Chooser"
|
||||
RenderStyle="ButtonRenderStyle.Secondary"
|
||||
IconCssClass="btn-column-chooser"
|
||||
Click="ColumnChooserButton_Click" />
|
||||
</div>
|
||||
|
||||
<CarGridComponent ShowNestedRows="true" GetAllTag="SignalRTags.GetAllCars"></CarGridComponent>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</Animation>
|
||||
</div>
|
||||
|
||||
<div class=" col-12 col-xl-6">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
private LoggerClient<ManageUserProductMappings> _logger;
|
||||
//public UserModelDtoDetail UserModelDtoDetail = new();
|
||||
|
||||
|
||||
bool PopupVisible { get; set; }
|
||||
|
||||
IGrid Grid { get; set; }
|
||||
//object? MasterGridData { get; set; }
|
||||
bool AutoCollapseDetailRow { get; set; }
|
||||
|
||||
public List<string> IgnoreList =
|
||||
[
|
||||
"ReceiverEmailAddress",
|
||||
"ReceiverId",
|
||||
"SenderEmailAddress",
|
||||
"SenderId",
|
||||
"ContextId"
|
||||
];
|
||||
|
||||
|
||||
|
||||
void Grid_CustomizeElement(GridCustomizeElementEventArgs e)
|
||||
{
|
||||
if (e.ElementType == GridElementType.DataRow && e.VisibleIndex % 2 == 1)
|
||||
{
|
||||
e.CssClass = "bg-alt";
|
||||
}
|
||||
else if (e.ElementType == GridElementType.HeaderCell)
|
||||
{
|
||||
e.Style = "background-color: rgba(0, 0, 0, 0.08); font-style=bold";
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void Grid_CustomizeEditModel(GridCustomizeEditModelEventArgs e)
|
||||
{
|
||||
if (!e.IsNew) return;
|
||||
|
||||
var userEditModel = (UserModelDtoDetail)e.EditModel; //TODO not valid cast
|
||||
userEditModel.Id = Guid.NewGuid();
|
||||
|
||||
userEditModel.UserDto = new UserDtoDetail
|
||||
{
|
||||
AffiliateId = Guid.NewGuid(),
|
||||
EmailAddress = "",
|
||||
PhoneNumber = ""
|
||||
};
|
||||
|
||||
userEditModel.ProfileDto = new TIAM.Entities.Profiles.Profile
|
||||
{
|
||||
Name = "New user"
|
||||
};
|
||||
|
||||
userEditModel.Products = [];
|
||||
userEditModel.ServiceProviders = [];
|
||||
userEditModel.UserProductMappings = [];
|
||||
}
|
||||
|
||||
async Task Grid_EditModelSaving(GridEditModelSavingEventArgs e)
|
||||
{
|
||||
var userModelDtoDetail = ((UserModelDtoDetail)e.EditModel);
|
||||
|
||||
if (e.IsNew)
|
||||
{
|
||||
//add new orderData to orderData array
|
||||
var registration = new RegistrationModel();
|
||||
//TODO: Refractor to userDataService
|
||||
|
||||
var random = new Random();
|
||||
const string chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
|
||||
var password = new string(Enumerable.Repeat(chars, 10)
|
||||
.Select(s => s[random.Next(s.Length)]).ToArray());
|
||||
|
||||
registration.Email = userModelDtoDetail.UserDto.EmailAddress;
|
||||
registration.PhoneNumber = userModelDtoDetail.UserDto.PhoneNumber;
|
||||
registration.Password = password;
|
||||
registration.ReferralId = null;
|
||||
|
||||
await UserDataService.CreateGuestUser(registration);
|
||||
_logger.Info("New user created added");
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.Info("orderData updated at id " + userModelDtoDetail.Id);
|
||||
|
||||
//await transferDataService.UpdateTransferAsync((TransferWizardModel)e.EditModel);
|
||||
//modify transferData where transferData.Id == e.EditModel.Id
|
||||
}
|
||||
//get transfer from TransferData by Id
|
||||
|
||||
// foreach (var transferToModify in (List<Transfer>)TransferData)
|
||||
// {
|
||||
// myModel = (Transfer)e.EditModel;
|
||||
|
||||
// if (transferToModify.Id == myModel.Id)
|
||||
// {
|
||||
// //transferToModify.Driver = myModel.Driver;
|
||||
// }
|
||||
// }
|
||||
|
||||
//TODO: ne a teljes grid-et refresh-eljük, elég lenne csak az adott sort! - J.
|
||||
await UpdateDataAsync();
|
||||
}
|
||||
|
||||
async Task Grid_DataItemDeleting(GridDataItemDeletingEventArgs e)
|
||||
{
|
||||
//await NwindDataService.RemoveEmployeeAsync((EditableEmployee)e.DataItem);
|
||||
//remove orderData from orderData array
|
||||
_logger.Info("orderData deleted");
|
||||
//await UpdateDataAsync();
|
||||
}
|
||||
|
||||
async Task UpdateDataAsync()
|
||||
{
|
||||
//refresh grid
|
||||
|
||||
_logger.Info("orderData grid refreshed");
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
_logger = new LoggerClient<ManageUserProductMappings>(LogWriters.ToArray());
|
||||
|
||||
base.OnInitialized();
|
||||
}
|
||||
|
||||
void ColumnChooserButton_Click()
|
||||
{
|
||||
Grid.ShowColumnChooser();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
@page "/sysadmin/drivers"
|
||||
@using BlazorAnimation
|
||||
@using TIAM.Entities.Users
|
||||
@using TIAM.Models.Dtos.Users
|
||||
@using TIAM.Resources
|
||||
@using TIAM.Services
|
||||
@using TIAMSharedUI.Pages.Components
|
||||
@using TIAMSharedUI.Shared
|
||||
@using TIAMWebApp.Shared.Application.Interfaces
|
||||
@using TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels
|
||||
@using TIAMWebApp.Shared.Application.Models.PageModels
|
||||
@using TIAMWebApp.Shared.Application.Utility
|
||||
@using AyCode.Services.Loggers
|
||||
@layout AdminLayout
|
||||
@inject IEnumerable<IAcLogWriterClientBase> LogWriters
|
||||
@inject IStringLocalizer<TIAMResources> Localizer
|
||||
@inject ISessionService SessionService
|
||||
|
||||
<PageTitle>User permissions</PageTitle>
|
||||
|
||||
<div class="text-center m-5">
|
||||
<h1>Drivers</h1>
|
||||
<h2 style="font-size:small">Manage drivers here!</h2>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class=" col-12">
|
||||
<Animation Effect="@Effect.FadeInUp" Class="glass" Speed="@Speed.Fast" Delay="@TimeSpan.FromMilliseconds(250)">
|
||||
<div class="card">
|
||||
<div class="d-flex flex-column mb-4 pb-2">
|
||||
<div class="align-self-end pl-2 pb-2">
|
||||
<DxButton Text="Column Chooser"
|
||||
RenderStyle="ButtonRenderStyle.Secondary"
|
||||
IconCssClass="btn-column-chooser"
|
||||
Click="ColumnChooserButton_Click" />
|
||||
</div>
|
||||
|
||||
<DriverGridComponent ShowNestedRows="true" ContextId="Guid.Parse(TransferProductId)" GetAllTag="SignalRTags.GetUserProductMappingsByProductId"></DriverGridComponent>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</Animation>
|
||||
</div>
|
||||
|
||||
<div class=" col-12 col-xl-6">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
private LoggerClient<ManageUserProductMappings> _logger;
|
||||
//public UserModelDtoDetail UserModelDtoDetail = new();
|
||||
|
||||
private string TransferProductId = "814b5495-c2e9-4f1d-a73f-37cd5d353078";
|
||||
|
||||
|
||||
IGrid Grid { get; set; }
|
||||
//object? MasterGridData { get; set; }
|
||||
bool AutoCollapseDetailRow { get; set; }
|
||||
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
_logger = new LoggerClient<ManageUserProductMappings>(LogWriters.ToArray());
|
||||
|
||||
base.OnInitialized();
|
||||
}
|
||||
|
||||
void ColumnChooserButton_Click()
|
||||
{
|
||||
Grid.ShowColumnChooser();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,4 +1,6 @@
|
|||
@page "/user/products"
|
||||
@* Deprecated *@
|
||||
|
||||
@page "/user/products"
|
||||
@using TIAM.Resources
|
||||
@using TIAMSharedUI.Shared
|
||||
@using TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
@page "/user/companies"
|
||||
@page "/sysadmin/companies"
|
||||
@using BlazorAnimation
|
||||
@using TIAM.Entities.ServiceProviders
|
||||
@using TIAM.Resources
|
||||
@using TIAM.Services
|
||||
@using TIAMSharedUI.Pages.Components
|
||||
@using TIAMSharedUI.Shared
|
||||
@using TIAMWebApp.Shared.Application.Interfaces
|
||||
|
|
@ -26,8 +27,8 @@
|
|||
<PageTitle>Admin - Companies</PageTitle>
|
||||
|
||||
<div class="text-center m-5">
|
||||
<h1>Company management</h1>
|
||||
<h2 style="font-size:small">Manage transfers here!</h2>
|
||||
<h1>Partners</h1>
|
||||
<h2 style="font-size:small">Manage partners here!</h2>
|
||||
</div>
|
||||
|
||||
<DxPopup @bind-Visible="@_setOwnerPopupVisible"
|
||||
|
|
@ -82,9 +83,9 @@
|
|||
<Animation Effect="@Effect.Pulse" Speed="@Speed.Fast" Delay="@TimeSpan.FromMilliseconds(250)">
|
||||
<div class="card">
|
||||
<CompanyGrid @ref="_gridCompany"
|
||||
|
||||
Logger="_logger"
|
||||
SignalRClient="AdminSignalRClient"
|
||||
|
||||
AutoCollapseDetailRow="_autoCollapseDetailRow"
|
||||
KeyboardNavigationEnabled="true"
|
||||
CustomizeElement="Grid_CustomizeElement"
|
||||
|
|
@ -132,7 +133,7 @@
|
|||
<ProfileGridComponent ParentData="((Company)context.DataItem)" KeyboardNavigationEnabled="true" />
|
||||
</DxTabPage>
|
||||
<DxTabPage Text="Products">
|
||||
<ProductDetailGridComponent @ref="_productDetailGridComponent" OnGridEditModelSaving="OnProductGridItemSaving" ContextId="((Company)context.DataItem).Id" ParentData="(Company)context.DataItem" KeyboardNavigationEnabled="true" />
|
||||
<ProductDetailGridComponent @ref="_productDetailGridComponent" GetAllTag="SignalRTags.GetProductsByOwnerId" OnGridEditModelSaving="OnProductGridItemSaving" ContextId="((Company)context.DataItem).Id" ParentData="(Company)context.DataItem" KeyboardNavigationEnabled="true" />
|
||||
</DxTabPage>
|
||||
<DxTabPage Text="Address">
|
||||
<AddressDetailGridComponent ParentData="((Company)context.DataItem).Profile" KeyboardNavigationEnabled="true" />
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
@page "/user/transfers"
|
||||
@page "/sysadmin/transfers"
|
||||
@using BlazorAnimation
|
||||
@using TIAM.Core.Enums
|
||||
@using TIAM.Entities.Emails
|
||||
|
|
@ -121,6 +121,7 @@
|
|||
</CellDisplayTemplate>
|
||||
</DxGridDataColumn>
|
||||
<DxGridDataColumn FieldName="PaymentId" DisplayFormat="N"/>
|
||||
<DxGridDataColumn Caption="Paid" FieldName="Payed"/>
|
||||
<DxGridDataColumn FieldName="FromAddress"/>
|
||||
<DxGridDataColumn FieldName="ToAddress"/>
|
||||
<DxGridDataColumn FieldName="Appointment" DisplayFormat="g" Width="140"/>
|
||||
|
|
@ -187,6 +188,10 @@
|
|||
@EditFormContext.GetEditor("PassengerCount")
|
||||
</DxFormLayoutItem>
|
||||
|
||||
<DxFormLayoutItem Caption="Paid:" ColSpanMd="6">
|
||||
@EditFormContext.GetEditor("Payed")
|
||||
</DxFormLayoutItem>
|
||||
|
||||
<DxFormLayoutItem Caption="Status:" ColSpanMd="6">
|
||||
@EditFormContext.GetEditor("TransferStatusType")
|
||||
</DxFormLayoutItem>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
@page "/user/userproductmappings"
|
||||
@page "/sysadmin/userproductmappings"
|
||||
@using BlazorAnimation
|
||||
@using TIAM.Models.Dtos.Users
|
||||
@using TIAM.Resources
|
||||
@using TIAM.Services
|
||||
@using TIAMSharedUI.Pages.Components
|
||||
@using TIAMSharedUI.Shared
|
||||
@using TIAMWebApp.Shared.Application.Interfaces
|
||||
|
|
@ -36,7 +37,7 @@
|
|||
Click="ColumnChooserButton_Click" />
|
||||
</div>
|
||||
|
||||
<UserProductMappingGridComponent></UserProductMappingGridComponent>
|
||||
<UserProductMappingGridComponent ShowNestedRows="true" GetAllTag="SignalRTags.GetAllUserProductMappings"></UserProductMappingGridComponent>
|
||||
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
@page "/user/users"
|
||||
@page "/sysadmin/users"
|
||||
@using BlazorAnimation
|
||||
@using TIAM.Models.Dtos.Users
|
||||
@using TIAM.Resources
|
||||
|
|
|
|||
|
|
@ -1,193 +0,0 @@
|
|||
@using TIAM.Entities.Products
|
||||
@using TIAM.Entities.ServiceProviders
|
||||
@using TIAM.Entities.Transfers
|
||||
@using TIAM.Entities.Drivers
|
||||
@using TIAM.Entities.Users
|
||||
@using TIAM.Models.Dtos.Users
|
||||
@using TIAM.Resources
|
||||
@using TIAMWebApp.Shared.Application.Interfaces
|
||||
@using TIAMWebApp.Shared.Application.Utility
|
||||
@using AyCode.Services.Loggers
|
||||
@using TIAM.Core.Loggers
|
||||
@using Address = TIAM.Entities.Addresses.Address
|
||||
@using Profile = TIAM.Entities.Profiles.Profile
|
||||
@using TIAMSharedUI.Shared.Components.Grids
|
||||
@using TIAMSharedUI.Pages.Components.EditComponents
|
||||
@using TIAMWebApp.Shared.Application.Services
|
||||
@using AyCode.Interfaces.Addresses
|
||||
@inject IStringLocalizer<TIAMResources> Localizer
|
||||
@inject IServiceProviderDataService serviceProviderDataService
|
||||
@inject IUserDataService userDataService
|
||||
@inject ITransferDataService transferDataService
|
||||
@inject IEnumerable<IAcLogWriterClientBase> LogWriters
|
||||
@inject AdminSignalRClient AdminSignalRClient;
|
||||
|
||||
|
||||
<ProductDetailGrid @ref="_productGrid"
|
||||
DataSource = "productList"
|
||||
ContextIds="new[] {(Guid)ContextId}"
|
||||
Logger="_logger"
|
||||
SignalRClient="AdminSignalRClient"
|
||||
OnGridEditModelSaving="DataItemSaving"
|
||||
OnGridItemDeleting="DataItemDeleting"
|
||||
OnGridItemChanged="DataItemChanged"
|
||||
PageSize="5"
|
||||
AutoExpandAllGroupRows="true"
|
||||
KeyboardNavigationEnabled="KeyboardNavigationEnabled"
|
||||
KeyFieldName="Id"
|
||||
ValidationEnabled="false"
|
||||
EditMode="GridEditMode.EditForm"
|
||||
ColumnResizeMode="GridColumnResizeMode.NextColumn"
|
||||
ShowFilterRow="true">
|
||||
<Columns>
|
||||
<DxGridCommandColumn NewButtonVisible="true" Width="8%" FixedPosition="GridColumnFixedPosition.Left" />
|
||||
<DxGridDataColumn FieldName="Id" GroupIndex="0" />
|
||||
<DxGridDataColumn Caption=@Localizer.GetString(ResourceKeys.ProductName) FieldName="Name" />
|
||||
<DxGridDataColumn Caption=@Localizer.GetString(ResourceKeys.ProductType) FieldName="ProductType" Width="140" />
|
||||
<DxGridDataColumn Caption=@Localizer.GetString(ResourceKeys.Price) FieldName="Price" Width="40" />
|
||||
<DxGridDataColumn FieldName="ServiceProviderId" Width="40" />
|
||||
<DxGridDataColumn Caption=@Localizer.GetString(ResourceKeys.ProductDescription) FieldName="Description" Width="40" />
|
||||
</Columns>
|
||||
<DetailRowTemplate>
|
||||
<DxTabs>
|
||||
<DxTabPage Text="Profile">
|
||||
<ProfileGridComponent ParentData="((Product)context.DataItem)" KeyboardNavigationEnabled="true" />
|
||||
</DxTabPage>
|
||||
</DxTabs>
|
||||
</DetailRowTemplate>
|
||||
<EditFormTemplate Context="EditFormContext">
|
||||
@{
|
||||
var transfer2 = (Product)EditFormContext.EditModel;
|
||||
}
|
||||
<DxFormLayout CssClass="w-100">
|
||||
<DxFormLayoutItem Caption=@Localizer.GetString(ResourceKeys.ProductName) ColSpanMd="4">
|
||||
@EditFormContext.GetEditor("Name")
|
||||
</DxFormLayoutItem>
|
||||
<DxFormLayoutItem Caption=@Localizer.GetString(ResourceKeys.ProductType) ColSpanMd="4">
|
||||
@EditFormContext.GetEditor("ProductType")
|
||||
</DxFormLayoutItem>
|
||||
<DxFormLayoutItem Caption=@Localizer.GetString(ResourceKeys.Price) ColSpanMd="4">
|
||||
@EditFormContext.GetEditor("Price")
|
||||
</DxFormLayoutItem>
|
||||
<DxFormLayoutItem Caption=@Localizer.GetString(ResourceKeys.ProductDescription) ColSpanMd="4">
|
||||
@EditFormContext.GetEditor("Description")
|
||||
</DxFormLayoutItem>
|
||||
|
||||
|
||||
</DxFormLayout>
|
||||
</EditFormTemplate>
|
||||
|
||||
</ProductDetailGrid>
|
||||
|
||||
@code {
|
||||
[Parameter] public bool KeyboardNavigationEnabled { get; set; }
|
||||
[Parameter] public Guid? ContextId { get; set; } = null;
|
||||
[Parameter] public IProductsRelation ParentData { get; set; } = null!;
|
||||
[Parameter] public EventCallback<GridEditModelSavingEventArgs> OnGridEditModelSaving { get; set; }
|
||||
|
||||
private ProductDetailGrid _productGrid;
|
||||
private List<Product> productList = new List<Product>();
|
||||
private LoggerClient<ProductDetailGridComponent> _logger = null!;
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
_logger = new LoggerClient<ProductDetailGridComponent>(LogWriters.ToArray());
|
||||
//DataSource = new List<Address>();
|
||||
|
||||
}
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
// if (ParentData != null)
|
||||
// {
|
||||
// productList.AddRange(ParentData.Products);
|
||||
// }
|
||||
// else if (ContextId != null)
|
||||
// {
|
||||
// //_productGrid.ContextIds = new Guid[1];
|
||||
// //_productGrid.ContextIds[0] = (Guid)ContextId;
|
||||
// var data = await serviceProviderDataService.GetProductByIdAsync((Guid)ContextId);
|
||||
// List<Product> result = new List<Product>();
|
||||
// result.Add(data);
|
||||
// _productGrid.DataSource = result;
|
||||
// }
|
||||
// else
|
||||
|
||||
base.OnParametersSet();
|
||||
}
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
// if(firstRender)
|
||||
// {
|
||||
|
||||
// var a = _productGrid;
|
||||
|
||||
// if (ParentData != null)
|
||||
// {
|
||||
// _productGrid.DataSource = new List<Product>();
|
||||
// _productGrid.DataSource = ParentData.Products;
|
||||
// }
|
||||
|
||||
|
||||
// }
|
||||
}
|
||||
|
||||
private void DataItemChanged(GridDataItemChangedEventArgs<Product> args)
|
||||
{
|
||||
_logger.Debug($"Saving: {args.DataItem.Name}, {args.DataItem.ServiceProviderId}");
|
||||
|
||||
//ProductGrid.SaveChangesAsync();
|
||||
}
|
||||
|
||||
public async Task DataItemSaving(GridEditModelSavingEventArgs e)
|
||||
{
|
||||
await OnGridEditModelSaving.InvokeAsync(e);
|
||||
|
||||
if (e.Cancel) return;
|
||||
|
||||
var product = ((Product)e.EditModel);
|
||||
|
||||
if (e.IsNew)
|
||||
{
|
||||
_logger.Debug($"DataItemSaving");
|
||||
|
||||
var profileId = Guid.NewGuid();
|
||||
product.Profile = new Profile(profileId, product.Name);
|
||||
product.ProfileId = profileId;
|
||||
|
||||
var addressId = Guid.NewGuid();
|
||||
product.Profile.Address = new Address(addressId);
|
||||
product.Profile.AddressId = addressId;
|
||||
|
||||
//((Product)e.EditModel).UserProductMappings.Add(new UserProductMapping(Guid.NewGuid, ParentData.));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
_logger.Debug($"Saving: {product.Name}, {product.ServiceProviderId}");
|
||||
|
||||
//var result = serviceProviderDataService.CreateProductAsync((Product)e.EditModel);
|
||||
//_logger.Debug($"saved product: {product.ServiceProviderId}");
|
||||
}
|
||||
|
||||
private void DataItemDeleting(GridDataItemDeletingEventArgs obj)
|
||||
{
|
||||
_logger.Debug($"DataItemDeleting");
|
||||
}
|
||||
|
||||
void CustomizeEditModel(GridCustomizeEditModelEventArgs e)
|
||||
{
|
||||
if (!e.IsNew) return;
|
||||
|
||||
var newProduct = (Product)e.EditModel;
|
||||
newProduct.Id = Guid.NewGuid();
|
||||
newProduct.Name = "Type a name";
|
||||
newProduct.ServiceProviderId = (Guid)ContextId!;
|
||||
newProduct.Price = 0;
|
||||
newProduct.ProductType = TIAM.Core.Enums.ProductType.Hotel;
|
||||
newProduct.Description = "Type a description";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -5,6 +5,7 @@
|
|||
@using TIAM.Entities.Users
|
||||
@using TIAM.Models.Dtos.Users
|
||||
@using TIAM.Resources
|
||||
@using TIAM.Services
|
||||
@using TIAMWebApp.Shared.Application.Interfaces
|
||||
@using TIAMWebApp.Shared.Application.Utility
|
||||
@using AyCode.Services.Loggers
|
||||
|
|
@ -25,6 +26,7 @@
|
|||
|
||||
|
||||
<ProductDetailGrid @ref="_productGrid"
|
||||
GetAllMessageTag="GetAllTag"
|
||||
DataSource = "productList"
|
||||
ContextIds="new[] {(Guid)ContextId}"
|
||||
Logger="_logger"
|
||||
|
|
@ -52,6 +54,10 @@
|
|||
</Columns>
|
||||
<DetailRowTemplate>
|
||||
<DxTabs>
|
||||
<DxTabPage Text="Permissions">
|
||||
<UserProductMappingGridComponent ShowNestedRows="false" ContextId="((Product)context.DataItem).Id" GetAllTag="SignalRTags.GetUserProductMappingsByProductId">
|
||||
</UserProductMappingGridComponent>
|
||||
</DxTabPage>
|
||||
<DxTabPage Text="Profile">
|
||||
<ProfileGridComponent ParentData="((Product)context.DataItem)" KeyboardNavigationEnabled="true" />
|
||||
</DxTabPage>
|
||||
|
|
@ -86,7 +92,7 @@
|
|||
[Parameter] public Guid? ContextId { get; set; } = null;
|
||||
[Parameter] public IProductsRelation ParentData { get; set; } = null!;
|
||||
[Parameter] public EventCallback<GridEditModelSavingEventArgs> OnGridEditModelSaving { get; set; }
|
||||
[Parameter] public int GetAllTag { get; set; }
|
||||
[Parameter] public int GetAllTag { get; set; } = SignalRTags.GetProductsByContextId;
|
||||
|
||||
private ProductDetailGrid _productGrid;
|
||||
private List<Product> productList = new List<Product>();
|
||||
|
|
@ -120,19 +126,19 @@
|
|||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
if(firstRender)
|
||||
{
|
||||
|
||||
_productGrid.GetAllMessageTag = GetAllTag;
|
||||
|
||||
// if (ParentData != null)
|
||||
// if(firstRender)
|
||||
// {
|
||||
// _productGrid.DataSource = new List<Product>();
|
||||
// _productGrid.DataSource = ParentData.Products;
|
||||
|
||||
// _productGrid.GetAllMessageTag = GetAllTag;
|
||||
|
||||
// // if (ParentData != null)
|
||||
// // {
|
||||
// // _productGrid.DataSource = new List<Product>();
|
||||
// // _productGrid.DataSource = ParentData.Products;
|
||||
// // }
|
||||
|
||||
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void DataItemChanged(GridDataItemChangedEventArgs<Product> args)
|
||||
|
|
|
|||
|
|
@ -17,8 +17,9 @@
|
|||
@inject AdminSignalRClient AdminSignalRClient
|
||||
|
||||
|
||||
<UserProductMappingGrid
|
||||
Logger="_logger"
|
||||
<UserProductMappingGrid Logger="_logger"
|
||||
ContextIds="ContextIds"
|
||||
GetAllMessageTag="GetAllTag"
|
||||
SignalRClient="AdminSignalRClient"
|
||||
PageSize="10"
|
||||
AutoExpandAllGroupRows="true"
|
||||
|
|
@ -37,14 +38,21 @@
|
|||
<DxGridDataColumn FieldName="Permissions" />
|
||||
</Columns>
|
||||
<DetailRowTemplate>
|
||||
@{
|
||||
if (ShowNestedRows)
|
||||
{
|
||||
<DxTabs>
|
||||
|
||||
<DxTabPage Text="Products">
|
||||
<ProductDetailGridComponent @ref="bleh" ContextId="((UserProductMapping)context.DataItem).ProductId" KeyboardNavigationEnabled="true" />
|
||||
<ProductDetailGridComponent GetAllTag="SignalRTags.GetProductsById" ContextId="((UserProductMapping)context.DataItem).ProductId" KeyboardNavigationEnabled="true" />
|
||||
</DxTabPage>
|
||||
|
||||
|
||||
</DxTabs>
|
||||
}
|
||||
}
|
||||
</DetailRowTemplate>
|
||||
|
||||
<EditFormTemplate Context="UserEditFormContext">
|
||||
@{
|
||||
var transfer2 = (UserProductMapping)UserEditFormContext.EditModel;
|
||||
|
|
@ -71,7 +79,15 @@
|
|||
[Parameter]
|
||||
public bool KeyboardNavigationEnabled { get; set; }
|
||||
|
||||
[Parameter] public IUserProductMappingForeignKey ParentData { get; set; } = null!;
|
||||
[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;
|
||||
|
||||
|
|
@ -79,6 +95,16 @@
|
|||
|
||||
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());
|
||||
|
|
@ -101,15 +127,6 @@
|
|||
//e.EditModel = newProductMapping;
|
||||
}
|
||||
|
||||
protected override void OnAfterRender(bool firstRender)
|
||||
{
|
||||
if(firstRender)
|
||||
{
|
||||
bleh.GetAllTag = SignalRTags.GetProductsById;
|
||||
}
|
||||
|
||||
base.OnAfterRender(firstRender);
|
||||
}
|
||||
|
||||
async Task EditModelSaving(GridEditModelSavingEventArgs e)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -0,0 +1,31 @@
|
|||
using Microsoft.AspNetCore.Components;
|
||||
using TIAM.Entities.Drivers;
|
||||
using TIAM.Entities.Products;
|
||||
using TIAM.Services;
|
||||
|
||||
namespace TIAMSharedUI.Shared.Components.Grids;
|
||||
|
||||
public class CarDetailGrid : CarGrid
|
||||
{
|
||||
public CarDetailGrid() : base()
|
||||
{
|
||||
GetAllMessageTag = SignalRTags.GetAllCars;
|
||||
AddMessageTag = SignalRTags.CreateCar;
|
||||
UpdateMessageTag = SignalRTags.UpdateCar;
|
||||
RemoveMessageTag = SignalRTags.DeleteCar;
|
||||
}
|
||||
|
||||
protected override Task SetParametersAsyncCore(ParameterView parameters)
|
||||
{
|
||||
if (!IsFirstInitializeParameters)
|
||||
{
|
||||
//ShowFilterRow = true;
|
||||
//ShowGroupPanel = true;
|
||||
//AllowSort = false;
|
||||
|
||||
//etc...
|
||||
}
|
||||
|
||||
return base.SetParametersAsyncCore(parameters);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
using Microsoft.AspNetCore.Components;
|
||||
using TIAM.Entities.Drivers;
|
||||
using TIAM.Entities.Products;
|
||||
using TIAM.Services;
|
||||
|
||||
namespace TIAMSharedUI.Shared.Components.Grids;
|
||||
|
||||
public class CarGrid : TiamGrid<Car>
|
||||
{
|
||||
public CarGrid() : base()
|
||||
{
|
||||
GetAllMessageTag = SignalRTags.GetAllCars;
|
||||
AddMessageTag = SignalRTags.CreateCar;
|
||||
UpdateMessageTag = SignalRTags.UpdateCar;
|
||||
RemoveMessageTag = SignalRTags.DeleteCar;
|
||||
}
|
||||
|
||||
protected override Task SetParametersAsyncCore(ParameterView parameters)
|
||||
{
|
||||
if (!IsFirstInitializeParameters)
|
||||
{
|
||||
//ShowFilterRow = true;
|
||||
//ShowGroupPanel = true;
|
||||
//AllowSort = false;
|
||||
|
||||
//etc...
|
||||
}
|
||||
|
||||
return base.SetParametersAsyncCore(parameters);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
using Microsoft.AspNetCore.Components;
|
||||
using TIAM.Entities.ServiceProviders;
|
||||
using TIAM.Entities.Users;
|
||||
using TIAM.Services;
|
||||
|
||||
namespace TIAMSharedUI.Shared.Components.Grids;
|
||||
|
||||
public class UserProductMappingDriverGrid : TiamGrid<UserProductMapping>
|
||||
{
|
||||
public UserProductMappingDriverGrid() : base()
|
||||
{
|
||||
GetAllMessageTag = SignalRTags.GetAllUserProductMappings;
|
||||
AddMessageTag = SignalRTags.CreateUserProductMapping;
|
||||
UpdateMessageTag = SignalRTags.UpdateUserProductMapping;
|
||||
RemoveMessageTag = SignalRTags.DeleteUserProductMapping;
|
||||
}
|
||||
|
||||
protected override Task SetParametersAsyncCore(ParameterView parameters)
|
||||
{
|
||||
if (!IsFirstInitializeParameters)
|
||||
{
|
||||
//ShowFilterRow = true;
|
||||
//ShowGroupPanel = true;
|
||||
//AllowSort = false;
|
||||
|
||||
//etc...
|
||||
}
|
||||
|
||||
return base.SetParametersAsyncCore(parameters);
|
||||
}
|
||||
}
|
||||
|
|
@ -15,10 +15,13 @@
|
|||
<DxMenuItem Text="SysAdmin" IconCssClass="menu-icon-products menu-icon">
|
||||
<Items>
|
||||
<DxMenuItem NavigateUrl="user/sysadmin" Text="Dashboard" />
|
||||
<DxMenuItem NavigateUrl="user/transfers" Text="Transfers" />
|
||||
<DxMenuItem NavigateUrl="user/companies" Text="Companies" />
|
||||
<DxMenuItem NavigateUrl="user/userproductmappings" Text="Permissions" />
|
||||
<DxMenuItem NavigateUrl="user/users" Text="Users" />
|
||||
<DxMenuItem NavigateUrl="sysadmin/transfers" Text="Transfers" />
|
||||
<DxMenuItem NavigateUrl="sysadmin/companies" Text="Companies" />
|
||||
<DxMenuItem NavigateUrl="sysadmin/drivers" Text="Drivers" />
|
||||
<DxMenuItem NavigateUrl="sysadmin/cars" Text="Cars" />
|
||||
|
||||
<DxMenuItem NavigateUrl="sysadmin/userproductmappings" Text="Permissions" />
|
||||
<DxMenuItem NavigateUrl="sysadmin/users" Text="Users" />
|
||||
<DxMenuItem NavigateUrl="user/destinations" Text="Destinations" />
|
||||
</Items>
|
||||
</DxMenuItem>
|
||||
|
|
|
|||
|
|
@ -213,9 +213,9 @@ namespace TIAMWebApp.Server.Controllers
|
|||
//23.
|
||||
[AllowAnonymous]
|
||||
[HttpPost]
|
||||
[Route(APIUrls.GetUserProductMappingsByProductRouteName)]
|
||||
[Route(APIUrls.GetUserProductMappingsByProductIdRouteName)]
|
||||
[SignalR(SignalRTags.GetUserProductMappingsByProductId)]
|
||||
public async Task<string> GetUserProductMappingsForProduct(Guid productId)
|
||||
public async Task<string> GetUserProductMappingsByProductId(Guid productId)
|
||||
{
|
||||
_logger.Info($@"GetUserProductMappingsByUserId called with serviceProviderId: {productId}");
|
||||
|
||||
|
|
@ -229,9 +229,9 @@ namespace TIAMWebApp.Server.Controllers
|
|||
|
||||
[AllowAnonymous]
|
||||
[HttpPost]
|
||||
[Route(APIUrls.GetUserProductMappingsByUserRouteName)]
|
||||
[Route(APIUrls.GetUserProductMappingsByUserIdRouteName)]
|
||||
[SignalR(SignalRTags.GetUserProductMappingsByUserId)]
|
||||
public async Task<string> GetUserProductMappingsByProduct(Guid userId)
|
||||
public async Task<string> GetUserProductMappingsByUserId(Guid userId)
|
||||
{
|
||||
_logger.Info($@"GetUserProductMappingsByUserId called with userId: {userId}");
|
||||
|
||||
|
|
@ -243,6 +243,22 @@ namespace TIAMWebApp.Server.Controllers
|
|||
return myUserProductMappings.ToJson();
|
||||
}
|
||||
|
||||
[AllowAnonymous]
|
||||
[HttpPost]
|
||||
[Route(APIUrls.GetUserProductMappingByIdRouteName)]
|
||||
[SignalR(SignalRTags.GetUserProductMappingById)]
|
||||
public async Task<string> GetUserProductMappingById(Guid id)
|
||||
{
|
||||
_logger.Info($@"GetUserProductMappingsByUserId called with userId: {id}");
|
||||
|
||||
var userProductMappings = adminDal.GetAllUserProductMappings();
|
||||
|
||||
var myUserProductMappings = userProductMappings.Where(x => x.Id == id).ToList();
|
||||
//put serviceprovider id and name into a dictionary
|
||||
|
||||
return myUserProductMappings.ToJson();
|
||||
}
|
||||
|
||||
[AllowAnonymous]
|
||||
[HttpPost]
|
||||
[Route(APIUrls.GetAllUserProductMappingsRouteName)]
|
||||
|
|
@ -263,11 +279,24 @@ namespace TIAMWebApp.Server.Controllers
|
|||
[HttpGet]
|
||||
[Route(APIUrls.GetCarsForUserProductMappingRouteName + "/{userProductMappingId}")]
|
||||
[SignalR(SignalRTags.GetCarsForUserProductMapping)]
|
||||
public async Task<List<Car>> GetCarsForUserProductMapping(string userProductMappingId)
|
||||
public async Task<List<Car>> GetCarsForUserProductMapping(Guid userProductMappingId)
|
||||
{
|
||||
_logger.Info($@"GetCarsForUserProductMapping called with userProductMappingId: {userProductMappingId}");
|
||||
|
||||
var cars = adminDal.GetCarByUserProductMappingId(Guid.Parse(userProductMappingId));
|
||||
var cars = adminDal.GetCarByUserProductMappingId(userProductMappingId);
|
||||
|
||||
return cars;
|
||||
}
|
||||
|
||||
[AllowAnonymous]
|
||||
[HttpGet]
|
||||
[Route(APIUrls.GetAllCarsRouteName)]
|
||||
[SignalR(SignalRTags.GetAllCars)]
|
||||
public async Task<List<Car>> GetAllCars()
|
||||
{
|
||||
_logger.Info($@"GetAllCars called ");
|
||||
|
||||
var cars = await adminDal.GetAllCarsAsync();
|
||||
|
||||
return cars;
|
||||
}
|
||||
|
|
@ -310,8 +339,13 @@ namespace TIAMWebApp.Server.Controllers
|
|||
[Tags("Finished", "Cars")]
|
||||
[EndpointSummary("Create car")]
|
||||
[SignalR(SignalRTags.CreateCar)]
|
||||
public async Task<IActionResult> CreateCar(Car car)
|
||||
=> await CarDataChanging(car, TrackingState.Add) ? Ok(car) : BadRequest("Invalid request");
|
||||
public async Task<Car> CreateCar(Car car)
|
||||
{
|
||||
var result = await CarDataChanging(car, TrackingState.Add);
|
||||
if (result)
|
||||
return car;
|
||||
else return null;
|
||||
}
|
||||
|
||||
[AllowAnonymous]
|
||||
[HttpPost]
|
||||
|
|
@ -319,8 +353,14 @@ namespace TIAMWebApp.Server.Controllers
|
|||
[Tags("Finished", "Cars")]
|
||||
[EndpointSummary("Update car")]
|
||||
[SignalR(SignalRTags.UpdateCar)]
|
||||
public async Task<IActionResult> UpdateCar(Car car)
|
||||
=> await CarDataChanging(car, TrackingState.Update) ? Ok(car) : BadRequest("Invalid request");
|
||||
public async Task<Car> UpdateCar(Car car)
|
||||
{
|
||||
var result = await CarDataChanging(car, TrackingState.Update);
|
||||
if (result)
|
||||
return car;
|
||||
else return null;
|
||||
}
|
||||
|
||||
|
||||
[AllowAnonymous]
|
||||
[HttpPost]
|
||||
|
|
|
|||
|
|
@ -159,11 +159,14 @@ namespace TIAMWebApp.Shared.Application.Models
|
|||
public const string GetAllUserProductMappingsRouteName = "GetAllUserProductMappings";
|
||||
public const string GetAllUserProductMappings = ServiceProviderAPI + GetAllUserProductMappingsRouteName;
|
||||
|
||||
public const string GetUserProductMappingsByProductRouteName = "GetUserProductMappingsByProduct";
|
||||
public const string GetUserProductMappingsByProduct = ServiceProviderAPI + GetUserProductMappingsByProductRouteName;
|
||||
public const string GetUserProductMappingsByProductIdRouteName = "GetUserProductMappingsByProductId";
|
||||
public const string GetUserProductMappingsByProductId = ServiceProviderAPI + GetUserProductMappingsByProductIdRouteName;
|
||||
|
||||
public const string GetUserProductMappingsByUserRouteName = "GetUserProductMappingsByUser";
|
||||
public const string GetUserProductMappingsByUser = ServiceProviderAPI + GetUserProductMappingsByUserRouteName;
|
||||
public const string GetUserProductMappingsByUserIdRouteName = "GetUserProductMappingsByUserId";
|
||||
public const string GetUserProductMappingsByUserId = ServiceProviderAPI + GetUserProductMappingsByUserIdRouteName;
|
||||
|
||||
public const string GetUserProductMappingByIdRouteName = "GetUserProductMappingById";
|
||||
public const string GetUserProductMappingById = ServiceProviderAPI + GetUserProductMappingByIdRouteName;
|
||||
|
||||
public const string GetCarsForUserProductMappingRouteName = "GetCarsForUserProductMapping";
|
||||
public const string GetCarsForUserProductMapping = ServiceProviderAPI + GetCarsForUserProductMappingRouteName;
|
||||
|
|
@ -177,6 +180,9 @@ namespace TIAMWebApp.Shared.Application.Models
|
|||
public const string DeleteCarRouteName = "DeleteCar";
|
||||
public const string DeleteCar = ServiceProviderAPI + DeleteCarRouteName;
|
||||
|
||||
public const string GetAllCarsRouteName = "GetAllCars";
|
||||
public const string GetAllCars = ServiceProviderAPI + GetAllCarsRouteName;
|
||||
|
||||
public const string GetProfileByIdRouteName = "GetProfileById";
|
||||
public const string GetProfileById = ProfileAPI + GetProfileByIdRouteName;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue