@extends('layouts.app') @section('title', '所有專案') @section('content') @include('projects._list_tabs', ['activeTab' => 'list'])
{{-- 顯示目前篩選狀態 --}} @if ($type || $category)

🔎 目前篩選: @if($category){{ $category }}@endif @if($type){{ $type }}@endif 清除

@elseif($tool)

🔎 開發框架:{{ $tool }} 清除

@endif {{-- 🌐 儀表板 --}}

專案統計儀表板

{{-- ① 總覽列:總數 / 進行中 / 已結束 --}}
{{ $stats['active'] }}
開啟中
{{ $stats['closed'] }}
已結束
{{-- ② 分類細分:産品 / 專案,各自展示開発・保固・維護 --}} @php $catMeta = [ '產品' => ['icon' => 'bi-box-seam', 'grad' => '#d97706,#f59e0b', 'param' => 'category'], '專案' => ['icon' => 'bi-folder-fill', 'grad' => '#2563eb,#60a5fa', 'param' => 'category'], ]; $typeMeta = [ '開發' => ['icon' => 'bi-tools', 'color' => '#138496'], '保固' => ['icon' => 'bi-shield-check', 'color' => '#6f42c1'], '維護' => ['icon' => 'bi-wrench', 'color' => '#117a65'], '其他' => ['icon' => 'bi-folder2', 'color' => '#64748b'], ]; $categories = collect($catMeta)->keys() ->filter(fn($cat) => ($stats['byCategory'][$cat] ?? 0) > 0); @endphp @if($categories->isNotEmpty())
@foreach($categories as $cat) @php $cm = $catMeta[$cat]; $catTotal = $stats['byCategory'][$cat] ?? 0; $catTypes = $stats['byCatType'][$cat] ?? collect(); @endphp
{{-- 分類標頭 --}} {{ $cat }} {{ $catTotal }} {{-- 階段細分 --}}
@foreach($typeMeta as $typeName => $tm) @php $cnt = $catTypes[$typeName] ?? 0; @endphp @if($typeName !== '其他' || $cnt > 0) @endif @endforeach
@endforeach
@endif {{-- ③ 開發工具 --}}
💻 開發框架
@php $toolMeta = [ 'SMF' => ['color' => '#e0ccff', 'icon' => 'bi-terminal'], 'Laravel' => ['color' => '#f5c6cb', 'icon' => 'bi-layers-fill'], 'WordPress' => ['color' => '#d0e2ff', 'icon' => 'bi-wordpress'], 'Wordpress' => ['color' => '#d0e2ff', 'icon' => 'bi-wordpress'], 'ZF2' => ['color' => '#c7eed8', 'icon' => 'bi-bootstrap'], '其他' => ['color' => '#e2e3e5', 'icon' => 'bi-question-circle'], ]; $allTools = \App\Models\ProjectDevTool::labels(); @endphp @foreach ($allTools as $toolName) @php $meta = $toolMeta[$toolName] ?? ['color' => '#e2e3e5', 'icon' => 'bi-tools']; @endphp @endforeach
{{-- 專案列表(Redmine 風格階層表格) --}} @php $allProjects = $projects->getCollection(); $projectMap = $allProjects->keyBy('id'); // 根專案:parent_id 為 null,或父專案不在目前結果集(例如被篩選掉) $rootProjects = $allProjects->filter( fn($p) => is_null($p->parent_id) || !$projectMap->has($p->parent_id) ); // 依客戶分組,按 clientScore 排序(全結束客戶排最後,未分類排次後) $typeRankView = ['產品' => 1, '開發' => 2, '保固' => 3, '維護' => 4, '結束' => 5]; $byClient = $rootProjects ->sortBy(function ($p) use ($clientScore) { $score = $clientScore[(string)($p->client_id ?? 'null')] ?? 9; $name = $p->client?->name ?? 'zzzzz'; return sprintf('%02d_%s', $score, $name); }) ->groupBy(fn($p) => $p->client?->name ?? '⚠ 未分類'); @endphp @if ($projects->isEmpty())

找不到符合條件的專案。

@else @foreach ($byClient as $clientName => $clientRoots)
{{-- 客戶群組標題 --}}
{{ $clientName }} {{ $clientRoots->count() }} 個專案
{{-- 表格 --}}
@foreach ($clientRoots->sortBy(function ($p) use ($treeEnded) { return sprintf('%d_%s', ($treeEnded[$p->id] ?? false) ? 1 : 0, $p->name); }) as $project) @include('projects._project_row', [ 'project' => $project, 'depth' => 0, 'projectMap' => $projectMap, ]) @endforeach
專案名稱 類型 開發框架 開始日期 結束日期 成員
@endforeach @endif
@endsection