mivita/resources/views/admin/business_optimized/_user_detail_in.blade.php
2026-01-23 17:35:23 +01:00

351 lines
No EOL
18 KiB
PHP

<table class="table user-view-table m-0">
<tbody>
<tr>
<td>{{ __('team.account') }}:</td>
<td>
@if($TreeCalcBot->__get('business_user')->active_account)
<span class="badge badge-outline-success">{{ __('team.active') }}</span>
@else
<span class="badge badge-outline-danger">{{ __('team.not_active') }}</span>
@endif
@if($TreeCalcBot->__get('business_user')->payment_account_date)
{{ __('team.until') }}: {{ formatDate($TreeCalcBot->__get('business_user')->payment_account_date) }}
@endif
(ID: {{ $TreeCalcBot->__get('business_user')->m_account }}) <span class="badge badge-outline-default">v2</span>
</td>
</tr>
<tr>
<td>{{ __('team.date') }}:</td>
<td>
<strong>{{ HTMLHelper::getMonth($data['month']) }} {{ $data['year'] }}</strong> |
@if($TreeCalcBot->__get('business_user')->isSave())
{{ __('team.completed') }}:
<span class="badge badge-outline-success"><i class="fa fa-check-circle"></i></span>
{{-- @if(Auth::user()->isSySAdmin())
<a target="_blank" class="btn btn-outline-secondary btn-xs" href="{{ route('admin_business_optimized_user_detail', [$user->id, 'force_live' => true]) }}">
<i class="fa fa-redo"></i> {{ __('Live Berechnung') }}
</a>
@endif --}}
@else
{{ __('team.open') }}:
<span class="badge badge-outline-warning-dark"><i class="fa fa-history"></i></span>
@endif
</td>
</tr>
<tr>
<td>{{ __('team.career_level') }}:</td>
<td>
{{ \App\Services\TranslationHelper::transUserLevelName($TreeCalcBot->__get('business_user')->user_level_name) }} &nbsp;
<span class="badge badge-outline-success"> {{ __('team.KU') }} {{ $TreeCalcBot->__get('business_user')->qual_kp }} / {{ __('team.PP') }} {{ formatNumber($TreeCalcBot->__get('business_user')->qual_pp) }}</span>
</td>
</tr>
<tr>
<td>{{ __('team.sponsor') }}:</td>
<td>
@if($TreeCalcBot->__get('business_user')->sponsor && $TreeCalcBot->__get('business_user')->sponsor->is_sponsor)
{{ $TreeCalcBot->__get('business_user')->sponsor->first_name }} {{ $TreeCalcBot->__get('business_user')->sponsor->last_name }} |
{{ $TreeCalcBot->__get('business_user')->sponsor->email }} |
{{ $TreeCalcBot->__get('business_user')->sponsor->m_account }}
@else
-
@endif
</td>
</tr>
<tr>
<td>{{ __('team.consultant_margin') }}:</td>
<td>
{{ $TreeCalcBot->__get('business_user')->margin }} %
</td>
</tr>
<tr>
<td>{{ __('team.shop_commission') }}:</td>
<td>
{{ $TreeCalcBot->__get('business_user')->margin_shop }} %
</td>
</tr>
<tr>
<td>{{ __('team.net_turnover') }}:</td>
<td>
<strong>{{ formatNumber($TreeCalcBot->__get('business_user')->sales_volume_total_sum) }} &euro;</strong>
({{ __('team.own') }}: {{ formatNumber($TreeCalcBot->__get('business_user')->sales_volume_total) }} &euro; | {{ __('team.shop') }}: {{ formatNumber($TreeCalcBot->__get('business_user')->sales_volume_total_shop) }} &euro;)
</td>
</tr>
<tr>
<td>{{ __('team.customer_points') }}:</td>
<td>
<strong>{{ formatNumber($TreeCalcBot->__get('business_user')->sales_volume_points_KP_sum) }} {{ __('team.KU') }}</strong>
({{ __('team.own') }}: {{ formatNumber($TreeCalcBot->__get('business_user')->sales_volume_KP_points) }} | {{ __('team.shop') }}: {{ formatNumber($TreeCalcBot->__get('business_user')->sales_volume_points_shop) }})
&nbsp; <span class="badge {{ $TreeCalcBot->__get('business_user')->isQualKP() ? 'badge-outline-success' : 'badge-outline-warning-dark' }}"> {{ __('team.KU') }} {{ $TreeCalcBot->__get('business_user')->qual_kp }}</span>
@if($TreeCalcBot->__get('business_user')->getRestQualKP() > 0)
&nbsp; <span class="badge badge-outline-info" title="Überschüssige KU-Punkte werden als Bonus zu den TP hinzugefügt">
Rest-KU: {{ formatNumber($TreeCalcBot->__get('business_user')->getRestQualKP()) }}
</span>
@endif
</td>
</tr>
@if($TreeCalcBot->__get('business_user')->version == 1)
<tr>
<td>{{ __('team.qualification_points') }}:</td>
<td>
<strong>{{ formatNumber($TreeCalcBot->__get('business_user')->total_qual_pp) }} {{ __('team.TP') }}</strong> (+ {{ __('team.volume_KU') }}) &nbsp;
</td>
</tr>
<tr>
<td>{{ __('team.qualification_commission') }}:</td>
<td>
@if($TreeCalcBot->__get('business_user')->isQualLevel())
<span class="badge {{ $TreeCalcBot->__get('business_user')->isQualEqualLevel() ? 'badge-outline-success' : 'badge-outline-info' }}">
{{ __('team.KP') }} {{ formatNumber($TreeCalcBot->__get('business_user')->sales_volume_points_KP_sum) }} /
<strong>{{ formatNumber($TreeCalcBot->__get('business_user')->qual_user_level['qual_kp']) }}</strong> |
{{ __('team.TP') }} {{ formatNumber($TreeCalcBot->__get('business_user')->total_qual_pp) }} /
<strong>{{ formatNumber($TreeCalcBot->__get('business_user')->qual_user_level['qual_pp']) }}</strong>
| {{ $TreeCalcBot->__get('business_user')->qual_user_level['name'] }}</span>
@endif
</td>
</tr>
@endif
@if($TreeCalcBot->__get('business_user')->version == 2)
<tr>
<td>{{ __('team.payline_points') }}:</td>
<td>
<strong>{{ formatNumber($TreeCalcBot->__get('business_user')->payline_points) }} {{ __('team.PP') }}</strong>
</td>
</tr>
<tr>
<td>{{ __('team.qualification_points') }}:</td>
<td>
<strong>{{ formatNumber($TreeCalcBot->__get('business_user')->payline_points_qual_kp) }} {{ __('team.PP') }}</strong>
<small class="text-muted">
({{ formatNumber($TreeCalcBot->__get('business_user')->payline_points ?? 0) }} Payline
@if($TreeCalcBot->__get('business_user')->getRestQualKP() > 0)
+ {{ formatNumber($TreeCalcBot->__get('business_user')->getRestQualKP()) }} Rest-KU
@endif
)
</small>
</td>
</tr>
<tr>
<td>{{ __('team.current_commission_level') }}:</td>
<td>
@if($TreeCalcBot->__get('business_user')->isQualLevel())
<span class="badge {{ $TreeCalcBot->__get('business_user')->isQualEqualLevel() ? 'badge-outline-success' : 'badge-outline-info' }}">
{{ __('team.KU') }} {{ formatNumber($TreeCalcBot->__get('business_user')->calc_qual_kp) }} /
<strong>{{ formatNumber($TreeCalcBot->__get('business_user')->qual_user_level['qual_kp']) }}</strong> |
{{ __('team.PP') }} {{ formatNumber($TreeCalcBot->__get('business_user')->payline_points_qual_kp) }} /
<strong>{{ formatNumber($TreeCalcBot->__get('business_user')->qual_user_level['qual_pp']) }}</strong>
| {{ \App\Services\TranslationHelper::transUserLevelName($TreeCalcBot->__get('business_user')->qual_user_level['name']) }}</span>
@endif
</td>
</tr>
@if($TreeCalcBot->__get('business_user')->qual_user_level_next)
<tr>
<td>{{ __('team.next_commission_level') }}:</td>
<td>
<span class="badge badge-outline-warning-dark">
{{ __('team.KU') }} {{ formatNumber($TreeCalcBot->__get('business_user')->qual_user_level_next['_calculated_qual_kp']) }} /
<strong>{{ formatNumber($TreeCalcBot->__get('business_user')->qual_user_level_next['qual_kp']) }}</strong> |
{{ __('team.PP') }} {{ formatNumber($TreeCalcBot->__get('business_user')->qual_user_level_next['_calculated_payline_points_qual_kp']) }} /
<strong>{{ formatNumber($TreeCalcBot->__get('business_user')->qual_user_level_next['qual_pp']) }}</strong>
| {{ \App\Services\TranslationHelper::transUserLevelName($TreeCalcBot->__get('business_user')->qual_user_level_next['name']) }}</span>
</td>
</tr>
@endif
@endif
<tr>
<td>@if($TreeCalcBot->__get('business_user')->next_qual_user_level) {{ __('team.qualification') }}<br> @endif {{ __('team.next_career_level') }}:</td>
<td>
@if($TreeCalcBot->__get('business_user')->next_qual_user_level)
<span class="badge badge-outline-success">
{{ __('team.KU') }} {{ formatNumber($TreeCalcBot->__get('business_user')->next_qual_user_level['_calculated_qual_kp']) }} /
<strong>{{ formatNumber($TreeCalcBot->__get('business_user')->next_qual_user_level['qual_kp']) }}</strong> |
{{ __('team.TP') }} {{ formatNumber($TreeCalcBot->__get('business_user')->next_qual_user_level['_calculated_payline_points_qual_kp']) }} /
<strong>{{ formatNumber($TreeCalcBot->__get('business_user')->next_qual_user_level['qual_pp']) }}</strong>
| {{ \App\Services\TranslationHelper::transUserLevelName($TreeCalcBot->__get('business_user')->next_qual_user_level['name']) }}</span>
@elseif($TreeCalcBot->__get('business_user')->next_can_user_level)
<span class="badge badge-outline-warning-dark">
{{ __('team.KU') }} {{ formatNumber($TreeCalcBot->__get('business_user')->next_can_user_level['_calculated_qual_kp']) }} /
<strong>{{ formatNumber($TreeCalcBot->__get('business_user')->next_can_user_level['qual_kp']) }}</strong> |
{{ __('team.TP') }} {{ formatNumber($TreeCalcBot->__get('business_user')->next_can_user_level['_calculated_payline_points_qual_kp']) }} /
<strong>{{ formatNumber($TreeCalcBot->__get('business_user')->next_can_user_level['qual_pp']) }}</strong>
| {{ \App\Services\TranslationHelper::transUserLevelName($TreeCalcBot->__get('business_user')->next_can_user_level['name']) }}</span>
@else
<span class="badge badge-outline-warning"><i class="fa fa-times"></i></span>
@endif
</td>
</tr>
<tr>
<td><strong>{{ __('team.commission_shop') }}:</strong></td>
<td>
<span class="badge badge-primary" style="font-size: 1em;"><strong>{{ formatNumber($TreeCalcBot->__get('business_user')->commission_shop_sales) }} &euro;</strong></span>
&nbsp;
({{ __('team.sales_store_net') }}: {{ formatNumber($TreeCalcBot->__get('business_user')->sales_volume_total_shop) }} &euro; / {{ $TreeCalcBot->__get('business_user')->margin_shop }} %)
</td>
</tr>
@if($TreeCalcBot->__get('business_user')->version == 1)
<tr>
<td><strong>{{ __('team.commission_team') }}:</strong></td>
<td>
<span class="badge badge-primary" style="font-size: 1em;"><strong>{{ formatNumber($TreeCalcBot->__get('business_user')->commission_pp_total) }} &euro;</strong></span>
</td>
</tr>
@endif
@if($TreeCalcBot->__get('business_user')->version == 2)
<tr>
<td><strong>{{ __('team.commission_payline') }}:</strong></td>
<td>
<span class="badge badge-primary" style="font-size: 1em;"><strong>{{ formatNumber($TreeCalcBot->__get('business_user')->commission_pp_total) }} &euro;</strong></span>
</td>
</tr>
<tr>
<td><strong>{{ __('team.commission_WB') }}:</strong></td>
<td>
<span class="badge badge-primary" style="font-size: 1em;"><strong>{{ formatNumber($TreeCalcBot->__get('business_user')->commission_growth_total) }} &euro;</strong></span>
</td>
</tr>
@endif
<tr>
<td><strong>{{ __('team.commission_total') }}:</strong></td>
<td>
<span class="badge badge-secondary" style="font-size: 1em;"><strong>{{ formatNumber($TreeCalcBot->__get('business_user')->getCommissionTotal()) }} &euro;</strong></span>
</td>
</tr>
@if($TreeCalcBot->__get('business_user')->version == 2)
{{-- <tr>
<td>Team Points:</td>
<td>
<strong>{{ formatNumber($TreeCalcBot->__get('business_user')->total_pp) }} TP</strong>
</td>
</tr>
<tr>
<td>Qualifikation Team Points:</td>
<td>
<strong>{{ formatNumber($TreeCalcBot->__get('business_user')->payline_points_qual_kp) }} TP</strong> (+ Volumen KP)
</td>
</tr>
--}}
@endif
</tbody>
</table>
<hr class="border-light m-0 mb-2">
<div class="table-responsive">
<table class="table card-table m-0">
<tbody>
<tr>
<th>{{__('tables.line')}}</th>
<th>{{__('tables.points')}}</th>
<th>{{__('tables.commission')}} %</th>
<th>{{__('tables.commission')}} &euro;</th>
</tr>
@foreach (array_reverse($TreeCalcBot->__get('business_user')->business_lines->toArray(), true) as $line => $object)
<tr>
<td>
@if($line <= $TreeCalcBot->__get('business_user')->getQualLevelPaylines())
<div class="font-weight-bolder line-height-1 my-2 text-dark badge badge-outline-success">{{ $line }}. {{ __('team.PP') }}</div>
@elseif($TreeCalcBot->__get('business_user')->isQualLevelGrowth($line))
<div class="font-weight-bolder line-height-1 my-2 text-dark badge badge-outline-warning-dark">{{ $line }}. {{ __('team.WB') }}</div>
@else
<div class="font-weight-bolder line-height-1 my-2 text-dark badge badge-outline-dark">{{ $line }}.</div>
@endif
</td>
<td>{{ formatNumber($TreeCalcBot->getKeybyLine($line, 'points')) }}</td>
<td>{{ formatNumber($TreeCalcBot->getKeybyLine($line, 'margin'), 2) }} %</td>
<td>{{ formatNumber($TreeCalcBot->getKeybyLine($line, 'commission'), 2) }} &euro;</td>
</tr>
@endforeach
</tbody>
<tfoot>
<tr>
<td>{{__('tables.total')}}</td>
<td>{{ formatNumber($TreeCalcBot->__get('business_user')->total_pp) }}</td>
<td></td>
<td><strong>{{ formatNumber($TreeCalcBot->__get('business_user')->commission_pp_total, 2) }} &euro;</strong></td>
</tr>
</tfoot>
</table>
</div>
@if(!empty($matrix = $TreeCalcBot->__get('business_user')->getGrowthBonusMatrix()))
@php
// Maximale Tiefe für Spalten ermitteln (für Matrix-Header)
$maxLevel = 0;
foreach($matrix as $leg) {
if(!empty($leg['levels'])) {
$maxKey = max(array_keys($leg['levels']));
if($maxKey > $maxLevel) $maxLevel = $maxKey;
}
}
// Begrenze Anzeige auf sinnvolle Breite (z.B. 20 Ebenen)
$maxLevel = min($maxLevel, 20);
@endphp
<div class="table-responsive mt-4">
<h5 class="font-weight-bold mb-2">{{ __('team.commission_WB') ?? '(Tiefenbonus)' }}</h5>
<table class="table card-table m-0 table-bordered table-sm text-center">
<thead class="thead-light">
<tr>
<th style="width: 200px" class="text-left align-middle">Partner</th>
@for($i = 1; $i <= $maxLevel; $i++)
<th style="min-width: 80px">L{{ $i }}</th>
@endfor
<th class="text-right align-middle" style="width: 100px; border-left: 2px solid #dee2e6">Total</th>
</tr>
</thead>
<tbody>
@foreach($matrix as $leg)
<tr>
<td class="text-left align-middle">
<div class="font-weight-bold text-truncate" style="max-width: 180px;" title="{{ $leg['user']['name'] }}">
{{ $leg['user']['name'] }}
</div>
<div class="small text-muted">
ID: {{ $leg['user']['id'] }} | {{ $leg['user']['level'] }}
</div>
</td>
@for($i = 1; $i <= $maxLevel; $i++)
@php $levelData = $leg['levels'][$i] ?? null; @endphp
<td class="align-middle position-relative">
@if($levelData)
@if($levelData['commission'] > 0)
<div class="font-weight-bold text-success" style="font-size: 0.9em">
{{ formatNumber($levelData['commission'], 2) }}
</div>
@else
<div class="text-danger" style="font-size: 0.8em">0 </div>
@endif
<div class="small text-muted" style="font-size: 0.75em">
{{ formatNumber($levelData['volume']) }} / <span class="text-danger">{{ $levelData['details'][0]['pct'] ?? 0 }}%</span>
</div>
@if(!empty($levelData['has_blocker']))
<div class="position-absolute" style="top: 0; right: 0; font-size: 0.6em;" title="Blocker: {{ $levelData['blocker_name'] }}">
<i class="fa fa-shield-alt text-warning"></i>
</div>
@endif
@else
<span class="text-muted">-</span>
@endif
</td>
@endfor
<td class="text-right align-middle font-weight-bold" style="border-left: 2px solid #dee2e6">
{{ formatNumber($leg['total_commission'], 2) }}
</td>
</tr>
@endforeach
</tbody>
</table>
<div class="small text-muted mt-1">
{{ __('team.growth_bonus_details_description') }}
</div>
</div>
@endif