And still more license route updates

This commit is contained in:
snipe 2016-12-15 13:07:34 -08:00
parent bea1a93e9b
commit ad1bf86a08
9 changed files with 24 additions and 34 deletions

View file

@ -46,7 +46,6 @@ class LicensesController extends Controller
*/
public function index()
{
// Show the page
return View::make('licenses/index');
}
@ -848,7 +847,7 @@ class LicensesController extends Controller
$error = trans('admin/licenses/message.does_not_exist', compact('id'));
// Redirect to the licence management page
return redirect()->route('licenses')->with('error', $error);
return redirect()->route('licenses.index')->with('error', $error);
}
}
@ -888,7 +887,7 @@ class LicensesController extends Controller
$error = trans('admin/licenses/message.does_not_exist', compact('id'));
// Redirect to the licence management page
return redirect()->route('licenses')->with('error', $error);
return redirect()->route('licenses.index')->with('error', $error);
}
}
@ -923,7 +922,7 @@ class LicensesController extends Controller
$error = trans('admin/licenses/message.does_not_exist', compact('id'));
// Redirect to the licence management page
return redirect()->route('licenses')->with('error', $error);
return redirect()->route('licenses.index')->with('error', $error);
}
}
@ -975,7 +974,7 @@ class LicensesController extends Controller
$actions = '<span style="white-space: nowrap;">';
if (Gate::allows('licenses.checkout')) {
$actions .= '<a href="' . route('freecheckout/license', $license->id)
$actions .= '<a href="' . route('licenses.freecheckout', $license->id)
. '" class="btn btn-primary btn-sm' . (($license->remaincount() > 0) ? '' : ' disabled') . '" style="margin-right:5px;">' . trans('general.checkout') . '</a> ';
}
@ -1010,7 +1009,7 @@ class LicensesController extends Controller
'notes' => ($license->notes) ? e($license->notes) : '',
'actions' => $actions,
'company' => is_null($license->company) ? '' : e($license->company->name),
'manufacturer' => $license->manufacturer ? (string) link_to('/admin/settings/manufacturers/'.$license->manufacturer_id.'/view', $license->manufacturer->name) : ''
'manufacturer' => $license->manufacturer ? (string) link_to('settings/manufacturers/'.$license->manufacturer_id.'/view', $license->manufacturer->name) : ''
);
}
@ -1034,12 +1033,10 @@ class LicensesController extends Controller
*/
public function getFreeLicense($licenseId)
{
// Check if the asset exists
if (is_null($license = License::find($licenseId))) {
// Redirect to the asset management page with error
return redirect()->route('licenses.index')->with('error', trans('admin/licenses/message.not_found'));
}
$seatId = $license->freeSeat($licenseId);
return redirect()->to('admin/licenses/'.$seatId.'/checkout');
return redirect()->route('licenses.checkout', $seatId);
}
}

View file

@ -360,7 +360,7 @@ class ManufacturersController extends Controller
$actions = '<span style="white-space: nowrap;">';
if (Gate::allows('licenses.checkout')) {
$actions .= '<a href="' . route('freecheckout/license', $license->id)
$actions .= '<a href="' . route('licenses.freecheckout', $license->id)
. '" class="btn btn-primary btn-sm' . (($license->remaincount() > 0) ? '' : ' disabled') . '" style="margin-right:5px;">' . trans('general.checkout') . '</a> ';
}

View file

@ -177,7 +177,7 @@
<tr>
<td><a href="{{ route('view/license', $seat->license->id) }}">{{ $seat->license->name }}</a></td>
<td>{{ $seat->license->serial }}</td>
<td><a href="{{ route('checkin/license', $seat->id) }}" class="btn-flat info">{{ trans('general.checkin') }}</a>
<td><a href="{{ route('licenses.checkin', $seat->id) }}" class="btn-flat info">{{ trans('general.checkin') }}</a>
</td>
</tr>
@endforeach

View file

@ -287,7 +287,7 @@
{{ trans('general.months') }}
)
@endif
</td>
</tr>
@endif
@ -441,7 +441,7 @@
<td><a href="{{ route('view/license', $seat->license->id) }}">{{ $seat->license->name }}</a></td>
<td>{{ $seat->license->serial }}</td>
<td>
<a href="{{ route('checkin/license', $seat->id) }}" class="btn-flat info btn-sm">{{ trans('general.checkin') }}</a>
<a href="{{ route('licenses.checkin', $seat->id) }}" class="btn-flat info btn-sm">{{ trans('general.checkin') }}</a>
</td>
</tr>
@endforeach
@ -489,7 +489,7 @@
{{ trans('general.no_results') }}
</div>
@endif
</div>
</div>
</div> <!-- /.tab-pane components -->
@ -612,7 +612,7 @@
@else
<del>{{ $log->target->fullName() }}</del>
@endif
@elseif($log->target instanceof \App\Models\Asset)
@elseif($log->target instanceof \App\Models\Asset)
@if ($log->target->deleted_at=='')
<a href="{{ route('view/hardware', $log->target_id) }}">
{{ $log->target->showAssetName() }}

