@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 LogWriters @inject AdminSignalRClient AdminSignalRClient @{ if (ShowNestedRows) { } } @{ var car = (Car)UserEditFormContext.EditModel; } @UserEditFormContext.GetEditor("CountryCode") @UserEditFormContext.GetEditor("LicencePlate") @UserEditFormContext.GetEditor("Color") @UserEditFormContext.GetEditor("Manufacture") @UserEditFormContext.GetEditor("CarModel") @UserEditFormContext.GetEditor("YearOfMake") @UserEditFormContext.GetEditor("SeatNumber") @UserEditFormContext.GetEditor("CarMotorType") @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 _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(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"); } }