star-cloud/resources/views/admin/sales/pickup-codes/partials/tab-logs.blade.php
sky121113 820e1c87db [FIX] 取貨碼操作紀錄顯示異常修正
1. 修正 index.blade.php 的 HTML 標籤嵌套錯誤,解決操作紀錄分頁空白問題。
2. 移除暫時的除錯訊息。
3. 整合 SystemOperationLog 機制於取貨碼模組。
2026-04-30 10:28:04 +08:00

99 lines
7.0 KiB
PHP

<div class="overflow-hidden bg-white/80 dark:bg-slate-900/80 backdrop-blur-xl border border-slate-200 dark:border-slate-800 shadow-sm rounded-xl">
<div class="overflow-x-auto">
<table class="min-w-full divide-y divide-slate-200 dark:divide-slate-800">
<thead class="bg-slate-50/50 dark:bg-slate-800/50">
<tr>
<th scope="col" class="px-6 py-4 text-left text-xs font-semibold text-slate-500 dark:text-slate-400 uppercase tracking-wider">
{{ __('Time') }}
</th>
<th scope="col" class="px-6 py-4 text-left text-xs font-semibold text-slate-500 dark:text-slate-400 uppercase tracking-wider">
{{ __('Operator') }}
</th>
<th scope="col" class="px-6 py-4 text-left text-xs font-semibold text-slate-500 dark:text-slate-400 uppercase tracking-wider">
{{ __('Actions') }}
</th>
<th scope="col" class="px-6 py-4 text-left text-xs font-semibold text-slate-500 dark:text-slate-400 uppercase tracking-wider">
{{ __('Target') }}
</th>
<th scope="col" class="px-6 py-4 text-left text-xs font-semibold text-slate-500 dark:text-slate-400 uppercase tracking-wider">
{{ __('Notes') }}
</th>
</tr>
</thead>
<tbody class="divide-y divide-slate-200 dark:divide-slate-800">
@forelse($logs as $log)
<tr class="hover:bg-slate-50/50 dark:hover:bg-slate-800/50 transition-colors duration-200">
<td class="px-6 py-4 whitespace-nowrap text-sm text-slate-600 dark:text-slate-300">
{{ $log->created_at->format('Y-m-d H:i:s') }}
</td>
<td class="px-6 py-4 whitespace-nowrap">
<div class="flex items-center gap-2">
<div class="w-6 h-6 rounded-full bg-indigo-100 dark:bg-indigo-900/50 flex items-center justify-center text-indigo-600 dark:text-indigo-400 text-xs font-medium">
{{ Str::substr($log->user->name ?? 'Sys', 0, 1) }}
</div>
<span class="text-sm font-medium text-slate-700 dark:text-slate-200">
{{ $log->user->name ?? __('System') }}
</span>
</div>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm">
@if($log->action === 'create')
<span class="inline-flex items-center px-2 py-1 rounded-md text-xs font-medium bg-emerald-50 text-emerald-700 dark:bg-emerald-500/10 dark:text-emerald-400 border border-emerald-200 dark:border-emerald-800/50">
{{ __('Generate') }}
</span>
@elseif($log->action === 'update')
<span class="inline-flex items-center px-2 py-1 rounded-md text-xs font-medium bg-blue-50 text-blue-700 dark:bg-blue-500/10 dark:text-blue-400 border border-blue-200 dark:border-blue-800/50">
{{ __('Update') }}
</span>
@elseif($log->action === 'cancel')
<span class="inline-flex items-center px-2 py-1 rounded-md text-xs font-medium bg-rose-50 text-rose-700 dark:bg-rose-500/10 dark:text-rose-400 border border-rose-200 dark:border-rose-800/50">
{{ __('Cancel') }}
</span>
@else
<span class="inline-flex items-center px-2 py-1 rounded-md text-xs font-medium bg-slate-50 text-slate-700 dark:bg-slate-500/10 dark:text-slate-400 border border-slate-200 dark:border-slate-800/50">
{{ $log->action }}
</span>
@endif
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-slate-600 dark:text-slate-300">
ID: {{ $log->target_id }}
@if($log->new_values && isset($log->new_values['code']))
<span class="ml-2 px-2 py-0.5 rounded text-xs bg-slate-100 dark:bg-slate-800 font-mono">
{{ $log->new_values['code'] }}
</span>
@endif
</td>
<td class="px-6 py-4 text-sm text-slate-500 dark:text-slate-400">
@if($log->action === 'update' && isset($log->old_values['expires_at']) && isset($log->new_values['expires_at']))
<div>{{ __('Expires At') }}:
<span class="line-through opacity-70">{{ \Carbon\Carbon::parse($log->old_values['expires_at'])->format('Y-m-d H:i') }}</span>
<svg class="inline w-3 h-3 mx-1 text-slate-400" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M13.5 4.5L21 12m0 0l-7.5 7.5M21 12H3" /></svg>
<span class="text-amber-600 dark:text-amber-400 font-medium">{{ \Carbon\Carbon::parse($log->new_values['expires_at'])->format('Y-m-d H:i') }}</span>
</div>
@endif
</td>
</tr>
@empty
<tr>
<td colspan="5" class="px-6 py-12 text-center">
<div class="flex flex-col items-center justify-center text-slate-400 dark:text-slate-500">
<svg class="w-12 h-12 mb-4 opacity-50" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" d="M12 9v3.75m9-.75a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9 3.75h.008v.008H12v-.008Z" />
</svg>
<p class="text-sm font-medium">{{ __('No records found') }}</p>
</div>
</td>
</tr>
@endforelse
</tbody>
</table>
</div>
<!-- Pagination -->
@if(isset($logs) && $logs instanceof \Illuminate\Pagination\LengthAwarePaginator && $logs->hasPages())
<div class="px-6 py-4 border-t border-slate-200 dark:border-slate-800 bg-slate-50/50 dark:bg-slate-800/50">
{{ $logs->links('vendor.pagination.luxury') }}
</div>
@endif
</div>