A free open source IT asset/license management system
Use datetimepicker
snipe5f84a17be0c5
diff --git a/resources/views/blade/input/datetimepicker.blade.php b/resources/views/blade/input/datetimepicker.blade.phpindex 54d946a507..6a73cd004e 100644--- a/resources/views/blade/input/datetimepicker.blade.php+++ b/resources/views/blade/input/datetimepicker.blade.php@@ -4,13 +4,19 @@'format' => 'YYYY-MM-DD HH:mm:ss','placeholder' => trans('general.select_datetime'),'col_size_class' => null,+ // Whether an empty picker should auto-populate to the user's current+ // local datetime on open. Callers that render a picker where "now" is+ // not a safe default (user-defined custom fields, for example) can pass+ // :default_now="false" to opt out.+ 'default_now' => true,])<!-- Datetimepicker (eonasdan-bootstrap-datetimepicker) --><div class="input-group date {{ $col_size_class }}"data-provide="datetimepicker"data-format="{{ $format }}"- data-locale="{{ auth()->user()?->locale ?? 'en' }}">+ data-locale="{{ auth()->user()?->locale ?? 'en' }}"+ data-default-now="{{ $default_now ? 'true' : 'false' }}"><input type="text"placeholder="{{ $placeholder }}"value="{{ $value }}"diff --git a/resources/views/hardware/bulk-checkin.blade.php b/resources/views/hardware/bulk-checkin.blade.phpindex b6be9f999f..03c2ba7321 100644--- a/resources/views/hardware/bulk-checkin.blade.php+++ b/resources/views/hardware/bulk-checkin.blade.php@@ -96,10 +96,12 @@{{ trans('admin/hardware/form.checkin_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-end-date="0d" data-date-clear-btn="true">- <input type="text" class="form-control" placeholder="{{ trans('general.select_date') }}" name="checkin_at" id="checkin_at" value="{{ old('checkin_at') }}">- <span class="input-group-addon"><x-icon type="calendar" /></span>- </div>+ <x-input.datetimepicker+ id="checkin_at"+ name="checkin_at"+ :value="old('checkin_at')"+ col_size_class="col-md-5"+ /><x-form.error name="checkin_at" /></div></div>diff --git a/resources/views/hardware/bulk-checkout.blade.php b/resources/views/hardware/bulk-checkout.blade.phpindex 2b47225436..f01d5d1e97 100644--- a/resources/views/hardware/bulk-checkout.blade.php+++ b/resources/views/hardware/bulk-checkout.blade.php@@ -110,10 +110,9 @@input_div_class="col-md-4"><x-slot:input>- <x-input.datepicker+ <x-input.datetimepickername="expected_checkin":value="old('expected_checkin')"- :placeholder="trans('general.select_date')"/></x-slot:input></x-form.row>diff --git a/resources/views/hardware/bulk.blade.php b/resources/views/hardware/bulk.blade.phpindex c6838920b4..a5be8e7756 100755--- a/resources/views/hardware/bulk.blade.php+++ b/resources/views/hardware/bulk.blade.php@@ -78,10 +78,9 @@<div class="form-group{{ $errors->has('expected_checkin') ? ' has-error' : '' }}"><label for="expected_checkin" class="col-md-3 control-label">{{ trans('admin/hardware/form.expected_checkin') }}</label><div class="col-md-4">- <x-input.datepicker+ <x-input.datetimepickername="expected_checkin"value="{{ old('expected_checkin') }}"- placeholder="{{ trans('general.select_date') }}"/><x-form.error name="expected_checkin" /></div>diff --git a/resources/views/hardware/checkin.blade.php b/resources/views/hardware/checkin.blade.phpindex 853847b03b..1d1247005d 100755--- a/resources/views/hardware/checkin.blade.php+++ b/resources/views/hardware/checkin.blade.php@@ -162,16 +162,11 @@<div class="col-md-8 col-xs-12 col-sm-12"><div class="input-group col-xl-5 col-lg-5 col-md-7 col-sm-9 col-xs-12 required">- <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="checkin_at" id="checkin_at"- value="{{ old('checkin_at', date('Y-m-d')) }}">- <span class="input-group-addon">- <x-icon type="calendar" />- </span>- </div>+ <x-input.datetimepicker+ id="checkin_at"+ name="checkin_at"+ :value="old('checkin_at', date('Y-m-d H:i:s'))"+ /><x-form.error name="checkin_at" /></div></div>diff --git a/resources/views/hardware/checkout.blade.php b/resources/views/hardware/checkout.blade.phpindex 95cc029b88..ded6105b6f 100755--- a/resources/views/hardware/checkout.blade.php+++ b/resources/views/hardware/checkout.blade.php@@ -101,10 +101,9 @@input_div_class="col-md-4"><x-slot:input>- <x-input.datepicker+ <x-input.datetimepickername="expected_checkin"- :value="old('expected_checkin', $item->expected_checkin)"- :placeholder="trans('general.select_date')"+ :value="old('expected_checkin', $item->expected_checkin?->format('Y-m-d H:i:s'))"required="{{ Helper::checkIfRequired($item, 'expected_checkin') }}"/></x-slot:input>diff --git a/resources/views/hardware/edit.blade.php b/resources/views/hardware/edit.blade.phpindex be8e8de10e..9ce853b814 100755--- a/resources/views/hardware/edit.blade.php+++ b/resources/views/hardware/edit.blade.php@@ -148,7 +148,7 @@<div id="optional_details" class="col-md-12" style="display:none">@include ('partials.forms.edit.name', ['translated_name' => trans('admin/hardware/form.name')])@include ('partials.forms.edit.warranty')- @include ('partials.forms.edit.datepicker', ['translated_name' => trans('admin/hardware/form.expected_checkin'),'fieldname' => 'expected_checkin'])+ @include ('partials.forms.edit.datetimepicker', ['translated_name' => trans('admin/hardware/form.expected_checkin'),'fieldname' => 'expected_checkin'])@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">diff --git a/resources/views/hardware/view.blade.php b/resources/views/hardware/view.blade.phpindex 3a142a90e0..b1a09c4c60 100755--- a/resources/views/hardware/view.blade.php+++ b/resources/views/hardware/view.blade.php@@ -114,7 +114,7 @@<x-icon type="expected_checkin" class="fa-fw"/><strong>{{ trans('general.expected_checkin') }}</strong>@if ($asset->expected_checkin!='')- {{ Helper::getFormattedDateObject($asset->expected_checkin, 'date', false) }}+ {{ Helper::getFormattedDateObject($asset->expected_checkin, 'datetime', false) }}<span class="text-muted hidden-sm hidden-md">{{ Carbon::parse($asset->expected_checkin)->diffForHumans(['parts' => 2]) }}</span>@else{{ trans('general.na') }}diff --git a/resources/views/kits/checkout.blade.php b/resources/views/kits/checkout.blade.phpindex c86552d802..a1ad69f329 100644--- a/resources/views/kits/checkout.blade.php+++ b/resources/views/kits/checkout.blade.php@@ -45,10 +45,9 @@input_div_class="col-md-4"><x-slot:input>- <x-input.datepicker+ <x-input.datetimepickername="expected_checkin":value="old('expected_checkin')"- :placeholder="trans('general.select_date')"/></x-slot:input></x-form.row>diff --git a/resources/views/layouts/default.blade.php b/resources/views/layouts/default.blade.phpindex ea0d76a843..5749db7790 100644--- a/resources/views/layouts/default.blade.php+++ b/resources/views/layouts/default.blade.php@@ -304,6 +304,66 @@overflow-y: auto;}+ /*+ eonasdan bootstrap-datetimepicker widget: match the app's theme color+ 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.+ */+ .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. */+ .bootstrap-datetimepicker-widget.dropdown-menu.timepicker-sbs {+ width: 42em !important;+ }+ .bootstrap-datetimepicker-widget table td.active,+ .bootstrap-datetimepicker-widget table td.active:hover,+ .bootstrap-datetimepicker-widget table td span.active,+ .bootstrap-datetimepicker-widget table td span.active:hover {+ background-color: var(--main-theme-color) !important;+ color: var(--nav-primary-text-color) !important;+ text-shadow: none !important;+ }+ .bootstrap-datetimepicker-widget table td.today:before {+ border-bottom-color: var(--main-theme-color) !important;+ }+ .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;+ }+ /* 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 {+ color: var(--color-fg) !important;+ }+ .bootstrap-datetimepicker-widget .picker-switch table td:hover {+ background-color: transparent !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;+ }+.input-group-addon {background-color: var(--input-group-bg) !important;diff --git a/resources/views/models/custom_fields_form_bulk_edit.blade.php b/resources/views/models/custom_fields_form_bulk_edit.blade.phpindex c6f2f32313..f09775adc1 100644--- a/resources/views/models/custom_fields_form_bulk_edit.blade.php+++ b/resources/views/models/custom_fields_form_bulk_edit.blade.php@@ -118,6 +118,17 @@</div>+ @elseif ($field->format=='DATETIME')++ <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()}) : '')"+ col_size_class="col-md-5"+ :default_now="false"+ />++@else@if (($field->field_encrypted=='0') || (Gate::allows('admin')))diff --git a/resources/views/partials/forms/edit/datetimepicker.blade.php b/resources/views/partials/forms/edit/datetimepicker.blade.phpnew file mode 100644index 0000000000..e96fbe52c6--- /dev/null+++ b/resources/views/partials/forms/edit/datetimepicker.blade.php@@ -0,0 +1,21 @@+<!-- Datetimepicker -->+<div class="form-group{{ $errors->has($fieldname) ? ' has-error' : '' }}">+ <label for="{{ $fieldname }}" class="col-md-3 control-label">{{ $translated_name }}</label>+ <div class="input-group col-md-4">+ <x-input.datetimepicker+ name="{{ $fieldname }}"+ value="{{ old($fieldname, ($item->{$fieldname}) ? date('Y-m-d H:i:s', strtotime($item->{$fieldname})) : '') }}"+ required="{{ Helper::checkIfRequired($item, $fieldname) }}"+ />+ <x-form.error :name="$fieldname" />+ </div>+ @if (isset($help_text))+ <div class="col-md-8 col-md-offset-3">+ <p class="help-block">+ {!! $help_text !!}+ </p>+ </div>+ @endif+</div>++<!-- /Datetimepicker -->