0 comments on “Locations Table : React Conversion”

Locations Table : React Conversion

Goal: replace the legacy locations management table written in PHP and jQuery with a modern React component preferably MUI DataGridPro.

Legacy Locations Management Table

Rendering The UI

Rendering of the PHP page in WordPress is routed via this path:
– WordPress admin menu “Locations” (WordPress plugin) or “Location Details” (SaaS) for menu_items[‘slp_manage_locations’]
– Admin Menu calls \SLP_Admin_UI::renderLocationsPage to render the page.
– Calls \SLP_Admin_Locations::display

This renders the location manage page which has several tab panels.
Each tab panel is added or augmented with the slp_build_locations_panels custom WordPress hook.
The Locations Management Table is added with a hook priority of 10 that calls \SLP_Admin_Locations::addListLocationsSetting

When the page renders it goes inside an HTML div (tab panel) that is exposed when a user clicks on the List menu item in the horizontal tab menu that is currently rendered as a React component on the same page.

The List Locations Tab Panel Content

This page is comprised of HTML from the following methods:

  • \SLP_Admin_Locations::create_string_location_table_start –
    starting HTML wrappers for the locations table
  • \SLP_Notifications_Manager::get_html –
    renders a notification or “SnackBar” style notices manager if any notification messages are on the notifications array.
  • The ‘manage_locations_table’ \SLP_Setting object rendered by \SLP_Settings_manage_locations_table
    Draws the main locations data grid / table.
  • \SLP_Admin_Locations::create_string_location_table_end –
    ending HTML wrappers for the locations table

\SLP_Admin_Locations::create_string_location_table_start calls the following methods:

  • \SLP_Admin_Locations::set_location_query –
    Manages the SLP database queries.
    • Adds location query modifiers for the where clause via the custom hook slp_manage_location_where
      • Used by the Power plugin via \SLP_Power_Admin_Locations_Actions::process when action =
        • filter_by_category – to filter locations by category
        • show_uncoded – filter locations to those that are not geocoded (empty latitude or longitude fields)
        • filter_by_property – filter locations to match properties like name, zip code, country, state
    • Adds location query modifiers via \SLP_Admin_Locations::set_location_filter
    • Adds a sort order to the location results via \SLP_Admin_Locations::set_location_order
  • Executes the location query via \SLP_Data::get_SQL
  • Gets a total location count and stores it in \SLP_Admin_Locations::$total_locations_shown
  • Adjust the pagination starting page number if necessary storing the value in \SLP_Admin_Locations::$start


  • If no locations, adds a WordPress nonce with wp_nonce_field( ‘screen-options-nonce’, ‘screenoptionnonce’, false ) and shows the no locations message and returns.
  • If there are locations:
    • Outputs a hidden input field name=’start’ with the starting offset for pagination
    • If the page is rendered after a form post (processing the apply to all button) outputs a hidden input name=”apply_to_all” with a value=”1″
    • Outputs a div for the simulated pagination navigation block via \SLP_Admin_Locations::createstring_PanelManageTablePagination

\SLP_Settings_manage_locations_table main locations data grid rendering calls the following methods:

  • \SLP_Settings_manage_locations_table::display handles the main rendering which calls…
    • \SLP_Admin_Locations::display_manage_locations_table
      This is where the main HTML table is rendered that will be the primary object replaced by the MUI DataGridPro component.
      • Add the HTML input checkbox for each row, wired to a jQuery call to help managed checked/unchecked state.
      • Calls \SLP_Admin_Locations::display_column_headers to put field labels on top of the table columns.
      • Uses the custom filter slp_locations_manage_cssclass to apply custom CSS styling on rows for
        • invalid location entries via \SLP_Admin_Locations::filter_InvalidHighlight
        • locations with the private field set to true via \SLP_Admin_Locations::add_private_location_css
        • adds custom data specific styling via \SLP_Admin_Locations::customize_location_list_displayed_data
      • Managed the location data query, preparing the database layer for where clauses, sorting, etc.
      • Adds action buttons for edit, delete, etc to an Actions column which presents icons to modify data in each row
      • Loops through he list of returned locations records and displays rows of locations
        • Column data HTML output can be modified via the WordPress hook slp_column_data. This is used by these plugins:
          • Experience:
            • add_filter( ‘slp_column_data’, array( $this, ‘filter_FieldDataToManageLocations’ ), 90, 3 );
          • Power:
            • add_filter( ‘slp_column_data’, array( $this, ‘customize_location_list_displayed_data’ ), 20, 3 );
            • add_filter( ‘slp_column_data’, array( $this, ‘extend_location_columns’ ), 90, 3 );
          • Premier:
            • add_filter( ‘slp_column_data’, array( $this, ‘checkmark_territory_bounds’ ), 20, 3 );
          • Store-Locator-Plus:
            • add_filter( ‘slp_column_data’, array( $this, ‘customize_location_list_displayed_data’ ), 10, 3 );

Task : Replace The Manage Locations PHP and jQuery managed table with MUI DataGrid Pro

Licensing MUI DataGrid Pro

There is a license for MUI DataGrid Pro.
You can find an example in the HistoryTable React component in MySLP Dashboard (wp-content/plugins/myslp-dashboard/src/settings_history/HistoryTable.tsx).
The MySLP Dashboard plugin invokes the license in that component via import “@licensing/MuiLicense.js”;
This methodology can be copied for SLP.

