Skip to content

Vendor panel order details — first-party React view behind a server-side view marker - #3347

Open
MdAsifHossainNadim wants to merge 2 commits into
feat/vendor-panel-order-details-fragmentfrom
feat/vendor-panel-order-details-react
Open

Vendor panel order details — first-party React view behind a server-side view marker#3347
MdAsifHossainNadim wants to merge 2 commits into
feat/vendor-panel-order-details-fragmentfrom
feat/vendor-panel-order-details-react

Conversation

@MdAsifHossainNadim

@MdAsifHossainNadim MdAsifHossainNadim commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

All Submissions:

  • My code follow the WordPress' coding standards
  • My code satisfies feature requirements
  • My code is tested
  • My code passes the PHPCS tests
  • My code has proper inline documentation
  • I've included related pull request(s)
  • I've included developer documentation

Changes proposed in this Pull Request:

Gives the Vendor panel's /orders/:orderId route a first-party React UI matching the design mockups, while the #3333 server-rendered fragment stays as the permanent compatibility fallback (ADR-0005 intact). Stacked on feat/vendor-panel-order-details-fragment.

Everything is additive — the only shipped files touched are one-line registrations plus this feature's own files from the base branch. OrderController, Assets.php, Order/functions.php, DetailsFragment and the fragment component are byte-identical.

  • Server-side view marker — new WeDevs\Dokan\Order\VendorPanelOrderDetails (Hookable) publishes dokanFrontend.order_details.view (react | fragment) through the existing dokan_react_frontend_localized_args seam, plus sections, the status list and the order_status_change admin setting. Defaults to react, with automatic fallback to the fragment when third-party callbacks are detected on the details-template hooks (reflection, best-effort — the dokan_vendor_panel_order_details_view filter is the guaranteed override) or when the session is Vendor staff (whose access only the fragment endpoint currently grants — the shipped staff-refusing permission rule is deliberately untouched, per the WPML - CUSTOMER/SELLER ACCOUNT - ORDERS > Order Details: Date of Delivery > Date > not translated #2133 split).
  • React view (src/dashboard/orders/details/) — summary strip (site-format "date at time", Dokan-formatted earning), items card (Figma column spec 44fr/22fr/22fr/22fr, #FDFDFD header strip, coupon chips, refund rows, strikethrough totals), downloadable-permissions card (search + grant, per-file editable limit/expiry with usage hints, revoke), sidebar Customer/Address/Notes cards built to the Figma spec (20px card grid with block-owned dividers, one label size throughout, lucide mail/phone/IP glyphs, addresses as a single line clamped to three with the full text on hover, legacy keycdn geo IP link, humanTimeDiff note stamps, trash-icon delete). One order fetch feeds the page; ORDER_DETAILS_LOADED/ORDER_DETAILS_STATUS_CHANGED keep the shared header in sync under either renderer.
  • Extension contract — every section is bracketed by before-* / after-* slots (summary, items, downloads, customer, address, notes) alongside items-actions and sidebar-before/middle/after, each receiving { order, orderId, sections, isLoading, refetch, navigate } as fillProps; Pro's sections plug in via registerPlugin scoped to the route id (companion PR). First-party data runs through JS filters too — dokan_order_details_summary_items, dokan_order_details_statuses, dokan_order_details_address_parts — and on the server, dokan_vendor_panel_order_details_sections and …_statuses join the existing …_args / …_view.
  • Header — RFQ-style breadcrumb ("< All Orders"), outlined status pill reusing the order-list badge theme classes at the RFQ pill's measured size, and the RFQ-measured split status button (42px segments, sharp white seam) offering the legacy status list — hidden on cancelled/refunded orders and honoring dokan_manage_order + the order_status_change admin setting. No Print control: the legacy page has none.
  • Downloads REST — new OrderDownloadController: GET/POST dokan/v1/orders/<id>/downloads, PUT/DELETE …/downloads/<permission_id>, registered via the dokan_rest_api_class_map filter; staff-aware permission callbacks modeled on the fragment endpoint; grant wraps wc_downloadable_file_permission() with the vendor-ownership guard from the AJAX handler; expiry stored as UTC midnight so the picked day round-trips timezone-stable.

Related Pull Request(s)

Closes

  • Part of getdokan/plugin-internal-tasks#2159 (implementation slices S1–S8 + parts of S10; automated tests and the extension-guide doc slice remain)

How to test the changes in this Pull Request:

  1. Build (npm run build) and open /dashboard/new/#/orders, then any order — the details render as first-party React (no fragment markup), on the product editor's gray canvas.
  2. Change the status from the split button — the header pill, button label and page data update together; the control is absent on cancelled/refunded orders and when the admin's "Order Status Change" setting is off.
  3. Add/delete an order note; grant a downloadable product, edit its limit/expiry, Update, Revoke.
  4. add_filter( 'dokan_vendor_panel_order_details_view', fn() => 'fragment' ); — the same route renders the Vendor order details in the Vendor panel — server-rendered fragment over REST #3333 fragment again (ADR-0005 gate). Legacy URL unchanged.
  5. Register any callback on dokan_order_detail_after_order_items from a theme — the view auto-falls back to the fragment.

Changelog entry

Vendor order details render as first-party React in the Vendor panel

Previous behaviour: the panel's order-details route displayed the legacy server-rendered template bridged in as an HTML fragment.

New behaviour: stores without third-party template hooks get a first-party React details view matching the new design (summary, items and totals, downloadable permissions, customer/address/notes sidebar), with named section slots for extensions. The fragment remains the automatic fallback for stores with third-party hooked output, for Vendor staff sessions, and via the dokan_vendor_panel_order_details_view filter; the legacy URL keeps working unchanged.

🤖 Generated with Claude Code

…ew marker

The panel's /orders/:orderId route renders a first-party React view matching
the Figma designs, with the #3333 server-rendered fragment kept as the
permanent fallback (ADR-0005). The server decides the renderer per store via
dokanFrontend.order_details.view — react by default, fragment automatically
when third-party callbacks are detected on the details-template hooks or the
session is Vendor staff, and always overridable through the
dokan_vendor_panel_order_details_view filter.

Additive only: a Hookable marker class on the existing localized-args seam,
a new OrderDownloadController (list/grant/update/revoke) registered through
dokan_rest_api_class_map, the details/ component tree with named section
slots for Pro, and the RFQ-measured header controls (breadcrumb, outlined
status pill, split status button honoring the legacy cancelled/refunded and
admin-setting rules). Shipped permission callbacks, Assets.php and the
fragment renderer are untouched.

Part of getdokan/plugin-internal-tasks#2159

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 091f1bc1-5a1e-4c11-8439-55d8ee170aa1

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/vendor-panel-order-details-react

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

The sidebar cards now carry the design's own spec rather than an approximation
of it: the customer's name belongs to the title block instead of sitting below
a rule, contact lines have their glyphs, addresses read as one sentence that
clamps at three lines with the full text on hover, and every block label is the
same size and weight.

Card rhythm needed the rule to move. The shared card header applies
`[.border-b]:pb-6` when it draws its own divider, and that beats a plain
padding utility on specificity — even an important one — so the dividered cards
sat 4px off the grid from the one without a divider. Blocks draw the rule
themselves now, and every card breathes identically.

Extensibility comes with it: each section is bracketed by `before-*`/`after-*`
slots carrying the whole view context, so an extension can add a card anywhere
without replacing a first-party one, and the summary cells, status list and
address parts run through JS filters. On the server, sections and the status
list get their own filters beside the existing marker ones.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.

1 participant