mivita/resources/views/admin/level-reports/index.blade.php
2025-10-20 17:42:08 +02:00

171 lines
No EOL
8.7 KiB
PHP

@extends('layouts.layout-2')
@section('content')
<div class="card">
<h5 class="card-header">
Level-Aufstieg Reports
<span class="badge badge-info ml-2">{{ $promotions->count() }}</span>
</h5>
<div class="card-body p-0">
<!-- Filter Form -->
<form method="GET" action="{{ route('admin.level-reports.index') }}" class="form-horizontal" id="form_filter_level_reports">
<div class="form-row align-items-center px-4 pb-2 pt-3">
<div class="col-6 col-sm-6 col-md-2 col-lg-2 mb-1">
<select class="custom-select" name="month">
<option value="">Alle Monate</option>
@foreach($availableMonths as $key => $value)
<option value="{{ $key }}" @if($filters['month'] == $key) selected @endif>{{ $value }}</option>
@endforeach
</select>
</div>
<div class="col-6 col-sm-6 col-md-2 col-lg-2 mb-1">
<select class="custom-select" name="year">
<option value="">Alle Jahre</option>
@foreach($availableYears as $year)
<option value="{{ $year }}" @if($filters['year'] == $year) selected @endif>{{ $year }}</option>
@endforeach
</select>
</div>
{{-- <div class="col-6 col-sm-6 col-md-2 col-lg-2 mb-1">
<input type="number" class="form-control" name="user_id" placeholder="User ID" value="{{ $filters['user_id'] }}">
</div> --}}
<div class="col-6 col-sm-6 col-md-3 col-lg-3 mb-1">
<div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="not_updated" name="not_updated" value="1" @if($filters['only_not_updated']) checked @endif>
<label class="custom-control-label" for="not_updated">Nur nicht umgestellte User</label>
</div>
</div>
<div class="col-6 col-sm-6 col-md-3 col-lg-3 mb-1">
<button type="submit" class="btn btn-primary mr-2">Filter</button>
<a href="{{ route('admin.level-reports.export', request()->query()) }}" class="btn btn-success">CSV Export</a>
</div>
</div>
</form>
@if($promotions->count() > 0)
<!-- Statistiken -->
<div class="px-4 pb-3">
<div class="row">
<div class="col-md-3">
<div class="card bg-primary text-white">
<div class="card-body">
<h4 class="card-title">{{ $statistics['total_count'] }}</h4>
<p class="card-text">Gesamt Aufstiege</p>
</div>
</div>
</div>
<div class="col-md-9">
<div class="card">
<div class="card-body">
<h6 class="card-subtitle mb-2 text-muted">Aufstiege nach Level</h6>
@foreach($statistics['level_stats'] as $level => $count)
<span class="badge badge-secondary mr-1">{{ $level }}: {{ $count }}</span>
@endforeach
</div>
</div>
</div>
</div>
</div>
<!-- Tabelle -->
<div class="table-responsive">
<table class="table table-striped table-hover mb-0">
<thead class="thead-light">
<tr>
<th>Datum</th>
<th>User</th>
<th>Von Level</th>
<th>Zu Level</th>
<th>Aktueller Level</th>
<th>KP Quali</th>
<th>User KP</th>
<th>PP Quali</th>
<th>User PP</th>
<th>Update</th>
<th>Aktiv</th>
</tr>
</thead>
<tbody>
@foreach($promotions as $promotion)
<tr class="@if($promotion['level_updated'] === 'Nein') table-warning @endif">
<td>{{ $promotion['date'] }}</td>
<td>
<strong>{{ $promotion['first_name'] }} {{ $promotion['last_name'] }}</strong><br>
<small class="text-muted">
ID: {{ $promotion['user_id'] }}<br>
{{ $promotion['email'] }}
</small>
</td>
<td>
<span class="badge badge-secondary">
{{ $promotion['from_level_name'] }}
</span>
<br><small>ID: {{ $promotion['from_level_id'] }}</small>
</td>
<td>
<span class="badge badge-success">
{{ $promotion['to_level_name'] }}
</span>
<br><small>ID: {{ $promotion['to_level_id'] }}</small>
</td>
<td>
<span class="badge badge-info">
{{ $promotion['current_user_level_name'] }}
</span>
<br><small>ID: {{ $promotion['current_user_level_id'] ?? 'N/A' }}</small>
</td>
<td><span class="badge badge-outline-info">{{ number_format($promotion['to_level_qual_kp'], 0, ',', '.') }}</span></td>
<td><span class="badge badge-outline-success">{{ number_format($promotion['sales_volume_points_sum'], 0, ',', '.') }}</span></td>
<td><span class="badge badge-outline-info">{{ number_format($promotion['to_level_qual_pp'], 0, ',', '.') }}</span></td>
<td><span class="badge badge-outline-success">{{ number_format($promotion['payline_points_qual_kp'], 0, ',', '.') }}</span></td>
<td>
@if($promotion['level_updated'] === 'Ja')
<span class="badge badge-success">Ja</span>
@else
<span class="badge badge-warning">Nein</span>
@endif
</td>
<td>
@if($promotion['active_account'] === 'Ja')
<span class="badge badge-success">Ja</span>
@else
<span class="badge badge-danger">Nein</span>
@endif
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
@if($statistics['period_stats'])
<!-- Periode Statistiken -->
<div class="px-4 py-3 border-top">
<h6 class="text-muted mb-2">Aufstiege nach Zeitraum</h6>
@foreach($statistics['period_stats'] as $period => $count)
<span class="badge badge-outline-default mr-1">{{ $period }}: {{ $count }}</span>
@endforeach
</div>
@endif
@else
<div class="px-4 py-5 text-center">
<h5 class="text-muted">Keine Level-Aufstiege gefunden</h5>
<p class="text-muted">Mit den aktuellen Filtern wurden keine Einträge gefunden.</p>
</div>
@endif
</div>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
// Auto-submit Form bei Änderung der Filter
const selects = document.querySelectorAll('#form_filter_level_reports select, #form_filter_level_reports input[type="checkbox"]');
selects.forEach(function(select) {
select.addEventListener('change', function() {
document.getElementById('form_filter_level_reports').submit();
});
});
});
</script>
@endsection