Skip to content

Commit 54df9e1

Browse files
author
Itamar Junior
committed
Add address search and split company name/custom columns in company table
1 parent 7f53912 commit 54df9e1

File tree

2 files changed

+29
-7
lines changed

2 files changed

+29
-7
lines changed

app/Livewire/Company/Company.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,11 @@ public function companies()
8181
$query->where(function ($q) {
8282
$q->where('name', 'like', '%' . $this->search . '%')
8383
->orWhere('custom', 'like', '%' . $this->search . '%')
84-
->orWhere('company_number', 'like', '%' . $this->search . '%');
84+
->orWhere('company_number', 'like', '%' . $this->search . '%')
85+
->orWhere('address_line_1', 'like', '%' . $this->search . '%')
86+
->orWhere('address_line_2', 'like', '%' . $this->search . '%')
87+
->orWhere('address_line_3', 'like', '%' . $this->search . '%')
88+
->orWhere('address_line_4', 'like', '%' . $this->search . '%');
8589
});
8690
})
8791
->when($this->selectedTagFilters, function ($query) {

resources/views/livewire/company/company.blade.php

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,21 @@ class="size-6 duration-400 transform ease-in-out
136136
d="m15 11.25-3-3m0 0-3 3m3-3v7.5M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z" />
137137
</svg>
138138
@endif
139-
Company Name
139+
Custom Name
140+
</div>
141+
</th>
142+
<th scope="col" class="px-6 py-2" wire:click="sort('name')">
143+
<div class="flex items-center">
144+
@if ($sortBy === 'name')
145+
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"
146+
stroke-width="1.5" stroke="currentColor"
147+
class="size-6 duration-400 transform ease-in-out
148+
@if ($sortDirection === 'asc' && $sortBy === 'name') rotate-180 @endif">
149+
<path stroke-linecap="round" stroke-linejoin="round"
150+
d="m15 11.25-3-3m0 0-3 3m3-3v7.5M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z" />
151+
</svg>
152+
@endif
153+
Company Entity
140154
</div>
141155
</th>
142156
<th scope="col" class="px-6 py-2" wire:click="sort('next_annual_return')">
@@ -194,16 +208,20 @@ class="size-6 duration-400 transform ease-in-out
194208
class="px-6 py-1.5 font-medium text-gray-900 whitespace-nowrap dark:text-gray-300">
195209
{{ $company->company_number }}
196210
</th>
211+
<td class="px-6 py-1.5">
212+
<div class="flex items-center">
213+
<p class="text-base font-semibold text-gray-900 dark:text-gray-300">
214+
{{ $company->custom ?? $company->name }}
215+
</p>
216+
</div>
217+
</td>
197218
<td class="px-6 py-0.5">
198219
<div class="ml-3">
199220
<p class="text-base font-semibold text-gray-900 dark:text-gray-300">
200-
{{ $company->custom ?? $company->name }}
221+
{{ $company->name }}
201222
</p>
202223
<span class="text-xm text-gray-500 dark:text-gray-400">
203-
Address: {{ $company->address_line_1 ?? '' }}
204-
</span>
205-
<span class="text-xm text-gray-500 dark:text-gray-400 truncate">
206-
{{ $company->name ?? ($company->custom ?? '') }}
224+
Address: {{ $company->address_line_1 . ', ' . $company->address_line_2 ?? '' }}
207225
</span>
208226
@if ($company->tags->isNotEmpty())
209227
@foreach ($company->tags as $tag)

0 commit comments

Comments
 (0)