@extends('garage.layouts.app') @section('title', 'View Job Card') @push('styles') @endpush @section('content') @php $minutesToText = function ($minutes) { $m = (int) $minutes; $h = intdiv($m, 60); $r = $m % 60; if ($h <= 0) return $r . 'm'; if ($r <= 0) return $h . 'h'; return $h . 'h ' . $r . 'm'; }; @endphp
Job Card Details
@if($workOrder->status !== 'completed') Edit @endif Queue Back to List
Job Card Number: {{ $workOrder->work_order_number }}
Job Card Date: {{ \Carbon\Carbon::parse($workOrder->work_order_date)->format('M d, Y') }}
Start Date: {{ $workOrder->start_date ? \Carbon\Carbon::parse($workOrder->start_date)->format('M d, Y') : '-' }}
Completion Date: {{ $workOrder->completion_date ? \Carbon\Carbon::parse($workOrder->completion_date)->format('M d, Y') : '-' }}
Reference Number: {{ $workOrder->reference_number ?? '-' }}
{{ $glOrder ?? 'Order' }}: {{ $workOrder->repair_order_number ?? '-' }}
Slot: {{ $workOrder->slot_name ?? '-' }}
Estimate: {{ $workOrder->estimate_number ?? '-' }}
Customer: {{ $workOrder->customer_name ?? '-' }}
Vehicle: @if($workOrder->vehicle_registration) {{ $workOrder->vehicle_registration }} @if($workOrder->vehicle_make && $workOrder->vehicle_model) ({{ $workOrder->vehicle_make }} {{ $workOrder->vehicle_model }}) @endif @else - @endif
Priority: @php $priorityColors = [ 0 => 'secondary', 1 => 'warning', 2 => 'danger' ]; $priorityLabels = [ 0 => 'Normal', 1 => 'High', 2 => 'Urgent' ]; $priorityColor = $priorityColors[$workOrder->priority] ?? 'secondary'; @endphp {{ $priorityLabels[$workOrder->priority] ?? 'Normal' }}
Status: @php $statusColors = [ 'draft' => 'secondary', 'in_progress' => 'info', 'on_hold' => 'warning', 'completed' => 'success', 'cancelled' => 'danger' ]; $statusColor = $statusColors[$workOrder->status] ?? 'secondary'; @endphp {{ ucfirst(str_replace('_', ' ', $workOrder->status)) }}
Subtotal: PKR {{ number_format($workOrder->subtotal, 2) }}
Tax Amount: PKR {{ number_format($workOrder->tax_amount, 2) }}
Discount: PKR {{ number_format($workOrder->discount_amount, 2) }}
Total Amount: PKR {{ number_format($workOrder->total_amount, 2) }}
@if($workOrder->work_description)
Work Description

{{ nl2br(e($workOrder->work_description)) }}

@endif @if($workOrder->customer_notes || $workOrder->internal_notes)
@if($workOrder->customer_notes)
Customer Notes

{{ nl2br(e($workOrder->customer_notes)) }}

@endif @if($workOrder->internal_notes)
Internal Notes

{{ nl2br(e($workOrder->internal_notes)) }}

@endif
@endif
Job Card Items
@foreach($items as $index => $item) @endforeach
# Item Type Qty Qty Used ETA Unit Price Discount Tax % Tax Amount Total Status
{{ $index + 1 }}
{{ $item->part_name ?? $item->labor_name ?? $item->service_group_name ?? $item->garage_service_name ?? $item->description ?? '-' }}
@if($item->notes) {{ $item->notes }} @endif
{{ ucfirst(str_replace('_', ' ', $item->item_type)) }} {{ $item->quantity }} {{ $item->quantity_used ?? 0 }} @php $eta = null; if (($item->item_type ?? '') === 'garage_service') { $eta = isset($item->estimated_minutes) && $item->estimated_minutes !== null && $item->estimated_minutes !== '' ? (int) $item->estimated_minutes : (isset($item->garage_service_required_minutes) ? (int) $item->garage_service_required_minutes : 0); } elseif (($item->item_type ?? '') === 'labor' || ($item->item_type ?? '') === 'service_group') { $eta = isset($item->estimated_minutes) ? (int) $item->estimated_minutes : 0; } @endphp @if($eta === null) @else {{ $minutesToText($eta) }} @endif PKR {{ number_format($item->unit_price, 2) }} PKR {{ number_format($item->discount_amount, 2) }} {{ number_format($item->tax_rate, 2) }}% PKR {{ number_format($item->tax_amount, 2) }} PKR {{ number_format($item->total_price, 2) }} @php $itemStatusColors = ['pending' => 'secondary','in_progress' => 'info','completed' => 'success']; $itemStatusColor = $itemStatusColors[$item->status] ?? 'secondary'; @endphp {{ ucfirst(str_replace('_', ' ', $item->status)) }}
Subtotal:PKR {{ number_format($workOrder->subtotal, 2) }}
Tax:PKR {{ number_format($workOrder->tax_amount, 2) }}
Discount:PKR {{ number_format($workOrder->discount_amount, 2) }}
Total:PKR {{ number_format($workOrder->total_amount, 2) }}
Total Estimated
{{ $minutesToText($taskSummary['total_estimated_minutes'] ?? 0) }}
Total Actual
{{ $minutesToText($taskSummary['total_actual_minutes'] ?? 0) }}
Total Pending
{{ $minutesToText($taskSummary['total_pending_minutes'] ?? 0) }}
Total Delay
{{ $minutesToText($taskSummary['total_delay_minutes'] ?? 0) }}
Completed
{{ (int)($taskSummary['completed_tasks_count'] ?? 0) }}
Pending
{{ (int)($taskSummary['pending_tasks_count'] ?? 0) }}
Parts/services are fetched from {{ $glOrder ?? 'Order' }} or Estimate and shown read-only on Job Card. You can update required completion time in the task rows below.
@forelse($tasks as $task) @empty @endforelse
Task Assigned To Estimated Start Time End Time Actual Pending Delay Status Actions
{{ $task->task_name }}
@if(!empty($task->source_item_type)) {{ str_replace('_', ' ', $task->source_item_type) }} @endif @if($task->remarks){{ $task->remarks }}@endif
{{ $task->assigned_to_name ?: '-' }} {{ $minutesToText($task->estimated_minutes) }} {{ $task->start_time ? \Carbon\Carbon::parse($task->start_time)->format('M d, Y h:i A') : '-' }} {{ $task->end_time ? \Carbon\Carbon::parse($task->end_time)->format('M d, Y h:i A') : '-' }} {{ $minutesToText($task->actual_minutes) }} @if($task->status === 'in_progress' && $task->open_started_at) Running @endif {{ $minutesToText($task->pending_minutes) }} {{ $minutesToText($task->delay_minutes) }} {{ ucfirst(str_replace('_', ' ', $task->status)) }}
@if(in_array($task->status, ['pending','assigned','paused']))
@csrf
@endif @if($task->status === 'in_progress')
@csrf
@endif @if($task->status === 'paused')
@csrf
@endif @if(in_array($task->status, ['pending','assigned','in_progress','paused']))
@csrf
@csrf
@endif
@if($workOrder->status !== 'completed' && $workOrder->status !== 'cancelled')
@csrf @method('PUT')
@endif
No tasks added yet.
Back to List @if($workOrder->status !== 'completed') Edit Job Card @endif
@endsection @push('scripts') @endpush