From 7356304d6fd4c9357c49eb7fbdb4571524d10aa7 Mon Sep 17 00:00:00 2001 From: sky121113 Date: Wed, 29 Apr 2026 11:29:42 +0800 Subject: [PATCH] =?UTF-8?q?[STYLE]=20=E6=A9=9F=E5=8F=B0=E5=88=86=E4=BD=88?= =?UTF-8?q?=E5=9C=B0=E5=9C=96=E8=A1=8C=E5=8B=95=E7=AB=AF=E5=84=AA=E5=8C=96?= =?UTF-8?q?=E8=88=87=E8=A3=9C=E8=B2=A8=E7=AE=A1=E7=90=86=E9=82=8F=E8=BC=AF?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. 機台分佈頁面行動端優化:新增懸浮標題切換按鈕、抽屜式列表與毛玻璃視覺效果。 2. 修正補貨單指派視窗:優化下拉選單初始化邏輯,解決二次開啟時的選擇殘留問題。 3. 更新多語系檔 (zh_TW, en, ja):補齊機台分佈與補貨管理相關詞彙。 4. 移除暫存的簡報檔案 (star-cloud-demo-day.pptx)。 --- .../Controllers/Admin/WarehouseController.php | 44 +++--- lang/en.json | 7 +- lang/ja.json | 7 +- lang/zh_TW.json | 6 +- .../machines/distribution.blade.php | 135 ++++++++++++++++-- .../modal-replenishment-assign.blade.php | 14 +- .../modal-replenishment-status.blade.php | 21 ++- .../partials/table-replenishments.blade.php | 8 +- .../admin/warehouses/replenishments.blade.php | 28 +++- star-cloud-demo-day.pptx | Bin 122097 -> 0 bytes 10 files changed, 226 insertions(+), 44 deletions(-) delete mode 100644 star-cloud-demo-day.pptx diff --git a/app/Http/Controllers/Admin/WarehouseController.php b/app/Http/Controllers/Admin/WarehouseController.php index ce34029..858f44c 100644 --- a/app/Http/Controllers/Admin/WarehouseController.php +++ b/app/Http/Controllers/Admin/WarehouseController.php @@ -637,10 +637,11 @@ class WarehouseController extends Controller $products = Product::with('translations')->orderBy('name')->get(['id', 'name', 'image_url', 'name_dictionary_key']); // 同租戶帳號(用於指派人員) - $users = \App\Models\System\User::where('company_id', Auth::user()->company_id) - ->where('status', 'active') - ->orderBy('name') - ->get(['id', 'name']); + $userQuery = \App\Models\System\User::where('status', 1)->orderBy('name'); + if (!Auth::user()->isSystemAdmin()) { + $userQuery->where('company_id', Auth::user()->company_id); + } + $users = $userQuery->get(['id', 'name']); return view('admin.warehouses.replenishments', compact('orders', 'warehouses', 'machines', 'products', 'users')); } @@ -844,6 +845,7 @@ class WarehouseController extends Controller { $validated = $request->validate([ 'status' => 'required|in:prepared,delivering,completed', + 'assigned_to' => 'nullable|exists:users,id', ]); $newStatus = $validated['status']; @@ -855,9 +857,14 @@ class WarehouseController extends Controller ], 422); } - DB::transaction(function () use ($replenishmentOrder, $newStatus) { + DB::transaction(function () use ($replenishmentOrder, $newStatus, $validated) { $replenishmentOrder->loadMissing('items'); + // 更新指派人員 (如果有傳遞的話) + if (array_key_exists('assigned_to', $validated)) { + $replenishmentOrder->assigned_to = $validated['assigned_to']; + } + // pending → prepared:扣減倉庫庫存 if ($newStatus === ReplenishmentOrder::STATUS_PREPARED) { foreach ($replenishmentOrder->items as $item) { @@ -1002,23 +1009,26 @@ class WarehouseController extends Controller public function assignReplenishment(Request $request, ReplenishmentOrder $replenishmentOrder) { $validated = $request->validate([ - 'assigned_to' => 'required|exists:users,id', + 'assigned_to' => 'nullable|exists:users,id', ]); - // 確保指派人員屬於同租戶 - $user = \App\Models\System\User::where('id', $validated['assigned_to']) - ->where('company_id', Auth::user()->company_id) - ->first(); + if ($validated['assigned_to']) { + // 確保指派人員屬於同租戶 + $user = \App\Models\System\User::where('id', $validated['assigned_to']) + ->where('company_id', Auth::user()->company_id) + ->first(); - if (!$user) { - return response()->json([ - 'success' => false, - 'message' => __('Invalid personnel selection') - ], 422); + if (!$user) { + return response()->json([ + 'success' => false, + 'message' => __('Invalid personnel selection') + ], 422); + } + $replenishmentOrder->assigned_to = $user->id; + } else { + $replenishmentOrder->assigned_to = null; } - $replenishmentOrder->update(['assigned_to' => $user->id]); - session()->flash('success', __('Personnel assigned successfully')); return response()->json([ diff --git a/lang/en.json b/lang/en.json index ca62036..6cc5fa0 100644 --- a/lang/en.json +++ b/lang/en.json @@ -1470,5 +1470,8 @@ "All Status": "All Status", "Add Pickup Code": "Add Pickup Code", "Add Pass Code": "Add Pass Code", - "Expected Expiry Date & Time": "Expected Expiry Date & Time" -} \ No newline at end of file + "Expected Expiry Date & Time": "Expected Expiry Date & Time", + "Assign Personnel (Optional)": "Assign Personnel (Optional)", + "Unassigned / No Change": "Unassigned / No Change", + "You can assign or change the personnel handling this order": "You can assign or change the personnel handling this order" +} diff --git a/lang/ja.json b/lang/ja.json index d684683..875e0a0 100644 --- a/lang/ja.json +++ b/lang/ja.json @@ -299,5 +299,8 @@ "Expired": "期限切れ", "Cancelled": "キャンセル済み", "Active": "有効", - "All Status": "すべてのステータス" -} \ No newline at end of file + "All Status": "すべてのステータス", + "Assign Personnel (Optional)": "担当者指定 (オプション)", + "Unassigned / No Change": "未指定 / 変更なし", + "You can assign or change the personnel handling this order": "この注文の担当者を割り当て、または変更できます" +} diff --git a/lang/zh_TW.json b/lang/zh_TW.json index cfee4d4..ba698a1 100644 --- a/lang/zh_TW.json +++ b/lang/zh_TW.json @@ -132,6 +132,7 @@ "Assign Advertisement": "投放廣告", "Assign Machines": "分配機台", "Assign Personnel": "指派人員", + "Assign Personnel (Optional)": "指派人員 (選填)", "Assign replenishment staff": "指派補貨人員", "Assign warehouse managers": "指派倉庫負責人", "Assigned Machines": "授權機台", @@ -1476,6 +1477,7 @@ "Type to search or leave blank for system defaults.": "輸入關鍵字搜尋,或留空以使用系統預設。", "UI Elements": "UI元素", "Unassigned": "未指派", + "Unassigned / No Change": "未指派 / 不變動", "Unauthorized login attempt: :account": "越權登入嘗試::account", "Unauthorized Status": "未授權", "Unauthorized: Account not authorized for this machine": "授權失敗:此帳號無存取該機台的權限", @@ -1606,5 +1608,5 @@ "Delete Pass Code": "刪除通行碼", "Are you sure you want to delete this pass code?": "確定要刪除此通行碼嗎?", "Yes, Delete": "確認刪除", - "Delete Code": "刪除代碼" -} \ No newline at end of file + "You can assign or change the personnel handling this order": "您可以指派或變更處理此訂單的人員" +} diff --git a/resources/views/admin/basic-settings/machines/distribution.blade.php b/resources/views/admin/basic-settings/machines/distribution.blade.php index d6a3cf1..8b9328a 100644 --- a/resources/views/admin/basic-settings/machines/distribution.blade.php +++ b/resources/views/admin/basic-settings/machines/distribution.blade.php @@ -48,7 +48,7 @@ .marker-error { background-color: #ef4444; } - +
@@ -177,19 +177,119 @@
-
+

