m_level_id) { return '-'; } $qualKP = (float) $userBusiness->qual_kp; $pointsSum = (float) $userBusiness->sales_volume_points_KP_sum; $isQual = $pointsSum >= $qualKP; $badgeClass = $isQual ? 'badge-outline-success' : 'badge-outline-info'; return ' KU ' . $qualKP . "/" . $pointsSum . ''; } /** * Generiert QualKP Badge für User */ public static function generateQualKPBadgeForUser(User $user, int $month, int $year): string { if (!$user->user_level) { return '-'; } $qualKP = (float) $user->user_level->qual_kp; $pointsSum = (float) $user->getUserSalesVolumeBy($month, $year, 'sales_volume_points_KP_sum'); $isQual = $pointsSum >= $qualKP; $badgeClass = $isQual ? 'badge-outline-success' : 'badge-outline-warning-dark'; return ' KU ' . $qualKP . ''; } /** * Generiert Sales Volume Display für UserBusiness */ public static function generateSalesVolumeDisplay(UserBusiness $userBusiness, string $type): string { if ($type === 'points') { $total = (float) $userBusiness->sales_volume_points_KP_sum; $individual = (float) $userBusiness->sales_volume_KP_points; $shop = (float) $userBusiness->sales_volume_points_shop; } else { $total = (float) $userBusiness->sales_volume_total_sum; $individual = (float) $userBusiness->sales_volume_total; $shop = (float) $userBusiness->sales_volume_total_shop; $suffix = ' €'; } $totalFormatted = formatNumber($total); $individualFormatted = formatNumber($individual); $shopFormatted = formatNumber($shop); $suffix = $type === 'points' ? '' : ' €'; return '
' . $totalFormatted . $suffix . '
' . 'E: ' . $individualFormatted . ' | S: ' . $shopFormatted . $suffix . ''; } /** * Generiert Sales Volume Display für User */ public static function generateSalesVolumeDisplayForUser(User $user, string $type, int $month, int $year): string { if ($type === 'points') { $total = (float) $user->getUserSalesVolumeBy($month, $year, 'sales_volume_points_KP_sum'); $individual = (float) $user->getUserSalesVolumeBy($month, $year, 'sales_volume_KP_points'); $shop = (float) $user->getUserSalesVolumeBy($month, $year, 'sales_volume_points_shop'); } else { $total = (float) $user->getUserSalesVolumeBy($month, $year, 'sales_volume_total_sum'); $individual = (float) $user->getUserSalesVolumeBy($month, $year, 'sales_volume_total'); $shop = (float) $user->getUserSalesVolumeBy($month, $year, 'sales_volume_total_shop'); } $totalFormatted = formatNumber($total); $individualFormatted = formatNumber($individual); $shopFormatted = formatNumber($shop); $suffix = $type === 'points' ? '' : ' €'; return '
' . $totalFormatted . $suffix . '
' . 'E: ' . $individualFormatted . ' | S: ' . $shopFormatted . $suffix . ''; } /** * Generiert Action Buttons (mit XSS-Schutz) */ public static function generateActionButtons($userId): string { $userId = (int) $userId; // Sicherheit: Nur Integer $html = ''; if (config('app.debug') === true) { $html .= ''; } return $html; } /** * Generiert Sponsor Display für UserBusiness */ public static function generateSponsorDisplay(UserBusiness $userBusiness): string { if (!$userBusiness->sponsor || !$userBusiness->sponsor->is_sponsor) { return '-'; } $sponsor = $userBusiness->sponsor; $html = e($sponsor->first_name . ' ' . $sponsor->last_name); $html .= '  
'; $html .= '' . e($sponsor->email); $html .= ' | ' . e($sponsor->m_account); $html .= ''; return $html; } /** * Generiert Sponsor Display für User */ public static function generateSponsorDisplayForUser(User $user): string { if (!$user->user_sponsor) { return '-'; } $sponsor = $user->user_sponsor; $html = ''; if ($sponsor->account) { $html .= e($sponsor->account->first_name . ' ' . $sponsor->account->last_name); $html .= '  
'; } $html .= '' . e($sponsor->email); if ($sponsor->account) { $html .= ' | ' . e($sponsor->account->m_account); } $html .= ''; return $html; } }