A free open source IT asset/license management system
Addec clone button back to models, assets, licenses, etc
snipec2e8803d1e01
diff --git a/app/Http/Controllers/AssetsController.php b/app/Http/Controllers/AssetsController.phpindex 0ced1799f0..7ea4d1b1e2 100755--- a/app/Http/Controllers/AssetsController.php+++ b/app/Http/Controllers/AssetsController.php@@ -259,7 +259,7 @@ class AssetsController extends Controller->with('model_list', Helper::modelList())->with('supplier_list', Helper::suppliersList())->with('company_list', Helper::companyList())- ->with('location_list', Helper::locationsList())+ ->with('locations_list', Helper::locationsList())->with('statuslabel_list', Helper::statusLabelList())->with('assigned_to', Helper::usersList())->with('manufacturer', Helper::manufacturerList())@@ -705,9 +705,11 @@ class AssetsController extends Controller->with('statuslabel_types', Helper::statusTypeList())->with('assigned_to', Helper::usersList())->with('item', $asset)- ->with('location_list', Helper::locationsList())+ ->with('locations_list', Helper::locationsList())->with('manufacturer', Helper::manufacturerList())->with('category', Helper::categoryList('asset'))+ ->with('users_list', Helper::usersList())+ ->with('assets_list', Helper::assetsList())->with('company_list', Helper::companyList());}diff --git a/app/Http/Controllers/UsersController.php b/app/Http/Controllers/UsersController.phpindex 9e220edc9b..0045b514d1 100755--- a/app/Http/Controllers/UsersController.php+++ b/app/Http/Controllers/UsersController.php@@ -721,7 +721,7 @@ class UsersController extends Controller$user->id = null;// Get this user groups- $userGroups = $user_to_clone->groups()->lists('name', 'id');+ $userGroups = $user_to_clone->groups()->pluck('name', 'id');// Get all the available permissions$permissions = config('permissions');$clonedPermissions = $user_to_clone->decodePermissions();@@ -733,6 +733,7 @@ class UsersController extends Controller->with('location_list', Helper::locationsList())->with('company_list', Helper::companyList())->with('manager_list', Helper::managerList())+ ->with('department_list', Helper::departmentList())->with('user', $user)->with('groups', Group::pluck('name', 'id'))->with('userGroups', $userGroups)diff --git a/app/Http/Transformers/AssetModelsTransformer.php b/app/Http/Transformers/AssetModelsTransformer.phpindex dfebcf3e08..0992c2bf85 100644--- a/app/Http/Transformers/AssetModelsTransformer.php+++ b/app/Http/Transformers/AssetModelsTransformer.php@@ -36,8 +36,9 @@ class AssetModelsTransformer];$permissions_array['available_actions'] = [- 'update' => Gate::allows('admin') ? true : false,- 'delete' => Gate::allows('admin') ? true : false,+ 'update' => Gate::allows('update', AssetModel::class) ? true : false,+ 'delete' => Gate::allows('delete', AssetModel::class) ? true : false,+ 'clone' => Gate::allows('create', AssetModel::class) ? true : false,];$array += $permissions_array;diff --git a/app/Http/Transformers/AssetsTransformer.php b/app/Http/Transformers/AssetsTransformer.phpindex 1e27ac4832..4077bc406e 100644--- a/app/Http/Transformers/AssetsTransformer.php+++ b/app/Http/Transformers/AssetsTransformer.php@@ -82,6 +82,7 @@ class AssetsTransformer$permissions_array['available_actions'] = ['checkout' => (bool) Gate::allows('checkout', Asset::class),'checkin' => (bool) Gate::allows('checkin', Asset::class),+ 'clone' => Gate::allows('create', Asset::class) ? true : false,'update' => (bool) Gate::allows('update', Asset::class),'delete' => (bool) Gate::allows('delete', Asset::class),];diff --git a/app/Http/Transformers/LicensesTransformer.php b/app/Http/Transformers/LicensesTransformer.phpindex ddebf5707e..c5747bb76e 100644--- a/app/Http/Transformers/LicensesTransformer.php+++ b/app/Http/Transformers/LicensesTransformer.php@@ -48,6 +48,7 @@ class LicensesTransformer$permissions_array['available_actions'] = ['checkout' => Gate::allows('checkout', License::class) ? true : false,'checkin' => Gate::allows('checkin', License::class) ? true : false,+ 'clone' => Gate::allows('create', License::class) ? true : false,'update' => Gate::allows('update', License::class) ? true : false,'delete' => Gate::allows('delete', License::class) ? true : false,];diff --git a/app/Http/Transformers/UsersTransformer.php b/app/Http/Transformers/UsersTransformer.phpindex e93c6f2b69..f33349dbde 100644--- a/app/Http/Transformers/UsersTransformer.php+++ b/app/Http/Transformers/UsersTransformer.php@@ -53,6 +53,7 @@ class UsersTransformer$permissions_array['available_actions'] = ['update' => Gate::allows('update', User::class) ? true : false,'delete' => Gate::allows('delete', User::class) ? true : false,+ 'clone' => Gate::allows('create', User::class) ? true : false,];$array += $permissions_array;diff --git a/resources/views/hardware/edit.blade.php b/resources/views/hardware/edit.blade.phpindex 5f46acff10..0bd6791906 100755--- a/resources/views/hardware/edit.blade.php+++ b/resources/views/hardware/edit.blade.php@@ -124,7 +124,7 @@<div class="form-group {{ $errors->has('rtd_location_id') ? ' has-error' : '' }}"><label for="rtd_location_id" class="col-md-3 control-label">{{ trans('admin/hardware/form.default_location') }}</label><div class="col-md-7 col-sm-11">- {{ Form::select('rtd_location_id', $location_list , Input::old('rtd_location_id', $item->rtd_location_id), array('class'=>'select2', 'style'=>'width:100%','id'=>'rtd_location_select')) }}+ {{ Form::select('rtd_location_id', $locations_list , Input::old('rtd_location_id', $item->rtd_location_id), array('class'=>'select2', 'style'=>'width:100%','id'=>'rtd_location_select')) }}{!! $errors->first('rtd_location_id', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}</div>diff --git a/resources/views/partials/bootstrap-table.blade.php b/resources/views/partials/bootstrap-table.blade.phpindex ea216c56d6..109ec5773b 100644--- a/resources/views/partials/bootstrap-table.blade.php+++ b/resources/views/partials/bootstrap-table.blade.php@@ -142,6 +142,10 @@ $('.snipe-table').bootstrapTable({var actions = '<nobr>';+ if ((row.available_actions) && (row.available_actions.clone === true)) {+ actions += '<a href="{{ url('/') }}/' + destination + '/' + row.id + '/clone" class="btn btn-sm btn-info"><i class="fa fa-copy"></i></a> ';+ }+if ((row.available_actions) && (row.available_actions.update === true)) {actions += '<a href="{{ url('/') }}/' + destination + '/' + row.id + '/edit" class="btn btn-sm btn-warning"><i class="fa fa-pencil"></i></a> ';}