Guidelines

  • Use the built-in DataGrid features for sorting, filtering, checkboxes to select row, pagination, and other extended features of the MUI component.
  • Extract the data manipulation elements from the legacy Store Locator Plus location management PHP code and integrate them into a location REST endpoint in the Store Locator Plus plugin.
    • The Store Locator Plus plugin already has REST endpoints for fetching location data
    • These existing endpoints may need to be augmented to accommodate all features of the manage locations table
    • Be sure to follow any custom WordPress hooks and filters employed to manipulate data
      • Pay special attention to hook and filters in the Experience, Power, and Premier plugins
  • Connect the interactions of the React LocationsTable component that was started in wp-content/plugins/store-locator-plus/src/LocationsTable/LocationsTable.tsx to the data display of the new MUI DataGrid Pro table for locations.
    • The LocationsTableHeader React component has been designed to interact with this data display table.
      • This component currently interacts with the legacy PHP and backend data processing interfaces.
      • Update the interactions as appropriate to take advantage of the new MUI Data Grid Pro features.
  • Locate the local AI knowledge and context files related to prior work on the location management interface, especially task summaries related to the LocationsTableHeader components.
    • Find $HOME/PhpstormProjects/workspace-sprocket/knowledge/ai-summaries/locations
  • Ask clarification questions before starting.
  • If unsure of any step in the process, pause and ask for guidance.
  • If any step of the process is not resolving in several turns, pause to explain the issue and proposed path forward and ask for guidance or assistance if needed.

Feedback Turn 1 : Store Locator Plus plugin version 2607.22.02

Tasks

  • ✅ Revert the action bar styling , see details below.
  • The per-row checkbox does not work, clicking the checkbox does not change the state of the checkbox UI on the row.
  • Pagination does not work. Reproduction:
    • Set page length to 10. Page 1-20 of 21 shown.
    • Click the > to move to the next page. Page redraws showing 1-10 again.
  • ✅ Fix Bulk Actions Categorize Slide Out Styling , see details below. Style is not correct.
  • ✅ The edit button on each row (in LocationsDataGrid) does not invoke an action.
  • ✅ Fix the add tags modal styling, see details below.
  • ✅ Drop the With These Properties option from the filter drop down (LocationsFilter)
    • Remove associated React code to show the slide out drawer and render the selectors.
  • ✅ Remove the LocationsSearch component from the LocationsTableHeader action bar.
    • Remove associated React code for display as well as related processing that is not in use by the DataGrid Pro implementation.

Revert The Action Bar Styling

The Manage Locations action bar (LocationsTableHeader component) style was changed.
The image below was what it looked like before the Codex GPT-5.6-Sol agent created the React version of the manage locations table.
This styling should have not been changed.

original action bar
Version 2607.22.01 – original manage locations action bar styling.

The revised action bar is shown here:

revised action bar
Version 2607.22.02 buttons colors changed.
  • Color scheme of apply, apply to all, and search buttons have changed.

Bulk Actions Categorize Slide Out Styling

  • The apply and apply to all are buttons not the top right as icons next to the close button.
  • The categories are following the WordPress hierarchy display
Version 2607.22.01 – original categorize panel styling
Version 2607.22.02 – Categories not hierarchical , button colors changed

Fix the add tags modal styling

v26072.22.01 – original styling
v2607.22.02 styling

For Review

With These Properties Filter Not Rendering

THIS IS NOT AN ACTIONABLE ITEM. This is a record of the changes made by the AI agent that produced a subpar result.

The “With These Properties” filter can be removed as MUI DataGrid Prod provides more advanced per-column filtering.

The drop down filter menu (rendered via the LocationsFilter component) no longer shows the slide out filter properties selector.

  • Select “With These Properties”
  • This should show a slide out drawer where a user can pick the properties to filter on (reference first image below), the drawer is not rendering on the visible UI surface (reference second image below).
v26072.22.01 – The With The Properties slide out UI is rendering.
Version 2607.22.02 – With These Properties slide out component is not rendering

Feedback Turn 2 : Store Locator Plus plugin version 2607.22.03

Tasks (Issues)

  • Click the per-row checkbox does not check the box.
    • Cannot select single rows in the DataGrid.
  • ✅ Pagination does not work.
    • Reproduction:
      • There are 25 locations
      • Set page length to 10. Page 1-20 of 21 shown.
      • Click the > to move to the next page. Page redraws showing 1-10 again.

Tasks (Improvements)

  • ✅ Separate the latitude and longitude after the business name into two new separate columns on the data grid.
    • Keep the name column pure with only the name rendered.
    • Add the latitude and longitude as separate columns as they are in the database.
    • This may require a back end change depending on how the REST data is procured.
  • ✅ Remember the state of the DataGrid columns.
    • The following properties of the DataGridPro should be remembered across page loads or table interactions:
      • Column Order
      • Hidden Columns
      • Filters
      • Sort Order
    • The state should be stored in the browser React state between page refreshes.
    • The state should make a REST call to store this state in the WordPress user meta as well.
      • This will likely require a new REST endpoint.
      • The meta key should start with the SLPLUS_PREFIX plus a name you deem appropriate (maybe csl-slplus-LocationsGridState)?
      • Use that user meta to remember the table state if the user moves off the page to another interface in WordPress and comes back.
      • This will also allow the table to remember the state if a user logs off and comes back the next day.
  • ✅ With DataGridPro there is an option to lock the table header (column names) and footer (pagination) and vertically scroll rows in between.
    • The display mode also appears to be able to match the height and width of the DataGridPro to the bounding box.
    • See the demo under the “Pro Version” header at https://mui.com/x/react-data-grid/

Feedback Turn 3 : Store Locator Plus plugin version 2607.23.01

Tasks (Issues)

  • ✅ Click the per-row checkbox does not check the box.
    • This issue has been a problem since Turn 1 and is going to need human intervention.
    • Cannot select single rows in the DataGrid.
    • The check/uncheck a single location does not work.

