diff --git a/TIAM.Core/Enums/ProductType.cs b/TIAM.Core/Enums/ProductType.cs index 180adb1d..444cfe03 100644 --- a/TIAM.Core/Enums/ProductType.cs +++ b/TIAM.Core/Enums/ProductType.cs @@ -5,4 +5,5 @@ public enum ProductType : byte NotDefined = 0, Transfer = 5, Hotel = 10, + Guide = 15, } \ No newline at end of file diff --git a/TIAM.Database/DataLayers/Admins/AdminDal.cs b/TIAM.Database/DataLayers/Admins/AdminDal.cs index fb2e878e..c914f630 100644 --- a/TIAM.Database/DataLayers/Admins/AdminDal.cs +++ b/TIAM.Database/DataLayers/Admins/AdminDal.cs @@ -57,6 +57,7 @@ namespace TIAM.Database.DataLayers.Admins public Task> GetTransfersByFilterAsync(CriteriaOperator criteriaOperator) => SessionAsync(ctx => (ctx.GetTransfers().AppendWhere(new CriteriaToExpressionConverter(), criteriaOperator) as IQueryable)!.OrderBy(x => x.TransferStatusType).ThenByDescending(x => x.OrderId).ToList()); public Task> GetTransfersByDriverUserIdAsync(Guid driverUserId) => SessionAsync(ctx => ctx.GetTransfersByDriverUserId(driverUserId).OrderBy(x => x.TransferStatusType).ThenByDescending(x => x.OrderId).ToList()); + public Task> GetTransfersByProductIdAsync(Guid productId) => SessionAsync(ctx => ctx.GetTransfersByProductId(productId).OrderBy(x => x.TransferStatusType).ThenByDescending(x => x.OrderId).ToList()); public Task> GetTransfersByUserProductMappingIdAsync(Guid userProductMappingId) => SessionAsync(ctx => ctx.GetTransfersByUserProductMappingId(userProductMappingId).OrderBy(x => x.TransferStatusType).ThenByDescending(x => x.OrderId).ToList()); public Task> GetTransfersAsync() => SessionAsync(ctx => ctx.GetTransfers().OrderBy(x => x.TransferStatusType).ThenByDescending(x => x.OrderId).ToList()); diff --git a/TIAM.Database/DbSets/Transfers/TransferDbSetExtensions.cs b/TIAM.Database/DbSets/Transfers/TransferDbSetExtensions.cs index 721d5c26..78cd66a2 100644 --- a/TIAM.Database/DbSets/Transfers/TransferDbSetExtensions.cs +++ b/TIAM.Database/DbSets/Transfers/TransferDbSetExtensions.cs @@ -50,6 +50,9 @@ public static class TransferDbSetExtensions public static IQueryable GetTransfersByDriverUserId(this ITransferDbSet ctx, Guid driverUserId) => ctx.GetTransfers().Where(x => x.TransferToDrivers.Any(ttd => ttd.UserProductMapping.UserId == driverUserId)); + public static IQueryable GetTransfersByProductId(this ITransferDbSet ctx, Guid productId) + => ctx.GetTransfers().Where(x => x.ProductId == productId); + public static IQueryable GetTransfersByUserProductMappingId(this ITransferDbSet ctx, Guid userProductMappingId) => ctx.GetTransfers().Where(x => x.TransferToDrivers.Any(ttd => ttd.UserProductMappingId == userProductMappingId)); diff --git a/TIAM.Services/SignalRTags.cs b/TIAM.Services/SignalRTags.cs index ff8c0587..11ff9820 100644 --- a/TIAM.Services/SignalRTags.cs +++ b/TIAM.Services/SignalRTags.cs @@ -12,6 +12,7 @@ public class SignalRTags : AcSignalRTags public const int GetTransfersByProductId = 5; public const int GetTransfersByCompanyId = 6; public const int GetTransfersByUserProductMappingId = 701; + public const int GetTransfersByOrderingProductId = 702; public const int GetTransfersByFilterText = 301; diff --git a/TIAMMobileApp/Services/SessionServiceMobile.cs b/TIAMMobileApp/Services/SessionServiceMobile.cs index 5d27ab2d..b1d3b2f6 100644 --- a/TIAMMobileApp/Services/SessionServiceMobile.cs +++ b/TIAMMobileApp/Services/SessionServiceMobile.cs @@ -1,5 +1,6 @@ using System.Net; using TIAM.Core.Consts; +using TIAM.Entities.Products; using TIAM.Entities.Users; using TIAMWebApp.Shared.Application.Interfaces; using TIAMWebApp.Shared.Application.Models; @@ -17,6 +18,14 @@ namespace TIAMMobileApp.Services public bool IsDriver { get; set; } = false; public bool IsDevAdmin { get; set; } = false; public bool IsSysAdmin { get; set; } = false; + public List GetHotels() + { + if (User.UserModelDto.Products.Count > 0) + { + return User.UserModelDto.Products.Where(x => x.ProductType == TIAM.Core.Enums.ProductType.Hotel).ToList(); + } + else return new List(); + } public Guid DriverPersmissionId { get; set; } = Guid.Empty; } diff --git a/TIAMSharedUI/Pages/User/Hotels/CreateAndManageTransfer.razor b/TIAMSharedUI/Pages/User/Hotels/CreateAndManageTransfer.razor index df67c43d..65a18cc8 100644 --- a/TIAMSharedUI/Pages/User/Hotels/CreateAndManageTransfer.razor +++ b/TIAMSharedUI/Pages/User/Hotels/CreateAndManageTransfer.razor @@ -72,7 +72,7 @@ { if (SessionService.User.UserModelDto.Products.Any(x => x.ProductType == TIAM.Core.Enums.ProductType.Hotel)) { - Hotels = SessionService.User.UserModelDto.Products.Where(x => x.ProductType == TIAM.Core.Enums.ProductType.Hotel).ToList(); + Hotels = SessionService.GetHotels(); SelectedHotel = Hotels[0]; } } diff --git a/TIAMSharedUI/Pages/User/Hotels/HotelAdmin.razor b/TIAMSharedUI/Pages/User/Hotels/HotelAdmin.razor index 5b049669..efa1abba 100644 --- a/TIAMSharedUI/Pages/User/Hotels/HotelAdmin.razor +++ b/TIAMSharedUI/Pages/User/Hotels/HotelAdmin.razor @@ -1,4 +1,4 @@ -@page "/user/hoteladmin/{id}" +@page "/user/hoteladmin/{id:guid}" @using TIAMSharedUI.Shared @using TIAMWebApp.Shared.Application.Interfaces; @layout AdminLayout @@ -15,7 +15,7 @@
- +
@@ -24,7 +24,7 @@ @code { - [Parameter] public string id { get; set; } + [Parameter] public Guid id { get; set; } bool isUserLoggedIn; int userType = 0; @@ -35,7 +35,7 @@ { return; } - var check = SessionService.User.UserModelDto.UserProductMappings.Any(x => x.ProductId == Guid.Parse(id)); + var check = SessionService.User.UserModelDto.UserProductMappings.Any(x => x.ProductId == id); if (!check) { return; diff --git a/TIAMSharedUI/Pages/User/Hotels/HotelComponent.razor b/TIAMSharedUI/Pages/User/Hotels/HotelComponent.razor index 1ea87365..ab45210f 100644 --- a/TIAMSharedUI/Pages/User/Hotels/HotelComponent.razor +++ b/TIAMSharedUI/Pages/User/Hotels/HotelComponent.razor @@ -1,8 +1,15 @@ -@using BlazorAnimation +@using AyCode.Core +@using AyCode.Core.Extensions +@using BlazorAnimation +@using TIAM.Entities.Transfers +@using TIAMSharedUI.Pages.User.SysAdmins @using TIAMSharedUI.Shared +@using TIAMSharedUI.Shared.Components.Grids @using TIAMWebApp.Shared.Application.Models; @using TIAMWebApp.Shared.Application.Interfaces; @using TIAMSharedUI.Pages.User; +@using TIAMWebApp.Shared.Application.Models.ClientSide.UI +@using TIAM.Services @@ -41,9 +48,9 @@
-

Hotel name: Example hotel

-

Address: Budapest, Minta u. 46

-

Phone number: +36 1 123 4567

+

Hotel name: @hotelName

+

Address: @hotelAddress

+

Contact name: @hotelContactName

-
+
@@ -75,19 +82,66 @@
- - - - - @context.Value - + + + + + + + @{ + var idKeyField = ((Transfer)context.DataItem).Id.ToString("N"); + var editUri = $"mytransfers/{idKeyField}"; + + @context.Value + + } + - - - + + + + + + + + + + + @{ + + TransferStatusModel keyField = Statuses.FirstOrDefault(x => x.StatusValue == (byte)context.Value)!; + string transferStatusText = keyField.StatusName; + @transferStatusText + } + + + + + - + + + + + + + + + + + + + @@ -109,7 +163,7 @@
-
+
@@ -126,38 +180,38 @@
- - -
- -

- username - Donec id elit non mi porta gravida at eget metus... -

-
-
- -

- username - Donec id elit non mi porta gravida at eget metus... -

-
-
- -

- username - Donec id elit non mi porta gravida at eget metus... -

-
-
- -

- username - Donec id elit non mi porta gravida at eget metus... -

-
- - + + +
+ +

+ username + Donec id elit non mi porta gravida at eget metus... +

+
+
+ +

+ username + Donec id elit non mi porta gravida at eget metus... +

+
+
+ +

+ username + Donec id elit non mi porta gravida at eget metus... +

+
+
+ +

+ username + Donec id elit non mi porta gravida at eget metus... +

+
+ +
@@ -175,13 +229,13 @@
-
+