Skip to content

[Core]: Global search bar across invoices, quotes, and clients #546

@nielsdrost7

Description

@nielsdrost7

User story

As a user, I want a global search bar in the company panel so I can quickly find invoices, quotes, clients, and products by number or name without navigating to each module individually.


Scope

Searchable resources

Resource Searchable fields
Invoices invoice_number, customer company_name
Quotes quote_number, prospect company_name
Clients (Relations) company_name, relation_number, trading_name
Products product_name

Acceptance criteria

  • A search input is visible in the company panel top navigation bar.
  • Typing 3+ characters triggers a live search across all configured resources.
  • Results are grouped by resource type.
  • Clicking a result navigates to the record's detail or edit page.
  • Search is company-scoped (current tenant only — no cross-tenant data leaks).
  • Empty state is shown when no results match.

Implementation notes

Filament v4 global search is enabled per resource by implementing getGloballySearchableAttributes():

// InvoiceResource.php
public static function getGloballySearchableAttributes(): array
{
    return ['invoice_number', 'customer.company_name'];
}

Each resource that should appear in global search results must implement this method. The panel provider enables global search by default via the top bar.


Arrange · Act · Assert

#[Test]
public function it_finds_an_invoice_via_table_search(): void
{
    /* Arrange */
    Invoice::factory()->for($this->company)->create(['invoice_number' => 'INV-SEARCH-001']);

    /* Act */
    $component = Livewire::actingAs($this->user)
        ->test(ListInvoices::class, ['tenant' => Str::lower($this->company->search_code)])
        ->searchTable('INV-SEARCH-001');

    /* Assert */
    $component->assertSuccessful();
    $component->assertCountTableRecords(1);
}

Split from #512, which had an incorrect title ("add search bar") on a body that described date field auto-population. This is the search bar issue; #512 now tracks date field auto-population.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions