@php
$isEditing = isset($offer);
$currentOfferSide = strtoupper((string) old('side', $isEditing ? $offer->side->value : 'BUY'));
$isSellOfferSide = $currentOfferSide === 'SELL';
$selectedPaymentMethodIds = collect(old('payment_method_ids', $isEditing ? ($offerPaymentMethodIds ?? []) : []))
->map(fn ($id) => (int) $id)
->filter(fn ($id) => $id > 0)
->all();
$p2pCountries = \App\Support\P2PPaymentMethodManager::countryOptions(collect($methods ?? []));
$savedPaymentMethodIds = collect($paymentAccounts ?? collect())
->pluck('payment_method_id')
->map(fn ($id) => (int) $id)
->unique()
->values()
->all();
$orderedMethods = collect($methods ?? collect())
->sortBy(function ($method) use ($savedPaymentMethodIds, $userCountryCode) {
$methodId = (int) ($method->id ?? 0);
$countryCode = strtoupper((string) ($method->country ?? ''));
$isLocal = !empty($userCountryCode) && $countryCode === strtoupper((string) $userCountryCode);
$isGlobal = $countryCode === '';
$sortOrder = (int) ($method->sort_order ?? 0);
$methodName = mb_strtolower(trim((string) ($method->name ?? '')));
return [
$isLocal ? 0 : ($isGlobal ? 1 : 2),
in_array($methodId, $savedPaymentMethodIds, true) ? 0 : 1,
$sortOrder,
$methodName,
$methodId,
];
})
->values();
@endphp
{{ $isSellOfferSide ? __('Accepted Payment Methods') : __('Preferred / Available Payment Methods') }}
{{ $isSellOfferSide
? __('Choose which of your saved payment accounts buyers can pay to.')
: __('Select the payment methods you can use to send payment from your saved accounts.') }}
@lang('Manage Accounts')
@if(collect($paymentAccounts ?? collect())->isEmpty())
@lang('No saved payment accounts found')
@lang('Add your own payment accounts first. Trade ads can only use payment methods that you have already saved in your profile.')
@endif
@foreach($orderedMethods as $m)
@php
$methodEnabled = in_array((int) $m->id, $savedPaymentMethodIds, true);
$countryCode = strtoupper((string) ($m->country ?? ''));
$countryLabel = $countryCode !== '' ? (getCountryDisplayLabel($countryCode, false) ?? $countryCode) : __('Global');
$isLocalScope = !empty($userCountryCode) && $countryCode === strtoupper((string) $userCountryCode);
$methodScopeLabel = $isLocalScope ? __('Local') : __('Global');
$methodScopeClass = $isLocalScope ? 'is-local' : 'is-global';
$addAccountUrl = route('user.p2p.payment-accounts.index', [
'create' => 1,
'payment_method_id' => (int) $m->id,
]);
@endphp
@endforeach
@lang('No payment methods match your filters')
@lang('Try a different country filter or search keyword.')
{{ $isSellOfferSide
? __('Choose which of your saved payment accounts buyers can pay to.')
: __('Select the payment methods you can use to send payment. Sellers will see these before starting a trade.') }}
@lang('Terms & Instructions')
@lang('Add payment rules, timing notes, and trade instructions.')
@if(!$isEditing)
@lang('Ad Promotion (Optional)')
@lang('Boost your trade ad right after publishing with a promotion plan')
@php
$decimals = (int) setting('site_decimal', 2);
$canPromote = isset($packages) && $packages->isNotEmpty();
$promoteChecked = (string) old('promote_now', '0') === '1';
@endphp
@lang('Promote this trade ad now')
@if(!$canPromote)
@lang('No promotion plans are available right now.')
@endif
@endif