# Leads

As the initial step within the Build Solution framework, all incoming leads received by the company will be logged within this module by a designated user. The Leads module encompasses multiple forms and procedural steps that necessitate completion prior to advancing to subsequent tasks such as jobs and other related activities.

Access to the leads module is granted to users assigned any combination of the following roles: **Admin, Staff, Salespersons, Sales Manager, Sales Consultant, Super Admin, Accountant, Estimator, System Admin, and System Developer**.

{% tabs %}
{% tab title="Navigation to the page" %}

* Build Solution System menu > Leads

<figure><img src="https://1721684721-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPaF9cGX0SlYrvgRNs9Wi%2Fuploads%2FabGW4DjxRu2fJS23OdES%2Fimage.png?alt=media&#x26;token=838056f1-418c-4f1a-9085-2c17bcadce6a" alt=""><figcaption><p>Navigation to Leads</p></figcaption></figure>
{% endtab %}

{% tab title="Database tables and queries" %}
Below are the related DB tables:

* leads
* lead\_status\_types
  {% endtab %}

{% tab title="Function path" %}

#### Function Path -&#x20;

```
app/Http/Controllers/Admin/Lead/LeadController.php->create, store
```

{% endtab %}
{% endtabs %}

From the below interface, the user possesses the capability to conduct searches and apply filters to previously established leads.

<figure><img src="https://1721684721-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPaF9cGX0SlYrvgRNs9Wi%2Fuploads%2FLIjNtsRVpqYFk1Xw6exG%2Fimage.png?alt=media&#x26;token=072b16a1-4f09-4f63-a0d1-dea709a7e4c1" alt=""><figcaption><p>Leads</p></figcaption></figure>

The user can execute searches based on parameters such as first name, last name, email, mobile number, and address.&#x20;

<figure><img src="https://1721684721-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPaF9cGX0SlYrvgRNs9Wi%2Fuploads%2FlN23SyQ9x2MR3HKsOX5u%2Fimage.png?alt=media&#x26;token=3a02c214-d11f-46b1-9439-f3fe6d0db12b" alt=""><figcaption><p>Search Leads</p></figcaption></figure>

Additionally, the user is equipped to employ radio buttons for filtering leads. The user has the option to select between viewing All Leads or applying filters to the grid, allowing for the categorization of leads into 'Closed Leads', 'Mistake Leads', 'Duplicate Leads', or 'Sales Customers'.

<figure><img src="https://1721684721-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPaF9cGX0SlYrvgRNs9Wi%2Fuploads%2FsToO764UArMgknvmawbI%2Fimage.png?alt=media&#x26;token=c8ae5179-101c-468b-85e0-67475a3e81ad" alt=""><figcaption><p>Leads filter radio buttons</p></figcaption></figure>

In addition to the primary search field, the user is endowed with the privilege of employing filters to refine leads based on a selection of supplementary fields. These fields encompass Project Type, Assigned Salesperson, Lead Status, Lead Source, Conversion Status, and Dates. The user can readily access and activate these filtering mechanisms by toggling the designated filter control.

<figure><img src="https://1721684721-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPaF9cGX0SlYrvgRNs9Wi%2Fuploads%2F2zTawYPwJ65Km5LGySXv%2Fimage.png?alt=media&#x26;token=64bada6d-0955-4544-acf0-c33b817ece9e" alt=""><figcaption><p>Toggle Filter switch</p></figcaption></figure>

<div data-full-width="false"><figure><img src="https://1721684721-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPaF9cGX0SlYrvgRNs9Wi%2Fuploads%2F4l9PlKLLpWcmNaURHmSn%2Fimage.png?alt=media&#x26;token=6ace1ca5-4ed8-41b6-9617-58b19f846285" alt=""><figcaption><p>Toggle filter fields</p></figcaption></figure></div>

Values of the above dropdown fields are taken from different tables.

<table data-full-width="false"><thead><tr><th>Field</th><th>DB Table</th><th>Other</th></tr></thead><tbody><tr><td>Project Type</td><td>project_types</td><td>-</td></tr><tr><td>Salesperson Assigned</td><td>Users </td><td>where status =1 , listed_in_sales=1, is_developer!=1</td></tr><tr><td>Lead Status</td><td>lead_status_types </td><td>-</td></tr><tr><td>Lead Source</td><td>lead_source_types</td><td>-</td></tr><tr><td>Conversion Status</td><td>-</td><td>hardcoded the values</td></tr><tr><td>Date from</td><td>-</td><td>date picker</td></tr><tr><td>Date to</td><td>-</td><td>date picker</td></tr></tbody></table>

#### Leads Grid

The Leads grid is equipped with multiple columns that allow users to obtain a summarized view of individual leads without requiring navigation to their respective profiles. Each lead is associated with a job address, but this field remains empty until the lead is converted into a job.

When a user accesses a lead's profile, an automatic mechanism triggers, updating the "last viewed" timestamp for that lead and displaying this timestamp within the grid.

Furthermore, if a user modifies the details of a lead, a similar automated process updates the "last updated" timestamp for that lead, ensuring the most recent modification time is accurately reflected.

<figure><img src="https://1721684721-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPaF9cGX0SlYrvgRNs9Wi%2Fuploads%2FniSWCT1uZeiPNzrhiKS4%2Fimage.png?alt=media&#x26;token=3c4d97da-7517-468d-9fa4-14c619d09dbf" alt=""><figcaption><p>Leads grid</p></figcaption></figure>

Values of some columns in the leads grid are populated as below,

**Profile:** If First Name, Lead Status, and Lead Source are filled when updating the lead, then the profile is marked as completed.

**Job Address:** Get data from the leads table ‘address’ column.

**Status:**

<img src="https://lh5.googleusercontent.com/O3llJkmwEeLViKpARhDMzLOvBh9had5kTpmIyuEfUZmf9KbfesUJLnWDnZ44vRmB2WAgMWgZnlxGuw7R3SIbwtNltDXYnvBrOcL-PZyrc-UBuRCTWDvkluCGaxTF6OBC5EzgssEeF_ZkdtqqQuX2bTc" alt="" data-size="original">

**Confidence:** As the user iterates through and satisfies each element of the checklist array, the progress attribute of the confidence bar object incrementally populates, reflecting real-time completion status.

![](https://lh6.googleusercontent.com/AL6di5G1HXAds_ePElN1zxdfjudQqdWBLk0L6YZdBPkOuSH3vr4Jbl0qZdt_sSmOxXVUksgs3rij2NxaT9fDDMgp273wudHt2iXoluoLP3q6CyrDZanI5a8S04aERxDceLDakxcfO0LNs7UjhffU88U)

**Age:**

```
 If the lead is converted 
Age(days) = lead_coverted_date - lead_created_date;
 Else 
Age(days) = today - lead_created_date;

```

**Conversion:** Get data from the leads table ‘conversion\_status’ column.\\
