A free open source IT asset/license management system
Fixed #5842 - added components to location detail view
sniped9fa2f0e91d4
diff --git a/app/Http/Controllers/Api/ComponentsController.php b/app/Http/Controllers/Api/ComponentsController.phpindex 00b4cd9e5a..987d30da2e 100644--- a/app/Http/Controllers/Api/ComponentsController.php+++ b/app/Http/Controllers/Api/ComponentsController.php@@ -39,6 +39,10 @@ class ComponentsController extends Controller$components->where('category_id','=',$request->input('category_id'));}+ if ($request->has('location_id')) {+ $components->where('location_id','=',$request->input('location_id'));+ }+$offset = request('offset', 0);$limit = request('limit', 50);diff --git a/resources/views/locations/view.blade.php b/resources/views/locations/view.blade.phpindex 9e3975a61a..932765dfc1 100644--- a/resources/views/locations/view.blade.php+++ b/resources/views/locations/view.blade.php@@ -86,6 +86,41 @@</div><!-- /.box-body --></div> <!--/.box-->++ <div class="box box-default">+ <div class="box-header with-border">+ <div class="box-heading">+ <h3 class="box-title">{{ trans('general.components') }}</h3>+ </div>+ </div>+ <div class="box-body">+ <div class="table table-responsive">++ <table+ data-columns="{{ \App\Presenters\ComponentPresenter::dataTableLayout() }}"+ data-cookie-id-table="componentsTable"+ data-pagination="true"+ data-id-table="componentsTable"+ data-search="true"+ data-side-pagination="server"+ data-show-columns="true"+ data-show-export="true"+ data-show-refresh="true"+ data-sort-order="asc"+ id="componentsTable"+ class="table table-striped snipe-table"+ data-url="{{route('api.components.index', ['location_id' => $location->id])}}"+ data-export-options='{+ "fileName": "export-locations-{{ str_slug($location->name) }}-components-{{ date('Y-m-d') }}",+ "ignoreColumn": ["actions","image","change","checkbox","checkincheckout","icon"]+ }'>++ </table>+ </div><!-- /.table-responsive -->+ </div><!-- /.box-body -->+ </div> <!--/.box-->++</div><!--/.col-md-9--><div class="col-md-3">