# UI/UX Improvements & New Features Recommendations **Date:** November 16, 2024 **Focus:** Display improvements, URL parameters, and filter-based search --- ## 🎨 Current Display Types Analysis ### 1. Vertical Table Display **Current State:** - Two-column layout (header | value) - Good for detailed single-record view - Works well with pagination **Improvements Needed:** - ✅ Already well-implemented - Consider: Collapsible sections for long data - Consider: Sticky headers on scroll ### 2. Div Display **Current State:** - Flexible layout - Header and value in separate divs - Pagination support **Improvements Needed:** - Add responsive grid option (2-column, 3-column on larger screens) - Better visual separation between records - Optional card-style wrapper per record ### 3. Standard Table Display **Current State:** - Traditional table with DataTables - Horizontal layout - Sorting and searching built-in **Improvements Needed:** - ✅ Already excellent with DataTables - Consider: Export buttons (CSV, PDF, Excel) - Consider: Column visibility toggle - Consider: Fixed header on scroll ### 4. Card Display **Current State:** - Grid layout with responsive columns - Individual cards per field - Custom colors per card **Improvements Needed:** - Add card hover effects - Optional image support in cards - Better spacing/padding controls - Card shadow customization --- ## 🚀 Major New Feature: URL Parameter Search & Filter Mode ### Concept Overview Transform the checker from "search-only" to "filter-capable" with two modes: **Mode 1: Search Mode (Current)** - User fills form to find specific records - Results shown after submission - Good for targeted searches **Mode 2: Filter Mode (NEW)** - Show all data by default - Form becomes a filter - Real-time filtering as user types - URL parameters pre-fill filters ### Benefits 1. **Better UX** - See all data immediately 2. **Shareable Links** - Direct links to filtered results 3. **SEO Friendly** - Crawlable data 4. **Faster Workflow** - No need to search if browsing --- ## 📋 Feature 1: URL Parameter Support ### Implementation Plan #### Backend Changes **File:** `includes/class-Shortcode.php` Add URL parameter parsing in `content()` method: ```php public function content($atts, $content=null) { // ... existing code ... // Get URL parameters $url_params = []; if (isset($_GET) && !empty($_GET)) { foreach ($_GET as $key => $value) { // Sanitize and store $url_params[$key] = sanitize_text_field($value); } } // Pass to template $render = str_replace('{url_params}', json_encode($url_params), $render); return $render; } ``` #### Frontend Changes **File:** `assets/public.js` Add auto-fill from URL parameters: ```javascript jQuery(document).ready(function($){ // Get URL parameters function getUrlParams() { var params = {}; var queryString = window.location.search.substring(1); var pairs = queryString.split('&'); for (var i = 0; i < pairs.length; i++) { var pair = pairs[i].split('='); if (pair[0]) { params[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1] || ''); } } return params; } // Auto-fill form from URL params var urlParams = getUrlParams(); if (Object.keys(urlParams).length > 0) { $('.dw-checker-inputs').each(function() { var fieldName = $(this).data('kolom'); if (urlParams[fieldName]) { $(this).val(urlParams[fieldName]); } }); // Auto-submit if params exist if ($('.auto-search-on-params').val() == 'yes') { $('.search-button').trigger('click'); } } }); ``` #### Admin Settings **File:** `templates/editor/setting-table-form.php` Add new setting: ```html
``` ### Usage Examples **Example 1: Pre-fill single field** ``` https://yoursite.com/checker/?Name=John ``` **Example 2: Pre-fill multiple fields** ``` https://yoursite.com/checker/?Name=John&City=Jakarta ``` **Example 3: Auto-search** ``` https://yoursite.com/checker/?Name=John&auto=1 ``` --- ## 📊 Feature 2: Show All Data Mode (Filter Mode) ### Implementation Plan #### Concept Instead of showing empty form → search → results, show: 1. All data loaded by default 2. Form acts as live filter 3. Results update as user types #### Admin Settings **File:** `templates/editor/setting-table-result.php` Add new setting: ```html ``` #### Frontend Implementation **File:** `assets/public.js` Add filter mode logic: ```javascript // Load all data on page load (if enabled) if (checkerSettings.initial_display !== 'hidden') { loadAllData(); } function loadAllData() { $.ajax({ type: 'post', url: '/wp-admin/admin-ajax.php', data: { action: 'checker_load_all_data', checker_id: checkerId, limit: checkerSettings.max_records || 100 }, success: function(res) { renderResults(res); // Enable filter mode if configured if (checkerSettings.filter_mode === 'filter') { enableLiveFiltering(); } } }); } function enableLiveFiltering() { // Store all data var allData = currentResults; // Listen to input changes $('.dw-checker-inputs').on('input', function() { var filters = {}; // Collect all filter values $('.dw-checker-inputs').each(function() { var field = $(this).data('kolom'); var value = $(this).val(); if (value) { filters[field] = value.toLowerCase(); } }); // Filter data client-side var filtered = allData.filter(function(row) { var match = true; for (var field in filters) { var rowValue = (row[field] || '').toLowerCase(); var filterValue = filters[field]; // Check match type if (matchType === 'match') { if (rowValue !== filterValue) match = false; } else if (matchType === 'contain') { if (rowValue.indexOf(filterValue) === -1) match = false; } } return match; }); // Update display renderResults({ count: filtered.length, rows: filtered, settings: checkerSettings, output: outputSettings }); }); } ``` #### Backend Handler **File:** `includes/class-Shortcode.php` Add new AJAX handler: ```php public function __construct() { // ... existing code ... add_action('wp_ajax_checker_load_all_data', [$this, 'checker_load_all_data']); add_action('wp_ajax_nopriv_checker_load_all_data', [$this, 'checker_load_all_data']); } public function checker_load_all_data() { $post_id = $_REQUEST['checker_id']; $limit = isset($_REQUEST['limit']) ? intval($_REQUEST['limit']) : 100; $checker = get_post_meta($post_id, 'checker', true); // Security check $ip = CHECKER_SECURITY::get_client_ip(); $rate_limit = CHECKER_SECURITY::check_rate_limit($post_id, $ip); if (!$rate_limit['allowed']) { wp_send_json_error(['message' => $rate_limit['message']]); return; } $url = $checker['link']; $link_format = substr($url, -3); $delimiter = $link_format == 'tsv' ? "\t" : ","; $data = []; if (($handle = fopen($url, "r")) !== false) { $keys = fgetcsv($handle, 0, $delimiter); $count = 0; while (($row = fgetcsv($handle, 0, $delimiter)) !== false && $count < $limit) { $data[] = array_combine($keys, $row); $count++; } fclose($handle); } wp_send_json([ 'count' => count($data), 'rows' => $data, 'settings' => $checker['result'], 'output' => $checker['output'] ]); } ``` --- ## 🎯 Feature 3: Enhanced Display Options ### Pagination Improvements #### Current Issues - Only shows numbered buttons - No "Previous/Next" buttons - No "Show X per page" option #### Recommended Additions **File:** `assets/public.js` ```javascript // Enhanced pagination function createPagination(totalRecords, perPage) { var totalPages = Math.ceil(totalRecords / perPage); var html = 'Loading data...
Try adjusting your search criteria