Merge remote-tracking branch 'origin/develop'

This commit is contained in:
snipe 2021-01-27 15:38:15 -08:00
commit c745fa095b
5 changed files with 35 additions and 3 deletions

View file

@ -6,6 +6,7 @@ use App\Http\Controllers\Controller;
use App\Services\LdapAd;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Artisan;
use App\Models\User; // Note that this is awful close to 'Users' the namespace above; be careful
class LDAPImportController extends Controller
{
@ -65,6 +66,7 @@ class LDAPImportController extends Controller
*/
public function store(Request $request)
{
$this->authorize('update', User::class);
// Call Artisan LDAP import command.
$location_id = $request->input('location_id');
Artisan::call('snipeit:ldap-sync', ['--location_id' => $location_id, '--json_summary' => true]);

View file

@ -287,7 +287,7 @@ class CustomField extends Model
{
$arr = preg_split("/\\r\\n|\\r|\\n/", $this->field_values);
if (($this->element!='checkbox') && ($this->element!='checkbox')) {
if (($this->element!='checkbox') && ($this->element!='radio')) {
$result[''] = 'Select '.strtolower($this->format);
}

View file

@ -70,7 +70,7 @@
</div>
<!-- Format -->
<div class="form-group {{ $errors->has('format') ? ' has-error' : '' }}">
<div class="form-group {{ $errors->has('format') ? ' has-error' : '' }}" id="format_values">
<label for="format" class="col-md-4 control-label">
{{ trans('admin/custom_fields/general.field_format') }}
</label>
@ -168,6 +168,17 @@
});
}).change();
// If the element is a radiobutton, doesn't show the format input box
$(".field_element").change(function(){
$(this).find("option:selected").each(function(){
if (($(this).attr("value") != "radio")){
$("#format_values").show();
} else{
$("#format_values").hide();
}
});
}).change();
// Only display the field element if the type is not text
$(".field_element").change(function(){
$(this).find("option:selected").each(function(){

View file

@ -10,7 +10,15 @@
@stop
@section('header_right')
<a href="{{ route('depreciations.edit', ['depreciation' => $depreciation->id]) }}" class="btn btn-sm btn-primary pull-right">{{ trans('admin/depreciations/table.update') }} </a>
<div class="btn-group pull-right">
<button class="btn btn-default dropdown-toggle" data-toggle="dropdown">{{ trans('button.actions') }}
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li><a href="{{ route('depreciations.edit', ['depreciation' => $depreciation->id]) }}">{{ trans('general.update') }}</a></li>
<li><a href="{{ route('depreciations.create') }}">{{ trans('general.create') }}</a></li>
</ul>
</div>
@stop
{{-- Page content --}}

View file

@ -27,6 +27,17 @@
</div>
@endforeach
@elseif ($field->element=='radio')
@foreach ($field->formatFieldValuesAsArray() as $value)
<div>
<label>
<input type="radio" value="{{ $value }}" name="{{ $field->db_column_name() }}" class="minimal" {{ isset($item) ? ($item->{$field->db_column_name()} == $value ? ' checked="checked"' : '') : (Request::old($field->db_column_name()) != '' ? ' checked="checked"' : '') }}>
{{ $value }}
</label>
</div>
@endforeach
@endif