star-cloud/scratch/test_breadcrumbs.php
sky121113 39a246d3c5 [FEAT] 倉儲管理模組標準化與庫存矩陣功能實作
1. 實作「目前庫存」矩陣化視圖:將商品作為行、倉庫作為列,支援跨倉庫水位分析與自動加總。
2. 優化矩陣 UI:實作固定欄位 (Sticky Columns) 以應對多倉庫場景,並修正深色模式下的背景色對齊問題。
3. 強化倉儲操作驗證:實作調撥與補貨單的 Alpine.js 前端欄位驗證與 AJAX 提交邏輯,提升操作流暢度。
4. 優化機台地址定位:實作結構化地址解析與 Nominatim API 對接,提升經緯度自動獲取的準確性。
5. 標準化 UI 組件:更新 Breadcrumbs、刪除確認彈窗與搜尋下拉選單,確保全站視覺一致性。
6. 完善多語系支援:補全倉儲管理、機台設定與 UI 提示的繁體中文翻譯。
7. 增加 Product Model 的 stocks() 關聯,支援高效率的庫存矩陣查詢。
2026-04-23 17:34:22 +08:00

67 lines
1.6 KiB
PHP

<?php
// Mocking Route and Laravel environment for breadcrumb logic test
function __($str) { return $str; }
class Route {
public static $currentName = '';
public static function currentRouteName() { return self::$currentName; }
}
function testBreadcrumbs($routeName) {
Route::$currentName = $routeName;
$links = [];
$links[] = [
'label' => __('Dashboard'),
'url' => '/admin/dashboard',
'active' => $routeName === 'admin.dashboard'
];
$moduleMap = [
'admin.warehouses' => __('Warehouse Management'),
// ... simplified
];
$foundModule = null;
foreach ($moduleMap as $prefix => $label) {
if (str_starts_with($routeName, $prefix)) {
$foundModule = [
'label' => $label,
'url' => '#',
'active' => false
];
break;
}
}
if ($foundModule) {
$links[] = $foundModule;
}
$segments = explode('.', $routeName);
$lastSegment = end($segments);
// Simplifed page labels
$pageLabel = match($lastSegment) {
'inventory' => __('Inventory Management'),
'index' => 'Warehouse Overview',
default => null,
};
if ($pageLabel) {
$links[] = [
'label' => $pageLabel,
'active' => true
];
}
echo "Route: $routeName\n";
foreach ($links as $link) {
echo " - " . $link['label'] . ($link['active'] ? " (active)" : "") . "\n";
}
echo "\n";
}
testBreadcrumbs('admin.warehouses.inventory');
testBreadcrumbs('admin.warehouses.index');