mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-25 13:44:06 -08:00
Added asset by manufacturer listing
This commit is contained in:
parent
f1c4aed5b5
commit
9cae6066a0
|
@ -92,6 +92,10 @@ class AssetsController extends Controller
|
|||
$assets->InCategory($request->input('category_id'));
|
||||
}
|
||||
|
||||
if ($request->has('manufacturer_id')) {
|
||||
$assets->ByManufacturer($request->input('manufacturer_id'));
|
||||
}
|
||||
|
||||
$request->has('order_number') ? $assets = $assets->where('order_number', '=', e($request->get('order_number'))) : '';
|
||||
|
||||
$offset = request('offset', 0);
|
||||
|
|
|
@ -843,6 +843,22 @@ class Asset extends Depreciable
|
|||
->join('categories', 'models.category_id', '=', 'categories.id')->where('models.category_id','=',$category_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Query builder scope to return results of a manufacturer
|
||||
*
|
||||
* @param \Illuminate\Database\Query\Builder $query Query builder instance
|
||||
* @param text $order Order
|
||||
*
|
||||
* @return \Illuminate\Database\Query\Builder Modified query builder
|
||||
*/
|
||||
public function scopeByManufacturer($query, $manufacturer_id)
|
||||
{
|
||||
return $query->join('models', 'assets.model_id', '=', 'models.id')
|
||||
->join('manufacturers', 'models.manufacturer_id', '=', 'manufacturers.id')->where('models.manufacturer_id','=',$manufacturer_id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Query builder scope to order on category
|
||||
*
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
name="category_assets"
|
||||
class="snipe-table"
|
||||
id="table"
|
||||
data-url="{{ ($category->category_type=='asset') ? route('api.assets.index',['category_id'=> $category->id]) : route('api'.$category->category_type.'index', ['category_id'=> $category->id]) }}
|
||||
data-url="{{ ($category->category_type=='asset') ? route('api.assets.index',['category_id'=> $category->id]) : route('api.'.$category->category_type.'s.index', ['category_id'=> $category->id]) }}
|
||||
data-cookie="true"
|
||||
data-click-to-select="true"
|
||||
data-cookie-id-table="categoryAssetsTable">
|
||||
|
|
|
@ -31,7 +31,8 @@
|
|||
<thead>
|
||||
<tr>
|
||||
<th data-sortable="true" data-field="id" data-visible="false">{{ trans('general.id') }}</th>
|
||||
<th data-sortable="true" data-field="name">{{ trans('admin/manufacturers/table.name') }}</th>
|
||||
<th data-sortable="true" data-field="name" data-formatter="manufacturersLinkFormatter">
|
||||
{{ trans('admin/manufacturers/table.name') }}</th>
|
||||
<th data-switchable="true" data-searchable="false" data-sortable="false" data-field="assets_count">{{ trans('general.assets') }}</th>
|
||||
<th data-switchable="true" data-searchable="false" data-sortable="false" data-field="licenses_count">{{ trans('general.licenses') }}</th>
|
||||
<th data-switchable="true" data-searchable="false" data-sortable="false" data-field="accessories_count">{{ trans('general.accessories') }}</th>
|
||||
|
|
|
@ -48,22 +48,22 @@
|
|||
name="manufacturer_assets"
|
||||
class="table table-striped bootstrap-table snipe-table"
|
||||
id="assets-table"
|
||||
data-url="{{ route('api.manufacturers.show', ['manufacturerId' => $manufacturer->id, 'itemtype' => 'assets']) }}"
|
||||
data-url="{{ route('api.assets.index', ['manufacturer_id' => $manufacturer->id, 'itemtype' => 'assets']) }}"
|
||||
data-cookie="true"
|
||||
data-click-to-select="true"
|
||||
data-cookie-id-table="maufacturerAssetsTable-{{config('version.hash_version') }}"
|
||||
>
|
||||
data-cookie-id-table="maufacturerAssetsTable-{{config('version.hash_version') }}">
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-searchable="false" data-sortable="false" data-field="company" data-visible="false">
|
||||
<th data-searchable="false" data-sortable="false" data-field="id" data-visible="false">{{ trans('general.id') }}</th>
|
||||
<th data-searchable="false" data-sortable="false" data-field="company" data-visible="false" data-formatter="companiesLinkObjFormatter">
|
||||
{{ trans('admin/companies/table.title') }}
|
||||
</th>
|
||||
<th data-searchable="false" data-sortable="false" data-field="id" data-visible="false">{{ trans('general.id') }}</th>
|
||||
<th data-searchable="false" data-sortable="false" data-field="name">{{ trans('general.name') }}</th>
|
||||
<th data-searchable="false" data-sortable="false" data-field="model">{{ trans('admin/hardware/form.model') }}</th>
|
||||
<th data-searchable="false" data-sortable="false" data-field="asset_tag">{{ trans('general.asset_tag') }}</th>
|
||||
<th data-searchable="false" data-sortable="false" data-field="serial">{{ trans('admin/hardware/form.serial') }}</th>
|
||||
<th data-searchable="false" data-sortable="false" data-field="assigned_to">{{ trans('general.user') }}</th>
|
||||
<th data-searchable="false" data-sortable="false" data-field="name" data-formatter="hardwareLinkFormatter">{{ trans('general.name') }}</th>
|
||||
<th data-searchable="false" data-sortable="false" data-field="image" data-visible="false" data-formatter="imageFormatter">{{ trans('admin/hardware/table.image') }}</th>
|
||||
<th data-searchable="false" data-sortable="false" data-field="model" data-formatter="modelsLinkObjFormatter">{{ trans('admin/hardware/form.model') }}</th>
|
||||
<th data-searchable="false" data-sortable="false" data-field="asset_tag" data-formatter="hardwareLinkFormatter">{{ trans('general.asset_tag') }}</th>
|
||||
<th data-searchable="false" data-sortable="false" data-field="serial" data-formatter="hardwareLinkFormatter">{{ trans('admin/hardware/form.serial') }}</th>
|
||||
<th data-searchable="false" data-sortable="false" data-field="assigned_to" data-formatter="usersLinkFormatter">{{ trans('general.user') }}</th>
|
||||
<th data-searchable="false" data-sortable="false" data-field="change" data-switchable="false">{{ trans('admin/hardware/table.change') }}</th>
|
||||
<th data-searchable="false" data-sortable="false" data-field="actions" data-switchable="false">{{ trans('table.actions') }}</th>
|
||||
</tr>
|
||||
|
|
Loading…
Reference in a new issue