@php $sales_prev_week = cache('sales_previous_week'); $sales_this_week = cache('sales_this_week'); $popular_tools_data = cache('popular_tools_data'); $popular_plans_data = cache('popular_plans_data'); $user_behavior_data = cache('user_behavior_data'); $currencySymbol = currency()->symbol; @endphp @extends('panel.layout.app', ['disable_tblr' => true]) @section('title', __('Overview')) @section('content')
@if ($gatewayError == true)

{{ __('Gateway is set to use sandbox. Please set mode to development!') }}

@endif

@lang('Marketplace is here.')

@lang('Extend the capabilities of MagicAI, explore new designs and unlock new horizons.')

{{ __('Explore Marketplace') }}
@php $sales_change = percentageChange($sales_prev_week, $sales_this_week); @endphp

{{ __('Total Sales') }}

@if (currencyShouldDisplayOnRight($currencySymbol)) {{ number_format(cache('total_sales')) }} {{ $currencySymbol }} @else {{ $currencySymbol }}{{ number_format(cache('total_sales')) }} @endif

@php $users_change = percentageChange(cache('users_previous_week'), cache('users_this_week')); @endphp

{{ __('Total Users') }}

{{ cache('total_users') }} {{-- --}}

@php $generated_change = percentageChange(cache('words_previous_week'), cache('words_this_week')); @endphp

{{ __('Words Generated') }}

{{ cache('words_this_week') }}

@php $generated_change = percentageChange(cache('images_previous_week'), cache('images_this_week')); @endphp

{{ __('Images Generated') }}

{{ cache('images_this_week') }}

@php if ($sales_prev_week != 0 && $sales_this_week != 0) { $sales_percent = number_format((1 - $sales_prev_week / $sales_this_week) * 100); } else { $sales_percent = 0; } @endphp

{{ __('Revenue') }}

{{ __('Total Sales') }}

@if (currencyShouldDisplayOnRight($currencySymbol)) {{ number_format(cache('total_sales')) }}{{ $currencySymbol }} @else {{ $currencySymbol }}{{ number_format(cache('total_sales')) }} @endif

{{ __('AI Usage') }}

{{ __('Popular Plans') }}

{{ __('New Users') }}

{{ __('Popular AI Tools') }}

{{ __('User Behaviour') }}

@php $values_sum = array_sum(array_column($user_behavior_data, 'value')); $values_sum = $values_sum == 0 ? 1 : $values_sum; @endphp
@foreach ($user_behavior_data as $data)
@endforeach
@foreach ($user_behavior_data as $data)
{{ $data['label'] }}
{{ number_format(($data['value'] / $values_sum) * 100, 2) }}%
{{ $data['value'] }}
@if (!$loop->last)
@lang('vs')
@endif @endforeach

{{ __('Top Countries') }}

{{ __('Country') }} {{ __('Users') }} {{ __('Popularity') }} @foreach (json_decode(cache('top_countries') ?? '[]') as $top_countries) {{ __($top_countries->country ?? 'Not Specified') }} {{ $top_countries->total }}
@endforeach

{{ __('Activity') }}

@if (count($activity) == 0)

{{ __('No activity logged yet.') }}

@else @foreach ($activity as $entry) @if ($entry->user) @endif
@if ($entry->user) {{ $entry->user->fullName() }} @endif {{ __($entry->activity_type) }} @if (isset($entry->activity_title)) "{{ __($entry->activity_title) }}" @endif
{{ $entry->created_at->diffForHumans() }}
@if (isset($entry->url)) {{ __('Go') }} @endif @endforeach
@endif

{{ __('Latest Transactions') }}

{{ __('Method') }} {{ __('Status') }} {{ __('Info') }} {{ __('Plan') }} / {{ __('Words') }} / {{ __('Images') }} @foreach ($latestOrders as $order) {{ __($order->payment_type) }} @php switch ($order->status) { case 'Success': $badge_type = 'success'; break; case 'Waiting': $badge_type = 'secondary'; break; case 'Approved': $badge_type = 'success'; break; case 'Rejected': $badge_type = 'danger'; break; default: $badge_type = 'default'; break; } @endphp {{ __($order->status) }} {{ $order->user->fullName() }}
{{ __($order->type) }} {{ @$order->plan->name ?? 'Archived Plan' }} / {{ @$order->plan->total_words === '-1' ? __('Unlimited') : @$order->plan->total_words ?? '-' }} / {{ @$order->plan->total_images === '-1' ? __('Unlimited') : @$order->plan->total_images ?? '-' }} @endforeach
@endsection @push('script') @endpush