mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-24 21:24:13 -08:00
* Add a setting to show assets assigned to other assets #6489 * Update user's views to show assets assigned to other assets #6489 * Add ukrainian and russian translation for the feature #6489 in settings
This commit is contained in:
parent
3fbfb0c658
commit
6ad1f51673
|
@ -334,6 +334,7 @@ class SettingsController extends Controller
|
|||
$setting->email_format = $request->input('email_format');
|
||||
$setting->username_format = $request->input('username_format');
|
||||
$setting->require_accept_signature = $request->input('require_accept_signature');
|
||||
$setting->show_assigned_assets = $request->input('show_assigned_assets', '0');
|
||||
if (! config('app.lock_passwords')) {
|
||||
$setting->login_note = $request->input('login_note');
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ use App\Models\Asset;
|
|||
use App\Models\Company;
|
||||
use App\Models\Group;
|
||||
use App\Models\Ldap;
|
||||
use App\Models\Setting;
|
||||
use App\Models\User;
|
||||
use App\Notifications\WelcomeNotification;
|
||||
use Auth;
|
||||
|
@ -404,7 +405,8 @@ class UsersController extends Controller
|
|||
$userlog = $user->userlog->load('item');
|
||||
|
||||
$this->authorize('view', $user);
|
||||
return view('users/view', compact('user', 'userlog'));
|
||||
return view('users/view', compact('user', 'userlog'))
|
||||
->with('settings', Setting::getSettings());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -604,6 +606,7 @@ class UsersController extends Controller
|
|||
->with('licenses', $show_user->licenses()->get())
|
||||
->with('accessories', $accessories)
|
||||
->with('consumables', $consumables)
|
||||
->with('show_user', $show_user);
|
||||
->with('show_user', $show_user)
|
||||
->with('settings', Setting::getSettings());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,13 +42,11 @@ class ViewAssetsController extends Controller
|
|||
$userlog = $user->userlog->load('item', 'user', 'target');
|
||||
|
||||
if (isset($user->id)) {
|
||||
return view('account/view-assets', compact('user', 'userlog'));
|
||||
return view('account/view-assets', compact('user', 'userlog'))
|
||||
->with('settings', Setting::getSettings());
|
||||
} else {
|
||||
// Prepare the error message
|
||||
$error = trans('admin/users/message.user_not_found', compact('id'));
|
||||
|
||||
// Redirect to the user management page
|
||||
return redirect()->route('users.index')->with('error', $error);
|
||||
return redirect()->route('users.index')->with('error', trans('admin/users/message.user_not_found', compact('id')));
|
||||
}
|
||||
// Redirect to the user management page
|
||||
return redirect()->route('users.index')
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddShowAssignedAssetsToSettings extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('settings', function (Blueprint $table) {
|
||||
$table->boolean('show_assigned_assets')->default(false);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('settings', function (Blueprint $table) {
|
||||
$table->dropColumn('show_assigned_assets');
|
||||
});
|
||||
}
|
||||
}
|
|
@ -120,6 +120,8 @@ return array(
|
|||
'show_alerts_in_menu' => 'Show alerts in top menu',
|
||||
'show_archived_in_list' => 'Archived Assets',
|
||||
'show_archived_in_list_text' => 'Show archived assets in the "all assets" listing',
|
||||
'show_assigned_assets' => 'Show assets assigned to assets',
|
||||
'show_assigned_assets_help' => 'Display assets which were assigned to the other assets in View User -> Assets, View User -> Info -> Print All Assigned and in Account -> View Assigned Assets.',
|
||||
'show_images_in_email' => 'Show images in emails',
|
||||
'show_images_in_email_help' => 'Uncheck this box if your Snipe-IT installation is behind a VPN or closed network and users outside the network will not be able to load images served from this installation in their emails.',
|
||||
'site_name' => 'Site Name',
|
||||
|
|
|
@ -111,6 +111,8 @@ return array(
|
|||
'show_alerts_in_menu' => 'Показать оповещения в верхнем меню',
|
||||
'show_archived_in_list' => 'Архивные активы',
|
||||
'show_archived_in_list_text' => 'Отображать активы из архива в списке «все активы»',
|
||||
'show_assigned_assets' => 'Отображать активы которые назначены другим активам',
|
||||
'show_assigned_assets_help' => 'Отображать активы которые назначены другим активам в: Показать пользователя -> Активы, Показать пользователя -> Информация -> Печать всех назначенных, Аккаунт -> Показать присвоенные активы.',
|
||||
'show_images_in_email' => 'Показать изображения в письмах',
|
||||
'show_images_in_email_help' => 'Снимите этот флажок, если ваша установка Snipe-IT находится за VPN или в закрытой сети в случае, если в E-mail-ах, которые просматриваются пользователями за пределами указанной сети не отбражаются/не загружаются изображения из данной установки Snipe-IT.',
|
||||
'site_name' => 'Название сайта',
|
||||
|
|
|
@ -92,6 +92,8 @@ return array(
|
|||
'logo_print_assets_help' => 'Use branding on printable asset lists ',
|
||||
'full_multiple_companies_support_help_text' => 'Restricting users (including admins) assigned to companies to their company\'s assets.',
|
||||
'full_multiple_companies_support_text' => 'Full Multiple Companies Support',
|
||||
'show_assigned_assets' => 'Показувати активи які призначені іншим активам',
|
||||
'show_assigned_assets_help' => 'Відображати активи які призначені іншим активам у: Перегляд коритувача -> Активи, Перегляд коритувача -> Інфо -> Друкувати всі призначення та Аккаунт -> Показати прив\'язані активи.',
|
||||
'show_in_model_list' => 'Show in Model Dropdowns',
|
||||
'optional' => 'optional',
|
||||
'per_page' => 'Results Per Page',
|
||||
|
|
|
@ -17,7 +17,7 @@ return array(
|
|||
'restore_user' => 'Click here to restore them.',
|
||||
'last_login' => 'Останній вхід',
|
||||
'ldap_config_text' => 'LDAP configuration settings can be found Admin > Settings. The (optional) selected location will be set for all imported users.',
|
||||
'print_assigned' => 'Print All Assigned',
|
||||
'print_assigned' => 'Друкувати всі призначення',
|
||||
'software_user' => 'Software Checked out to :name',
|
||||
'view_user' => 'View User :name',
|
||||
'usercsv' => 'Файл CSV',
|
||||
|
|
|
@ -44,6 +44,7 @@ View Assets for {{ $user->present()->fullName() }}
|
|||
}'>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th class="col-md-3" data-switchable="true" data-visible="true">{{ trans('general.category') }}</th>
|
||||
<th class="col-md-2" data-switchable="true" data-visible="true">{{ trans('admin/hardware/table.asset_tag') }}</th>
|
||||
<th class="col-md-3" data-switchable="true" data-visible="true">{{ trans('general.name') }}</th>
|
||||
|
@ -54,8 +55,12 @@ View Assets for {{ $user->present()->fullName() }}
|
|||
|
||||
</thead>
|
||||
<tbody>
|
||||
@php
|
||||
$counter = 1
|
||||
@endphp
|
||||
@foreach ($user->assets as $asset)
|
||||
<tr>
|
||||
<td>{{ $counter }}</td>
|
||||
<td>{{ $asset->model->category->name }}</td>
|
||||
<td>{{ $asset->asset_tag }}</td>
|
||||
<td>{{ $asset->name }}</td>
|
||||
|
@ -74,6 +79,39 @@ View Assets for {{ $user->present()->fullName() }}
|
|||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
@if($settings->show_assigned_assets)
|
||||
@php
|
||||
$assignedCounter = 1
|
||||
@endphp
|
||||
@foreach ($asset->assignedAssets as $asset)
|
||||
<tr>
|
||||
<td>{{ $counter }}.{{ $assignedCounter }}</td>
|
||||
<td>{{ $asset->model->category->name }}</td>
|
||||
<td>{{ $asset->asset_tag }}</td>
|
||||
<td>{{ $asset->name }}</td>
|
||||
<td>
|
||||
@if ($asset->physical=='1')
|
||||
{{ $asset->model->name }}
|
||||
@endif
|
||||
</td>
|
||||
<td>{{ $asset->serial }}</td>
|
||||
<td>
|
||||
@if (($asset->image) && ($asset->image!=''))
|
||||
<img src="{{ Storage::disk('public')->url(app('assets_upload_path').e($asset->image)) }}" height="50" width="50">
|
||||
|
||||
@elseif (($asset->model) && ($asset->model->image!=''))
|
||||
<img src="{{ Storage::disk('public')->url(app('models_upload_path').e($asset->model->image)) }}" height="50" width="50">
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
@php
|
||||
$assignedCounter++
|
||||
@endphp
|
||||
@endforeach
|
||||
@endif
|
||||
@php
|
||||
$counter++
|
||||
@endphp
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
|
@ -257,6 +257,20 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Show assets assigned to user's assets -->
|
||||
<div class="form-group {{ $errors->has('show_assigned_assets') ? 'error' : '' }}">
|
||||
<div class="col-md-3">
|
||||
{{ Form::label('show_assigned_assets',
|
||||
trans('admin/settings/general.show_assigned_assets')) }}
|
||||
</div>
|
||||
<div class="col-md-9">
|
||||
{{ Form::checkbox('show_assigned_assets', '1', Input::old('show_assigned_assets', $setting->show_assigned_assets),array('class' => 'minimal')) }}
|
||||
{{ trans('general.yes') }}
|
||||
<p class="help-block">{{ trans('admin/settings/general.show_assigned_assets_help') }}</p>
|
||||
{!! $errors->first('show_assigned_assets', '<span class="alert-msg">:message</span>') !!}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Model List prefs -->
|
||||
<div class="form-group {{ $errors->has('show_in_model_list') ? 'error' : '' }}">
|
||||
<div class="col-md-3">
|
||||
|
|
|
@ -87,6 +87,28 @@
|
|||
{{ $asset->last_checkout }}</td>
|
||||
<td><img height="20%" src="{{ asset('/') }}display-sig/{{ $asset->assetlog->first()->accept_signature }}"></img></td>
|
||||
</tr>
|
||||
@if($settings->show_assigned_assets)
|
||||
@php
|
||||
$assignedCounter = 1;
|
||||
@endphp
|
||||
@foreach ($asset->assignedAssets as $asset)
|
||||
|
||||
<tr>
|
||||
<td>{{ $counter }}.{{ $assignedCounter }}</td>
|
||||
<td>{{ $asset->asset_tag }}</td>
|
||||
<td>{{ $asset->name }}</td>
|
||||
<td>{{ $asset->model->category->name }}</td>
|
||||
<td>{{ $asset->model->name }}</td>
|
||||
<td>{{ $asset->serial }}</td>
|
||||
<td>
|
||||
{{ $asset->last_checkout }}</td>
|
||||
<td><img height="20%" src="{{ asset('/') }}display-sig/{{ $asset->assetlog->first()->accept_signature }}"></img></td>
|
||||
</tr>
|
||||
@php
|
||||
$assignedCounter++
|
||||
@endphp
|
||||
@endforeach
|
||||
@endif
|
||||
@php
|
||||
$counter++
|
||||
@endphp
|
||||
|
|
|
@ -353,6 +353,28 @@
|
|||
@endcan
|
||||
</td>
|
||||
</tr>
|
||||
@if($settings->show_assigned_assets)
|
||||
@foreach ($asset->assignedAssets as $asset)
|
||||
<tr>
|
||||
<td>
|
||||
@if ($asset->physical=='1')
|
||||
<a href="{{ route('models.show', $asset->model->id) }}">{{ ' – '.$asset->model->name }}</a>
|
||||
@endif
|
||||
</td>
|
||||
<td>
|
||||
@can('view', $asset)
|
||||
<a href="{{ route('hardware.show', $asset->id) }}">{{ $asset->asset_tag }}</a>
|
||||
@endcan
|
||||
</td>
|
||||
<td>{!! $asset->present()->nameUrl() !!}</td>
|
||||
<td class="hidden-print">
|
||||
@can('checkin', $asset)
|
||||
<a href="{{ route('checkin/hardware', array('assetId'=> $asset->id, 'backto'=>'user')) }}" class="btn btn-primary btn-sm hidden-print">{{ trans('general.checkin') }}</a>
|
||||
@endcan
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
@endif
|
||||
@endforeach
|
||||
@endif
|
||||
</tbody>
|
||||
|
|
Loading…
Reference in a new issue