Repository navigation
Pick reservation dates in a Vue component - #1165
Merged
Merged
Conversation
The product page and the quick view render one <reservation-picker> fed by ReservationAvailability: a day product picks a range limited to the last end date one resource can take, an hour product a date and a slot, the parameter filtering the slots. Dates are shown in the store's culture and posted as yyyy-MM-dd, the only format the cart reads now. window.Reservation, Pikaday and GetDatesForMonth are gone, with the availableToCustomerId filter only that endpoint used. After an add to cart the picker asks again what is free, for day products too.
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Active reservation-picker bugs prevent retries after failed availability requests, clear saved selections when editing cart items, and leave preserved dates without refreshed slots after filter changes.
3 open issues
2 files not reviewed
src/Web/Grand.Web/vueapp/package-lock.json: Generated filesrc/Web/Grand.Web/wwwroot/bundles/libs.css: Generated file
What changed in this PR
Replaces the storefront’s Pikaday reservation controls with a shared Vue component that uses the range-aware availability API introduced in #1164.
Changes:
- Adds localized date-range and time-slot selection for product pages and quick views, including cart-item editing and availability refresh.
- Standardizes submitted dates on
yyyy-MM-ddand removes the legacy calendar endpoint, scripts, and Pikaday dependency. - Updates reservation tests and Nordic styling for the new picker.
Review used the supplied diffs; the repository snapshot was unavailable, and no verification commands ran.
| File | Description |
|---|---|
src/Web/Grand.Web/wwwroot/theme/script/app.js |
Removes legacy quick-view reservation initialization. |
src/Web/Grand.Web/vueapp/src/views/reservation-picker.js |
Adds the shared reservation picker and availability handling. |
src/Web/Grand.Web/vueapp/src/views/reservation-picker.css |
Styles the calendar, ranges, and slots. |
src/Web/Grand.Web/vueapp/src/theme/common.js |
Removes the legacy reservation implementation. |
src/Web/Grand.Web/vueapp/src/theme/axios-cart.js |
Dispatches reservation refresh events after booking. |
src/Web/Grand.Web/vueapp/src/main.js |
Registers the picker and removes Pikaday imports and globals. |
src/Web/Grand.Web/vueapp/src/behaviours/reservation-info.js |
Deletes the legacy picker bootstrap. |
src/Web/Grand.Web/vueapp/src/behaviours/quick-view-modal.js |
Removes the legacy reservation modal hook. |
src/Web/Grand.Web/vueapp/package.json |
Removes the Pikaday dependency. |
src/Web/Grand.Web/vueapp/package-lock.json |
Removes Pikaday’s locked package entry. |
src/Web/Grand.Web/Views/Shared/Partials/QuickView/ReservationInfo.cshtml |
Uses the shared picker in quick views. |
src/Web/Grand.Web/Views/Shared/Partials/ProductQuickView.cshtml |
Supplies quick-view picker routes, culture, and labels. |
src/Web/Grand.Web/Views/Product/Partials/ReservationInfo.cshtml |
Hosts the product-page picker and its data island. |
src/Web/Grand.Web/Extensions/MappingExtensions.cs |
Parses reservation dates strictly as ISO dates. |
src/Web/Grand.Web/Controllers/ProductController.cs |
Removes GetDatesForMonth. |
src/Web/Grand.Web/Controllers/ActionCartController.cs |
Requests availability refresh for day reservations too. |
src/Tests/Grand.Web.Tests/Extensions/ReservationDatesTests.cs |
Tests accepted and rejected date formats. |
src/Tests/Grand.Web.Tests/Controllers/ProductControllerReservationDatesTests.cs |
Removes tests for the retired endpoint. |
src/Tests/Grand.Web.Tests/Controllers/ProductControllerReservationAvailabilityTests.cs |
Adds preview and availability-window coverage. |
src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/PlaceOrderCommandHandlerTests.cs |
Updates verification for the simplified service signature. |
src/Tests/Grand.Business.Catalog.Tests/Services/Products/ProductReservationServiceTests.cs |
Removes coverage for the deleted customer-filter parameter. |
src/Plugins/Theme.Nordic/Content/css/product.css |
Targets the new picker markup. |
src/Modules/Grand.Module.Installer/Services/InstallDataProducts.Outdoor.cs |
Updates a comment to name the replacement endpoint. |
src/Business/Grand.Business.Core/Interfaces/Catalog/Products/IProductReservationService.cs |
Removes the obsolete optional customer-filter parameter. |
src/Business/Grand.Business.Catalog/Services/Products/ProductReservationService.cs |
Removes the corresponding legacy query filter. |
Review effort: Balanced
Comment on lines
+156
to
+158
| parameter() { | ||
| this.refresh() | ||
| }, |
| lastEndDates: {}, readTo: {}, readRanges: [], slots: {}, readMonths: {}, | ||
| start: null, end: null, reservationId: null | ||
| }) | ||
| this.read() |
Comment on lines
+243
to
+244
| const range = { from, to: addDays(from, DAYS_READ) } | ||
| this.readRanges.push(range) |
added 4 commits
December 1, 2026 17:18
TryHold returned early when every slot of the item's new choice was already freshly held by it, so a range edited to fewer days kept holding the days it dropped until the hold expired. The early return now also requires that the item holds nothing outside its choice.
Every type other than simple was looked up among the associated products, which only a grouped product has, so a reservation or auction product with attributes threw in the quick view and its price never changed.
Resetting the parameter for another product fired the parameter watcher, whose refresh cleared the dates or slot of the cart item being edited; the parameter now refreshes on the select's change only. A read answered after a refresh no longer counts as failed, so it leaves the newer read's month mark alone.
A range previews where it would end under the pointer, and the start and end fields show their weekday and which one the next click fills. Free days read bold, today is underlined. An hour product opens on its first date with slots, the slots are buttons, and a few parameters are a switch with "All" instead of a dropdown with an empty option. No new resources.
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
The storefront picked reservation dates with
window.Reservation(theme/common.js): three Pikaday instances with wrongparsefunctions (day and month swapped, month not zero-based),disableDayFnevaluated before the AJAX data arrived, arrays growing throughconcat,alert(error)and a fixedMM/DD/YYYYformat. The quick view called it with hardcoded URLs and an English message. It also could not use what R12 (#1164) offers: the last end date one resource can take.Solution
<reservation-picker>component (vueapp/src/views/reservation-picker.js+.css) used by the product page and the quick view, fed byGET Product/ReservationAvailability:IncBothDateallows a one-day range). Reads a year from the month shown and reads on from a start whose run reaches the end of the read;CultureInfo.CurrentCulture), first day Monday as before; labels from the JSON island;updatecartitemidor the cart's quick view) opens on the item's dates/slot and passesshoppingCartItemId, so the item keeps its own slots;grand:reservation-bookedevent).refreshreservationis now sent for day products too, since R6 a range in the cart holds its slots;productdetails_attributechangewhen a range is complete, scoped to the quick view when the picker is in it.Common.All) instead of a dropdown with an empty option. Labels reuseProducts.ReservationStartDate/EndDate, no new resources.vue-island="reservationInfo"; the quick view modal declaresreservationQuickView. OnereservationInfoview registers each payload under the name it carries.yyyy-MM-ddonly (ParseReservationDates), no fallback forMM/dd/yyyy.window.Reservation,behaviours/reservation-info.js, the quick view'sinitReservationQV, theReservationFullDate/Year/Monthfields, Pikaday (package, CSS,window.Pikaday),ProductController.GetDatesForMonthand theavailableToCustomerIdparameter ofGetProductReservationsByProductIdthat only it used.#reservationDatepickerand parameter label now target the new markup.npm run build).Breaking changes
ProductController.GetDatesForMonthis removed; useProduct/ReservationAvailability.reservationDatepickerFrom/reservationDatepickerToare read asyyyy-MM-ddonly. A custom theme or client postingMM/dd/yyyygets no dates.window.Reservationandwindow.Pikadayno longer exist.IProductReservationService.GetProductReservationsByProductIdlost its last optional parameteravailableToCustomerId.Testing
Unit:
Grand.Web.Tests(712),Grand.Business.Catalog.Tests(1187),Grand.Business.Checkout.Tests(1168),Grand.Web.Admin.Tests(2199) pass. The visibility tests of the removed endpoint (catalog manager preview, availability window) moved to theReservationAvailabilitytests; newReservationDatesTestscover the ISO parsing.eslint srcclean.E2E on the shared reservations DB (Theme.Nordic, dark and light mode):
IncBothDate=false): start Wed 12/09 offers ends up to 12/24 only (Tent 1; 24–26 Dec have no slots); range 12/09–12/24 posts ISO dates, price 15 × 24.65 = 369.75; add to cart → the cart stores 12/09–12/24 at store midnight, and the calendar drops the Wednesdays 9, 16, 23 (Tent 2 has none).Beginnerfilter keeps the chosen date and halves the slots; add 10:00 → it disappears from the list.IncBothDate=true) from the tent page: 12/14–12/14 allowed; 12/14–12/16 → quick view price 3 × 41.65 = 124.95, the page price behind it unchanged.Also fixed here (found while testing and in review):
ProductReservationService.TryHoldreturned early when every slot of the new range was already freshly held by the item, so it never released the others (seen: item edited from 12/09–12/24 to 12/10–12/15, Tent 1 kept 12/09–12/23). The early return now also requires that the item holds nothing outside its choice. New testTryHold_RangeShortenedWithinAFreshHold_ReleasesTheDroppedDays(fails without the fix). E2E: after the same edit only 12/10–12/14 stay held.Cannot read properties of undefined (reading 'ProductPrice')inwwwroot/theme/script/app.js): every type other than simple was looked up amongAssociatedProducts. Now only a grouped product's associated product is priced that way, any other type prices itself. E2E: e-bike quick view, ticking "Pannier bags" moves the price 41.65 → 46.75, no console error.changeonly (E2E: pick a parameter in a quick view, close, edit the cart's hour item → its slot is still selected). A read answered after a refresh no longer counts as failed, so it leaves the newer read's month mark alone.