Skip to main content

Rentiva v4.51.0 — Vendor Management Faz B: Vendors, Commission & Settings React SPA

· 2 min read
MaxHandMade
Maintainer

Vendor Management completes its React SPA migration with Faz B: the Vendors, Commission, and Settings tabs are now fully client-side. Seven new REST endpoints, three new React components, and an N+1 query fix for vendor listing.

What Changed

Vendors Tab — VendorTable Component

The Vendors tab is now a live React table powered by GET /wp-json/mhm-rentiva/v1/admin/vendors. Features:

  • Paginated vendor list with vehicle count per vendor (single GROUP BY query — no N+1)
  • Suspend / Unsuspend actions via POST /admin/vendors/{id}/suspend and POST /admin/vendors/{id}/unsuspend
  • Real-time status badges and inline feedback without page reload

Commission Tab — CommissionTab Component

The Commission tab reads and writes the global commission rate via two new REST routes:

  • GET /admin/commission — fetch current rate
  • POST /admin/commission — update rate with validation

The PHP render function has been removed; the tab is entirely SPA-driven.

Settings Tab — SettingsTab Component

Vendor Management settings (enable/disable vendor marketplace, terms URL, approval mode) are now managed through:

  • GET /admin/vendor-settings — fetch all settings
  • POST /admin/vendor-settings — persist changes

REST Endpoints Added (7 total)

MethodRoutePurpose
GET/admin/vendorsPaginated vendor list
POST/admin/vendors/{id}/suspendSuspend a vendor
POST/admin/vendors/{id}/unsuspendUnsuspend a vendor
GET/admin/commissionGet commission rate
POST/admin/commissionSet commission rate
GET/admin/vendor-settingsGet vendor settings
POST/admin/vendor-settingsUpdate vendor settings

Performance

Vendor list previously issued one COUNT(*) query per vendor to get vehicle counts. This release replaces it with a single GROUP BY aggregation — O(n) → O(1) queries regardless of vendor count.

Test Coverage

19 new PHPUnit tests covering all 7 REST endpoints and their permission, validation, and response contracts.