Skip to content

A free open source IT asset/license management system

Use new datepicker in blades

snipede4c0c84c240
diff --git a/resources/views/accessories/edit.blade.php b/resources/views/accessories/edit.blade.php
index 22bf5de20a..c25e94ace8 100644
--- a/resources/views/accessories/edit.blade.php
+++ b/resources/views/accessories/edit.blade.php
@@ -75,17 +75,10 @@
<x-form.row
:label="trans('general.purchase_date')"
name="purchase_date"
+ type="datepicker"
+ :item="$item"
input_div_class="col-md-4"
- >
- <x-slot:input>
- <x-input.datepicker
- name="purchase_date"
- id="purchase_date"
- :value="old('purchase_date', $item->purchase_date ? date('Y-m-d', strtotime($item->purchase_date)) : '')"
- :placeholder="trans('general.select_date')"
- />
- </x-slot:input>
- </x-form.row>
+ />
<x-input.purchase-cost
:label="trans('general.unit_cost')"
diff --git a/resources/views/blade/form/help.blade.php b/resources/views/blade/form/help.blade.php
index 4fcb90942c..4791af3909 100644
--- a/resources/views/blade/form/help.blade.php
+++ b/resources/views/blade/form/help.blade.php
@@ -1,5 +1,5 @@
@props(['name', 'icon' => null])
-<p class="help-block" id="{{ $name }}-help">
+<p {{ $attributes->merge(['class' => 'help-block', 'id' => $name.'-help']) }}>
@if ($icon)
<x-icon :type="$icon" />
@endif
diff --git a/resources/views/blade/form/row.blade.php b/resources/views/blade/form/row.blade.php
index 3a31dd8818..320f694374 100644
--- a/resources/views/blade/form/row.blade.php
+++ b/resources/views/blade/form/row.blade.php
@@ -22,6 +22,11 @@
'rows' => null,
'placeholder' => null,
'default' => null,
+ // Datepicker / datetimepicker widget knobs. Only consumed when
+ // type="datepicker" or type="datetimepicker".
+ 'end_date' => null,
+ 'default_now' => true,
+ 'side_by_side' => false,
])
<div {{ $attributes->merge(['class' => 'form-group'. $errors_class]) }}>
@@ -68,6 +73,25 @@
:item="$item"
:default="$default"
/>
+ @elseif ($blade_type === 'datepicker')
+ <x-input.datepicker
+ :name="$name"
+ :id="$name"
+ :value="old($name, $item?->{$name} ?? $default)"
+ :required="Helper::checkIfRequired($item, $name)"
+ :placeholder="$placeholder"
+ :end_date="$end_date"
+ />
+ @elseif ($blade_type === 'datetimepicker')
+ <x-input.datetimepicker
+ :name="$name"
+ :id="$name"
+ :value="old($name, $item?->{$name}?->format('Y-m-d H:i:s') ?? $item?->{$name} ?? $default)"
+ :required="Helper::checkIfRequired($item, $name)"
+ :placeholder="$placeholder"
+ :default_now="$default_now"
+ :side_by_side="$side_by_side"
+ />
@else
<x-dynamic-component
:$name
diff --git a/resources/views/components/edit.blade.php b/resources/views/components/edit.blade.php
index 354cd0cd2d..c7b1b16216 100644
--- a/resources/views/components/edit.blade.php
+++ b/resources/views/components/edit.blade.php
@@ -85,17 +85,10 @@
<x-form.row
:label="trans('general.purchase_date')"
name="purchase_date"
+ type="datepicker"
+ :item="$item"
input_div_class="col-md-4"
- >
- <x-slot:input>
- <x-input.datepicker
- name="purchase_date"
- id="purchase_date"
- :value="old('purchase_date', $item->purchase_date ? date('Y-m-d', strtotime($item->purchase_date)) : '')"
- :placeholder="trans('general.select_date')"
- />
- </x-slot:input>
- </x-form.row>
+ />
<x-input.purchase-cost
:label="trans('general.unit_cost')"
diff --git a/resources/views/consumables/edit.blade.php b/resources/views/consumables/edit.blade.php
index f71eb8e261..e0c3601929 100644
--- a/resources/views/consumables/edit.blade.php
+++ b/resources/views/consumables/edit.blade.php
@@ -85,17 +85,10 @@
<x-form.row
:label="trans('general.purchase_date')"
name="purchase_date"
+ type="datepicker"
+ :item="$item"
input_div_class="col-md-4"
- >
- <x-slot:input>
- <x-input.datepicker
- name="purchase_date"
- id="purchase_date"
- :value="old('purchase_date', $item->purchase_date ? date('Y-m-d', strtotime($item->purchase_date)) : '')"
- :placeholder="trans('general.select_date')"
- />
- </x-slot:input>
- </x-form.row>
+ />
<x-input.purchase-cost
:label="trans('general.unit_cost')"
diff --git a/resources/views/custom_fields/fields/edit.blade.php b/resources/views/custom_fields/fields/edit.blade.php
index 936bd3133c..1f3be4ce0e 100644
--- a/resources/views/custom_fields/fields/edit.blade.php
+++ b/resources/views/custom_fields/fields/edit.blade.php
@@ -43,29 +43,88 @@
</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' : '' }}">
+ <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">
-
- <x-input.select
- name="element"
- :selected="old('element', $field->element)"
- class="field_element"
- 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'),
- ]"
- />
- <x-form.error name="element" />
-
+ {{-- 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>
@@ -86,30 +145,6 @@
<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">
- <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"
- />
- <x-form.error name="format" />
- </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">
@@ -158,6 +193,15 @@
<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">
@@ -327,8 +371,62 @@
$("#custom_regex").hide();
}
});
+
+ var pickedFormat = $(this).val();
+ var isDateFormat = (pickedFormat === 'DATE' || pickedFormat === 'DATETIME');
+
+ // DATE / DATETIME fields are stored in native date columns which
+ // can't hold ciphertext, so encryption is disallowed. Leave the
+ // checkbox visible so the user sees the option exists, but
+ // uncheck + disable it. Trigger change so the dependent warning
+ // and related visibility toggles run.
+ $("#field_encrypted")
+ .prop('disabled', isDateFormat)
+ .prop('checked', isDateFormat ? false : $("#field_encrypted").prop('checked'))
+ .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".
+ $("#encrypt_disabled_note-help").toggle(isDateFormat);
+
+ // With DATE/DATETIME format, force the element to the matching
+ // picker option and disable the other options so the user can't
+ // pick something invalid. Anything else — re-enable everything.
+ var $elementOptions = $("#element_select > option");
+ if (isDateFormat) {
+ var matchingElement = (pickedFormat === 'DATETIME') ? 'datetime_picker' : 'date_picker';
+ $elementOptions.each(function () {
+ $(this).prop('disabled', $(this).val() !== matchingElement);
+ });
+ $("#element_select").val(matchingElement).trigger('change');
+ } else {
+ $elementOptions.prop('disabled', false);
+ // Don't force-change the user's element pick here — only
+ // reset if the previous value was one of the forced pickers.
+ var currentEl = $("#element_select").val();
+ if (currentEl === 'date_picker' || currentEl === 'datetime_picker') {
+ // Leave whatever they had; user can pick another manually.
+ }
+ }
+
+ // Nudge the format-picker help note (element handler recomputes
+ // it too — this catches the case where format alone changed).
+ updateFormatPickerNote();
}).change();
+ // Shown when the user has explicitly picked date_picker /
+ // datetime_picker as the element AND left the format as ANY. That
+ // combo IS supported (needed for encrypted date fields) but isn't
+ // the common path — surface the reason so users don't wonder.
+ function updateFormatPickerNote() {
+ var el = $("#element_select").val();
+ var fmt = $(".format").val();
+ var isPickerElement = (el === 'date_picker' || el === 'datetime_picker');
+ var isAnyFormat = (fmt === 'ANY' || fmt === '' || fmt == null);
+ $("#format_picker_note-help").toggle(isPickerElement && isAnyFormat);
+ }
+
// If the element is a radiobutton/checkbox, doesn't show the format input box
$(".field_element").change(function(){
$(this).find("option:selected").each(function(){
@@ -340,20 +438,26 @@
});
}).change();
- // Only display the field element if the type is not text
- // and don't display encryption option for checkbox or radio
+ // Field Values input is only meaningful for elements that need a
+ // predefined set of options (listbox, checkbox, radio). Datepickers
+ // and text inputs have no options list, so hide it there.
+ // Encryption is disallowed for checkbox / radio elements (those
+ // store comma-separated values that don't play nicely with encrypt).
$(".field_element").change(function(){
- $(this).find("option:selected").each(function(){
- if (($(this).attr("value") != "text") && ($(this).attr("value") != "textarea") && ($(this).attr("value") != "markdown-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();
- }
- });
+ var el = $(this).val();
+ var needsValues = (el === 'listbox' || el === 'checkbox' || el === 'radio');
+ var blocksEncryption = (el === 'checkbox' || el === 'radio');
+
+ $("#field_values_text").toggle(needsValues);
+ if (blocksEncryption) {
+ $("#encryption_section").hide();
+ } else {
+ $("#encryption_section").show();
+ }
+
+ // Also re-evaluate the format-picker help note when element
+ // changes (e.g., user switches to date_picker on an ANY format).
+ updateFormatPickerNote();
}).change();
});
diff --git a/resources/views/hardware/audit.blade.php b/resources/views/hardware/audit.blade.php
index 98e2a3232d..1c4b61e2e8 100644
--- a/resources/views/hardware/audit.blade.php
+++ b/resources/views/hardware/audit.blade.php
@@ -106,10 +106,13 @@
{{ trans('general.next_audit_date') }}
</label>
<div class="col-md-8">
- <div class="input-group date col-md-5" data-provide="datepicker" data-date-format="yyyy-mm-dd" data-date-clear-btn="true">
- <input type="text" class="form-control" placeholder="{{ trans('general.next_audit_date') }}" name="next_audit_date" id="next_audit_date" value="{{ old('next_audit_date', $next_audit_date) }}">
- <span class="input-group-addon"><x-icon type="calendar" /></span>
- </div>
+ <x-input.datepicker
+ id="next_audit_date"
+ name="next_audit_date"
+ :value="old('next_audit_date', $next_audit_date)"
+ :placeholder="trans('general.next_audit_date')"
+ col_size_class="col-md-5"
+ />
<x-form.error name="next_audit_date" />
<p class="help-block">{!! trans('general.next_audit_date_help') !!}</p>
</div>
diff --git a/resources/views/hardware/bulk-checkout.blade.php b/resources/views/hardware/bulk-checkout.blade.php
index f01d5d1e97..d837ee4866 100644
--- a/resources/views/hardware/bulk-checkout.blade.php
+++ b/resources/views/hardware/bulk-checkout.blade.php
@@ -92,30 +92,17 @@
<x-form.row
:label="trans('admin/hardware/form.checkout_date')"
name="checkout_at"
+ type="datetimepicker"
input_div_class="col-md-4"
- >
- <x-slot:input>
- <x-input.datepicker
- name="checkout_at"
- end_date="0d"
- :value="old('checkout_at')"
- :placeholder="trans('general.select_date')"
- />
- </x-slot:input>
- </x-form.row>
+ />
<x-form.row
:label="trans('admin/hardware/form.expected_checkin')"
name="expected_checkin"
+ type="datetimepicker"
+ :default_now="false"
input_div_class="col-md-4"
- >
- <x-slot:input>
- <x-input.datetimepicker
- name="expected_checkin"
- :value="old('expected_checkin')"
- />
- </x-slot:input>
- </x-form.row>
+ />
<x-form.row
:label="trans('general.notes')"
diff --git a/resources/views/hardware/bulk.blade.php b/resources/views/hardware/bulk.blade.php
index a5be8e7756..fa6e01b0e9 100755
--- a/resources/views/hardware/bulk.blade.php
+++ b/resources/views/hardware/bulk.blade.php
@@ -81,6 +81,7 @@
<x-input.datetimepicker
name="expected_checkin"
value="{{ old('expected_checkin') }}"
+ :default_now="false"
/>
<x-form.error name="expected_checkin" />
</div>
diff --git a/resources/views/hardware/checkout.blade.php b/resources/views/hardware/checkout.blade.php
index ded6105b6f..64fdf8e705 100755
--- a/resources/views/hardware/checkout.blade.php
+++ b/resources/views/hardware/checkout.blade.php
@@ -82,32 +82,20 @@
<x-form.row
:label="trans('admin/hardware/form.checkout_date')"
name="checkout_at"
+ type="datetimepicker"
+ :item="$item"
+ :default="date('Y-m-d H:i:s')"
input_div_class="col-md-4"
- >
- <x-slot:input>
- <x-input.datepicker
- name="checkout_at"
- end_date="0d"
- :value="old('expected_checkin', date('Y-m-d'))"
- :placeholder="trans('general.select_date')"
- required="{{ Helper::checkIfRequired($item, 'checkout_at') }}"
- />
- </x-slot:input>
- </x-form.row>
+ />
<x-form.row
:label="trans('admin/hardware/form.expected_checkin')"
name="expected_checkin"
+ type="datetimepicker"
+ :item="$item"
+ :default_now="false"
input_div_class="col-md-4"
- >
- <x-slot:input>
- <x-input.datetimepicker
- name="expected_checkin"
- :value="old('expected_checkin', $item->expected_checkin?->format('Y-m-d H:i:s'))"
- required="{{ Helper::checkIfRequired($item, 'expected_checkin') }}"
- />
- </x-slot:input>
- </x-form.row>
+ />
<x-form.row
:label="trans('general.notes')"
diff --git a/resources/views/hardware/edit.blade.php b/resources/views/hardware/edit.blade.php
index 6586967e16..a8b361618b 100755
--- a/resources/views/hardware/edit.blade.php
+++ b/resources/views/hardware/edit.blade.php
@@ -151,16 +151,11 @@
<x-form.row
:label="trans('admin/hardware/form.expected_checkin')"
name="expected_checkin"
- input_div_class="input-group col-md-4"
- >
- <x-slot:input>
- <x-input.datetimepicker
- name="expected_checkin"
- :value="old('expected_checkin', $item->expected_checkin?->format('Y-m-d H:i:s'))"
- :required="Helper::checkIfRequired($item, 'expected_checkin')"
- />
- </x-slot:input>
- </x-form.row>
+ type="datetimepicker"
+ :item="$item"
+ :default_now="false"
+ input_div_class="input-group col-md-5"
+ />
@include ('partials.forms.edit.datepicker', ['translated_name' => trans('general.next_audit_date'),'fieldname' => 'next_audit_date', 'help_text' => trans('general.next_audit_date_help')])
<!-- byod checkbox -->
<div class="form-group byod">
@@ -251,6 +246,11 @@
success: function (data) {
$('#custom_fields_content').html(data);
$('#custom_fields_content select').select2(); //enable select2 on any custom fields that are select-boxes
+ // Re-init eonasdan datetimepickers on any DATE/DATETIME
+ // custom fields that came with the new HTML. Without
+ // this, the pickers would just be plain text inputs
+ // until page reload.
+ window.snipeitInitDatetimepickers('#custom_fields_content');
//now re-populate the custom fields based on the previously saved values
$('#custom_fields_content').find('input,select,textarea').each(function (index,elem) {
if(transformed_oldvals[elem.name]) {
diff --git a/resources/views/hardware/quickscan.blade.php b/resources/views/hardware/quickscan.blade.php
index b4b4a9a537..ec47519ea7 100644
--- a/resources/views/hardware/quickscan.blade.php
+++ b/resources/views/hardware/quickscan.blade.php
@@ -77,10 +77,13 @@
<div class="form-group {{ $errors->has('next_audit_date') ? 'error' : '' }}">
<label for="next_audit_date" class="col-md-3 control-label">{{ trans('general.next_audit_date') }}</label>
<div class="col-md-9">
- <div class="input-group date col-md-5" data-provide="datepicker" data-date-format="yyyy-mm-dd" data-date-clear-btn="true">
- <input type="text" class="form-control" placeholder="{{ trans('general.next_audit_date') }}" name="next_audit_date" id="next_audit_date" value="{{ old('next_audit_date', $next_audit_date) }}">
- <span class="input-group-addon"><x-icon type="calendar" /></span>
- </div>
+ <x-input.datepicker
+ id="next_audit_date"
+ name="next_audit_date"
+ :value="old('next_audit_date', $next_audit_date)"
+ :placeholder="trans('general.next_audit_date')"
+ col_size_class="col-md-5"
+ />
<x-form.error name="next_audit_date" />
</div>
</div>
diff --git a/resources/views/kits/checkout.blade.php b/resources/views/kits/checkout.blade.php
index a1ad69f329..07604a255c 100644
--- a/resources/views/kits/checkout.blade.php
+++ b/resources/views/kits/checkout.blade.php
@@ -27,30 +27,17 @@
<x-form.row
:label="trans('admin/hardware/form.checkout_date')"
name="checkout_at"
+ type="datetimepicker"
input_div_class="col-md-4"
- >
- <x-slot:input>
- <x-input.datepicker
- name="checkout_at"
- end_date="0d"
- :value="old('checkout_at')"
- :placeholder="trans('general.select_date')"
- />
- </x-slot:input>
- </x-form.row>
+ />
<x-form.row
:label="trans('admin/hardware/form.expected_checkin')"
name="expected_checkin"
+ type="datetimepicker"
+ :default_now="false"
input_div_class="col-md-4"
- >
- <x-slot:input>
- <x-input.datetimepicker
- name="expected_checkin"
- :value="old('expected_checkin')"
- />
- </x-slot:input>
- </x-form.row>
+ />
<x-form.row
:label="trans('general.notes')"
diff --git a/resources/views/layouts/default.blade.php b/resources/views/layouts/default.blade.php
index 5749db7790..a887bb64e0 100644
--- a/resources/views/layouts/default.blade.php
+++ b/resources/views/layouts/default.blade.php
@@ -309,18 +309,62 @@
for selected/today cells and follow light/dark mode for the popup
chrome. Ships with Bootstrap's stock #337ab7 which looks off next to
AdminLTE.
+
+ - All toolbar buttons: .bootstrap-datetimepicker-widget li.picker-switch a[data-action]
+ - Individual buttons: a[data-action="today"], a[data-action="clear"], a[data-action="close"] - -
+ - The <td> cell each button sits in: .bootstrap-datetimepicker-widget li.picker-switch td
+ - The icon <span> inside the anchor: .bootstrap-datetimepicker-widget li.picker-switch a[data-action] > span
*/
.bootstrap-datetimepicker-widget {
z-index: 1030 !important;
background-color: var(--box-bg) !important;
color: var(--color-fg) !important;
}
- /* Side-by-side (date + time) mode ships at 38em, which isn't wide
- enough once the format includes seconds — the seconds column runs
- past the right edge. Bump it up to give the time cells room. */
+
+ /* Widget border in the theme color so the popup edge visually
+ matches other themed boxes in the app. */
+ .bootstrap-datetimepicker-widget.dropdown-menu {
+ border: 1px solid var(--main-theme-color) !important;
+ }
+
+ /* The connecting caret between the input and the popup is drawn
+ with two triangles: :before is the outer border outline (7px),
+ :after is the inner fill (6px, sits inside the :before). Match
+ the widget's own theme-color border on the outer triangle, and
+ the widget's background on the inner. */
+ .bootstrap-datetimepicker-widget.dropdown-menu.bottom:before {
+ border-bottom-color: var(--main-theme-color) !important;
+ }
+
+ .bootstrap-datetimepicker-widget.dropdown-menu.bottom:after {
+ border-bottom-color: var(--box-bg) !important;
+ }
+
+ .bootstrap-datetimepicker-widget.dropdown-menu.top:before {
+ border-top-color: var(--main-theme-color) !important;
+ }
+
+ .bootstrap-datetimepicker-widget.dropdown-menu.top:after {
+ border-top-color: var(--box-bg) !important;
+ }
+
+ /* Side-by-side (date + time) mode ships at 38em, not wide enough
+ once the format includes seconds. Bump up to give the time cells
+ room. */
.bootstrap-datetimepicker-widget.dropdown-menu.timepicker-sbs {
width: 42em !important;
}
+
+ /* Compact (non-sideBySide) mode. Library default is 19em, which is
+ too narrow for the time-picker view — hour/minute/second cells
+ are 54px each and the increment/decrement arrow buttons add width
+ on top of that, so under ~300px the time view gets clipped. Sizing
+ to fit the widest child (the time view) also gives the calendar
+ view plenty of room. */
+ .bootstrap-datetimepicker-widget.dropdown-menu:not(.timepicker-sbs) {
+ min-width: 320px;
+ }
+
.bootstrap-datetimepicker-widget table td.active,
.bootstrap-datetimepicker-widget table td.active:hover,
.bootstrap-datetimepicker-widget table td span.active,
@@ -332,38 +376,133 @@
.bootstrap-datetimepicker-widget table td.today:before {
border-bottom-color: var(--main-theme-color) !important;
}
+
+ /* Cell hover: theme color background + white text — same shape as
+ "active" so contrast is guaranteed in both light and dark mode. */
.bootstrap-datetimepicker-widget table td:hover,
.bootstrap-datetimepicker-widget table td span:hover,
.bootstrap-datetimepicker-widget table thead tr:first-child th:hover {
- background-color: hsl(from var(--main-theme-color) h s calc(l + 40)) !important;
- color: var(--color-fg) !important;
+ background-color: var(--main-theme-color) !important;
+ color: var(--nav-primary-text-color) !important;
}
- /* The toolbar wrapper (<li class="picker-switch">) intentionally is
- NOT included in the generic hover rule above — that would tint the
- entire toolbar bar when hovering ANY single button, washing out the
- non-hovered buttons around it. Hover state is per-button only, via
- the a[data-action]:hover rule further down. */
- /* Today / Clear / Close toolbar buttons. Default link color is the
- app-wide bright blue which clashes on the widget; use the standard
- foreground color for the icons and highlight with the theme color
- on hover. Hover uses a DARKER shade of the theme color so the white
- icon has enough contrast against it — the +40 lightness tint used
- for calendar cells makes toolbar icons wash out. Container td
- background is neutralised on hover so it doesn't peek around the
- button and dilute the contrast. */
- .bootstrap-datetimepicker-widget .picker-switch a[data-action],
- .bootstrap-datetimepicker-widget .picker-switch a[data-action] span {
+
+ /* Time-picker text (compact mode). Bootstrap's .btn base color is
+ #333 which is invisible on the dark box-bg in dark mode; force
+ these text elements to inherit the widget's --color-fg instead
+ so they read in both themes.
+ - .timepicker-hour / -minute / -second : the big clickable digits
+ - .separator : the colon between them
+ - .timepicker-picker .btn : the up/down arrow buttons
+ - .timepicker-picker .btn span : the FA icon inside those
+ - .timepicker-hours / -minutes / -seconds .btn : the expanded grid
+ of pickable hour/minute/second numbers when you click a digit */
+ .bootstrap-datetimepicker-widget .timepicker-hour,
+ .bootstrap-datetimepicker-widget .timepicker-minute,
+ .bootstrap-datetimepicker-widget .timepicker-second,
+ .bootstrap-datetimepicker-widget .separator,
+ .bootstrap-datetimepicker-widget .timepicker-picker .btn,
+ .bootstrap-datetimepicker-widget .timepicker-picker .btn span,
+ .bootstrap-datetimepicker-widget .timepicker-hours td,
+ .bootstrap-datetimepicker-widget .timepicker-minutes td,
+ .bootstrap-datetimepicker-widget .timepicker-seconds td {
color: var(--color-fg) !important;
}
- .bootstrap-datetimepicker-widget .picker-switch table td:hover {
- background-color: transparent !important;
+
+ /* The empty <td class="separator"> cells above and below the ":"
+ are pure spacers, but were rendering visible "lines" around the
+ colon. Force their background to match the popup so they blend
+ into the widget in both light and dark mode.
+
+ Also kill the ::before / ::after pseudo-elements — the app's own
+ .separator class elsewhere in the codebase draws horizontal grey
+ border-bottom lines via those pseudos (for section dividers), and
+ class-name collides with the library's timepicker separator td. */
+ .bootstrap-datetimepicker-widget .separator {
+ background-color: var(--box-bg) !important;
+ border: none !important;
+ box-shadow: none !important;
+ }
+ .bootstrap-datetimepicker-widget .separator::before,
+ .bootstrap-datetimepicker-widget .separator::after {
+ display: none !important;
+ content: none !important;
+ border: none !important;
+ }
+ /* Same treatment for the increment/decrement arrow buttons — no
+ border/box-shadow/focus outline so the time-picker column doesn't
+ get sub-lines between each button. */
+ .bootstrap-datetimepicker-widget .timepicker-picker .btn {
+ background-color: var(--box-bg) !important;
+ border: none !important;
+ box-shadow: none !important;
+ outline: none !important;
}
- .bootstrap-datetimepicker-widget .picker-switch a[data-action]:hover,
- .bootstrap-datetimepicker-widget .picker-switch a[data-action]:hover span {
- background-color: hsl(from var(--main-theme-color) h s calc(l - 10)) !important;
- color: var(--nav-primary-text-color) !important;
+ .bootstrap-datetimepicker-widget .timepicker-picker .btn:focus,
+ .bootstrap-datetimepicker-widget .timepicker-picker .btn:active {
+ outline: none !important;
+ box-shadow: none !important;
+ }
+
+ /*!* Toolbar buttons (Today / Clear / Close). *!*/
+ /*.bootstrap-datetimepicker-widget .picker-switch a[data-action] {*/
+ /* color: var(--color-fg) !important;*/
+ /* background-color: var(--main-theme-color) !important;*/
+ /* border-radius: 0 !important;*/
+ /*}*/
+
+ /*.bootstrap-datetimepicker-widget .picker-switch a[data-action] span {*/
+ /* color: var(--nav-primary-text-color) !important;*/
+ /* background-color: transparent !important;*/
+ /* border-radius: 0 !important;*/
+ /*}*/
+ /*.bootstrap-datetimepicker-widget .picker-switch table td:hover {*/
+ /* border-radius: 0 !important;*/
+ /* !*background-color: var(--color-bg) !important;*!*/
+ /*}*/
+ /*.bootstrap-datetimepicker-widget .picker-switch a[data-action]:hover,*/
+ /*.bootstrap-datetimepicker-widget .picker-switch a[data-action]:hover span {*/
+ /* background-color: var(--main-theme-color) !important;*/
+ /* color: var(--nav-primary-text-color) !important;*/
+ /* border-radius: 0 !important;*/
+ /*}*/
+
+
+ /* Button hover — matches the whole <a> element */
+ .bootstrap-datetimepicker-widget li.picker-switch a[data-action]:hover,
+ .bootstrap-datetimepicker-widget li.picker-switch td:hover {
+ background-color: transparent !important;
+ border-radius: 0 !important;
+
}
+ /* The icon <span> inside the anchor, when the anchor is hovered.
+ Use this if you want the icon color to change independently of the anchor bg. */
+ /*.bootstrap-datetimepicker-widget li.picker-switch a[data-action]:hover > span {*/
+ /* background-color: var(--main-theme-color) !important;*/
+ /* border-radius: 0;*/
+ /* border: none;*/
+ /*}*/
+
+ /*!* The <td> cell around the anchor, on hover. Handy for suppressing the*/
+ /* generic table td:hover rule that would otherwise tint the cell before*/
+ /* the anchor's own hover kicks in. *!*/
+ /*.bootstrap-datetimepicker-widget li.picker-switch td:hover {*/
+ /* background-color: orange !important;*/
+ /*}*/
+
+ /*!* Per-button hover if you want each colored differently *!*/
+ /*.bootstrap-datetimepicker-widget li.picker-switch a[data-action="today"]:hover {*/
+ /* background-color: green !important;*/
+ /*}*/
+
+ /*.bootstrap-datetimepicker-widget li.picker-switch a[data-action="clear"]:hover {*/
+ /* background-color: blue !important;*/
+ /*}*/
+
+ /*.bootstrap-datetimepicker-widget li.picker-switch a[data-action="close"]:hover {*/
+ /* background-color: pink !important;*/
+ /*}*/
+
.input-group-addon {
background-color: var(--input-group-bg) !important;
diff --git a/resources/views/licenses/edit.blade.php b/resources/views/licenses/edit.blade.php
index 4055192e44..5886ee2054 100755
--- a/resources/views/licenses/edit.blade.php
+++ b/resources/views/licenses/edit.blade.php
@@ -120,44 +120,26 @@
<x-form.row
:label="trans('general.purchase_date')"
name="purchase_date"
+ type="datepicker"
+ :item="$item"
input_div_class="col-md-4"
- >
- <x-slot:input>
- <x-input.datepicker
- name="purchase_date"
- :value="old('purchase_date', $item->purchase_date ? date('Y-m-d', strtotime($item->purchase_date)) : '')"
- :placeholder="trans('general.select_date')"
- />
- </x-slot:input>
- </x-form.row>
+ />
<x-form.row
:label="trans('admin/licenses/form.expiration')"
name="expiration_date"
+ type="datepicker"
+ :item="$item"
input_div_class="col-md-4"
- >
- <x-slot:input>
- <x-input.datepicker
- name="expiration_date"
- :value="old('expiration_date', $item->expiration_date ? date('Y-m-d', strtotime($item->expiration_date)) : '')"
- :placeholder="trans('general.select_date')"
- />
- </x-slot:input>
- </x-form.row>
+ />
<x-form.row
:label="trans('admin/licenses/form.termination_date')"
name="termination_date"
+ type="datepicker"
+ :item="$item"
input_div_class="col-md-4"
- >
- <x-slot:input>
- <x-input.datepicker
- name="termination_date"
- :value="old('termination_date', $item->termination_date ? date('Y-m-d', strtotime($item->termination_date)) : '')"
- :placeholder="trans('general.select_date')"
- />
- </x-slot:input>
- </x-form.row>
+ />
<x-form.row
:label="trans('admin/licenses/form.purchase_order')"