User Statistik
This commit is contained in:
parent
70240d2b6a
commit
53bdba33cd
24 changed files with 2633 additions and 9 deletions
237
resources/views/user/backoffice/statistics/index.blade.php
Normal file
237
resources/views/user/backoffice/statistics/index.blade.php
Normal file
|
|
@ -0,0 +1,237 @@
|
|||
@extends('layouts.layout-2')
|
||||
|
||||
@section('content')
|
||||
<h4 class="font-weight-bold py-2 mb-2 d-flex justify-content-between align-items-center w-100">
|
||||
<div>
|
||||
{{ __('navigation.statistics') }}
|
||||
<span class="badge badge-secondary ml-2">VIP</span>
|
||||
</div>
|
||||
</h4>
|
||||
|
||||
<div class="card mb-4">
|
||||
<div class="card-body">
|
||||
<div class="row align-items-center">
|
||||
<div class="col-md-8">
|
||||
<h5 class="mb-2">{{ __('navigation.statistics') }} / Backoffice MVP</h5>
|
||||
<p class="text-muted mb-md-0">
|
||||
Linienbasierte Übersicht für alle vorhandenen Team-Linien. Klickbare Zahlen führen direkt in die
|
||||
passenden Namen- und Detaillisten.
|
||||
</p>
|
||||
@if (! empty($performance))
|
||||
<div class="small text-muted mt-2">
|
||||
Datenquelle:
|
||||
<span class="badge badge-outline-default">{{ $performance['source_label'] }}</span>
|
||||
<span class="ml-2">Berechnet in {{ number_format($performance['duration_ms'], 2, ',', '.') }} ms</span>
|
||||
@if (! empty($performance['calculated_at']))
|
||||
<span class="ml-2">Snapshot vom {{ $performance['calculated_at'] }}</span>
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
<div class="col-md-4 mt-3 mt-md-0">
|
||||
<form method="GET" action="{{ route('user_backoffice_statistics') }}"
|
||||
class="form-inline justify-content-md-end">
|
||||
<a href="{{ route('user_backoffice_statistics_overview_export', ['month' => $selectedMonth, 'year' => $selectedYear]) }}"
|
||||
class="btn btn-sm btn-outline-secondary mr-2">
|
||||
<span class="ion ion-md-download mr-1"></span> CSV
|
||||
</a>
|
||||
<select name="month" class="form-control custom-select form-control-sm mr-2">
|
||||
@foreach ($filterMonths as $monthNumber => $monthName)
|
||||
<option value="{{ $monthNumber }}"
|
||||
{{ (int) $selectedMonth === (int) $monthNumber ? 'selected' : '' }}>
|
||||
{{ $monthName }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<select name="year" class="form-control custom-select form-control-sm mr-2">
|
||||
@foreach ($filterYears as $year)
|
||||
<option value="{{ $year }}"
|
||||
{{ (int) $selectedYear === (int) $year ? 'selected' : '' }}>
|
||||
{{ $year }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<button type="submit" class="btn btn-sm btn-primary">Anzeigen</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@php
|
||||
$clickableMetrics = [
|
||||
'consultants',
|
||||
'new_partners',
|
||||
'team_partner_abos',
|
||||
'team_customer_abos',
|
||||
'own_points',
|
||||
'external_points',
|
||||
'customer_abo_points',
|
||||
'customer_single_order_points',
|
||||
'customer_other_points',
|
||||
'total_points',
|
||||
'shop_1000',
|
||||
];
|
||||
|
||||
$formatValue = function ($value, string $metric): string {
|
||||
if (
|
||||
in_array(
|
||||
$metric,
|
||||
[
|
||||
'own_points',
|
||||
'external_points',
|
||||
'customer_abo_points',
|
||||
'customer_single_order_points',
|
||||
'customer_other_points',
|
||||
'total_points',
|
||||
],
|
||||
true,
|
||||
)
|
||||
) {
|
||||
return \App\Services\Util::formatNumber($value);
|
||||
}
|
||||
|
||||
return number_format((float) $value, 0, ',', '.');
|
||||
};
|
||||
|
||||
$newAboMetric = function (array $row, string $metric): ?string {
|
||||
return match ($metric) {
|
||||
'team_partner_abos' => 'team_partner_abos_new',
|
||||
'team_customer_abos' => 'team_customer_abos_new',
|
||||
default => null,
|
||||
};
|
||||
};
|
||||
@endphp
|
||||
|
||||
<div class="card mb-4">
|
||||
<div class="card-body p-0">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover mb-0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Linie</th>
|
||||
<th class="text-right">Berater</th>
|
||||
<th class="text-right">Neupartner</th>
|
||||
<th class="text-right">Teamabos</th>
|
||||
<th class="text-right">Teamkundenabos</th>
|
||||
<th class="text-right">Eigenpunkte</th>
|
||||
<th class="text-right">Externe Punkte</th>
|
||||
<th class="text-right">Kundenabo-Punkte</th>
|
||||
<th class="text-right">Einzelbestellungs-Punkte</th>
|
||||
<th class="text-right">Sonstige Kundenpunkte</th>
|
||||
<th class="text-right">Gesamtpunkte</th>
|
||||
<th class="text-right">1000 Punkte Shop</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($statistics['lines'] as $line)
|
||||
<tr>
|
||||
<td class="font-weight-semibold">{{ $line['label'] }}</td>
|
||||
@foreach ($clickableMetrics as $metric)
|
||||
<td class="text-right">
|
||||
@if ($line[$metric] > 0)
|
||||
<a href="{{ route('user_backoffice_statistics_details', [
|
||||
'line' => $line['line'],
|
||||
'metric' => $metric,
|
||||
'month' => $selectedMonth,
|
||||
'year' => $selectedYear,
|
||||
]) }}"
|
||||
class="badge badge-pill badge-outline-default backoffice-statistics-click-badge">
|
||||
{{ $formatValue($line[$metric], $metric) }}
|
||||
</a>
|
||||
@php $newMetric = $newAboMetric($line, $metric); @endphp
|
||||
@if ($newMetric && $line[$newMetric] > 0)
|
||||
<span
|
||||
class="badge badge-pill badge-success ml-1">+{{ number_format($line[$newMetric], 0, ',', '.') }}</span>
|
||||
@endif
|
||||
@else
|
||||
<span
|
||||
class="badge badge-pill badge-light backoffice-statistics-empty-badge">0</span>
|
||||
@endif
|
||||
</td>
|
||||
@endforeach
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr class="font-weight-bold bg-light">
|
||||
<td>{{ $statistics['totals']['label'] }}</td>
|
||||
@foreach ($clickableMetrics as $metric)
|
||||
<td class="text-right">
|
||||
@if ($statistics['totals'][$metric] > 0)
|
||||
<a href="{{ route('user_backoffice_statistics_details', [
|
||||
'line' => 0,
|
||||
'metric' => $metric,
|
||||
'month' => $selectedMonth,
|
||||
'year' => $selectedYear,
|
||||
]) }}"
|
||||
class="badge badge-pill badge-secondary backoffice-statistics-click-badge">
|
||||
{{ $formatValue($statistics['totals'][$metric], $metric) }}
|
||||
</a>
|
||||
@php $newMetric = $newAboMetric($statistics['totals'], $metric); @endphp
|
||||
@if ($newMetric && $statistics['totals'][$newMetric] > 0)
|
||||
<span
|
||||
class="badge badge-pill badge-success ml-1">+{{ number_format($statistics['totals'][$newMetric], 0, ',', '.') }}</span>
|
||||
@endif
|
||||
@else
|
||||
<span
|
||||
class="badge badge-pill badge-light backoffice-statistics-empty-badge">0</span>
|
||||
@endif
|
||||
</td>
|
||||
@endforeach
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6 mb-4">
|
||||
<div class="card h-100">
|
||||
<div class="card-body">
|
||||
<h5 class="mb-2">Begriffe</h5>
|
||||
<p class="text-muted mb-2">
|
||||
Teamabos sind Berater-/Eigenabos im Team. Teamkundenabos sind Kundenabos, die einem Berater
|
||||
aus der jeweiligen Linie zugeordnet sind.
|
||||
</p>
|
||||
<p class="text-muted mb-0">
|
||||
Externe Punkte kommen aktuell aus `month_shop_points`, Eigenpunkte aus `month_KP_points`.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6 mb-4">
|
||||
<div class="card h-100">
|
||||
<div class="card-body">
|
||||
<h5 class="mb-2">Nächster Ausbau</h5>
|
||||
<p class="text-muted mb-0">
|
||||
Die Detailansichten liefern bereits Namen und Basisdaten. Im nächsten Schritt werden Abo-Punkte
|
||||
und Umsatzarten noch feiner nach Abo, Einzelbestellung und Shop getrennt.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.backoffice-statistics-click-badge,
|
||||
.backoffice-statistics-empty-badge {
|
||||
display: inline-block;
|
||||
font-size: .85rem;
|
||||
line-height: 1.35;
|
||||
min-width: 2.35rem;
|
||||
padding: .35rem .55rem;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.backoffice-statistics-click-badge {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.backoffice-statistics-click-badge:hover,
|
||||
.backoffice-statistics-click-badge:focus {
|
||||
text-decoration: none;
|
||||
}
|
||||
</style>
|
||||
@endsection
|
||||
Loading…
Add table
Add a link
Reference in a new issue