Statistik-Änderungen 2026-08-19 (dev/2026-07-22/entwicklungsplan-2026-08-19.md, alle 8 Pakete gemäß beantworteten F-Fragen): - N1 Monatsstatistik: Team-Cluster (Firstlines klickbar -> neue Seite user_team_firstlines, Teampartner gesamt/Payline [nur aktive], Abos Payline mit +N) + Level-Kachel (Quali-Stufe, fehlende Payline-/persönliche Punkte, Karriere-Level); LiveCommissionService-Snapshot v3 reicht Level-/Quali-Daten durch - N2 Abo-Kacheln auf Home monatsbezogen (aboStockCount-Rückrechnung über cancel/deleted/Status-Historie; VIP-Statistik bleibt tagesaktuell) - N3 VIP-Statistik 'Recruiter des Monats' (Neupartner-Definition wie KPI, rekursives Ketten-Volumen als Gesamtpunkte inkl. Starterpaket) + Drilldown/CSV-Spalte 'Punkte gesamt' - N4 Prognose-Block 'Level & Provision laut Prognose (Stand 25.)' mit unverbindlich-Kennzeichnung (ebenengenaue offene Abo-Punkte + TP-Laufstände) - N5 Checkout-Herkunft: Dropdown raus, Pflicht-Freitext (lokalisierte Fehlermeldung) - N6 Berater-Profilfoto (user_accounts.profile_image, Einwilligung als Sprachkey-Platzhalter, DSGVO-Löschung) + teaminterne Top-3-Karte (TopResultsService, Scope-Schalter) - N7 USt-Optionen: 'nicht umsatzsteuerpflichtig' zuerst + '§ 19 UStG'-Textfix - N8 Jahresgebühr-Nachfassliste je Berater (AnnualFeeDueService, überfällig/1-3 Monate, Sidenav) Kontroll-Review (8 Perspektiven) angewendet: next-Level-Fallback im Steady-State (resolveNextLevel — sonst 'Höchstes Level erreicht' für Normalfälle), _calculated-Punktebasis bei mehr Paylines, keine Wiederbelebung deaktivierter Abos in der Monatsrückrechnung, Payline-Abo-Kachel monatskonsistent, Top-3-Nachrücker; Performance: BackofficeDashboardService als Singleton mit lineBuckets-Memo (+flushLineBucketsMemo), level_forecast 6h-Cache; Reuse: User-Scopes firstlinesOf/newPartnerIn, SalesVolumePoints::totalPointsByUser, Slim::storeCroppedImage (3 Upload-Kopien vereinigt), activeAbo-Scope statt Inline-Prädikate, Form::open-Konvention, Return-Types Repair-Härtung (Kundenentscheide): VP-Nachtrepair dedupliziert über shopping_order_id (Live-Pfad schreibt sie jetzt mit), zählende Alt-Zeilen-Erkennung, Vormonats-Scan für Monatswechsel, Firmenaccount-Buchungen (config mivita.company_user_id) werden automatisch auf den Berater umgebucht (in place bzw. per Gegenbuchung bei geschlossenem Monat; Echtfall Anna Schall Order 58797 -> Christina Schuder), Berater-zu-Berater nur Warnung; Incentive-Repair: m_sponsor=NULL löscht nicht mehr, FK-Repair vor Stale-Bereinigung, gebatchte Lookups, zentrales Incentive::qualificationWindow(); .env aus dem Git-Tracking entfernt (Pflege per SFTP) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
332 lines
23 KiB
PHP
332 lines
23 KiB
PHP
@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') }} / {{ $details['metric_label'] }}
|
|
<span class="badge badge-secondary ml-2">VIP</span>
|
|
@if (! empty($details['only_new']))
|
|
<span class="badge badge-success ml-1">Nur neue im {{ $details['month'] }}/{{ $details['year'] }}</span>
|
|
@endif
|
|
</div>
|
|
<div>
|
|
<a href="{{ route('user_backoffice_statistics_export', [
|
|
'line' => $details['line'],
|
|
'metric' => $details['metric'],
|
|
'month' => $selectedMonth,
|
|
'year' => $selectedYear,
|
|
'only_new' => ($details['only_new'] ?? false) ? 1 : 0,
|
|
]) }}"
|
|
class="btn btn-sm btn-outline-secondary mr-2">
|
|
<span class="ion ion-md-download mr-1"></span> CSV
|
|
</a>
|
|
<a href="{{ route('user_backoffice_statistics', ['month' => $selectedMonth, 'year' => $selectedYear]) }}"
|
|
class="btn btn-sm btn-default">
|
|
{{ __('back') }}
|
|
</a>
|
|
</div>
|
|
</h4>
|
|
|
|
<div class="card mb-4">
|
|
<div class="card-body">
|
|
<div class="row">
|
|
<div class="col-md-3 mb-2">
|
|
<div class="text-muted small">Linie</div>
|
|
<strong>{{ $details['line_label'] }}</strong>
|
|
</div>
|
|
<div class="col-md-3 mb-2">
|
|
<div class="text-muted small">Zeitraum</div>
|
|
<strong>{{ $details['month'] }}/{{ $details['year'] }}</strong>
|
|
</div>
|
|
<div class="col-md-3 mb-2">
|
|
<div class="text-muted small">Kennzahl</div>
|
|
<strong>{{ $details['metric_label'] }}</strong>
|
|
</div>
|
|
<div class="col-md-3 mb-2">
|
|
<div class="text-muted small">Treffer</div>
|
|
<strong>{{ number_format($details['summary']['count'], 0, ',', '.') }}</strong>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card">
|
|
<div class="card-body p-0">
|
|
<div class="alert alert-warning rounded-0 border-left-0 border-right-0 border-top-0 mb-0">
|
|
<strong>Datenschutz-Hinweis:</strong>
|
|
Die Anzeige personenbezogener Detaildaten befindet sich noch in rechtlicher Klärung und ist aktuell nur für berechtigte VIP-Auswertungen vorgesehen.
|
|
</div>
|
|
@if ($details['rows'] === [])
|
|
<div class="p-4">
|
|
<p class="text-muted mb-0">{{ __('tables.no_data_available') }}</p>
|
|
</div>
|
|
@else
|
|
<div class="p-3 border-bottom">
|
|
<div class="input-group">
|
|
<div class="input-group-prepend">
|
|
<span class="input-group-text">
|
|
<span class="ion ion-ios-search"></span>
|
|
</span>
|
|
</div>
|
|
<input type="search" id="backoffice-statistics-detail-search" class="form-control"
|
|
placeholder="Detailtabelle durchsuchen...">
|
|
</div>
|
|
<small class="text-muted d-block mt-2">
|
|
Suche nach Name, E-Mail, Status, Punkten oder Datum. Die Summenzeile bleibt unverändert.
|
|
</small>
|
|
</div>
|
|
<div class="table-responsive">
|
|
<table class="table table-hover mb-0" id="backoffice-statistics-detail-table">
|
|
<thead>
|
|
<tr>
|
|
<th data-sortable="true"><span class="sortable-label">Name <i class="ion ion-ios-swap sort-icon"></i></span></th>
|
|
<th data-sortable="true"><span class="sortable-label">E-Mail <i class="ion ion-ios-swap sort-icon"></i></span></th>
|
|
<th data-sortable="true"><span class="sortable-label">Karriere-Level <i class="ion ion-ios-swap sort-icon"></i></span></th>
|
|
@if ($details['metric'] === 'team_customer_abos')
|
|
<th class="text-right" data-sortable="true" data-sort-type="number"><span class="sortable-label justify-content-end">Kundenabos <i class="ion ion-ios-swap sort-icon"></i></span></th>
|
|
<th class="text-right" data-sortable="true" data-sort-type="number"><span class="sortable-label justify-content-end">Volumenpunkte gesamt <i class="ion ion-ios-swap sort-icon"></i></span></th>
|
|
@elseif ($details['metric'] === 'team_partner_abos')
|
|
<th data-sortable="true"><span class="sortable-label">Berater <i class="ion ion-ios-swap sort-icon"></i></span></th>
|
|
<th class="text-right" data-sortable="true" data-sort-type="number"><span class="sortable-label justify-content-end">Abo-Punkte <i class="ion ion-ios-swap sort-icon"></i></span></th>
|
|
<th data-sortable="true"><span class="sortable-label">Status <i class="ion ion-ios-swap sort-icon"></i></span></th>
|
|
<th data-sortable="true" data-sort-type="date"><span class="sortable-label">Besteht seit <i class="ion ion-ios-swap sort-icon"></i></span></th>
|
|
<th data-sortable="true" data-sort-type="date"><span class="sortable-label">Nächste Ausführung <i class="ion ion-ios-swap sort-icon"></i></span></th>
|
|
<th class="text-right" data-sortable="true" data-sort-type="number"><span class="sortable-label justify-content-end">Lieferungen <i class="ion ion-ios-swap sort-icon"></i></span></th>
|
|
@elseif (in_array($details['metric'], ['own_points', 'external_points', 'customer_abo_points', 'customer_single_order_points', 'customer_other_points', 'total_points', 'shop_1000'], true))
|
|
<th class="text-right" data-sortable="true" data-sort-type="number" style="background-color:#d4edda;"><span class="sortable-label justify-content-end">Eigenpunkte <i class="ion ion-ios-swap sort-icon"></i></span></th>
|
|
<th class="text-right" data-sortable="true" data-sort-type="number"><span class="sortable-label justify-content-end">Shop-Punkte <i class="ion ion-ios-swap sort-icon"></i></span></th>
|
|
<th class="text-right" data-sortable="true" data-sort-type="number"><span class="sortable-label justify-content-end">Abo-Punkte <i class="ion ion-ios-swap sort-icon"></i></span></th>
|
|
<th class="text-right" data-sortable="true" data-sort-type="number"><span class="sortable-label justify-content-end">Sonstige Punkte <i class="ion ion-ios-swap sort-icon"></i></span></th>
|
|
<th class="text-right" data-sortable="true" data-sort-type="number" style="background-color:#d4edda;"><span class="sortable-label justify-content-end">Kundenpunkte <i class="ion ion-ios-swap sort-icon"></i></span></th>
|
|
<th class="text-right" data-sortable="true" data-sort-type="number"><span class="sortable-label justify-content-end">Gesamtpunkte <i class="ion ion-ios-swap sort-icon"></i></span></th>
|
|
@elseif ($details['metric'] === 'new_partners')
|
|
<th data-sortable="true"><span class="sortable-label">Sponsor <i class="ion ion-ios-swap sort-icon"></i></span></th>
|
|
<th class="text-right" data-sortable="true" data-sort-type="number"><span class="sortable-label justify-content-end">Kundenpunkte <i class="ion ion-ios-swap sort-icon"></i></span></th>
|
|
<th class="text-right" data-sortable="true" data-sort-type="number" title="Eigen- und Kundenpunkte des Monats zusammen — inkl. Starterpaket"><span class="sortable-label justify-content-end">Punkte gesamt <i class="ion ion-ios-swap sort-icon"></i></span></th>
|
|
<th data-sortable="true" data-sort-type="date"><span class="sortable-label">Aktiv seit <i class="ion ion-ios-swap sort-icon"></i></span></th>
|
|
<th data-sortable="true" data-sort-type="date"><span class="sortable-label">Account gültig bis <i class="ion ion-ios-swap sort-icon"></i></span></th>
|
|
@else
|
|
<th data-sortable="true" data-sort-type="date"><span class="sortable-label">Aktiv seit <i class="ion ion-ios-swap sort-icon"></i></span></th>
|
|
<th data-sortable="true" data-sort-type="date"><span class="sortable-label">Account gültig bis <i class="ion ion-ios-swap sort-icon"></i></span></th>
|
|
@endif
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach ($details['rows'] as $row)
|
|
<tr
|
|
class="{{ isset($row['is_account_active']) && ! $row['is_account_active'] ? 'table-danger' : '' }} {{ ! empty($row['is_new_this_month']) ? 'table-success' : '' }}">
|
|
<td class="font-weight-semibold">{{ $row['name'] }}</td>
|
|
<td>{{ $row['email'] ?? '-' }}</td>
|
|
<td>{{ $row['career_level'] ?? '-' }}</td>
|
|
@if ($details['metric'] === 'team_customer_abos')
|
|
<td class="text-right">{{ number_format($row['abo_count'], 0, ',', '.') }}</td>
|
|
<td class="text-right">
|
|
<span class="font-weight-bold">{{ \App\Services\Util::formatNumber($row['points']) }}</span>
|
|
@if (! empty($row['abos']))
|
|
<a class="d-block small" data-toggle="collapse"
|
|
href="#customer-abos-{{ $loop->index }}" role="button">
|
|
Abos anzeigen
|
|
</a>
|
|
<div class="collapse text-left" id="customer-abos-{{ $loop->index }}">
|
|
<ul class="list-unstyled small text-muted mt-2 mb-0">
|
|
@foreach ($row['abos'] as $aboItem)
|
|
<li>
|
|
{{ $aboItem['start_date'] ?? '-' }} →
|
|
{{ $aboItem['next_date'] ?? '-' }}:
|
|
<span class="font-weight-semibold">{{ \App\Services\Util::formatNumber($aboItem['points']) }}</span> P.
|
|
@if (! empty($aboItem['is_new_this_month']))
|
|
<span class="badge badge-success ml-1">Neu</span>
|
|
@endif
|
|
</li>
|
|
@endforeach
|
|
</ul>
|
|
</div>
|
|
@endif
|
|
</td>
|
|
@elseif ($details['metric'] === 'team_partner_abos')
|
|
<td>{{ $row['consultant_name'] ?? $row['name'] }}</td>
|
|
<td class="text-right">{{ \App\Services\Util::formatNumber($row['points']) }}</td>
|
|
<td>
|
|
{!! $row['status_badge'] ?? '' !!}
|
|
@if (! empty($row['status_reason']))
|
|
<div class="small text-muted mt-1">{{ $row['status_reason'] }}</div>
|
|
@endif
|
|
</td>
|
|
<td>
|
|
{{ $row['start_date'] ?? '-' }}
|
|
@if (! empty($row['is_new_this_month']))
|
|
<span class="badge badge-success ml-1">Neu</span>
|
|
@endif
|
|
</td>
|
|
<td>{{ $row['next_date'] ?? '-' }}</td>
|
|
<td class="text-right">{{ number_format($row['deliveries'], 0, ',', '.') }}</td>
|
|
@elseif (in_array($details['metric'], ['own_points', 'external_points', 'customer_abo_points', 'customer_single_order_points', 'customer_other_points', 'total_points', 'shop_1000'], true))
|
|
<td class="text-right"><span class="badge" style="background-color:#d4edda;color:#155724;font-size:90%;">{{ \App\Services\Util::formatNumber($row['own_points']) }}</span></td>
|
|
<td class="text-right">{{ \App\Services\Util::formatNumber($row['customer_single_order_points']) }}</td>
|
|
<td class="text-right">{{ \App\Services\Util::formatNumber($row['customer_abo_points']) }}</td>
|
|
<td class="text-right">{{ \App\Services\Util::formatNumber($row['customer_other_points']) }}</td>
|
|
<td class="text-right font-weight-bold"><span class="badge" style="background-color:#d4edda;color:#155724;font-size:90%;">{{ \App\Services\Util::formatNumber($row['external_points']) }}</span></td>
|
|
<td class="text-right font-weight-bold">{{ \App\Services\Util::formatNumber($row['total_points']) }}</td>
|
|
@elseif ($details['metric'] === 'new_partners')
|
|
<td>{{ $row['sponsor'] ?? '-' }}</td>
|
|
<td class="text-right font-weight-bold">{{ \App\Services\Util::formatNumber($row['customer_points'] ?? 0) }}</td>
|
|
<td class="text-right font-weight-bold">{{ \App\Services\Util::formatNumber($row['total_points'] ?? 0) }}</td>
|
|
<td>{{ $row['active_date'] ?? '-' }}</td>
|
|
<td>{{ $row['payment_account'] ?? '-' }}</td>
|
|
@else
|
|
<td>{{ $row['active_date'] ?? '-' }}</td>
|
|
<td>
|
|
{{ $row['payment_account'] ?? '-' }}
|
|
@if (isset($row['is_account_active']))
|
|
<span
|
|
class="badge badge-{{ $row['is_account_active'] ? 'success' : 'danger' }} ml-1">
|
|
{{ $row['account_status'] }}
|
|
</span>
|
|
@endif
|
|
</td>
|
|
@endif
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
<tfoot>
|
|
<tr class="font-weight-bold bg-light">
|
|
<td>Summe</td>
|
|
<td class="text-muted">{{ number_format($details['summary']['count'], 0, ',', '.') }} Einträge</td>
|
|
<td></td>
|
|
@if ($details['metric'] === 'team_customer_abos')
|
|
<td class="text-right">{{ number_format($details['summary']['abo_count'], 0, ',', '.') }}</td>
|
|
<td class="text-right">{{ \App\Services\Util::formatNumber($details['summary']['points']) }}</td>
|
|
@elseif ($details['metric'] === 'team_partner_abos')
|
|
<td></td>
|
|
<td class="text-right">{{ \App\Services\Util::formatNumber($details['summary']['points']) }}</td>
|
|
<td></td>
|
|
<td></td>
|
|
<td></td>
|
|
<td class="text-right">{{ number_format($details['summary']['deliveries'], 0, ',', '.') }}</td>
|
|
@elseif (in_array($details['metric'], ['own_points', 'external_points', 'customer_abo_points', 'customer_single_order_points', 'customer_other_points', 'total_points', 'shop_1000'], true))
|
|
<td class="text-right" style="background-color:#d4edda;">{{ \App\Services\Util::formatNumber($details['summary']['own_points']) }}</td>
|
|
<td class="text-right">{{ \App\Services\Util::formatNumber($details['summary']['customer_single_order_points']) }}</td>
|
|
<td class="text-right">{{ \App\Services\Util::formatNumber($details['summary']['customer_abo_points']) }}</td>
|
|
<td class="text-right">{{ \App\Services\Util::formatNumber($details['summary']['customer_other_points']) }}</td>
|
|
<td class="text-right" style="background-color:#d4edda;">{{ \App\Services\Util::formatNumber($details['summary']['external_points']) }}</td>
|
|
<td class="text-right">{{ \App\Services\Util::formatNumber($details['summary']['total_points']) }}</td>
|
|
@elseif ($details['metric'] === 'new_partners')
|
|
<td></td>
|
|
<td class="text-right">{{ \App\Services\Util::formatNumber($details['summary']['customer_points'] ?? 0) }}</td>
|
|
<td class="text-right">{{ \App\Services\Util::formatNumber($details['summary']['total_points'] ?? 0) }}</td>
|
|
<td></td>
|
|
<td></td>
|
|
@else
|
|
<td></td>
|
|
<td></td>
|
|
@endif
|
|
</tr>
|
|
</tfoot>
|
|
</table>
|
|
</div>
|
|
@endif
|
|
</div>
|
|
</div>
|
|
|
|
@if ($details['rows'] !== [])
|
|
<style>
|
|
#backoffice-statistics-detail-table {
|
|
min-width: 980px;
|
|
}
|
|
|
|
#backoffice-statistics-detail-table th,
|
|
#backoffice-statistics-detail-table td {
|
|
vertical-align: middle;
|
|
}
|
|
|
|
#backoffice-statistics-detail-table th[data-sortable="true"] {
|
|
white-space: nowrap;
|
|
}
|
|
|
|
#backoffice-statistics-detail-table .sortable-label {
|
|
align-items: center;
|
|
display: inline-flex;
|
|
gap: .25rem;
|
|
white-space: nowrap;
|
|
width: 100%;
|
|
}
|
|
|
|
#backoffice-statistics-detail-table .sort-icon {
|
|
color: #adb5bd;
|
|
flex: 0 0 auto;
|
|
font-size: .875rem;
|
|
line-height: 1;
|
|
}
|
|
|
|
#backoffice-statistics-detail-table th[data-sort-direction="asc"] .sort-icon,
|
|
#backoffice-statistics-detail-table th[data-sort-direction="desc"] .sort-icon {
|
|
color: #4e73df;
|
|
}
|
|
</style>
|
|
|
|
<script>
|
|
$(document).ready(function() {
|
|
$('#backoffice-statistics-detail-search').on('keyup search', function() {
|
|
var search = $(this).val().toLowerCase();
|
|
|
|
$('#backoffice-statistics-detail-table tbody tr').each(function() {
|
|
var rowText = $(this).text().toLowerCase();
|
|
$(this).toggle(rowText.indexOf(search) !== -1);
|
|
});
|
|
});
|
|
|
|
$('#backoffice-statistics-detail-table th[data-sortable="true"]').css('cursor', 'pointer').on('click',
|
|
function() {
|
|
var $header = $(this);
|
|
var columnIndex = $header.index();
|
|
var sortType = $header.data('sort-type') || 'text';
|
|
var direction = $header.data('sort-direction') === 'asc' ? 'desc' : 'asc';
|
|
var rows = $('#backoffice-statistics-detail-table tbody tr').get();
|
|
|
|
rows.sort(function(a, b) {
|
|
var aValue = getSortValue($(a).children('td').eq(columnIndex).text(), sortType);
|
|
var bValue = getSortValue($(b).children('td').eq(columnIndex).text(), sortType);
|
|
|
|
if (aValue < bValue) {
|
|
return direction === 'asc' ? -1 : 1;
|
|
}
|
|
|
|
if (aValue > bValue) {
|
|
return direction === 'asc' ? 1 : -1;
|
|
}
|
|
|
|
return 0;
|
|
});
|
|
|
|
$('#backoffice-statistics-detail-table th[data-sortable="true"]')
|
|
.removeData('sort-direction')
|
|
.removeAttr('data-sort-direction');
|
|
$header.data('sort-direction', direction).attr('data-sort-direction', direction);
|
|
$.each(rows, function(index, row) {
|
|
$('#backoffice-statistics-detail-table tbody').append(row);
|
|
});
|
|
});
|
|
|
|
function getSortValue(value, sortType) {
|
|
value = $.trim(value);
|
|
|
|
if (sortType === 'number') {
|
|
return parseFloat(value.replace(/\./g, '').replace(',', '.').replace(/[^\d.-]/g, '')) || 0;
|
|
}
|
|
|
|
if (sortType === 'date') {
|
|
var parts = value.match(/(\d{2})\.(\d{2})\.(\d{4})/);
|
|
|
|
if (!parts) {
|
|
return 0;
|
|
}
|
|
|
|
return new Date(parts[3], parts[2] - 1, parts[1]).getTime();
|
|
}
|
|
|
|
return value.toLowerCase();
|
|
}
|
|
});
|
|
</script>
|
|
@endif
|
|
@endsection
|