From eed3494a69bb908bfaa548414e9e3ab6014de556 Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 4 Jul 2024 18:59:16 +0200 Subject: [PATCH 1/3] prices --- ...ferDestinationToProductGridComponent.razor | 66 +++++++++++++++---- 1 file changed, 54 insertions(+), 12 deletions(-) diff --git a/TIAMSharedUI/Pages/User/SysAdmins/TransferDestinationToProductGridComponent.razor b/TIAMSharedUI/Pages/User/SysAdmins/TransferDestinationToProductGridComponent.razor index 8d9c246a..d54dcd11 100644 --- a/TIAMSharedUI/Pages/User/SysAdmins/TransferDestinationToProductGridComponent.razor +++ b/TIAMSharedUI/Pages/User/SysAdmins/TransferDestinationToProductGridComponent.razor @@ -4,6 +4,7 @@ @using TIAM.Entities.Drivers @using TIAM.Entities.Users @using TIAM.Models.Dtos.Users +@using TIAM.Services @using TIAMWebApp.Shared.Application.Interfaces @using TIAMWebApp.Shared.Application.Services @using TIAMWebApp.Shared.Application.Utility @@ -16,13 +17,13 @@ @inject IEnumerable LogWriters @inject AdminSignalRClient AdminSignalRClient; - + @@ -30,7 +31,7 @@ @* @{ - var destinationNameFieldName = $"{nameof(TransferDestinationToProduct.TransferDestination.Name)}.{nameof(TransferDestination.Name)}"; + var destinationNameFieldName = $"{nameof(TransferDestinationToProduct.TransferDestination.Name)}.{nameof(TransferDestination.Name)}"; } *@ @@ -40,10 +41,10 @@ - + - + @@ -61,7 +62,34 @@ @editFormContext.GetEditor("Price3") - + + @{ + var contextId = ((TransferDestinationToProduct)editFormContext.EditModel).Id; + TransferDestinationToProduct thisItem = (TransferDestinationToProduct)editFormContext.EditModel; + if (Value != null) + { + thisItem.TransferDestinationId = ((TransferDestination)Value).Id; + } + } + + + + + + + + @editFormContext.GetEditor("ProductCommis") @@ -75,6 +103,20 @@ private LoggerClient _logger = null!; + object Value { get; set; } + + string QueryText(DropDownBoxQueryDisplayTextContext arg) + { + if (arg.Value is TransferDestination value) + return value.Id.ToString(); + return string.Empty; + } + void GridSelectedDataItemChanged(object item, IDropDownBox dropDownBox) + { + Value = item as TransferDestination; + dropDownBox.HideDropDown(); + } + protected override void OnInitialized() { _logger = new LoggerClient(LogWriters.ToArray()); @@ -118,6 +160,6 @@ // { // //refresh grid // _logger.Info("orderData grid refreshed"); - // } + // } } \ No newline at end of file From 5a525450715fb8f4ef6ed96d59fb9df44c2c52da Mon Sep 17 00:00:00 2001 From: Adam Date: Fri, 5 Jul 2024 11:20:14 +0200 Subject: [PATCH 2/3] =?UTF-8?q?ba#&#@#@#=C3=A1ba=20commit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Pages/User/MyServiceProviders.razor | 4 +- .../User/SysAdmins/DriverGridComponent.razor | 4 +- .../ManageTransferDestinationToProducts.razor | 4 +- .../User/SysAdmins/ProductGridComponent.razor | 4 +- .../TransferDestinationGridComponent.razor | 2 +- ...tinationToProductDetailGridComponent.razor | 123 ++++++++++++++---- ...ferDestinationToProductGridComponent.razor | 109 +++++++--------- .../UserProductMappingGridComponent.razor | 6 + 8 files changed, 161 insertions(+), 95 deletions(-) diff --git a/TIAMSharedUI/Pages/User/MyServiceProviders.razor b/TIAMSharedUI/Pages/User/MyServiceProviders.razor index 8c9cb06b..cb9d183e 100644 --- a/TIAMSharedUI/Pages/User/MyServiceProviders.razor +++ b/TIAMSharedUI/Pages/User/MyServiceProviders.razor @@ -20,8 +20,8 @@ User permissions
-

Drivers

-

Manage drivers here!

+

My companies

+

Manage your companies here!

diff --git a/TIAMSharedUI/Pages/User/SysAdmins/DriverGridComponent.razor b/TIAMSharedUI/Pages/User/SysAdmins/DriverGridComponent.razor index dda2ea58..80d9a0bd 100644 --- a/TIAMSharedUI/Pages/User/SysAdmins/DriverGridComponent.razor +++ b/TIAMSharedUI/Pages/User/SysAdmins/DriverGridComponent.razor @@ -108,7 +108,7 @@ } - + @transfer2.UserId @{ var a = UserEditFormContext.GetEditor("UserId"); @@ -117,7 +117,7 @@ Select user - + @UserEditFormContext.GetEditor("Permissions") diff --git a/TIAMSharedUI/Pages/User/SysAdmins/ManageTransferDestinationToProducts.razor b/TIAMSharedUI/Pages/User/SysAdmins/ManageTransferDestinationToProducts.razor index 46cd6546..4426d28f 100644 --- a/TIAMSharedUI/Pages/User/SysAdmins/ManageTransferDestinationToProducts.razor +++ b/TIAMSharedUI/Pages/User/SysAdmins/ManageTransferDestinationToProducts.razor @@ -46,7 +46,7 @@ @code { - private LoggerClient _logger; + private LoggerClient _logger; //public UserModelDtoDetail UserModelDtoDetail = new(); @@ -135,7 +135,7 @@ protected override void OnInitialized() { - _logger = new LoggerClient(LogWriters.ToArray()); + _logger = new LoggerClient(LogWriters.ToArray()); base.OnInitialized(); } diff --git a/TIAMSharedUI/Pages/User/SysAdmins/ProductGridComponent.razor b/TIAMSharedUI/Pages/User/SysAdmins/ProductGridComponent.razor index fcc59ace..be32e39d 100644 --- a/TIAMSharedUI/Pages/User/SysAdmins/ProductGridComponent.razor +++ b/TIAMSharedUI/Pages/User/SysAdmins/ProductGridComponent.razor @@ -48,7 +48,7 @@ - + @@ -76,8 +76,6 @@ @editFormContext.GetEditor("Description") - - diff --git a/TIAMSharedUI/Pages/User/SysAdmins/TransferDestinationGridComponent.razor b/TIAMSharedUI/Pages/User/SysAdmins/TransferDestinationGridComponent.razor index 5921eb78..fe7cc083 100644 --- a/TIAMSharedUI/Pages/User/SysAdmins/TransferDestinationGridComponent.razor +++ b/TIAMSharedUI/Pages/User/SysAdmins/TransferDestinationGridComponent.razor @@ -55,7 +55,7 @@ - + diff --git a/TIAMSharedUI/Pages/User/SysAdmins/TransferDestinationToProductDetailGridComponent.razor b/TIAMSharedUI/Pages/User/SysAdmins/TransferDestinationToProductDetailGridComponent.razor index 0ef37798..075e9710 100644 --- a/TIAMSharedUI/Pages/User/SysAdmins/TransferDestinationToProductDetailGridComponent.razor +++ b/TIAMSharedUI/Pages/User/SysAdmins/TransferDestinationToProductDetailGridComponent.razor @@ -1,4 +1,5 @@ -@using TIAM.Entities.Products +@using AyCode.Core.Helpers +@using TIAM.Entities.Products @using TIAM.Entities.ServiceProviders @using TIAM.Entities.Transfers @using TIAM.Entities.Drivers @@ -18,19 +19,42 @@ - - + + + @{ + var TransferDestinationToProductEditModel = (TransferDestinationToProduct)context.EditModel; + } + + + + + + + + @{ + var TransferDestinationToProductEditModel = (TransferDestinationToProduct)context.EditModel; + + } + + + + @* @{ var destinationNameFieldName = $"{nameof(TransferDestinationToProduct.TransferDestination.Name)}.{nameof(TransferDestination.Name)}"; @@ -54,29 +78,29 @@
- - @{ - var transferDestinationToProduct = (TransferDestinationToProduct)editFormContext.EditModel; - } - - - @editFormContext.GetEditor("Price") - - - @editFormContext.GetEditor("Price2") - - - @editFormContext.GetEditor("Price3") - + @* + @{ + var transferDestinationToProduct = (TransferDestinationToProduct)editFormContext.EditModel; + } + + + @editFormContext.GetEditor("Price") + + + @editFormContext.GetEditor("Price2") + + + @editFormContext.GetEditor("Price3") + - - @editFormContext.GetEditor("ProductCommis") - + + @editFormContext.GetEditor("ProductCommis") + - - + + *@ @@ -84,13 +108,64 @@ [Parameter] public GridDetailExpandButtonDisplayMode DetailExpandButtonDisplayMode { get; set; } = GridDetailExpandButtonDisplayMode.Never; [Parameter] public Guid[]? ContextIds { get; set; } = null!; [Parameter] public int GetAllTag { get; set; } = SignalRTags.GetAllTransferDestinationToProducts; + [Parameter] public bool IsProductIdReadonly { get; set; } = false; + [Parameter] public bool IsDestinationIdReadonly { get; set; } = false; + + private bool ProductIdReadOnly = false; + private bool DestinationIdReadOnly = false; + + //private bool? _isNewState = null; + private List _transferDestinations = []; + private List _products = []; private LoggerClient _logger = null!; protected override void OnInitialized() { _logger = new LoggerClient(LogWriters.ToArray()); - + AdminSignalRClient.GetAllIntoAsync(_transferDestinations, SignalRTags.GetAllTransferDestinations).Forget(); + AdminSignalRClient.GetAllIntoAsync(_products, SignalRTags.GetAllProducts).Forget(); base.OnInitialized(); } + + void CustomizeEditModel(GridCustomizeEditModelEventArgs e) + { + if (!e.IsNew) + { + DestinationIdReadOnly = true; + + ProductIdReadOnly = true; + + } + else + { + if(IsDestinationIdReadonly) + { + ((TransferDestinationToProduct)(e.EditModel)).TransferDestinationId = (Guid)ContextIds[0]; + } + DestinationIdReadOnly = IsDestinationIdReadonly; + if (IsProductIdReadonly) + { + ((TransferDestinationToProduct)(e.EditModel)).ProductId = (Guid)ContextIds[0]; + } + ProductIdReadOnly = IsProductIdReadonly; + } + + if (!e.IsNew) return; + + } + + private void OnGridEditModelSaving(GridEditModelSavingEventArgs e) + { + DestinationIdReadOnly = false; + ProductIdReadOnly = false; + } + + private void EditCanceling(GridEditCancelingEventArgs e) + { + DestinationIdReadOnly = false; + ProductIdReadOnly = false; + } + + } \ No newline at end of file diff --git a/TIAMSharedUI/Pages/User/SysAdmins/TransferDestinationToProductGridComponent.razor b/TIAMSharedUI/Pages/User/SysAdmins/TransferDestinationToProductGridComponent.razor index d54dcd11..9ee683bf 100644 --- a/TIAMSharedUI/Pages/User/SysAdmins/TransferDestinationToProductGridComponent.razor +++ b/TIAMSharedUI/Pages/User/SysAdmins/TransferDestinationToProductGridComponent.razor @@ -1,4 +1,5 @@ -@using TIAM.Entities.Products +@using AyCode.Core.Helpers +@using TIAM.Entities.Products @using TIAM.Entities.ServiceProviders @using TIAM.Entities.Transfers @using TIAM.Entities.Drivers @@ -19,16 +20,38 @@ - - - + + + + @{ + var TransferDestinationToProductEditModel = (TransferDestinationToProduct)context.EditModel; + } + + + + + + + + @{ + var TransferDestinationToProductEditModel = (TransferDestinationToProduct)context.EditModel; + + } + + + + @* @{ var destinationNameFieldName = $"{nameof(TransferDestinationToProduct.TransferDestination.Name)}.{nameof(TransferDestination.Name)}"; @@ -48,7 +71,7 @@ - + @* @{ var transferDestinationToProduct = (TransferDestinationToProduct)editFormContext.EditModel; } @@ -63,38 +86,13 @@ @editFormContext.GetEditor("Price3") - @{ - var contextId = ((TransferDestinationToProduct)editFormContext.EditModel).Id; - TransferDestinationToProduct thisItem = (TransferDestinationToProduct)editFormContext.EditModel; - if (Value != null) - { - thisItem.TransferDestinationId = ((TransferDestination)Value).Id; - } - } - - - - - - - + @editFormContext.GetEditor("ProductCommis") - + *@ @@ -102,41 +100,30 @@ [Parameter] public GridDetailExpandButtonDisplayMode DetailExpandButtonDisplayMode { get; set; } = GridDetailExpandButtonDisplayMode.Never; private LoggerClient _logger = null!; + private bool? _isNewState = null; + private List _transferDestinations = []; + private List _products = []; + - object Value { get; set; } - - string QueryText(DropDownBoxQueryDisplayTextContext arg) - { - if (arg.Value is TransferDestination value) - return value.Id.ToString(); - return string.Empty; - } - void GridSelectedDataItemChanged(object item, IDropDownBox dropDownBox) - { - Value = item as TransferDestination; - dropDownBox.HideDropDown(); - } - - protected override void OnInitialized() + protected override async Task OnInitializedAsync() { _logger = new LoggerClient(LogWriters.ToArray()); - - base.OnInitialized(); + AdminSignalRClient.GetAllIntoAsync(_transferDestinations, SignalRTags.GetAllTransferDestinations).Forget(); + AdminSignalRClient.GetAllIntoAsync(_products, SignalRTags.GetAllProducts).Forget(); + await base.OnInitializedAsync(); } - // void CustomizeEditModel(GridCustomizeEditModelEventArgs e) - // { - // if (!e.IsNew) return; + void CustomizeEditModel(GridCustomizeEditModelEventArgs e) + { + _isNewState = e.IsNew; + if (!e.IsNew) return; - // var newProductMapping = new UserProductMapping - // { - // ProductId = Guid.NewGuid(), - // UserId = UserModelDtoDetail.Id, - // Permissions = 1 - // }; + } - // e.EditModel = newProductMapping; - // } + private void OnGridEditModelSaving(GridEditModelSavingEventArgs e) + { + _isNewState = false; + } // async Task EditModelSaving(GridEditModelSavingEventArgs e) // { diff --git a/TIAMSharedUI/Pages/User/SysAdmins/UserProductMappingGridComponent.razor b/TIAMSharedUI/Pages/User/SysAdmins/UserProductMappingGridComponent.razor index 467afa69..1e15b823 100644 --- a/TIAMSharedUI/Pages/User/SysAdmins/UserProductMappingGridComponent.razor +++ b/TIAMSharedUI/Pages/User/SysAdmins/UserProductMappingGridComponent.razor @@ -28,6 +28,7 @@ PageSize="10" ValidationEnabled="false" CustomizeEditModel="CustomizeEditModel" + EditCanceling="EditCanceling" EditMode="GridEditMode.EditRow" ColumnResizeMode="GridColumnResizeMode.NextColumn" OnGridEditModelSaving="OnGridEditModelSaving" @@ -175,4 +176,9 @@ _isNewState = false; } + private void EditCanceling(GridEditCancelingEventArgs e) + { + _isNewState = false; + } + } \ No newline at end of file From 1febed99843f07bd257a39cd26c468cdfcbb5ec4 Mon Sep 17 00:00:00 2001 From: Adam Date: Fri, 5 Jul 2024 11:44:26 +0200 Subject: [PATCH 3/3] profilegrid edit profile fix --- .../Pages/User/SysAdmins/ProfileGridComponent.razor | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/TIAMSharedUI/Pages/User/SysAdmins/ProfileGridComponent.razor b/TIAMSharedUI/Pages/User/SysAdmins/ProfileGridComponent.razor index 93e7b0fd..15e3012b 100644 --- a/TIAMSharedUI/Pages/User/SysAdmins/ProfileGridComponent.razor +++ b/TIAMSharedUI/Pages/User/SysAdmins/ProfileGridComponent.razor @@ -21,14 +21,16 @@ Logger="_logger" SignalRClient="AdminSignalRClient" ValidationEnabled="false" - EditMode="GridEditMode.EditForm" + EditMode="GridEditMode.EditRow" ColumnResizeMode="GridColumnResizeMode.NextColumn" DetailExpandButtonDisplayMode="DetailExpandButtonDisplayMode"> - - + + + +