mirror of
https://github.com/snipe/snipe-it.git
synced 2025-03-05 20:52:15 -08:00
Changed layout, added fieldsets
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
6cd3cfe1ea
commit
67212f9d57
|
@ -1,8 +1,9 @@
|
||||||
@php
|
@extends('layouts/default', [
|
||||||
use App\Models\CustomField;
|
'helpText' => trans('admin/custom_fields/general.about_fieldsets_text'),
|
||||||
@endphp
|
'helpPosition' => 'right',
|
||||||
|
'topSubmit' => true,
|
||||||
|
])
|
||||||
|
|
||||||
@extends('layouts/default')
|
|
||||||
|
|
||||||
{{-- Page title --}}
|
{{-- Page title --}}
|
||||||
@section('title')
|
@section('title')
|
||||||
|
@ -21,8 +22,6 @@
|
||||||
{{-- Page content --}}
|
{{-- Page content --}}
|
||||||
@section('content')
|
@section('content')
|
||||||
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-9">
|
|
||||||
<!-- Horizontal Form -->
|
<!-- Horizontal Form -->
|
||||||
@if ($field->id)
|
@if ($field->id)
|
||||||
{{ Form::open(['route' => ['fields.update', $field->id], 'class'=>'form-horizontal']) }}
|
{{ Form::open(['route' => ['fields.update', $field->id], 'class'=>'form-horizontal']) }}
|
||||||
|
@ -31,14 +30,20 @@
|
||||||
{{ Form::open(['route' => 'fields.store', 'class'=>'form-horizontal']) }}
|
{{ Form::open(['route' => 'fields.store', 'class'=>'form-horizontal']) }}
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
|
@csrf
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
<div class="box box-default">
|
<div class="box box-default">
|
||||||
<div class="box-body">
|
<div class="box-body">
|
||||||
|
|
||||||
|
<div class="col-md-8">
|
||||||
|
|
||||||
<!-- Name -->
|
<!-- Name -->
|
||||||
<div class="form-group {{ $errors->has('name') ? ' has-error' : '' }}">
|
<div class="form-group {{ $errors->has('name') ? ' has-error' : '' }}">
|
||||||
<label for="name" class="col-md-4 control-label">
|
<label for="name" class="col-md-3 control-label">
|
||||||
{{ trans('admin/custom_fields/general.field_name') }}
|
{{ trans('admin/custom_fields/general.field_name') }}
|
||||||
</label>
|
</label>
|
||||||
<div class="col-md-6 required">
|
<div class="col-md-8 required">
|
||||||
{{ Form::text('name', old('name', $field->name), array('class' => 'form-control', 'aria-label'=>'name')) }}
|
{{ Form::text('name', old('name', $field->name), array('class' => 'form-control', 'aria-label'=>'name')) }}
|
||||||
{!! $errors->first('name', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
|
{!! $errors->first('name', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
|
||||||
</div>
|
</div>
|
||||||
|
@ -46,10 +51,10 @@
|
||||||
|
|
||||||
<!-- Element Type -->
|
<!-- Element Type -->
|
||||||
<div class="form-group {{ $errors->has('element') ? ' has-error' : '' }}">
|
<div class="form-group {{ $errors->has('element') ? ' has-error' : '' }}">
|
||||||
<label for="element" class="col-md-4 control-label">
|
<label for="element" class="col-md-3 control-label">
|
||||||
{{ trans('admin/custom_fields/general.field_element') }}
|
{{ trans('admin/custom_fields/general.field_element') }}
|
||||||
</label>
|
</label>
|
||||||
<div class="col-md-6 required">
|
<div class="col-md-8 required">
|
||||||
|
|
||||||
{!! Form::customfield_elements('element', old('element', $field->element), 'field_element select2 form-control') !!}
|
{!! Form::customfield_elements('element', old('element', $field->element), 'field_element select2 form-control') !!}
|
||||||
{!! $errors->first('element', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
|
{!! $errors->first('element', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
|
||||||
|
@ -59,10 +64,10 @@
|
||||||
|
|
||||||
<!-- Element values -->
|
<!-- Element values -->
|
||||||
<div class="form-group {{ $errors->has('field_values') ? ' has-error' : '' }}" id="field_values_text" style="display:none;">
|
<div class="form-group {{ $errors->has('field_values') ? ' has-error' : '' }}" id="field_values_text" style="display:none;">
|
||||||
<label for="field_values" class="col-md-4 control-label">
|
<label for="field_values" class="col-md-3 control-label">
|
||||||
{{ trans('admin/custom_fields/general.field_values') }}
|
{{ trans('admin/custom_fields/general.field_values') }}
|
||||||
</label>
|
</label>
|
||||||
<div class="col-md-6 required">
|
<div class="col-md-8 required">
|
||||||
{!! Form::textarea('field_values', old('name', $field->field_values), ['style' => 'width: 100%', 'rows' => 4, 'class' => 'form-control', 'aria-label'=>'field_values']) !!}
|
{!! Form::textarea('field_values', old('name', $field->field_values), ['style' => 'width: 100%', 'rows' => 4, 'class' => 'form-control', 'aria-label'=>'field_values']) !!}
|
||||||
{!! $errors->first('field_values', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
|
{!! $errors->first('field_values', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
|
||||||
<p class="help-block">{{ trans('admin/custom_fields/general.field_values_help') }}</p>
|
<p class="help-block">{{ trans('admin/custom_fields/general.field_values_help') }}</p>
|
||||||
|
@ -71,7 +76,7 @@
|
||||||
|
|
||||||
<!-- Format -->
|
<!-- Format -->
|
||||||
<div class="form-group {{ $errors->has('format') ? ' has-error' : '' }}" id="format_values">
|
<div class="form-group {{ $errors->has('format') ? ' has-error' : '' }}" id="format_values">
|
||||||
<label for="format" class="col-md-4 control-label">
|
<label for="format" class="col-md-3 control-label">
|
||||||
{{ trans('admin/custom_fields/general.field_format') }}
|
{{ trans('admin/custom_fields/general.field_format') }}
|
||||||
</label>
|
</label>
|
||||||
@php
|
@php
|
||||||
|
@ -80,17 +85,17 @@
|
||||||
$field_format = 'CUSTOM REGEX';
|
$field_format = 'CUSTOM REGEX';
|
||||||
}
|
}
|
||||||
@endphp
|
@endphp
|
||||||
<div class="col-md-6 required">
|
<div class="col-md-8 required">
|
||||||
{{ Form::select("format",Helper::predefined_formats(), ($field_format == '') ? $field->format : $field_format, array('class'=>'format select2 form-control', 'aria-label'=>'format')) }}
|
{{ Form::select("format",Helper::predefined_formats(), ($field_format == '') ? $field->format : $field_format, array('class'=>'format select2 form-control', 'aria-label'=>'format')) }}
|
||||||
{!! $errors->first('format', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
|
{!! $errors->first('format', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- Custom Format -->
|
<!-- Custom Format -->
|
||||||
<div class="form-group {{ $errors->has('custom_format') ? ' has-error' : '' }}" id="custom_regex" style="display:none;">
|
<div class="form-group {{ $errors->has('custom_format') ? ' has-error' : '' }}" id="custom_regex" style="display:none;">
|
||||||
<label for="custom_format" class="col-md-4 control-label">
|
<label for="custom_format" class="col-md-3 control-label">
|
||||||
{{ trans('admin/custom_fields/general.field_custom_format') }}
|
{{ trans('admin/custom_fields/general.field_custom_format') }}
|
||||||
</label>
|
</label>
|
||||||
<div class="col-md-6 required">
|
<div class="col-md-8 required">
|
||||||
{{ Form::text('custom_format', old('custom_format', (($field->format!='') && (stripos($field->format,'regex')===0)) ? $field->format : ''), array('class' => 'form-control', 'id' => 'custom_format','aria-label'=>'custom_format', 'placeholder'=>'regex:/^[0-9]{15}$/')) }}
|
{{ Form::text('custom_format', old('custom_format', (($field->format!='') && (stripos($field->format,'regex')===0)) ? $field->format : ''), array('class' => 'form-control', 'id' => 'custom_format','aria-label'=>'custom_format', 'placeholder'=>'regex:/^[0-9]{15}$/')) }}
|
||||||
<p class="help-block">{!! trans('admin/custom_fields/general.field_custom_format_help') !!}</p>
|
<p class="help-block">{!! trans('admin/custom_fields/general.field_custom_format_help') !!}</p>
|
||||||
|
|
||||||
|
@ -101,26 +106,36 @@
|
||||||
|
|
||||||
<!-- Help Text -->
|
<!-- Help Text -->
|
||||||
<div class="form-group {{ $errors->has('help_text') ? ' has-error' : '' }}">
|
<div class="form-group {{ $errors->has('help_text') ? ' has-error' : '' }}">
|
||||||
<label for="help_text" class="col-md-4 control-label">
|
<label for="help_text" class="col-md-3 control-label">
|
||||||
{{ trans('admin/custom_fields/general.help_text') }}
|
{{ trans('admin/custom_fields/general.help_text') }}
|
||||||
</label>
|
</label>
|
||||||
<div class="col-md-6">
|
<div class="col-md-8">
|
||||||
{{ Form::text('help_text', old('help_text', $field->help_text), array('class' => 'form-control', 'aria-label'=>'help_text')) }}
|
{{ Form::text('help_text', old('help_text', $field->help_text), array('class' => 'form-control', 'aria-label'=>'help_text')) }}
|
||||||
<p class="help-block">{{ trans('admin/custom_fields/general.help_text_description') }}</p>
|
<p class="help-block">{{ trans('admin/custom_fields/general.help_text_description') }}</p>
|
||||||
{!! $errors->first('help_text', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
|
{!! $errors->first('help_text', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- Auto-Add to Future Fieldsets -->
|
||||||
|
<div class="form-group {{ $errors->has('auto_add_to_fieldsets') ? ' has-error' : '' }}" id="auto_add_to_fieldsets">
|
||||||
|
<div class="col-md-8 col-md-offset-3">
|
||||||
|
<label class="form-control">
|
||||||
|
<input type="checkbox" name="auto_add_to_fieldsets" aria-label="auto_add_to_fieldsets" value="1"{{ (old('auto_add_to_fieldsets') || $field->auto_add_to_fieldsets) ? ' checked="checked"' : '' }}>
|
||||||
|
{{ trans('admin/custom_fields/general.auto_add_to_fieldsets') }}
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
@if (!$field->id)
|
@if (!$field->id)
|
||||||
<!-- Encrypted -->
|
<!-- Encrypted -->
|
||||||
<div class="form-group {{ $errors->has('encrypted') ? ' has-error' : '' }}">
|
<div class="form-group {{ $errors->has('encrypted') ? ' has-error' : '' }}">
|
||||||
<div class="col-md-8 col-md-offset-4">
|
<div class="col-md-8 col-md-offset-3">
|
||||||
<label class="form-control">
|
<label class="form-control">
|
||||||
<input type="checkbox" value="1" name="field_encrypted" id="field_encrypted"{{ (Request::old('field_encrypted') || $field->field_encrypted) ? ' checked="checked"' : '' }}>
|
<input type="checkbox" value="1" name="field_encrypted" id="field_encrypted"{{ (Request::old('field_encrypted') || $field->field_encrypted) ? ' checked="checked"' : '' }}>
|
||||||
{{ trans('admin/custom_fields/general.encrypt_field') }}
|
{{ trans('admin/custom_fields/general.encrypt_field') }}
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6 col-md-offset-4" id="encrypt_warning" style="display:none;">
|
<div class="col-md-8 col-md-offset-3" id="encrypt_warning" style="display:none;">
|
||||||
|
|
||||||
<div class="callout callout-danger">
|
<div class="callout callout-danger">
|
||||||
<p><i class="fas fa-exclamation-triangle" aria-hidden="true"></i> {{ trans('admin/custom_fields/general.encrypt_field_help') }}</p>
|
<p><i class="fas fa-exclamation-triangle" aria-hidden="true"></i> {{ trans('admin/custom_fields/general.encrypt_field_help') }}</p>
|
||||||
|
@ -131,7 +146,7 @@
|
||||||
|
|
||||||
<!-- Show in Email -->
|
<!-- Show in Email -->
|
||||||
<div class="form-group {{ $errors->has('show_in_email') ? ' has-error' : '' }}" id="show_in_email">
|
<div class="form-group {{ $errors->has('show_in_email') ? ' has-error' : '' }}" id="show_in_email">
|
||||||
<div class="col-md-8 col-md-offset-4">
|
<div class="col-md-8 col-md-offset-3">
|
||||||
<label class="form-control">
|
<label class="form-control">
|
||||||
<input type="checkbox" name="show_in_email" aria-label="show_in_email" value="1"{{ (old('show_in_email') || $field->show_in_email) ? ' checked="checked"' : '' }}>
|
<input type="checkbox" name="show_in_email" aria-label="show_in_email" value="1"{{ (old('show_in_email') || $field->show_in_email) ? ' checked="checked"' : '' }}>
|
||||||
{{ trans('admin/custom_fields/general.show_in_email') }}
|
{{ trans('admin/custom_fields/general.show_in_email') }}
|
||||||
|
@ -142,7 +157,7 @@
|
||||||
|
|
||||||
<!-- Show in View All Assets profile view -->
|
<!-- Show in View All Assets profile view -->
|
||||||
<div class="form-group {{ $errors->has('display_in_user_view') ? ' has-error' : '' }}" id="display_in_user_view">
|
<div class="form-group {{ $errors->has('display_in_user_view') ? ' has-error' : '' }}" id="display_in_user_view">
|
||||||
<div class="col-md-8 col-md-offset-4">
|
<div class="col-md-8 col-md-offset-3">
|
||||||
<label class="form-control">
|
<label class="form-control">
|
||||||
<input type="checkbox" name="display_in_user_view" aria-label="display_in_user_view" value="1" {{ (old('display_in_user_view') || $field->display_in_user_view) ? ' checked="checked"' : '' }}>
|
<input type="checkbox" name="display_in_user_view" aria-label="display_in_user_view" value="1" {{ (old('display_in_user_view') || $field->display_in_user_view) ? ' checked="checked"' : '' }}>
|
||||||
{{ trans('admin/custom_fields/general.display_in_user_view') }}
|
{{ trans('admin/custom_fields/general.display_in_user_view') }}
|
||||||
|
@ -153,16 +168,58 @@
|
||||||
|
|
||||||
<!-- Value Must be Unique -->
|
<!-- Value Must be Unique -->
|
||||||
<div class="form-group {{ $errors->has('is_unique') ? ' has-error' : '' }}" id="is_unique">
|
<div class="form-group {{ $errors->has('is_unique') ? ' has-error' : '' }}" id="is_unique">
|
||||||
<div class="col-md-8 col-md-offset-4">
|
<div class="col-md-8 col-md-offset-3">
|
||||||
<label class="form-control">
|
<label class="form-control">
|
||||||
<input type="checkbox" name="is_unique" aria-label="is_unique" value="1"{{ (old('is_unique') || $field->is_unique) ? ' checked="checked"' : '' }}>
|
<input type="checkbox" name="is_unique" aria-label="is_unique" value="1"{{ (old('is_unique') || $field->is_unique) ? ' checked="checked"' : '' }}>
|
||||||
{{ trans('admin/custom_fields/general.is_unique') }}
|
{{ trans('admin/custom_fields/general.is_unique') }}
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@if ($fieldsets->count() > 0)
|
||||||
|
<!-- begin fieldset columns -->
|
||||||
|
<div class="col-md-4">
|
||||||
|
|
||||||
|
<h4>{{ trans('admin/custom_fields/general.fieldsets') }}</h4>
|
||||||
|
{!! $errors->first('associate_fieldsets', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
|
||||||
|
|
||||||
|
<label class="form-control">
|
||||||
|
<input type="checkbox" id="checkAll">
|
||||||
|
{{ trans('general.select_all') }}
|
||||||
|
</label>
|
||||||
|
|
||||||
|
@foreach ($fieldsets as $fieldset)
|
||||||
|
@php
|
||||||
|
$array_fieldname = 'associate_fieldsets.'.$fieldset->id;
|
||||||
|
|
||||||
|
// Consider the form data first
|
||||||
|
if (old($array_fieldname) == $fieldset->id) {
|
||||||
|
$checked = 'checked';
|
||||||
|
// Otherwise check DB
|
||||||
|
} elseif (isset($field->fieldset) && ($field->fieldset->contains($fieldset->id))) {
|
||||||
|
$checked = 'checked';
|
||||||
|
} else {
|
||||||
|
$checked = '';
|
||||||
|
}
|
||||||
|
@endphp
|
||||||
|
|
||||||
|
<label class="form-control{{ $errors->has('associate_fieldsets.'.$fieldset->id) ? ' has-error' : '' }}">
|
||||||
|
<input type="checkbox"
|
||||||
|
name="associate_fieldsets[{{ $fieldset->id }}]"
|
||||||
|
class="fieldset"
|
||||||
|
value="{{ $fieldset->id }}"
|
||||||
|
{{ $checked }}>
|
||||||
|
{{ $fieldset->name }}
|
||||||
|
{!! $errors->first('associate_fieldsets.'.$fieldset->id, '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
|
||||||
|
|
||||||
|
</label>
|
||||||
|
|
||||||
|
@endforeach
|
||||||
|
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
</div> <!-- /.box-body-->
|
</div> <!-- /.box-body-->
|
||||||
|
|
||||||
<div class="box-footer text-right">
|
<div class="box-footer text-right">
|
||||||
|
@ -171,20 +228,22 @@
|
||||||
|
|
||||||
</div> <!--.box.box-default-->
|
</div> <!--.box.box-default-->
|
||||||
|
|
||||||
{{ Form::close() }}
|
|
||||||
</div> <!--/.col-md-9-->
|
</div> <!--/.col-md-9-->
|
||||||
|
|
||||||
<div class="col-md-3">
|
|
||||||
<h2>{{ trans('admin/custom_fields/general.about_custom_fields_title') }}</h2>
|
|
||||||
<p>{{ trans('admin/custom_fields/general.about_custom_fields_text') }}</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
{{ Form::close() }}
|
||||||
@stop
|
@stop
|
||||||
|
|
||||||
@section('moar_scripts')
|
@section('moar_scripts')
|
||||||
<script nonce="{{ csrf_token() }}">
|
<script nonce="{{ csrf_token() }}">
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
|
|
||||||
|
$("#checkAll").change(function () {
|
||||||
|
$(".fieldset").prop('checked', $(this).prop("checked"));
|
||||||
|
});
|
||||||
|
|
||||||
// Only display the custom format field if it's a custom format validation type
|
// Only display the custom format field if it's a custom format validation type
|
||||||
$(".format").change(function(){
|
$(".format").change(function(){
|
||||||
$(this).find("option:selected").each(function(){
|
$(this).find("option:selected").each(function(){
|
||||||
|
|
Loading…
Reference in a new issue