Tasks (Improvements)

  • ✅ Remove the LocationsFilter component from the LocationsTableHeader component.
    • The last remaining filter “Show Uncoded” is no longer needed now that latitude and longitude are on the column list.
  • Move the latitude and longitude column to be directly after the distance column on initial startup state.
  • ✅ When the DataGridPro meta data about column order, hide/show, or filters are in place add notification box above the table to let the user know “Custom table settings are in place. Some columns may be hidden or reordered.”

Feedback Turn 4 : Store Locator Plus plugin version 2607.23.02

Current (left) and preferred (right) notification box location.

Tasks (Improvements)

  • ✅ Move the notification box about custom columns to the top right.
  • ✅ Introduce a “Reset” button in the “Custom table settings” notification.
    • When the reset button is clicked, reset the DataGrid state back to the original defaults updating the stored state and related user meta in the process.
  • ✅ Add the built-in GridToolbarFilterButton and GridToolbarDensitySelector to the DataGridPro component in LocationsDataGrid.
  • Add the MUI Quick filter multi-field search to the DataGridPro by implementing the showToolbar property (see https://mui.com/x/react-data-grid/filtering/quick-filter/#system-QuickFilteringGrid.tsx)
  • ✅ Add an alternating row background to the data rows in the DataGridPro rendering.
  • ✅ The initial height for the DataGridPro component appears to be set according to the size of the slp-locations-grid or .react-wrapper div.
    • This element includes the LocationsTableHeader component and LocationsDataGrid component.
    • The height should be set by the available space in the outermost bounding layout element in LocationsDataGrid.

Observations

Actions to not need to be taken here. These are findings while reviewing the AI agent work.

  • To deal with styling issues with the React components, the AI Agent (Codex 5.6-Sol) added <div className=”react-wrapper”> to the LocationsTable component.
    • This would be more efficient by adding class=”react-wrapper” to the \SLP_Settings_manage_locations_table::display method that builds the div this React component attaches to.
      • Why? It creates one less HTML element the DOM processors need to navigate during processing.
  • Imports for React components are using “barrel imports” versus names imports.

Feedback Turn 5 : Store Locator Plus plugin version 2607.23.02

Tasks (Issues)

Tasks (Improvements)

  • ✅ Add the pin column setting to the state we remember about the data grid display. Store in local state and persistent user meta.
  • ✅ Move the Filters (GridToolbarFilterButton) and Density (GridToolbarDensitySelector) buttons after the Quick Filter search icon in the header.

Review

Task Summary

0 comments on “Accounting: Monthly History Data”

Accounting: Monthly History Data

Goal: Create a persistent accounting information data store using the built-in WordPress Multisite database surfaces.

The table should follow some standard rules that will allow us to implement CRUD operations via REST endpoints in the MySLP Dashboard plugin.

Tasks

  • One time task “Create Or Update The Database” when the MySLP Dashboard version indicates a change.
  • Create a Monthly Ledger User Interface to allow for manual CRUD operations on the slp_accounting_monthly_history table.

Monthly History Data : Environment

Environment

All accounting history data will reside in tables for the main WordPress super admin account.

The Main WordPress Super Admin account site ID is stored in the PHP constant SITE_ID_CURRENT_SITE and should be 1.
The database table prefix should come up as wp_ unlike user accounts that start with wp_<user_site_id>.

slp_accounting_monthly_history Table

The table should be named $wpdb->prefix . “slp_accounting_monthly_history” resulting in a table name of wp_slp_accounting_history.

slp_accounting_monthly_history Structure

  • ID – a unique ID to allow for explicit record I/O for CRUD operations.
  • KEY – a short string indicating the type of monthly data for example:
    • “SAAS_REVENUE”
    • “PLUGIN_REVENUE”
  • AMOUNT -an integer representing the numeric value for the key for example:
    • 3500 which may represent “35.00” or 35 dollars in our UI surfaces
  • DATE – a date and time for they entry representing the date this value represents NOT when the data was created or modified
  • YEAR – the 4-digit year represented by DATE
  • MONTH – the 2-digit month represented by DATE
  • DAY – the 2-digit day represented by DATE

slp_accounting_monthly_history Example Data

  • ID | KEY | AMOUNT | DATE | YEAR | MONTH | DAY
  • 1 | SAAS_REVENUE | 299000 | 2026-03-01 00:00:00 | 2026 | 03 | 31
  • 2 | SAAS_REVENUE | 302000 | 2026-04-01 00:00:00 | 2026 | 04 | 30
  • 3 | SAAS_REVENUE | 303000 | 2026-05-01 00:00:00 | 2026 | 05 | 31

slp_accounting_monthly_history Data Use Case

This Accounting Monthly History Data interface will run various monthly cron jobs to collect data and store it in this table.
We will use this data to product things like monthly revenue graphs for the SaaS Account Overview dashboard.
The graph will show SaaS Revenue from active accounts on a monthly basis.

We will do the same providing a manual process to add other revenue such as WordPress plugin revenue under “PLUGIN_REVENUE” keys.

We will allow for users to change the Line Chart revenue graph to show “monthly” or “yearly” graphs.
Future data keys may warrant daily graphs.

Task: Create Or Update The Database

When the MySLP Dashboard module version (plugin version) changes, run a database “create or update” hook to create the table or modify it as needed.

Copy the design pattern in the Store Locator Plus plugin in the \SLP_Admin_Activation class.
wp-content/plugins/store-locator-plus/include/module/admin/SLP_Admin_Activation.php
This is fired from \SLPlus::initialize_after_plugins_loaded
When the Store Locator Plus version reported is newer than the installed version for the plugin (see version_compare( $this->installed_version, SLPLUS_VERSION, ‘<‘ )) , the MySLP Dashboard should follow that pattern.

Task: Monthly Ledger User Interface

Admin Menu

  • Add a submenu with the label “Monthly Ledger” under the “Accounting” admin sidebar menu we created in \MySLP::create_network_admin_menu.
		$this->menu_hooks[ MYSLP_ACCOUNTING_MENU_SLUG ] =
			add_menu_page( __( 'Accounting', 'myslp' ),
				__( 'Accounting', 'myslp' ),
				'manage_network_options',
				MYSLP_ACCOUNTING_MENU_SLUG,
				array( $this, 'render_accounting_page' ),
				SLPlus::menu_icon,
				1.50
			);

Initial User Interface

  • Add a new My MySLP_Account_MonthlyLedger PHP React loader and helper class.
    Follow the design pattern of \MySLP_Accounting in wp-content/plugins/myslp-dashboard/include/accounting/MySLP_Accounting.php
    Place it in the same directory as MySLP_Accounting.php as a sibling.
  • Create a new React component that allows basic CRUD operations on the slp_accounting_monthly_history Table.
    Attach it to the MySLP_Account_MonthlyLedger PHP React loader.
    Follow the UI design pattern of the AccountingPanel React component at wp-content/plugins/myslp-dashboard/src/accounting/accounting.tsx
    Use a MUI X DataGridPro component as the primary table interface.
    Allow for pagination, starting with a default page length of 25 records.
    Sort the records by DATE descending on initial load so we see newer records at the top.
    Provide an add record interface where a user can enter the KEY, AMOUNT, DATE.
    Provide an inline edit record interface on the DataGridPro table to allow users to click on they KEY, AMOUNT, or DATE field on an existing record and change it.
    Provide a delete option for each record.

Data Interface

Use REST for all CRUD operations and to fetch the initial data set.

When records are added the backend data interface should:

  • Ensure all keys entered are trimmed (no leading/trailing spaces) and are shifted to uppercase.
  • AMOUNT is stored only as an integer.
  • DATE field needs to allow for flexible input converting text input into a best guess for the date to be stored as a date-time entry in the database. Examples:
    • “05/2026” is May 2026 which should be recorded as the date time 2026-05-01 00:00:00
    • “05/01/2026” is May 1st 2026 which should be recorded as the date time 2026-05-01 00:00:00
    • “May 2026” is May 2026 which should be recorded as the date time 2026-05-01 00:00:00
    • Allow for various separators such as / or – or .
      • 05-01-2026 is the same as 05/01/2026
      • 05.01.2026 is the same as 05/01/2026
    • Use standard Date/Time JavaScript or React libraries for data manipulation.
    • The manipulation can be not the front-end (React/JavaScript) before communicating with the REST endpoint.
  • The backend should do basic sanitation before recording data.

The “Buffer” For Overages

Legacy billing was sometimes strict on the overage policy. The revised automated report, not so much as there is a 100 views “free buffer” on overages.

2026 : Jan | Feb | Mar | April | May

Acct IDSpreadsheetNew50
BRmarket0 – 0 – 15 – 0 – 200 – 0 – 15 – 0 – ?
MKbevis0 – 0 – 5 – 0 – 00 – 0 – 0 – 55
TKESeck0 – 0 – 0 – 5 – 00 – 0 – 0 – 0 – 0
Arbor0 – 0 – 0 – 0 – 350 – 0 – 0 – 0 – 35
UWS0 – 20 – 25 – 45 – 11515 – 20 – 25 – 45 – 115
Gary10 – 15 – 20 – 25 – 250 – 15 – 20 – 20 – 25

The actual billing and monthly views do not always match.

Part of this is the monthly view total is triggered when the Stripe billing renews.
When a Stripe renewal is successful the SLP SaaS platform records the current view count to a permanent record of views for the previous customer billing period (prior month).
The system is imperfect and need refinement as Stripe sometimes needs to reprocess subscription renewals for a myriad of reasons.
As such the view tally is sometimes recorded more than once and reset more than once.
This impacts the total view count recorded for the month as well as the billing.

Starting in June 2026, we are using the new monthly views report as the source of truth.
This may not be perfect during the period we work to resolve these corner cases with Stripe renewals.
The map views will never be OVER actual usage.
Worst case, we bill a little LESS due to this issue.

Overages remain billed at $5 for a block of 1,000 extra views.
As an unofficial policy while we work toward resolution, all accounts now have a “100 free overage views” allowed on their account.
Thus, if an account is over views we don’t charge for the block until the new block gets 101+ views.
Examples:
limit is 5,000 – actual views is 5099 – billing is 0 extra blocks as 99 is under the 100 grace = $0
limit is 5,000 – actual views is 5250 – billing is 1 extra block at 250 exceeds the 100 grace = $5

limit is 5,000 – actual views is 8099 – billing is 3 extra block as 99 is under the 100 grace = $15

limit is 5,000 – actual views is 8250 – billing is 4 extra blocks = $20
(1 extra block: up to 6,000 views, 2: up to 7,000 views, 3: up to 8,000 views, 4: up to 9,000 views) = $20

As a result, months prior to June 2026 may not align with billing and view count.

0 comments on “Create Accounting Dashboard”

Create Accounting Dashboard

Goal: Create an accounting dashboard for the Store Locator Plus® SaaS application.

Primary Module: MySLP Dashboard (myslp-dashboard)
git repo: https://github.com/Store-Locator-Plus/myslp-dashboard

We are creating a full Store Locator Plus accounting dashboard to track both the SaaS platform as well as WordPress plugin sales.

Sales Data

The primary source of truth for sales data will come from Stripe.
Any references to PayPal payments or accounts can be considered legacy information and can be left out of the accounting panel.

Payment Module: MySLP Payments (myslp-payments)
git repo: https://github.com/Store-Locator-Plus/myslp-payments.git

The payment module holds the Stripe API module and related code for payment system communications.

User Interface

Stage 1 : Accounting Overview Scaffolding

Accounting Sidebar Menu

A new sidebar menu should be created in WordPress for super admin users only.
\MySLP::create_network_admin_menu should be used to create and attach the menu.
Follow the design pattern for the configure menu option, code snippet follows:

		$this->menu_hooks[ MYSLP_CONFIG_MENU_SLUG ] =
			add_menu_page( __( 'Configure', 'myslp' ),
				__( 'Configure', 'myslp' ),
				'manage_network_options',
				MYSLP_CONFIG_MENU_SLUG,
				array( $this, 'render_configuration_page' ),
				SLPlus::menu_icon,
				1.30
			);

Account Page Rendering

Unlike the main configure menu page that is rendered via \MySLP::render_configuration_page the new accounting module should load and render a React PHP helper class. We want this interface to be primarily React driven.

The WordPress PHP React Helper Class

Follow the \MySLP_Customer_Profile class for guidance on implementing a React user interface within WordPress.
I suggest creating a new class MySLP_Accounting in wp-content/plugins/myslp-dashboard/include/accounting.

The React AccountingPanel Component


The React components that \MySLP_Accounting loads with the help of the wp-scripts node package should live in wp-content/plugins/myslp-dashboard/src/accounting.
This directory should have a block.json and an accounting.tsx file.

block.json should probably look like this:

{
  "script": "file:profile.js"
}

The accounting.tsx TypeScript should contain the React accounting component.
This new React component should be named AccountingPanel.
It should follow the UX design pattern of the ProfilePanel component in wp-content/plugins/myslp-dashboard/src/profile/profile.tsx

The initial user interface will only have a single submenu (SLPTabsBar Tabs components) for the main page which should be labelled “Overview” which is already selected and open. It will render the AccountingOverviewPanel component noted below.

AccountingOverviewPanel Component

A supporting AccountingOverviewPanel React component should be created.
If the WordPress wp-scripts supports it, this can go in the same directory as the AccountingPanel component : if not place it in wp-content/plugins/myslp-dashboard/src/accounting_overview

This component should be a React Dashboard that shows overall accounting metrics.
To start with we will want to show the total number current active accounts and total amount of payments from those active accounts.
The ManageCustomers React component (wp-content/plugins/myslp-dashboard/src/manage_customers/manage_customers.tsx) displays this data in the AdminHeader children via a pair of Chips.
Use the same REST endpoints to fetch this data and display it.

The UX should try to follow the general design pattern at https://mui.com/material-ui/getting-started/templates/dashboard/.

Here is a screen shot of the Material UI Dashboard Template that is referenced.

For now we need the cards for:

  • Accounts in place of Users with the active count below. We will add a data table for historical trends and a graph below it in the future.
    Clicking on the user count in the account card should redirect the UX to load the Manage Customers page at /wp-admin/network/admin.php?page=customer_list
  • Payments in place of Conversions with the total payment amount below. This too will eventually have trends stored in a data table that we will create later.

AI Summary

Junie Pro Summary

Completed setup and implementation prep for the accounting dashboard work in myslp-dashboard, including running required start-revision on branch accounting.

• Implemented Stage 1 accounting UI scaffold: new Accounting admin page, React entrypoint, and overview metrics/cards with click-through to Manage Customers.

• Added new files: include/accounting/MySLP_Accounting.php, src/accounting/accounting.tsx, and src/accounting/block.json.

• Updated integration points in include/MySLP.php and constants/version metadata in myslp-dashboard.php and package.json.

• Validation status: lint checks for new files passed (only a non-blocking TS import style warning noted earlier), diff checks passed, and you confirmed npm install + npm run build succeeded locally with generated build/accounting/accounting.js and build/accounting/accounting.asset.php present.

• Environment note: Junie shell still lacks local php tooling and direct GitHub auth; you requested follow-up guidance on PAT-based auth after task completion.

Junie Release Notes
• Scope: No new product-code changes were made after the previously summarized accounting dashboard work in myslp-dashboard.
• Skills/Environment updates this session: Reloaded skills via Vendors/JetBrains/relink_skills.sh; available skills now include /wordpress-release-notes.
• Code impact since last implementation summary: None.
• Build/Test status: No additional build or test runs were performed after the earlier confirmed successful npm install and npm run build for myslp-dashboard.
Included Previously Completed Work (for continuity)
• Added Accounting admin page scaffold and React entry (include/accounting/MySLP_Accounting.php, src/accounting/accounting.tsx, src/accounting/block.json).
• Wired menu/render integration in include/MySLP.php and version bump artifacts from start-revision (myslp-dashboard.php, package.json).

0 comments on “Settings Interface Architecture”

Settings Interface Architecture

The Settings Interface architecture drives most of the legacy Store Locator Plus admin interfaces. These are the interfaces customers interact with most often, especially on the SaaS platform. It is the main component of the SLP Dashboard for SaaS.

It was originally written to manage the UI surfaces that present the myriad of settings (options) available to customers. It presents the “dials the users turn” to change how their store locator maps and directory presentations are configured. It grew to cover other admin UI interfaces including the Locations Interface.

Research Notes

About SLP_Settings

Extends SLP_Base_ReactObject which extends SLPlus_BaseClass_Object

SLP_Settings::render_settings_page

Outputs the HTML for settings pages, including the location details page (it uses the “settings” page construct). The output all ends up in a HTML element: <div class=’dashboard-wrapper’>…</div>.

General layout:

  • <div class=’dashboard-wrapper’>
    • <header id=”dashboard-header” class=”dashboard-header”> = React blue bar header
    • <div class=’dashboard-main store-locator-plus’>
      • <section class=’dashboard-content’>
        • <div id=’wpcsl_container’ …>
          • <form method=’post’ class=’slplus_settings_form’ …>
            • <div id=”main” class=”dashboard-content-inner panel-settings”>
            • <div id=”wpcsl-nav” class=”sub_navigation”> = from \SLP_Settings::sublevel_navbar
            • <div id=”content” class=”content js settings-content”>
The settings page header

The page header ends up in:

<header id="dashboard-header" class="dashboard-header"><!-- react slp_adminheader --></header>

Which is setup and managed with:

		// -- include the asset file to get the WordPress Scripts defined dependencies and version ID
		$asset = include SLPLUS_PLUGINDIR . 'build/slp_adminheader/script.asset.php';

		wp_enqueue_script( 'slp_adminheader', SLPLUS_PLUGINURL . '/build/slp_adminheader/script.js', $asset['dependencies'], $asset['version'], true );

		wp_add_inline_script( 'slp_adminheader', 'const slpReact = ' . wp_json_encode( $this->get_vars_for_react() ) . ';', 'before' );

Rendered via the React component at
wp-content/plugins/store-locator-plus/src/components/AdminHeader.js

That renders React Components:

  • <CssBaseline/>
  • <AdminHeader/>

Where <AdminHeader/> renders as:

  • <AppBar position=”sticky”>
    • <Toolbar>
      • <Typography variant=”h6″ component=”div”
        sx={{flexGrow: 1}}>{slpReact.pageName}</Typography>
      • {mainButtonGroup}
      • <Tooltip title={__(‘Documentation’, ‘store-locator-le’)}>
        • <IconButton … documentation … />
The settings page sub navbar (menu)

In the current version the header element DOES NOT contain the sub navbar.

It is rendered via SLP_Settings::sublevel_navbar deep inside the <div class=’dashboard-wrapper’>…</div> element.

React Update To Render Subnavbar

The goal is to render the \SLP_Settings::sublevel_navbar HTML output using React instead of the current PHP and HTML implementation.

The AdminHeader at wp-content/plugins/store-locator-plus/src/components/AdminHeader.js renders the top-of-page header with the page name and some interactive icon buttons.

The task is to add a submenu below the Toolbar that is comprised of the sections currently residing in $this->sections in the \SLP_Settings::sublevel_navbar method.  Using the $titleText ($section->name) within.  The wp_kses_post function current used to set $titleText is not necessary as the $section->name is already considered "clean".

The best way to get the variables into React so they are accessible in JavaScript is to modify the \SLP_Base_ReactObject::get_vars_for_react method.  Instead of attempting to override or extend the base \SLP_Base_ReactObject::get_vars_for_react method, add a filter in \SLP_Settings for slp_react_vars.   That will extend the react variable array via this return method on the end of the get_vars_for_react method:
apply_filters( 'slp_react_vars', $defaultVars );

You will find a good reference implementation of the slp_react_vars filter via:
\Customer_Profile_Site_Info::initialize - adds the filter for that class
\Customer_Profile_Site_Info::extendReactVars - extends the available JavaScript variables for React

In our case we are not extending MySLP variables, so the SLP_Settings::extendReactVars method should be more like this:
$vars['SLP']['sections'][] = array( 
'name' => $section->name,
'div_id' => ! empty( $section->div_id ) ? $section->div_id : $section->slug,
'link_id' => "wpcsl-option-{$div_id}"
);
This should be set up by looping through $this->sections in a new extendReactVars method in SLP_Settings.

This should create a horizontal navbar that shows and reveals each section by the div id. This may require further refinement as the current system uses outdated JavaScript and jQuery to hide and reveal subsequent divs by using the div IDS as noted in the link_id property.   For now we will assume that if React renders the components correctly the pre-existing JavaScript will take over.
Initial Results

Works on locations page.
Does not work on Settings page.
Spacing is not well defined, needs more space between menu items.

0 comments on “Locations Interface Architecture”

Locations Interface Architecture

The locations interface needs a major overhaul.

Let’s investigate the process and where we can start shimming some React components.

Research

Main Loader : Locations | Location Details (SaaS) Menu

Locations Page Header (UI)

The locations page is a bastardized combination of the SLP_Settings class and WP_List_Table.

The top-of-page header appears to be handled by SLP_Settings.
SLP_Settings extends SLP_Base_ReactObject
To start rendering the page is calls \SLP_Base_ReactObject::render with these attributes:
– $scriptHandle = ‘slp_settings’
– $scriptFilebase = ‘slp_settings’
This methodology ends up render the SLPSettingsPanel React component (wp-content/plugins/store-locator-plus/src/slp_settings/slp_settings.tsx)

That means the page header is rendering using the Reactionary standard <AdminHeader> for the page.
Currently SLP_Settings is only leverage the pageName property, but it also supports sections as a property which is the submenu.

With the 2606.26.01 release the Settings system uses the React AdminHeader menu.

\SLP_Settings::render_settings_page

  • $this->sections may have is_topmenu set, this indicates the top level menus in the app

Locations Card (Defunct?)

This may no longer be used: \SLP_Admin_Locations::create_location_details_box

SLP_Admin_Locations

extends WP_List_Table – this is already going to be a shit show. The WP_List_Table interface is from 1902. Maybe before that. It is awful.

Referenced by:

  • \MySLP_Admin::do_admin_startup()
    • Setting the screen property , probably not needed:
      SLP_Admin_Locations::get_instance()->screen = ‘store-locator-plus_page_slp_manage_locations’;
  • \SLP_Power_Pages_Admin::extend_location_edit()
    • Only if Store Pages is active, add an edit section to show an “edit Store Page” link
  • \SLP_Power_Pages_Admin::set_page_actions()
    • Add the recreate store page action hyperlink under each location on the table
  • \SLP_Actions::save_screen_options()
    • To save the screen options, which is currently only the page (table rows) length.
  • \SLP_Admin_Locations_Add::
    • initialize
    • extended_data_block – for extended data fields
  • \SLP_Admin_UI::renderLocationsPage
    • To render the UI
  • \SLP_Location_LoadFromWP::import
    • To only report back any URL the person puts in is invalid.
    • This is called from \SLP_Admin_Locations_Actions::process_actions when the current_action is load_from_wp
    • This is setup from \SLP_Admin_Locations_Load
  • \SLP_Settings_manage_locations_table::display
    • A shim for $this->settings->add_ItemToGroup( array(
      ‘group_params’ => $group_params,
      ‘type’ => ‘manage_locations_table’,
      ) );

SLP_Admin_Locations

Hooks & Filters Fired

  • slp_locations_manage_bulkactions : creates the list of bulk action dropdown items
    • SLP_Power_Admin_Locations
    • SLP_Experience_Admin
    • SLP_Power_Pages_Admin
  • slp_locations_manage_filters : The filter location drop down items
    • SLP_Power_Admin
  • slp_locations_manage_cssclass : Adds extra CSS classes
    • SLP_Experience_Admin
  • slp_column_data : Change the data rendered in a column
  • slp_manage_locations_actionbar_ui : modify the action bar on top of the table
  • slp_modify_admin_locations_script_data : modify the script data for the JavaScript on the page
  • slp_manage_location_columns
  • pls_manage_location_where
  • slp_manage_locations_buttons
  • slp_build_locations_panels

Not used:

  • slp_invalid_highlight
  • slp_edit_location_change_extended_data_info
  • slp_manage_expanded_location_columns

Screen for WP_List_Table

This is messing up the UI.
Let’s see if we can drop this, start peeling away layers to simplify this interface as we work toward a React version.

locations_per_page

  • Tracked via \SLPlus::$userMetaKeys
    • Stored in user meta via \SLP_AJAX::update_slp_user_meta
  • \SLP_Actions::init sets a filter on set-screen-option … it calls…
    • \SLP_Actions::save_screen_options … which only runs if the current page is slp_manage_locations… if so it calls…
      • \SLP_Admin_Locations::save_screen_options
        • Which returns the value of locations_per_page

Best option is to make this a React interface for page length / pagination

0 comments on “Twenty Twelve Theme Does Not Exist”

Twenty Twelve Theme Does Not Exist

The theme directory "twentytwelve" does not exist.

This issue comes up for older accounts where their wp_options table has their theme set to twentytwelve. If these accounts time out it does NOT flush the cookie (shit WordPress design) and when you re-visit the SaaS dashboard site (staging or production) you get the error message noted above.

0 comments on “google_maps script missing slp_core prerequisite”

google_maps script missing slp_core prerequisite

Notice: Function WP_Scripts::add was called incorrectly.

The script with the handle “google_maps” was enqueued with dependencies that are not registered: slp_core.

Reproduction


Dev Notes

SLP Architecture

slp_core (WordPress/wp-content/plugins/store-locator-plus/js/slp_core.js)

slp_core is the WordPress handle for the slp_core.js file.
slp_core.js is the primary Google maps interface between WordPress and JavaScript

Where the slp_core is found in store-locator-plus v2603.03.01

slp_core references in slp v2603.03.01

slp_core is REGISTERED here: \SLP_Actions::wp_enqueue_scripts
slp_core is currently only enqueued here: \SLP_UI::render_shortcode


google_maps (Google public Google Map JavaScript loader)

This loads a URL similar to:
https://maps.googleapis.com/maps/api/js?libraries=geometry,marker&v=quarterly&language=en&region=US&key=<GOOGLE_API_KEY>&loading=async

In the JavaScript this is referenced as google.maps.*

Google Maps is only enqueued here with the google_maps hook: \SLPlus::enqueue_google_maps_script
* @used-by \SLPlus::nqGoogleMaps
* @used-by \SLP_Actions::wp_enqueue_scripts
* @used-by \SLP_Admin_UI::initialize via the WordPress admin_enqueue_scripts hook

Non Admin Implementation

google_maps is used for users that are not logged in (non-admin) when rendering the SLPLUS shortcode.

This is managed via \SLP_UI::render_shortcode

\SLP_Power_UI::at_startup adds google_maps as a js_requirement (managed by \SLP_BaseClass_UI as part of normal UI interface management). This is likely unnecessary.

JavaScript References

  • SLP
    • js/slp_core.js
  • Power add on (slp-power)
    • slp-power_userinterface.js
  • Premier add on (slp-premier)
    • js/markerclusterer.js
    • slp-premier_userinterface.js
Admin Implementation

This is called on the slp_manage_locations (Location Details) admin page: \SLP_Admin_UI::initialize
via add_action( ‘admin_enqueue_scripts’, array( $this, ‘enqueue_slp_core_and_google_maps’ ) );

JavaScript References

  • SLP
    • js/slp_core.js
    • admin-locations-tab.js
  • Premier add on (slp-premier)
    • admin-locations-tab.js
    • admin-settings-tab.js
    • admin.js

AI Actions

Prompt

@amelia – We need to fix a script enqueue issue on the Location Details page
___
The script with the handle “google_maps” was enqueued with dependencies that are not registered: slp_core.
__

This error is caused because the WordPress script with the handle slp_core is not enqueued.

__

Option 1: We could enqueue this by calling \SLP_UI::render_shortcode

For the JavaScript in slp_core to be fully functional it requires localized variables.
Currently this only happens in \SLP_UI::render_shortcode
The problem is that \SLP_UI::render_shortcode has the extra overhead:
– Generating a large HTML output string
– Firing a slp_after_render_shortcode action
We only want the JavaScript variables configured and then localized via \SLP_UI::localize_script

If we use this method, we would need to bypass the HTML output and slp_after_render_shortcode action hook processing.

The best way to hook that would be to rewrite \SLP_Admin_UI::initialize to call a new method:
– Replace add_action( ‘admin_enqueue_scripts’, array( $this->slplus, ‘enqueue_google_maps_script’ ) );
– With add_action( ‘admin_enqueue_scripts’, array( $this, ‘enqueue_slp_core_and_google_maps’ ) );

Create a new method \SLP_UI::enqueue_slp_core
– Extracts the first chunk of \SLP_UI::render_shortcode up to the wp_enqueue_script( ‘slp_core’ );
– It needs to accept the parameters from \SLP_UI::render_shortcode

Create a new method \SLP_Admin_UI::enqueue_slp_core_and_google_maps
– call the new \SLP_UI::enqueue_slp_core method
– call \SLPlus::enqueue_google_maps_script

Update \SLP_UI::render_shortcode to call \SLP_UI::enqueue_slp_core to replace the code that was moved to the new \SLP_UI::enqueue_slp_core method

AI Results

\SLP_UI::register_slp_scripts_if_needed is a duplicate of \SLP_Actions::wp_enqueue_scripts.
This unnecessary extra code.
Duplicate code should be avoided when possible.

Created \SLP_UI::enqueue_slp_core with admin_safe flag resulting in inefficient architecture.
This is only called with the admin_safe flag from \SLP_Admin_UI::enqueue_slp_core_and_google_maps.
The register_slp_scripts_if_needed call in the admin_safe short circuit block can be put inline in the calling method as a call to \SLP_Actions::wp_enqueue_scripts.
The admin_safe only method localize_script_admin_safe could should be in SLP_Admin_UI as it is an admin only method: \SLP_Admin_UI::localize_script_admin_safe.
The wp_enqueue_script( ‘slp_core’ ); call can be in the calling method as well.
Returning the $attributes array is not necessary.

My fixes to the AI work:

Rip out the admin_safe short circuit from SLP_UI and place the equivalent code in SLP_Admin_UI as these updates only related to admin hooks. SLP_UI relates to non-admin code and should not have admin-only methods in there. Us nqGoogleMaps in admin as that can certainly load in async versus defer mode.

in SLP_Admin_UI

	public function enqueue_slp_core_and_google_maps( string $hook = '' ): void {
		$slp_actions = SLP_Actions::get_instance();
		$slp_actions->wp_enqueue_scripts(); // misnomer - registers the slp_core script

		$this->localize_script_admin_safe();
		wp_enqueue_script( 'slp_core' );

		$this->slplus->nqGoogleMaps( $hook );
	}

	/**
	 * Localize only the data needed for admin enqueue paths without invoking shortcode SmartOptions callbacks.
	 */
	private function localize_script_admin_safe(): void {
		$scriptData = array(
			'options'              => is_array( $this->slplus->options ) ? $this->slplus->options : array(),
			'environment'          => array(
				'addons'      => $this->slplus->AddOns->get_versions(),
				'slp_version' => SLPLUS_VERSION,
			),
			'plugin_url'           => SLPLUS_PLUGINURL,
			'ajaxurl'              => admin_url( 'admin-ajax.php' ),
			'nonce'                => wp_create_nonce( 'wp_rest' ),
			'apikey'               => SLPlus::get_instance()->get_apikey(),
			'rest_url'             => rest_url( 'store-locator-plus/v2/' ),
			'messages'             => $this->get_messages(),
			'shortcode_attributes' => $this->js_attributes,
		);

		ksort( $scriptData['options'] );
		wp_add_inline_script(
			'slp_core',
			'const slplus = ' . wp_json_encode( $scriptData )
		);
	}

	/**
	 * Set the messages for us in the JS array.
	 *
	 * @return string[]
	 */
	private function get_messages(): array {
		$messages = $this->slplus->Text->get_text_group( 'messages' );

		return apply_filters( 'slp_js_messages', $messages );
	}

In SLP_UI

Move the localize_script_admin_save to the SLP_Admin_UI module where it belongs. Have register_slp-scripts_if_needed method call SLP_Actions->wp_enqueue_scripts in SLP_Actions.

	private function register_slp_scripts_if_needed(): void {
		$slp_actions = SLP_Actions::get_instance();
		$slp_actions->wp_enqueue_scripts();
	}

Update

The latest update needs to be reviewed. It is calling enqueue_google_maps_script from \SLP_Admin_UI::initialize
With add_action( ‘admin_enqueue_scripts’, array( $this, ‘enqueue_slp_core_and_google_maps’ ) );

Need to look at Premier interfaces listed above for Google Maps interactions.

Settings | Map | Map Center Fallback

This should be showing the Google Map to show the map center.

0 comments on “WP Distribution : Some Fonts / Images Missing”

WP Distribution : Some Fonts / Images Missing

While testing Power : Imports Are Not Working other issue were noted about missing images and fonts.

On the WordPress QC Site looking in the JavaScript console shows some WOFF/TTF and image files are missing in the CSS stack.

Need to update the Store Locator Plus® plugin distribution.


🔲  All CSS fonts (woff/woff2/ttf) files are missing
Check the distribution packaging ruleset in the AWS CodeBuilder https://qc.storelocatorplus.com/wp-content/plugins/store-locator-plus/css/fonts/fontawesome-webfont.woff2?v=4.7.0
https://qc.storelocatorplus.com/wp-content/plugins/store-locator-plus/css/fonts/fontawesome-webfont.ttf?v=4.7.0
https://qc.storelocatorplus.com/wp-content/plugins/store-locator-plus/css/fonts/fontawesome-webfont.svg?v=4.7.0#fontawesomeregular

🔲  Some CSS images are missing
https://qc.storelocatorplus.com/wp-content/plugins/store-locator-plus/css/admin/DataTables-1.10.24/images/sort_both.png
https://qc.storelocatorplus.com/wp-content/plugins/store-locator-plus/css/admin/DataTables-1.10.24/images/sort_asc.png