Merge remote-tracking branch 'origin/develop'

This commit is contained in:
snipe
2026-03-10 20:13:10 +00:00
5 changed files with 30 additions and 50 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

@@ -2,50 +2,3 @@
/**
* Macro helpers
*/
/**
* Barcode macro
* Generates the dropdown menu of available 1D barcodes
*/
Form::macro('alt_barcode_types', function ($name = 'alt_barcode', $selected = null, $class = null) {
$barcode_types = [
'C128',
'C39',
'PDF417',
'EAN5',
'EAN13',
'UPCA',
'UPCE',
];
$select = '<select name="'.$name.'" class="'.$class.'" aria-label="'.$name.'">';
foreach ($barcode_types as $barcode_type) {
$select .= '<option value="'.$barcode_type.'"'.($selected == $barcode_type ? ' selected="selected" role="option" aria-selected="true"' : ' aria-selected="false"').'>'.$barcode_type.'</option> ';
}
$select .= '</select>';
return $select;
});
/**
* Barcode macro
* Generates the dropdown menu of available 2D barcodes
*/
Form::macro('barcode_types', function ($name = 'barcode_type', $selected = null, $class = null) {
$barcode_types = [
'QRCODE',
'DATAMATRIX',
];
$select = '<select name="'.$name.'" class="'.$class.'" aria-label="'.$name.'">';
foreach ($barcode_types as $barcode_type) {
$select .= '<option value="'.$barcode_type.'"'.($selected == $barcode_type ? ' selected="selected" role="option" aria-selected="true"' : ' aria-selected="false"').'>'.$barcode_type.'</option> ';
}
$select .= '</select>';
return $select;
});

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') }}"
@@ -128,7 +129,7 @@
<x-slot:buttons>
<x-button.checkout permission="checkout" :item="$license" :route="route('licenses.freecheckout', $license->id)" />
<x-button.checkout permission="checkout" :item="$license" :route="route('licenses.checkout', $license->id)" />
<x-button.edit :item="$license" :route="route('licenses.edit', $license->id)" />
<x-button.clone :item="$license" :route="route('clone/license', $license->id)" />
<x-button.delete :item="$license" />