@extends('layouts.gamification') @section('title', __('Магазин')) @section('gami-active', 'shop') @push('styles') @endpush @section('gami-content') {{-- Flash messages come from layouts/app.blade.php's toasts now. --}}
{{ __('Баланс') }}
{{ (int) $hero->coins_balance }} 🪙
{{ __('Мой профиль — как его видят другие') }}
@if ($nextUnlock)
@include('partials._next_unlock', ['nextUnlock' => $nextUnlock, 'xpTotal' => $hero->xp_total])
@endif @foreach (['frame' => '🖼️ '.__('Рамки для аватара'), 'name_color' => '🎨 '.__('Цвет имени в рейтинге'), 'title' => '🏷️ '.__('Звания'), 'profile_theme' => '🪪 '.__('Оформление профиля')] as $kind => $title) @php $kindItems = $items->filter(fn ($i) => $i->kind === $kind); @endphp @if ($kindItems->isEmpty()) @continue @endif
{{ $title }}
@foreach ($kindItems as $item) @php $isOwned = in_array((int) $item->id, $ownedItemIds, true); $isEquipped = $isOwned && match ($kind) { 'frame' => ($hero->frame_color ?? '') === $item->value, 'name_color' => ($hero->name_color ?? '') === $item->value, 'title' => ($hero->title ?? '') === $item->name, 'profile_theme' => ($hero->profile_theme ?? '') === $item->value, }; $canAfford = (int) $hero->coins_balance >= (int) $item->cost_coins; $locked = (int) $hero->level_number < (int) ($item->min_level ?? 1); @endphp
@if ($kind === 'frame') @php($fr = \App\Support\Cosmetics::frame($item->value, 4))
@include('partials._student_avatar', ['studentId' => $student->id, 'avatarPath' => $student->avatar_path])
@elseif ($kind === 'name_color') @php($nm = \App\Support\Cosmetics::name($item->value))
{{ trim($studentName ?? __('Имя')) }}
@elseif ($kind === 'profile_theme') {{-- A small copy of the profile page's cover (/student/profile.php). --}}
@include('partials._student_avatar', ['studentId' => $student->id, 'avatarPath' => $student->avatar_path])
@else
{{ $item->icon }}
{{ $item->name }}
@endif @if ($kind !== 'title')
{{ $item->name }}
@endif @if (isset($rewardFor[(int) $item->id]) && ! $isOwned) {{-- Earned, not bought (128): Gamification::unlockShopItem() refuses it. --}} 🏆 {{ __('За достижение «:name»', ['name' => $rewardFor[(int) $item->id]]) }} @elseif ($locked && ! $isOwned)
{{ (int) $item->cost_coins }} 🪙
🔒 {{ __('С :n уровня', ['n' => (int) $item->min_level]) }} @elseif ($isEquipped && in_array($kind, ['title', 'profile_theme'], true)) {{-- ShopController::equip() takes a worn title / profile theme off. --}} {{ __('✅ надето') }}
@csrf
@elseif ($isEquipped) {{ __('✅ надето') }} @elseif ($isOwned)
@csrf
@else
{{ (int) $item->cost_coins }} 🪙
{{-- One click spends the coins and there's no refund, so ask first. --}}
@csrf
@endif
@endforeach
@endforeach @endsection