mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-12 06:17:28 -08:00
Updated license routes
This commit is contained in:
parent
456e4a633e
commit
0c5d3d1c74
|
@ -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),
|
||||
|
|
|
@ -195,7 +195,7 @@
|
|||
@endcan
|
||||
@can('licenses.create')
|
||||
<li {!! (Request::is('licenses/create') ? 'class="active"' : '') !!}>
|
||||
<a href="{{ route('create/licenses') }}">
|
||||
<a href="{{ route('licenses.create') }}">
|
||||
<i class="fa fa-floppy-o fa-fw"></i>
|
||||
@lang('general.license')</a>
|
||||
</li>
|
||||
|
@ -459,7 +459,7 @@
|
|||
@endcan
|
||||
@can('licenses.view')
|
||||
<li{!! (Request::is('licenses*') ? ' class="active"' : '') !!}>
|
||||
<a href="{{ route('licenses.create') }}">
|
||||
<a href="{{ route('licenses.index') }}">
|
||||
<i class="fa fa-floppy-o"></i>
|
||||
<span>@lang('general.licenses')</span>
|
||||
</a>
|
||||
|
|
|
@ -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 --}}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
@section('header_right')
|
||||
@can('licenses.create')
|
||||
<a href="{{ route('create/licenses') }}" class="btn btn-primary pull-right">
|
||||
<a href="{{ route('licenses.create') }}" class="btn btn-primary pull-right">
|
||||
{{ trans('general.create') }}
|
||||
</a>
|
||||
@endcan
|
||||
|
@ -27,7 +27,7 @@
|
|||
<table
|
||||
name="licenses"
|
||||
id="table"
|
||||
data-url="{{route('api.licenses.list') }}"
|
||||
data-url="{{ route('api.licenses.list') }}"
|
||||
class="table table-striped snipe-table"
|
||||
data-cookie="true"
|
||||
data-click-to-select="true"
|
||||
|
|
|
@ -89,7 +89,7 @@
|
|||
<td>
|
||||
@if ($licensedto->asset_id)
|
||||
@can('assets.view')
|
||||
<a href="{{ route('view/hardware', $licensedto->asset_id) }}">
|
||||
<a href="{{ route('hardware.show', $licensedto->asset_id) }}">
|
||||
{{ $licensedto->asset->name }} {{ $licensedto->asset->asset_tag }}
|
||||
</a>
|
||||
@else
|
||||
|
@ -384,7 +384,7 @@
|
|||
{{ $log->userlog->fullName() }}
|
||||
</a>
|
||||
@elseif ($log->target_type == 'App\Models\Asset')
|
||||
<a href="{{ route('view/hardware', $log->target_id) }}">
|
||||
<a href="{{ route('hardware.show', $log->target_id) }}">
|
||||
{{ $log->userlog->showAssetName() }}
|
||||
</a>
|
||||
@endif
|
||||
|
|
|
@ -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']
|
||||
]);
|
||||
|
|
Loading…
Reference in a new issue