2018-12-06 20:05:04 -08:00
|
|
|
@php
|
|
|
|
use App\Models\CustomField;
|
|
|
|
@endphp
|
|
|
|
|
2016-03-25 01:18:05 -07:00
|
|
|
@extends('layouts/default')
|
2018-12-06 20:05:04 -08:00
|
|
|
|
2016-03-25 01:18:05 -07:00
|
|
|
{{-- Page title --}}
|
|
|
|
@section('title')
|
2017-01-25 04:31:18 -08:00
|
|
|
{{ trans('admin/custom_fields/general.custom_fields') }}
|
2016-03-25 01:18:05 -07:00
|
|
|
@parent
|
|
|
|
@stop
|
|
|
|
|
|
|
|
@section('content')
|
|
|
|
|
|
|
|
@section('header_right')
|
2017-01-25 04:31:18 -08:00
|
|
|
<a href="{{ route('fields.index') }}" class="btn btn-primary pull-right">
|
2016-03-25 01:18:05 -07:00
|
|
|
{{ trans('general.back') }}</a>
|
|
|
|
@stop
|
|
|
|
|
|
|
|
|
|
|
|
{{-- Page content --}}
|
|
|
|
@section('content')
|
|
|
|
|
|
|
|
<div class="row">
|
2016-12-27 12:03:47 -08:00
|
|
|
<div class="col-md-9">
|
|
|
|
<!-- Horizontal Form -->
|
2017-01-25 04:31:18 -08:00
|
|
|
@if ($field->id)
|
|
|
|
{{ Form::open(['route' => ['fields.update', $field->id], 'class'=>'form-horizontal']) }}
|
|
|
|
{{ method_field('PUT') }}
|
|
|
|
@else
|
|
|
|
{{ Form::open(['route' => 'fields.store', 'class'=>'form-horizontal']) }}
|
|
|
|
@endif
|
|
|
|
|
2016-03-25 01:18:05 -07:00
|
|
|
<div class="box box-default">
|
|
|
|
<div class="box-body">
|
|
|
|
<!-- Name -->
|
|
|
|
<div class="form-group {{ $errors->has('name') ? ' has-error' : '' }}">
|
2016-12-27 12:03:47 -08:00
|
|
|
<label for="name" class="col-md-4 control-label">
|
|
|
|
{{ trans('admin/custom_fields/general.field_name') }}
|
|
|
|
</label>
|
|
|
|
<div class="col-md-6 required">
|
2020-04-21 03:58:31 -07:00
|
|
|
{{ Form::text('name', old('name', $field->name), array('class' => 'form-control', 'aria-label'=>'name')) }}
|
2021-09-26 01:11:08 -07:00
|
|
|
{!! $errors->first('name', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
|
2016-12-27 12:03:47 -08:00
|
|
|
</div>
|
2016-03-25 01:18:05 -07:00
|
|
|
</div>
|
|
|
|
|
2016-08-25 16:36:00 -07:00
|
|
|
<!-- Element Type -->
|
2016-03-25 01:18:05 -07:00
|
|
|
<div class="form-group {{ $errors->has('element') ? ' has-error' : '' }}">
|
2016-12-27 12:03:47 -08:00
|
|
|
<label for="element" class="col-md-4 control-label">
|
|
|
|
{{ trans('admin/custom_fields/general.field_element') }}
|
|
|
|
</label>
|
|
|
|
<div class="col-md-6 required">
|
2016-03-25 01:18:05 -07:00
|
|
|
|
2020-04-21 03:58:31 -07:00
|
|
|
{!! Form::customfield_elements('element', old('element', $field->element), 'field_element select2 form-control') !!}
|
2021-09-26 01:11:08 -07:00
|
|
|
{!! $errors->first('element', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
|
2016-03-25 01:18:05 -07:00
|
|
|
|
2016-12-27 12:03:47 -08:00
|
|
|
</div>
|
2016-03-25 01:18:05 -07:00
|
|
|
</div>
|
|
|
|
|
2016-12-27 12:03:47 -08:00
|
|
|
<!-- Element values -->
|
2021-03-31 14:02:25 -07:00
|
|
|
<div class="form-group {{ $errors->has('field_values') ? ' has-error' : '' }}" id="field_values_text" style="display:none;">
|
2016-12-27 12:03:47 -08:00
|
|
|
<label for="field_values" class="col-md-4 control-label">
|
|
|
|
{{ trans('admin/custom_fields/general.field_values') }}
|
|
|
|
</label>
|
|
|
|
<div class="col-md-6 required">
|
2020-04-21 03:58:31 -07:00
|
|
|
{!! Form::textarea('field_values', old('name', $field->field_values), ['style' => 'width: 100%', 'rows' => 4, 'class' => 'form-control', 'aria-label'=>'field_values']) !!}
|
2021-09-26 01:11:08 -07:00
|
|
|
{!! $errors->first('field_values', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
|
2016-12-27 12:03:47 -08:00
|
|
|
<p class="help-block">{{ trans('admin/custom_fields/general.field_values_help') }}</p>
|
2016-08-25 16:36:00 -07:00
|
|
|
</div>
|
2016-12-27 12:03:47 -08:00
|
|
|
</div>
|
2016-08-25 16:36:00 -07:00
|
|
|
|
2016-03-25 01:18:05 -07:00
|
|
|
<!-- Format -->
|
2021-01-27 14:41:58 -08:00
|
|
|
<div class="form-group {{ $errors->has('format') ? ' has-error' : '' }}" id="format_values">
|
2016-12-27 12:03:47 -08:00
|
|
|
<label for="format" class="col-md-4 control-label">
|
|
|
|
{{ trans('admin/custom_fields/general.field_format') }}
|
|
|
|
</label>
|
|
|
|
<div class="col-md-6 required">
|
2021-09-28 19:44:55 -07:00
|
|
|
{{ Form::select("format",Helper::predefined_formats(), $field->format, array('class'=>'format select2 form-control', 'aria-label'=>'format')) }}
|
2021-09-26 01:11:08 -07:00
|
|
|
{!! $errors->first('format', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
|
2016-12-27 12:03:47 -08:00
|
|
|
</div>
|
2016-03-25 01:18:05 -07:00
|
|
|
</div>
|
|
|
|
<!-- Custom Format -->
|
2016-08-23 18:52:54 -07:00
|
|
|
<div class="form-group {{ $errors->has('custom_format') ? ' has-error' : '' }}" id="custom_regex" style="display:none;">
|
2016-12-27 12:03:47 -08:00
|
|
|
<label for="custom_format" class="col-md-4 control-label">
|
|
|
|
{{ trans('admin/custom_fields/general.field_custom_format') }}
|
|
|
|
</label>
|
|
|
|
<div class="col-md-6 required">
|
2020-04-21 03:58:31 -07:00
|
|
|
{{ 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}$/')) }}
|
2017-11-04 17:06:14 -07:00
|
|
|
<p class="help-block">{!! trans('admin/custom_fields/general.field_custom_format_help') !!}</p>
|
|
|
|
|
2021-09-26 01:11:08 -07:00
|
|
|
{!! $errors->first('custom_format', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
|
2017-11-27 22:10:46 -08:00
|
|
|
|
2016-12-27 12:03:47 -08:00
|
|
|
</div>
|
2016-03-25 01:18:05 -07:00
|
|
|
</div>
|
|
|
|
|
2017-01-26 04:52:11 -08:00
|
|
|
<!-- Help Text -->
|
|
|
|
<div class="form-group {{ $errors->has('help_text') ? ' has-error' : '' }}">
|
|
|
|
<label for="help_text" class="col-md-4 control-label">
|
2021-11-02 03:27:53 -07:00
|
|
|
{{ trans('admin/custom_fields/general.help_text') }}
|
2017-01-26 04:52:11 -08:00
|
|
|
</label>
|
|
|
|
<div class="col-md-6">
|
2020-04-21 03:58:31 -07:00
|
|
|
{{ Form::text('help_text', old('help_text', $field->help_text), array('class' => 'form-control', 'aria-label'=>'help_text')) }}
|
2021-11-02 03:27:53 -07:00
|
|
|
<p class="help-block">{{ trans('admin/custom_fields/general.help_text_description') }}</p>
|
2021-09-26 01:11:08 -07:00
|
|
|
{!! $errors->first('help_text', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
|
2017-01-26 04:52:11 -08:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2018-05-03 08:06:28 -07:00
|
|
|
<!-- 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">
|
2018-07-09 14:51:17 -07:00
|
|
|
<label for="show_in_email">
|
2020-04-21 03:58:31 -07:00
|
|
|
<input type="checkbox" name="show_in_email" aria-label="show_in_email" value="1" class="minimal"{{ (old('show_in_email') || $field->show_in_email) ? ' checked="checked"' : '' }}>
|
2018-05-03 08:06:28 -07:00
|
|
|
{{ trans('admin/custom_fields/general.show_in_email') }}
|
|
|
|
</label>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
2022-11-08 07:27:59 -08:00
|
|
|
<!-- 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="col-md-8 col-md-offset-4">
|
|
|
|
<label for="display_in_user_view">
|
|
|
|
<input type="checkbox" name="display_in_user_view" aria-label="display_in_user_view" value="1" class="minimal"{{ (old('display_in_user_view') || $field->display_in_user_view) ? ' checked="checked"' : '' }}>
|
|
|
|
{{ trans('admin/custom_fields/general.display_in_user_view') }}
|
|
|
|
</label>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
2022-02-16 13:47:48 -08:00
|
|
|
<!-- Value Must be Unique -->
|
|
|
|
<div class="form-group {{ $errors->has('is_unique') ? ' has-error' : '' }}" id="is_unique">
|
|
|
|
<div class="col-md-8 col-md-offset-4">
|
|
|
|
<label for="is_unique">
|
|
|
|
<input type="checkbox" name="is_unique" aria-label="is_unique" value="1" class="minimal"{{ (old('is_unique') || $field->is_unique) ? ' checked="checked"' : '' }}>
|
|
|
|
{{ trans('admin/custom_fields/general.is_unique') }}
|
|
|
|
</label>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
2017-01-26 04:52:11 -08:00
|
|
|
|
|
|
|
@if (!$field->id)
|
2018-12-06 20:05:04 -08:00
|
|
|
<!-- Encrypted -->
|
|
|
|
<div class="form-group {{ $errors->has('encrypted') ? ' has-error' : '' }}">
|
|
|
|
<div class="col-md-8 col-md-offset-4">
|
|
|
|
<label for="field_encrypted">
|
2019-12-10 19:32:50 -08:00
|
|
|
<input type="checkbox" value="1" name="field_encrypted" id="field_encrypted" class="minimal"{{ (Request::old('field_encrypted') || $field->field_encrypted) ? ' checked="checked"' : '' }}>
|
2018-12-06 20:05:04 -08:00
|
|
|
{{ trans('admin/custom_fields/general.encrypt_field') }}
|
|
|
|
</label>
|
|
|
|
</div>
|
|
|
|
<div class="col-md-6 col-md-offset-4" id="encrypt_warning" style="display:none;">
|
2018-03-25 13:46:57 -07:00
|
|
|
|
2016-12-27 12:03:47 -08:00
|
|
|
<div class="callout callout-danger">
|
2021-09-24 07:21:30 -07:00
|
|
|
<p><i class="fas fa-exclamation-triangle" aria-hidden="true"></i> {{ trans('admin/custom_fields/general.encrypt_field_help') }}</p>
|
2016-12-27 12:03:47 -08:00
|
|
|
</div>
|
|
|
|
</div>
|
2018-12-06 20:05:04 -08:00
|
|
|
</div>
|
|
|
|
@endif
|
2016-12-27 12:03:47 -08:00
|
|
|
|
|
|
|
</div> <!-- /.box-body-->
|
2018-12-06 20:05:04 -08:00
|
|
|
|
2016-12-27 12:03:47 -08:00
|
|
|
<div class="box-footer text-right">
|
2020-04-01 01:26:44 -07:00
|
|
|
<button type="submit" class="btn btn-primary"> {{ trans('general.save') }}</button>
|
2016-12-27 12:03:47 -08:00
|
|
|
</div>
|
2018-12-06 20:05:04 -08:00
|
|
|
|
2016-12-27 12:03:47 -08:00
|
|
|
</div> <!--.box.box-default-->
|
2018-12-06 20:05:04 -08:00
|
|
|
|
2017-01-18 04:58:31 -08:00
|
|
|
{{ Form::close() }}
|
2016-12-27 12:03:47 -08:00
|
|
|
</div> <!--/.col-md-9-->
|
2018-12-06 20:05:04 -08:00
|
|
|
|
2016-12-27 12:03:47 -08:00
|
|
|
<div class="col-md-3">
|
2021-11-02 03:27:53 -07:00
|
|
|
<h2>{{ trans('admin/custom_fields/general.about_custom_fields_title') }}</h2>
|
|
|
|
<p>{{ trans('admin/custom_fields/general.about_custom_fields_text') }}</p>
|
2016-03-25 01:18:05 -07:00
|
|
|
</div>
|
2018-12-06 20:05:04 -08:00
|
|
|
|
2016-03-25 01:18:05 -07:00
|
|
|
</div>
|
2016-12-27 12:03:47 -08:00
|
|
|
@stop
|
2016-03-25 01:18:05 -07:00
|
|
|
|
2016-08-23 18:52:54 -07:00
|
|
|
@section('moar_scripts')
|
2017-09-28 19:45:15 -07:00
|
|
|
<script nonce="{{ csrf_token() }}">
|
2016-12-27 12:03:47 -08:00
|
|
|
$(document).ready(function(){
|
|
|
|
// Only display the custom format field if it's a custom format validation type
|
|
|
|
$(".format").change(function(){
|
|
|
|
$(this).find("option:selected").each(function(){
|
2018-06-21 09:35:04 -07:00
|
|
|
if ($('.format').prop("selectedIndex") == 1) {
|
2016-12-27 12:03:47 -08:00
|
|
|
$("#custom_regex").show();
|
|
|
|
} else{
|
|
|
|
$("#custom_regex").hide();
|
|
|
|
}
|
2016-08-23 18:52:54 -07:00
|
|
|
});
|
2016-12-27 12:03:47 -08:00
|
|
|
}).change();
|
|
|
|
|
2021-02-16 17:20:29 -08:00
|
|
|
// If the element is a radiobutton/checkbox, doesn't show the format input box
|
2021-01-27 14:41:58 -08:00
|
|
|
$(".field_element").change(function(){
|
|
|
|
$(this).find("option:selected").each(function(){
|
2021-02-16 17:20:29 -08:00
|
|
|
if (($(this).attr("value") != "radio") && ($(this).attr("value") != "checkbox")){
|
2021-01-27 14:41:58 -08:00
|
|
|
$("#format_values").show();
|
|
|
|
} else{
|
|
|
|
$("#format_values").hide();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}).change();
|
|
|
|
|
2016-12-27 12:03:47 -08:00
|
|
|
// Only display the field element if the type is not text
|
|
|
|
$(".field_element").change(function(){
|
|
|
|
$(this).find("option:selected").each(function(){
|
2018-06-21 09:35:04 -07:00
|
|
|
if (($(this).attr("value")!="text") && ($(this).attr("value")!="textarea")){
|
2016-12-27 12:03:47 -08:00
|
|
|
$("#field_values_text").show();
|
|
|
|
} else{
|
|
|
|
$("#field_values_text").hide();
|
|
|
|
}
|
2016-08-25 16:36:00 -07:00
|
|
|
});
|
2016-12-27 12:03:47 -08:00
|
|
|
}).change();
|
|
|
|
});
|
2016-08-25 16:36:00 -07:00
|
|
|
|
2016-12-27 12:03:47 -08:00
|
|
|
// Checkbox handling
|
2017-08-09 18:40:45 -07:00
|
|
|
$('#field_encrypted').on('ifChecked', function(event){
|
2016-12-27 12:03:47 -08:00
|
|
|
$("#encrypt_warning").show();
|
2018-03-25 13:46:57 -07:00
|
|
|
$("#show_in_email").hide();
|
2022-11-10 09:56:50 -08:00
|
|
|
$("#display_in_user_view").hide();
|
2016-12-27 12:03:47 -08:00
|
|
|
});
|
2016-08-23 18:52:54 -07:00
|
|
|
|
2017-08-09 18:40:45 -07:00
|
|
|
$('#field_encrypted').on('ifUnchecked', function(event){
|
2016-12-27 12:03:47 -08:00
|
|
|
$("#encrypt_warning").hide();
|
2018-03-25 13:46:57 -07:00
|
|
|
$("#show_in_email").show();
|
2022-11-10 09:56:50 -08:00
|
|
|
$("#display_in_user_view").show();
|
2016-12-27 12:03:47 -08:00
|
|
|
});
|
2016-08-23 18:52:54 -07:00
|
|
|
|
2016-12-27 12:03:47 -08:00
|
|
|
</script>
|
2016-03-25 01:18:05 -07:00
|
|
|
@stop
|