@php function formatIndianCurrency($amount) { $amount = (float) $amount; $decimal = number_format($amount, 2, '.', ''); $exploded = explode('.', $decimal); $last3 = substr($exploded[0], -3); $restUnits = substr($exploded[0], 0, -3); if ($restUnits != '') { $restUnits = preg_replace("/\B(?=(\d{2})+(?!\d))/", ",", $restUnits); } return '₹' . $restUnits . $last3 . '.' . $exploded[1]; } @endphp @extends('layouts.admin') @section('title', 'Active Jobs') @section('pages', 'Active Jobs') @section('content')
{{-- Page Header --}}

Active Jobs

All currently in-progress projects

{{ $activeJobs->count() }} Active Jobs
{{-- Search & Filter Bar --}}
{{-- Table Card --}}
@forelse($activeJobs as $order) {{-- Quote ID --}} {{-- Client with Avatar --}} {{-- Project Name --}} {{-- Location --}} {{-- Date --}} {{-- Status Badge --}} {{-- Estimated Cost --}} {{-- Final Quote --}} {{-- Action --}} @empty @endforelse
Quote No Client Factory Name Factory Location Quote Date Status Estimated Quote Final Quote Value
{{ strtoupper(substr($order->quotation->state_code ?? '', 0, 2)) }}-{{ \Carbon\Carbon::parse($order->quotation->created_at)->format('y') }}-{{ str_pad($order->quotation->id ?? 0, 3, '0', STR_PAD_LEFT) }}
{{ $order->client_name }}
{{ $order->title ?? 'N/A' }}
{{ $order->location ?? 'N/A' }}
{{ \Carbon\Carbon::parse($order->created_at)->format('d M Y') }}
{{ \Carbon\Carbon::parse($order->created_at)->diffForHumans() }}
@php $statusMap = [ 'in-progress' => ['bg' => '#e0f2fe', 'text' => '#0369a1', 'dot' => '#0ea5e9', 'label' => 'In Progress'], 'on-hold' => ['bg' => '#fef9c3', 'text' => '#854d0e', 'dot' => '#eab308', 'label' => 'On Hold'], 'review' => ['bg' => '#ede9fe', 'text' => '#6d28d9', 'dot' => '#8b5cf6', 'label' => 'Review'], 'completed' => ['bg' => '#dcfce7', 'text' => '#15803d', 'dot' => '#22c55e', 'label' => 'Completed'], ]; $s = $statusMap[strtolower($order->status)] ?? ['bg' => '#f3f4f6', 'text' => '#374151', 'dot' => '#9ca3af', 'label' => ucfirst($order->status)]; @endphp {{ $s['label'] }} @if(!empty($order->quotation->estimate_cost))
{{ formatIndianCurrency($order->quotation->estimate_cost) }}
@else — @endif
@if(!empty($order->project_cost))
{{ formatIndianCurrency($order->project_cost) }}
{{-- Show variance if both values exist --}} @if(!empty($order->quotation->estimate_cost)) @php $diff = $order->project_cost - $order->quotation->estimate_cost; $pct = $order->quotation->estimate_cost > 0 ? round(($diff / $order->quotation->estimate_cost) * 100, 1) : 0; @endphp
{{ abs($pct) }}% vs estimate
@endif @else — @endif
No active jobs found

No projects are currently in progress.

{{-- Footer --}}
Showing {{ $activeJobs->count() }} active job(s) @if(method_exists($activeJobs, 'links')) {{ $activeJobs->links('pagination::bootstrap-5') }} @endif
@endsection