[PROMOTE] 晉升 dev 變更至 demo 環境
1. 包含:優化遠端管理與庫存歷史紀錄之日期篩選介面 (feat/remote-date-ui-opt)
This commit is contained in:
commit
f6a406459a
@ -72,6 +72,9 @@ class RemoteController extends Controller
|
|||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
// 忽略解析錯誤
|
// 忽略解析錯誤
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// 預設過濾當天紀錄
|
||||||
|
$historyQuery->whereDate('created_at', now()->toDateString());
|
||||||
}
|
}
|
||||||
|
|
||||||
// 指令類型過濾
|
// 指令類型過濾
|
||||||
@ -259,6 +262,9 @@ class RemoteController extends Controller
|
|||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
// 忽略解析錯誤
|
// 忽略解析錯誤
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// 預設過濾當天紀錄
|
||||||
|
$historyQuery->whereDate('created_at', now()->toDateString());
|
||||||
}
|
}
|
||||||
|
|
||||||
// 狀態過濾
|
// 狀態過濾
|
||||||
|
|||||||
@ -36,41 +36,47 @@
|
|||||||
class="luxury-input py-2.5 pl-12 pr-6 block w-full sm:w-72 text-sm font-bold">
|
class="luxury-input py-2.5 pl-12 pr-6 block w-full sm:w-72 text-sm font-bold">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{-- 日期範圍 --}}
|
{{-- 起始時間 --}}
|
||||||
<div class="relative group w-full sm:w-72 sm:flex-none" x-data="{
|
<div class="relative group w-full sm:w-48 sm:flex-none">
|
||||||
fp: null,
|
|
||||||
startDate: '{{ request('start_date') }}',
|
|
||||||
endDate: '{{ request('end_date') }}'
|
|
||||||
}" x-init="fp = flatpickr($refs.dateRange, {
|
|
||||||
mode: 'range',
|
|
||||||
dateFormat: 'Y-m-d H:i', enableTime: true, time_24hr: true,
|
|
||||||
defaultHour: 0,
|
|
||||||
defaultMinute: 0,
|
|
||||||
locale: 'zh_tw',
|
|
||||||
defaultDate: startDate && endDate ? [startDate, endDate] : (startDate ? [startDate] : []),
|
|
||||||
onChange: function(selectedDates, dateStr, instance) {
|
|
||||||
if (selectedDates.length === 2) {
|
|
||||||
$refs.startDate.value = instance.formatDate(selectedDates[0], 'Y-m-d H:i');
|
|
||||||
$refs.endDate.value = instance.formatDate(selectedDates[1], 'Y-m-d H:i');
|
|
||||||
} else if (selectedDates.length === 0) {
|
|
||||||
$refs.startDate.value = '';
|
|
||||||
$refs.endDate.value = '';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})">
|
|
||||||
<span class="absolute inset-y-0 left-0 flex items-center pl-4 pointer-events-none z-10 text-slate-400 group-focus-within:text-cyan-500 transition-colors">
|
<span class="absolute inset-y-0 left-0 flex items-center pl-4 pointer-events-none z-10 text-slate-400 group-focus-within:text-cyan-500 transition-colors">
|
||||||
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
<svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z" />
|
||||||
d="M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z" />
|
|
||||||
</svg>
|
</svg>
|
||||||
</span>
|
</span>
|
||||||
<input type="hidden" name="start_date" x-ref="startDate"
|
<input type="text" name="start_date"
|
||||||
value="{{ request('start_date') }}">
|
x-init="flatpickr($el, {
|
||||||
<input type="hidden" name="end_date" x-ref="endDate" value="{{ request('end_date') }}">
|
dateFormat: 'Y-m-d H:i',
|
||||||
<input type="text" x-ref="dateRange"
|
enableTime: true,
|
||||||
value="{{ request('start_date') && request('end_date') ? request('start_date') . ' ' . __('to') . ' ' . request('end_date') : (request('start_date') ?: '') }}"
|
time_24hr: true,
|
||||||
placeholder="{{ __('Select Date Range') }}"
|
locale: 'zh_tw',
|
||||||
class="luxury-input py-2.5 pl-12 pr-6 block w-full text-sm font-bold cursor-pointer">
|
defaultDate: $el.value
|
||||||
|
})"
|
||||||
|
value="{{ request('start_date', now()->startOfDay()->format('Y-m-d H:i')) }}"
|
||||||
|
placeholder="{{ __('Start Date') }}"
|
||||||
|
class="luxury-input py-2.5 pl-12 pr-4 block w-full text-sm font-bold cursor-pointer">
|
||||||
|
<div class="absolute -top-2 left-4 px-1 bg-white dark:bg-slate-900 text-[9px] font-black text-slate-400 uppercase tracking-widest opacity-0 group-focus-within:opacity-100 transition-opacity">{{ __('Start Time') }}</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- 結束時間 --}}
|
||||||
|
<div class="relative group w-full sm:w-48 sm:flex-none">
|
||||||
|
<span class="absolute inset-y-0 left-0 flex items-center pl-4 pointer-events-none z-10 text-slate-400 group-focus-within:text-cyan-500 transition-colors">
|
||||||
|
<svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||||
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z" />
|
||||||
|
</svg>
|
||||||
|
</span>
|
||||||
|
<input type="text" name="end_date"
|
||||||
|
x-init="flatpickr($el, {
|
||||||
|
dateFormat: 'Y-m-d H:i',
|
||||||
|
enableTime: true,
|
||||||
|
time_24hr: true,
|
||||||
|
locale: 'zh_tw',
|
||||||
|
defaultDate: $el.value,
|
||||||
|
position: 'auto right'
|
||||||
|
})"
|
||||||
|
value="{{ request('end_date', now()->endOfDay()->format('Y-m-d H:i')) }}"
|
||||||
|
placeholder="{{ __('End Date') }}"
|
||||||
|
class="luxury-input py-2.5 pl-12 pr-4 block w-full text-sm font-bold cursor-pointer">
|
||||||
|
<div class="absolute -top-2 left-4 px-1 bg-white dark:bg-slate-900 text-[9px] font-black text-slate-400 uppercase tracking-widest opacity-0 group-focus-within:opacity-100 transition-opacity">{{ __('End Time') }}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{-- 指令類型 --}}
|
{{-- 指令類型 --}}
|
||||||
|
|||||||
@ -17,45 +17,49 @@
|
|||||||
placeholder="{{ __('Search machines...') }}" class="luxury-input py-2.5 pl-12 pr-6 block w-full">
|
placeholder="{{ __('Search machines...') }}" class="luxury-input py-2.5 pl-12 pr-6 block w-full">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Date Range -->
|
<!-- Start Date -->
|
||||||
<div class="relative group flex-[2] min-w-[340px]" x-data="{
|
<div class="relative group flex-1 min-w-[180px]">
|
||||||
fp: null,
|
<span class="absolute inset-y-0 left-0 flex items-center pl-4 pointer-events-none z-10 text-slate-400 group-focus-within:text-cyan-500 transition-colors">
|
||||||
startDate: '{{ request('start_date') }}',
|
<svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||||
endDate: '{{ request('end_date') }}'
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z" />
|
||||||
}" x-init="fp = flatpickr($refs.dateRange, {
|
|
||||||
mode: 'range',
|
|
||||||
dateFormat: 'Y-m-d H:i', enableTime: true, time_24hr: true,
|
|
||||||
defaultHour: 0,
|
|
||||||
defaultMinute: 0,
|
|
||||||
locale: 'zh_tw',
|
|
||||||
defaultDate: startDate && endDate ? [startDate, endDate] : (startDate ? [startDate] : []),
|
|
||||||
onChange: function(selectedDates, dateStr, instance) {
|
|
||||||
if (selectedDates.length === 2) {
|
|
||||||
$refs.startDate.value = instance.formatDate(selectedDates[0], 'Y-m-d H:i');
|
|
||||||
$refs.endDate.value = instance.formatDate(selectedDates[1], 'Y-m-d H:i');
|
|
||||||
historyStartDate = $refs.startDate.value;
|
|
||||||
historyEndDate = $refs.endDate.value;
|
|
||||||
} else if (selectedDates.length === 0) {
|
|
||||||
$refs.startDate.value = '';
|
|
||||||
$refs.endDate.value = '';
|
|
||||||
historyStartDate = '';
|
|
||||||
historyEndDate = '';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})">
|
|
||||||
<span
|
|
||||||
class="absolute inset-y-0 left-0 flex items-center pl-4 pointer-events-none z-10 text-slate-400 group-focus-within:text-cyan-500 transition-colors">
|
|
||||||
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
||||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
|
||||||
d="M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z" />
|
|
||||||
</svg>
|
</svg>
|
||||||
</span>
|
</span>
|
||||||
<input type="hidden" name="start_date" x-ref="startDate" value="{{ request('start_date') }}">
|
<input type="text" name="start_date"
|
||||||
<input type="hidden" name="end_date" x-ref="endDate" value="{{ request('end_date') }}">
|
x-model="historyStartDate"
|
||||||
<input type="text" x-ref="dateRange"
|
x-init="flatpickr($el, {
|
||||||
value="{{ request('start_date') && request('end_date') ? request('start_date') . ' 至 ' . request('end_date') : (request('start_date') ?: '') }}"
|
dateFormat: 'Y-m-d H:i',
|
||||||
placeholder="{{ __('Select Date Range') }}"
|
enableTime: true,
|
||||||
class="luxury-input py-2.5 pl-12 pr-6 block w-full cursor-pointer">
|
time_24hr: true,
|
||||||
|
locale: 'zh_tw',
|
||||||
|
defaultDate: historyStartDate || '{{ now()->startOfDay()->format('Y-m-d H:i') }}',
|
||||||
|
onChange: (selectedDates, dateStr) => { historyStartDate = dateStr }
|
||||||
|
})"
|
||||||
|
placeholder="{{ __('Start Date') }}"
|
||||||
|
class="luxury-input py-2.5 pl-12 pr-4 block w-full text-sm font-bold cursor-pointer">
|
||||||
|
<div class="absolute -top-2 left-4 px-1 bg-white dark:bg-slate-900 text-[9px] font-black text-slate-400 uppercase tracking-widest opacity-0 group-focus-within:opacity-100 transition-opacity">{{ __('Start Time') }}</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- End Date -->
|
||||||
|
<div class="relative group flex-1 min-w-[180px]">
|
||||||
|
<span class="absolute inset-y-0 left-0 flex items-center pl-4 pointer-events-none z-10 text-slate-400 group-focus-within:text-cyan-500 transition-colors">
|
||||||
|
<svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||||
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z" />
|
||||||
|
</svg>
|
||||||
|
</span>
|
||||||
|
<input type="text" name="end_date"
|
||||||
|
x-model="historyEndDate"
|
||||||
|
x-init="flatpickr($el, {
|
||||||
|
dateFormat: 'Y-m-d H:i',
|
||||||
|
enableTime: true,
|
||||||
|
time_24hr: true,
|
||||||
|
locale: 'zh_tw',
|
||||||
|
defaultDate: historyEndDate || '{{ now()->endOfDay()->format('Y-m-d H:i') }}',
|
||||||
|
position: 'auto right',
|
||||||
|
onChange: (selectedDates, dateStr) => { historyEndDate = dateStr }
|
||||||
|
})"
|
||||||
|
placeholder="{{ __('End Date') }}"
|
||||||
|
class="luxury-input py-2.5 pl-12 pr-4 block w-full text-sm font-bold cursor-pointer">
|
||||||
|
<div class="absolute -top-2 left-4 px-1 bg-white dark:bg-slate-900 text-[9px] font-black text-slate-400 uppercase tracking-widest opacity-0 group-focus-within:opacity-100 transition-opacity">{{ __('End Time') }}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Status -->
|
<!-- Status -->
|
||||||
|
|||||||
@ -25,8 +25,8 @@
|
|||||||
// 機器搜尋狀態
|
// 機器搜尋狀態
|
||||||
machineSearch: '{{ request('machine_search') }}',
|
machineSearch: '{{ request('machine_search') }}',
|
||||||
historySearch: '{{ request('search') }}',
|
historySearch: '{{ request('search') }}',
|
||||||
historyStartDate: '{{ request('start_date') }}',
|
historyStartDate: '{{ request('start_date', now()->startOfDay()->format('Y-m-d H:i')) }}',
|
||||||
historyEndDate: '{{ request('end_date') }}',
|
historyEndDate: '{{ request('end_date', now()->endOfDay()->format('Y-m-d H:i')) }}',
|
||||||
historyStatus: '{{ request('status') }}',
|
historyStatus: '{{ request('status') }}',
|
||||||
|
|
||||||
async init() {
|
async init() {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user