@extends('layouts.omd.omd') @section('title', 'Project Details') @section('content')
{{-- ── Page header ── --}}
{{ $leads ? 'JOB NO. ' . str_pad($project->id ?? $leads->id, 3, '0', STR_PAD_LEFT) : '' }}
Project Details
Back
{{-- ── RADIO INPUTS ── --}} @if($source !== 'enquiry') @endif {{-- ── TAB NAV ── --}} {{-- ── TAB PANELS ── --}}
{{-- ═══════════════════════════════ PANEL 1 · Project Overview ═══════════════════════════════ --}}

Project Overview

@csrf @php $cif = $cif ?? []; @endphp
@php $cost = $project->project_cost ?? ($cif['total_project_cost'] ?? 0); $formattedCost = ''; if (is_numeric($cost) && $cost > 0) { if ($cost >= 10000000) { $formattedCost = round($cost / 10000000, 2) . ' Cr'; } elseif ($cost >= 100000) { $formattedCost = round($cost / 100000, 2) . ' Lakh'; } else { $formattedCost = number_format($cost); // Regular formatting for < 1 Lakh } } else { $formattedCost = $cost; // Fallback if it's already a string or empty } @endphp {{-- --- CONTACT INFO HEADING & SPACING --- --}}
Job No.
Client Name
Payment Receivable
Status
Expected Date of Handover
Total Project Cost
Contact Info
Consultant
Responsible OMD Person
Responsible Site Person
Responsible Sales Person
Client Contact - Technical
Client Contact - Finance
Client Contact - Site
{{-- /panel1 --}} {{-- ═══════════════════════════════ PANEL 2 · Project Documents ═══════════════════════════════ --}}

Initial Documents

@php $projectDocs2 = [ ['name' => 'Signed Offer', 'stage' => 'Signed Offer'], ['name' => 'PO', 'stage' => 'Agreement PO'], ['name' => 'Final Order Entry Estimate', 'stage' => 'Final Order Entry Estimate'], ['name' => 'Final Order Entry Cost Sheet', 'stage' => 'Final Order Entry Cost Sheet'], ['name' => 'JAF', 'stage' => 'JAF'], ]; @endphp @foreach($projectDocs2 as $doc) @php $wf = $workflows->get($doc['stage']); @endphp @endforeach
Description Attachment Responsible Status
{{ $doc['name'] }}
@csrf
@if($wf && $wf->file_path) View Download @else @endif
@php $assignedStaff = $taskAssignmentsGroup[$doc['stage']] ?? collect(); @endphp
@forelse($assignedStaff as $assignment) {{ $assignment->staff->name }} @empty Unassigned @endforelse
@csrf
@if($source !== 'enquiry') @endif
{{-- /panel2 --}} {{-- ═══════════════════════════════ PANEL 3 · Project Execution ═══════════════════════════════ --}}

Project Execution

@php $execDocs = [ ['Approval Drawing', 'Approval Drawing', null], ['RAD', 'RAD', null], ['CIF', 'CIF', null], ['Color Confirmation Structure', 'Color Confirmation Structure', null], ['Color Confirmation Sheeting', 'Color Confirmation Sheeting', null], ['Shop Drawing', 'Shop Drawing', null], ]; @endphp @foreach($execDocs as [$stage, $label, $financeStatus]) @php $wf = $workflows->get($stage); @endphp @endforeach
Description Attachment Responsible Status
{{ $label }}
@csrf
@if($wf && $wf->file_path) View Download @else @endif
@php $assignedStaff = $taskAssignmentsGroup[$stage] ?? collect(); @endphp
@forelse($assignedStaff as $assignment) {{ $assignment->staff->name }} @empty Unassigned @endforelse
@csrf
@if($source !== 'enquiry') @endif
{{-- /panel3 --}} {{-- ═══════════════════════════════ PANEL 4 · Material & Tech-Sheet ═══════════════════════════════ --}}

Material & Tech-Sheet

@php $bomDocs = [ ['Final BOM - Consolidated', 'Final BOM - Consolidated', 'cleared'], ['Final BOM - Built Up', 'Final BOM - Built Up', 'cleared'], ['Final BOM - CFS', 'Final BOM - CFS', 'cleared'], ['Final BOM - AB', 'Final BOM - AB', 'cleared'], ['Final BOM - CB', 'Final BOM - CB', 'cleared'], ['Final BOM - Roof Sheeting', 'Final BOM - Roof Sheeting', 'cleared'], ['Final BOM - Wall Sheeting', 'Final BOM - Wall Sheeting', 'cleared'], ['Final BOM - Sheeting Angle', 'Final BOM - Sheeting Angle', 'cleared'], ['Final BOM - Skylight', 'Final BOM - Skylight', 'cleared'], ['Final BOM - Wall Light', 'Final BOM - Wall Light', 'not_cleared'], ['Final BOM - Screws', 'Final BOM - Screws', 'not_cleared'], ['Final BOM - Turbovents', 'Final BOM - Turbovents', 'not_cleared'], ]; @endphp @foreach($bomDocs as [$stage, $label, $financeStatus]) @php $wf = $workflows->get($stage); $rfq = $rfqs->get($label); $order = \App\Models\Order::where('project_id', $project->id) ->whereHas('items', fn($q) => $q->where('name', $label)) ->latest()->first(); @endphp @endforeach
Material Attachment Workflow Procurement Responsible Finance PO Status Delivery Remarks
{{ $label }}
@csrf
@if($wf && $wf->file_path) View Download @else @endif
@csrf
@php $assignedStaff = $taskAssignmentsGroup[$stage] ?? collect(); @endphp
@forelse($assignedStaff as $assignment) {{ $assignment->staff->name }} @empty Unassigned @endforelse
@if($order) Cleared @else Under Review @endif @if($order)
{{ $order->po_number }} PO Generated
@else Pending @endif
@if($rfq && $rfq->delivery_date) {{ \Carbon\Carbon::parse($rfq->delivery_date)->format('d M Y') }} @elseif($rfq) Awaited @else - @endif @if($rfq) RFQ completed successfully and ready for PO workflow. @else Create RFQ to start quotation and procurement workflow. @endif
@if($source !== 'enquiry') @endif
{{-- /panel4 --}} {{-- ═══════════════════════════════ PANEL 5 · Post PO Documents ═══════════════════════════════ --}}

SITE REPORTS

@php // 1. Updated Array: Removed Logs/Photos, Added Erection items $postPoDocs = [ ['name' => 'AB Report'], ['name' => 'Alignment Report'], ['name' => 'Bolt Tightening Report'], ['name' => 'Roof Sheeting Report'], ['name' => 'Erection drawings'], ['name' => 'Erection work order activity'], ]; // Fetch the single project-level execution $projectExecution = \App\Models\Order::with(['execution.documents']) ->where('project_id', $project->id) ->whereHas('execution') ->latest() ->first() ?->execution; @endphp @if(!$projectExecution)
Execution not started.
No execution record found for this project. Documents will appear once an order execution is created.
@else {{-- ========================================= --}} {{-- 1. STANDARD SITE REPORTS (WITH APPROVAL) --}} {{-- ========================================= --}}
Standard Reports
{{-- 2. New OMD Approval Column --}} @foreach($postPoDocs as $doc) @php $file = $projectExecution->documents ->where('document_type', $doc['name']) ->first(); @endphp {{-- OMD Approval Logic --}} @endforeach
Description Attachment Status ResponsibleOMD Approval
{{ $doc['name'] }}
@csrf
@if($file && $file->file_path) View Download @else @endif
{{ $file ? 'Uploaded' : 'Pending' }} @php $assignedStaff = $taskAssignmentsGroup[$doc['name']] ?? collect(); @endphp
@forelse($assignedStaff as $assignment) {{ $assignment->staff->name }} @empty Unassigned @endforelse
Awaiting Upload

{{-- ========================================= --}} {{-- 3. DAILY SITE LOGS (EXCEL/GRID FORMAT) --}} {{-- ========================================= --}}
Daily Site Logs (Equipment, Fuel & Manpower)
{{-- INPUT FORM (Fixed at the top) --}}
@csrf
Date Manpower Count Equipment Used Fuel Consumed (Liters) Action
{{-- PREVIOUS LOGS TABLE (Scrollable below) --}}
Previous Logs
@forelse(\App\Models\DailySiteLog::where('execution_id', $projectExecution->id)->orderBy('log_date', 'desc')->get() as $log) @empty @endforelse
Date Manpower Equipment Used Fuel (Liters)
{{ \Carbon\Carbon::parse($log->log_date)->format('d M, Y') }} {{ $log->manpower }} People {{ $log->equipment ?? '-' }} {{ $log->fuel ? $log->fuel . ' L' : '-' }}
No daily logs have been saved yet.
{{-- ========================================= --}} {{-- 4. DAILY SITE PHOTOS --}} {{-- ========================================= --}}
Daily Site Photos
{{-- INPUT FORM --}}
@csrf {{-- Show Laravel Validation Errors Here --}} @if ($errors->any())
    @foreach ($errors->all() as $error)
  • {{ $error }}
  • @endforeach
@endif
* Note: Please select minimum 5 photos per day. Photos will automatically be grouped by the date selected.
{{-- PREVIOUS PHOTOS VIEW (ACCORDION) --}}
Uploaded Photos by Date
@forelse($dailyPhotos ?? [] as $date => $photos)

@foreach($photos as $photo) @endforeach
@empty
No daily photos uploaded yet.
@endforelse
@endif
@if($source !== 'enquiry') @endif
{{-- /panel5 --}} {{-- ═══════════════════════════════ PANEL 6 · Consolidated Document Status ═══════════════════════════════ --}}
@php $totalReceivable = $receivables->sum('amount'); $totalReceived = $receivables->sum('received_amount'); $totalPending = $totalReceivable - $totalReceived; @endphp

Client Receivable Scheduler

{{-- Summary Cards --}}
Total Receivable

₹{{ number_format($totalReceivable, 2) }}

Received

₹{{ number_format($totalReceived, 2) }}

Pending

₹{{ number_format($totalPending, 2) }}

{{-- Table --}}
@forelse($receivables as $receivable) @php $status = $receivable->status; if ( $status != 'paid' && \Carbon\Carbon::parse($receivable->due_date)->isPast() ) { $status = 'overdue'; } @endphp @php $stageTasks = array_map('trim', explode(',', $receivable->stage_name)); $assignments = $taskAssignments->filter(function ($item) use ($stageTasks) { return in_array($item->task_name, $stageTasks); }); $groupedByTask = $assignments->groupBy('task_name'); @endphp {{-- Receive Payment Modal --}} @empty @endforelse
Scheduler Task Responsible Person Expected Milestone Completion Date Status Action
{{ $receivable->category_name }} {{ $receivable->stage_name }} @if($groupedByTask->count())
@foreach($groupedByTask as $taskName => $taskAssigns) @php $staffEntries = $taskAssigns->filter(fn($a) => $a->staff); @endphp
{{ $taskName }}
@forelse($staffEntries as $assignment) {{ $assignment->staff->name }} @empty Staff Not Allotted @endforelse
@endforeach
@else {{-- This handles your brand new custom schedulers or any unassigned tasks --}}
@foreach($stageTasks as $task)
{{ $task }}
Staff Not Allotted
@endforeach
@endif
₹{{ number_format($receivable->amount, 2) }} {{ \Carbon\Carbon::parse($receivable->due_date)->format('d M Y') }} @if($status == 'paid') Paid @elseif($status == 'partially_paid') Partial @elseif($status == 'overdue') Overdue @else Pending @endif @if($receivable->status != 'paid') @endif
No receivable schedules created yet.
{{-- Create Scheduler Modal --}} @php // Consolidating all items to easily loop through them in the modal $allModalDocs = [ 'Project Documents' => [ ['name' => 'Signed Offer', 'stage' => 'Signed Offer'], ['name' => 'PO', 'stage' => 'Agreement PO'], ['name' => 'Final Order Entry Estimate', 'stage' => 'Final Order Entry Estimate'], ['name' => 'Final Order Entry Cost Sheet', 'stage' => 'Final Order Entry Cost Sheet'], ['name' => 'JAF', 'stage' => 'JAF'], ], 'Project Execution' => [ ['name' => 'Approval Drawing', 'stage' => 'Approval Drawing'], ['name' => 'RAD', 'stage' => 'RAD'], ['name' => 'CIF', 'stage' => 'CIF'], ['name' => 'Color Confirmation Structure', 'stage' => 'Color Confirmation Structure'], ['name' => 'Color Confirmation Sheeting', 'stage' => 'Color Confirmation Sheeting'], ['name' => 'Shop Drawing', 'stage' => 'Shop Drawing'], ], 'Material & Tech-Sheet' => [ ['name' => 'Final BOM - Consolidated', 'stage' => 'Final BOM - Consolidated'], ['name' => 'Final BOM - Built Up', 'stage' => 'Final BOM - Built Up'], ['name' => 'Final BOM - CFS', 'stage' => 'Final BOM - CFS'], ['name' => 'Final BOM - AB', 'stage' => 'Final BOM - AB'], ['name' => 'Final BOM - CB', 'stage' => 'Final BOM - CB'], ['name' => 'Final BOM - Roof Sheeting', 'stage' => 'Final BOM - Roof Sheeting'], ['name' => 'Final BOM - Wall Sheeting', 'stage' => 'Final BOM - Wall Sheeting'], ['name' => 'Final BOM - Sheeting Angle', 'stage' => 'Final BOM - Sheeting Angle'], ['name' => 'Final BOM - Skylight', 'stage' => 'Final BOM - Skylight'], ['name' => 'Final BOM - Wall Light', 'stage' => 'Final BOM - Wall Light'], ['name' => 'Final BOM - Screws', 'stage' => 'Final BOM - Screws'], ['name' => 'Final BOM - Turbovents', 'stage' => 'Final BOM - Turbovents'], ], 'Site Reports' => [ ['name' => 'AB Report', 'stage' => 'AB Report'], ['name' => 'Alignment Report', 'stage' => 'Alignment Report'], ['name' => 'Bolt Tightening Report', 'stage' => 'Bolt Tightening Report'], ['name' => 'Roof Sheeting Report', 'stage' => 'Roof Sheeting Report'], ['name' => 'Erection drawings', 'stage' => 'Erection drawings'], ['name' => 'Erection work order activity', 'stage' => 'Erection work order activity'], ], ]; @endphp {{-- Script to handle dynamic categories and incomplete status alerts --}} {{-- /tab-panels --}}
{{-- /container --}} @endsection