Abo-Uebersichten: Team-Ansicht konsolidiert, Monatsfilter, Wachstum & Dashboard-KPIs

- /user/abos/ot: Filter nach Eingangsmonat (start_date) ueber neuen UserAbo-Scope
- Konsolidierte Team-Abo-Ansicht nach Ebenen/Linien (Bestand, neue Abos im Monat,
  Eigen-/Kundenabos, Punkte je Ebene + Summen) via TeamAboOverviewService
- team/customers leitet auf konsolidierte Ansicht um; Navigation bereinigt
- Mitglieder-Detail-Modal mit Abo-Zusammenfassung (Eigen-Abo, Kundenabos,
  Punkte, Beginn, naechste Ausfuehrung, Ausfuehrungen)
- Wachstums-Tabelle (Jahr x Monate) + Liniendiagramm (neue Eigen-/Kundenabos)
- Dashboard-KPI-Kachel (Gesamtabos, Kundenabos, 1000-Punkte-Shops)
- i18n de/en/es/fr, Tests (Filter, Overview, Wachstum, Modal, Redirect)

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Kevin 2026-06-23 14:07:29 +00:00
parent 65b867f8ee
commit 4135726772
15 changed files with 967 additions and 174 deletions

View file

@ -1,133 +1,273 @@
@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 ">
<h4 class="font-weight-bold py-2 mb-2 d-flex justify-content-between align-items-center w-100">
<div>
{{ __('abo.team_subscriptions') }} / {{ __('navigation.overview') }}
</div>
</h4>
@if(isset($chartData))
@include('user.abo._abo_chart')
@endif
<div class="row">
<div class="col-12">
@if(!$abos || $abos->isEmpty())
<div class="card mb-4">
<div class="card-body pb-2">
<div class="row">
<div class="col-sm-12">
<h5>{{ __('abo.team_subscriptions') }}</h5>
<p class="text-muted">{{ __('tables.no_data_available') }}</p>
</div>
</div>
{{-- Gesamtübersicht (aktueller Bestand) --}}
@php($totals = $overview['totals'])
<div class="row mb-2">
<div class="col-md-4 col-12 mb-3">
<div class="card h-100">
<div class="card-body text-center">
<div class="text-muted small">{{ __('abo.team_total_abos') }}</div>
<div class="display-5 font-weight-bold text-primary">{{ $totals['total_abos'] }}</div>
</div>
</div>
@endif
@foreach($abos as $user_abo)
<div class="card mb-4">
<div class="card-body pb-2">
<div class="row">
<div class="col-sm-6">
<h5 class="mb-1">
<a href="{{ route('user_abos_team_detail', [$user_abo->id]) }}">
{{ __('navigation.abo') }} <span class="text-muted">{{ '#'.$user_abo->payone_userid }}</span>
</a>
</h5>
</div>
<div class="col-sm-6 text-right">
<a href="{{ route('user_abos_team_detail', [$user_abo->id]) }}" class="btn btn-sm btn-secondary float-right">
<span class="fa fa-edit"></span>{{ __('abo.abo_details') }}
</a>
</div>
</div>
</div>
<hr class="m-0">
<div class="card-body pb-1">
<div class="row">
<div class="col-md-3 mb-2">
<div class="text-muted small">{{ __('tables.start_date') }}</div>
<div class="font-weight-bold">{{ $user_abo->start_date }}</div>
</div>
<div class="col-md-3 mb-2">
<div class="text-muted small">{{ __('tables.next_date') }} </div>
<div class="font-weight-bold">{{ $user_abo->next_date }}</div>
</div>
<div class="col-md-3 mb-2">
<div class="text-muted small">{{ __('tables.abo_delivery_day') }}</div>
<div class="font-weight-bold">{{ \App\Services\HTMLHelper::getAboStrLang($user_abo->abo_interval) }}</div>
</div>
<div class="col-md-3 mb-2">
<div class="text-muted small">{{ __('tables.last_date') }}</div>
<div class="font-weight-bold">{{ $user_abo->last_date }}</div>
</div>
</div>
</div>
<hr class="m-0">
<div class="card-body pb-1">
<div class="row">
<div class="col-md-3 mb-3">
<div class="text-muted small">{{ __('tables.status') }} / {{ __('tables.active') }}</div>
{!! $user_abo->getStatusFormated() !!} &nbsp;{!! get_active_badge($user_abo->active) !!}
</div>
<div class="col-md-3 mb-3">
<div class="text-muted small">{{ __('tables.abo_delivery') }}</div>
{{ $user_abo->getCountOrders() }}
</div>
<div class="col-md-3 mb-3">
<div class="text-muted small">{{ __('navigation.points') }}</div>
<strong class="text-primary">{{ $user_abo->getFormattedTotalPoints() }} Pkt.</strong>
</div>
<div class="col-md-3 mb-3">
<div class="text-muted small">{{ __('tables.payment') }}</div>
{{ $user_abo->getPaymentType() }}
</div>
</div>
</div>
<hr class="m-0">
<div class="card-body pb-1">
<div class="row">
<div class="col-md-3 mb-3">
<div class="text-muted small">{{ __('First name') }}</div>
@if($user_abo->user && $user_abo->user->account)
{{ $user_abo->user->account->first_name }}
@endif
</div>
<div class="col-md-3 mb-3">
<div class="text-muted small">{{ __('Last name') }}</div>
@if($user_abo->user && $user_abo->user->account)
{{ $user_abo->user->account->last_name }}
@endif
</div>
<div class="col-md-3 mb-3">
<div class="text-muted small">{{ __('E-Mail') }}</div>
@if($user_abo->user)
{{ $user_abo->user->email }}
@endif
</div>
<div class="col-md-3 mb-3">
<div class="text-muted small">{{ __('tables.adviser') }}</div>
@if($user_abo->user && $user_abo->user->account)
<a href="#" class="text-black" data-toggle="modal"
data-target="#modals-load-content"
data-id="{{ $user_abo->user->id }}"
data-action="business-user-show"
data-back=""
data-modal="modal-md"
data-init_from="member"
data-route=" {{ route('modal_load') }}">
<span class="mr-1 ion ion-ios-contact"></span> {{ $user_abo->user->account->first_name }} {{ $user_abo->user->account->last_name }} </a>
@endif
</div>
</div>
</div>
<div class="col-md-4 col-6 mb-3">
<div class="card h-100">
<div class="card-body text-center">
<div class="text-muted small">{{ __('abo.team_own_abos') }}</div>
<div class="display-5 font-weight-bold">{{ $totals['own_abos'] }}</div>
<div class="small text-success">+{{ $totals['own_abos_new'] }} {{ __('abo.new_this_month') }}</div>
</div>
</div>
</div>
<div class="col-md-4 col-6 mb-3">
<div class="card h-100">
<div class="card-body text-center">
<div class="text-muted small">{{ __('abo.team_customer_abos') }}</div>
<div class="display-5 font-weight-bold">{{ $totals['customer_abos'] }}</div>
<div class="small text-success">+{{ $totals['customer_abos_new'] }} {{ __('abo.new_this_month') }}</div>
</div>
</div>
@endforeach
</div>
</div>
@endsection
{{-- Linien-/Ebenen-Tabelle --}}
<div class="card mb-4">
<div class="card-header d-flex justify-content-between align-items-center">
<span class="font-weight-bold">{{ __('abo.team_by_level') }}</span>
</div>
<div class="table-responsive">
<table class="table table-hover mb-0">
<thead>
<tr class="text-muted small">
<th>{{ __('abo.level') }}</th>
<th class="text-center">{{ __('abo.consultants') }}</th>
<th class="text-center">{{ __('abo.team_own_abos') }}</th>
<th class="text-center">{{ __('abo.team_customer_abos') }}</th>
<th class="text-center">{{ __('abo.new_this_month') }} ({{ $currentMonthName }})</th>
<th class="text-center">{{ __('abo.team_total') }}</th>
<th class="text-right">{{ __('abo.abo_count_points') }}</th>
</tr>
</thead>
<tbody>
@forelse($overview['lines'] as $line)
@php($collapseId = 'team-line-'.$line['line'])
<tr class="{{ $line['line'] === 1 ? 'table-active' : '' }}" style="cursor: pointer;"
data-toggle="collapse" data-target="#{{ $collapseId }}">
<td class="font-weight-bold">
<span class="ion ion-md-arrow-dropright"></span>
{{ $line['label'] }}
</td>
<td class="text-center">{{ $line['consultants'] }}</td>
<td class="text-center">
{{ $line['own_abos'] }}
@if($line['own_abos_new'] > 0)<span class="badge badge-success">+{{ $line['own_abos_new'] }}</span>@endif
</td>
<td class="text-center">
{{ $line['customer_abos'] }}
@if($line['customer_abos_new'] > 0)<span class="badge badge-success">+{{ $line['customer_abos_new'] }}</span>@endif
</td>
<td class="text-center text-success font-weight-bold">+{{ $line['own_abos_new'] + $line['customer_abos_new'] }}</td>
<td class="text-center font-weight-bold text-primary">{{ $line['total_abos'] }}</td>
<td class="text-right font-weight-bold">{{ \App\Services\Util::formatNumber($line['own_abo_points'] + $line['customer_abo_points']) }}</td>
</tr>
<tr class="p-0">
<td colspan="7" class="p-0 border-0">
<div class="collapse {{ $line['line'] === 1 ? 'show' : '' }}" id="{{ $collapseId }}">
<div class="p-3 bg-lightest">
<table class="table table-sm table-borderless mb-0">
<thead>
<tr class="text-muted small">
<th>{{ __('tables.adviser') }}</th>
<th>{{ __('abo.career_level') }}</th>
<th class="text-center">{{ __('abo.own_abo') }}</th>
<th class="text-center">{{ __('abo.customer_abos_count') }}</th>
<th class="text-right">{{ __('navigation.points') }}</th>
</tr>
</thead>
<tbody>
@foreach($line['members'] as $member)
<tr>
<td>
<a href="#" class="text-black" data-toggle="modal"
data-target="#modals-load-content"
data-id="{{ $member['user_id'] }}"
data-action="team-abo-member-show"
data-back=""
data-modal="modal-md"
data-init_from="member"
data-route="{{ route('modal_load') }}">
<span class="mr-1 ion ion-ios-contact"></span>{{ $member['name'] }}
</a>
</td>
<td class="small text-muted">{{ $member['career_level'] }}</td>
<td class="text-center">
@if($member['has_own_abo'])
<span class="badge badge-success">{{ __('abo.yes') }}</span>
@else
<span class="badge badge-outline-secondary">{{ __('abo.no') }}</span>
@endif
</td>
<td class="text-center">{{ $member['customer_abo_count'] }}</td>
<td class="text-right">
<span class="text-primary font-weight-bold">{{ \App\Services\Util::formatNumber($member['own_abo_points'] + $member['customer_abo_points']) }}</span> Pkt.
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</td>
</tr>
@empty
<tr>
<td colspan="7" class="text-muted text-center py-4">{{ __('tables.no_data_available') }}</td>
</tr>
@endforelse
</tbody>
@if(!empty($overview['lines']))
<tfoot>
<tr class="font-weight-bold">
<td>{{ $totals['label'] }}</td>
<td class="text-center">{{ $totals['consultants'] }}</td>
<td class="text-center">{{ $totals['own_abos'] }}</td>
<td class="text-center">{{ $totals['customer_abos'] }}</td>
<td class="text-center text-success">+{{ $totals['own_abos_new'] + $totals['customer_abos_new'] }}</td>
<td class="text-center text-primary">{{ $totals['total_abos'] }}</td>
<td class="text-right">{{ \App\Services\Util::formatNumber($totals['own_abo_points'] + $totals['customer_abo_points']) }}</td>
</tr>
</tfoot>
@endif
</table>
</div>
</div>
{{-- Wachstum: neue Abos je Monat im gewählten Jahr --}}
<div class="card mb-4">
<div class="card-header d-flex justify-content-between align-items-center">
<span class="font-weight-bold">{{ __('abo.team_growth') }}</span>
<form method="GET" action="{{ url()->current() }}" class="form-inline">
<select name="year" class="form-control form-control-sm" onchange="this.form.submit()">
@foreach($filterYears as $y)
<option value="{{ $y }}" {{ (int) $growthYear === (int) $y ? 'selected' : '' }}>{{ $y }}</option>
@endforeach
</select>
<noscript><button type="submit" class="btn btn-sm btn-secondary ml-2">{{ __('abo.filter') }}</button></noscript>
</form>
</div>
<div class="table-responsive">
<table class="table table-hover mb-0">
<thead>
<tr class="text-muted small">
<th>{{ __('abo.month') }}</th>
<th class="text-center">{{ __('abo.new_own_abos') }}</th>
<th class="text-center">{{ __('abo.new_customer_abos') }}</th>
<th class="text-center">{{ __('abo.new_total') }}</th>
</tr>
</thead>
<tbody>
@foreach($growth['months'] as $row)
<tr class="{{ $row['total_new'] === 0 ? 'text-muted' : '' }}">
<td>{{ $row['label'] }}</td>
<td class="text-center">{{ $row['own_new'] }}</td>
<td class="text-center">{{ $row['customer_new'] }}</td>
<td class="text-center font-weight-bold {{ $row['total_new'] > 0 ? 'text-success' : '' }}">{{ $row['total_new'] }}</td>
</tr>
@endforeach
</tbody>
<tfoot>
<tr class="font-weight-bold">
<td>{{ __('abo.team_total') }} {{ $growth['year'] }}</td>
<td class="text-center">{{ $growth['totals']['own_new'] }}</td>
<td class="text-center">{{ $growth['totals']['customer_new'] }}</td>
<td class="text-center text-primary">{{ $growth['totals']['total_new'] }}</td>
</tr>
</tfoot>
</table>
</div>
<div class="card-footer py-2">
<small class="text-muted">{{ __('abo.growth_note') }}</small>
</div>
</div>
{{-- Wachstums-Diagramm: zwei Kurven (neue Eigen-/Kunden-Abos je Monat) --}}
<div class="card mb-4">
<div class="card-body pb-2">
<h6 class="font-weight-bold mb-2">
{{ __('abo.team_growth') }}
<span class="text-muted font-weight-normal ml-1">{{ $growth['year'] }}</span>
</h6>
</div>
<hr class="m-0">
<div class="card-body pt-3 pb-2">
<canvas id="aboGrowthChart" height="90"></canvas>
</div>
</div>
<script src="/vendor/libs/chartjs/chartjs.js"></script>
<script>
(function () {
var ctx = document.getElementById('aboGrowthChart').getContext('2d');
new Chart(ctx, {
type: 'line',
data: {
labels: {!! json_encode($growthChart['labels']) !!},
datasets: [
{
label: @json(__('abo.new_own_abos')),
data: {!! json_encode($growthChart['own']) !!},
backgroundColor: 'rgba(102, 110, 232, 0.1)',
borderColor: 'rgba(102, 110, 232, 0.9)',
borderWidth: 2,
pointBackgroundColor: 'rgba(102, 110, 232, 0.9)',
pointRadius: 3,
lineTension: 0.3,
fill: false
},
{
label: @json(__('abo.new_customer_abos')),
data: {!! json_encode($growthChart['customer']) !!},
backgroundColor: 'rgba(40, 167, 69, 0.1)',
borderColor: 'rgba(40, 167, 69, 0.9)',
borderWidth: 2,
pointBackgroundColor: 'rgba(40, 167, 69, 0.9)',
pointRadius: 3,
lineTension: 0.3,
fill: false
}
]
},
options: {
responsive: true,
legend: { display: true, position: 'top' },
tooltips: { mode: 'index', intersect: false },
layout: { padding: { top: 10 } },
scales: {
yAxes: [{
ticks: {
beginAtZero: true,
stepSize: {{ $growthChart['step'] }},
suggestedMax: {{ $growthChart['suggested_max'] }},
callback: function (value) {
return Number.isInteger(value) ? value : null;
}
},
gridLines: { color: 'rgba(0,0,0,0.05)' }
}],
xAxes: [{
gridLines: { display: false }
}]
}
}
});
}());
</script>
@endsection