@extends('layouts.app')
@section('title', '專案管理(舊版)')
@push('styles')
@endpush
@section('content')
@php
$typeCls=['開發'=>'rm5-type-dev','維護'=>'rm5-type-maint','其他'=>'rm5-type-end','保固'=>'rm5-type-war'];
$catCls=['專案'=>'rm5-type-dev','產品'=>'rm5-type-prod'];
$typeRankView=['開發'=>1,'保固'=>2,'維護'=>3,'其他'=>4];
$priorityCls=['urgent'=>'rm5-priority-urgent','high'=>'rm5-priority-high','normal'=>'rm5-priority-normal','low'=>'rm5-priority-low'];
$priorityLbl=['urgent'=>'緊急','high'=>'高','normal'=>'正常','low'=>'低'];
$statusLbl=['pending'=>'待處理','in_progress'=>'處理中','hold'=>'暫緩','watching'=>'觀察中'];
@endphp
{{-- 頂部深藍欄 --}}
專案管理
@if($type || ($category??''))
目前篩選:
@if($category??''){{ $category }} @endif
@if($type){{ $type }} @endif
@elseif($search)
搜尋:{{ $search }}
@endif
{{-- 統計 --}}
{{-- 篩選器 --}}
{{-- 多欄專案卡片 --}}
@php
$allItems = $projects->getCollection();
$projectMap= $allItems->keyBy('id');
$topLevel = $allItems->filter(fn($p)=>is_null($p->parent_id)||!$projectMap->has($p->parent_id));
$children = $allItems->whereNotNull('parent_id')->groupBy('parent_id');
$byClient = $topLevel->sortBy(function($p) use($clientScore,$typeRankView){
$score = $clientScore[(string)($p->client_id??'null')]??9;
return sprintf('%02d_%s_%d', $score, $p->client?->name??'zzz', $typeRankView[$p->project_type]??5);
})->groupBy(fn($p)=>$p->client?->name??'(未分類)');
@endphp
@if($projects->isEmpty())
找不到符合條件的專案。
@else
@foreach($byClient as $clientName => $clientRoots)
@foreach($clientRoots->sortBy(fn($p)=>$typeRankView[$p->project_type]??5) as $p)
@php $pClosed = $treeEnded[$p->id] ?? ($p->is_ended || ($p->end_date && \Carbon\Carbon::parse($p->end_date)->isPast())); @endphp
@if($p->project_category === '產品')
產品
@endif
{{ $p->project_type }}
@if($pClosed)
結束@endif
{{ $p->name }}
@if(isset($children[$p->id]))
@foreach($children[$p->id]->sortBy(fn($c)=>$c->name) as $child)
@php $cDisplay = $child->name; $cClosed = $child->is_ended || ($child->end_date && \Carbon\Carbon::parse($child->end_date)->isPast()); @endphp
@if($child->project_category === '產品')
產品
@endif
{{ $child->project_type }}
@if($cClosed)
結束@endif
{{ $cDisplay }}
@endforeach
@endif
@endforeach
@endforeach
@endif
找不到符合的專案。
{{-- /rm5-page --}}
@endsection
@push('scripts')
@endpush