@extends('backend.p2p.layout') @section('title', __('Promotion Plans')) @section('p2p_title') {{ __('Promotion Plans') }} @endsection @section('p2p_icon', 'apps') @section('p2p_action') @can('p2p-manage') @lang('Add Plan') @endcan @endsection @php $decimals = (int) setting('site_decimal', 2); $packagesTotal = method_exists($packages, 'count') ? (int) $packages->count() : count($packages); $activePlans = collect($packages)->where('status', true)->count(); $featuredId = optional(collect($packages)->firstWhere(fn ($p) => strtoupper((string) ($p->visibility ?? '')) === 'FEATURED' && $p->status))->id; @endphp @section('p2p_content')
{{ __('Plan Catalog') }}
{{ __('Promotion plans') }}
{{ __('Plans') }} {{ number_format($packagesTotal) }} {{ __('Active') }} {{ number_format($activePlans) }}
@can('p2p-manage') @endcan @can('p2p-manage') @endcan @forelse($packages as $package) @php $billingType = strtoupper(trim((string) ($package->billing_type ?? 'FIXED'))); $billingText = match ($billingType) { 'DAILY_PRICE' => __('Daily'), 'PER_TRADE_FEE' => __('Per Trade'), default => __('Fixed'), }; $durationMinutes = (int) $package->duration_minutes; $durationText = $durationMinutes >= 60 ? (rtrim(rtrim(number_format($durationMinutes / 60, 2, '.', ''), '0'), '.') . ' ' . __('hours')) : ($durationMinutes . ' ' . __('min')); $visibility = strtoupper((string) ($package->visibility ?? 'PUBLIC')); $isFeatured = $package->id === $featuredId; @endphp @can('p2p-manage') @endcan @can('p2p-manage') @endcan @empty @endforelse
 @lang('Plan') @lang('Billing') @lang('Price') @lang('Duration') @lang('Visibility') @lang('Status')@lang('Action')
{{ $package->name }} @if($isFeatured) @lang('Featured') @endif
#{{ $package->id }}
{{ $billingText }} {{ number_format((float) $package->effectiveBasePrice(), $decimals) }} {{ $durationText }} {{ $visibility }} {{ $package->status ? __('Active') : __('Inactive') }}
@endsection @can('p2p-manage') @push('scripts') @include('backend.p2p.promotion_plans.partials._plans_list_scripts') @endpush @endcan