mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-11 13:57:41 -08:00
Added search/sort by Location OU, added to listing
This commit is contained in:
parent
3dda4c9116
commit
2ea805b7ed
|
@ -26,7 +26,7 @@ class LocationsController extends Controller
|
||||||
$allowed_columns = [
|
$allowed_columns = [
|
||||||
'id','name','address','address2','city','state','country','zip','created_at',
|
'id','name','address','address2','city','state','country','zip','created_at',
|
||||||
'updated_at','manager_id','image',
|
'updated_at','manager_id','image',
|
||||||
'assigned_assets_count','users_count','assets_count','currency'];
|
'assigned_assets_count','users_count','assets_count','currency','ldap_ou'];
|
||||||
|
|
||||||
$locations = Location::with('parent', 'manager', 'children')->select([
|
$locations = Location::with('parent', 'manager', 'children')->select([
|
||||||
'locations.id',
|
'locations.id',
|
||||||
|
@ -42,6 +42,7 @@ class LocationsController extends Controller
|
||||||
'locations.created_at',
|
'locations.created_at',
|
||||||
'locations.updated_at',
|
'locations.updated_at',
|
||||||
'locations.image',
|
'locations.image',
|
||||||
|
'locations.ldap_ou',
|
||||||
'locations.currency'
|
'locations.currency'
|
||||||
])->withCount('assignedAssets as assigned_assets_count')
|
])->withCount('assignedAssets as assigned_assets_count')
|
||||||
->withCount('assets as assets_count')
|
->withCount('assets as assets_count')
|
||||||
|
|
|
@ -47,6 +47,7 @@ class LocationsTransformer
|
||||||
'assets_count' => (int) $location->assets_count,
|
'assets_count' => (int) $location->assets_count,
|
||||||
'users_count' => (int) $location->users_count,
|
'users_count' => (int) $location->users_count,
|
||||||
'currency' => ($location->currency) ? e($location->currency) : null,
|
'currency' => ($location->currency) ? e($location->currency) : null,
|
||||||
|
'ldap_ou' => ($location->ldap_ou) ? e($location->ldap_ou) : null,
|
||||||
'created_at' => Helper::getFormattedDateObject($location->created_at, 'datetime'),
|
'created_at' => Helper::getFormattedDateObject($location->created_at, 'datetime'),
|
||||||
'updated_at' => Helper::getFormattedDateObject($location->updated_at, 'datetime'),
|
'updated_at' => Helper::getFormattedDateObject($location->updated_at, 'datetime'),
|
||||||
'parent' => ($location->parent) ? [
|
'parent' => ($location->parent) ? [
|
||||||
|
|
|
@ -76,7 +76,7 @@ class Location extends SnipeModel
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $searchableAttributes = ['name', 'address', 'city', 'state', 'zip', 'created_at'];
|
protected $searchableAttributes = ['name', 'address', 'city', 'state', 'zip', 'created_at', 'ldap_ou'];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The relations and their attributes that should be included when searching the model.
|
* The relations and their attributes that should be included when searching the model.
|
||||||
|
|
|
@ -123,7 +123,16 @@ class LocationPresenter extends Presenter
|
||||||
"switchable" => true,
|
"switchable" => true,
|
||||||
"title" => trans('admin/locations/table.country'),
|
"title" => trans('admin/locations/table.country'),
|
||||||
"visible" => false,
|
"visible" => false,
|
||||||
],[
|
],
|
||||||
|
[
|
||||||
|
"field" => "ldap_ou",
|
||||||
|
"searchable" => true,
|
||||||
|
"sortable" => true,
|
||||||
|
"switchable" => true,
|
||||||
|
"title" => trans('admin/locations/table.ldap_ou'),
|
||||||
|
"visible" => false,
|
||||||
|
],
|
||||||
|
[
|
||||||
"field" => "manager",
|
"field" => "manager",
|
||||||
"searchable" => false,
|
"searchable" => false,
|
||||||
"sortable" => true,
|
"sortable" => true,
|
||||||
|
|
|
@ -512,8 +512,8 @@ Form::macro('customfield_elements', function ($name = "customfield_elements", $s
|
||||||
'text' => 'Text Box',
|
'text' => 'Text Box',
|
||||||
'listbox' => 'List Box',
|
'listbox' => 'List Box',
|
||||||
'textarea' => 'Textarea (multi-line) ',
|
'textarea' => 'Textarea (multi-line) ',
|
||||||
// 'checkbox' => 'Checkbox',
|
'checkbox' => 'Checkbox',
|
||||||
// 'radio' => 'Radio Buttons',
|
'radio' => 'Radio Buttons',
|
||||||
);
|
);
|
||||||
|
|
||||||
$select = '<select name="'.$name.'" class="'.$class.'" style="width: 100%" aria-label="'.$name.'">';
|
$select = '<select name="'.$name.'" class="'.$class.'" style="width: 100%" aria-label="'.$name.'">';
|
||||||
|
|
|
@ -141,12 +141,15 @@
|
||||||
@if (($location->city!='') || ($location->state!='') || ($location->zip!=''))
|
@if (($location->city!='') || ($location->state!='') || ($location->zip!=''))
|
||||||
<li>{{ $location->city }} {{ $location->state }} {{ $location->zip }}</li>
|
<li>{{ $location->city }} {{ $location->state }} {{ $location->zip }}</li>
|
||||||
@endif
|
@endif
|
||||||
@if (($location->manager))
|
@if ($location->manager)
|
||||||
<li>{{ trans('admin/users/table.manager') }}: {!! $location->manager->present()->nameUrl() !!}</li>
|
<li>{{ trans('admin/users/table.manager') }}: {!! $location->manager->present()->nameUrl() !!}</li>
|
||||||
@endif
|
@endif
|
||||||
@if (($location->parent))
|
@if ($location->parent)
|
||||||
<li>{{ trans('admin/locations/table.parent') }}: {!! $location->parent->present()->nameUrl() !!}</li>
|
<li>{{ trans('admin/locations/table.parent') }}: {!! $location->parent->present()->nameUrl() !!}</li>
|
||||||
@endif
|
@endif
|
||||||
|
@if ($location->ldap_ou)
|
||||||
|
<li>{{ trans('admin/locations/table.ldap_ou') }}: {{ $location->ldap_ou }}</li>
|
||||||
|
@endif
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
@if (($location->state!='') && ($location->country!='') && (config('services.google.maps_api_key')))
|
@if (($location->state!='') && ($location->country!='') && (config('services.google.maps_api_key')))
|
||||||
|
|
Loading…
Reference in a new issue