Merge pull request #11407 from snipe/features/disclosure_arrows_on_user_screen

Added disclosure arrows for lesser used options on user screen
This commit is contained in:
snipe 2022-06-27 17:33:31 -07:00 committed by GitHub
commit ae73d4cc7c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 254 additions and 230 deletions

View file

@ -203,11 +203,6 @@ class AssetsController extends Controller
$success = true;
// $cookie = Cookie::queue(Cookie::make('optional_info', $_POST['options'],$minutes));
// $data = $request->session()->all();
// dd($_POST['options']);
}
}
@ -217,8 +212,7 @@ class AssetsController extends Controller
// dd( $_POST['options']);
// Cookie::queue(Cookie::make('optional_info', json_decode($_POST['options']), $minutes));
return redirect()->route('hardware.index')
->with('success', trans('admin/hardware/message.create.success'))
->withCookie(cookie('optional_info',json_encode($_POST['options']),$minutes,null,null,null,false));
->with('success', trans('admin/hardware/message.create.success'));
}

View file

@ -15,7 +15,6 @@
@include ('partials.forms.edit.company-select', ['translated_name' => trans('general.company'), 'fieldname' => 'company_id'])
<!-- {{Request::cookie('optional_info');}} -->
<!-- Asset Tag -->
<div class="form-group {{ $errors->has('asset_tag') ? ' has-error' : '' }}">
<label for="asset_tag" class="col-md-3 control-label">{{ trans('admin/hardware/form.tag') }}</label>

View file