{{ __('Machine Distribution Map') }}

-
+ +
+
+
+
+ + +
+ +
+ + +
+ + +
+
+

+ {{ __('Machine List') }} +

+

+ {{ $machines->count() }} {{ __('Units') }} +

+
+ +
+ + +
+
+ + + + +
+
+ + +
+ +
+

{{ __('Filter: Model') }}

+
+ @foreach($groupedByModel as $modelName => $group) + @php $color = $modelColors[$modelName] ?? $getFallbackColor($modelName); @endphp + + @endforeach +
+ +
+ @foreach($machines as $machine) + @php + $modelName = $machine->machineModel?->name ?? __('Unknown Model'); + $color = $modelColors[$modelName] ?? $getFallbackColor($modelName); + @endphp +
+
+
+ + + {{ $machine->name }} + +
+ +
+

+ {{ $machine->address ?: $machine->location ?: __('No address information') }} +

+
+ @endforeach +
@@ -274,6 +374,17 @@ }); function focusMachine(lat, lng, id) { + // Close mobile menu if open + if (window.innerWidth < 768) { + try { + // Access Alpine state via data-stack + const body = document.querySelector('body'); + if (body && body._x_dataStack) { + body._x_dataStack[0].mobileMenuOpen = false; + } + } catch (e) { console.log('Alpine sync error:', e); } + } + map.flyTo([lat, lng], 15, { duration: 1.5 }); @@ -329,13 +440,21 @@ function updateSearchFilter(query) { currentSearchQuery = query.toLowerCase().trim(); + + // Sync all search inputs + document.querySelectorAll('.machine-search-input').forEach(input => { + if (input.value.toLowerCase().trim() !== currentSearchQuery) { + input.value = query; + } + }); + applyFilters(); } function resetFilter() { currentModelFilter = null; currentSearchQuery = ''; - document.getElementById('machine-search').value = ''; + document.querySelectorAll('.machine-search-input').forEach(input => input.value = ''); applyFilters(); map.setView([23.973875, 120.982024], 8); } diff --git a/resources/views/admin/warehouses/partials/modal-replenishment-assign.blade.php b/resources/views/admin/warehouses/partials/modal-replenishment-assign.blade.php index 5839665..43da69e 100644 --- a/resources/views/admin/warehouses/partials/modal-replenishment-assign.blade.php +++ b/resources/views/admin/warehouses/partials/modal-replenishment-assign.blade.php @@ -3,19 +3,23 @@
-
+

{{ __('Assign Personnel') }}

{{ __('Select a team member to handle this replenishment order') }}

- +
diff --git a/resources/views/admin/warehouses/partials/modal-replenishment-status.blade.php b/resources/views/admin/warehouses/partials/modal-replenishment-status.blade.php index 8c64601..ac237fb 100644 --- a/resources/views/admin/warehouses/partials/modal-replenishment-status.blade.php +++ b/resources/views/admin/warehouses/partials/modal-replenishment-status.blade.php @@ -3,7 +3,7 @@
-
+
+ +
+ + @foreach($users as $u) + + @endforeach + +
+

* {{ __('You can assign or change the personnel handling this order') }}

+
+
@elseif($order->status === 'prepared') - @elseif($order->status === 'delivering') - @if($order->status === 'pending') -