Filter System Module

Filter System
 

Intelligent Customer & New Leads Segmentation Engine

 

1. Conceptual Overview
 

The Filter System is a dynamic data-segmentation engine built to help users precisely control which customers or new leads appear in the system list.
 

It is not just a UI filter.

It is a persistent, reusable, export-aware filtering framework that powers:
 

  • Customer & New Lead lists

  • Saved views and shortcuts

  • Tabs and Orders filtering

  • Multi-criteria scoring filters

  • Export and reporting logic
     

Every filter you apply becomes part of a single unified query pipeline that the system understands and reuses across modules.
 



2. Where the Filter System Lives
 

The Filter System appears on the Customers / New Leads list page, visually integrated into the toolbar of the main customer table.
 

  • The entry point is a hamburger-style “Filters” button

  • Clicking it opens a full filter popup

  • The popup is layered above the list without navigating away

  • Filters always apply to the currently active list context
     

This ensures filters feel immediate, reversible, and safe.
 



3. Filter Popup – Visual & Functional Layout
 

The filter popup is divided into four functional tabs, each representing a different filtering strategy.
 

Advanced Filters
 

This is the core builder for most users.
It allows constructing one logical filter composed of multiple conditions combined with AND / OR logic.
 

Saved Filters
 

This tab lists all previously saved Advanced Filters, allowing instant reuse, editing, or sharing.
 

Multi Advance Filters
 

This tab allows building scored filters, where each condition contributes to a weighted evaluation.
 

Multi Saved Filters
 

This tab stores and manages previously saved multi-criteria (score-based) filters.
 

At any time, Clear All resets the filter state and returns the list to its default view.
 



4. Advanced Filters – How One Filter Is Built
 

Advanced Filters are constructed row-by-row, with each row representing one condition.
 

Step 1: Select Field
 

The user selects a field from a dynamically generated dropdown.

This list includes:
 

  • Core system fields (email, phone, status, source, tags, etc.)

  • Financial and status metrics

  • Dates and timestamps

  • Organization-defined extra fields

  • Grouped custom fields expanded automatically
     

The field list is generated centrally so the same fields are available everywhere.
 

Step 2: Choose Condition
 

Each field can be tested using operators such as:
 

  • is

  • is not

  • empty

  • not empty
     

These operators are language-aware and consistent across the system.

 

Step 3: Enter Value
 

The value input adapts to the selected field type:
 

  • Dropdowns for enums (status, tags, managers)

  • Date pickers for dates

  • Text inputs for strings

  • Numeric inputs for amounts
     

Step 4: Combine Conditions
 

Users can add unlimited rows and connect them using AND / OR logic, allowing very precise queries.
 



5. Include Child Customers & Extra Options
 

include Child Customers
 

A dedicated checkbox allows the filter to include sub-customers (child records).
 

This setting:
 

  • Can be toggled per filter

  • Is saved inside the filter definition

  • Can also be enabled globally per user
     

Extra Options
 

The “Extra Option” panel allows injecting additional key/value constraints that are not part of the main UI fields.
 

These options:
 

  • Are stored with the filter

  • Travel with saved filters

  • Are applied transparently by the backend query engine
     



6. Applying a Filter – What Really Happens
 

When the user clicks Apply, the system does not just hide rows.
 

Instead, it performs a full data reload using a structured filter payload.
 

Internally:
 

  1. The UI builds a structured filter object

  2. All selected fields, operators, values, AND/OR logic, extra options, and child flags are packaged

  3. This payload is sent to the main load API

  4. The backend converts it into SQL filter logic

  5. The customer list reloads using the filtered query
     

This guarantees:
 

  • Correct pagination

  • Correct totals

  • Correct exports

  • Consistent results everywhere
     



7. Saving Filters – Persistent Views
 

Any Advanced Filter can be saved with a name.
 

Once saved:
 

  • It appears in the Saved Filters tab

  • It can be reapplied instantly

  • It can be edited or overwritten

  • It can be copied as a direct URL
     

Saved filters are stored per user and per organization, ensuring privacy and consistency.
 

Opening the page with ?advance={filter_id} automatically applies that filter.
 



8. Multi Advance Filters – Scored Logic
 

Multi Advance Filters extend filtering beyond yes/no logic.
 

Each condition:
 

  • Has a comparison operator

  • Has a value

  • Contributes to a score
     

The final score determines whether a customer matches.
 

This is ideal for:
 

  • Lead qualification

  • Priority ranking

  • Complex business rules
     

Saved multi filters behave exactly like saved single filters but use a different evaluation engine.
 



9. Backend Query Engine
 

All filtering logic ultimately passes through a single backend loader.
 

This loader:
 

  • Reads filter parameters

  • Builds SQL WHERE clauses dynamically

  • Applies AND/OR logic correctly

  • Merges multi filters when present

  • Handles extra options and sub-customers

  • Ensures security and correctness
     

This unified engine ensures filters behave identically across:
 

  • Customer list

  • Tabs

  • Orders

  • Exports

  • Reports
     



10. Database Persistence
 

Saved filters are persisted in dedicated tables.
 

  • Single filters store condition arrays, operators, values, and flags

  • Multi filters store scored conditions and extra metadata

  • Filters are scoped by user, organization, and context (customer, tab, order)
     

This allows filters to be:
 

  • Reused safely

  • Migrated between contexts

  • Applied automatically in exports
     



11. Export Integration
 

The Export system is filter-aware by design.
 

When exporting:
 

  • The system uses the same filter query

  • Folder, search, and filters are respected

  • Selected rows override filters if chosen

  • Saved filters can be exported directly by ID
     

This guarantees exported files always match what the user sees.
 



12. Tabs, Orders & Reuse
 

The Filter System is reused across multiple modules.
 

  • Tabs can have their own saved filters

  • Orders reuse the same filter definitions

  • Newspapers and WhatsApp views reuse the same logic

  • Only the context flag changes
     

This reuse avoids duplication and keeps logic consistent.
 



13. End-to-End Lifecycle


User opens Filter
     ↓
Builds conditions
     ↓
Applies filter
     ↓
Backend builds query
     ↓
Customer list reloads
     ↓
(Optional) Save filter
     ↓
Reuse / Export / Share


14. Why This System Matters
 

The Filter System is a core intelligence layer, not a UI convenience.
 

It:
 

  • Enables deep segmentation

  • Improves operational focus

  • Powers exports and reporting

  • Supports growth in data volume

  • Keeps logic centralized and maintainable
     



Final Definition
 

The Filter System is a centralized, persistent, and reusable customer segmentation engine that transforms raw customer data into meaningful, actionable views — fully integrated with lists, tabs, orders, exports, and scoring logic.


 

information_img