@ -162,6 +162,7 @@
</div>
</div>
@if ($user->ldap_import!='1' || str_contains(Route::currentRouteName(), 'clone'))
<!-- Password Confirm -->
<div class="form-group {{ $errors->has('password_confirmation') ? 'has-error' : '' }}">
@ -271,14 +272,7 @@
</div>
</div> <!--/form-group-->
@endif
<!-- Company -->
@if (\App\Models\Company::canManageUsersCompanies())
@include ('partials.forms.edit.company-select', ['translated_name' => trans('general.select_company'), 'fieldname' => 'company_id'])
@endif
<!-- Image -->
<!-- Image -->
@if ($user->avatar)
<div class="form-group {{ $errors->has('image_delete') ? 'has-error' : '' }}">
<label class="col-md-3 control-label" for="image_delete">{{ trans('general.image_delete') }}</label>
@ -292,236 +286,255 @@
@include ('partials.forms.edit.image-upload', ['fieldname' => 'avatar'])
<!-- language -->
<div class="form-group {{ $errors->has('locale') ? 'has-error' : '' }}">
<label class="col-md-3 control-label" for="locale">{{ trans('general.language') }}</label>
<div class="col-md-6">
{!! Form::locales('locale', old('locale', $user->locale), 'select2') !!}
{!! $errors->first('locale', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
</div>
</div>
<!-- Employee Number -->
<div class="form-group {{ $errors->has('employee_num') ? 'has-error' : '' }}">
<label class="col-md-3 control-label" for="employee_num">{{ trans('general.employee_number') }}</label>
<div class="col-md-6">
<input
class="form-control"
type="text"
aria-label="employee_num"
name="employee_num"
maxlength="191"
id="employee_num"
value="{{ Request::old('employee_num', $user->employee_num) }}"
/>
{!! $errors->first('employee_num', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
</div>
</div>
<!-- Jobtitle -->
<div class="form-group {{ $errors->has('jobtitle') ? 'has-error' : '' }}">
<label class="col-md-3 control-label" for="jobtitle">{{ trans('admin/users/table.title') }}</label>
<div class="col-md-6">
<input
class="form-control"
type="text"
maxlength="191"
name="jobtitle"
id="jobtitle"
value="{{ Request::old('jobtitle', $user->jobtitle) }}"
/>
{!! $errors->first('jobtitle', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
</div>
</div>
<!-- Manager -->
@include ('partials.forms.edit.user-select', ['translated_name' => trans('admin/users/table.manager'), 'fieldname' => 'manager_id'])
<!-- Department -->
@include ('partials.forms.edit.department-select', ['translated_name' => trans('general.department'), 'fieldname' => 'department_id'])
<!-- remote checkbox -->
<div class="form-group">
<div class="col-md-7 col-md-offset-3">
<label for="remote">
<input type="checkbox" value="1" name="remote" class="minimal" {{ (old('remote', $user->remote)) == '1' ? ' checked="checked"' : '' }} aria-label="remote">
{{ trans('admin/users/general.remote_label') }}
</label>
<p class="help-block">{{ trans('admin/users/general.remote_help') }}
</p>
</div>
</div>
<!-- Location -->
@include ('partials.forms.edit.location-select', ['translated_name' => trans('general.location'), 'fieldname' => 'location_id'])
<!-- Phone -->
<div class="form-group {{ $errors->has('phone') ? 'has-error' : '' }}">
<label class="col-md-3 control-label" for="phone">{{ trans('admin/users/table.phone') }}</label>
<div class="col-md-6">
<input class="form-control" type="text" name="phone" id="phone" value="{{ old('phone', $user->phone) }}" maxlength="191" />
{!! $errors->first('phone', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
</div>
</div>
<!-- Website URL -->
<div class="form-group {{ $errors->has('website') ? ' has-error' : '' }}">
<label for="website" class="col-md-3 control-label">{{ trans('general.website') }}</label>
<div class="col-md-6">
<input class="form-control" type="text" name="website" id="website" value="{{ old('website', $user->website) }}" maxlength="191" />
{!! $errors->first('website', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
</div>
</div>
<!-- Address -->
<div class="form-group{{ $errors->has('address') ? ' has-error' : '' }}">
<label class="col-md-3 control-label" for="address">{{ trans('general.address') }}</label>
<div class="col-md-6">
<input class="form-control" type="text" name="address" id="address" value="{{ old('address', $user->address) }}" maxlength="191" />
{!! $errors->first('address', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
</div>
</div>
<!-- City -->
<div class="form-group{{ $errors->has('city') ? ' has-error' : '' }}">
<label class="col-md-3 control-label" for="city">{{ trans('general.city') }}</label>
<div class="col-md-6">
<input class="form-control" type="text" name="city" id="city" aria-label="city" value="{{ old('city', $user->city) }}" maxlength="191" />
{!! $errors->first('city', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
</div>
</div>
<!-- State -->
<div class="form-group{{ $errors->has('state') ? ' has-error' : '' }}">
<label class="col-md-3 control-label" for="state">{{ trans('general.state') }}</label>
<div class="col-md-6">
<input class="form-control" type="text" name="state" id="state" value="{{ old('state', $user->state) }}" maxlength="3" />
{!! $errors->first('state', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
</div>
</div>
<!-- Country -->
<div class="form-group{{ $errors->has('country') ? ' has-error' : '' }}">
<label class="col-md-3 control-label" for="country">{{ trans('general.country') }}</label>
<div class="col-md-6">
{!! Form::countries('country', old('country', $user->country), 'col-md-6 select2') !!}
{!! $errors->first('country', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
</div>
</div>
<!-- Zip -->
<div class="form-group{{ $errors->has('zip') ? ' has-error' : '' }}">
<label class="col-md-3 control-label" for="zip">{{ trans('general.zip') }}</label>
<div class="col-md-3">
<input class="form-control" type="text" name="zip" id="zip" value="{{ old('zip', $user->zip) }}" maxlength="10" />
{!! $errors->first('zip', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
</div>
</div>
@if ($snipeSettings->two_factor_enabled!='')
@if ($snipeSettings->two_factor_enabled=='1')
<!-- begin optional disclosure arrow stuff -->
<div class="form-group">
<div class="col-md-3 control-label">
{{ Form::label('two_factor_optin', trans('admin/settings/general.two_factor')) }}
</div>
<div class="col-md-9">
@if (config('app.lock_passwords'))
<div class="icheckbox disabled">
{{ Form::checkbox('two_factor_optin', '1', Request::old('two_factor_optin', $user->two_factor_optin),['class' => 'minimal', 'disabled'=>'disabled']) }} {{ trans('admin/settings/general.two_factor_enabled_text') }}
<p class="help-block">{{ trans('general.feature_disabled') }}</p>
</div>
@else
{{ Form::checkbox('two_factor_optin', '1', Request::old('two_factor_optin', $user->two_factor_optin),['class' => 'minimal']) }} {{ trans('admin/settings/general.two_factor_enabled_text') }}
<p class="help-block">{{ trans('admin/users/general.two_factor_admin_optin_help') }}</p>
<label class="col-md-3 control-label"></label>
@endif
<div class="col-md-9 col-sm-9 col-md-offset-3">
</div>
</div>
@endif
<a id="optional_user_info" class="text-primary">
<i class="fa fa-caret-right fa-2x" id="optional_user_info_icon"></i>
<strong>{{ trans('admin/hardware/form.optional_infos') }}</strong>
</a>
<!-- Reset Two Factor -->
<div class="form-group">
<div class="col-md-8 col-md-offset-3 two_factor_resetrow">
<a class="btn btn-default btn-sm pull-left" id="two_factor_reset" style="margin-right: 10px;"> {{ trans('admin/settings/general.two_factor_reset') }}</a>
<span id="two_factor_reseticon">
</span>
<span id="two_factor_resetresult">
</span>
<span id="two_factor_resetstatus">
</span>
</div>
<div class="col-md-8 col-md-offset-3 two_factor_resetrow">
<p class="help-block">{{ trans('admin/settings/general.two_factor_reset_help') }}</p>
</div>
</div>
@endif
</div>
<!-- Notes -->
<div class="form-group{!! $errors->has('notes') ? ' has-error' : '' !!}">
<label for="notes" class="col-md-3 control-label">{{ trans('admin/users/table.notes') }}</label>
<div class="col-md-6">
<textarea class="form-control" rows="5" id="notes" name="notes">{{ old('notes', $user->notes) }}</textarea>
{!! $errors->first('notes', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
</div>
</div>
<div id="optional_user_details" class="col-md-12" style="display:none">
<!-- everything here should be what is considered optional -->
<br>
<!-- Company -->
@if (\App\Models\Company::canManageUsersCompanies())
@include ('partials.forms.edit.company-select', ['translated_name' => trans('general.select_company'), 'fieldname' => 'company_id'])
@endif
<!-- Groups -->
<div class="form-group{{ $errors->has('groups') ? ' has-error' : '' }}">
<label class="col-md-3 control-label" for="groups[]"> {{ trans('general.groups') }}</label>
<div class="col-md-6">
@if ($groups->count())
@if ((Config::get('app.lock_passwords') || (!Auth::user()->isSuperUser())))
<!-- language -->
<div class="form-group {{ $errors->has('locale') ? 'has-error' : '' }}">
<label class="col-md-3 control-label" for="locale">{{ trans('general.language') }}</label>
<div class="col-md-9">
{!! Form::locales('locale', old('locale', $user->locale), 'select2') !!}
{!! $errors->first('locale', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
</div>
</div>
@if (count($userGroups->keys()) > 0)
<ul>
@foreach ($groups as $id => $group)
{!! ($userGroups->keys()->contains($id) ? '<li>'.e($group).'</li>' : '') !!}
@endforeach
</ul>
<!-- Employee Number -->
<div class="form-group {{ $errors->has('employee_num') ? 'has-error' : '' }}">
<label class="col-md-3 control-label" for="employee_num">{{ trans('general.employee_number') }}</label>
<div class="col-md-6">
<input
class="form-control"
type="text"
aria-label="employee_num"
name="employee_num"
maxlength="191"
id="employee_num"
value="{{ Request::old('employee_num', $user->employee_num) }}"
/>
{!! $errors->first('employee_num', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
</div>
</div>
<!-- Jobtitle -->
<div class="form-group {{ $errors->has('jobtitle') ? 'has-error' : '' }}">
<label class="col-md-3 control-label" for="jobtitle">{{ trans('admin/users/table.title') }}</label>
<div class="col-md-6">
<input
class="form-control"
type="text"
maxlength="191"
name="jobtitle"
id="jobtitle"
value="{{ Request::old('jobtitle', $user->jobtitle) }}"
/>
{!! $errors->first('jobtitle', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
</div>
</div>
<!-- Manager -->
@include ('partials.forms.edit.user-select', ['translated_name' => trans('admin/users/table.manager'), 'fieldname' => 'manager_id'])
<!-- Department -->
@include ('partials.forms.edit.department-select', ['translated_name' => trans('general.department'), 'fieldname' => 'department_id'])
<!-- remote checkbox -->
<div class="form-group">
<div class="col-md-7 col-md-offset-3">
<label for="remote">
<input type="checkbox" value="1" name="remote" class="minimal" {{ (old('remote', $user->remote)) == '1' ? ' checked="checked"' : '' }} aria-label="remote">
{{ trans('admin/users/general.remote_label') }}
</label>
<p class="help-block">{{ trans('admin/users/general.remote_help') }}
</p>
</div>
</div>
<!-- Location -->
@include ('partials.forms.edit.location-select', ['translated_name' => trans('general.location'), 'fieldname' => 'location_id'])
<!-- Phone -->
<div class="form-group {{ $errors->has('phone') ? 'has-error' : '' }}">
<label class="col-md-3 control-label" for="phone">{{ trans('admin/users/table.phone') }}</label>
<div class="col-md-6">
<input class="form-control" type="text" name="phone" id="phone" value="{{ old('phone', $user->phone) }}" maxlength="191" />
{!! $errors->first('phone', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
</div>
</div>
<!-- Website URL -->
<div class="form-group {{ $errors->has('website') ? ' has-error' : '' }}">
<label for="website" class="col-md-3 control-label">{{ trans('general.website') }}</label>
<div class="col-md-6">
<input class="form-control" type="text" name="website" id="website" value="{{ old('website', $user->website) }}" maxlength="191" />
{!! $errors->first('website', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
</div>
</div>
<!-- Address -->
<div class="form-group{{ $errors->has('address') ? ' has-error' : '' }}">
<label class="col-md-3 control-label" for="address">{{ trans('general.address') }}</label>
<div class="col-md-6">
<input class="form-control" type="text" name="address" id="address" value="{{ old('address', $user->address) }}" maxlength="191" />
{!! $errors->first('address', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
</div>
</div>
<!-- City -->
<div class="form-group{{ $errors->has('city') ? ' has-error' : '' }}">
<label class="col-md-3 control-label" for="city">{{ trans('general.city') }}</label>
<div class="col-md-6">
<input class="form-control" type="text" name="city" id="city" aria-label="city" value="{{ old('city', $user->city) }}" maxlength="191" />
{!! $errors->first('city', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
</div>
</div>
<!-- State -->
<div class="form-group{{ $errors->has('state') ? ' has-error' : '' }}">
<label class="col-md-3 control-label" for="state">{{ trans('general.state') }}</label>
<div class="col-md-6">
<input class="form-control" type="text" name="state" id="state" value="{{ old('state', $user->state) }}" maxlength="3" />
{!! $errors->first('state', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
</div>
</div>
<!-- Country -->
<div class="form-group{{ $errors->has('country') ? ' has-error' : '' }}">
<label class="col-md-3 control-label" for="country">{{ trans('general.country') }}</label>
<div class="col-md-6">
{!! Form::countries('country', old('country', $user->country), 'col-md-6 select2') !!}
{!! $errors->first('country', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
</div>
</div>
<!-- Zip -->
<div class="form-group{{ $errors->has('zip') ? ' has-error' : '' }}">
<label class="col-md-3 control-label" for="zip">{{ trans('general.zip') }}</label>
<div class="col-md-3">
<input class="form-control" type="text" name="zip" id="zip" value="{{ old('zip', $user->zip) }}" maxlength="10" />
{!! $errors->first('zip', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
</div>
</div>
<!-- Notes -->
<div class="form-group{!! $errors->has('notes') ? ' has-error' : '' !!}">
<label for="notes" class="col-md-3 control-label">{{ trans('admin/users/table.notes') }}</label>
<div class="col-md-6">
<textarea class="form-control" rows="5" id="notes" name="notes">{{ old('notes', $user->notes) }}</textarea>
{!! $errors->first('notes', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
</div>
</div>
@if ($snipeSettings->two_factor_enabled!='')
@if ($snipeSettings->two_factor_enabled=='1')
<div class="form-group">
<div class="col-md-3 control-label">
{{ Form::label('two_factor_optin', trans('admin/settings/general.two_factor')) }}
</div>
<div class="col-md-9">
@if (config('app.lock_passwords'))
<div class="icheckbox disabled">
{{ Form::checkbox('two_factor_optin', '1', Request::old('two_factor_optin', $user->two_factor_optin),['class' => 'minimal', 'disabled'=>'disabled']) }} {{ trans('admin/settings/general.two_factor_enabled_text') }}
<p class="help-block">{{ trans('general.feature_disabled') }}</p>
</div>
@else
{{ Form::checkbox('two_factor_optin', '1', Request::old('two_factor_optin', $user->two_factor_optin),['class' => 'minimal']) }} {{ trans('admin/settings/general.two_factor_enabled_text') }}
<p class="help-block">{{ trans('admin/users/general.two_factor_admin_optin_help') }}</p>
@endif
</div>
</div>
@endif
<span class="help-block">{{ trans('admin/users/general.group_memberships_helpblock') }}</p>
@else
<div class="controls">
<select
name="groups[]"
aria-label="groups[]"
id="groups[]"
multiple="multiple"
class="form-control">
@foreach ($groups as $id => $group)
<option value="{{ $id }}"
{{ ($userGroups->keys()->contains($id) ? ' selected="selected"' : '') }}>
{{ $group }}
</option>
@endforeach
</select>
<span class="help-block">
{{ trans('admin/users/table.groupnotes') }}
</span>
</div>
<!-- Reset Two Factor -->
<div class="form-group">
<div class="col-md-8 col-md-offset-3 two_factor_resetrow">
<a class="btn btn-default btn-sm pull-left" id="two_factor_reset" style="margin-right: 10px;"> {{ trans('admin/settings/general.two_factor_reset') }}</a>
<span id="two_factor_reseticon"></span>
<span id="two_factor_resetresult"></span>
<span id="two_factor_resetstatus"></span>
</div>
<div class="col-md-8 col-md-offset-3 two_factor_resetrow">
<p class="help-block">{{ trans('admin/settings/general.two_factor_reset_help') }}</p>
</div>
</div>
@endif
@else
<p>No groups have been created yet. Visit <code>Admin Settings > Permission Groups</code> to add one.</p>
@endif
<!-- Groups -->
<div class="form-group{{ $errors->has('groups') ? ' has-error' : '' }}">
<label class="col-md-3 control-label" for="groups[]"> {{ trans('general.groups') }}</label>
<div class="col-md-6">
@if ($groups->count())
@if ((Config::get('app.lock_passwords') || (!Auth::user()->isSuperUser())))
@if (count($userGroups->keys()) > 0)
<ul>
@foreach ($groups as $id => $group)
{!! ($userGroups->keys()->contains($id) ? '<li>'.e($group).'</li>' : '') !!}
@endforeach
</ul>
@endif
<span class="help-block">{{ trans('admin/users/general.group_memberships_helpblock') }}</p>
@else
<div class="controls">
<select
name="groups[]"
aria-label="groups[]"
id="groups[]"
multiple="multiple"
class="form-control">
@foreach ($groups as $id => $group)
<option value="{{ $id }}"
{{ ($userGroups->keys()->contains($id) ? ' selected="selected"' : '') }}>
{{ $group }}
</option>
@endforeach
</select>
<span class="help-block">
{{ trans('admin/users/table.groupnotes') }}
</span>
</div>
@endif
@else
<p>No groups have been created yet. Visit <code>Admin Settings > Permission Groups</code> to add one.</p>
@endif
</div>
</div>
</div>
</div>
</div> <!--/col-md-12-->
</div>
</div><!-- /.tab-pane -->
@ -619,6 +632,24 @@ $(document).ready(function() {
}
});
$("#optional_user_info").on("click",function(){
$('#optional_user_details').fadeToggle(100);
$('#optional_user_info_icon').toggleClass('fa-caret-right fa-caret-down');
var optional_user_info_open = $('#optional_user_info_icon').hasClass('fa-caret-down');
document.cookie = "optional_user_info_open="+optional_user_info_open+'; path=/';
});
var all_cookies = document.cookie.split(';')
for(var i in all_cookies) {
var trimmed_cookie = all_cookies[i].trim(' ')
if (trimmed_cookie.startsWith('optional_user_info_open=')) {
elems = all_cookies[i].split('=', 2)
if (elems[1] == 'true') {
$('#optional_user_info').trigger('click')
}
}
}
$("#two_factor_reset").click(function(){
$("#two_factor_resetrow").removeClass('success');
$("#two_factor_resetrow").removeClass('danger');