171 lines
5.7 KiB
Plaintext
171 lines
5.7 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
|
|
|
|
|
|
<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");
|
|
}
|
|
|
|
} |