diff --git a/app/Http/Controllers/Admin/StaffCardController.php b/app/Http/Controllers/Admin/StaffCardController.php index 5707fc1..60a7ec9 100644 --- a/app/Http/Controllers/Admin/StaffCardController.php +++ b/app/Http/Controllers/Admin/StaffCardController.php @@ -32,7 +32,7 @@ class StaffCardController extends Controller $q->where('company_id', $request->company_id); }); - $logsQuery = StaffCardLog::with(['staffCard', 'machine']) + $logsQuery = StaffCardLog::with(['staffCard', 'machine', 'order']) ->when($request->log_search, function ($q) use ($request) { $q->whereHas('staffCard', function ($sq) use ($request) { $sq->where('name', 'like', "%{$request->log_search}%") diff --git a/app/Models/StaffCardLog.php b/app/Models/StaffCardLog.php index d727f8d..b2cd862 100644 --- a/app/Models/StaffCardLog.php +++ b/app/Models/StaffCardLog.php @@ -45,4 +45,12 @@ class StaffCardLog extends Model { return $this->belongsTo(Machine::class); } + + /** + * 取得關聯的訂單 + */ + public function order(): BelongsTo + { + return $this->belongsTo(\App\Models\Transaction\Order::class); + } } diff --git a/lang/zh_TW.json b/lang/zh_TW.json index c831b6a..3ac1758 100644 --- a/lang/zh_TW.json +++ b/lang/zh_TW.json @@ -206,6 +206,7 @@ "Cannot delete warehouse with existing stock": "無法刪除仍有庫存的倉庫", "Card Machine System": "刷卡機系統", "Card Reader": "刷卡機", + "Card UID": "卡片 UID", "Card Reader No": "刷卡機編號", "Card Reader Reboot": "刷卡機重啟", "Card Reader Restart": "卡機重啟", @@ -302,6 +303,7 @@ "Contract Start": "合約起始", "Contract Until (Optional)": "合約到期日 (選填)", "Contract information updated": "合約資訊已更新", + "Consumed": "核銷成功", "Control": "監控操作", "Copy": "複製", "Copy Code": "複製代碼", @@ -665,6 +667,7 @@ "Hrs": "小時", "IC Card UID": "IC 卡號", "ITEM": "ITEM", + "Identification": "識別資訊", "Identity & Codes": "識別與代碼", "Image": "圖片", "Image Downloaded": "圖片已下載", @@ -759,6 +762,7 @@ "Loyalty & Features": "行銷與點數", "Machine": "機台", "Machine / Date": "機台 / 日期", + "Machine / Employee": "機台 / 員工", "Machine / Pass Code": "機台 / 通行碼", "Machine / Slot": "機台 / 貨道", "Machine Advertisement Settings": "機台廣告設置", @@ -1421,6 +1425,7 @@ "Spring": "彈簧", "Spring Channel Limit": "彈簧貨道上限", "Spring Limit": "彈簧貨道上限", + "Staff": "員工", "Staff Identification Management": "員工識別管理", "Staff List": "員工列表", "Staff Name": "員工姓名", @@ -1851,6 +1856,8 @@ "used": "已使用", "user": "一般用戶", "vending": "販賣頁", + "Verified": "驗證成功", + "Verified Only": "僅限驗證", "verified": "驗證成功", "verify_success": "驗證成功", "video": "影片", diff --git a/resources/views/admin/data-config/staff-cards/partials/tab-usage-logs.blade.php b/resources/views/admin/data-config/staff-cards/partials/tab-usage-logs.blade.php index 2c65a30..0be6e0c 100644 --- a/resources/views/admin/data-config/staff-cards/partials/tab-usage-logs.blade.php +++ b/resources/views/admin/data-config/staff-cards/partials/tab-usage-logs.blade.php @@ -62,81 +62,67 @@ - {{ __('Time') }} + {{ __('Machine / Employee') }} - - {{ __('Employee') }} - - - {{ __('IC Card UID') }} - - - {{ __('Machine') }} - - + {{ __('Action') }} - - {{ __('Status') }} + + {{ __('Identification') }} + + + {{ __('Sales Record') }} + + + {{ __('Time') }} @forelse($logs as $log) - - {{ $log->created_at->format('Y-m-d H:i:s') }} - - -
- {{ $log->staffCard?->name ?? __('Unknown') }} - {{ $log->staffCard?->employee_id ?? '-' }} -
- - - {{ $log->staffCard?->card_uid ?? '-' }} - - -
-
+ +
+
- {{ $log->machine?->name ?? __('Unknown Machine') }} - {{ $log->machine?->serial_no ?? '-' }} + + {{ $log->machine?->name ?? $log->machine?->serial_no ?? __('Unknown Machine') }} + + + {{ __('Staff') }}: {{ $log->staffCard?->name ?? __('Unknown') }} +
- + - -
- @if($log->action === 'consume') - - - - - {{ __('Usage Completed') }} - - @if($log->order_id) - - - - - - @endif - @else - - {{ __('Verified Only') }} - - @endif + +
+ {{ $log->staffCard?->employee_id ?? '-' }} + {{ $log->staffCard?->card_uid ?? '-' }}
+ + @if($log->order_id) + + + {{ $log->order?->order_no ?? '#' . $log->order_id }} + + @else + + {{ __('Verified Only') }} + + @endif + + + {{ $log->created_at->format('Y-m-d H:i:s') }} + @empty @@ -154,15 +140,15 @@
- +
-

- {{ $log->created_at->format('Y-m-d H:i:s') }} +

+ {{ $log->machine?->name ?? $log->machine?->serial_no ?? __('Unknown Machine') }}

-

- {{ $log->staffCard?->name ?? __('Unknown') }} +

+ {{ __('Staff') }}: {{ $log->staffCard?->name ?? __('Unknown') }}

@@ -170,29 +156,47 @@
+ +
-

- {{ __('Status') }} +

+ {{ __('Employee ID') }} +

+

+ {{ $log->staffCard?->employee_id ?? '-' }} +

+
+
+

+ {{ __('Card UID') }} +

+

+ {{ $log->staffCard?->card_uid ?? '-' }} +

+
+
+

+ {{ __('Sales Record') }} +

+ @if($log->order_id) + + + {{ $log->order?->order_no ?? '#' . $log->order_id }} + + @else + + {{ __('Verified Only') }} + + @endif +
+
+

+ {{ __('Time') }} +

+

+ {{ $log->created_at->format('Y-m-d H:i:s') }}

-
- @if($log->action === 'consume') - - - - - {{ __('Usage Completed') }} - - @if($log->order_id) - - #{{ $log->order_id }} - - @endif - @else - - {{ __('Verified Only') }} - - @endif -
diff --git a/resources/views/components/status-badge.blade.php b/resources/views/components/status-badge.blade.php index c307a78..6774b0c 100644 --- a/resources/views/components/status-badge.blade.php +++ b/resources/views/components/status-badge.blade.php @@ -57,7 +57,9 @@ 'expired' => ['label' => __('Expired'), 'color' => 'rose'], 'cancelled'=> ['label' => __('Cancelled'),'color' => 'slate'], 'verify_success' => ['label' => __('Verified'), 'color' => 'emerald'], - 'consume' => ['label' => __('Consumed'), 'color' => 'cyan'], + 'verified' => ['label' => __('Verified'), 'color' => 'emerald'], + 'consume' => ['label' => __('Consumed'), 'color' => 'cyan'], + 'completed' => ['label' => __('Completed'), 'color' => 'cyan'], ]; $preset = $presets[$status] ?? ['label' => $status, 'color' => 'slate'];