This commit is contained in:
snipe 2016-10-12 12:48:37 -07:00
parent fe5e813970
commit 8f4e016c01
4 changed files with 90 additions and 34 deletions

View file

@ -354,19 +354,19 @@ Route::group(
]);
# Asset Model Management
Route::group([ 'prefix' => 'models', 'middleware' => 'auth' ], function () {
Route::group([ 'prefix' => 'models', 'middleware' => ['auth'] ], function () {
Route::get('/', [ 'as' => 'models', 'uses' => 'AssetModelsController@getIndex' ]);
Route::get('create', [ 'as' => 'create/model', 'uses' => 'AssetModelsController@getCreate' ]);
Route::get('create', [ 'as' => 'create/model', 'uses' => 'AssetModelsController@getCreate', 'middleware' => ['authorize:superuser'] ]);
Route::post('create', 'AssetModelsController@postCreate');
Route::get('{modelId}/edit', [ 'as' => 'update/model', 'uses' => 'AssetModelsController@getEdit' ]);
Route::post('{modelId}/edit', 'AssetModelsController@postEdit');
Route::get('{modelId}/edit', [ 'as' => 'update/model', 'uses' => 'AssetModelsController@getEdit' , 'middleware' => ['authorize:superuser']]);
Route::post('{modelId}/edit', [ 'uses' => 'AssetModelsController@postEdit', 'middleware' => ['authorize:superuser']]);
Route::get('{modelId}/clone', [ 'as' => 'clone/model', 'uses' => 'AssetModelsController@getClone' ]);
Route::post('{modelId}/clone', 'AssetModelsController@postCreate');
Route::get('{modelId}/delete', [ 'as' => 'delete/model', 'uses' => 'AssetModelsController@getDelete' ]);
Route::get('{modelId}/delete', [ 'as' => 'delete/model', 'uses' => 'AssetModelsController@getDelete', 'middleware' => ['authorize:superuser'] ]);
Route::get('{modelId}/view', [ 'as' => 'view/model', 'uses' => 'AssetModelsController@getView' ]);
Route::get('{modelID}/restore', [ 'as' => 'restore/model', 'uses' => 'AssetModelsController@getRestore' ]);
Route::get('{modelID}/restore', [ 'as' => 'restore/model', 'uses' => 'AssetModelsController@getRestore', 'middleware' => ['authorize:superuser'] ]);
Route::get('{modelId}/custom_fields', ['as' => 'custom_fields/model','uses' => 'AssetModelsController@getCustomFields']);
Route::get('/', [ 'as' => 'models', 'uses' => 'AssetModelsController@getIndex' ,'middleware' => ['authorize:superuser'] ]);
});
Route::get('/', [
@ -730,7 +730,7 @@ Route::group([ 'prefix' => 'admin','middleware' => ['web','auth']], function ()
[ 'as' => 'update/location', 'uses' => 'LocationsController@getEdit' ]
);
Route::post('{locationId}/edit', 'LocationsController@postEdit');
Route::get('{locationId}/view', 'LocationsController@getView');
Route::get('{locationId}/view', [ 'as' => 'view/location', 'uses' => 'LocationsController@getView' ]);
Route::get(
'{locationId}/delete',
[ 'as' => 'delete/location', 'uses' => 'LocationsController@getDelete' ]

View file

@ -94,28 +94,40 @@
</tr>
@endif
@if ($asset->model->manufacturer)
<tr>
<td>{{ trans('admin/hardware/form.manufacturer') }}</td>
<td>
<a href="{{ route('view/manufacturer', $asset->model->manufacturer->id) }}">
{{ $asset->model->manufacturer->name }}
</a>
</td>
</tr>
<tr>
<td>{{ trans('admin/hardware/form.model') }}</td>
<td>
<a href="{{ route('view/model', $asset->model->id) }}">
{{ $asset->model->name }}
</a>
</td>
</tr>
<tr>
<td>{{ trans('admin/models/table.modelnumber') }}</td>
<td>
{{ $asset->model->modelno }}
</td>
</tr>
<tr>
<td>{{ trans('admin/hardware/form.manufacturer') }}</td>
<td>
@can('superuser')
<a href="{{ route('view/manufacturer', $asset->model->manufacturer->id) }}">
{{ $asset->model->manufacturer->name }}
</a>
@else
{{ $asset->model->manufacturer->name }}
@endcan
</td>
</tr>
<tr>
<td>
{{ trans('admin/hardware/form.model') }}</td>
<td>
@can('superuser')
<a href="{{ route('view/model', $asset->model->id) }}">
{{ $asset->model->name }}
</a>
@else
{{ $asset->model->name }}
@endcan
</td>
</tr>
<tr>
<td>{{ trans('admin/models/table.modelnumber') }}</td>
<td>
{{ $asset->model->modelno }}
</td>
</tr>
@endif
@if ($asset->model->fieldset)
@ -132,7 +144,7 @@
@if ($field->isFieldDecryptable($asset->{$field->db_column_name()} ))
@can('admin')
@can('superuser')
@if (($field->format=='URL') && ($asset->{$field->db_column_name()}!=''))
<a href="{{ \App\Helpers\Helper::gracefulDecrypt($field, $asset->{$field->db_column_name()}) }}" target="_new">{{ \App\Helpers\Helper::gracefulDecrypt($field, $asset->{$field->db_column_name()}) }}</a>
@else
@ -188,9 +200,13 @@
<tr>
<td>{{ trans('admin/hardware/form.supplier') }}</td>
<td>
<a href="{{ route('view/supplier', $asset->supplier_id) }}">
{{ $asset->supplier->name }}
</a>
@can ('superuser')
<a href="{{ route('view/supplier', $asset->supplier_id) }}">
{{ $asset->supplier->name }}
</a>
@else
{{ $asset->supplier->name }}
@endcan
</td>
</tr>
@endif
@ -260,6 +276,8 @@
</tr>
@endif
@if ($asset->expected_checkin!='')
<tr>
<td>{{ trans('admin/hardware/form.expected_checkin') }}</td>
@ -280,6 +298,39 @@
</td>
</tr>
@endif
@if ($asset->assetloc)
<tr>
<td>{{ trans('general.location') }}</td>
<td>
@can('superuser')
<a href="{{ route('view/location', $asset->assetloc->id) }}">
{{ $asset->assetloc->name }}
</a>
@else
{{ $asset->assetloc->name }}
@endcan
</td>
</tr>
@endif
@if ($asset->assetloc)
<tr>
<td>{{ trans('admin/hardware/form.default_location') }}</td>
<td>
@can('superuser')
<a href="{{ route('view/location', $asset->defaultLoc->id) }}">
{{ $asset->defaultLoc->name }}
</a>
@else
{{ $asset->defaultLoc->name }}
@endcan
</td>
</tr>
@endif
</tbody>
</table>
</div> <!-- /table-responsive -->

View file

@ -441,8 +441,11 @@
<a href="{{ route('hardware/bulkcheckout') }}">
{{ trans('general.bulk_checkout') }}</a>
</li>
@can('superuser')
<li{!! (Request::is('hardware/models*') ? ' class="active"' : '') !!}><a href="{{ URL::to('hardware/models') }}">@lang('general.asset_models')</a></li>
<li><a href="{{ URL::to('admin/settings/categories') }}" {!! (Request::is('admin/settings/categories*') ? ' class="active"' : '') !!} >@lang('general.categories')</a></li>
@endcan
<li{!! (Request::query('Deleted') ? ' class="active"' : '') !!}><a href="{{ URL::to('hardware?status=Deleted') }}">@lang('general.deleted')</a></li>
<li><a href="{{ URL::to('admin/asset_maintenances') }}" >@lang('general.asset_maintenances') </a></li>
<li><a href="{{ URL::to('hardware/import') }}">@lang('general.import') </a></li>

View file

@ -8,6 +8,7 @@
@stop
@section('header_right')
@can('superuser')
<div class="btn-group pull-right">
<button class="btn btn-default dropdown-toggle" data-toggle="dropdown">{{ trans('button.actions') }}
<span class="caret"></span>
@ -22,6 +23,7 @@
@endif
</ul>
</div>
@endcan
@stop
{{-- Page content --}}