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