{{-- @extends('layouts.UserDashboard') @section('user')

Platform Policy

@if ($user_salary)
Your Progress

Current Level: {{ $user_salary->salaryTarget->level_name ?? 'N/A' }}

Current Target: {{ $user_salary->salaryTarget->target ?? 'N/A' }} Coins

@endif
@foreach ($salary_dats as $salart)
{{$salart->level_name}}
@if ($user_current_target_id == $salart->id) Current Level @endif
Time Target Host Salary Status
{{$salart->validity}} Days {{$salart->target}} Coins ${{$salart->host_dollar}} @php // Check if user has met this target $target_met = false; // Check based on different conditions: // 1. If this is user's current level and coins earned >= target if ($user_current_target_id == $salart->id && $user_coins_earned >= $salart->target) { $target_met = true; } // 2. If this level is lower than current level (assuming completed) elseif ($user_salary && $salart->id < $user_current_target_id) { $target_met = true; } // 3. If user has already completed this target (check in user_salary_history table if exists) @endphp @if ($target_met) Target Met @elseif($user_current_target_id == $salart->id)
@php $percentage = $salart->target > 0 ? min(100, ($user_coins_earned / $salart->target) * 100) : 0; @endphp
{{ number_format($percentage, 1) }}%
{{ $user_coins_earned }}/{{ $salart->target }} Coins @elseif($salart->id > $user_current_target_id) Locked @else Not Started @endif
@endforeach {{$salary_dats->links()}}
@endsection --}} @extends('layouts.UserDashboard') @section('user')

Platform Policy

@if ($subordinates->count() > 0)
@endif
Target User: {{ $target_user->name }}

User ID: {{ $target_user->user_id ?? 'N/A' }}

{{ number_format($total_coins_collected) }} Coins Collected
@foreach ($salary_dats as $salart) @php // A level is "Passed" if it's strictly below our current achieved level $isPassed = $user_salary && $salart->target <= $user_salary->salaryTarget->target; // The "Active" level is the one immediately higher than our current level // If no levels achieved yet, the first level is active. $isActive = false; if (!$user_salary && $loop->first) { $isActive = true; } elseif ($user_salary) { $isActive = $salart->id == $next_target_id; } // Commission Calculation $percentValue = 0; if (Auth::user()->hasRole('superadmin')) { $percentValue = $salart->super_admin_percent; } elseif (Auth::user()->hasRole('subadmin')) { $percentValue = $salart->sub_admin_percent; } elseif (Auth::user()->hasRole('bd')) { $percentValue = $salart->bd_percent; } elseif (Auth::user()->hasRole('agency')) { $percentValue = $salart->agency_percent; } $commission = ($salart->host_dollar * $percentValue) / 100; @endphp @endforeach
Level Validity Target (Coins) Host Dollar Commission Current Status
{{ $salart->level_name }} {{ $salart->validity }} Days {{ number_format($salart->target) }} ${{ number_format($salart->host_dollar, 2) }} ${{ number_format($commission, 2) }} ({{ $percentValue }}%) @if ($isPassed) Level Complete @elseif ($isActive) @php $percent = $salart->target > 0 ? min(100, ($active_coins / $salart->target) * 100) : 0; @endphp
{{ number_format($active_coins) }} / {{ number_format($salart->target) }} @else Pending @endif
{{ $salary_dats->links() }}
@endsection