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

View file

@ -94,20 +94,31 @@
</tr> </tr>
@endif @endif
@if ($asset->model->manufacturer) @if ($asset->model->manufacturer)
<tr> <tr>
<td>{{ trans('admin/hardware/form.manufacturer') }}</td> <td>{{ trans('admin/hardware/form.manufacturer') }}</td>
<td> <td>
@can('superuser')
<a href="{{ route('view/manufacturer', $asset->model->manufacturer->id) }}"> <a href="{{ route('view/manufacturer', $asset->model->manufacturer->id) }}">
{{ $asset->model->manufacturer->name }} {{ $asset->model->manufacturer->name }}
</a> </a>
@else
{{ $asset->model->manufacturer->name }}
@endcan
</td> </td>
</tr> </tr>
<tr> <tr>
<td>{{ trans('admin/hardware/form.model') }}</td>
<td> <td>
{{ trans('admin/hardware/form.model') }}</td>
<td>
@can('superuser')
<a href="{{ route('view/model', $asset->model->id) }}"> <a href="{{ route('view/model', $asset->model->id) }}">
{{ $asset->model->name }} {{ $asset->model->name }}
</a> </a>
@else
{{ $asset->model->name }}
@endcan
</td> </td>
</tr> </tr>
<tr> <tr>
@ -116,6 +127,7 @@
{{ $asset->model->modelno }} {{ $asset->model->modelno }}
</td> </td>
</tr> </tr>
@endif @endif
@if ($asset->model->fieldset) @if ($asset->model->fieldset)
@ -132,7 +144,7 @@
@if ($field->isFieldDecryptable($asset->{$field->db_column_name()} )) @if ($field->isFieldDecryptable($asset->{$field->db_column_name()} ))
@can('admin') @can('superuser')
@if (($field->format=='URL') && ($asset->{$field->db_column_name()}!='')) @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> <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 @else
@ -188,9 +200,13 @@
<tr> <tr>
<td>{{ trans('admin/hardware/form.supplier') }}</td> <td>{{ trans('admin/hardware/form.supplier') }}</td>
<td> <td>
@can ('superuser')
<a href="{{ route('view/supplier', $asset->supplier_id) }}"> <a href="{{ route('view/supplier', $asset->supplier_id) }}">
{{ $asset->supplier->name }} {{ $asset->supplier->name }}
</a> </a>
@else
{{ $asset->supplier->name }}
@endcan
</td> </td>
</tr> </tr>
@endif @endif
@ -260,6 +276,8 @@
</tr> </tr>
@endif @endif
@if ($asset->expected_checkin!='') @if ($asset->expected_checkin!='')
<tr> <tr>
<td>{{ trans('admin/hardware/form.expected_checkin') }}</td> <td>{{ trans('admin/hardware/form.expected_checkin') }}</td>
@ -280,6 +298,39 @@
</td> </td>
</tr> </tr>
@endif @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> </tbody>
</table> </table>
</div> <!-- /table-responsive --> </div> <!-- /table-responsive -->

View file

@ -441,8 +441,11 @@
<a href="{{ route('hardware/bulkcheckout') }}"> <a href="{{ route('hardware/bulkcheckout') }}">
{{ trans('general.bulk_checkout') }}</a> {{ trans('general.bulk_checkout') }}</a>
</li> </li>
@can('superuser')
<li{!! (Request::is('hardware/models*') ? ' class="active"' : '') !!}><a href="{{ URL::to('hardware/models') }}">@lang('general.asset_models')</a></li> <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> <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{!! (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('admin/asset_maintenances') }}" >@lang('general.asset_maintenances') </a></li>
<li><a href="{{ URL::to('hardware/import') }}">@lang('general.import') </a></li> <li><a href="{{ URL::to('hardware/import') }}">@lang('general.import') </a></li>

View file

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