Added UI elements for is_unique

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe 2022-02-16 13:47:48 -08:00
parent a4a0aa5124
commit 824eedf7c2
3 changed files with 15 additions and 0 deletions

View file

@ -92,6 +92,7 @@ class CustomFieldsController extends Controller
"field_values" => $request->get("field_values"),
"field_encrypted" => $request->get("field_encrypted", 0),
"show_in_email" => $request->get("show_in_email", 0),
"is_unique" => $request->get("is_unique", 0),
"user_id" => Auth::id()
]);
@ -211,6 +212,7 @@ class CustomFieldsController extends Controller
$field->user_id = Auth::id();
$field->help_text = $request->get("help_text");
$field->show_in_email = $request->get("show_in_email", 0);
$field->is_unique = $request->get("is_unique", 0);
if ($request->get('format') == 'CUSTOM REGEX') {
$field->format = e($request->get('custom_format'));

View file

@ -116,6 +116,17 @@
</div>
<!-- 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>
@if (!$field->id)
<!-- Encrypted -->

View file

@ -129,6 +129,7 @@
<th data-searchable="true">{{ trans('general.name') }}</th>
<th data-searchable="true">{{ trans('admin/custom_fields/general.help_text')}}</th>
<th data-searchable="true">{{ trans('general.email') }}</th>
<th data-searchable="true">{{ trans('admin/custom_fields/general.unique') }}</th>
<th data-visible="false">{{ trans('admin/custom_fields/general.db_field') }}</th>
<th data-searchable="true">{{ trans('admin/custom_fields/general.field_format') }}</th>
<th data-searchable="true">{{ trans('admin/custom_fields/general.field_element_short') }}</th>
@ -142,6 +143,7 @@
<td>{{ $field->name }}</td>
<td>{{ $field->help_text }}</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->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)