ok
This commit is contained in:
@ -0,0 +1,336 @@
|
||||
@extends('layouts/default', [
|
||||
'helpText' => trans('admin/custom_fields/general.about_fieldsets_text'),
|
||||
'helpPosition' => 'right',
|
||||
])
|
||||
|
||||
|
||||
{{-- Page title --}}
|
||||
@section('title')
|
||||
{{ trans('admin/custom_fields/general.custom_fields') }}
|
||||
@parent
|
||||
@stop
|
||||
|
||||
@section('content')
|
||||
|
||||
@section('header_right')
|
||||
<a href="{{ route('fields.index') }}" class="btn btn-primary pull-right">
|
||||
{{ trans('general.back') }}</a>
|
||||
@stop
|
||||
|
||||
|
||||
{{-- Page content --}}
|
||||
@section('content')
|
||||
|
||||
<!-- Horizontal Form -->
|
||||
@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
|
||||
|
||||
@csrf
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="box box-default">
|
||||
<div class="box-header with-border text-right">
|
||||
<button type="submit" class="btn btn-primary"> {{ trans('general.save') }}</button>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
|
||||
<div class="col-md-8">
|
||||
|
||||
<!-- Name -->
|
||||
<div class="form-group {{ $errors->has('name') ? ' has-error' : '' }}">
|
||||
<label for="name" class="col-md-3 control-label">
|
||||
{{ trans('admin/custom_fields/general.field_name') }}
|
||||
</label>
|
||||
<div class="col-md-8 required">
|
||||
{{ 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>') !!}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Element Type -->
|
||||
<div class="form-group {{ $errors->has('element') ? ' has-error' : '' }}">
|
||||
<label for="element" class="col-md-3 control-label">
|
||||
{{ trans('admin/custom_fields/general.field_element') }}
|
||||
</label>
|
||||
<div class="col-md-8 required">
|
||||
|
||||
{!! 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>') !!}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Element values -->
|
||||
<div class="form-group {{ $errors->has('field_values') ? ' has-error' : '' }}" id="field_values_text" style="display:none;">
|
||||
<label for="field_values" class="col-md-3 control-label">
|
||||
{{ trans('admin/custom_fields/general.field_values') }}
|
||||
</label>
|
||||
<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']) !!}
|
||||
{!! $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>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Format -->
|
||||
<div class="form-group {{ $errors->has('format') ? ' has-error' : '' }}" id="format_values">
|
||||
<label for="format" class="col-md-3 control-label">
|
||||
{{ trans('admin/custom_fields/general.field_format') }}
|
||||
</label>
|
||||
@php
|
||||
$field_format = '';
|
||||
if (stripos($field->format, 'regex') === 0){
|
||||
$field_format = 'CUSTOM REGEX';
|
||||
}
|
||||
@endphp
|
||||
<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', 'style' => 'width:100%;')) }}
|
||||
{!! $errors->first('format', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
|
||||
</div>
|
||||
</div>
|
||||
<!-- Custom Format -->
|
||||
<div class="form-group {{ $errors->has('custom_format') ? ' has-error' : '' }}" id="custom_regex" style="display:none;">
|
||||
<label for="custom_format" class="col-md-3 control-label">
|
||||
{{ trans('admin/custom_fields/general.field_custom_format') }}
|
||||
</label>
|
||||
<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}$/')) }}
|
||||
<p class="help-block">{!! trans('admin/custom_fields/general.field_custom_format_help') !!}</p>
|
||||
|
||||
{!! $errors->first('custom_format', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Help Text -->
|
||||
<div class="form-group {{ $errors->has('help_text') ? ' has-error' : '' }}">
|
||||
<label for="help_text" class="col-md-3 control-label">
|
||||
{{ trans('admin/custom_fields/general.help_text') }}
|
||||
</label>
|
||||
<div class="col-md-8">
|
||||
{{ 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>
|
||||
{!! $errors->first('help_text', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Set up checkbox form group -->
|
||||
<div class="form-group">
|
||||
|
||||
<!-- Encrypted warning callout box -->
|
||||
@if (($field->id) && ($field->field_encrypted=='1'))
|
||||
<div class="col-md-9 col-md-offset-3">
|
||||
<div class="alert alert-warning fade in">
|
||||
<i class="fas fa-exclamation-triangle faa-pulse animated"></i>
|
||||
<strong>{{ trans('general.notification_warning') }}:</strong>
|
||||
{{ trans('admin/custom_fields/general.encrypted_options') }}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@if (!$field->id)
|
||||
<!-- Encrypted -->
|
||||
<div class="col-md-9 col-md-offset-3" id="encryption_section">
|
||||
<label class="form-control">
|
||||
<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') }}
|
||||
</label>
|
||||
</div>
|
||||
<div class="col-md-9 col-md-offset-3" id="encrypt_warning" style="display:none;">
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
|
||||
|
||||
<!-- Auto-Add to Future Fieldsets -->
|
||||
<div class="col-md-9 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>
|
||||
|
||||
<!-- Show in list view -->
|
||||
<div class="col-md-9 col-md-offset-3">
|
||||
<label class="form-control">
|
||||
<input type="checkbox" name="show_in_listview" aria-label="show_in_listview" value="1"{{ (old('show_in_listview') || $field->show_in_listview) ? ' checked="checked"' : '' }}>
|
||||
{{ trans('admin/custom_fields/general.show_in_listview') }}
|
||||
</label>
|
||||
</div>
|
||||
|
||||
|
||||
@if ((!$field->id) || ($field->field_encrypted=='0'))
|
||||
|
||||
<!-- Show in requestable list view -->
|
||||
<div class="col-md-9 col-md-offset-3" id="show_in_requestable_list">
|
||||
<label class="form-control">
|
||||
<input type="checkbox" name="show_in_requestable_list" aria-label="show_in_requestable_list" value="1"{{ (old('show_in_requestable_list') || $field->show_in_requestable_list) ? ' checked="checked"' : '' }}>
|
||||
{{ trans('admin/custom_fields/general.show_in_requestable_list') }}
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<!-- Show in Email -->
|
||||
<div class="col-md-9 col-md-offset-3" id="show_in_email">
|
||||
<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"' : '' }}>
|
||||
{{ trans('admin/custom_fields/general.show_in_email') }}
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<!-- Value Must be Unique -->
|
||||
<div class="col-md-9 col-md-offset-3" id="is_unique">
|
||||
<label class="form-control">
|
||||
<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') }}
|
||||
</label>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<!-- Show in View All Assets profile view -->
|
||||
<div class="col-md-9 col-md-offset-3" id="display_in_user_view">
|
||||
<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"' : '' }}>
|
||||
{{ trans('admin/custom_fields/general.display_in_user_view') }}
|
||||
</label>
|
||||
</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 class="box-footer text-right">
|
||||
<button type="submit" class="btn btn-primary"> {{ trans('general.save') }}</button>
|
||||
</div>
|
||||
|
||||
</div> <!--.box.box-default-->
|
||||
|
||||
|
||||
</div> <!--/.col-md-9-->
|
||||
|
||||
|
||||
</div>
|
||||
{{ Form::close() }}
|
||||
@stop
|
||||
|
||||
@section('moar_scripts')
|
||||
<script nonce="{{ csrf_token() }}">
|
||||
$(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
|
||||
$(".format").change(function(){
|
||||
$(this).find("option:selected").each(function(){
|
||||
if ($('.format').prop("selectedIndex") == 1) {
|
||||
$("#custom_regex").show();
|
||||
} else{
|
||||
$("#custom_regex").hide();
|
||||
}
|
||||
});
|
||||
}).change();
|
||||
|
||||
// If the element is a radiobutton/checkbox, doesn't show the format input box
|
||||
$(".field_element").change(function(){
|
||||
$(this).find("option:selected").each(function(){
|
||||
if (($(this).attr("value") != "radio") && ($(this).attr("value") != "checkbox")){
|
||||
$("#format_values").show();
|
||||
} else{
|
||||
$("#format_values").hide();
|
||||
}
|
||||
});
|
||||
}).change();
|
||||
|
||||
// Only display the field element if the type is not text
|
||||
// and don't display encryption option for checkbox or radio
|
||||
$(".field_element").change(function(){
|
||||
$(this).find("option:selected").each(function(){
|
||||
if (($(this).attr("value")!="text") && ($(this).attr("value")!="textarea")){
|
||||
$("#field_values_text").show();
|
||||
if ($(this).attr("value") == "checkbox" || $(this).attr("value") == "radio") {
|
||||
$("#encryption_section").hide();
|
||||
}
|
||||
} else{
|
||||
$("#encryption_section").show();
|
||||
$("#field_values_text").hide();
|
||||
}
|
||||
});
|
||||
}).change();
|
||||
});
|
||||
|
||||
|
||||
$("#field_encrypted").change(function() {
|
||||
if (this.checked) {
|
||||
$("#encrypt_warning").show();
|
||||
$("#show_in_email").hide();
|
||||
$("#display_in_user_view").hide();
|
||||
$("#is_unique").hide();
|
||||
$("#show_in_requestable_list").hide();
|
||||
} else {
|
||||
$("#encrypt_warning").hide();
|
||||
$("#show_in_email").show();
|
||||
$("#display_in_user_view").show();
|
||||
$("#is_unique").show();
|
||||
$("#show_in_requestable_list").show();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
@stop
|
@ -0,0 +1,17 @@
|
||||
@extends('layouts/edit-form', [
|
||||
'createText' => trans('admin/custom_fields/general.create_fieldset') ,
|
||||
'updateText' => trans('admin/custom_fields/general.update_fieldset'),
|
||||
'helpText' => trans('admin/custom_fields/general.about_fieldsets_text'),
|
||||
'helpPosition' => 'right',
|
||||
'formAction' => (isset($item->id)) ? route('fieldsets.update', ['fieldset' => $item->id]) : route('fieldsets.store'),
|
||||
])
|
||||
|
||||
@section('content')
|
||||
@parent
|
||||
@stop
|
||||
|
||||
@section('inputFields')
|
||||
@include ('partials.forms.edit.name', ['translated_name' => trans('general.name')])
|
||||
@stop
|
||||
|
||||
|
@ -0,0 +1,177 @@
|
||||
@extends('layouts/default')
|
||||
|
||||
{{-- Page title --}}
|
||||
@section('title')
|
||||
{{ trans('admin/custom_fields/general.custom_fields') }}
|
||||
@parent
|
||||
@stop
|
||||
|
||||
@section('header_right')
|
||||
<a href="{{ route('fields.index') }}" class="btn btn-primary pull-right">
|
||||
{{ trans('general.back') }}</a>
|
||||
@stop
|
||||
|
||||
@section('content')
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="box box-default">
|
||||
<div class="box-header with-border">
|
||||
<h2 class="box-title">{{ $custom_fieldset->name }} {{ trans('admin/custom_fields/general.fieldset') }}</h2>
|
||||
<div class="box-tools pull-right">
|
||||
</div>
|
||||
</div><!-- /.box-header -->
|
||||
<div class="box-body">
|
||||
<table
|
||||
name="fieldsets" id="sort" class="table table-responsive todo-list">
|
||||
<thead>
|
||||
<tr>
|
||||
{{-- Hide the sorting handle if we can't update the fieldset --}}
|
||||
@can('update', $custom_fieldset)
|
||||
<th class="col-md-1"><span class="sr-only">{{ trans('admin/custom_fields/general.reorder') }}</span></th>
|
||||
@endcan
|
||||
<th class="col-md-1" style="display: none;">{{ trans('admin/custom_fields/general.order') }}</th>
|
||||
<th class="col-md-3">{{ trans('admin/custom_fields/general.field_name') }}</th>
|
||||
<th class="col-md-2">{{ trans('admin/custom_fields/general.field_format') }}</th>
|
||||
<th class="col-md-2">{{ trans('admin/custom_fields/general.field_element') }}</th>
|
||||
<th class="col-md-1">{{ trans('admin/custom_fields/general.encrypted') }}</th>
|
||||
<th class="col-md-1">{{ trans('admin/custom_fields/general.required') }}</th>
|
||||
<th class="col-md-1"><span class="sr-only">{{ trans('button.remove') }}</span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($custom_fieldset->fields as $field)
|
||||
<tr class="{{ Auth::user()->can('update', $custom_fieldset)?'cansort':'' }}" data-index="{{ $field->pivot->custom_field_id }}" id="item_{{ $field->pivot->custom_field_id }}">
|
||||
{{-- Hide the sorting handle if we can't update the fieldset --}}
|
||||
@can('update', $custom_fieldset)
|
||||
<td>
|
||||
<!-- drag handle -->
|
||||
<span class="handle">
|
||||
<i class="fas fa-ellipsis-v"></i>
|
||||
<i class="fas fa-ellipsis-v"></i>
|
||||
</span>
|
||||
</td>
|
||||
@endcan
|
||||
<td class="index" style="display: none;">{{$field->pivot->order + 1}}</td> {{--this +1 needs to exist to keep the first row from reverting to 0 if you edit/delete fields in/from a fielset--}}
|
||||
<td>{{$field->name}}</td>
|
||||
<td>{{$field->format}}</td>
|
||||
<td>{{$field->element}}</td>
|
||||
<td>{{ $field->field_encrypted=='1' ? trans('general.yes') : trans('general.no') }}</td>
|
||||
<td>
|
||||
|
||||
@if ($field->pivot->required)
|
||||
<form method="post" action="{{ route('fields.optional', [$custom_fieldset->id, $field->id]) }}">
|
||||
@csrf
|
||||
<button type="submit" class="btn btn-link"><i class="fa fa-check text-success" aria-hidden="true"></i></button>
|
||||
</form>
|
||||
|
||||
@else
|
||||
|
||||
<form method="post" action="{{ route('fields.required', [$custom_fieldset->id, $field->id]) }}">
|
||||
@csrf
|
||||
<button type="submit" class="btn btn-link"><i class="fa fa-times text-danger" aria-hidden="true"></i></button>
|
||||
</form>
|
||||
@endif
|
||||
|
||||
</td>
|
||||
<td>
|
||||
@can('update', $custom_fieldset)
|
||||
<form method="post" action="{{ route('fields.disassociate', [$field, $custom_fieldset->id]) }}">
|
||||
@csrf
|
||||
<button type="submit" class="btn btn-sm btn-danger"><i class="fa fa-trash icon-white" aria-hidden="true"></i></button>
|
||||
</form>
|
||||
@endcan
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
@can('update', $custom_fieldset)
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="8">
|
||||
{{ Form::open(['route' =>
|
||||
["fieldsets.associate",$custom_fieldset->id],
|
||||
'class'=>'form-inline',
|
||||
'id' => 'ordering']) }}
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<label for="field_id" class="sr-only">
|
||||
{{ trans('admin/custom-field/general.add_field_to_fieldset')}}
|
||||
</label>
|
||||
{{ Form::select("field_id",$custom_fields_list,"",['aria-label'=>'field_id', 'class'=>'select2', 'style' => 'min-width:400px;']) }}
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-group" style="display: none;">
|
||||
{{ Form::text('order', $maxid, array('aria-label'=>'order', 'maxlength'=>'3', 'size'=>'3')) }}
|
||||
<label for="order">{{ trans('admin/custom_fields/general.order') }}</label>
|
||||
</div>
|
||||
|
||||
<div class="checkbox-inline">
|
||||
<label>
|
||||
{{ Form::checkbox('required', 'on', old('required')) }}
|
||||
<span style="padding-left: 10px;">{{ trans('admin/custom_fields/general.required') }}</span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<span style="padding-left: 10px;">
|
||||
<button type="submit" class="btn btn-primary"> {{ trans('general.save') }}</button>
|
||||
</span>
|
||||
|
||||
{{ Form::close() }}
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
@endcan
|
||||
</table>
|
||||
</div> <!-- /.box-body-->
|
||||
</div> <!-- /.box.box-default-->
|
||||
</div> <!-- /.col-md-12-->
|
||||
</div> <!--/.row-->
|
||||
|
||||
@stop
|
||||
|
||||
@push('js')
|
||||
@can('update', $custom_fieldset)
|
||||
|
||||
<script nonce="{{ csrf_token() }}">
|
||||
var fixHelperModified = function(e, tr) {
|
||||
var $originals = tr.children();
|
||||
var $helper = tr.clone();
|
||||
$helper.children().each(function(index) {
|
||||
$(this).width($originals.eq(index).width())
|
||||
});
|
||||
return $helper;
|
||||
},
|
||||
updateIndex = function(e, ui) {
|
||||
$('td.index', ui.item.parent()).each(function (i) {
|
||||
$(this).html(i + 1);
|
||||
$.ajax({
|
||||
method: "POST",
|
||||
url: "{{ route('api.customfields.order', $custom_fieldset->id) }}",
|
||||
headers: {
|
||||
"X-Requested-With": 'XMLHttpRequest',
|
||||
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr('content')
|
||||
},
|
||||
data: $("#sort tbody").sortable('serialize', {
|
||||
}),
|
||||
|
||||
success: function(data) {
|
||||
//console.log('ajax fired');
|
||||
// do some stuff here
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
// this uses the jquery UI sortable method, NOT the query-dragtable library
|
||||
$("#sort tbody").sortable({
|
||||
helper: fixHelperModified,
|
||||
stop: updateIndex
|
||||
}).disableSelection();
|
||||
</script>
|
||||
@endcan
|
||||
@endpush
|
@ -0,0 +1,235 @@
|
||||
@extends('layouts/default', [
|
||||
'helpText' => trans('admin/custom_fields/general.about_fieldsets_text'),
|
||||
'helpPosition' => 'right',
|
||||
])
|
||||
|
||||
|
||||
{{-- Page title --}}
|
||||
@section('title')
|
||||
{{ trans('admin/custom_fields/general.manage') }} {{ trans('admin/custom_fields/general.custom_fields') }}
|
||||
@parent
|
||||
@stop
|
||||
|
||||
@section('content')
|
||||
|
||||
@can('view', \App\Models\CustomFieldset::class)
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="box box-default">
|
||||
|
||||
<div class="box-header with-border">
|
||||
<h2 class="box-title">{{ trans('admin/custom_fields/general.fieldsets') }}</h2>
|
||||
<div class="box-tools pull-right">
|
||||
@can('create', \App\Models\CustomFieldset::class)
|
||||
<a href="{{ route('fieldsets.create') }}" class="btn btn-sm btn-primary" data-tooltip="true" title="{{ trans('admin/custom_fields/general.create_fieldset_title') }}">{{ trans('admin/custom_fields/general.create_fieldset') }}</a>
|
||||
@endcan
|
||||
</div>
|
||||
</div><!-- /.box-header -->
|
||||
|
||||
<div class="box-body">
|
||||
<table
|
||||
data-cookie-id-table="customFieldsetsTable"
|
||||
data-id-table="customFieldsetsTable"
|
||||
data-search="true"
|
||||
data-side-pagination="client"
|
||||
data-show-columns="true"
|
||||
data-show-export="true"
|
||||
data-show-refresh="true"
|
||||
data-sort-order="asc"
|
||||
data-sort-name="name"
|
||||
id="customFieldsTable"
|
||||
class="table table-striped snipe-table"
|
||||
data-export-options='{
|
||||
"fileName": "export-fieldsets-{{ date('Y-m-d') }}",
|
||||
"ignoreColumn": ["actions","image","change","checkbox","checkincheckout","icon"]
|
||||
}'>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{ trans('general.name') }}</th>
|
||||
<th>{{ trans('admin/custom_fields/general.qty_fields') }}</th>
|
||||
<th>{{ trans('admin/custom_fields/general.used_by_models') }}</th>
|
||||
<th>{{ trans('table.actions') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
@if(isset($custom_fieldsets))
|
||||
<tbody>
|
||||
@foreach($custom_fieldsets AS $fieldset)
|
||||
<tr>
|
||||
<td>
|
||||
{{ link_to_route("fieldsets.show",$fieldset->name,['fieldset' => $fieldset->id]) }}
|
||||
</td>
|
||||
<td>
|
||||
{{ $fieldset->fields->count() }}
|
||||
</td>
|
||||
<td>
|
||||
@foreach($fieldset->models as $model)
|
||||
<a href="{{ route('models.show', $model->id) }}" class="label label-default">{{ $model->name }}{{ ($model->model_number) ? ' ('.$model->model_number.')' : '' }}</a>
|
||||
|
||||
@endforeach
|
||||
</td>
|
||||
<td>
|
||||
|
||||
<nobr>
|
||||
|
||||
@can('update', $fieldset)
|
||||
|
||||
<a href="{{ route('fieldsets.show', ['fieldset' => $fieldset->id]) }}" data-tooltip="true" title="{{ trans('general.edit_fieldset') }}">
|
||||
<button type="submit" class="btn btn-info btn-sm">
|
||||
<i class="fa-regular fa-rectangle-list"></i>
|
||||
</button>
|
||||
</a>
|
||||
|
||||
<a href="{{ route('fieldsets.edit', $fieldset->id) }}" class="btn btn-warning btn-sm" data-tooltip="true" title="{{ trans('general.update') }}">
|
||||
<i class="fas fa-pencil-alt" aria-hidden="true"></i>
|
||||
<span class="sr-only">{{ trans('button.edit') }}</span>
|
||||
</a>
|
||||
@endcan
|
||||
|
||||
@can('delete', $fieldset)
|
||||
{{ Form::open(['route' => array('fieldsets.destroy', $fieldset->id), 'method' => 'delete','style' => 'display:inline-block']) }}
|
||||
@if($fieldset->models->count() > 0)
|
||||
<button type="submit" class="btn btn-danger btn-sm disabled" data-tooltip="true" title="{{ trans('general.cannot_be_deleted') }}" disabled><i class="fas fa-trash"></i></button>
|
||||
@else
|
||||
<button type="submit" class="btn btn-danger btn-sm" data-tooltip="true" title="{{ trans('general.delete') }}"><i class="fas fa-trash"></i></button>
|
||||
@endif
|
||||
{{ Form::close() }}
|
||||
@endcan
|
||||
</nobr>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
@endif
|
||||
</table>
|
||||
</div><!-- /.box-body -->
|
||||
</div><!-- /.box.box-default -->
|
||||
|
||||
</div> <!-- .col-md-12-->
|
||||
|
||||
|
||||
</div> <!-- .row-->
|
||||
@endcan
|
||||
@can('view', \App\Models\CustomField::class)
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="box box-default">
|
||||
<div class="box-header with-border">
|
||||
<h2 class="box-title">{{ trans('admin/custom_fields/general.custom_fields') }}</h2>
|
||||
<div class="box-tools pull-right">
|
||||
@can('create', \App\Models\CustomField::class)
|
||||
<a href="{{ route('fields.create') }}" class="btn btn-sm btn-primary" data-tooltip="true" title="{{ trans('admin/custom_fields/general.create_field_title') }}">{{ trans('admin/custom_fields/general.create_field') }}</a>
|
||||
@endcan
|
||||
</div>
|
||||
|
||||
</div><!-- /.box-header -->
|
||||
<div class="box-body">
|
||||
|
||||
<div class="table-responsive">
|
||||
<table
|
||||
data-cookie-id-table="customFieldsTable"
|
||||
data-id-table="customFieldsTable"
|
||||
data-search="true"
|
||||
data-side-pagination="client"
|
||||
data-show-columns="true"
|
||||
data-show-export="true"
|
||||
data-show-refresh="true"
|
||||
data-sort-order="asc"
|
||||
data-sort-name="name"
|
||||
id="customFieldsTable"
|
||||
class="table table-striped snipe-table"
|
||||
data-export-options='{
|
||||
"fileName": "export-fields-{{ date('Y-m-d') }}",
|
||||
"ignoreColumn": ["actions","image","change","checkbox","checkincheckout","icon"]
|
||||
}'>
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-sortable="true" data-searchable="true">{{ trans('general.name') }}</th>
|
||||
<th data-sortable="true" data-searchable="true">{{ trans('admin/custom_fields/general.help_text')}}</th>
|
||||
<th data-sortable="true" data-searchable="true">{{ trans('admin/custom_fields/general.unique') }}</th>
|
||||
<th data-sortable="true" data-visible="false">{{ trans('admin/custom_fields/general.db_field') }}</th>
|
||||
<th data-sortable="true" data-searchable="true">{{ trans('admin/custom_fields/general.field_format') }}</th>
|
||||
<th data-sortable="true"><i class="fa fa-lock" aria-hidden="true"></i>
|
||||
<span class="hidden-xs hidden-sm hidden-md hidden-lg">{{ trans('admin/custom_fields/general.encrypted') }}</span>
|
||||
</th>
|
||||
<th data-sortable="true" class="text-center"><i class="fa fa-list" aria-hidden="true"></i>
|
||||
<span class="hidden-xs hidden-sm hidden-md hidden-lg">{{ trans('admin/custom_fields/general.show_in_listview_short') }}</span>
|
||||
</th>
|
||||
<th data-visible="false" data-sortable="true" class="text-center"><i class="fa fa-eye" aria-hidden="true"><span class="sr-only">Visible to User</span></i></th>
|
||||
<th data-sortable="true" data-searchable="true" class="text-center"><i class="fa fa-envelope" aria-hidden="true"><span class="sr-only">{{ trans('admin/custom_fields/general.show_in_email_short') }}</span></i></th>
|
||||
<th data-sortable="true" data-searchable="true" class="text-center"><i class="fa fa-laptop fa-fw" aria-hidden="true"><span class="sr-only">{{ trans('admin/custom_fields/general.show_in_requestable_list_short') }}</span></i></th>
|
||||
<th data-sortable="true" data-searchable="true" class="text-center"><i class="fa-solid fa-fingerprint"><span class="sr-only">{{ trans('admin/custom_fields/general.unique') }}</span></i></th>
|
||||
<th data-sortable="true" data-searchable="true" class="text-center">{{ trans('admin/custom_fields/general.field_element_short') }}</th>
|
||||
<th data-searchable="true">{{ trans('admin/custom_fields/general.fieldsets') }}</th>
|
||||
<th>{{ trans('button.actions') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($custom_fields as $field)
|
||||
<tr>
|
||||
<td>{{ $field->name }}</td>
|
||||
<td>{{ $field->help_text }}</td>
|
||||
|
||||
<td class="text-center">{!! ($field->is_unique=='1') ? '<i class="fas fa-check text-success" aria-hidden="true"><span class="sr-only">'.trans('general.yes').'</span></i>' : '<i class="fas fa-times text-danger" aria-hidden="true"><span class="sr-only">'.trans('general.no').'</span></i>' !!}</td>
|
||||
<td>
|
||||
<code>{{ $field->convertUnicodeDbSlug() }}</code>
|
||||
@if ($field->convertUnicodeDbSlug()!=$field->db_column)
|
||||
<br><i class="fas fa-exclamation-triangle text-danger"></i>
|
||||
{!! trans('admin/custom_fields/general.db_convert_warning',['db_column' => $field->db_column, 'expected' => $field->convertUnicodeDbSlug()]) !!}
|
||||
@endif
|
||||
</td>
|
||||
<td>{{ $field->format }}</td>
|
||||
<td class="text-center">{!! ($field->field_encrypted=='1' ? '<i class="fa fa-check text-success"></i>' : '<i class="fa fa-times text-danger"></i>') !!}</td>
|
||||
<td class="text-center">{!! ($field->show_in_listview=='1' ? '<i class="fa fa-check text-success"></i>' : '<i class="fa fa-times text-danger"></i>') !!}</td>
|
||||
<td class="text-center">{!! ($field->display_in_user_view=='1' ? '<i class="fa fa-check text-success"></i>' : '<i class="fa fa-times text-danger"></i>') !!}</td>
|
||||
<td class="text-center">{!! ($field->show_in_email=='1') ? '<i class="fas fa-check text-success" aria-hidden="true"><span class="sr-only">'.trans('general.yes').'</span></i>' : '<i class="fas fa-times text-danger" aria-hidden="true"><span class="sr-only">'.trans('general.no').'</span></i>' !!}</td>
|
||||
<td class="text-center">{!! ($field->show_in_requestable_list=='1') ? '<i class="fas fa-check text-success" aria-hidden="true"><span class="sr-only">'.trans('general.yes').'</span></i>' : '<i class="fas fa-times text-danger" aria-hidden="true"><span class="sr-only">'.trans('general.no').'</span></i>' !!}</td>
|
||||
<td class="text-center">{!! ($field->is_unique=='1') ? '<i class="fas fa-check text-success" aria-hidden="true"><span class="sr-only">'.trans('general.yes').'</span></i>' : '<i class="fas fa-times text-danger" aria-hidden="true"><span class="sr-only">'.trans('general.no').'</span></i>' !!}</td>
|
||||
<td>{{ $field->element }}</td>
|
||||
<td>
|
||||
@foreach($field->fieldset as $fieldset)
|
||||
<a href="{{ route('fieldsets.show', $fieldset->id) }}" class="label label-default">{{ $fieldset->name }}</a>
|
||||
@endforeach
|
||||
</td>
|
||||
<td>
|
||||
<nobr>
|
||||
{{ Form::open(array('route' => array('fields.destroy', $field->id), 'method' => 'delete', 'style' => 'display:inline-block')) }}
|
||||
@can('update', $field)
|
||||
<a href="{{ route('fields.edit', $field->id) }}" class="btn btn-warning btn-sm" data-tooltip="true" title="{{ trans('general.update') }}">
|
||||
<i class="fas fa-pencil-alt" aria-hidden="true"></i>
|
||||
<span class="sr-only">{{ trans('button.edit') }}</span>
|
||||
</a>
|
||||
@endcan
|
||||
|
||||
@can('delete', $field)
|
||||
|
||||
@if($field->fieldset->count()>0)
|
||||
<button type="submit" class="btn btn-danger btn-sm disabled" data-tooltip="true" title="{{ trans('general.cannot_be_deleted') }}" disabled>
|
||||
<i class="fas fa-trash" aria-hidden="true"></i>
|
||||
<span class="sr-only">{{ trans('button.delete') }}</span></button>
|
||||
@else
|
||||
<button type="submit" class="btn btn-danger btn-sm" data-tooltip="true" title="{{ trans('general.delete') }}">
|
||||
<i class="fas fa-trash" aria-hidden="true"></i>
|
||||
<span class="sr-only">{{ trans('button.delete') }}</span>
|
||||
</button>
|
||||
@endif
|
||||
|
||||
@endcan
|
||||
{{ Form::close() }}
|
||||
</nobr>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div><!-- /.box-body -->
|
||||
</div><!-- /.box -->
|
||||
</div> <!-- /.col-md-9-->
|
||||
</div>
|
||||
@endcan
|
||||
|
||||
@stop
|
||||
@section('moar_scripts')
|
||||
@include ('partials.bootstrap-table')
|
||||
@stop
|
Reference in New Issue
Block a user