diff --git a/app/Http/Controllers/LicensesController.php b/app/Http/Controllers/LicensesController.php index 89ea0ed85a..6492ba4662 100755 --- a/app/Http/Controllers/LicensesController.php +++ b/app/Http/Controllers/LicensesController.php @@ -172,7 +172,7 @@ class LicensesController extends Controller // Redirect to the new license page - return redirect()->to("admin/licenses")->with('success', trans('admin/licenses/message.create.success')); + return redirect()->route("licenses.index")->with('success', trans('admin/licenses/message.create.success')); } return redirect()->back()->withInput()->withErrors($license->getErrors()); @@ -551,9 +551,9 @@ class LicensesController extends Controller // Update the asset data if (e(Input::get('assigned_to')) == '') { - $slack_msg = 'License <'.\URL::to('/').'/admin/licenses/'.$license->id.'/view'.'|'.$license->name.'> checked out to <'.\URL::to('/').'/hardware/'.$asset->id.'/view|'.$asset->showAssetName().'> by <'.\URL::to('/').'/admin/users/'.$user->id.'/view'.'|'.$user->fullName().'>.'; + $slack_msg = 'License <'.\URL::to('/').'/licenses/'.$license->id.'|'.$license->name.'> checked out to <'.\URL::to('/').'/hardware/'.$asset->id.'/view|'.$asset->showAssetName().'> by <'.\URL::to('/').'/users/'.$user->id.'/view'.'|'.$user->fullName().'>.'; } else { - $slack_msg = 'License <'.\URL::to('/').'/admin/licenses/'.$license->id.'/view'.'|'.$license->name.'> checked out to <'.\URL::to('/').'/admin/users/'.$user->id.'/view|'.$is_assigned_to->fullName().'> by <'.\URL::to('/').'/admin/users/'.$user->id.'/view'.'|'.$user->fullName().'>.'; + $slack_msg = 'License <'.\URL::to('/').'/licenses/'.$license->id.'|'.$license->name.'> checked out to <'.\URL::to('/').'/users/'.$user->id.'/view|'.$is_assigned_to->fullName().'> by <'.\URL::to('/').'/users/'.$user->id.'/view'.'|'.$user->fullName().'>.'; } @@ -594,7 +594,7 @@ class LicensesController extends Controller } // Redirect to the new asset page - return redirect()->to("admin/licenses")->with('success', trans('admin/licenses/message.checkout.success')); + return redirect()->route("licenses.index")->with('success', trans('admin/licenses/message.checkout.success')); } // Redirect to the asset management page with error @@ -730,7 +730,7 @@ class LicensesController extends Controller } // Redirect to the license page with error - return redirect()->to("admin/licenses")->with('error', trans('admin/licenses/message.checkin.error')); + return redirect()->route("licenses.index")->with('error', trans('admin/licenses/message.checkin.error')); } /** @@ -741,7 +741,7 @@ class LicensesController extends Controller * @param int $licenseId * @return View */ - public function getView($licenseId = null) + public function show($licenseId = null) { $license = License::find($licenseId); @@ -1004,8 +1004,8 @@ class LicensesController extends Controller $rows[] = array( 'id' => $license->id, - 'name' => (string) link_to('/admin/licenses/'.$license->id.'/view', $license->name), - 'serial' => (string) link_to('/admin/licenses/'.$license->id.'/view', mb_strimwidth($license->serial, 0, 50, "...")), + 'name' => (string) link_to('/licenses/'.$license->id, $license->name), + 'serial' => (string) link_to('/licenses/'.$license->id, mb_strimwidth($license->serial, 0, 50, "...")), 'totalSeats' => $license->licenseSeatsCount, 'remaining' => $license->remaincount(), 'license_name' => e($license->license_name), diff --git a/resources/views/layouts/default.blade.php b/resources/views/layouts/default.blade.php index 5fea98dce3..402e972bc4 100644 --- a/resources/views/layouts/default.blade.php +++ b/resources/views/layouts/default.blade.php @@ -195,7 +195,7 @@ @endcan @can('licenses.create')
  • - + @lang('general.license')
  • @@ -459,7 +459,7 @@ @endcan @can('licenses.view') - + @lang('general.licenses') diff --git a/resources/views/licenses/edit.blade.php b/resources/views/licenses/edit.blade.php index 428c142349..49b5a420f5 100755 --- a/resources/views/licenses/edit.blade.php +++ b/resources/views/licenses/edit.blade.php @@ -2,7 +2,8 @@ 'createText' => trans('admin/licenses/form.create') , 'updateText' => trans('admin/licenses/form.update'), 'helpTitle' => trans('admin/licenses/general.about_licenses_title'), - 'helpText' => trans('admin/licenses/general.about_licenses_text') + 'helpText' => trans('admin/licenses/general.about_licenses_text'), + 'formAction' => ($item) ? route('licenses.update', ['license' => $item->id]) : route('license.store'), ]) {{-- Page content --}} diff --git a/resources/views/licenses/index.blade.php b/resources/views/licenses/index.blade.php index c0f8d82bab..bf8b965f33 100755 --- a/resources/views/licenses/index.blade.php +++ b/resources/views/licenses/index.blade.php @@ -9,7 +9,7 @@ @section('header_right') @can('licenses.create') - + {{ trans('general.create') }} @endcan @@ -27,7 +27,7 @@ @if ($licensedto->asset_id) @can('assets.view') - + {{ $licensedto->asset->name }} {{ $licensedto->asset->asset_tag }} @else @@ -384,7 +384,7 @@ {{ $log->userlog->fullName() }} @elseif ($log->target_type == 'App\Models\Asset') - + {{ $log->userlog->showAssetName() }} @endif diff --git a/routes/web/licenses.php b/routes/web/licenses.php index f20571724d..dd3424e0a5 100644 --- a/routes/web/licenses.php +++ b/routes/web/licenses.php @@ -4,59 +4,55 @@ # Licenses Route::group([ 'prefix' => 'licenses', 'middleware'=>'authorize:licenses.view' ], function () { -Route::get('create', [ 'as' => 'create/licenses', 'middleware' => 'authorize:licenses.create','uses' => 'LicensesController@getCreate' ]); -Route::post('create', [ 'as' => 'create/licenses', 'middleware' => 'authorize:licenses.create','uses' => 'LicensesController@postCreate' ]); -Route::get('{licenseId}/edit', [ 'as' => 'update/license', 'middleware' => 'authorize:licenses.edit', 'uses' => 'LicensesController@getEdit' ]); -Route::post('{licenseId}/edit', [ 'as' => 'update/license', 'middleware' => 'authorize:licenses.edit', 'uses' => 'LicensesController@postEdit' ]); -Route::get('{licenseId}/clone', [ 'as' => 'clone/license', 'middleware' => 'authorize:licenses.create', 'uses' => 'LicensesController@getClone' ]); -Route::post('{licenseId}/clone', [ 'as' => 'clone/license', 'middleware' => 'authorize:licenses.create', 'uses' => 'LicensesController@postCreate' ]); -Route::get('{licenseId}/delete', [ 'as' => 'delete/license', 'middleware' => 'authorize:licenses.delete', 'uses' => 'LicensesController@getDelete' ]); -Route::get('{licenseId}/freecheckout', [ -'as' => 'freecheckout/license', -'middleware' => 'authorize:licenses.checkout', -'uses' => 'LicensesController@getFreeLicense' -]); -Route::get( -'{licenseId}/checkout', -[ 'as' => 'checkout/license', 'middleware' => 'authorize:licenses.checkout','uses' => 'LicensesController@getCheckout' ] -); -Route::post( -'{licenseId}/checkout', -[ 'as' => 'checkout/license', 'middleware' => 'authorize:licenses.checkout','uses' => 'LicensesController@postCheckout' ] -); -Route::get('{licenseId}/checkin/{backto?}', [ -'as' => 'checkin/license', -'middleware' => 'authorize:licenses.checkin', -'uses' => 'LicensesController@getCheckin' -]); + Route::get('{licenseId}/clone', [ 'as' => 'clone/license', 'middleware' => 'authorize:licenses.create', 'uses' => 'LicensesController@getClone' ]); + Route::post('{licenseId}/clone', [ 'as' => 'clone/license', 'middleware' => 'authorize:licenses.create', 'uses' => 'LicensesController@postCreate' ]); -Route::post('{licenseId}/checkin/{backto?}', [ -'as' => 'checkin/license', -'middleware' => 'authorize:licenses.checkin', -'uses' => 'LicensesController@postCheckin' -]); + Route::get('{licenseId}/freecheckout', [ + 'as' => 'freecheckout/license', + 'middleware' => 'authorize:licenses.checkout', + 'uses' => 'LicensesController@getFreeLicense' + ]); + Route::get( + '{licenseId}/checkout', + [ 'as' => 'checkout/license', 'middleware' => 'authorize:licenses.checkout','uses' => 'LicensesController@getCheckout' ] + ); + Route::post( + '{licenseId}/checkout', + [ 'as' => 'checkout/license', 'middleware' => 'authorize:licenses.checkout','uses' => 'LicensesController@postCheckout' ] + ); + Route::get('{licenseId}/checkin/{backto?}', [ + 'as' => 'checkin/license', + 'middleware' => 'authorize:licenses.checkin', + 'uses' => 'LicensesController@getCheckin' + ]); -Route::get('{licenseId}/view', [ -'as' => 'view/license', -'middleware' => 'authorize:licenses.view', -'uses' => 'LicensesController@getView' -]); + Route::post('{licenseId}/checkin/{backto?}', [ + 'as' => 'checkin/license', + 'middleware' => 'authorize:licenses.checkin', + 'uses' => 'LicensesController@postCheckin' + ]); -Route::post( -'{licenseId}/upload', -[ 'as' => 'upload/license', 'middleware' => 'authorize:licenses.edit','uses' => 'LicensesController@postUpload' ] -); -Route::get( -'{licenseId}/deletefile/{fileId}', -[ 'as' => 'delete/licensefile', 'middleware' => 'authorize:licenses.edit', 'uses' => 'LicensesController@getDeleteFile' ] -); -Route::get( -'{licenseId}/showfile/{fileId}', -[ 'as' => 'show/licensefile', 'middleware' => 'authorize:licenses.view','uses' => 'LicensesController@displayFile' ] -); -Route::get('/', [ 'as' => 'licenses', 'middleware' => 'authorize:licenses.view','uses' => 'LicensesController@getIndex' ]); + #legacy + Route::get('{licenseId}/view', [ + 'as' => 'view/license', + 'middleware' => 'authorize:licenses.view', + 'uses' => 'LicensesController@getView' + ]); + + Route::post( + '{licenseId}/upload', + [ 'as' => 'upload/license', 'middleware' => 'authorize:licenses.edit','uses' => 'LicensesController@postUpload' ] + ); + Route::get( + '{licenseId}/deletefile/{fileId}', + [ 'as' => 'delete/licensefile', 'middleware' => 'authorize:licenses.edit', 'uses' => 'LicensesController@getDeleteFile' ] + ); + Route::get( + '{licenseId}/showfile/{fileId}', + [ 'as' => 'show/licensefile', 'middleware' => 'authorize:licenses.view','uses' => 'LicensesController@displayFile' ] + ); }); Route::resource('licenses', 'LicensesController', [ - 'license' => ['license' => 'license_id'] + 'parameters' => ['license' => 'license_id'] ]);