@extends('frontend.layout.dashboard-master') @section('site_title', __('Work History')) @section('content') @php $orderTitle = match($order_details->is_project_job) { 'project' => $order_details->project?->title ?? __('N/A'), 'job' => $order_details->job?->title ?? __('N/A'), default => __('Custom Order'), }; $statusLabel = match($order_details->status) { 0 => ['label' => __('Queue'), 'class' => 'bg-[#ECEDEF] text-[#3B4759]'], 1 => ['label' => __('Active'), 'class' => 'bg-primary/10 text-primary'], 2 => ['label' => __('Delivered'), 'class' => 'bg-primary/10 text-primary'], 3 => ['label' => __('Completed'), 'class' => 'bg-[#DCFCE7] text-[#15803D]'], 4 => ['label' => __('Cancelled'), 'class' => 'bg-[#FF4D4D]/10 text-[#FF4D4D]'], 5 => ['label' => __('Declined'), 'class' => 'bg-[#FF4D4D]/10 text-[#FF4D4D]'], default => ['label' => __('On Hold'), 'class' => 'bg-[#FA8C00]/10 text-[#FA8C00]'], }; $isHourly = $order_details->is_fixed_hourly === 'hourly'; $isComplete = $order_details->status === 3; $clientUser = $order_details->user; if ($clientUser?->image) { if (cloudStorageExist() && in_array(\Illuminate\Support\Facades\Storage::getDefaultDriver(), ['s3','cloudFlareR2','wasabi'])) { $clientImage = render_frontend_cloud_image_if_module_exists('profile/'.$clientUser->image, load_from: $clientUser->load_from ?? ''); } else { $clientImage = asset('assets/uploads/profile/'.$clientUser->image); } } else { $clientImage = asset('assets/static/img/author/author.jpg'); } $workHoursInt = floor($total_work_time); $workMinutes = round(($total_work_time - $workHoursInt) * 60); $workFormatted = $workHoursInt . 'h ' . $workMinutes . 'm'; $minHour = (int)(get_static_option('minimum_hour_for_realtime_earning') ?? 1); $earnings = $isComplete ? $order_details->payable_amount : \App\Models\OrderMilestone::where('order_id', $order_details->id)->where('status', 2)->sum('price'); $total_job = \App\Models\JobPost::where('user_id', $clientUser?->id)->count(); $total_order = \App\Models\Order::where('user_id', $clientUser?->id)->where('status', 3)->count(); $hiring_rate = $total_job > 0 ? ($total_order * 100) / $total_job : 0; @endphp {{-- Page header --}}

{{ __('Work History') }}

#{{ str_pad($order_details->id, 6, '0', STR_PAD_LEFT) }} · {{ $orderTitle }}

{{ __('Back to Order') }}
{{-- Left column --}}
{{-- Order summary --}}

{{ __('Order ID') }}: #{{ str_pad($order_details->id, 6, '0', STR_PAD_LEFT) }}

{{ $orderTitle }}

{{ $order_details->created_at->toFormattedDateString() }}

{{ $statusLabel['label'] }} @if($isHourly) {{ __('Hourly') }} @else {{ __('Fixed') }} @endif
{{-- Stats grid --}}

{{ __('Earned') }}

{{ float_amount_with_currency_symbol($earnings) }}

@if($isHourly && !$isComplete)

{{ __('Hourly Rate') }}

{{ float_amount_with_currency_symbol($order_details->hourly_rate) }}

{{ __('Est. Hours') }}

{{ $order_details->job?->estimated_hours }} h

{{ __('Approx. Budget') }}

{{ float_amount_with_currency_symbol($order_details->price) }}

@else

{{ __('Pending') }}

{{ (!$isComplete && $order_details->payment_status) ? float_amount_with_currency_symbol($order_details->payable_amount) : site_currency_symbol() . ' 0' }}

{{ __('Commission') }}

{{ float_amount_with_currency_symbol($order_details->commission_amount) }}

{{ __('Total Budget') }}

{{ float_amount_with_currency_symbol($order_details->price) }}

@endif
{{-- Tabs --}}
{{-- Work Sessions --}}
@if($all_histories->count())
@foreach($all_histories as $history) @endforeach
{{ __('Start') }} {{ __('End') }} {{ __('Duration') }} {{ __('Note') }}
{{ \Carbon\Carbon::parse($history->start_date)->format('M d, Y H:i') }} {{ \Carbon\Carbon::parse($history->end_date)->format('M d, Y H:i') }} {{ $history->hours_worked }} {{ $history->notes ?: '—' }}
@if($all_histories->hasPages())
{{ $all_histories->links() }}
@endif @else

{{ __('No work sessions yet') }}

{{ __('Sessions will appear here once you start the time tracker.') }}

@endif
{{-- Earnings Summary --}}
{{-- Right sidebar --}}
{{-- Client card --}}

{{ __('Client') }}

{{ $clientUser?->first_name }}

{{ $clientUser?->first_name }} {{ $clientUser?->last_name }}

@if($clientUser?->user_verified_status) @endif
@if($clientUser?->user_state?->state || $clientUser?->user_country?->country)

{{ implode(', ', array_filter([$clientUser?->user_state?->state, $clientUser?->user_country?->country])) }}

@endif @if(\Illuminate\Support\Facades\Cache::has('user_is_online_' . $clientUser?->id)) {{ __('Online') }} @else {{ __('Offline') }} @endif
{{ __('Member since') }} {{ $clientUser?->created_at->format('M Y') }}
{{ __('Total jobs') }} {{ $total_job }}
@if($hiring_rate >= 1)
{{ __('Hire rate') }} {{ $hiring_rate > 100 ? 100 : round($hiring_rate) }}%
@endif
{{-- Actions --}}
@if(!$isComplete && $order_details->status !== 0) {{ __('Go to Time Tracker') }} @endif {{ __('Back to Order') }}
@endsection @section('script') @endsection