Skip to main content

Rentiva v4.39.0 — Customers Page React SPA (Faz 2)

· 2 min read
MaxHandMade
Maintainer

The legacy jQuery / WP_List_Table Customers admin page is gone. v4.39.0 replaces it with a full React SPA backed by a dedicated REST API — live search, sortable columns, a slide-in detail panel, and bulk delete, all without page reloads.

What's New

Customers Page — React SPA Migration

This is the second major admin page migrated from PHP-rendered output to a React SPA (Faz 2, following the Dashboard in Faz 1).

New REST Endpoints

  • GET /mhm-rentiva/v1/customers — paginated customer list with search, sort, and per-page controls
  • GET /mhm-rentiva/v1/customers/{id} — full customer detail (name, email, phone, address, booking stats, first/last booking)
  • DELETE /mhm-rentiva/v1/customers/bulk — bulk delete by ID array with manage_options gate

New React Components

  • CustomersPage — root state orchestrator wiring search, pagination, and panel state
  • CustomerTable — sortable table replacing WP_List_Table; columns: Name, Email, Bookings, Total Spent, Last Booking, Registered
  • CustomerDetailPanel — slide-in panel on row click; shows full profile with Edit and View Bookings quick links
  • FilterBar — live search input with 300 ms debounce and bulk delete trigger

Removed Legacy Code

  • CustomersListTable.php — deleted
  • CustomersListPage.php — deleted
  • customers.js, customers-calendar.js, customers.css, simple-calendars.css — deleted

Other Changes

  • CustomersOptimizer extended with sort_by / sort_dir parameters and a PHP-side column whitelist for safe ORDER BY injection
  • Export CSV still streams via admin-post.php — the download flow is preserved alongside the SPA
  • CustomersPage::register() no longer hooks rest_api_init directly; routes register through Plugin.php so they're available before admin_menu fires

Tests

13 new PHPUnit integration tests (10 REST endpoint tests + 3 exporter tests). Full suite: 1115 tests, 3425 assertions. PHPCS: 0 errors.