Merge remote-tracking branch 'origin/develop'

This commit is contained in:
snipe 2024-12-02 15:59:25 +00:00
commit 5a4a3aa8f3
3 changed files with 22 additions and 21 deletions

View file

@ -283,6 +283,7 @@ class UsersController extends Controller
'autoassign_licenses', 'autoassign_licenses',
'website', 'website',
'locale', 'locale',
'notes',
]; ];
$sort = in_array($request->input('sort'), $allowed_columns) ? $request->input('sort') : 'first_name'; $sort = in_array($request->input('sort'), $allowed_columns) ? $request->input('sort') : 'first_name';

View file

@ -24,9 +24,9 @@ class AssetCheckoutRequest extends Request
$settings = \App\Models\Setting::getSettings(); $settings = \App\Models\Setting::getSettings();
$rules = [ $rules = [
'assigned_user' => 'required_without_all:assigned_asset,assigned_location', 'assigned_user' => 'integer|required_without_all:assigned_asset,assigned_location',
'assigned_asset' => 'required_without_all:assigned_user,assigned_location', 'assigned_asset' => 'integer|required_without_all:assigned_user,assigned_location',
'assigned_location' => 'required_without_all:assigned_user,assigned_asset', 'assigned_location' => 'integer|required_without_all:assigned_user,assigned_asset',
'status_id' => 'exists:status_labels,id,deployable,1', 'status_id' => 'exists:status_labels,id,deployable,1',
'checkout_to_type' => 'required|in:asset,location,user', 'checkout_to_type' => 'required|in:asset,location,user',
'checkout_at' => [ 'checkout_at' => [

View file

@ -2,20 +2,22 @@
@foreach($model->fieldset->fields AS $field) @foreach($model->fieldset->fields AS $field)
<div class="form-group{{ $errors->has($field->db_column_name()) ? ' has-error' : '' }}"> <div class="form-group{{ $errors->has($field->db_column_name()) ? ' has-error' : '' }}">
<label for="{{ $field->db_column_name() }}" class="col-md-3 control-label">{{ $field->name }} </label> <label for="{{ $field->db_column_name() }}" class="col-md-3 control-label">{{ $field->name }} </label>
<div class="col-md-7 col-sm-12{{ ($field->pivot->required=='1') ? ' required' : '' }}"> <div class="col-md-7 col-sm-12">
@if ($field->element!='text') @if ($field->element!='text')
<!-- Listbox -->
@if ($field->element=='listbox') @if ($field->element=='listbox')
<!-- Listbox -->
{{ Form::select($field->db_column_name(), $field->formatFieldValuesAsArray(), {{ Form::select($field->db_column_name(), $field->formatFieldValuesAsArray(),
old($field->db_column_name(),(isset($item) ? Helper::gracefulDecrypt($field, $item->{$field->db_column_name()}) : $field->defaultValue($model->id))), ['class'=>'format select2 form-control']) }} old($field->db_column_name(),(isset($item) ? Helper::gracefulDecrypt($field, $item->{$field->db_column_name()}) : $field->defaultValue($model->id))), ['class' => 'format select2 form-control', ($field->pivot->required=='1' ? ' required' : '') ]) }}
@elseif ($field->element=='textarea') @elseif ($field->element=='textarea')
<textarea class="col-md-6 form-control" id="{{ $field->db_column_name() }}" name="{{ $field->db_column_name() }}">{{ old($field->db_column_name(),(isset($item) ? Helper::gracefulDecrypt($field, $item->{$field->db_column_name()}) : $field->defaultValue($model->id))) }}</textarea> <!-- Textarea -->
<textarea class="col-md-6 form-control" id="{{ $field->db_column_name() }}" name="{{ $field->db_column_name() }}"{{ ($field->pivot->required=='1') ? ' required' : '' }}>{{ old($field->db_column_name(),(isset($item) ? Helper::gracefulDecrypt($field, $item->{$field->db_column_name()}) : $field->defaultValue($model->id))) }}</textarea>
@elseif ($field->element=='checkbox') @elseif ($field->element=='checkbox')
<!-- Checkboxes --> <!-- Checkbox -->
@foreach ($field->formatFieldValuesAsArray() as $key => $value) @foreach ($field->formatFieldValuesAsArray() as $key => $value)
<div> <div>
<label class="form-control"> <label class="form-control">
@ -26,27 +28,25 @@
@endforeach @endforeach
@elseif ($field->element=='radio') @elseif ($field->element=='radio')
@foreach ($field->formatFieldValuesAsArray() as $value) <!-- Radio -->
@foreach ($field->formatFieldValuesAsArray() as $value)
<div> <div>
<label class="form-control"> <label class="form-control">
<input type="radio" value="{{ $value }}" name="{{ $field->db_column_name() }}" {{ isset($item) ? ($item->{$field->db_column_name()} == $value ? ' checked="checked"' : '') : (old($field->db_column_name()) != '' ? ' checked="checked"' : (in_array($value, explode(', ', $field->defaultValue($model->id))) ? ' checked="checked"' : '')) }}> <input type="radio" value="{{ $value }}" name="{{ $field->db_column_name() }}" {{ isset($item) ? ($item->{$field->db_column_name()} == $value ? ' checked="checked"' : '') : (old($field->db_column_name()) != '' ? ' checked="checked"' : (in_array($value, explode(', ', $field->defaultValue($model->id))) ? ' checked="checked"' : '')) }}>
{{ $value }} {{ $value }}
</label> </label>
</div> </div>
@endforeach @endforeach
@endif @endif
@else @else
<!-- Date field --> <!-- Date field -->
@if ($field->format=='DATE') @if ($field->format=='DATE')
<div class="input-group col-md-5" style="padding-left: 0px;"> <div class="input-group col-md-5" style="padding-left: 0px;">
<div class="input-group date" data-provide="datepicker" data-date-format="yyyy-mm-dd" data-autoclose="true" data-date-clear-btn="true"> <div class="input-group date" data-provide="datepicker" data-date-format="yyyy-mm-dd" data-autoclose="true" data-date-clear-btn="true">
<input type="text" class="form-control" placeholder="{{ trans('general.select_date') }}" name="{{ $field->db_column_name() }}" id="{{ $field->db_column_name() }}" readonly value="{{ old($field->db_column_name(),(isset($item) ? Helper::gracefulDecrypt($field, $item->{$field->db_column_name()}) : $field->defaultValue($model->id))) }}" style="background-color:inherit"> <input type="text" class="form-control" placeholder="{{ trans('general.select_date') }}" name="{{ $field->db_column_name() }}" id="{{ $field->db_column_name() }}" readonly value="{{ old($field->db_column_name(),(isset($item) ? Helper::gracefulDecrypt($field, $item->{$field->db_column_name()}) : $field->defaultValue($model->id))) }}" style="background-color:inherit"{{ ($field->pivot->required=='1') ? ' required' : '' }}>
<span class="input-group-addon"><x-icon type="calendar" /></span> <span class="input-group-addon"><x-icon type="calendar" /></span>
</div> </div>
</div> </div>
@ -54,7 +54,7 @@
@else @else
@if (($field->field_encrypted=='0') || (Gate::allows('assets.view.encrypted_custom_fields'))) @if (($field->field_encrypted=='0') || (Gate::allows('assets.view.encrypted_custom_fields')))
<input type="text" value="{{ old($field->db_column_name(),(isset($item) ? Helper::gracefulDecrypt($field, $item->{$field->db_column_name()}) : $field->defaultValue($model->id))) }}" id="{{ $field->db_column_name() }}" class="form-control" name="{{ $field->db_column_name() }}" placeholder="Enter {{ strtolower($field->format) }} text"> <input type="text" value="{{ old($field->db_column_name(),(isset($item) ? Helper::gracefulDecrypt($field, $item->{$field->db_column_name()}) : $field->defaultValue($model->id))) }}" id="{{ $field->db_column_name() }}" class="form-control" name="{{ $field->db_column_name() }}" placeholder="Enter {{ strtolower($field->format) }} text"{{ ($field->pivot->required=='1') ? ' required' : '' }}>
@else @else
<input type="text" value="{{ strtoupper(trans('admin/custom_fields/general.encrypted')) }}" class="form-control disabled" disabled> <input type="text" value="{{ strtoupper(trans('admin/custom_fields/general.encrypted')) }}" class="form-control disabled" disabled>
@endif @endif