View file

@ -21,9 +21,9 @@
<div class="col-md-10 column">
@if ($backto=='user')
<form class="form-horizontal" method="post" action="{{ route('checkin/license', array('licenseeat_id'=> $licenseseat->id, 'backto'=>'user')) }}" autocomplete="off">
<form class="form-horizontal" method="post" action="{{ route('licenses.checkin', array('licenseeat_id'=> $licenseseat->id, 'backto'=>'user')) }}" autocomplete="off">
@else
<form class="form-horizontal" method="post" action="{{ route('checkin/license', $licenseseat->id) }}" autocomplete="off">
<form class="form-horizontal" method="post" action="{{ route('licenses.checkin', $licenseseat->id) }}" autocomplete="off">
@endif
<!-- CSRF Token -->
@ -58,7 +58,7 @@
<div class="form-group">
<label class="col-md-2 control-label"></label>
<div class="col-md-7">
<a class="btn btn-link" href="{{ route('licenses') }}">{{ trans('button.cancel') }}</a>
<a class="btn btn-link" href="{{ route('licenses.index') }}">{{ trans('button.cancel') }}</a>
<button type="submit" class="btn btn-success"><i class="fa fa-check icon-white"></i> {{ trans('general.checkin') }}</button>
</div>
</div>

View file

@ -88,7 +88,7 @@
</div>
</div>
<div class="box-footer">
<a class="btn btn-link" href="{{ route('licenses') }}">{{ trans('button.cancel') }}</a>
<a class="btn btn-link" href="{{ route('licenses.index') }}">{{ trans('button.cancel') }}</a>
<button type="submit" class="btn btn-success pull-right"><i class="fa fa-check icon-white"></i> {{ trans('general.checkout') }}</button>
</div>
</form>

View file

@ -103,14 +103,14 @@
@if (($licensedto->assigned_to) || ($licensedto->asset_id))
@if ($license->reassignable)
<a href="{{ route('checkin/license', $licensedto->id) }}" class="btn btn-primary btn-sm">
<a href="{{ route('licenses.checkin', $licensedto->id) }}" class="btn btn-primary btn-sm">
{{ trans('general.checkin') }}
</a>
@else
<span>Assigned</span>
@endif
@else
<a href="{{ route('checkout/license', $licensedto->id) }}" class="btn btn-info btn-sm">
<a href="{{ route('licenses.checkout', $licensedto->id) }}" class="btn btn-info btn-sm">
{{ trans('general.checkout') }}</a>
@endif
@endcan

View file

@ -229,7 +229,7 @@
<td><a href="{{ route('view/license', $license->id) }}">{{ mb_strimwidth($license->serial, 0, 50, "...") }}</a></td>
<td class="hidden-print">
@can('licenses.edit')
<a href="{{ route('checkin/license', array('licenseseat_id'=> $license->pivot->id, 'backto'=>'user')) }}" class="btn btn-primary btn-sm">Checkin</a>
<a href="{{ route('licenses.checkin', array('licenseseat_id'=> $license->pivot->id, 'backto'=>'user')) }}" class="btn btn-primary btn-sm">Checkin</a>
@endcan
</td>
</tr>

View file

@ -8,37 +8,30 @@ Route::group([ 'prefix' => 'licenses', 'middleware'=>'authorize:licenses.view' ]
Route::post('{licenseId}/clone', [ 'as' => 'clone/license', 'middleware' => 'authorize:licenses.create', 'uses' => 'LicensesController@postCreate' ]);
Route::get('{licenseId}/freecheckout', [
'as' => 'freecheckout/license',
'as' => 'licenses.freecheckout',
'middleware' => 'authorize:licenses.checkout',
'uses' => 'LicensesController@getFreeLicense'
]);
Route::get(
'{licenseId}/checkout',
[ 'as' => 'checkout/license', 'middleware' => 'authorize:licenses.checkout','uses' => 'LicensesController@getCheckout' ]
[ 'as' => 'licenses.checkout', 'middleware' => 'authorize:licenses.checkout','uses' => 'LicensesController@getCheckout' ]
);
Route::post(
'{licenseId}/checkout',
[ 'as' => 'checkout/license', 'middleware' => 'authorize:licenses.checkout','uses' => 'LicensesController@postCheckout' ]
[ 'as' => 'licenses.checkout', 'middleware' => 'authorize:licenses.checkout','uses' => 'LicensesController@postCheckout' ]
);
Route::get('{licenseId}/checkin/{backto?}', [
'as' => 'checkin/license',
'as' => 'licenses.checkin',
'middleware' => 'authorize:licenses.checkin',
'uses' => 'LicensesController@getCheckin'
]);
Route::post('{licenseId}/checkin/{backto?}', [
'as' => 'checkin/license',
'as' => 'licenses.checkin',
'middleware' => 'authorize:licenses.checkin',
'uses' => 'LicensesController@postCheckin'
]);
#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' ]