diff --git a/Dockerfile b/Dockerfile index d9e1ca3433..3e55fc584f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:wily +FROM ubuntu:trusty MAINTAINER Brady Wetherington RUN apt-get update && apt-get install -y \ diff --git a/app/controllers/admin/CategoriesController.php b/app/controllers/admin/CategoriesController.php index 788c80ddc2..d9010fbc33 100755 --- a/app/controllers/admin/CategoriesController.php +++ b/app/controllers/admin/CategoriesController.php @@ -267,7 +267,7 @@ class CategoriesController extends AdminController return $data; } - public function getDataView($categoryID) { + public function getDataViewAssets($categoryID) { $category = Category::with('assets.company')->find($categoryID); $category_assets = $category->assets; @@ -335,4 +335,115 @@ class CategoriesController extends AdminController } + + public function getDataViewAccessories($categoryID) { + + $category = Category::with('accessories.company')->find($categoryID); + $category_assets = $category->accessories; + + if (Input::has('search')) { + $category_assets = $category_assets->TextSearch(e(Input::get('search'))); + } + + if (Input::has('offset')) { + $offset = e(Input::get('offset')); + } else { + $offset = 0; + } + + if (Input::has('limit')) { + $limit = e(Input::get('limit')); + } else { + $limit = 50; + } + + $order = Input::get('order') === 'asc' ? 'asc' : 'desc'; + + $allowed_columns = ['id','name','serial','asset_tag']; + $sort = in_array(Input::get('sort'), $allowed_columns) ? Input::get('sort') : 'created_at'; + $count = $category_assets->count(); + + $rows = array(); + + foreach ($category_assets as $asset) { + + $actions = ''; + $inout=''; + + if ($asset->deleted_at=='') { + $actions = '
'; + } elseif ($asset->deleted_at!='') { + $actions = ''; + } + + + + $rows[] = array( + 'id' => $asset->id, + 'name' => link_to_route('view/accessory', $asset->name, [$asset->id]), + 'actions' => $actions, + 'companyName' => Company::getName($asset), + ); + } + + $data = array('total' => $count, 'rows' => $rows); + return $data; + } + + + public function getDataViewConsumables($categoryID) { + + $category = Category::with('accessories.company')->find($categoryID); + $category_assets = $category->consumables; + + if (Input::has('search')) { + $category_assets = $category_assets->TextSearch(e(Input::get('search'))); + } + + if (Input::has('offset')) { + $offset = e(Input::get('offset')); + } else { + $offset = 0; + } + + if (Input::has('limit')) { + $limit = e(Input::get('limit')); + } else { + $limit = 50; + } + + $order = Input::get('order') === 'asc' ? 'asc' : 'desc'; + + $allowed_columns = ['id','name','serial','asset_tag']; + $sort = in_array(Input::get('sort'), $allowed_columns) ? Input::get('sort') : 'created_at'; + $count = $category_assets->count(); + + $rows = array(); + + foreach ($category_assets as $asset) { + + $actions = ''; + $inout=''; + + if ($asset->deleted_at=='') { + $actions = '
'; + } elseif ($asset->deleted_at!='') { + $actions = ''; + } + + + + $rows[] = array( + 'id' => $asset->id, + 'name' => link_to_route('view/consumable', $asset->name, [$asset->id]), + 'actions' => $actions, + 'companyName' => Company::getName($asset), + ); + } + + $data = array('total' => $count, 'rows' => $rows); + return $data; + } + + } diff --git a/app/routes.php b/app/routes.php index 4f39ccec58..6ce5085310 100755 --- a/app/routes.php +++ b/app/routes.php @@ -124,6 +124,14 @@ Route::get( 'list', [ 'as' => 'api.categories.list', 'uses' => 'CategoriesController@getDatatable' ] ); Route::get( '{categoryID}/view', [ 'as' => 'api.categories.view', 'uses' => 'CategoriesController@getDataView' ] ); + Route::get( '{categoryID}/asset/view', + [ 'as' => 'api.categories.asset.view', 'uses' => 'CategoriesController@getDataViewAssets' ] ); + Route::get( '{categoryID}/accessory/view', + [ 'as' => 'api.categories.accessory.view', 'uses' => 'CategoriesController@getDataViewAccessories' ] ); + Route::get( '{categoryID}/consumable/view', + [ 'as' => 'api.categories.consumable.view', 'uses' => 'CategoriesController@getDataViewConsumables' ] ); + Route::get( '{categoryID}/component/view', + [ 'as' => 'api.categories.component.view', 'uses' => 'CategoriesController@getDataViewComponent' ] ); } ); /*-- Suppliers API (mostly for creating new ones in-line while creating an asset) --*/ diff --git a/app/views/backend/categories/view.blade.php b/app/views/backend/categories/view.blade.php index f196ea0c1a..291efe5fda 100644 --- a/app/views/backend/categories/view.blade.php +++ b/app/views/backend/categories/view.blade.php @@ -36,7 +36,7 @@ @@ -47,11 +47,14 @@ + @if ($category->category_type=='asset') + @endif + @@ -71,7 +74,7 @@ iconsPrefix: 'fa', showRefresh: true, //search: true, - pageSize: {{{ Setting::getSettings()->per_page }}}, + pageSize: {{ Setting::getSettings()->per_page }}, pagination: true, sidePagination: 'server', sortable: true, diff --git a/app/views/backend/hardware/view.blade.php b/app/views/backend/hardware/view.blade.php index 0350c7bf5c..2ef5a059c3 100755 --- a/app/views/backend/hardware/view.blade.php +++ b/app/views/backend/hardware/view.blade.php @@ -166,7 +166,7 @@ @if ($asset->model->fieldset)
-
FIELDSET: +
FIELDSET: {{{ $asset->model->fieldset->name }}}
@foreach($asset->model->fieldset->fields as $field)
{{{ $field->name }}}: @@ -379,9 +379,10 @@
diff --git a/public/uploads/.gitkeep b/public/uploads/.gitkeep new file mode 100644 index 0000000000..e69de29bb2
@lang('general.id') @lang('general.name')@lang('admin/hardware/form.model') @lang('general.asset_tag') @lang('admin/hardware/form.serial') @lang('general.user') @lang('admin/hardware/table.change')@lang('table.actions')
{{ $asset->created_at }} - @if (isset($asset->adminuser->id)) {{{ $asset->adminuser->fullName() }}} + @if ($asset->adminuser) + {{{ $asset->adminuser->fullName() }}} @else - @lang('general.unknown_admin') + @lang('general.unknown_admin') @endif @lang('general.created_asset')