Skip to content

Add ShippingController to Grand.Web.Store and StoreId support to Admin Shipping for delivery dates, warehouses, pickup points, shipping methods, and restrictions#702

Merged
KrzysztofPajak merged 38 commits into
developfrom
copilot/add-delivery-dates-warehouses-pickup-points-contro
May 31, 2026
Merged

Add ShippingController to Grand.Web.Store and StoreId support to Admin Shipping for delivery dates, warehouses, pickup points, shipping methods, and restrictions#702
KrzysztofPajak merged 38 commits into
developfrom
copilot/add-delivery-dates-warehouses-pickup-points-contro

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 25, 2026

Adds full CRUD support for warehouses, delivery dates, pickup points, and shipping methods in Grand.Web.Store, with store-owner data isolation so each store owner only sees and manages their own records. Also adds StoreId support to the existing Grand.Web.Admin shipping management for all four entities. Adds shipping settings, provider management, and shipping restrictions to Grand.Web.Store, all scoped to the current store.

Service Layer Changes

  • IDeliveryDateService.GetAllDeliveryDates, IWarehouseService.GetAllWarehouses, and IPickupPointService.GetAllPickupPoints updated with storeId parameter, pageIndex/pageSize pagination parameters, and IPagedList<T> return type
  • Cache removed from all three GetAll* methods — each now queries the repository directly with filtering applied to the IQueryable before pagination (no in-memory filtering)
  • Implementations use PagedList<T>.Create(query, pageIndex, pageSize) following the existing ShipmentService pattern
  • Cache removed from IShippingMethodService.GetAllShippingMethods; the method now queries the repository directly, applies the storeId filter on the IQueryable before materialization, and performs country/customer-group restriction filters in-memory after fetching

Controller & Views (Grand.Web.Store)

  • New ShippingController with full CRUD (list, create, edit, delete) for warehouses, delivery dates, pickup points, and shipping methods
  • Settings() GET and POST actions added to the Store ShippingController, loading and saving ShippingSettings scoped exclusively to CurrentStoreId
  • New Settings.cshtml view mirrors the admin shipping settings view but targets AreaStore and omits the global store-scope selector
  • Providers() GET/POST and ProviderUpdate POST actions added to the Store ShippingController, loading ShippingProviderSettings scoped to CurrentStoreId and toggling provider active/inactive state per store
  • New Providers.cshtml view mirrors the admin providers view but targets AreaStore and omits the global store-scope selector
  • Restrictions() GET and RestrictionSave() POST actions added to the Store ShippingController, scoped to CurrentStoreId — only the current store's shipping methods appear in the country and customer-group restriction matrices
  • New Restrictions.cshtml and partials (Restrictions.TabCountry.cshtml, Restrictions.TabGroup.cshtml) mirror the admin restrictions view but target AreaStore
  • Store isolation enforced: store owners can only access records where StoreId == CurrentStoreId
  • _ViewImports.cshtml updated with Grand.Web.AdminShared.Models.Shipping namespace
  • 21 Razor views added (list, create, edit, partial for each entity, plus Settings, Providers, and Restrictions)

Admin (Grand.Web.Admin) — StoreId Support

  • WarehouseModel, DeliveryDateModel, and ShippingMethodModel extended with StoreId, AvailableStores, and StoreName properties
  • ShippingController (Admin) updated: new PrepareDeliveryDateModel, PrepareShippingMethodModel helpers and updated PrepareAddressWarehouseModel now populate the store dropdown for create/edit forms
  • DeliveryDates, Warehouses, PickupPoints, and Methods list actions populate StoreName via O(1) dictionary lookup and return it in the grid data
  • CreateOrUpdateWarehouse.cshtml, CreateOrUpdateDeliveryDate.cshtml, and CreateOrUpdateMethod.cshtml partial views now render a store selector dropdown (label correctly bound to StoreId)
  • DeliveryDates.cshtml, Warehouses.cshtml, PickupPoints.cshtml, and Methods.cshtml list views now display a "Store" column
  • Restrictions() GET accepts an optional storeId query parameter — passes it to GetAllShippingMethods(storeId) so the restriction matrix shows only methods for the selected store; a store selector dropdown reloads the page on change
  • RestrictionSave() POST scopes saves to the selected store and preserves it in the redirect
  • ShippingMethodRestrictionModel extended with StoreId and AvailableStores properties
  • Resource keys added: Admin.Configuration.Shipping.Warehouses.Fields.Store, Admin.Configuration.Shipping.Warehouses.SelectStore, Admin.Configuration.Shipping.DeliveryDates.Fields.Store, Admin.Configuration.Shipping.DeliveryDates.SelectStore, Admin.Configuration.Shipping.Methods.Fields.Store, Admin.Configuration.Shipping.Methods.SelectStore

