@extends('frontend.layout.dashboard-master') @section('page-meta-data') {!! render_page_meta_data_for_job($job_details) !!} @endsection @section('content') @php $jd = $job_details; $creator = $user; // job creator (client) // Creator image if ($creator->image) { if (cloudStorageExist() && in_array(\Illuminate\Support\Facades\Storage::getDefaultDriver(), ['s3','cloudFlareR2','wasabi'])) { $creatorImg = render_frontend_cloud_image_if_module_exists('profile/'.$creator->image, load_from: $creator->load_from ?? ''); } else { $creatorImg = asset('assets/uploads/profile/'.$creator->image); } } else { $creatorImg = asset('assets/static/img/author/author.jpg'); } $isOnline = \Illuminate\Support\Facades\Cache::has('user_is_online_'.$creator->id); $totalJobs = $creator->user_jobs?->count() ?? 0; $proposalCount = $jd->job_proposals?->count() ?? 0; $isFixed = $jd->type !== 'hourly'; // Related jobs $related_jobs = \App\Models\JobPost::where('category', $jd->category) ->where('id', '!=', $jd->id) ->where('status', 1) ->with(['job_creator','job_category','job_skills']) ->whereHas('job_creator') ->take(4)->get(); // Attachment URL $attachUrl = ''; if ($jd->attachment && Auth::guard('web')->check()) { $localPath = base_path('../assets/uploads/jobs/'.$jd->attachment); if (file_exists($localPath)) { $attachUrl = asset('assets/uploads/jobs/'.$jd->attachment); } } @endphp {{-- Back link --}}
{{ __('Back to Jobs') }}
{{-- ===== LEFT COLUMN ===== --}}
{{-- Card 1: Job Header --}}
{{ $jd->job_category?->category ?? __('Uncategorized') }} @if($isFixed) {{ __('Fixed Price') }} @else {{ __('Hourly') }} @endif @if($jd->created_at->diffInHours(now()) <= 24) {{ __('New') }} @endif

{{ $jd->title }}

{{ __('Posted') }} {{ $jd->created_at->diffForHumans() }}  ·  {{ $proposalCount }} {{ __('proposals') }}

@if($attachUrl) {{ __('Download Attachment') }} @endif

{{-- Overview grid --}}
{{-- Budget --}}

{{ __('Budget') }}

{{ $jd->display_price }} @if(!$isFixed) /hr @endif

@if(!$isFixed && $jd->estimated_hours)

~{{ $jd->estimated_hours }} {{ __('hrs') }}

@endif
{{-- Level --}}

{{ __('Level') }}

{{ ucfirst($jd->level ?? 'N/A') }}

{{-- Location --}}

{{ __('Location') }}

{{ $creator->user_country?->country ?? __('Anywhere') }}

{{-- Posted --}}

{{ __('Posted') }}

{{ $jd->created_at->format('M d, Y') }}

{{-- Proposals --}}

{{ __('Proposals') }}

{{ $proposalCount }}

{{-- Type --}}

{{ __('Job Type') }}

{{ $isFixed ? __('Fixed Price') : __('Hourly Rate') }}

{{-- Card 2: Description --}}
{{ __('Job Description') }}
{!! html_entity_decode($jd->description) !!}
{{-- Card 3: Skills --}} @if($jd->job_skills && $jd->job_skills->count() > 0)
{{ __('Required Skills') }}
@foreach($jd->job_skills as $skill) {{ $skill->skill }} @endforeach
@endif {{-- Card 4: About the Client --}}
{{ __('About the Client') }}
{{ $creator->fullname }}

{{ $creator->fullname }}

@if($creator->user_verified_status) @endif @if($creator->is_pro_freelancer) Pro @endif

{{ $creator->user_type == 1 ? __('Client') : __('Freelancer') }} @if($creator->user_country?->country)  ·  {{ $creator->user_country->country }} @endif

@if($creator->user_introduction?->description)

{{ Str::limit($creator->user_introduction->description, 200) }}

@endif
{{-- Card 5: Related Jobs --}} @if($related_jobs->isNotEmpty())
{{ __('Related Jobs') }}
@foreach($related_jobs as $rj) @php $rjCreator = $rj->job_creator; @endphp

{{ Str::limit($rj->title, 70) }}

@if($rj->created_at->diffInHours(now()) <= 24) {{ __('New') }} @endif
{{ $rj->display_price }} {{ $rj->type == 'hourly' ? __('Hourly') : __('Fixed') }} {{ ucfirst($rj->level ?? 'N/A') }} {{ $rj->created_at->diffForHumans() }}

{{ Str::limit(strip_tags($rj->description), 100) }}

@foreach($rj->job_skills->take(3) as $sk) {{ $sk->skill }} @endforeach
{{ __('View Job') }} →
@endforeach
@endif
{{-- end left --}} {{-- ===== RIGHT COLUMN ===== --}}
{{-- Apply CTA card --}}
@if(Auth::guard('web')->check()) @if(Auth::user()->user_type == 1) {{-- Client --}}

{{ __('Only freelancers can apply to jobs.') }}

@elseif(Auth::user()->id == $jd->user_id) {{-- Own job --}}

{{ __('This is your job posting') }}

@elseif($hasApplied) {{-- Already applied --}}

{{ __('You have already applied for this job') }}

@elseif($canApply && !$isCountryRestricted) {{-- Can apply --}}

{{ __('Your proposal will be sent directly to the client') }}

@else {{-- Restricted --}}

{{ $isCountryRestricted ? $countryRestrictionMessage : $restrictionMessage }}

@if($requiresProfileUpdate) {{ __('Update Profile') }} @endif
@endif @else {{-- Not logged in --}}

{{ __('Login as a freelancer to apply') }}

@endif
{{-- Client info card --}}
{{ $creator->fullname }}

{{ $creator->fullname }}

@if($creator->user_verified_status) @endif
{{ $isOnline ? __('Active now') : __('Offline') }}
@if($creator->user_country?->country)

{{ $creator->user_country->country }}

@endif

{{ __('Member Since') }}
{{ $creator->created_at->format('M Y') }}
{{ __('Total Jobs Posted') }}
{{ $totalJobs }}
{{-- ===== Apply Proposal Modal ===== --}} {{-- ===== Login Modal (for non-auth users) ===== --}} @endsection @section('script') @endsection