Backoffice-Statistik: Punkte-Fix (kumulative Snapshots) & Meine Statistik
Punkte/Umsatz korrekt aus per-Zeile points/total_net je status berechnen statt SUM der kumulativen month_*-Snapshots (zaehlte massiv mehrfach). Zentralisiert in SalesVolumePoints, genutzt von Dashboard- & Drilldown-Service. Detail-Tabelle neu gegliedert: Eigenpunkte | Shop | Abo | Sonstige | Kundenpunkte (=Summe) | Gesamt, mit gruener Hervorhebung der Basis-/Summenspalten. Neue VIP-Seite "Meine Statistik" (Untermenue neben Team-Statistik): KPI-Karten + nachvollziehbare Detailtabellen, gruppiert nach eigenen Bestellungen, Shop-Bestellungen und Abos (PersonalStatisticsService). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
9565814221
commit
7a620d66ae
14 changed files with 666 additions and 70 deletions
|
|
@ -5,6 +5,7 @@ namespace App\Http\Controllers\User;
|
|||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Backoffice\BackofficeDashboardService;
|
||||
use App\Services\Backoffice\BackofficeDrilldownService;
|
||||
use App\Services\Backoffice\PersonalStatisticsService;
|
||||
use App\Services\HTMLHelper;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\View\View;
|
||||
|
|
@ -18,7 +19,8 @@ class BackofficeStatisticsController extends Controller
|
|||
|
||||
public function __construct(
|
||||
private BackofficeDashboardService $dashboardService,
|
||||
private BackofficeDrilldownService $drilldownService
|
||||
private BackofficeDrilldownService $drilldownService,
|
||||
private PersonalStatisticsService $personalService
|
||||
) {
|
||||
$this->middleware('active.account');
|
||||
}
|
||||
|
|
@ -48,6 +50,23 @@ class BackofficeStatisticsController extends Controller
|
|||
]);
|
||||
}
|
||||
|
||||
public function my(Request $request): View
|
||||
{
|
||||
if (! $request->user()?->isVIP()) {
|
||||
abort(404);
|
||||
}
|
||||
|
||||
[$selectedMonth, $selectedYear] = $this->selectedPeriod($request);
|
||||
|
||||
return view('user.backoffice.statistics.my', [
|
||||
'selectedMonth' => $selectedMonth,
|
||||
'selectedYear' => $selectedYear,
|
||||
'filterMonths' => HTMLHelper::getTransMonths(),
|
||||
'filterYears' => HTMLHelper::getYearRange(2022),
|
||||
'statistics' => $this->personalService->monthly($request->user(), $selectedMonth, $selectedYear),
|
||||
]);
|
||||
}
|
||||
|
||||
public function details(Request $request): View
|
||||
{
|
||||
if (! $request->user()?->isVIP()) {
|
||||
|
|
@ -210,7 +229,7 @@ class BackofficeStatisticsController extends Controller
|
|||
}
|
||||
|
||||
if (in_array($metric, ['own_points', 'external_points', 'customer_abo_points', 'customer_single_order_points', 'customer_other_points', 'total_points', 'shop_1000'], true)) {
|
||||
return ['Name', 'E-Mail', 'Karriere-Level', 'Eigenpunkte', 'Externe Punkte', 'Kundenabo-Punkte', 'Einzelbestellungs-Punkte', 'Sonstige Kundenpunkte', 'Gesamtpunkte'];
|
||||
return ['Name', 'E-Mail', 'Karriere-Level', 'Eigenpunkte', 'Shop-Punkte', 'Abo-Punkte', 'Sonstige Punkte', 'Kundenpunkte', 'Gesamtpunkte'];
|
||||
}
|
||||
|
||||
return ['Name', 'E-Mail', 'Karriere-Level', 'Aktiv seit', 'Account gueltig bis', 'Account Status'];
|
||||
|
|
@ -253,10 +272,10 @@ class BackofficeStatisticsController extends Controller
|
|||
$row['email'] ?? '',
|
||||
$row['career_level'] ?? '',
|
||||
$row['own_points'] ?? 0,
|
||||
$row['external_points'] ?? 0,
|
||||
$row['customer_abo_points'] ?? 0,
|
||||
$row['customer_single_order_points'] ?? 0,
|
||||
$row['customer_abo_points'] ?? 0,
|
||||
$row['customer_other_points'] ?? 0,
|
||||
$row['external_points'] ?? 0,
|
||||
$row['total_points'] ?? 0,
|
||||
];
|
||||
}
|
||||
|
|
@ -289,7 +308,7 @@ class BackofficeStatisticsController extends Controller
|
|||
}
|
||||
|
||||
if (in_array($metric, ['own_points', 'external_points', 'customer_abo_points', 'customer_single_order_points', 'customer_other_points', 'total_points', 'shop_1000'], true)) {
|
||||
return ['Summe', $summary['count'].' Eintraege', '', $summary['own_points'], $summary['external_points'], $summary['customer_abo_points'], $summary['customer_single_order_points'], $summary['customer_other_points'], $summary['total_points']];
|
||||
return ['Summe', $summary['count'].' Eintraege', '', $summary['own_points'], $summary['customer_single_order_points'], $summary['customer_abo_points'], $summary['customer_other_points'], $summary['external_points'], $summary['total_points']];
|
||||
}
|
||||
|
||||
return ['Summe', $summary['count'].' Eintraege', '', '', '', ''];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue