improvements, fixes
This commit is contained in:
parent
5355bd09cd
commit
05b76fe8a4
|
|
@ -149,9 +149,10 @@ namespace TIAM.Database.DataLayers.Admins
|
||||||
#region TransferDestination
|
#region TransferDestination
|
||||||
|
|
||||||
public Task<List<TransferDestination>> GetTransferDestinationsAsync() => SessionAsync(ctx => ctx.GetTransferDestinations().ToList());
|
public Task<List<TransferDestination>> GetTransferDestinationsAsync() => SessionAsync(ctx => ctx.GetTransferDestinations().ToList());
|
||||||
|
|
||||||
public TransferDestination? GetTransferDestinationById(Guid transferDestinationId) => Session(ctx => ctx.GetTransferDestinationById(transferDestinationId));
|
public TransferDestination? GetTransferDestinationById(Guid transferDestinationId) => Session(ctx => ctx.GetTransferDestinationById(transferDestinationId));
|
||||||
public Task<TransferDestination?> GetTransferDestinationByIdAsync(Guid transferDestinationId) => SessionAsync(ctx => ctx.GetTransferDestinationById(transferDestinationId));
|
public Task<TransferDestination?> GetTransferDestinationByIdAsync(Guid transferDestinationId) => SessionAsync(ctx => ctx.GetTransferDestinationById(transferDestinationId));
|
||||||
public string? GetTransferDestinationJsonById(Guid transferDestinationId) => Session(ctx => ctx.GetTransferDestinationById(transferDestinationId)?.ToJson());
|
public Task<List<TransferDestination>> GetPublicTransferDestinationsAsync(Guid productId) => SessionAsync(ctx => ctx.GetTransferDestinations().Where(x => !x.ProductId.HasValue || x.ProductId == productId).ToList());
|
||||||
|
|
||||||
public Task<bool> AddTransferDestinationAsync(TransferDestination transferDestination) => TransactionAsync(ctx => ctx.AddTransferDestination(transferDestination));
|
public Task<bool> AddTransferDestinationAsync(TransferDestination transferDestination) => TransactionAsync(ctx => ctx.AddTransferDestination(transferDestination));
|
||||||
public Task<bool> UpdateTransferDestinationAsync(TransferDestination transferDestination) => TransactionAsync(ctx => ctx.UpdateTransferDestination(transferDestination));
|
public Task<bool> UpdateTransferDestinationAsync(TransferDestination transferDestination) => TransactionAsync(ctx => ctx.UpdateTransferDestination(transferDestination));
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ namespace TIAM.Entities.Transfers
|
||||||
[ForeignKey(nameof(AddressId))]
|
[ForeignKey(nameof(AddressId))]
|
||||||
public virtual Address Address { get; set; }
|
public virtual Address Address { get; set; }
|
||||||
|
|
||||||
|
public Guid? ProductId { get; set; }
|
||||||
//public virtual List<Product> Products { get; set; }
|
//public virtual List<Product> Products { get; set; }
|
||||||
//public virtual List<TransferDestinationToProduct> TransferDestinationToProducts { get; set; }
|
//public virtual List<TransferDestinationToProduct> TransferDestinationToProducts { get; set; }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,5 +4,6 @@ namespace TIAM.Services.Interfaces;
|
||||||
|
|
||||||
public interface ITransferApiControllerClient : ITransferApiControllerCommon
|
public interface ITransferApiControllerClient : ITransferApiControllerCommon
|
||||||
{
|
{
|
||||||
Task GetTransferDestinationsInto(List<TransferDestination> intoDestinationList, Action? callback = null);
|
Task GetTransferDestinationsAsync(List<TransferDestination> intoDestinationList, Action? callback = null);
|
||||||
|
Task GetPublicTransferDestinationsAsync(List<TransferDestination> intoDestinationList, Guid includeProductId, Action? callback = null);
|
||||||
}
|
}
|
||||||
|
|
@ -27,6 +27,7 @@ public interface ITransferApiControllerCommon
|
||||||
|
|
||||||
#region TransferDestination
|
#region TransferDestination
|
||||||
public Task<List<TransferDestination>> GetTransferDestinations();
|
public Task<List<TransferDestination>> GetTransferDestinations();
|
||||||
|
public Task<List<TransferDestination>> GetPublicTransferDestinations(Guid includeProductId);
|
||||||
public Task<TransferDestination?> GetTransferDestinationById(Guid transferDestinationId);
|
public Task<TransferDestination?> GetTransferDestinationById(Guid transferDestinationId);
|
||||||
public Task<TransferDestination?> CreateTransferDestination(TransferDestination transferDestination);
|
public Task<TransferDestination?> CreateTransferDestination(TransferDestination transferDestination);
|
||||||
public Task<TransferDestination?> UpdateTransferDestination(TransferDestination transferDestination);
|
public Task<TransferDestination?> UpdateTransferDestination(TransferDestination transferDestination);
|
||||||
|
|
|
||||||
|
|
@ -100,9 +100,10 @@ public class SignalRTags : AcSignalRTags
|
||||||
|
|
||||||
public const int GetTransferDestinationById = 80;
|
public const int GetTransferDestinationById = 80;
|
||||||
public const int GetAllTransferDestinations = 81;
|
public const int GetAllTransferDestinations = 81;
|
||||||
public const int CreateTransferDestination = 82;
|
public const int GetAllTransferDestinationsByProductId = 82;
|
||||||
public const int UpdateTransferDestination = 83;
|
public const int CreateTransferDestination = 83;
|
||||||
public const int RemoveTransferDestination = 84; //set permissions to 0
|
public const int UpdateTransferDestination = 84;
|
||||||
|
public const int RemoveTransferDestination = 85; //set permissions to 0
|
||||||
|
|
||||||
public const int CreateTransferDestinationToProduct = 90;
|
public const int CreateTransferDestinationToProduct = 90;
|
||||||
public const int UpdateTransferDestinationToProduct = 91;
|
public const int UpdateTransferDestinationToProduct = 91;
|
||||||
|
|
|
||||||
|
|
@ -371,7 +371,8 @@ new HeroSliderItem
|
||||||
if (createdUserDetail != null)
|
if (createdUserDetail != null)
|
||||||
{
|
{
|
||||||
createdUserDetail.UserDto.RefferalId = userDetail.UserDto.RefferalId;
|
createdUserDetail.UserDto.RefferalId = userDetail.UserDto.RefferalId;
|
||||||
var updatedNewUser = await _adminSignalRClient.PostDataAsync<UserModelDtoDetail>(SignalRTags.UpdateUserModelDtoDetail, userDetail);
|
|
||||||
|
var updatedNewUser = await _adminSignalRClient.UpdateUserModelDtoDetail(userDetail);
|
||||||
if (updatedNewUser != null)
|
if (updatedNewUser != null)
|
||||||
{
|
{
|
||||||
//referral set
|
//referral set
|
||||||
|
|
|
||||||
|
|
@ -153,7 +153,7 @@
|
||||||
_isAddressTransferDestination = CheckDestinations(_productProfile.AddressId);
|
_isAddressTransferDestination = CheckDestinations(_productProfile.AddressId);
|
||||||
}
|
}
|
||||||
|
|
||||||
AdminSignalRClient.GetTransferDestinationsInto(_destinations).Forget();
|
AdminSignalRClient.GetTransferDestinationsAsync(_destinations).Forget();
|
||||||
await base.OnInitializedAsync();
|
await base.OnInitializedAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@
|
||||||
@using TIAMSharedUI.Pages.Components.EditComponents
|
@using TIAMSharedUI.Pages.Components.EditComponents
|
||||||
@using TIAMSharedUI.Shared
|
@using TIAMSharedUI.Shared
|
||||||
@using AyCode.Services.Loggers
|
@using AyCode.Services.Loggers
|
||||||
|
@using TIAM.Core.Enums
|
||||||
@using TIAMWebApp.Shared.Application.Interfaces;
|
@using TIAMWebApp.Shared.Application.Interfaces;
|
||||||
@using TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels
|
@using TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels
|
||||||
@using TIAMWebApp.Shared.Application.Models.PageModels
|
@using TIAMWebApp.Shared.Application.Models.PageModels
|
||||||
|
|
@ -38,7 +39,7 @@
|
||||||
|
|
||||||
|
|
||||||
<h3>Selected Hotel:</h3>
|
<h3>Selected Hotel:</h3>
|
||||||
<DxComboBox Data="@Hotels"
|
<DxComboBox Data="@_hotels"
|
||||||
@bind-Value="@SelectedHotel"
|
@bind-Value="@SelectedHotel"
|
||||||
SearchMode="@ListSearchMode.AutoSearch"
|
SearchMode="@ListSearchMode.AutoSearch"
|
||||||
SearchFilterCondition="@ListSearchFilterCondition.Contains"
|
SearchFilterCondition="@ListSearchFilterCondition.Contains"
|
||||||
|
|
@ -50,12 +51,12 @@
|
||||||
|
|
||||||
<div class="row py-3">
|
<div class="row py-3">
|
||||||
|
|
||||||
<DynamicEditForm Data="Data" CurrentProduct="@SelectedHotel" isEditing="true" IgnoreReflection="TransferIgnorList" OnSubmit="SubmitForm"></DynamicEditForm>
|
<DynamicEditForm Data="_data" CurrentProduct="@SelectedHotel" isEditing="true" IgnoreReflection="TransferIgnorList" OnSubmit="SubmitForm"></DynamicEditForm>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row py-3">
|
<div class="row py-3">
|
||||||
|
|
||||||
<DxButton RenderStyle="ButtonRenderStyle.Primary" Click="@Reload" Visible="@isReloadVisible">Reload</DxButton>
|
<DxButton RenderStyle="ButtonRenderStyle.Primary" Click="@Reload" Visible="@_isReloadVisible">Reload</DxButton>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -66,60 +67,58 @@
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
private LoggerClient<CreateAndManageTransfer> _logger;
|
private LoggerClient<CreateAndManageTransfer> _logger;
|
||||||
private TransferWizardModel Data = new();
|
private TransferWizardModel _data = new();
|
||||||
private List<Product> Hotels = new List<Product>();
|
private List<Product> _hotels = [];
|
||||||
private Product selectedHotel { get; set; }
|
private Product selectedHotel { get; set; }
|
||||||
public Product SelectedHotel
|
public Product SelectedHotel
|
||||||
{
|
{
|
||||||
get
|
get => selectedHotel;
|
||||||
{
|
|
||||||
return selectedHotel;
|
|
||||||
}
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
|
if (selectedHotel == value) return;
|
||||||
|
|
||||||
selectedHotel = value;
|
selectedHotel = value;
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<string> TransferIgnorList = new List<string>
|
public List<string> TransferIgnorList =
|
||||||
{
|
[
|
||||||
nameof(TransferWizardModel.Id),
|
nameof(TransferWizardModel.Id),
|
||||||
nameof(TransferWizardModel.UserId),
|
nameof(TransferWizardModel.UserId),
|
||||||
nameof(TransferWizardModel.ProductId),
|
nameof(TransferWizardModel.ProductId),
|
||||||
nameof(TransferWizardModel.FirstName),
|
nameof(TransferWizardModel.FirstName),
|
||||||
nameof(TransferWizardModel.LastName),
|
nameof(TransferWizardModel.LastName),
|
||||||
nameof(TransferWizardModel.UserProductMappingId),
|
nameof(TransferWizardModel.UserProductMappingId),
|
||||||
nameof(TransferWizardModel.UserProductToCarId),
|
nameof(TransferWizardModel.UserProductToCarId),
|
||||||
nameof(TransferWizardModel.ReferralId),
|
nameof(TransferWizardModel.ReferralId),
|
||||||
nameof(TransferWizardModel.Price)
|
nameof(TransferWizardModel.Price)
|
||||||
};
|
];
|
||||||
private bool isReloadVisible = false;
|
|
||||||
private bool SelectedHotelInitialized = false;
|
private bool _isReloadVisible = false;
|
||||||
|
private bool _selectedHotelInitialized = false;
|
||||||
|
|
||||||
protected override void OnInitialized()
|
protected override void OnInitialized()
|
||||||
{
|
{
|
||||||
_logger = new LoggerClient<CreateAndManageTransfer>(LogWriters.ToArray());
|
_logger = new LoggerClient<CreateAndManageTransfer>(LogWriters.ToArray());
|
||||||
|
|
||||||
if (_sessionService.User != null)
|
if (_sessionService.User != null)
|
||||||
{
|
{
|
||||||
|
if (_sessionService.User.UserModelDto.Products.Any())
|
||||||
if (_sessionService.User.UserModelDto.Products.Count() > 0)
|
|
||||||
{
|
{
|
||||||
if (_sessionService.User.UserModelDto.Products.Any(x => x.ProductType == TIAM.Core.Enums.ProductType.Hotel))
|
if (_sessionService.User.UserModelDto.Products.Any(x => x.ProductType == ProductType.Hotel))
|
||||||
{
|
{
|
||||||
Hotels = _sessionService.GetHotels();
|
_hotels = _sessionService.GetHotels();
|
||||||
if (!SelectedHotelInitialized)
|
if (!_selectedHotelInitialized)
|
||||||
{
|
{
|
||||||
SelectedHotel = Hotels[0];
|
SelectedHotel = _hotels[0];
|
||||||
SelectedHotelInitialized = true;
|
_selectedHotelInitialized = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Data = new TransferWizardModel();
|
|
||||||
base.OnInitialized();
|
base.OnInitialized();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task SubmitForm(object result)
|
public async Task SubmitForm(object result)
|
||||||
|
|
@ -171,13 +170,13 @@
|
||||||
|
|
||||||
var saveResult = await _adminSignalRClient.PostDataAsync<Transfer>(SignalRTags.AddTransfer, valami);
|
var saveResult = await _adminSignalRClient.PostDataAsync<Transfer>(SignalRTags.AddTransfer, valami);
|
||||||
_logger.Info($"Submitted form: {result.GetType().FullName}, {valami.ToAddress}, {valami.FromAddress}, {valami.ProductId}");
|
_logger.Info($"Submitted form: {result.GetType().FullName}, {valami.ToAddress}, {valami.FromAddress}, {valami.ProductId}");
|
||||||
isReloadVisible = true;
|
_isReloadVisible = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Reload()
|
public void Reload()
|
||||||
{
|
{
|
||||||
Data = new TransferWizardModel();
|
_data = new TransferWizardModel();
|
||||||
isReloadVisible = false;
|
_isReloadVisible = false;
|
||||||
|
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -158,7 +158,7 @@
|
||||||
{
|
{
|
||||||
_logger = new LoggerClient<ProductDetailGridComponent>(LogWriters.ToArray());
|
_logger = new LoggerClient<ProductDetailGridComponent>(LogWriters.ToArray());
|
||||||
|
|
||||||
AdminSignalRClient.GetTransferDestinationsInto(_destinations).Forget();
|
AdminSignalRClient.GetTransferDestinationsAsync(_destinations).Forget();
|
||||||
//DataSource = new List<Address>();
|
//DataSource = new List<Address>();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -160,7 +160,7 @@
|
||||||
{
|
{
|
||||||
_logger = new LoggerClient<ProductGridComponent>(LogWriters.ToArray());
|
_logger = new LoggerClient<ProductGridComponent>(LogWriters.ToArray());
|
||||||
|
|
||||||
AdminSignalRClient.GetTransferDestinationsInto(_destinations).Forget();
|
AdminSignalRClient.GetTransferDestinationsAsync(_destinations).Forget();
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool CheckDestinations(Guid addressId)
|
private bool CheckDestinations(Guid addressId)
|
||||||
|
|
|
||||||
|
|
@ -124,7 +124,7 @@
|
||||||
{
|
{
|
||||||
_logger = new LoggerClient<TransferDestinationToProductGridComponent>(LogWriters.ToArray());
|
_logger = new LoggerClient<TransferDestinationToProductGridComponent>(LogWriters.ToArray());
|
||||||
|
|
||||||
AdminSignalRClient.GetTransferDestinationsInto(_destinations).Forget();
|
AdminSignalRClient.GetTransferDestinationsAsync(_destinations).Forget();
|
||||||
AdminSignalRClient.GetAllIntoAsync(_products, SignalRTags.GetAllProducts).Forget();
|
AdminSignalRClient.GetAllIntoAsync(_products, SignalRTags.GetAllProducts).Forget();
|
||||||
|
|
||||||
base.OnInitialized();
|
base.OnInitialized();
|
||||||
|
|
|
||||||
|
|
@ -109,7 +109,7 @@
|
||||||
{
|
{
|
||||||
_logger = new LoggerClient<TransferDestinationToProductGridComponent>(LogWriters.ToArray());
|
_logger = new LoggerClient<TransferDestinationToProductGridComponent>(LogWriters.ToArray());
|
||||||
|
|
||||||
AdminSignalRClient.GetTransferDestinationsInto(_destinations).Forget();
|
AdminSignalRClient.GetTransferDestinationsAsync(_destinations).Forget();
|
||||||
AdminSignalRClient.GetAllIntoAsync(_products, SignalRTags.GetAllProducts).Forget();
|
AdminSignalRClient.GetAllIntoAsync(_products, SignalRTags.GetAllProducts).Forget();
|
||||||
|
|
||||||
await base.OnInitializedAsync();
|
await base.OnInitializedAsync();
|
||||||
|
|
|
||||||
|
|
@ -110,37 +110,19 @@
|
||||||
// StateHasChanged();
|
// StateHasChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
_logger = new LoggerClient<ComboboxItemSelector>(LogWriters.ToArray());
|
_logger = new LoggerClient<ComboboxItemSelector>(LogWriters.ToArray());
|
||||||
|
|
||||||
Guid? productAddressId = Guid.Empty;
|
if (ProductId.IsNullOrEmpty()) _adminSignalRClient.GetTransferDestinationsAsync(_destinations, GetTransferDestinationsCallback()).Forget();
|
||||||
if (!ProductId.IsNullOrEmpty())
|
else _adminSignalRClient.GetPublicTransferDestinationsAsync(_destinations, ProductId.Value, GetTransferDestinationsCallback()).Forget();
|
||||||
|
|
||||||
|
return Task.CompletedTask;
|
||||||
|
|
||||||
|
Action GetTransferDestinationsCallback()
|
||||||
{
|
{
|
||||||
var currentProduct = await _adminSignalRClient.GetByIdAsync<Product>(SignalRTags.GetProductById, ProductId);
|
return () => { SelectedDestination = ProductId.IsNullOrEmpty() ? _destinations.FirstOrDefault() : _destinations.FirstOrDefault(x => x.ProductId == ProductId); };
|
||||||
if (currentProduct != null)
|
|
||||||
{
|
|
||||||
if (!currentProduct.Profile.AddressId.IsNullOrEmpty())
|
|
||||||
{
|
|
||||||
productAddressId = currentProduct.Profile.AddressId;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_adminSignalRClient.GetTransferDestinationsInto(_destinations, () =>
|
|
||||||
{
|
|
||||||
SelectedDestination = productAddressId.IsNullOrEmpty() ? _destinations.FirstOrDefault() : _destinations.FirstOrDefault(x => x.AddressId == productAddressId);
|
|
||||||
}).Forget();
|
|
||||||
|
|
||||||
// _adminSignalRClient.GetAllIntoAsync(_destinations, SignalRTags.GetAllTransferDestinations, null, resultData =>
|
|
||||||
// {
|
|
||||||
// if (resultData == null) SelectedDestination = null;
|
|
||||||
// else SelectedDestination = productAddressId.IsNullOrEmpty() ? _destinations.FirstOrDefault() : _destinations.FirstOrDefault(x => x.AddressId == productAddressId);
|
|
||||||
|
|
||||||
// return Task.CompletedTask;
|
|
||||||
// }).Forget();
|
|
||||||
|
|
||||||
//await _adminSignalRClient.GetAllIntoAsync(Data, SignalRTags.GetAllTransferDestinations);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// RenderFragment GetSelectedItemDescription()
|
// RenderFragment GetSelectedItemDescription()
|
||||||
|
|
|
||||||
|
|
@ -47,9 +47,16 @@ namespace TIAMSharedUI.Shared.Components.BaseComponents
|
||||||
|
|
||||||
protected override void OnInitialized()
|
protected override void OnInitialized()
|
||||||
{
|
{
|
||||||
|
Initialize();
|
||||||
base.OnInitialized();
|
base.OnInitialized();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Initialize()
|
||||||
|
{
|
||||||
_logger = new LoggerClient<BasePageComponent>(_logWriters.ToArray());
|
_logger = new LoggerClient<BasePageComponent>(_logWriters.ToArray());
|
||||||
|
|
||||||
var currentUrl = _navManager.ToBaseRelativePath(_navManager.Uri);
|
var currentUrl = _navManager.ToBaseRelativePath(_navManager.Uri);
|
||||||
|
|
||||||
_pageState.AddPageToHistory(currentUrl);
|
_pageState.AddPageToHistory(currentUrl);
|
||||||
_logger.Debug(_pageState.GetGoBackPage());
|
_logger.Debug(_pageState.GetGoBackPage());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,20 +17,20 @@ namespace TIAMSharedUI.Shared.Components.BaseComponents
|
||||||
{
|
{
|
||||||
[Authorize]
|
[Authorize]
|
||||||
public class UserBasePageComponent : BasePageComponent
|
public class UserBasePageComponent : BasePageComponent
|
||||||
{
|
{
|
||||||
|
|
||||||
private LoggerClient<UserBasePageComponent> _logger = null!;
|
private LoggerClient<UserBasePageComponent> _logger = null!;
|
||||||
|
|
||||||
public UserBasePageComponent()
|
public UserBasePageComponent()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected override void OnInitialized()
|
protected override void OnInitialized()
|
||||||
{
|
{
|
||||||
base.OnInitialized();
|
|
||||||
_logger = new LoggerClient<UserBasePageComponent>(_logWriters.ToArray());
|
_logger = new LoggerClient<UserBasePageComponent>(_logWriters.ToArray());
|
||||||
|
|
||||||
|
base.OnInitialized();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,17 +24,17 @@
|
||||||
|
|
||||||
protected override void OnInitialized()
|
protected override void OnInitialized()
|
||||||
{
|
{
|
||||||
if(pageHistoryState.CanGoBack())
|
if (pageHistoryState.CanGoBack())
|
||||||
{
|
{
|
||||||
isBackVisible = true;
|
isBackVisible = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void GoBack()
|
private void GoBack()
|
||||||
{
|
{
|
||||||
@if (pageHistoryState.CanGoBack())
|
@if (pageHistoryState.CanGoBack())
|
||||||
{
|
{
|
||||||
NavManager.NavigateTo(pageHistoryState.GetGoBackPage());
|
NavManager.NavigateTo(pageHistoryState.GetGoBackPage()!);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -82,6 +82,13 @@ namespace TIAMWebApp.Server.Controllers
|
||||||
return await _adminDal.GetTransferDestinationsAsync();
|
return await _adminDal.GetTransferDestinationsAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[NonAction]
|
||||||
|
[SignalR(SignalRTags.GetAllTransferDestinationsByProductId)]
|
||||||
|
public async Task<List<TransferDestination>> GetPublicTransferDestinations(Guid includeProductId)
|
||||||
|
{
|
||||||
|
return await _adminDal.GetPublicTransferDestinationsAsync(includeProductId);
|
||||||
|
}
|
||||||
|
|
||||||
//[Authorize]
|
//[Authorize]
|
||||||
//[HttpGet]
|
//[HttpGet]
|
||||||
//[Route(APIUrls.GetTransferDriversByTransferIdRouteName)]
|
//[Route(APIUrls.GetTransferDriversByTransferIdRouteName)]
|
||||||
|
|
|
||||||
|
|
@ -127,9 +127,15 @@ namespace TIAMWebApp.Shared.Application.Services
|
||||||
public async Task<List<TransferDestination>> GetTransferDestinations()
|
public async Task<List<TransferDestination>> GetTransferDestinations()
|
||||||
=> await GetAllAsync<List<TransferDestination>>(SignalRTags.GetAllTransferDestinations) ?? [];
|
=> await GetAllAsync<List<TransferDestination>>(SignalRTags.GetAllTransferDestinations) ?? [];
|
||||||
|
|
||||||
public Task GetTransferDestinationsInto(List<TransferDestination> intoDestinationList, Action? callback = null)
|
|
||||||
|
public Task GetTransferDestinationsAsync(List<TransferDestination> intoDestinationList, Action? callback = null)
|
||||||
=> GetAllIntoAsync(intoDestinationList, SignalRTags.GetAllTransferDestinations, null, callback);
|
=> GetAllIntoAsync(intoDestinationList, SignalRTags.GetAllTransferDestinations, null, callback);
|
||||||
|
|
||||||
|
public async Task<List<TransferDestination>> GetPublicTransferDestinations(Guid includeProductId)
|
||||||
|
=> await GetAllAsync<List<TransferDestination>>(SignalRTags.GetAllTransferDestinationsByProductId, [includeProductId]) ?? [];
|
||||||
|
|
||||||
|
public Task GetPublicTransferDestinationsAsync(List<TransferDestination> intoDestinationList, Guid includeProductId, Action? callback = null)
|
||||||
|
=> GetAllIntoAsync(intoDestinationList, SignalRTags.GetAllTransferDestinationsByProductId, [includeProductId], callback);
|
||||||
|
|
||||||
public async Task<TransferDestination?> GetTransferDestinationById(Guid transferDestinationId)
|
public async Task<TransferDestination?> GetTransferDestinationById(Guid transferDestinationId)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using System.Net;
|
using System.Net;
|
||||||
|
using TIAM.Core.Enums;
|
||||||
using TIAM.Entities.Products;
|
using TIAM.Entities.Products;
|
||||||
using TIAM.Models;
|
using TIAM.Models;
|
||||||
using TIAMWebApp.Shared.Application.Interfaces;
|
using TIAMWebApp.Shared.Application.Interfaces;
|
||||||
|
|
@ -23,7 +24,7 @@ public abstract class SessionServiceClientBase : ISessionService
|
||||||
|
|
||||||
public virtual List<Product> GetHotels()
|
public virtual List<Product> GetHotels()
|
||||||
{
|
{
|
||||||
return User != null ? User.UserModelDto.Products.Where(x => x.ProductType == TIAM.Core.Enums.ProductType.Hotel).ToList() : [];
|
return User != null ? User.UserModelDto.Products.Where(x => x.ProductType == ProductType.Hotel).ToList() : [];
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void ClearAll()
|
public virtual void ClearAll()
|
||||||
|
|
|
||||||
|
|
@ -8,32 +8,24 @@ namespace TIAMWebApp.Shared.Application.Utility
|
||||||
{
|
{
|
||||||
public class PageHistoryState
|
public class PageHistoryState
|
||||||
{
|
{
|
||||||
private List<string> previousPages;
|
private readonly List<string> _previousPages = [];
|
||||||
|
|
||||||
public PageHistoryState()
|
public PageHistoryState()
|
||||||
|
{ }
|
||||||
|
|
||||||
|
public void AddPageToHistory(string pageUrl)
|
||||||
{
|
{
|
||||||
previousPages = new List<string>();
|
_previousPages.Add(pageUrl);
|
||||||
}
|
|
||||||
public void AddPageToHistory(string pageName)
|
|
||||||
{
|
|
||||||
previousPages.Add(pageName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetGoBackPage()
|
public string GetGoBackPage()
|
||||||
{
|
{
|
||||||
if (previousPages.Count > 1)
|
return _previousPages.Count > 1 ? _previousPages[^2] : _previousPages.FirstOrDefault() ?? string.Empty;
|
||||||
{
|
|
||||||
// You add a page on initialization, so you need to return the 2nd from the last
|
|
||||||
return previousPages.ElementAt(previousPages.Count - 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Can't go back because you didn't navigate enough
|
|
||||||
return previousPages.FirstOrDefault();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool CanGoBack()
|
public bool CanGoBack()
|
||||||
{
|
{
|
||||||
return previousPages.Count > 1;
|
return _previousPages.Count > 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue