@extends('backend.layout.main') @push('css') @endpush @section('content')
{{-- ══════════════════════════════════════════════════════════ --}} {{-- HEADER --}} {{-- ══════════════════════════════════════════════════════════ --}}

Repair & Service Dashboard

Overview of all service jobs, revenue and technician performance

{{-- Date filter --}}
{{-- ══════════════════════════════════════════════════════════ --}} {{-- ALERT PILLS --}} {{-- ══════════════════════════════════════════════════════════ --}} @if($overdue > 0 || $high_priority > 0 || $today_jobs > 0)
@if($overdue > 0) {{ $overdue }} Overdue Job{{ $overdue > 1 ? 's' : '' }} @endif @if($high_priority > 0) {{ $high_priority }} High Priority @endif @if($today_jobs > 0) {{ $today_jobs }} New Today @endif @if($total_due > 0) {{ config('currency') }} {{ number_format($total_due, config('decimal')) }} Outstanding @endif
@endif {{-- ══════════════════════════════════════════════════════════ --}} {{-- KPI CARDS --}} {{-- ══════════════════════════════════════════════════════════ --}}
{{-- Revenue span-2 --}}
Total Revenue
{{ config('currency') }} {{ number_format($total_revenue, config('decimal')) }}
{{ $total_jobs }} Jobs
Avg {{ $total_jobs > 0 ? number_format($total_revenue / $total_jobs, config('decimal')) : '0.00' }} / job
{{ config('currency') }} {{ number_format($total_collected, config('decimal')) }}
Collected
{{ config('currency') }} {{ number_format($total_due, config('decimal')) }}
Outstanding
{{ $total_revenue > 0 ? number_format(($total_collected / $total_revenue) * 100, 1) : '0' }}%
Collection Rate
{{-- Total Jobs --}}
{{ $total_jobs }}
Total Jobs
📱 {{ $device_jobs }} {{ __('db.device') }}  |  🚗 {{ $vehicle_jobs }} {{ __('db.vehicle') }}
{{-- In Progress --}}
{{ $in_progress }}
{{ __('db.in_progress') }}
+{{ $diagnosed }} {{ __('db.diagnosed') }}  ·  {{ $pending }} {{ __('db.Pending') }}
{{-- Completed --}}
{{ $completed + $delivered }}
Completed
{{ $completed }} completed  ·  {{ $delivered }} delivered
{{-- /kpi-grid --}} {{-- ══════════════════════════════════════════════════════════ --}} {{-- CHARTS ROW --}} {{-- ══════════════════════════════════════════════════════════ --}}
{{-- Monthly trend chart --}}
Monthly Trend (last 6 months)
View All →
{{-- Status donut --}}
Job Status
@php $statusColors = [ 'pending' => '#f59e0b', 'diagnosed' => '#0891b2', 'in_progress' => '#3b82f6', 'completed' => '#22c55e', 'delivered' => '#7c5cc4', 'cancelled' => '#ef4444', ]; $statusLabels = [ 'pending' => __('db.Pending'), 'diagnosed' => __('db.diagnosed'), 'in_progress' => __('db.in_progress'), 'completed' => __('db.Completed'), 'delivered' => __('db.Delivered'), 'cancelled' => __('db.Cancelled'), ]; $total_sc = array_sum($status_chart); @endphp @foreach($statusColors as $key => $color) @php $cnt = $status_chart[$key] ?? 0; @endphp @if($cnt > 0)
{{ $statusLabels[$key] }} {{ $cnt }}
@endif @endforeach @if($total_sc === 0)

No data for period

@endif
{{-- ══════════════════════════════════════════════════════════ --}} {{-- BOTTOM ROW — Recent jobs + Techs + Payments --}} {{-- ══════════════════════════════════════════════════════════ --}}
{{-- Recent Jobs --}}
Recent Service Jobs
+ New Job
@forelse($recent_jobs as $job) @empty @endforelse
Reference Customer Type Status Pri Total Due
{{ $job->reference_no }}
{{ date(config('date_format'), strtotime($job->created_at)) }}
{{ optional($job->customer)->name ?? '—' }}
{{ optional($job->warehouse)->name }}
{{ $job->service_type === 'device' ? '📱' : '🚗' }} {{ $job->service_type === 'device' ? __('db.device') : __('db.vehicle') }} {{ ucfirst(str_replace('_',' ',$job->status)) }} {{ number_format($job->total_amount, config('decimal')) }} {{ number_format($job->due_amount, config('decimal')) }}
No service jobs yet. Create one →
{{-- Top Technicians --}}
Top Technicians
@php $max_done = $top_technicians->max('done') ?: 1; @endphp @forelse($top_technicians as $idx => $tech)
{{ strtoupper(substr(optional($tech->assignedTo)->name ?? '?', 0, 1)) }}
{{ optional($tech->assignedTo)->name ?? 'Unknown' }}
{{ number_format($tech->earned, config('decimal')) }} earned
{{ $tech->done }}
@empty

No completed jobs yet.

@endforelse
{{-- Payment Methods --}}
Payment Methods
@php $pm_icons = ['Cash'=>'💵','Cheque'=>'📝','Card'=>'💳','bKash'=>'📲','Nagad'=>'📱','Rocket'=>'🚀','Bank Transfer'=>'🏦']; @endphp @forelse($payment_methods as $pm)
{{ $pm_icons[$pm->paying_method] ?? '💰' }}
{{ $pm->paying_method }}
{{ $pm->cnt }} payment{{ $pm->cnt > 1 ? 's' : '' }}
{{ number_format($pm->total, config('decimal')) }}
@empty

No payments yet.

@endforelse
@endsection @push('scripts') @endpush