Conversation
A new account page shows what the customer's orders booked, one row per order item: upcoming first, then past, with the store-time dates the order shows, the resource or parameter, and a link to the order. Cancelled and deleted orders do not appear. The tab shows only in stores that have reservation products (cached; cleared with the product lists).
| private readonly List<Order> _orders = []; | ||
| private readonly List<CustomerReservation> _reservations = []; | ||
| private GetCustomerReservationsQuery? _query; | ||
| private GetCustomerReservationsHandler _handler; |
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved defects can merge legacy bookings or omit them across pages, hide accessible reservations when store limits are ignored, and display deleted-product bookings in the wrong time zone.
4 open issues
What changed in this PR
Adds a Reservations page to customer accounts, bringing booked slots and their order details into a single paged view.
Changes:
- Adds the account route, navigation tab, and reservation table with upcoming and past sections.
- Adds customer/store-scoped reservation queries and a cached check controlling tab visibility.
- Adds translation resources and tests for queries, presentation, navigation, and cache invalidation.
Validation was limited to source inspection; tests and builds were not run.
| File | Description |
|---|---|
src/Web/Grand.Web/Views/Shared/Components/CustomerNavigation/Default.cshtml |
Adds the Reservations navigation link. |
src/Web/Grand.Web/Views/Reservation/List.cshtml |
Renders reservation groups, details, and pagination. |
src/Web/Grand.Web/Features/Models/Orders/GetCustomerReservations.cs |
Defines the page-model request. |
src/Web/Grand.Web/Features/Handlers/Orders/GetCustomerReservationsHandler.cs |
Prepares reservation rows and formatted dates. |
src/Web/Grand.Web/Features/Handlers/Customers/GetNavigationHandler.cs |
Controls reservation-tab visibility. |
src/Web/Grand.Web/Endpoints/EndpointProvider.cs |
Registers /account/reservations. |
src/Web/Grand.Web/Controllers/ReservationController.cs |
Handles authenticated reservation-page requests. |
src/Web/Grand.Web/App_Data/Resources/Upgrade/en_250.xml |
Adds reservation-page translation resources. |
src/Web/Grand.Web.Models/Orders/CustomerReservationListModel.cs |
Defines reservation rows and paging state. |
src/Web/Grand.Web.Models/Customer/CustomerNavigationModel.cs |
Adds reservation visibility and tab identifiers. |
src/Tests/Grand.Web.Tests/Features/Handlers/Orders/GetCustomerReservationsHandlerTests.cs |
Tests row preparation and date display. |
src/Tests/Grand.Web.Tests/Features/Handlers/Customers/GetNavigationHandlerTests.cs |
Tests reservation-tab visibility. |
src/Tests/Grand.Business.Checkout.Tests/Queries/Handlers/Orders/GetCustomerReservationsQueryHandlerTests.cs |
Tests reservation filtering, grouping, ordering, and paging. |
src/Tests/Grand.Business.Catalog.Tests/Queries/Handlers/HasReservationProductsQueryHandlerTests.cs |
Tests product detection and store-specific caching. |
src/Tests/Grand.Business.Catalog.Tests/Events/Handlers/Cache/ProductCacheEventHandlerTests.cs |
Checks reservation-cache invalidation. |
src/Core/Grand.Infrastructure/Caching/Constants/ProductCacheKey.cs |
Defines reservation-product cache keys. |
src/Business/Grand.Business.Core/Utilities/Checkout/CustomerReservation.cs |
Defines grouped booking data. |
src/Business/Grand.Business.Core/Queries/Checkout/Orders/GetCustomerReservationsQuery.cs |
Defines reservation-query scope and pagination. |
src/Business/Grand.Business.Core/Queries/Catalog/HasReservationProductsQuery.cs |
Defines the reservation-product existence query. |
src/Business/Grand.Business.Checkout/Queries/Handlers/Orders/GetCustomerReservationsQueryHandler.cs |
Retrieves, groups, sorts, and pages booked slots. |
src/Business/Grand.Business.Catalog/Queries/Handlers/HasReservationProductsQueryHandler.cs |
Caches reservation-product availability per store. |
src/Business/Grand.Business.Catalog/Events/Handlers/Cache/ProductCacheEventHandler.cs |
Invalidates the new cache on product-list changes. |
Review effort: Balanced
| return await _cacheBase.GetAsync(string.Format(CacheKey.PRODUCTS_RESERVATION_KEY, request.StoreId), | ||
| () => _productRepository.AnyAsync(_productRepository.Table.Where(x => | ||
| x.ProductTypeId == ProductType.Reservation && | ||
| (!x.LimitedToStores || x.Stores.Contains(request.StoreId))), cancellationToken)); |
| var productIds = orders.SelectMany(x => x.ProductIds).Distinct().ToList(); | ||
| var reservations = _productReservationRepository.Table | ||
| .Where(x => productIds.Contains(x.ProductId) && orderIds.Contains(x.OrderId)) | ||
| .GroupBy(x => new { x.OrderId, x.OrderItemId, x.ProductId }) |
Comment on lines
+58
to
+60
| .OrderBy(x => x.FirstDate).ThenBy(x => x.OrderItemId); | ||
| var past = reservations.Where(x => x.LastDate < request.UpcomingFromUtc) | ||
| .OrderByDescending(x => x.FirstDate).ThenBy(x => x.OrderItemId); |
Comment on lines
+87
to
+88
| Date = await FormatDate(product, orderItem?.RentalStartDateUtc ?? reservation.FirstDate, | ||
| orderItem?.RentalEndDateUtc), |
added 2 commits
December 1, 2026 21:44
The tab follows CustomerSettings.HideReservationsTab (Admin and Store settings) instead of a cached check for reservation products, which hid booked reservations once their product was deleted. The customer's reservations are read once and ordered and paged in memory, comparing dates in UTC on both data providers.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Type: feature
Issue
A customer sees a reservation only as a line of text inside an order. There is no place in the account that lists what is booked and when.
Solution
/account/reservations,ReservationController.List), linked in the account navigation after Orders.ReservationDateFormat), the resource of a day range or the parameter of a slot, and the order number linking to the order details.GetCustomerReservationsQueryreads the customer's orders in the store (not cancelled, not deleted, with a reservation item), then groups their bookedProductReservationslots by order item in the database, in one read. The slot query carries the product ids so it uses the existingProductId+Dateindex; no new index or collection. One customer's reservations are few, so they are ordered and paged in memory, dates compared in UTC on MongoDB and LiteDB.OrderItemId; they are shown with the order's item of their product.CustomerSettings.HideReservationsTab(Customer settings in Admin and Store, like the other "Hide ... tab" settings). Off by default, so the tab is shown; a store that sells no reservations hides it there.DefaultLanguage.xmlandUpgrade/en_250.xml.Breaking changes
None.
Testing
Unit tests:
GetCustomerReservationsQueryHandlerTests(MongoDB + LiteDB: only the customer's own, store-scoped, cancelled/deleted excluded, one row per item, ordering, paging across upcoming/past),GetCustomerReservationsHandlerTests, navigation tests. Catalog, Checkout and Web test projects pass.E2E (shared reservations DB):
customer@yourstore.com; My account → Reservations shows "You have no reservations yet."customer2@yourstore.comsees no reservations./account/reservationsredirects to the account info.