Cleanup

  • Removed obsolete StoreDeliveryDateModel, StoreWarehouseModel, StorePickupPointModel
  • Test mocks in ProductImportDataObjectTests updated to match new signatures and IPagedList<T> return types

Copilot AI and others added 2 commits May 25, 2026 16:34
…ses, and pickup points per store

Agent-Logs-Url: https://github.com/grandnode/grandnode2/sessions/6f46e96f-0a47-461a-b122-306c82c07139

Co-authored-by: KrzysztofPajak <16772986+KrzysztofPajak@users.noreply.github.com>
Copilot AI and others added 2 commits May 25, 2026 17:47
…add storeId filter to GetAllWarehouses/GetAllDeliveryDates

Agent-Logs-Url: https://github.com/grandnode/grandnode2/sessions/7619c4f6-ba72-4fd8-94d2-76228b83d336

Co-authored-by: KrzysztofPajak <16772986+KrzysztofPajak@users.noreply.github.com>
…oller pickup points section

Agent-Logs-Url: https://github.com/grandnode/grandnode2/sessions/7619c4f6-ba72-4fd8-94d2-76228b83d336

Co-authored-by: KrzysztofPajak <16772986+KrzysztofPajak@users.noreply.github.com>
Copilot AI and others added 2 commits May 25, 2026 18:06
…up point in Store area; store owners see only their own data

Agent-Logs-Url: https://github.com/grandnode/grandnode2/sessions/3cbffee5-4776-46b3-9e36-9f2c6fb8a13c

Co-authored-by: KrzysztofPajak <16772986+KrzysztofPajak@users.noreply.github.com>
…ix WarehouseId validation span in pickup point partial

Agent-Logs-Url: https://github.com/grandnode/grandnode2/sessions/3cbffee5-4776-46b3-9e36-9f2c6fb8a13c

Co-authored-by: KrzysztofPajak <16772986+KrzysztofPajak@users.noreply.github.com>
@KrzysztofPajak
Copy link
Copy Markdown
Member

@copilot remove cache from:
GetAllDeliveryDates(string storeId = "")
Task<IList> GetAllPickupPoints(string storeId = "")
Task<IList> GetAllWarehouses(string storeId = "")
Add pagination to this methods

Co-authored-by: KrzysztofPajak <16772986+KrzysztofPajak@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 27, 2026

@copilot remove cache from:
GetAllDeliveryDates(string storeId = "")
Task<IList> GetAllPickupPoints(string storeId = "")
...

Done — cache removed from GetAllDeliveryDates in 259c519. The method now queries the repository directly.

@KrzysztofPajak
Copy link
Copy Markdown
Member

@copilot remove cache from:
GetAllDeliveryDates(string storeId = "")
Task GetAllPickupPoints(string storeId = "")
...

Done — cache removed from GetAllDeliveryDates in 259c519. The method now queries the repository directly.
Use best practice and Where should be before ToList.
You didn remove from all suggested methods from other services.
You forgot to add pagination

…ore ToList; add pagination to all three GetAll methods

Co-authored-by: KrzysztofPajak <16772986+KrzysztofPajak@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 27, 2026

@copilot remove cache from:
GetAllDeliveryDates(string storeId = "")
Task GetAllPickupPoints(string storeId = "")
...

Done in c3e5885:

  • Cache removed from GetAllWarehouses and GetAllPickupPoints as well
  • Where is now applied to the IQueryable before pagination (filters in DB, not in-memory)
  • All three GetAll* methods now accept pageIndex/pageSize and return IPagedList<T>; test mocks updated accordingly

@KrzysztofPajak
Copy link
Copy Markdown
Member

@copilot Grand.Web.Admin - Add support for StoreId to Warehouse/DeliveryDate/PickupPoint in Shipping

…ing views

Co-authored-by: KrzysztofPajak <16772986+KrzysztofPajak@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 27, 2026

@copilot Grand.Web.Admin - Add support for StoreId to Warehouse/DeliveryDate/PickupPoint in Shipping

