@extends('admin.layout.main') @php // dd($project); @endphp @section('admin')

Project Details

Manage project information and track progress

ID: {{ $project->id }}
@csrf @method('PATCH')

Project Overview

Project Name

{{ $project->name ?? 'Unnamed Project' }}

Created Date

{{ $project->created_at->format('M d, Y') }}

Request ID

{{ $project->request_id }}

Last Updated

{{ $project->updated_at->format('M d, Y') }}

@php $services = is_array($project->services) ? $project->services : json_decode($project->services, true) ?? []; $totalServices = count($services); $completedServices = collect($services)->where('status', 'Complete')->count(); $progress = $totalServices > 0 ? round(($completedServices / $totalServices) * 100) : 0; @endphp

Services

{{ $completedServices }}/{{ $totalServices }} completed
Update Document
Progress {{ $progress }}%
@if ($totalServices > 0)
@foreach ($services as $key => $service)

{{ $service['name'] ?? 'Unknown Service' }}

ID: {{ $service['id'] ?? 'N/A' }}

@csrf @method('PATCH')
@endforeach
@else

No services found for this project

@endif
@php $documents = is_array($project->documents_data) ? $project->documents_data : json_decode($project->documents_data, true) ?? []; $totalDocs = count($documents); $completedDocs = collect($documents)->where('status', true)->count(); @endphp

Documents

{{ $completedDocs }}/{{ $totalDocs }} submitted
@if ($totalDocs > 0)
@foreach ($documents as $document)

{{ $document['name'] ?? 'Unknown Document' }}

@if ($document['value'] ?? false)

{{ Str::limit($document['value'], 50) }}

@endif
@if ($document['status'] ?? false) Submitted @else Pending @endif @if ($document['type'] == 'file' && ($document['value'] ?? false)) @endif
@endforeach
@else

No documents found for this project

@endif

Client Information

@php $contactInfo = is_array($project->serviceRequest->contact_info) ? $project->serviceRequest->contact_info : json_decode($project->serviceRequest->contact_info, true) ?? []; @endphp

Full Name

{{ $contactInfo['name'] ?? ($project->user->name ?? 'N/A') }}

Email

{{ $contactInfo['email'] ?? ($project->user->email ?? 'N/A') }}

Phone

{{ $contactInfo['phone'] ?? 'N/A' }}

Company

{{ $contactInfo['company'] ?? 'N/A' }}

Financial Information

Total Amount {{ number_format($project->serviceRequest->total_price ?? 0, 0) }} SR
Amount Paid {{ number_format($project->amount_paid ?? 0, 0) }} SR
Pending Amount {{ number_format(($project->serviceRequest->total_price ?? 0) - ($project->amount_paid ?? 0), 0) }} SR
@if (($project->amount_paid ?? 0) >= ($project->serviceRequest->total_price ?? 0)) Fully Paid @elseif(($project->amount_paid ?? 0) > 0) Partially Paid @else Unpaid @endif
@forelse($payents as $item)

#INV-{{ str_pad($item->id, 5, '0', STR_PAD_LEFT) }}

{{ number_format($item->amount, 0) }} SR

@php $statusColors = [ 'paid' => 'bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-300', 'pending' => 'bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-300', 'overdue' => 'bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-300', 'draft' => 'bg-gray-100 text-gray-800 dark:bg-gray-800 dark:text-gray-300', ]; $statusColor = $statusColors[$item->status] ?? $statusColors['draft']; @endphp {{ $item->status }}
@empty

No invoices found

@endforelse
@endsection