diff --git a/app/config/version.php b/app/config/version.php index a2e0b717ed94..fa56774236af 100644 --- a/app/config/version.php +++ b/app/config/version.php @@ -1,5 +1,5 @@ 'v2.0-388', - 'hash_version' => 'v2.0-388-g4b2e7b9', + 'app_version' => 'v2.0-391', + 'hash_version' => 'v2.0-391-g7e2b418', ); \ No newline at end of file diff --git a/app/controllers/admin/ManufacturersController.php b/app/controllers/admin/ManufacturersController.php index d677f4494b26..eb405082a82b 100755 --- a/app/controllers/admin/ManufacturersController.php +++ b/app/controllers/admin/ManufacturersController.php @@ -239,4 +239,72 @@ public function getDatatable() } + + public function getDataView($manufacturerID) { + + $manufacturer = Manufacturer::find($manufacturerID); + $manufacturer_assets = $manufacturer->assets; + + if (Input::has('search')) { + $manufacturer_assets = $manufacturer_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 = $manufacturer_assets->count(); + + $rows = array(); + + foreach ($manufacturer_assets as $asset) { + + $actions = ''; + if ($asset->deleted_at=='') { + $actions = '
'; + } elseif ($asset->deleted_at!='') { + $actions = ''; + } + + if ($asset->assetstatus) { + if ($asset->assetstatus->deployable != 0) { + if (($asset->assigned_to !='') && ($asset->assigned_to > 0)) { + $inout = ''.Lang::get('general.checkin').''; + } else { + $inout = ''.Lang::get('general.checkout').''; + } + } + } + + $rows[] = array( + 'id' => $asset->id, + 'name' => link_to('/hardware/'.$asset->id.'/view', $asset->showAssetName()), + 'model' => $asset->model->name, + 'asset_tag' => $asset->asset_tag, + 'serial' => $asset->serial, + 'assigned_to' => ($asset->assigneduser) ? link_to('/admin/users/'.$asset->assigneduser->id.'/view', $asset->assigneduser->fullName()): '', + 'change' => $inout, + 'actions' => $actions, + + + ); + } + + $data = array('total' => $count, 'rows' => $rows); + return $data; + } + + } diff --git a/app/routes.php b/app/routes.php index a927aef8ad3c..b9b87e1cb544 100755 --- a/app/routes.php +++ b/app/routes.php @@ -66,6 +66,7 @@ /*---Manufacturers API---*/ Route::group(array('prefix'=>'manufacturers'), function () { Route::get('list', array('as'=>'api.manufacturers.list', 'uses'=>'ManufacturersController@getDatatable')); + Route::get('{manufacturerID}/view', array('as'=>'api.manufacturers.view', 'uses'=>'ManufacturersController@getDataView')); }); /*---Suppliers API---*/ diff --git a/app/views/backend/manufacturers/view.blade.php b/app/views/backend/manufacturers/view.blade.php index 087a9d4ab1b9..bb143c07ebcb 100644 --- a/app/views/backend/manufacturers/view.blade.php +++ b/app/views/backend/manufacturers/view.blade.php @@ -19,14 +19,13 @@

{{{ $manufacturer->name }}} - @lang('general.manufacturer') + @lang('general.assets')

@@ -36,57 +35,67 @@
- - - @if (count($manufacturer->assets) > 0) - - - - - - - - - - - - @foreach ($manufacturer->assets as $modelassets) - - - - - - - - @endforeach - - - -
@lang('general.name')@lang('general.asset_tag')@lang('general.user')@lang('table.actions')
{{{ $modelassets->name }}}{{{ $modelassets->asset_tag }}} - @if ($modelassets->assigneduser) - - {{{ $modelassets->assigneduser->fullName() }}} - - @endif - - @if ($modelassets->assigned_to != 0) - Checkin - @else - Checkout - @endif -
- - @else -
-
- - @lang('general.no_results') -
-
- @endif - -
- + + + + + + + + + + + + + +
@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')
+ + @section('moar_scripts') + + + + + + + + @stop @stop