diff --git a/app/Http/Controllers/Admin/SalesController.php b/app/Http/Controllers/Admin/SalesController.php index ff536d3..6fdc97c 100644 --- a/app/Http/Controllers/Admin/SalesController.php +++ b/app/Http/Controllers/Admin/SalesController.php @@ -35,6 +35,7 @@ class SalesController extends Controller $machineId = $request->input('machine_id'); $paymentType = $request->input('payment_type'); $status = $request->input('status'); + $deliveryStatus = $request->input('delivery_status'); $startDate = $request->input('start_date'); $endDate = $request->input('end_date'); @@ -55,6 +56,7 @@ class SalesController extends Controller 'machine_id' => $machineId, 'payment_type' => $paymentType, 'status' => $status, + 'delivery_status' => $deliveryStatus, 'start_date' => $request->input('start_date'), // 保留原始輸入以顯示於 UI (如果是隱含的則 UI 顯示空) 'end_date' => $request->input('end_date'), ], @@ -126,6 +128,11 @@ class SalesController extends Controller if ($tab === 'orders') { if ($paymentType) $ordersQuery->where('payment_type', $paymentType); if ($status) $ordersQuery->where('status', $status); + // 出貨狀態:唯有付款成功(completed/paid)的單才有出貨結果,需與列表顯示邏輯 (hasDeliveryOutcome) 一致 + if ($deliveryStatus !== null && $deliveryStatus !== '') { + $ordersQuery->whereIn('status', [Order::STATUS_COMPLETED, 'paid']) + ->where('delivery_status', $deliveryStatus); + } } // 發票專用過濾器:狀態(pending/issued/failed/void) diff --git a/lang/en.json b/lang/en.json index 2f91f32..3da0062 100644 --- a/lang/en.json +++ b/lang/en.json @@ -112,9 +112,11 @@ "All Categories": "All Categories", "All Command Types": "All Command Types", "All Companies": "All Companies", + "All Dispense Statuses": "All Dispense Statuses", "All Levels": "All Levels", "All Machines": "All Machines", "All Normal": "All Normal", + "All Payment Statuses": "All Payment Statuses", "All Permissions": "All Permissions", "All Products (ALL)": "All Products (ALL)", "All Slots": "All Slots", @@ -1525,6 +1527,7 @@ "Page 69": "Page 69", "Page 7": "Page 7", "Page Lock Status": "Page Lock Status", + "Paid": "Paid", "Parameters": "Parameters", "Partial Dispense Success": "Partial Dispense Success", "Pass Code": "Pass Code", diff --git a/lang/ja.json b/lang/ja.json index d0fb4aa..87f8953 100644 --- a/lang/ja.json +++ b/lang/ja.json @@ -112,9 +112,11 @@ "All Categories": "すべてのカテゴリ", "All Command Types": "すべてのコマンドタイプ", "All Companies": "すべての会社", + "All Dispense Statuses": "すべての出庫ステータス", "All Levels": "すべてのレベル", "All Machines": "すべての機器", "All Normal": "すべて正常", + "All Payment Statuses": "すべての決済ステータス", "All Permissions": "すべての権限", "All Products (ALL)": "全商品 (ALL)", "All Slots": "すべてのスロット", @@ -1525,6 +1527,7 @@ "Page 69": "ページ 69 (購入キャンセル)", "Page 7": "ページ 7 (ロックページ)", "Page Lock Status": "ページロックステータス", + "Paid": "支払い済み", "Parameters": "パラメータ設定", "Partial Dispense Success": "一部出庫成功", "Pass Code": "パスコード", diff --git a/lang/zh_TW.json b/lang/zh_TW.json index 3430ff7..004bc5f 100644 --- a/lang/zh_TW.json +++ b/lang/zh_TW.json @@ -112,9 +112,11 @@ "All Categories": "所有分類", "All Command Types": "所有指令類型", "All Companies": "所有公司", + "All Dispense Statuses": "所有出貨狀態", "All Levels": "所有層級", "All Machines": "所有機台", "All Normal": "運作正常", + "All Payment Statuses": "所有付款狀態", "All Permissions": "全部權限", "All Products (ALL)": "全部商品 (ALL)", "All Slots": "所有貨道", @@ -1525,6 +1527,7 @@ "Page 69": "取消購買", "Page 7": "鎖定頁", "Page Lock Status": "頁面鎖定狀態", + "Paid": "已付款", "Parameters": "參數設定", "Partial Dispense Success": "部分出貨成功", "Pass Code": "通行碼", diff --git a/resources/views/admin/machines/index.blade.php b/resources/views/admin/machines/index.blade.php index e5b8185..58ec525 100644 --- a/resources/views/admin/machines/index.blade.php +++ b/resources/views/admin/machines/index.blade.php @@ -49,6 +49,7 @@ inventoryLoading: false, startDate: '', endDate: '', + selectedLevel: '', tab: 'list', viewMode: 'fleet', selectedMachine: null, @@ -321,6 +322,7 @@ let url = '/admin/machines/' + this.currentMachineId + '/logs-ajax?type=' + this.activeTab + '&page=' + page; if (this.startDate) url += '&start_date=' + this.startDate; if (this.endDate) url += '&end_date=' + this.endDate; + if (this.selectedLevel) url += '&level=' + this.selectedLevel; const res = await fetch(url); const data = await res.json(); @@ -993,7 +995,7 @@