mirror of
https://github.com/snipe/snipe-it.git
synced 2025-02-21 03:15:45 -08:00
Custom fields additions
This commit is contained in:
parent
ad22293f4b
commit
f38912a5cf
|
@ -237,7 +237,7 @@ class Helper
|
||||||
{
|
{
|
||||||
$keys=array_keys(CustomField::$PredefinedFormats);
|
$keys=array_keys(CustomField::$PredefinedFormats);
|
||||||
$stuff=array_combine($keys, $keys);
|
$stuff=array_combine($keys, $keys);
|
||||||
return $stuff+["" => "Custom Format..."];
|
return $stuff+["custom" => "Custom Format..."];
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function barcodeDimensions($barcode_type = 'QRCODE')
|
public static function barcodeDimensions($barcode_type = 'QRCODE')
|
||||||
|
|
|
@ -28,10 +28,9 @@
|
||||||
|
|
||||||
<!-- 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">{{ trans('admin/custom_fields/general.field_name') }}
|
<label for="name" class="col-md-4 control-label">{{ trans('admin/custom_fields/general.field_name') }} </label>
|
||||||
<i class='fa fa-asterisk'></i></label>
|
|
||||||
</label>
|
</label>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6 required">
|
||||||
<input class="form-control" type="text" name="name" id="name" value="{{ Input::old('name') }}" />
|
<input class="form-control" type="text" name="name" id="name" value="{{ Input::old('name') }}" />
|
||||||
{!! $errors->first('name', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
|
{!! $errors->first('name', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
|
||||||
</div>
|
</div>
|
||||||
|
@ -39,12 +38,11 @@
|
||||||
|
|
||||||
<!-- Type -->
|
<!-- 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">{{ trans('admin/custom_fields/general.field_element') }}
|
<label for="element" class="col-md-4 control-label">{{ trans('admin/custom_fields/general.field_element') }}</label>
|
||||||
<i class='fa fa-asterisk'></i></label>
|
|
||||||
</label>
|
</label>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6 required">
|
||||||
|
|
||||||
{{ Form::select("element",["text" => "Text Box"],"text", array('class'=>'select2 form-control')) }}
|
{!! Form::customfield_elements('customfield_element', Input::old('customfield_element'), 'select2 form-control') !!}
|
||||||
|
|
||||||
{!! $errors->first('element', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
|
{!! $errors->first('element', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
|
||||||
</div>
|
</div>
|
||||||
|
@ -52,17 +50,16 @@
|
||||||
|
|
||||||
<!-- Format -->
|
<!-- Format -->
|
||||||
<div class="form-group {{ $errors->has('format') ? ' has-error' : '' }}">
|
<div class="form-group {{ $errors->has('format') ? ' has-error' : '' }}">
|
||||||
<label for="format" class="col-md-4 control-label">{{ trans('admin/custom_fields/general.field_format') }}
|
<label for="format" class="col-md-4 control-label">{{ trans('admin/custom_fields/general.field_format') }}</label>
|
||||||
<i class='fa fa-asterisk'></i></label>
|
|
||||||
</label>
|
</label>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6 required">
|
||||||
{{ Form::select("format",\App\Helpers\Helper::predefined_formats(),"ANY", array('class'=>'select2 form-control')) }}
|
{{ Form::select("format",\App\Helpers\Helper::predefined_formats(),"ANY", array('class'=>'format select2 form-control')) }}
|
||||||
{!! $errors->first('format', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
|
{!! $errors->first('format', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Custom Format -->
|
<!-- Custom Format -->
|
||||||
<div class="form-group {{ $errors->has('custom_format') ? ' has-error' : '' }}">
|
<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">{{ trans('admin/custom_fields/general.field_custom_format') }}
|
<label for="custom_format" class="col-md-4 control-label">{{ trans('admin/custom_fields/general.field_custom_format') }}
|
||||||
</label>
|
</label>
|
||||||
</label>
|
</label>
|
||||||
|
@ -91,4 +88,23 @@
|
||||||
<p>Custom fields allow you to add arbitrary attributes to assets.</p>
|
<p>Custom fields allow you to add arbitrary attributes to assets.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@section('moar_scripts')
|
||||||
|
<script>
|
||||||
|
|
||||||
|
$(document).ready(function(){
|
||||||
|
$(".format").change(function(){
|
||||||
|
$(this).find("option:selected").each(function(){
|
||||||
|
console.warn($(this).attr("value"));
|
||||||
|
if($(this).attr("value")=="custom"){
|
||||||
|
$("#custom_regex").show();
|
||||||
|
} else{
|
||||||
|
$("#custom_regex").hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}).change();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
@stop
|
||||||
|
|
||||||
|
|
||||||
@stop
|
@stop
|
||||||
|
|
Loading…
Reference in a new issue