Done in the latest commit. Here's what was changed:

  • WarehouseModel and DeliveryDateModel now have StoreId and AvailableStores properties (matching the existing PickupPointModel pattern)
  • PrepareAddressWarehouseModel in ShippingController (Admin) now populates AvailableStores with all stores
  • New PrepareDeliveryDateModel helper populates AvailableStores for delivery dates
  • CreateOrUpdateWarehouse.cshtml and CreateOrUpdateDeliveryDate.cshtml partials now render the store selector dropdown
  • Resource keys added: Admin.Configuration.Shipping.Warehouses.Fields.Store, Admin.Configuration.Shipping.Warehouses.SelectStore, Admin.Configuration.Shipping.DeliveryDates.Fields.Store, Admin.Configuration.Shipping.DeliveryDates.SelectStore

Copilot AI changed the title Add ShippingController to Grand.Web.Store for delivery dates, warehouses, and pickup points per store Add ShippingController to Grand.Web.Store and StoreId support to Admin Shipping for delivery dates, warehouses, and pickup points May 27, 2026
… LINQ best practices

Co-authored-by: KrzysztofPajak <16772986+KrzysztofPajak@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 31, 2026

@copilot ShippingMethodService.GetAllShippingMethods remove cache and use the best standards for LINQ

Done. Cache removed from GetAllShippingMethods — the method now builds an IQueryable directly from the repository, applies the storeId filter (and OrderBy) on the query before materialization, then applies the filterByCountryId and customer-group filters in-memory (since those check nested collections that can't be pushed to the DB). Commit: c3e4d6f.

@KrzysztofPajak KrzysztofPajak marked this pull request as ready for review May 31, 2026 13:59
Copilot AI review requested due to automatic review settings May 31, 2026 13:59
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds store-scoped shipping management (CRUD + settings/providers) to the Store area and extends Admin shipping management with StoreId support so shipping entities can be isolated per store (with optional global/shared records).

Changes:

  • Added a Store-area ShippingController and Razor views for managing warehouses, delivery dates, pickup points, shipping methods, plus per-store shipping settings and provider activation.
  • Extended shipping domain/models and service APIs to support StoreId filtering and paging (IPagedList<T>), and updated consumers/tests accordingly.
  • Updated Admin shipping UI to display/store StoreId (dropdown + “Store” column), and adjusted installer sitemap permissions.

Reviewed changes

Copilot reviewed 49 out of 50 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
src/Web/Grand.Web.Store/Controllers/ShippingController.cs New Store-area controller for shipping CRUD, provider toggles, and per-store settings.
src/Web/Grand.Web.Store/Controllers/ProductController.cs Sets StoreId during product creation via object initializer.
src/Web/Grand.Web.Store/Controllers/HomeController.cs Adds store-area GetStatesByCountryId endpoint (parity with Admin/Vendor).
src/Web/Grand.Web.Store/Areas/Store/Views/Shipping/Warehouses.cshtml Store-area warehouses list grid.
src/Web/Grand.Web.Store/Areas/Store/Views/Shipping/Settings.cshtml Store-scoped shipping settings UI.
src/Web/Grand.Web.Store/Areas/Store/Views/Shipping/Providers.cshtml Store-scoped shipping provider activation grid.
src/Web/Grand.Web.Store/Areas/Store/Views/Shipping/PickupPoints.cshtml Store-area pickup points list grid.
src/Web/Grand.Web.Store/Areas/Store/Views/Shipping/Partials/CreateOrUpdateWarehouse.cshtml Store-area warehouse create/edit partial.
src/Web/Grand.Web.Store/Areas/Store/Views/Shipping/Partials/CreateOrUpdatePickupPoint.cshtml Store-area pickup point create/edit partial.
src/Web/Grand.Web.Store/Areas/Store/Views/Shipping/Partials/CreateOrUpdateMethod.cshtml Store-area shipping method create/edit partial (localized).
src/Web/Grand.Web.Store/Areas/Store/Views/Shipping/Partials/CreateOrUpdateDeliveryDate.cshtml Store-area delivery date create/edit partial (localized).
src/Web/Grand.Web.Store/Areas/Store/Views/Shipping/Methods.cshtml Store-area shipping methods list grid.
src/Web/Grand.Web.Store/Areas/Store/Views/Shipping/EditWarehouse.cshtml Store-area warehouse edit page.
src/Web/Grand.Web.Store/Areas/Store/Views/Shipping/EditPickupPoint.cshtml Store-area pickup point edit page.
src/Web/Grand.Web.Store/Areas/Store/Views/Shipping/EditMethod.cshtml Store-area shipping method edit page.
src/Web/Grand.Web.Store/Areas/Store/Views/Shipping/EditDeliveryDate.cshtml Store-area delivery date edit page.
src/Web/Grand.Web.Store/Areas/Store/Views/Shipping/DeliveryDates.cshtml Store-area delivery dates list grid.
src/Web/Grand.Web.Store/Areas/Store/Views/Shipping/CreateWarehouse.cshtml Store-area warehouse create page.
src/Web/Grand.Web.Store/Areas/Store/Views/Shipping/CreatePickupPoint.cshtml Store-area pickup point create page.
src/Web/Grand.Web.Store/Areas/Store/Views/Shipping/CreateMethod.cshtml Store-area shipping method create page.
src/Web/Grand.Web.Store/Areas/Store/Views/Shipping/CreateDeliveryDate.cshtml Store-area delivery date create page.
src/Web/Grand.Web.Store/Areas/Store/Views/Setting/Partials/GeneralCommon.TabStoreInformationSettings.cshtml Removes “premium themes” remote JSON loading block.
src/Web/Grand.Web.Store/Areas/Store/Views/_ViewImports.cshtml Imports AdminShared Shipping models into Store-area views.
src/Web/Grand.Web.AdminShared/Services/ProductViewModelService.cs Updates delivery date/warehouse retrieval to use store-scoped service signatures.
src/Web/Grand.Web.AdminShared/Models/Shipping/WarehouseModel.cs Adds store fields (StoreId, StoreName, AvailableStores).
src/Web/Grand.Web.AdminShared/Models/Shipping/ShippingMethodModel.cs Adds store fields (StoreId, AvailableStores).
src/Web/Grand.Web.AdminShared/Models/Shipping/PickupPointModel.cs Adds StoreName for admin grid display.
src/Web/Grand.Web.AdminShared/Models/Shipping/DeliveryDateModel.cs Adds store fields (StoreId, StoreName, AvailableStores).
src/Web/Grand.Web.AdminShared/Mapper/ShippingMethodProfile.cs Updates mappings to ignore store dropdown + restricted groups.
src/Web/Grand.Web.Admin/Controllers/ShippingController.cs Adds store dropdown preparation + store name in list grids.
src/Web/Grand.Web.Admin/Areas/Admin/Views/Shipping/Warehouses.cshtml Adds “Store” column in admin warehouses grid.
src/Web/Grand.Web.Admin/Areas/Admin/Views/Shipping/PickupPoints.cshtml Adds “Store” column in admin pickup points grid.
src/Web/Grand.Web.Admin/Areas/Admin/Views/Shipping/Partials/CreateOrUpdateWarehouse.cshtml Adds store selector to admin warehouse edit/create partial.
src/Web/Grand.Web.Admin/Areas/Admin/Views/Shipping/Partials/CreateOrUpdateMethod.cshtml Adds store selector to admin shipping method edit/create partial.
src/Web/Grand.Web.Admin/Areas/Admin/Views/Shipping/Partials/CreateOrUpdateDeliveryDate.cshtml Adds store selector to admin delivery date edit/create partial.
src/Web/Grand.Web.Admin/Areas/Admin/Views/Shipping/DeliveryDates.cshtml Adds “Store” column in admin delivery dates grid.
src/Tests/Grand.Business.Catalog.Tests/Services/ExportImport/ProductImportDataObjectTests.cs Updates mocks to new paged store-scoped service signatures.
src/Modules/Grand.Module.Installer/Utilities/StandardAdminSiteMap.cs Adjusts admin sitemap permissions for restrictions nodes.
src/Core/Grand.Domain/Shipping/Warehouse.cs Adds StoreId to warehouse domain entity.
src/Core/Grand.Domain/Shipping/ShippingMethod.cs Adds StoreId to shipping method domain entity.
src/Core/Grand.Domain/Shipping/DeliveryDate.cs Adds StoreId to delivery date domain entity.
src/Business/Grand.Business.Core/Interfaces/Checkout/Shipping/IWarehouseService.cs Updates GetAllWarehouses to store-scoped paged signature.
src/Business/Grand.Business.Core/Interfaces/Checkout/Shipping/IShippingMethodService.cs Adds storeId parameter to GetAllShippingMethods.
src/Business/Grand.Business.Core/Interfaces/Checkout/Shipping/IPickupPointService.cs Updates GetAllPickupPoints to store-scoped paged signature.
src/Business/Grand.Business.Core/Interfaces/Checkout/Shipping/IDeliveryDateService.cs Updates GetAllDeliveryDates to store-scoped paged signature.
src/Business/Grand.Business.Checkout/Services/Shipping/WarehouseService.cs Implements store filtering + paging (cache removed).
src/Business/Grand.Business.Checkout/Services/Shipping/ShippingMethodService.cs Adds store filtering (cache removed) and keeps in-memory restrictions filtering.
src/Business/Grand.Business.Checkout/Services/Shipping/PickupPointService.cs Implements store filtering + paging (cache removed).
src/Business/Grand.Business.Checkout/Services/Shipping/DeliveryDateService.cs Implements store filtering + paging (cache removed).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/Web/Grand.Web.Store/Controllers/ShippingController.cs
@KrzysztofPajak
Copy link
Copy Markdown
Member

@copilot Grand.Web.Admin - shipping methods, list, add new column storeName

KrzysztofPajak and others added 4 commits May 31, 2026 16:26
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
… Admin and Store

Co-authored-by: KrzysztofPajak <16772986+KrzysztofPajak@users.noreply.github.com>
…ricted helpers in Store

Co-authored-by: KrzysztofPajak <16772986+KrzysztofPajak@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 31, 2026

@copilot Grand.Web.Admin - shipping methods, list, add new column storeName

Done. StoreName property added to ShippingMethodModel, the Methods POST action now builds a store dictionary and populates StoreName for each method (same pattern as the DeliveryDates/Warehouses lists), and a "Store" column has been added to Methods.cshtml.

@copilot improve Shipping restrictions - Add support per store in Grand.Web.Admin - add Grand.Web.Store by current store

Done. Changes in the latest commits:

Admin (Grand.Web.Admin):

  • ShippingMethodRestrictionModel extended with StoreId and AvailableStores
  • Restrictions() GET accepts an optional storeId query parameter — passes it to GetAllShippingMethods(storeId) so only methods for the selected store appear in the matrix
  • A store selector dropdown added to Restrictions.cshtml reloads the page with the chosen store
  • RestrictionSave() POST accepts storeId and redirects back to Restrictions?storeId=... to preserve the selection

Store (Grand.Web.Store):

  • IGroupService added to ShippingController constructor
  • Restrictions() GET and RestrictionSave() POST added — both call GetAllShippingMethods(CurrentStoreId) so only the current store's methods are shown/saved
  • New views: Restrictions.cshtml, Partials/Restrictions.TabCountry.cshtml, Partials/Restrictions.TabGroup.cshtml

@KrzysztofPajak
Copy link
Copy Markdown
Member

@copilot Grand.Web.Store - add Shipping Restrictions but only for the shipping method from Store owner

Copilot AI changed the title Add ShippingController to Grand.Web.Store and StoreId support to Admin Shipping for delivery dates, warehouses, pickup points, and shipping methods Add ShippingController to Grand.Web.Store and StoreId support to Admin Shipping for delivery dates, warehouses, pickup points, shipping methods, and restrictions May 31, 2026
Co-authored-by: KrzysztofPajak <16772986+KrzysztofPajak@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 31, 2026

@copilot Grand.Web.Store - add Shipping Restrictions but only for the shipping method from Store owner

Done. Both Restrictions() GET and RestrictionSave() POST in the Store ShippingController now apply a strict sm.StoreId == CurrentStoreId filter after calling GetAllShippingMethods(CurrentStoreId), so global shipping methods (empty StoreId) are excluded and only the store owner's own methods appear in the restriction matrix.

KrzysztofPajak and others added 3 commits May 31, 2026 17:07
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
…tro' of https://github.com/grandnode/grandnode2 into copilot/add-delivery-dates-warehouses-pickup-points-contro
@KrzysztofPajak KrzysztofPajak merged commit 307c7c2 into develop May 31, 2026
6 checks passed
@KrzysztofPajak KrzysztofPajak deleted the copilot/add-delivery-dates-warehouses-pickup-points-contro branch May 31, 2026 17:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants