@extends('frontend.layouts.user.index') @section('title', isset($offer) ? __('Manage Trade Ad') : __('Create Trade Ad')) @section('content') @php $isEditing = isset($offer); $offerPaymentMethodIds = $isEditing ? $offer->paymentMethods->pluck('id')->map(fn ($id) => (int) $id)->all() : []; $managePromotion = $isEditing ? $offer->promotion : null; $isManagePromoted = $managePromotion && $managePromotion->status === \App\Enums\P2P\PromotionStatus::ACTIVE && $managePromotion->ends_at && $managePromotion->ends_at->isFuture(); $manageDecimals = (int) setting('site_decimal', 2); $manageCurrency = $isEditing ? ($offer->wallet->currency->code ?? siteCurrency('code')) : siteCurrency('code'); $manageFiatCurrency = siteCurrency('code') ?: $manageCurrency; $managePriceText = $isEditing ? number_format((float) $offer->price, $manageDecimals) . ' ' . $manageFiatCurrency : null; $manageLimitText = $isEditing ? number_format((float) $offer->min_amount, $manageDecimals) . ' - ' . ($offer->max_amount !== null ? number_format((float) $offer->max_amount, $manageDecimals) : __('∞')) : null; $managePaymentMethodsCount = $isEditing ? $offer->paymentMethods->count() : 0; $manageCanEditTradeAd = ! $isEditing || ($canEditTradeAd ?? false); $manageCanManageLifecycle = $isEditing && ($canManageLifecycle ?? false); $manageCanDelete = $isEditing && (int) ($openOrders ?? 0) === 0; @endphp {{-- Trade Ad Builder: wallet, pricing, payment methods, terms, and optional promotion plan --}}
@if($isEditing)
@lang('Trade Ad Management')
@lang('Manage Trade Ad #'){{ $offer->id }}

@lang('Use this page to update ad details, review trade health, and handle lifecycle actions from one place.')

@lang('My Trade Ads') @lang('Public View') @if($offer->status !== \App\Enums\P2P\OfferStatus::DISABLED) {{ $isManagePromoted ? __('Extend Promotion') : __('Promote Ad') }}
@csrf
@endif
@csrf @method('DELETE')
@lang('Status') {{ $offer->status->label() }} {{ $isManagePromoted ? __('Promotion active') : __('Standard placement') }}
@lang('Rate') {{ $managePriceText }} @lang('Per') {{ $manageCurrency }}
@lang('Limits') {{ $manageLimitText }} {{ number_format($managePaymentMethodsCount) }} @lang('payment methods linked')
@lang('Order Health') {{ number_format((int) ($completedOrders ?? 0)) }}/{{ number_format((int) ($totalOrders ?? 0)) }} @lang('Completed vs total orders')
@lang('Open Activity') {{ number_format((int) ($openOrders ?? 0)) }} {{ number_format((float) ($completionRate ?? 0), 1) }}% @lang('completion rate')
@if(! $manageCanEditTradeAd)
@if($offer->status === \App\Enums\P2P\OfferStatus::DISABLED) @lang('This ad is currently disabled, so editing is locked until it becomes available again.') @else @lang('This ad has open trades. You can review and manage lifecycle actions here, but editing the offer form stays locked until those trades are resolved.') @endif
@else
@lang('All key actions now live on this page. Review health above, update the offer below, and manage promotion or lifecycle actions from the action bar.')
@endif
@endif
{{ $isEditing ? __('Back to My Trade Ads') : __('My Trade Ads') }}
@csrf @if($isEditing) @method('PUT') @endif
@lang('Ad Details')

{{ $isEditing ? __('Update editable details for this ad from your management workspace') : __('Set your wallet, trade side, price, and trading limits') }}

{{ siteCurrency('code') }}
{{ siteCurrency('code') }}
{{ siteCurrency('code') }}
@lang('minutes')
@lang('Min amount must be less than or equal to max amount.')
@include('frontend.user.p2p.trade_ads.partials._create_trade_ad_extra_sections')
@endsection {{-- Trade Ad Builder Script: form state, promotion preview, Summernote, and helper interactions --}} @push('scripts') @include('frontend.user.p2p.trade_ads.partials._create_trade_ad_scripts') @endpush