Skip to content

A free open source IT asset/license management system

Added strings

sniped903555c4291
diff --git a/resources/lang/en-US/admin/custom_fields/general.php b/resources/lang/en-US/admin/custom_fields/general.php
index 0c716b1a63..4c9a409b80 100644
--- a/resources/lang/en-US/admin/custom_fields/general.php
+++ b/resources/lang/en-US/admin/custom_fields/general.php
@@ -20,6 +20,13 @@ return [
'field_element' => 'Form Element',
'field_element_short' => 'Element',
'field_format' => 'Format',
+ 'field_format_help' => 'Determines the validation rules that are applied.',
+ 'field_element_help' => 'Determines the UI element displayed in the form.',
+ 'format_any_with_date_picker_help' => 'Pairing a date/datetime picker with the ANY/NONE format is useful when the field needs to be encrypted (encrypted fields must be stored as text). Otherwise the DATE or DATETIME format is recommended for better sorting and validation.',
+ 'encrypt_disabled_for_date_format' => 'DATE and DATETIME formats cannot be encrypted because they are stored in native date columns, which only accept valid date values.',
+ 'format_locked_for_native_column' => 'The format cannot be changed on an existing :format field. It is backed by a native database column and would need a schema change to convert.',
+ 'date_picker_widget' => 'Date picker',
+ 'datetime_picker_widget' => 'Datetime picker',
'field_custom_format' => 'Custom Regex Format',
'field_custom_format_help' => 'This field allows you to use a regex expression for validation. It should start with "regex:" - for example, to validate that a custom field value contains a valid IMEI (15 numeric digits), you would use <code>regex:/^[0-9]{15}$/</code>.',
'required' => 'Required',
@@ -67,6 +74,8 @@ return [
'markdown-textarea' => 'Markdown Textarea',
'checkbox' => 'Checkbox',
'radio' => 'Radio Buttons',
+ 'date_picker' => 'Date Picker',
+ 'datetime_picker' => 'Datetime Picker',
],
'general_help_text' => 'Custom fields store additional information not covered by the default asset fields. <a href="https://snipe-it.readme.io/docs/custom-fields#/"><i class="fa fa-external-link"></i></a>.',
];
diff --git a/resources/views/custom_fields/fields/edit.blade.php b/resources/views/custom_fields/fields/edit.blade.php
index 1f3be4ce0e..3f40bf6dfc 100644
--- a/resources/views/custom_fields/fields/edit.blade.php
+++ b/resources/views/custom_fields/fields/edit.blade.php
@@ -3,355 +3,296 @@
'helpPosition' => 'right',
])
-
-{{-- Page title --}}
@section('title')
- {{ trans('admin/custom_fields/general.custom_fields') }}
-@parent
+ {{ trans('admin/custom_fields/general.custom_fields') }}
+ @parent
@stop
-{{-- Page content --}}
@section('content')
- <!-- Horizontal Form -->
- @if ($field->id)
- <form method="POST" action="{{ route('fields.update', $field->id) }}" accept-charset="UTF-8" class="form-horizontal">
- {{ method_field('PUT') }}
- @else
- <form method="POST" action="{{ route('fields.store') }}" accept-charset="UTF-8" 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">
- <input class="form-control" aria-label="name" name="name" type="text" required value="{{ old('name', $field->name) }}">
- <x-form.error name="name" />
- </div>
- </div>
-
- @php
- $field_format = '';
- if (stripos($field->format, 'regex') === 0){
- $field_format = 'CUSTOM REGEX';
- }
- // DATE / DATETIME fields are backed by native DATE / DATETIME
- // columns on the assets table AND always render via the
- // datepicker widgets, so we lock BOTH the format dropdown and
- // the element dropdown once the field exists as DATE/DATETIME.
- $format_locked = $field->exists && in_array($field->format, ['DATE', 'DATETIME'], true);
- // When creating a new field, the format hasn't been chosen yet;
- // JS ($('.format').change) reveals/hides the element block based
- // on the selected format at runtime. Server-side we still
- // enforce (element = text) when saving with DATE/DATETIME.
- @endphp
-
- <!-- 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>
- <div class="col-md-8 required">
- <x-input.select
- name="format"
- :options="Helper::predefined_formats()"
- :selected="($field_format == '') ? $field->format : $field_format"
- class="format form-control"
- style="width:100%"
- aria-label="format"
- :disabled="$format_locked"
- />
- @if ($format_locked)
- <input type="hidden" name="format" value="{{ $field->format }}">
- <x-form.help name="format-locked">
- {{ trans('admin/custom_fields/general.format_locked_for_native_column', ['format' => $field->format]) }}
- </x-form.help>
- @else
- <x-form.help name="format">
- {{ trans('admin/custom_fields/general.field_format_help') }}
- </x-form.help>
- @endif
- {{-- Shown by JS when element is date_picker / datetime_picker AND format is ANY.
- Explains the encryption use case for that combo. Component
- renders id="format_picker_note-help" — matched by the JS
- toggle in updateFormatPickerNote(). --}}
- <x-form.help name="format_picker_note" style="display:none;">
- {{ trans('admin/custom_fields/general.format_any_with_date_picker_help') }}
- </x-form.help>
- <x-form.error name="format" />
- </div>
- </div>
-
- <!-- Element Type -->
- <div class="form-group {{ $errors->has('element') ? ' has-error' : '' }}" id="element_row">
- <label for="element" class="col-md-3 control-label">
- {{ trans('admin/custom_fields/general.field_element') }}
- </label>
- <div class="col-md-8 required">
- {{-- When format is DATE / DATETIME, JS below auto-selects the
- matching picker option AND disables the other options in
- this dropdown so the user can't pick something invalid. --}}
- <x-input.select
- name="element"
- :selected="old('element', $field->element)"
- class="field_element"
- id="element_select"
- style="width: 100%;"
- :options="[
- 'text' => trans('admin/custom_fields/general.types.text'),
- 'listbox' => trans('admin/custom_fields/general.types.listbox'),
- 'textarea' => trans('admin/custom_fields/general.types.textarea'),
- 'markdown-textarea' => trans('admin/custom_fields/general.types.markdown-textarea'),
- 'checkbox' => trans('admin/custom_fields/general.types.checkbox'),
- 'radio' => trans('admin/custom_fields/general.types.radio'),
- 'date_picker' => trans('admin/custom_fields/general.types.date_picker'),
- 'datetime_picker' => trans('admin/custom_fields/general.types.datetime_picker'),
- ]"
- />
- <x-form.help name="element">
- {{ trans('admin/custom_fields/general.field_element_help') }}
- </x-form.help>
- <x-form.error name="element" />
- </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">
- <x-input.textarea
- name="field_values"
- :value="old('field_values', $field->field_values)"
- style="width: 100%"
- rows="4"
- aria-label="field_values"
- />
- <x-form.error name="field_values" />
- <p class="help-block">{{ trans('admin/custom_fields/general.field_values_help') }}</p>
- </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">
- <input class="form-control" id="custom_format" aria-label="custom_format" maxlength="191" placeholder="regex:/^[0-9]{15}$/" name="custom_format" type="text" value="{{ old('custom_format', (($field->format!='') && (stripos($field->format,'regex')===0)) ? $field->format : '') }}">
- <p class="help-block">{!! trans('admin/custom_fields/general.field_custom_format_help') !!}</p>
-
- <x-form.error name="custom_format" />
-
- </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">
- <input class="form-control" aria-label="help_text" name="help_text" type="text" value=" {{ old('help_text', $field->help_text) }}">
- <p class="help-block">{{ trans('admin/custom_fields/general.help_text_description') }}</p>
- <x-form.error name="help_text" />
- </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"{{ (old('field_encrypted') || $field->field_encrypted) ? ' checked="checked"' : '' }}>
- {{ trans('admin/custom_fields/general.encrypt_field') }}
- </label>
- {{-- Shown by JS when format is DATE or DATETIME. Sits inside
- encryption_section so it disappears alongside the section
- for any element type that hides the section entirely
- (e.g., checkbox / radio). Component renders id
- "encrypt_disabled_note-help" — matched by the JS toggle
- in the format-change handler. --}}
- <x-form.help name="encrypt_disabled_note" style="display:none;">
- {{ trans('admin/custom_fields/general.encrypt_disabled_for_date_format') }}
- </x-form.help>
- </div>
- <div class="col-md-9 col-md-offset-3" id="encrypt_warning" style="display:none;">
- <div class="callout callout-danger" role="alert" aria-live="assertive" aria-atomic="true">
- <p><x-icon type="warning" /> {{ 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" style="padding-bottom: 10px;">
- <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" style="padding-bottom: 10px;">
- <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" style="padding-bottom: 10px;">
- <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" style="padding-bottom: 10px;">
- <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" style="padding-bottom: 10px;">
- <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 Checkout Form -->
- <div class="col-md-9 col-md-offset-3" id="display_checkout" style="padding-bottom: 10px;">
- <label class="form-control">
- <input type="checkbox" name="display_checkout" aria-label="display_checkout" value="1" {{ (old('display_checkout') || $field->display_checkout) ? ' checked="checked"' : '' }}>
- {{ trans('admin/custom_fields/general.display_checkout') }}
- </label>
- </div>
-
- <!-- Show in Checkin Form -->
- <div class="col-md-9 col-md-offset-3" id="display_checkin" style="padding-bottom: 10px;">
- <label class="form-control">
- <input type="checkbox" name="display_checkin" aria-label="display_checkin" value="1" {{ (old('display_checkin') || $field->display_checkin) ? ' checked="checked"' : '' }}>
- {{ trans('admin/custom_fields/general.display_checkin') }}
- </label>
- </div>
-
- <!-- Show in Audit Form -->
- <div class="col-md-9 col-md-offset-3" id="display_audit" style="padding-bottom: 10px;">
- <label class="form-control">
- <input type="checkbox" name="display_audit" aria-label="display_audit" value="1" {{ (old('display_audit') || $field->display_audit) ? ' checked="checked"' : '' }}>
- {{ trans('admin/custom_fields/general.display_audit') }}
- </label>
- </div>
-
-
- <!-- 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>
- <x-form.error name="associate_fieldsets" />
-
- <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 }}
- <x-form.error :name="'associate_fieldsets.'.$fieldset->id" />
-
- </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-->
-
+ @php
+ $field_format = '';
+ if (stripos($field->format, 'regex') === 0) {
+ $field_format = 'CUSTOM REGEX';
+ }
+ $format_locked = $field->exists && in_array($field->format, ['DATE', 'DATETIME'], true);
+ @endphp
+
+ <x-form :item="$field" route="{{ $field->id ? route('fields.update', $field->id) : route('fields.store') }}">
+
+ <x-container columns="2">
+
+ <x-page-column class="col-md-8">
+
+ <x-box top_submit>
+
+ <x-form.row
+ :label="trans('admin/custom_fields/general.field_name')"
+ :item="$field"
+ name="name"
+ required
+ />
+
+ <x-form.row
+ :label="trans('admin/custom_fields/general.field_format')"
+ name="format"
+ required
+ id="format_values"
+ >
+ <x-slot:input>
+ <x-input.select
+ name="format"
+ :options="Helper::predefined_formats()"
+ :selected="($field_format == '') ? $field->format : $field_format"
+ class="format form-control"
+ style="width:100%"
+ aria-label="format"
+ :disabled="$format_locked"
+ />
+ @if ($format_locked)
+ <input type="hidden" name="format" value="{{ $field->format }}">
+ <x-form.help name="format-locked">
+ {{ trans('admin/custom_fields/general.format_locked_for_native_column', ['format' => $field->format]) }}
+ </x-form.help>
+ @else
+ <x-form.help name="format">
+ {{ trans('admin/custom_fields/general.field_format_help') }}
+ </x-form.help>
+ @endif
+ <x-form.help name="format_picker_note" style="display:none;">
+ {{ trans('admin/custom_fields/general.format_any_with_date_picker_help') }}
+ </x-form.help>
+ </x-slot:input>
+ </x-form.row>
+
+ <x-form.row
+ :label="trans('admin/custom_fields/general.field_element')"
+ name="element"
+ required
+ id="element_row"
+ >
+ <x-slot:input>
+ <x-input.select
+ name="element"
+ :selected="old('element', $field->element)"
+ class="field_element"
+ id="element_select"
+ style="width: 100%;"
+ :options="[
+ 'text' => trans('admin/custom_fields/general.types.text'),
+ 'listbox' => trans('admin/custom_fields/general.types.listbox'),
+ 'textarea' => trans('admin/custom_fields/general.types.textarea'),
+ 'markdown-textarea' => trans('admin/custom_fields/general.types.markdown-textarea'),
+ 'checkbox' => trans('admin/custom_fields/general.types.checkbox'),
+ 'radio' => trans('admin/custom_fields/general.types.radio'),
+ 'date_picker' => trans('admin/custom_fields/general.types.date_picker'),
+ 'datetime_picker' => trans('admin/custom_fields/general.types.datetime_picker'),
+ ]"
+ />
+ <x-form.help name="element">
+ {{ trans('admin/custom_fields/general.field_element_help') }}
+ </x-form.help>
+ </x-slot:input>
+ </x-form.row>
+
+ <x-form.row
+ :label="trans('admin/custom_fields/general.field_values')"
+ name="field_values"
+ required
+ id="field_values_text"
+ style="display:none;"
+ :help_text="trans('admin/custom_fields/general.field_values_help')"
+ >
+ <x-slot:input>
+ <x-input.textarea
+ name="field_values"
+ :value="old('field_values', $field->field_values)"
+ style="width: 100%"
+ rows="4"
+ aria-label="field_values"
+ />
+ </x-slot:input>
+ </x-form.row>
+
+ <x-form.row
+ :label="trans('admin/custom_fields/general.field_custom_format')"
+ name="custom_format"
+ required
+ id="custom_regex"
+ style="display:none;"
+ :help_html="trans('admin/custom_fields/general.field_custom_format_help')"
+ >
+ <x-slot:input>
+ <input
+ class="form-control"
+ id="custom_format"
+ aria-label="custom_format"
+ maxlength="191"
+ placeholder="regex:/^[0-9]{15}$/"
+ name="custom_format"
+ type="text"
+ value="{{ old('custom_format', (($field->format != '') && (stripos($field->format, 'regex') === 0)) ? $field->format : '') }}"
+ >
+ </x-slot:input>
+ </x-form.row>
+
+ <x-form.row
+ :label="trans('admin/custom_fields/general.help_text')"
+ :item="$field"
+ name="help_text"
+ :help_text="trans('admin/custom_fields/general.help_text_description')"
+ />
+
+ <div class="form-group">
+
+ @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)
+ <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"{{ (old('field_encrypted') || $field->field_encrypted) ? ' checked="checked"' : '' }}>
+ {{ trans('admin/custom_fields/general.encrypt_field') }}
+ </label>
+ <x-form.help name="encrypt_disabled_note" style="display:none;">
+ {{ trans('admin/custom_fields/general.encrypt_disabled_for_date_format') }}
+ </x-form.help>
+ </div>
+ <div class="col-md-9 col-md-offset-3" id="encrypt_warning" style="display:none;">
+ <div class="callout callout-danger" role="alert" aria-live="assertive" aria-atomic="true">
+ <p><x-icon type="warning" /> {{ trans('admin/custom_fields/general.encrypt_field_help') }}</p>
+ </div>
+ </div>
+ @endif
+
+ <div class="col-md-9 col-md-offset-3" style="padding-bottom: 10px;">
+ <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 class="col-md-9 col-md-offset-3" style="padding-bottom: 10px;">
+ <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'))
+ <div class="col-md-9 col-md-offset-3" id="show_in_requestable_list" style="padding-bottom: 10px;">
+ <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>
+
+ <div class="col-md-9 col-md-offset-3" id="show_in_email" style="padding-bottom: 10px;">
+ <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>
+
+ <div class="col-md-9 col-md-offset-3" id="is_unique" style="padding-bottom: 10px;">
+ <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
+
+ <div class="col-md-9 col-md-offset-3" id="display_checkout" style="padding-bottom: 10px;">
+ <label class="form-control">
+ <input type="checkbox" name="display_checkout" aria-label="display_checkout" value="1" {{ (old('display_checkout') || $field->display_checkout) ? ' checked="checked"' : '' }}>
+ {{ trans('admin/custom_fields/general.display_checkout') }}
+ </label>
+ </div>
+
+ <div class="col-md-9 col-md-offset-3" id="display_checkin" style="padding-bottom: 10px;">
+ <label class="form-control">
+ <input type="checkbox" name="display_checkin" aria-label="display_checkin" value="1" {{ (old('display_checkin') || $field->display_checkin) ? ' checked="checked"' : '' }}>
+ {{ trans('admin/custom_fields/general.display_checkin') }}
+ </label>
+ </div>
+
+ <div class="col-md-9 col-md-offset-3" id="display_audit" style="padding-bottom: 10px;">
+ <label class="form-control">
+ <input type="checkbox" name="display_audit" aria-label="display_audit" value="1" {{ (old('display_audit') || $field->display_audit) ? ' checked="checked"' : '' }}>
+ {{ trans('admin/custom_fields/general.display_audit') }}
+ </label>
+ </div>
+
+ <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>
+
+ </x-box>
+
+ </x-page-column>
+
+ @if ($fieldsets->count() > 0)
+ <x-page-column class="col-md-4">
+
+ <div class="box box-default">
+ <div class="box-body">
+
+ <h4>{{ trans('admin/custom_fields/general.fieldsets') }}</h4>
+ <x-form.error name="associate_fieldsets" />
+
+ <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;
+
+ if (old($array_fieldname) == $fieldset->id) {
+ $checked = 'checked';
+ } 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 }}
+ <x-form.error :name="'associate_fieldsets.' . $fieldset->id" />
+ </label>
+ @endforeach
+
+ </div>
+ </div>
+
+ </x-page-column>
+ @endif
+
+ </x-container>
+
+ </x-form>
-</div>
-</form>
@stop
@section('moar_scripts')
@@ -386,8 +327,7 @@
.trigger('change');
// Explain WHY the checkbox is disabled when the format is DATE
- // or DATETIME. ID is generated by <x-form.help name="..."> as
- // "{name}-help".
+ // or DATETIME. The help component renders id="{name}-help".
$("#encrypt_disabled_note-help").toggle(isDateFormat);
// With DATE/DATETIME format, force the element to the matching
diff --git a/resources/views/livewire/custom-field-set-default-values-for-model.blade.php b/resources/views/livewire/custom-field-set-default-values-for-model.blade.php
index b2dba4c419..b3d19a040a 100644
--- a/resources/views/livewire/custom-field-set-default-values-for-model.blade.php
+++ b/resources/views/livewire/custom-field-set-default-values-for-model.blade.php
@@ -48,20 +48,16 @@
@if ($field->format == "DATE")
<div class="input-group col-md-4" style="padding-left: 0px;">
- <div class="input-group date" data-provide="datepicker" data-date-format="yyyy-mm-dd" data-autoclose="true">
- <input
- type="text"
- class="form-control"
- placeholder="{{ trans('general.select_date') }}"
- name="default_values[{{ $field->id }}]"
- id="default-value{{ $field->id }}"
- wire:model="selectedValues.{{ $field->db_column }}"
- {{-- catch the onchange event and dispatch an InputEvent ourselves so Livewire can react to it... --}}
- {{-- https://laracasts.com/discuss/channels/livewire/livewire-and-bootstrap-datepicker?page=1&replyId=623122--}}
- onchange="this.dispatchEvent(new InputEvent('input'))"
- >
- <span class="input-group-addon"><x-icon type="calendar" /></span>
- </div>
+ {{-- wire:model + the input-event dispatch on change is the
+ usual Livewire workaround so the picker's value change
+ flows back to the component. See
+ https://laracasts.com/discuss/channels/livewire/livewire-and-bootstrap-datepicker?page=1&replyId=623122 --}}
+ <x-input.datepicker
+ id="default-value{{ $field->id }}"
+ name="default_values[{{ $field->id }}]"
+ wire:model="selectedValues.{{ $field->db_column }}"
+ onchange="this.dispatchEvent(new InputEvent('input'))"
+ />
</div>
@elseif ($field->element == "text")
diff --git a/resources/views/models/custom_fields_form.blade.php b/resources/views/models/custom_fields_form.blade.php
index 3ab5720636..2b4f0176b6 100644
--- a/resources/views/models/custom_fields_form.blade.php
+++ b/resources/views/models/custom_fields_form.blade.php
@@ -71,6 +71,33 @@
</label>
</div>
@endforeach
+
+ @elseif ($field->element=='date_picker')
+ {{-- Datepicker widget on a plain TEXT column (allows the
+ field to be encrypted). Format DATE uses a separate
+ native-column path below. --}}
+ <div class="input-group col-md-5" style="padding-left: 0px;">
+ <x-input.datepicker
+ id="{{ $field->db_column_name() }}"
+ name="{{ $field->db_column_name() }}"
+ :value="old($field->db_column_name(), isset($item) ? Helper::gracefulDecrypt($field, $item->{$field->db_column_name()}) : $field->defaultValue($model->id))"
+ required="{{ ($field->pivot->required=='1') ? '1' : '' }}"
+ />
+ </div>
+
+ @elseif ($field->element=='datetime_picker')
+ {{-- Datetimepicker widget on a plain TEXT column (allows
+ the field to be encrypted). Format DATETIME uses a
+ separate native-column path below. --}}
+ <div class="input-group col-md-6" style="padding-left: 0px;">
+ <x-input.datetimepicker
+ id="{{ $field->db_column_name() }}"
+ name="{{ $field->db_column_name() }}"
+ :value="old($field->db_column_name(), isset($item) ? Helper::gracefulDecrypt($field, $item->{$field->db_column_name()}) : $field->defaultValue($model->id))"
+ required="{{ ($field->pivot->required=='1') ? '1' : '' }}"
+ :default_now="false"
+ />
+ </div>
@endif
@@ -79,10 +106,12 @@
@if ($field->format=='DATE')
<div class="input-group col-md-5" style="padding-left: 0px;">
- <div class="input-group date" data-provide="datepicker" data-date-format="yyyy-mm-dd" data-autoclose="true" data-date-clear-btn="true">
- <input type="text" class="form-control" placeholder="{{ trans('general.select_date') }}" name="{{ $field->db_column_name() }}" id="{{ $field->db_column_name() }}" readonly value="{{ old($field->db_column_name(),(isset($item) ? Helper::gracefulDecrypt($field, $item->{$field->db_column_name()}) : $field->defaultValue($model->id))) }}" style="background-color:inherit"{{ ($field->pivot->required=='1') ? ' required' : '' }}>
- <span class="input-group-addon"><x-icon type="calendar" /></span>
- </div>
+ <x-input.datepicker
+ id="{{ $field->db_column_name() }}"
+ name="{{ $field->db_column_name() }}"
+ :value="old($field->db_column_name(), isset($item) ? Helper::gracefulDecrypt($field, $item->{$field->db_column_name()}) : $field->defaultValue($model->id))"
+ required="{{ ($field->pivot->required=='1') ? '1' : '' }}"
+ />
</div>
@@ -93,7 +122,7 @@
.input-group[class*="col-"] CSS rules re-apply
15px padding that would otherwise indent the
widget; the inline style forces it to zero. --}}
- <div class="input-group col-md-5" style="padding-left: 0px;">
+ <div class="input-group col-md-6" style="padding-left: 0px;">
<x-input.datetimepicker
id="{{ $field->db_column_name() }}"
name="{{ $field->db_column_name() }}"
diff --git a/resources/views/models/custom_fields_form_bulk_edit.blade.php b/resources/views/models/custom_fields_form_bulk_edit.blade.php
index 4893afe4f5..31103cdba0 100644
--- a/resources/views/models/custom_fields_form_bulk_edit.blade.php
+++ b/resources/views/models/custom_fields_form_bulk_edit.blade.php
@@ -99,6 +99,25 @@
data-target-name="{{ $field->db_column_name() }}">
{{ trans('/admin/hardware/general.clear') }}
</button>
+
+ @elseif ($field->element=='date_picker')
+ <div class="input-group col-md-5" style="padding-left: 0px;">
+ <x-input.datepicker
+ id="{{ $field->db_column_name() }}"
+ name="{{ $field->db_column_name() }}"
+ :value="old($field->db_column_name(), isset($item) ? Helper::gracefulDecrypt($field, $item->{$field->db_column_name()}) : '')"
+ />
+ </div>
+
+ @elseif ($field->element=='datetime_picker')
+ <div class="input-group col-md-6" style="padding-left: 0px;">
+ <x-input.datetimepicker
+ id="{{ $field->db_column_name() }}"
+ name="{{ $field->db_column_name() }}"
+ :value="old($field->db_column_name(), isset($item) ? Helper::gracefulDecrypt($field, $item->{$field->db_column_name()}) : '')"
+ :default_now="false"
+ />
+ </div>
@endif
@else
@@ -107,14 +126,11 @@
@if ($field->format=='DATE')
<div class="input-group col-md-5" style="padding-left: 0px;">
- <div class="input-group date" data-provide="datepicker" data-date-format="yyyy-mm-dd" data-autoclose="true" data-date-clear-btn="true">
- <input type="text" class="form-control" placeholder="{{ trans('general.select_date') }}"
- name="{{ $field->db_column_name() }}"
- id="{{ $field->db_column_name() }}" readonly
- value="{{ old($field->db_column_name(),(isset($item) ? Helper::gracefulDecrypt($field, $item->{$field->db_column_name()}) : '')) }}"
- style="background-color:inherit">
- <span class="input-group-addon"><x-icon type="calendar" /></span>
- </div>
+ <x-input.datepicker
+ id="{{ $field->db_column_name() }}"
+ name="{{ $field->db_column_name() }}"
+ :value="old($field->db_column_name(), isset($item) ? Helper::gracefulDecrypt($field, $item->{$field->db_column_name()}) : '')"
+ />
</div>
@@ -124,7 +140,7 @@
the DATE case above; conflicting duplicate CSS
rules for .input-group[class*="col-"] otherwise
re-apply the 15px grid padding. --}}
- <div class="input-group col-md-5" style="padding-left: 0px;">
+ <div class="input-group col-md-6" style="padding-left: 0px;">
<x-input.datetimepicker
id="{{ $field->db_column_name() }}"
name="{{ $field->db_column_name() }}"