@extends('frontend.layout.dashboard-master') @section('site_title', __('Order Details')) @section('style') @endsection @section('content') @php $od = $order_details; $mile_stones = \App\Models\OrderMilestone::where('order_id', $od->id)->get(); $payable_amount = \App\Models\OrderMilestone::where('order_id', $od->id)->where('status', '!=', 3)->sum('price'); $earnings = \App\Models\OrderMilestone::where('order_id', $od->id)->where('status', 2)->sum('price'); $complete_orders = \App\Models\Order::where('freelancer_id', $od->freelancer_id)->where('status', 3)->count(); $active_orders = \App\Models\Order::where('freelancer_id', $od->freelancer_id)->where('status', 1)->count(); $check_order_has_report_by_client = \App\Models\Report::where('client_id', $od->user_id) ->where('order_id', $od->id)->where('reporter', 'client')->first(); $clientRating = \App\Models\Rating::where('order_id', $od->id) ->where('sender_type', 1) ->where('sender_id', auth()->id()) ->first(); $isHourly = $od->is_fixed_hourly === 'hourly'; $notSuspended = $od?->freelancer?->is_suspend != 1; $hourlyLoggedSeconds = 0; $hourlyLoggedHours = 0; $hourlyPayAmount = 0; $hourlyRefund = 0; if ($isHourly && $od->status !== 3) { $hourlyLoggedSeconds = \App\Models\OrderWorkHistory::where('order_id', $od->id)->sum('seconds'); $hourlyLoggedHours = $hourlyLoggedSeconds / 3600; $hourlyRate = $od->hourly_rate ?? $od->job?->hourly_rate ?? 0; $hourlyActual = ($hourlyLoggedSeconds / 3600) * $hourlyRate; $hourlyPayAmount = min($hourlyActual, (float) $od->price); $hourlyRefund = max(0, (float) $od->price - $hourlyPayAmount); } $orderTitle = match($od->is_project_job) { 'project' => $od->project?->title ?? __('N/A'), 'job' => $od->job?->title ?? __('N/A'), default => __('Custom Order'), }; $budget = $isHourly ? float_amount_with_currency_symbol($od->job?->hourly_rate ?? 0) : float_amount_with_currency_symbol($od->price); if ($od->freelancer?->image) { if (cloudStorageExist() && in_array(\Illuminate\Support\Facades\Storage::getDefaultDriver(), ['s3','cloudFlareR2','wasabi'])) { $freelancerImage = render_frontend_cloud_image_if_module_exists('profile/'.$od->freelancer->image, load_from: $od->freelancer->load_from ?? ''); } else { $freelancerImage = asset('assets/uploads/profile/'.$od->freelancer->image); } } else { $freelancerImage = asset('assets/static/img/author/author.jpg'); } $isOnline = \Illuminate\Support\Facades\Cache::has('user_is_online_' . $od->freelancer?->id); @endphp {{-- Back link --}}
{{ __('Order ID') }}: #{{ str_pad($od->id, 6, '0', STR_PAD_LEFT) }}
{{ $isHourly ? __('Hourly Rate') : __('Budget') }}
{{ $budget }} @if(!$isHourly) ({{ $od->payment_status === 'complete' ? __('Funded') : ucfirst($od->payment_status) }}) @endif
{{ __('Delivery Time') }}
{{ $od->delivery_time ?? __('N/A') }}
{{ __('Completed') }}
{{ $complete_orders }}
{{ __('Active') }}
{{ $active_orders }}
{{ __('Hours Logged') }}
{{ number_format($hourlyLoggedHours, 2) }} / {{ $od->job?->estimated_hours ?? '—' }} {{ __('hrs') }}
@else{{ __('Earned Balance') }}
{{ float_amount_with_currency_symbol($od->status === 3 ? $od->payable_amount : $earnings) }}
@endif{{ __('Hourly Rate') }}
{{ float_amount_with_currency_symbol($od->job?->hourly_rate) }}
@else{{ __('Pending Balance') }}
@if($mile_stones->count() > 0) {{ float_amount_with_currency_symbol($od->status != 3 ? $payable_amount - $earnings : 0) }} @else {{ ($od->status != 3 && $od->status != 4 && $od->payment_status != '') ? float_amount_with_currency_symbol($od->payable_amount) : site_currency_symbol().'0' }} @endif
@endif{{ __('Amount to Pay') }}
{{ float_amount_with_currency_symbol($hourlyPayAmount) }}
@if($hourlyLoggedSeconds === 0){{ __('No hours logged yet') }}
@elseif($hourlyRefund > 0){{ float_amount_with_currency_symbol($hourlyRefund) }} {{ __('will be refunded to you') }}
@endif @else{{ __('Commission Amount') }}
{{ float_amount_with_currency_symbol($od->commission_amount) }}
@endif{{ $isHourly ? __('Locked Budget') : __('Total Budget') }}
{{ float_amount_with_currency_symbol($od->price) }}
{{ __('Delivery') }}: {{ $ms->deadline }}
{{ $ms->description }}
{{ $od->description ?? __('No description provided.') }}
@if($od->freelancer?->user_state?->state){{ $od->freelancer->user_state->state }}, @endif {{ $od->freelancer?->user_country?->country }}