Fixed #18662 wire up search box in assigned license seats

This commit is contained in:
snipe
2026-03-10 15:31:54 +00:00
parent d0dbd1e561
commit e75860c6ee
4 changed files with 29 additions and 2 deletions

View File

@@ -37,6 +37,9 @@ class LicenseSeatsController extends Controller
$seats->ByAssigned();
}
if ($request->filled('search')) {
$seats->TextSearch($request->input('search'));
}
$order = $request->input('order') === 'asc' ? 'asc' : 'desc';

View File

@@ -5,6 +5,7 @@ namespace App\Models;
use App\Models\Traits\Acceptable;
use App\Models\Traits\CompanyableChildTrait;
use App\Models\Traits\Loggable;
use App\Models\Traits\Searchable;
use App\Notifications\CheckinLicenseNotification;
use App\Notifications\CheckoutLicenseNotification;
use App\Presenters\Presentable;
@@ -14,13 +15,15 @@ use Illuminate\Database\Eloquent\SoftDeletes;
class LicenseSeat extends SnipeModel implements ICompanyableChild
{
use Acceptable;
use CompanyableChildTrait;
use HasFactory;
use Loggable;
use Presentable;
use Searchable;
use SoftDeletes;
protected $presenter = \App\Presenters\LicenseSeatPresenter::class;
use Presentable;
protected $guarded = 'id';
protected $table = 'license_seats';
@@ -39,7 +42,25 @@ class LicenseSeat extends SnipeModel implements ICompanyableChild
'notes',
];
use Acceptable;
/**
* The attributes that should be included when searching the model.
*
* @var array
*/
protected $searchableAttributes = [
'notes',
];
/**
* The relations and their attributes that should be included when searching the model.
*
* @var array
*/
protected $searchableRelations = [
'user' => ['first_name', 'last_name', 'display_name', 'username', 'email'],
'asset' => ['name', 'asset_tag'],
];
public function getCompanyableParents()
{

View File

@@ -5,6 +5,7 @@
'api_url' => null,
'show_column_search' => false,
'show_advanced_search' => false,
'show_search' => true,
'fixed_number' => false,
'fixed_right_number' => false,
'sort_order' => 'asc',
@@ -26,6 +27,7 @@
id="{{ $name }}ListingTable"
data-show-columns-search="{{ $show_column_search }}"
data-show-advanced-search="{{ $show_advanced_search }}"
data-search="{{ $show_search }}"
data-footer-style="footerStyle"
data-show-footer="true"

View File

@@ -79,6 +79,7 @@
<x-slot:content>
<x-table
show_search="false"
api_url="{{ route('api.licenses.seats.index', [$license->id, 'status' => 'available']) }}"
:presenter="\App\Presenters\LicensePresenter::dataTableLayoutSeats()"
export_filename="export-{{ str_slug($license->name) }}-available-{{ date('Y-m-d') }}"