@extends('layouts.dashboard') @section('content')
{{-- Project Manager --}}
{{-- Sales Person --}}
{{-- Department --}}
{{-- Assign Main Employee --}}
{{-- Project Status --}}
{{-- Client Type --}}
{{-- Project Grade --}}
{{-- Select Status --}} {{-- Select Month --}}
{{-- Select Year --}}
{{-- Business Type --}}
{{-- Country --}}
{{-- Project Main Category --}} {{-- Filter Button --}}

Project Management

@if ( auth()->user()->hasRole('Admin') || (!auth()->user()->hasRole('Sales Team') && !auth()->user()->hasRole('Team Lead')) ) @endif
@php $user = Auth::user(); @endphp @if($user->hasRole('Admin'))

Total Prediction Amount (All Projects)

${{ number_format($totalPredictionAmount, 2) }}

Total Amount Received (All Projects)

${{ number_format($totalAmountReceived, 2) }}

@endif

Total Projects

{{ $totalProjects }}

Prediction Amount ({{ $selectedYear }})

${{ number_format($predictionAmount, 2) }}

Projects Amount Received ({{ $selectedYear }})

${{ number_format($amountReceived, 2) }}

entries
@foreach($paginatedProjects as $key => $project) @php $currentMonth = now()->format('Y-m'); $hasCurrentMonthPayment = $project->projectPayments->contains(function ($payment) use ($currentMonth) { return \Carbon\Carbon::parse($payment->payment_date)->format('Y-m') === $currentMonth; }); $rowClass = $hasCurrentMonthPayment ? 'bg-[#abeae2]' : ''; @endphp @php $receivedAmount = $project->projectPayments->sum('payment_amount'); // 🔹 Duration: from created_at to NOW() $duration = $project->created_at ? $project->created_at->diff(now()) : null; @endphp @php $statusColors = [ 'complete' => 'text-green-600 font-bold', 'working' => 'text-green-600 font-bold', 'hold' => 'text-yellow-600 font-bold', 'paused' => 'text-purple-600 font-bold', 'issues' => 'text-red-600 font-bold', 'temp hold' => 'text-orange-600 font-bold', 'closed' => 'text-gray-600 font-bold', ]; $statusRaw = $project->project_status ?? 'working'; $status = strtolower(trim($statusRaw)); $statusClass = $statusColors[$status] ?? 'text-gray-500 font-bold'; @endphp @endforeach
# Name/URL Office Details Price/Hours Action Added On Type Project Type Project Status Client Details Attachment Description
SEODIS-{{ $paginatedProjects->firstItem() + $key }} {{ $project->name_or_url }}
Dashboard Link
Business: {{ $project->business_type }}
Grade: {{ $project->project_grade }}
PM: {{ optional($project->projectManager)->name ?? '-' }}
TL: {{ optional($project->teamLead)->name ?? '-' }}
{{-- ✅ Team Lead --}}
Sales: {{ optional($project->salesPerson)->name ?? '-' }}
Department: {{ optional($project->department)->name ?? '-' }}
Assigned Employee: {{ optional($project->assignMainEmployee)->name ?? '-' }}
@if($project->upsell_employee_id && optional($project->upsellEmployee)->name)
Upsell Employee: {{ $project->upsellEmployee->name }}
@endif
Can Client Rehire? {{ $project->can_client_rehire ?? 'No' }}
Rehire Date {{ $project->rehire_date ? \Carbon\Carbon::parse($project->rehire_date)->format('Y-m-d') : 'N/A' }}
Price: ${{ number_format($project->display_price ?? 0, 2) }}
Content Price: {{ $project->content_price ?? '0' }}
Hours: {{ $project->display_hours ?? 'N/A' }}
@if($duration) Project Duration: @if($duration->y > 0) {{ $duration->y }} year(s) @endif @if($duration->m > 0) {{ $duration->m }} month(s) @endif {{ $duration->d }} day(s) @else Project Duration: N/A @endif
{{ $project->created_at->format('d-M-Y') }}
Project Type: {{ $project->project_type }}
Report: {{ $project->report_type }}
Client Type: {{ $project->client_type }}
Category: {{ optional($project->projectCategory)->name ?? '-' }}
Sub Category: {{ optional($project->projectSubCategory)->name ?? '-' }}
Country: {{ optional($project->country)->name ?? '-' }}
{{ ucfirst($statusRaw) }} @if($project->reason_description)
Message: {{ $project->reason_description }}
Status Updated At: {{ $project->status_date ? \Carbon\Carbon::parse($project->status_date)->format('d-F-Y') : 'N/A' }}
@endif
Name: {{ $project->client_name }}
Email: {{ $project->client_email }}
Other Info: {{ Str::limit($project->client_other_info, 20) }} {{ $project->client_other_info }}
@php $pmAttachments = $project->attachments ?? []; $salesAttachments = $project->saleTeamAttachments ?? []; @endphp {{-- PM Attachments --}} @foreach ($pmAttachments as $attachment) 📎 {{ basename($attachment->file_path) }} (PM) @endforeach {{-- Sales Team Attachments --}} @foreach ($salesAttachments as $attachment) 📎 {{ basename($attachment->file_path) }} (Sales) @endforeach @if (count($pmAttachments) + count($salesAttachments) === 0) No attachments @endif {{-- Upload Button (only for PMs) --}} Add Attachment
{!! nl2br(e(Str::words($project->display_description, 10, '...'))) !!} @if (str_word_count($project->display_description) > 10) @endif
{{ $paginatedProjects->links() }}