Merge branch 'feat/discord-notification' into dev
This commit is contained in:
commit
e88d68d3b1
@ -230,10 +230,11 @@
|
||||
|
||||
<!-- 公司篩選下拉選單 (僅 System Admin 可見) -->
|
||||
@if(auth()->user()->isSystemAdmin())
|
||||
<div class="w-full md:w-64 relative focus-within:z-[20]">
|
||||
<div class="w-full md:w-64 relative focus-within:z-[20]"
|
||||
@change="$el.closest('form').dispatchEvent(new Event('submit'))">
|
||||
<x-searchable-select name="filter_company_id" :placeholder="__('All Companies')" :selected="request('filter_company_id')">
|
||||
@foreach($allCompanies as $c)
|
||||
<option value="{{ $c->id }}" data-title="{{ $c->name }}">{{ $c->name }}</option>
|
||||
<option value="{{ $c->id }}" data-title="{{ $c->name }}" {{ (string)request('filter_company_id') === (string)$c->id ? 'selected' : '' }}>{{ $c->name }}</option>
|
||||
@endforeach
|
||||
</x-searchable-select>
|
||||
</div>
|
||||
@ -244,7 +245,19 @@
|
||||
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24" stroke-width="2.5"><path stroke-linecap="round" stroke-linejoin="round" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"/></svg>
|
||||
</button>
|
||||
<button type="button"
|
||||
@click="$el.closest('form').querySelector('input[name=search_machine]').value=''; @if(auth()->user()->isSystemAdmin()) $el.closest('form').querySelector('select[name=filter_company_id]').value=''; @endif $el.closest('form').dispatchEvent(new Event('submit'));"
|
||||
@click="
|
||||
const form = $el.closest('form');
|
||||
form.querySelector('input[name=search_machine]').value = '';
|
||||
@if(auth()->user()->isSystemAdmin())
|
||||
const nativeSel = form.querySelector('select[name=filter_company_id]');
|
||||
if (nativeSel) {
|
||||
nativeSel.value = ' ';
|
||||
const inst = window.HSSelect?.getInstance(nativeSel);
|
||||
if (inst) inst.setValue(' ');
|
||||
}
|
||||
@endif
|
||||
form.dispatchEvent(new Event('submit'));
|
||||
"
|
||||
class="p-2.5 rounded-xl bg-slate-100 dark:bg-slate-800 text-slate-500 hover:bg-slate-200 dark:hover:bg-slate-700 transition-all" title="{{ __('Reset') }}">
|
||||
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24" stroke-width="2.5"><path stroke-linecap="round" stroke-linejoin="round" d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"/></svg>
|
||||
</button>
|
||||
@ -1265,8 +1278,18 @@
|
||||
if (newContent && container) {
|
||||
container.innerHTML = newContent.innerHTML;
|
||||
window.history.pushState({}, '', url);
|
||||
// 先讓 Preline (HSSelect 等) 初始化完成,再由 Alpine 接管
|
||||
if (window.HSStaticMethods?.autoInit) window.HSStaticMethods.autoInit();
|
||||
if (window.Alpine?.initTree) window.Alpine.initTree(container);
|
||||
// Re-sync company filter HSSelect display after AJAX DOM replacement.
|
||||
const filterSelect = container.querySelector('select[name="filter_company_id"]');
|
||||
if (filterSelect) {
|
||||
const selectedValue = (filterSelect.value ?? '').trim();
|
||||
const hsSelect = window.HSSelect?.getInstance(filterSelect);
|
||||
if (hsSelect) hsSelect.setValue(selectedValue || ' ');
|
||||
}
|
||||
requestAnimationFrame(() => {
|
||||
if (window.Alpine?.initTree) window.Alpine.initTree(container);
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('AJAX Load Failed:', e);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user