@extends('layouts.app')
@section('title', '活動')
@section('content')
@php
$allTrackers = \App\Models\IssueTracker::asOptions();
$allStatuses = \App\Models\IssueStatus::asOptions();
$trackerColor = [
'bug' => '#c0392b',
'feature' => '#2980b9',
'task' => '#27ae60',
'support' => '#8e44ad',
'doc' => '#e67e22',
];
// Bootstrap color name → dark text required
$lightBs = ['warning', 'info', 'light'];
$today = now()->format('Y-m-d');
@endphp
{{-- 頂部品牌列 --}}
活動
起 {{ $from->format('Y-m-d') }} 迄 {{ now()->format('Y-m-d') }}
{{-- 篩選列 --}}
@if($grouped->isEmpty())
此時段內沒有活動記錄。
@else
@foreach($grouped as $date => $items)
@php
$carbon = \Carbon\Carbon::parse($date);
$label = $date === $today
? '今天'
: ($date === now()->subDay()->format('Y-m-d') ? '昨天' : $date);
@endphp
@foreach($items as $issue)
@php
$tLabel = $allTrackers[$issue->tracker]['label'] ?? $issue->tracker;
$tColor = $trackerColor[$issue->tracker] ?? '#555';
$sBs = $allStatuses[$issue->status]['color'] ?? 'secondary';
$sLabel = $allStatuses[$issue->status]['label'] ?? $issue->status;
$isNew = $issue->created_at->format('Y-m-d') === $date
&& abs($issue->updated_at->timestamp - $issue->created_at->timestamp) < 60;
$projName = $issue->project->name ?? '—';
$clientName = $issue->project->client->name ?? null;
$displayProj = $clientName ? $clientName . ' - ' . $projName : $projName;
$assigneeName = $issue->assignee->name ?? ($issue->user->name ?? null);
$timeStr = $issue->updated_at->format('H:i');
@endphp
{{-- 圖示 --}}
@if($isNew)
{{-- 新建立:深色圖示 --}}
@else
{{-- 更新:淡色圖示 --}}
@endif
{{-- 內容 --}}
{{ $timeStr }}
{{ $displayProj }}
-
{{ $tLabel }}
@if($issue->redmine_id && $issue->project_id)
#{{ $issue->redmine_id }}
@elseif($issue->redmine_id)
#{{ $issue->redmine_id }}
@endif
{{ $sLabel }}
:
@if($issue->project_id)
{{ $issue->title }}
@else
{{ $issue->title }}
@endif
@if($isNew && $issue->description)
{{ Str::limit(strip_tags($issue->description), 120) }}
@endif
@if($assigneeName)
{{ $assigneeName }}
@endif
@endforeach
@endforeach
@endif
@endsection