136 lines
5.3 KiB
Plaintext
136 lines
5.3 KiB
Plaintext
@using TIAM.Entities.Products
|
|
@using TIAM.Entities.Transfers
|
|
@using TIAM.Entities.Drivers
|
|
@using TIAM.Entities.Users
|
|
@using TIAM.Models.Dtos.Users
|
|
@using TIAM.Services
|
|
@using TIAMSharedUI.Shared.Components.Grids
|
|
@using TIAMWebApp.Shared.Application.Interfaces
|
|
@using TIAMWebApp.Shared.Application.Services
|
|
@using TIAMWebApp.Shared.Application.Utility
|
|
@using TIAM.Core.Loggers
|
|
@using AyCode.Core.Loggers
|
|
@using AyCode.Services.Loggers
|
|
@using AyCode.Core
|
|
@inject IServiceProviderDataService ServiceProviderDataService
|
|
@inject IEnumerable<IAcLogWriterClientBase> LogWriters
|
|
@inject AdminSignalRClient AdminSignalRClient
|
|
|
|
|
|
<CarDetailGrid Logger="_logger"
|
|
ContextIds="new [] {ContextId}"
|
|
GetAllMessageTag="GetAllTag"
|
|
SignalRClient="AdminSignalRClient"
|
|
PageSize="10"
|
|
AutoExpandAllGroupRows="true"
|
|
KeyboardNavigationEnabled="KeyboardNavigationEnabled"
|
|
KeyFieldName="Id"
|
|
ValidationEnabled="false"
|
|
CustomizeEditModel="CustomizeEditModel"
|
|
EditMode="GridEditMode.EditForm"
|
|
ColumnResizeMode="GridColumnResizeMode.NextColumn"
|
|
DetailExpandButtonDisplayMode="DetailExpandButtonDisplayMode"
|
|
ShowFilterRow="true">
|
|
<Columns>
|
|
<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"/>
|
|
<DxGridDataColumn FieldName="Color"/>
|
|
<DxGridDataColumn FieldName="Manufacture"/>
|
|
<DxGridDataColumn FieldName="CarModel"/>
|
|
<DxGridDataColumn FieldName="YearOfMake"/>
|
|
<DxGridDataColumn FieldName="SeatNumber"/>
|
|
<DxGridDataColumn FieldName="CarMotorType"/>
|
|
</Columns>
|
|
<DetailRowTemplate>
|
|
@{
|
|
<DxTabs>
|
|
|
|
<DxTabPage Text="Driving permissions assigned">
|
|
<UserProductMappingGridComponent GetAllTag="SignalRTags.GetUserProductMappingById" ContextIds="new[] { ((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 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;
|
|
|
|
private LoggerClient<CarDetailGridComponent> _logger = null!;
|
|
|
|
protected override void OnInitialized()
|
|
{
|
|
_logger = new LoggerClient<CarDetailGridComponent>(LogWriters.ToArray());
|
|
|
|
base.OnInitialized();
|
|
}
|
|
|
|
void CustomizeEditModel(GridCustomizeEditModelEventArgs e)
|
|
{
|
|
if (e.IsNew)
|
|
{
|
|
var newCar = new Car
|
|
{
|
|
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
|
|
{
|
|
//
|
|
}
|
|
}
|
|
|
|
} |