@section('title', __('admin.dashboard.earn.title')) @extends('admin.layouts.admin') @section('scripts') @endsection @section('content')
@foreach ($widgets as $name => $items)
@if($loop->last)
@include('admin/shared/flatpickr', ['name' => 'start','type' => 'date', 'label' => __('admin.dashboard.earn.start_date'), 'value' => $start->format('Y-m-d')])
@include('admin/shared/flatpickr', ['name' => 'end', 'type' => 'date', 'label' => __('admin.dashboard.earn.end_date'), 'value' => $end->format('Y-m-d')])
@if (!empty($items))
@foreach ($items as $widget)

{{ $widget->title }}

{{ $widget->value }}

@endforeach
@endif
@else
@foreach ($items as $widget)

{{ $widget->title }}

{{ $widget->value }}

@endforeach
@endif
@endforeach
@include('admin.dashboard.cards.best-selling', ['dto' => $bestSelling['dto'], 'week' => $bestSelling['week'], 'month' => $bestSelling['month']])

{{ __('admin.dashboard.widgets.best_selling.title2') }}

@if ($bestSelling['products']->isEmpty())

{{ __("global.no_results") }}

@endif
    @for ($i = 0; $i < $bestSelling['split']; $i++)
  • {{ $bestSelling['products'][$i]->count }} x {{ $bestSelling['productsNames'][$bestSelling['products'][$i]->related_id] ?? 'Not found' }} {{ formatted_price($bestSelling['products'][$i]->price) }}
  • @endfor
    @for ($i = $bestSelling['split']; $i < count($bestSelling['products']); $i++)
  • {{ $bestSelling['products'][$i]->count }} x {{ $bestSelling['productsNames'][$bestSelling['products'][$i]->related_id] ?? 'Not found' }} {{ formatted_price($bestSelling['products'][$i]->price) }}
  • @endfor
{{ $bestSelling['products']->links('admin.shared.layouts.pagination') }}

{{ __('admin.dashboard.earn.services.title') }}

@include('admin/shared/select', ['name' => 'limit', 'options' => $limits, 'value' => $limit])
@if ($servicesStatistics->products->isEmpty()) @endif @foreach($servicesStatistics->products as $item) @endforeach
{{ __('global.name') }}
{{ __('global.services') }}
{{ __('admin.dashboard.earn.services.renewals_avg') }}

{{ __('global.no_results') }}

{{ $item->product->name }} {{ $item->count }} {{ number_format($item->renewals_avg, 2) }}
@if (method_exists($servicesStatistics->products, 'links'))
{{ $servicesStatistics->products->links('admin.shared.layouts.pagination') }}
@endif

{{ __('billing.admin.subscriptions.earn.subscription_and_services') }}

{{ __('admin.dashboard.earn.max_services_by_customer') }}

@if ($servicesStatistics->maxServicesByCustomer) @endif

{{ $servicesStatistics->maxServicesByCustomer ? $servicesStatistics->maxServicesByCustomer->count : 0 }}

{{ __('admin.dashboard.earn.max_periods') }}

@if ($servicesStatistics->maxPeriods) @endif

{{ $servicesStatistics->maxPeriods ? $servicesStatistics->maxPeriods->period : 0 }}

{{ __('billing.admin.subscriptions.earn.service_subscription_help', ['date' => $servicesFrom->format('d/m/y')]) }}

{{ __('admin.dashboard.earn.already_renewed') }}

{{ $servicesStatistics->already_renewed }} {{ $servicesStatistics->percentage('already_renewed', 'actives') }}%

{{ __('admin.dashboard.earn.service_can_renewal') }}

{{ $servicesStatistics->actives }}

{{ __('billing.admin.subscriptions.earn.monthly_earn') }}

{{ formatted_price($servicesStatistics->earn) }}

{{ __('billing.admin.subscriptions.earn.monthly') }}

{{ formatted_price($servicesStatistics->subscriptions) }}

{{ __('admin.dashboard.earn.average_periods') }}

{{ number_format($servicesStatistics->averagePeriods, 2) }}

{{ __('admin.dashboard.earn.average_service_price') }}

{{ formatted_price($servicesStatistics->averageServicesPrice) }}

{{ __('billing.admin.subscriptions.earn.monthly_help') }}

{{ __('admin.dashboard.earn.gateway_canvas') }}

{{ __('admin.dashboard.earn.gateway_canvas_help') }}

@if ($gatewaysSources->isEmpty())

{{ __("global.no_results") }}

@endif @foreach ($gatewaysSources->items as $gateway) @if ($gateway['paymethod'] == 'none') @continue @endif

{{ $gatewaysSources->names[$gateway['paymethod']] }}

{{ formatted_price($gatewaysSources->amounts[$gateway['paymethod']]) }} {{ $gatewaysSources->percentages[$gateway['paymethod']] }}% | {{ $gatewaysSources->counts[$gateway['paymethod']] }} {{ $gatewaysSources->counts[$gateway['paymethod']] == 1 ? __('global.invoice') : __('global.invoices') }}

@endforeach

{{ __('admin.dashboard.earn.related_billed.title') }}

@if ($relatedBilled->isEmpty())

{{ __("global.no_results") }}

@endif @foreach ($relatedBilled->items as $type)

{{ $relatedBilled->names[$type['type']] ?? $type['type'] }}

{{ formatted_price($relatedBilled->amounts[$type['type']]) }} {{ $relatedBilled->percentages[$type['type']] }}% | {{ trans_choice('admin.dashboard.earn.lines', $relatedBilled->counts[$type['type']], ['count' => $relatedBilled->counts[$type['type']]]) }}

@endforeach

{{ __('admin.dashboard.earn.graph_month') }}

@include('admin/shared/select', ['name' => 'year', 'options' => $years, 'value' => $year])
@foreach (['last_orders' => $lastorders, 'last_renewals' => $lastrenewals] as $key => $values)

{{ __('admin.dashboard.earn.' . $key) }}

@if (count($values) == 0) @endif @foreach($values as $item) @endforeach
{{ __('store.total') }}
{{ __($key == 'last_orders' ? 'client.invoices.itemname' : 'global.name') }}
{{ __('global.created') }}

{{ __('global.no_results') }}

{{ formatted_price($item->total, $item->currency) }} {{ collect($item->items)->where('type', $key == 'last_orders' ? 'service' : 'renewal')->pluck('name')->implode(', ') }} {{ $item->created_at->format('d/m/y H:i') }}
@endforeach

{{ __('admin.dashboard.earn.best_customers') }}

@include('admin/shared/select', ['name' => 'limit', 'options' => $limits, 'value' => $limit])
@if ($bestCustomers->isEmpty()) @endif @foreach($bestCustomers as $i => $item) @php ($offsetCustomers = method_exists($bestCustomers, 'perPage') ? $bestCustomers->perPage() * ($bestCustomers->currentPage() - 1) : 0) @endforeach
#
{{ __('store.total') }}
{{ __('global.customer') }}
{{ __('admin.dashboard.earn.customer_from') }}

{{ __('global.no_results') }}

@switch($offsetCustomers + $i) @case (0) @break @case (1) @break @case (2) @break @default {{ $offsetCustomers + $i + 1 }} @break @endswitch {{ formatted_price($item->total_subtotal) }} {{ $item->customer->fullName }} {{ $item->customer->created_at->format('d/m/y H:i') }}
@if (method_exists($bestCustomers, 'links'))
{{ $bestCustomers->links('admin.shared.layouts.pagination') }}
@endif
@endsection