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

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

@endif
@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

{{ __('New users') }}

{{ cache('users_this_week') }}

@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

{{ __('Generated Content') }}

{{ __('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