resetPage(); } public function updatedTypeFilter(): void { $this->resetPage(); } public function updatedPerPage(): void { $this->resetPage(); } public function clearFilters(): void { $this->search = ''; $this->typeFilter = ''; $this->resetPage(); } public function with(): array { return [ 'potentialClients' => PotentialClient::query() ->when($this->search, fn ($q) => $q->where(function ($q) { $q->where('name', 'like', "%{$this->search}%") ->orWhere('email', 'like', "%{$this->search}%") ->orWhere('phone', 'like', "%{$this->search}%"); })) ->when($this->typeFilter, fn ($q) => $q->where('type', $this->typeFilter)) ->latest() ->paginate($this->perPage), 'types' => PotentialClientType::cases(), ]; } }; ?>
| {{ __('potential-clients.fields.name') }} | {{ __('potential-clients.fields.type') }} | {{ __('potential-clients.fields.email') }} | {{ __('potential-clients.fields.phone') }} | {{ __('potential-clients.created_at') }} | {{ __('potential-clients.actions') }} |
|---|---|---|---|---|---|
|
|
@switch($potentialClient->type)
@case(PotentialClientType::Individual)
|
{{ $potentialClient->email ?? '-' }} | {{ $potentialClient->phone ?? '-' }} | {{ $potentialClient->created_at->format('Y-m-d') }} |
|
|
|
|||||