@php
$promotion = $offer->promotion;
$isSponsored = $promotion
&& $promotion->status === \App\Enums\P2P\PromotionStatus::ACTIVE
&& $promotion->ends_at
&& $promotion->ends_at->isFuture();
$promotionFeatures = (array) ($promotion?->package?->features ?? []);
$hasFeaturedBadge = $isSponsored
&& (!empty($promotionFeatures['featured_badge']) || !empty($promotionFeatures['verified_badge']));
$currency = $offer->wallet->currency->code;
$isBuy = $offer->side === \App\Enums\P2P\OrderSide::SELL;
$btnLabel = ($isBuy ? __('Buy') : __('Sell')) . ' ' . $currency;
$btnIcon = $isBuy ? 'fa-shopping-cart' : 'fa-tag';
$actionModifier = $isBuy ? 'p2p-offer-action-btn--buy' : 'p2p-offer-action-btn--sell';
$decimals = (int) setting('site_decimal', 2);
$fiatCurrency = $offer->quote_currency_code;
$userName = $offer->user?->name ?? __('User');
$initials = strtoupper(substr((string) $offer->user?->first_name, 0, 1) . substr((string) $offer->user?->last_name, 0, 1));
$initials = $initials !== '' ? $initials : strtoupper(substr((string) $userName, 0, 1));
$isVerified = $offer->user ? $offer->user->isKycVerified() : false;
$availableText = $offer->max_amount !== null ? number_format((float) $offer->max_amount, $decimals) : __('∞');
$limitText = number_format((float) $offer->min_amount, $decimals) . ' - ' . ($offer->max_amount !== null ? number_format((float) $offer->max_amount, $decimals) : __('∞'));
$pmJson = $offer->paymentMethods->filter(fn ($pm) => !empty($pm?->name))->map(function ($pm) {
return [
'id' => (int) $pm->id,
'name' => (string) $pm->name,
'logo' => !empty($pm->logo) ? asset('storage/' . $pm->logo) : null,
'instructions' => (string) ($pm->instructions ?? ''),
];
})->values();
$advertiserUrl = route('user.p2p.advertisers.show', $offer->user_id);
$statusDescription = match ($offer->status) {
\App\Enums\P2P\OfferStatus::ACTIVE => __('Visible in the marketplace and ready for new trade requests.'),
\App\Enums\P2P\OfferStatus::PAUSED => __('Temporarily hidden until you resume it from your ad controls.'),
default => __('Unavailable for promotion or status changes until restored by the system.'),
};
$ownerCanEdit = $isOwner && $offer->status !== \App\Enums\P2P\OfferStatus::DISABLED && $openOrders === 0;
$ownerCanDelete = $isOwner && $openOrders === 0;
$paymentMethods = $offer->paymentMethods->filter(fn ($pm) => !empty($pm?->name))->values();
$promotionPackage = trim((string) ($promotion?->package?->name ?? ''));
@endphp
@if($isOwner)
@if($ownerCanEdit)
@lang('Manage Ad')
@endif
@if($offer->status !== \App\Enums\P2P\OfferStatus::DISABLED)
{{ $isSponsored ? __('Extend Promotion') : __('Promote Ad') }}
@endif
@lang('Back to My Ads')
@else
@lang('Back to Marketplace')
@endif
{{ $offer->side->label() }}
{{ $offer->status->label() }}
@if($isSponsored)
@lang('Promoted')
@endif
@if($hasFeaturedBadge)
@lang('Featured')
@endif
@if($openOrders > 0)
{{ number_format($openOrders) }} @lang('Open')
@endif
@lang('Price')
{{ number_format((float) $offer->price, $decimals) }} {{ $fiatCurrency }}
@lang('Per') {{ $currency }}
@lang('Trade Limit')
{{ $limitText }}
@lang('Available') {{ $availableText }} {{ $currency }}
@lang('Payment Window')
{{ (int) ($offer->payment_window_minutes ?? 0) }} @lang('minutes')
@lang('Buyer payment deadline')
@lang('Order Activity')
{{ number_format($totalOrders) }} @lang('total')
{{ number_format($completedOrders) }} @lang('completed') · {{ number_format($openOrders) }} @lang('open')
@lang('Completion')
{{ number_format($completionRate, 1) }}%
@lang('Based on closed orders')
@lang('Disputes')
{{ number_format($disputedOrders) }}
{{ number_format($positiveCnt) }} @lang('positive') · {{ number_format($negativeCnt) }} @lang('negative')
@if($isOwner && $openOrders > 0)
@lang('This ad currently has open trades. Editing, pausing, and deleting remain restricted until those orders are completed, cancelled, expired, or resolved.')
@endif
@lang('Currency')
{{ $currency }}
@lang('Updated')
{{ $offer->updated_at->format('Y-m-d H:i') }}
@lang('Minimum')
{{ number_format((float) $offer->min_amount, $decimals) }}
@lang('Maximum')
{{ $offer->max_amount !== null ? number_format((float) $offer->max_amount, $decimals) : __('∞') }}
@lang('Payment Methods')
@if($paymentMethods->isNotEmpty())
@foreach($paymentMethods as $pm)
@if(!empty($pm->logo))
@else
{{ strtoupper(substr((string) $pm->name, 0, 1)) }}
@endif
{{ $pm->name }}
@if(!empty($pm->instructions))
{{ $pm->instructions }}
@endif
@endforeach
@else
@lang('No payment methods linked to this ad.')
@endif
@lang('Terms & Instructions')
@if(filled($offer->terms_text))
{{ $offer->terms_text }}
@else
@lang('No additional trade instructions provided.')
@endif
{{ $promotionPackage !== '' ? $promotionPackage : ($isSponsored ? __('Promotion active') : __('Standard placement')) }}
@if($isSponsored && $promotion?->ends_at)
@lang('Runs until') {{ $promotion->ends_at->format('Y-m-d H:i') }}
@elseif($isOwner && $offer->status !== \App\Enums\P2P\OfferStatus::DISABLED)
@lang('Promote this ad to improve visibility and placement priority.')
@else
@lang('This ad is currently not using promoted placement.')
@endif
@lang('Open Orders')
{{ number_format($openOrders) }}
@lang('Completed Orders')
{{ number_format($completedOrders) }}
@lang('Disputed Orders')
{{ number_format($disputedOrders) }}
@lang('Feedback Signal')
{{ number_format($positiveCnt) }}/{{ number_format($negativeCnt) }}
@if($isOwner)
@lang('This detailed page now holds all operational data for your ad. Use the actions above to edit, promote, pause, resume, or remove it when no open trades exist.')
@elseif($offer->side === \App\Enums\P2P\OrderSide::SELL)
{{ $btnLabel }}
@else
{{ $btnLabel }}
@endif
@forelse($feedbacks as $fb)
{{ $fb->user->name ?? __('User') }}
{{ $fb->created_at->diffForHumans() }}
{{ $fb->rating }}/5
@empty
@lang('No reviews yet')
@endforelse