diff --git a/app/Models/Machine/Machine.php b/app/Models/Machine/Machine.php index f446325..369d505 100644 --- a/app/Models/Machine/Machine.php +++ b/app/Models/Machine/Machine.php @@ -512,6 +512,16 @@ class Machine extends Model $this->attributes['card_terminal_enabled'] = (bool) $value; } + /** + * 是否需要在後台呈現刷卡機狀態燈號與日誌分頁。 + * 僅「基礎版(shopping_mode=basic)」且「刷卡機支付已啟用」的機台才有意義; + * 購物車模式或未啟用刷卡機的機台不顯示。 + */ + public function getShowCardTerminalAttribute(): bool + { + return $this->shopping_mode === 'basic' && $this->card_terminal_enabled; + } + public function getScanPayEsunEnabledAttribute(): bool { return (bool) ($this->settings['scan_pay_esun_enabled'] ?? ($this->attributes['scan_pay_esun_enabled'] ?? false)); diff --git a/database/migrations/2026_06_18_000001_add_status_lookup_index_to_machine_logs.php b/database/migrations/2026_06_18_000001_add_status_lookup_index_to_machine_logs.php new file mode 100644 index 0000000..18a5bb6 --- /dev/null +++ b/database/migrations/2026_06_18_000001_add_status_lookup_index_to_machine_logs.php @@ -0,0 +1,30 @@ +index(['machine_id', 'type', 'is_resolved', 'level'], 'machine_logs_status_lookup_index'); + }); + } + + public function down(): void + { + Schema::table('machine_logs', function (Blueprint $table) { + $table->dropIndex('machine_logs_status_lookup_index'); + }); + } +}; diff --git a/lang/en.json b/lang/en.json index bb6fac5..4fa8aa9 100644 --- a/lang/en.json +++ b/lang/en.json @@ -905,6 +905,7 @@ "Hardware & Network": "Hardware & Network", "Hardware & Slots": "Hardware & Slots", "Hardware Peripheral Settings": "Hardware Peripheral Settings", + "Hardware Status": "Hardware Status", "HashIV": "HashIV", "HashKey": "HashKey", "Heartbeat": "Heartbeat", @@ -2042,6 +2043,7 @@ "Sub Account Roles": "Sub Account Roles", "Sub Accounts": "Sub Accounts", "Sub-actions": "Sub-actions", + "Sub-machine": "Sub-machine", "Sub-machine Status": "Sub-machine Status", "Sub-machine Status Request": "Sub-machine Status Request", "Submachine Alert": "Submachine Alert", diff --git a/lang/ja.json b/lang/ja.json index 1700291..6d150b6 100644 --- a/lang/ja.json +++ b/lang/ja.json @@ -905,6 +905,7 @@ "Hardware & Network": "ハードウェア・ネットワーク", "Hardware & Slots": "ハードウェア・スロット", "Hardware Peripheral Settings": "ハードウェア周辺機器設定", + "Hardware Status": "ハードウェア状態", "HashIV": "HashIV", "HashKey": "HashKey", "Heartbeat": "ハートビート", @@ -2042,6 +2043,7 @@ "Sub Account Roles": "サブアカウントロール", "Sub Accounts": "サブアカウント", "Sub-actions": "サブアクション", + "Sub-machine": "サブマシン", "Sub-machine Status": "Sub-machine Status", "Sub-machine Status Request": "下位機ステータスリクエスト", "Submachine Alert": "下位機アラート", diff --git a/lang/zh_TW.json b/lang/zh_TW.json index 1b10223..4c8880d 100644 --- a/lang/zh_TW.json +++ b/lang/zh_TW.json @@ -285,7 +285,7 @@ "Card Reader Seconds": "刷卡機秒數", "Card Side Background": "左側卡片背景圖", "Card System": "刷卡機系統", - "Card Terminal": "刷卡機端", + "Card Terminal": "刷卡機", "Card Terminal Logs": "刷卡機日誌", "Card Terminal Status": "刷卡機狀態", "Card Terminal System": "刷卡機系統", @@ -905,6 +905,7 @@ "Hardware & Network": "硬體與網路", "Hardware & Slots": "硬體與貨道", "Hardware Peripheral Settings": "硬體周邊設定", + "Hardware Status": "硬體狀態", "HashIV": "HashIV", "HashKey": "HashKey", "Heartbeat": "心跳狀態", @@ -2042,6 +2043,7 @@ "Sub Account Roles": "子帳號角色", "Sub Accounts": "子帳號", "Sub-actions": "子項目", + "Sub-machine": "下位機", "Sub-machine Status": "下位機狀態", "Sub-machine Status Request": "下位機狀態回傳", "Submachine Alert": "下位機告警", diff --git a/resources/views/admin/machines/index.blade.php b/resources/views/admin/machines/index.blade.php index e8a071a..8947f87 100644 --- a/resources/views/admin/machines/index.blade.php +++ b/resources/views/admin/machines/index.blade.php @@ -43,6 +43,7 @@ currentMachineSn: '', currentMachineName: '', currentMachineAmbientTempEnabled: false, + currentMachineCardTerminalEnabled: false, logs: [], loading: false, inventoryLoading: false, @@ -87,11 +88,16 @@ }); }, - async openLogPanel(id, sn, name, ambientTempEnabled = false) { + async openLogPanel(id, sn, name, ambientTempEnabled = false, cardTerminalEnabled = false) { this.currentMachineId = id; this.currentMachineSn = sn; this.currentMachineName = name; this.currentMachineAmbientTempEnabled = ambientTempEnabled === true || ambientTempEnabled === 1 || ambientTempEnabled === '1' || ambientTempEnabled === 'true'; + this.currentMachineCardTerminalEnabled = cardTerminalEnabled === true || cardTerminalEnabled === 1 || cardTerminalEnabled === '1' || cardTerminalEnabled === 'true'; + // 若刷卡機分頁不可見且當前正停在該分頁,退回機台狀態分頁 + if (!this.currentMachineCardTerminalEnabled && this.activeTab === 'card_terminal') { + this.activeTab = 'status'; + } this.slots = []; this.showLogPanel = true; this.activeTab = 'status'; @@ -520,7 +526,7 @@ {{ __('Temperature') }}