@php
$isOwnerView = isset($hideFavoriteButton) && $hideFavoriteButton && auth()->check() && $project->user_id == auth()->id();
$statusBadgeStyle = '';
$hasMenuActions = false;
$showPayToFeatureBtn = false;
if ($isOwnerView) {
$statusBadgeStyle = match($project->status) {
\App\Models\Project::DRAFT => 'background:#6366f1; color:#fff;',
\App\Models\Project::PENDING => 'background:#f59e0b; color:#fff;',
\App\Models\Project::APPROVED => 'background:#22c55e; color:#fff;',
\App\Models\Project::REJECTED => 'background:#f97316; color:#fff;',
\App\Models\Project::RUNNING => 'background:#3b82f6; color:#fff;',
\App\Models\Project::COMPLETED => 'background:#1a1a2e; color:#fff;',
\App\Models\Project::CLOSED => 'background:#9e9e9e; color:#fff;',
\App\Models\Project::CANCELLED => 'background:#DC2626; color:#fff;',
default => 'background:#9e9e9e; color:#fff;',
};
$showPayToFeatureBtn = isset($showPayToFeature) && $showPayToFeature
&& $project->payment_type == \App\Models\Project::PAYMENT_TYPE_PAID
&& !$project->is_featured_payment;
$hasMenuActions = in_array($project->status, [
\App\Models\Project::DRAFT,
\App\Models\Project::PENDING,
\App\Models\Project::REJECTED,
\App\Models\Project::APPROVED,
\App\Models\Project::CLOSED,
]) || $showPayToFeatureBtn;
}
$hasOffer = auth()->check() && auth()->user()->isFreelancer()
? (isset($userOfferProjectIds) ? in_array($project->id, $userOfferProjectIds) : $project->offers->where('user_id', auth()->id())->first())
: null;
$hasHints = $project->is_private || $project->is_featured || $hasOffer;
$showBadgesRow = $hasHints || $isOwnerView;
@endphp
@if($isOwnerView)
{{-- Hidden Forms --}}
@if($project->status == \App\Models\Project::APPROVED)
@endif
@if($project->status == \App\Models\Project::CLOSED)
@endif
@endif
{{-- Unified badges row: hints + status + 3-dots --}}
@if($showBadgesRow)
{{-- Hint badges (private, featured, applied) --}}
@if($project->is_private)
مشروع خاص
@endif
@if($project->is_featured)
@lang('front.featured_project')
@endif
@if($hasOffer)
تم التقديم
@endif
{{-- Status badge (owner only) --}}
@if($isOwnerView)
{{ $project->getCurrentStatus() }}
@endif
{{-- 3-Dots menu (owner only, pushed to end) --}}
@if($isOwnerView && $hasMenuActions)
@endif
@endif
{{-- Confirm Close Project Modal --}}
@if($project->status == \App\Models\Project::APPROVED)
هل أنت متأكد من إغلاق المشروع؟
في حال إغلاق المشروع، لن يتمكن المستقلون من إضافة عروض جديدة عليه. ومع ذلك، سيظل بإمكانك مراجعة العروض المقدمة مسبقًا، واختيار العرض المناسب، ثم الموافقة عليه لبدء العمل.
@endif
@php
$fullDesc = strip_tags($project->description);
$isLongDesc = mb_strlen($fullDesc) > 310;
$shortDesc = $isLongDesc ? \Illuminate\Support\Str::limit($fullDesc, 310, '') : $fullDesc;
@endphp
{{ $shortDesc }}@if($isLongDesc)... @lang('front.More') @endif
{{ $fullDesc }} @lang('front.Less')
{{-- @if($project->category)
{{ $project->category->name }}
@else
@endif --}}
@if($project->skills->isNotEmpty())
@endif
{{-- Always-visible extras: payment verified + rating + delivery days + payment method --}}