@php use Carbon\Carbon; $fmtDate = fn($d) => $d ? Carbon::parse($d)->format('Y-m-d') : '—'; $fmtTime = fn($d) => $d ? Carbon::parse($d)->format('H:i') : '—'; $today = now(); $issuesCount = $canPm ? $myIssues->count() : 0; $issuesOverdue = $canPm ? $myIssues->filter(function($i){ if(!$i->due_date) return false; $d = Carbon::parse($i->due_date); return $d->isPast() && !$d->isToday(); })->count() : 0; $eventsCount = $canCal ? $todayEvents->count() : 0; $eventsAllDay = $canCal ? $todayEvents->filter(fn($e) => (bool)$e->all_day)->count() : 0; $nextEvent = null; if($canCal && $todayEvents->count()){ $nextEvent = $todayEvents->first(function($e) use ($today){ if($e->all_day) return true; $start = $e->starts_at ? Carbon::parse($e->starts_at) : null; return !$start || $start->gte($today->copy()->subMinutes(5)); }) ?? $todayEvents->first(); } @endphp @extends('layouts.app') @section('page-title') Dashboard @endsection @section('page-actions')
@if($canPm) Wszystkie zadania @endif @if($canCal) Terminarz @endif
@endsection @section('content')
{{-- Subheader jak w Wiadomościach --}}
Dzisiaj: {{ $today->format('Y-m-d') }} Szybki podgląd: Twoje zadania i plan dnia. {{ now()->format('H:i') }}
{{-- KPI --}}
Otwarte zadania
{{ $issuesCount }}
{{ $issuesOverdue }} przeterminowane
przypisane do mnie
Wydarzenia dzisiaj
{{ $eventsCount }}
{{ $eventsAllDay }} cały dzień
widoczne wg zasad
Następne
{{ $nextEvent?->title ?? '—' }}
@if($nextEvent) @if($nextEvent->all_day) Cały dzień @else {{ $fmtTime($nextEvent->starts_at) }}{{ $nextEvent->ends_at ? ' – '.$fmtTime($nextEvent->ends_at) : '' }} @endif @else Brak zaplanowanych wydarzeń @endif
@if($nextEvent && $nextEvent->location) {{ $nextEvent->location }} @else {{ now()->format('H:i') }} @endif
{{-- Content: PM + Terminarz --}}
{{-- PM --}}
PM Moje zadania ({{ $canPm ? $myIssues->count() : 0 }})
@if($canPm) Pokaż więcej @endif
@if(!$canPm)
Nie masz uprawnień do modułu PM.
@elseif($myIssues->isEmpty())
Brak przypisanych zadań
Wygląda na spokojny dzień 🙂
@else
@foreach($myIssues as $issue) @php $due = $issue->due_date ? Carbon::parse($issue->due_date) : null; $overdue = $due && $due->isPast() && !$due->isToday(); $priority = $issue->priority ?? 'medium'; $prioClass = match($priority) { 'critical' => 'erp-prio erp-prio--critical', 'high' => 'erp-prio erp-prio--high', 'medium' => 'erp-prio erp-prio--medium', 'low' => 'erp-prio erp-prio--low', default => 'erp-prio erp-prio--medium', }; $type = $issue->type ?? 'task'; $typeIcon = match($type) { 'bug' => 'bi-bug', 'story' => 'bi-book', default => 'bi-check2-square', }; @endphp
{{ $issue->issue_key ?? ('#'.$issue->id) }} {{ $issue->title }}
@if($issue->status) {{ $issue->status->name }} @endif @if($issue->project) {{ $issue->project->key ?? '' }} {{ $issue->project->name }} @endif Termin: {{ $fmtDate($issue->due_date) }} @if($overdue) Przeterminowane @endif
{{ strtoupper($priority) }}
@endforeach
@endif
{{-- Terminarz --}}
Terminarz Dzisiaj ({{ $canCal ? $todayEvents->count() : 0 }})
@if($canCal) Otwórz @endif
@if(!$canCal)
Nie masz uprawnień do terminarza.
@elseif($todayEvents->isEmpty())
Brak wydarzeń na dziś
Możesz spokojnie planować dalej.
@else
@foreach($todayEvents as $e) @php $start = $e->starts_at ? Carbon::parse($e->starts_at) : null; $end = $e->ends_at ? Carbon::parse($e->ends_at) : null; $timeLabel = $e->all_day ? 'Cały dzień' : (($start?->format('H:i') ?? '—') . ($end ? ' – '.$end->format('H:i') : '')); $dot = $e->color ?: null; @endphp
{{ $e->title }}
{{ $timeLabel }} @if($e->location) {{ $e->location }} @endif @if($e->type) {{ strtoupper($e->type) }} @endif
@if($e->description)
{{ $e->description }}
@endif
@endforeach
Szczegóły/edycja w pełnym widoku kalendarza.
@endif
@endsection