public function dashboard_page() { global $wpdb; $table_scans = $wpdb->prefix . 'muo_inventory_scans'; $table_website = $wpdb->prefix . 'muo_website_units'; $table_exceptions = $wpdb->prefix . 'muo_inventory_exceptions'; $latest_scans = $wpdb->get_results("SELECT * FROM {$table_scans} ORDER BY id DESC LIMIT 10"); $latest_website_rows = $wpdb->get_results("SELECT id, scan_id, dealer_id, stock_number, vin, year, make, model, trim, condition_type, page_type, vehicle_url FROM {$table_website} ORDER BY id DESC LIMIT 15"); $latest_exceptions = $wpdb->get_results("SELECT id, scan_id, dealer_id, stock_number, vin, year, make, model, inventory_status, website_status, issue_type, issue_note FROM {$table_exceptions} ORDER BY id DESC LIMIT 25"); echo '
'; echo '

Inventory Monitor

'; echo '

DB Prefix: ' . esc_html($wpdb->prefix) . '

'; echo '

Website Table: ' . esc_html($table_website) . '

'; echo '

Exceptions Table: ' . esc_html($table_exceptions) . '

'; if (!empty($latest_scans)) { echo '

Recent Scans

'; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; foreach ($latest_scans as $scan) { echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; } echo '
IDDealer IDStatusTotal Inventory UnitsTotal Website UnitsTotal ExceptionsStartedCompleted
' . esc_html($scan->id) . '' . esc_html($scan->dealer_id) . '' . esc_html($scan->scan_status) . '' . esc_html($scan->total_inventory_units) . '' . esc_html($scan->total_website_units) . '' . esc_html($scan->total_exceptions) . '' . esc_html($scan->started_at) . '' . esc_html($scan->completed_at) . '
'; } else { echo '

No scans yet.

'; } echo '

Latest Website Rows

'; if (!empty($latest_website_rows)) { echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; foreach ($latest_website_rows as $row) { echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; } echo '
IDScan IDDealer IDStock #VINYearMakeModelTrimConditionPage TypeURL
' . esc_html($row->id) . '' . esc_html($row->scan_id) . '' . esc_html($row->dealer_id) . '' . esc_html($row->stock_number) . '' . esc_html($row->vin) . '' . esc_html($row->year) . '' . esc_html($row->make) . '' . esc_html($row->model) . '' . esc_html($row->trim) . '' . esc_html($row->condition_type) . '' . esc_html($row->page_type) . '' . esc_html($row->vehicle_url) . '
'; } else { echo '

No website rows found yet.

'; } echo '

Latest Exceptions

'; if (!empty($latest_exceptions)) { echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; foreach ($latest_exceptions as $row) { echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; } echo '
IDScan IDDealer IDStock #VINYearMakeModelInventory StatusWebsite StatusIssue TypeIssue Note
' . esc_html($row->id) . '' . esc_html($row->scan_id) . '' . esc_html($row->dealer_id) . '' . esc_html($row->stock_number) . '' . esc_html($row->vin) . '' . esc_html($row->year) . '' . esc_html($row->make) . '' . esc_html($row->model) . '' . esc_html($row->inventory_status) . '' . esc_html($row->website_status) . '' . esc_html($this->friendly_issue_label($row->issue_type)) . '' . esc_html($row->issue_note) . '
'; } else { echo '

No exceptions found yet.

'; } echo '
'; }