@extends('layouts.app') @section('title', $req->request_key . ' – ' . $req->summary) @section('content')
{{-- ── Top bar ── --}}

{{ $req->summary }}

@if ($canManage && $req->status === 'unassigned')
@csrf
@endif @if ($canManage) @endif
@if (session('success'))
{{ session('success') }}
@endif @if (session('error'))
{{ session('error') }}
@endif {{-- ── Main 2-col layout ── --}}
{{-- ── LEFT: Content ── --}}
{{-- Request info card --}}
{{ $req->request_key }} {{ $statusMap[$req->status]['label'] ?? $req->status }}
Kategori
{{ $category['label'] ?? $req->category_key }}
Talep Türü
{{ $req->request_type }}
Öncelik
{{ $priorityMap[$req->priority]['label'] ?? $req->priority }}
Termin
{{ $req->termin_date ? \Carbon\Carbon::parse($req->termin_date)->format('d.m.Y') : '—' }}
@if (!empty($req->description))
{{ $req->description }}
@endif
{{-- Attachments --}} @if ($attachments->isNotEmpty())
@foreach ($attachments as $att) @php $mime = (string) $att->mime_type; $icon = str_contains($mime, 'pdf') ? 'bi-file-earmark-pdf text-danger' : (str_contains($mime, 'image') ? 'bi-file-earmark-image text-info' : (str_contains($mime, 'word') || str_contains($mime, 'document') ? 'bi-file-earmark-word text-primary' : (str_contains($mime, 'excel') || str_contains($mime, 'sheet') ? 'bi-file-earmark-excel text-success' : (str_contains($mime, 'zip') || str_contains($mime, 'rar') ? 'bi-file-earmark-zip text-warning' : 'bi-file-earmark text-muted')))); $size = $att->file_size ? ($att->file_size < 1048576 ? round($att->file_size / 1024, 1) . ' KB' : round($att->file_size / 1048576, 1) . ' MB') : ''; $uploaderName = trim((string) ($att->uploader_name ?? '')); $uploadSource = (int) ($att->uploaded_by ?? 0) > 0 ? ((int) ($att->uploaded_by ?? 0) === (int) ($req->reporter_user_id ?? 0) ? 'Talep sahibi' : 'Pazarlama ekibi') : 'Sistem'; @endphp @endforeach
@endif {{-- Activity / Comments --}}
@if ($comments->isNotEmpty())
@foreach ($comments as $c) @php $isSystem = $c->entry_type !== 'comment'; @endphp
@if (!$isSystem)
{{ strtoupper(substr($c->user_name ?? 'U', 0, 1)) }}
@else
@endif
{{ $c->user_name ?? 'Sistem' }} {{ \Carbon\Carbon::parse($c->created_at)->diffForHumans() }}
{{ $c->message }}
@endforeach
@endif {{-- Add comment form --}}
@csrf
{{-- ── RIGHT: Sidebar ── --}}
@php $reviewStepLabel = match ((string) ($req->customer_review_step ?? '')) { 'reporter' => 'Reporter Onayı Bekliyor', 'approver' => 'Departman Müdürü Onayı Bekliyor', default => null, }; @endphp @if ($canProgressWorkflow)
{{ $statusMap[$req->status]['label'] ?? $req->status }} @if ($reviewStepLabel)
{{ $reviewStepLabel }}
@endif
@if (!empty($workflowActions))
@foreach ($workflowActions as $workflowAction) @if (!empty($workflowAction['requires_assignee']))
@csrf
{{ $workflowAction['helper'] }}
@elseif (!empty($workflowAction['requires_approver']))
{{ $workflowAction['helper'] }}
@else
@csrf
{{ $workflowAction['helper'] }}
@endif @endforeach
@else
Bu aşamada ek işlem yok. Gerekli ise önce atama veya durum güncellemesi yapın.
@endif
@endif {{-- SLA --}}
@php $firstRespDue = $slaFirstResp; $resolutionDue = $slaResolution; $firstRespOver = $now->gt($firstRespDue); $resolutionOver = $now->gt($resolutionDue); $firstRespMins = abs($now->diffInMinutes($firstRespDue)); $resMins = abs($now->diffInMinutes($resolutionDue)); @endphp
{{ $firstRespDue->format('d M H:i') }}
İlk yanıt süresi (4 saat)
@if ($firstRespOver)
Süresi geçti
@else
{{ floor($firstRespMins / 60) }}s {{ $firstRespMins % 60 }}d kaldı
@endif
{{ $resolutionDue->format('d M H:i') }}
Çözüm süresi (8 saat)
@if ($resolutionOver)
Süresi geçti
@else
{{ floor($resMins / 60) }}s {{ $resMins % 60 }}d kaldı
@endif
{{-- Details --}}
SLA'lar
{{ $firstRespDue->format('d M H:i') }}
İlk yanıt süresi (4 saat)
@if ($firstRespOver)
Süresi geçti
@else
{{ floor($firstRespMins / 60) }}s {{ $firstRespMins % 60 }}d kaldı
@endif
{{ $resolutionDue->format('d M H:i') }}
Çözüm süresi (8 saat)
@if ($resolutionOver)
Süresi geçti
@else
{{ floor($resMins / 60) }}s {{ $resMins % 60 }}d kaldı
@endif
@if ($canEditTask)
@csrf
Atanan
@if ($canReassignTask && $assignableUsers->isNotEmpty()) @elseif ($req->assignee_name)
{{ strtoupper(substr($req->assignee_name, 0, 1)) }}
{{ $req->assignee_name }}
@else Atanmamış @endif
Durum
{{ $statusMap[$req->status]['label'] ?? $req->status }}
Öncelik
@else
Atanan
@if ($req->assignee_name)
{{ strtoupper(substr($req->assignee_name, 0, 1)) }}
{{ $req->assignee_name }}
@else Atanmamış @endif
@if (!$canEditTask)
Durum
{{ $statusMap[$req->status]['label'] ?? $req->status }}
@endif @endif
Talep Eden
{{ strtoupper(substr($req->reporter_name ?? 'U', 0, 1)) }}
{{ $req->reporter_name ?? '—' }}
Öncelik
{{ $priorityMap[$req->priority]['label'] ?? $req->priority }}
Oluşturuldu
{{ \Carbon\Carbon::parse($req->created_at)->format('d.m.Y H:i') }}
@if (!empty($req->approver_name))
Approver
{{ strtoupper(substr($req->approver_name, 0, 1)) }}
{{ $req->approver_name }}
@endif @if (!empty($reviewStepLabel))
Onay Adımı
{{ $reviewStepLabel }}
@endif
@if ($req->updated_at && $req->updated_at !== $req->created_at)
Güncellendi
{{ \Carbon\Carbon::parse($req->updated_at)->diffForHumans() }}
@endif @if ($canManage)
İşlemler
@csrf
@endif
{{-- ── Status Modal (team only) ── --}} @if ($canManage) @endif @if (collect($workflowActions ?? [])->contains(static fn($item) => !empty($item['requires_approver']))) @endif @endsection @push('scripts') @endpush @push('styles') @endpush