@extends('layouts.app') @section('title', 'Approval Details') @section('content')

Approval Details

Back
Document Information

Title: {{ $approvalRequest->model->title ?? 'N/A' }}

Document Number: {{ $approvalRequest->model->document_number ?? 'N/A' }}

Category: {{ $approvalRequest->model->category ?? 'N/A' }}

Status: {{ ucfirst($approvalRequest->status) }}

Initiator: {{ $approvalRequest->initiator->name ?? 'N/A' }}

Submitted: {{ $approvalRequest->submitted_at ? $approvalRequest->submitted_at->format('Y-m-d H:i') : 'N/A' }}

@if($approvalRequest->model->description)
Description:

{{ $approvalRequest->model->description }}

@endif @if($approvalRequest->model->file_path) @endif
Approval Timeline
@foreach($approvalRequest->workflow->steps as $step)
@php $isCompleted = $approvalRequest->actions->where('workflow_step_id', $step->id)->count() > 0; $isCurrent = $step->step_order == $approvalRequest->current_step; @endphp
Step {{ $step->step_order }}: {{ $step->name }}
{{ $isCompleted ? 'Completed' : ($isCurrent ? 'In Progress' : 'Pending') }}

Action: {{ ucfirst($step->action_type) }}

@php $actions = $approvalRequest->actions->where('workflow_step_id', $step->id); @endphp @foreach($actions as $action)
{{ $action->user->name }} {{ ucfirst($action->action) }}
@if($action->comments)

{{ $action->comments }}

@endif {{ $action->created_at->format('Y-m-d H:i') }}
@endforeach
@endforeach
Actions
@if($canAct)

You are required to {{ $currentStep->action_type ?? 'approve' }} this document.

@csrf
@if($currentStep->action_type === 'review' || $currentStep->action_type === 'sign') @endif
@elseif(in_array($approvalRequest->status, ['approved', 'rejected']))
{{ ucfirst($approvalRequest->status) }}

This approval request has been {{ $approvalRequest->status }}.

@else

You are not authorized to take action on this request.

@endif
Approval Progress
@php $totalSteps = $approvalRequest->workflow->steps->count(); $completedSteps = $approvalRequest->actions->groupBy('workflow_step_id')->count(); $percentage = $totalSteps > 0 ? ($completedSteps / $totalSteps) * 100 : 0; @endphp
{{ $completedSteps }} of {{ $totalSteps }} steps completed
@endsection