351 lines
10 KiB
PHP
351 lines
10 KiB
PHP
@extends('siswa.layouts.app')
|
|
|
|
@section('title', 'Hasil Challenge')
|
|
|
|
@push('styles')
|
|
<style>
|
|
.hasil-wrapper { max-width: 680px; margin: 0 auto; padding: 0 0 40px; }
|
|
|
|
.hasil-hero {
|
|
background: linear-gradient(135deg, #667eea, #764ba2);
|
|
border-radius: 24px;
|
|
padding: 36px 28px;
|
|
text-align: center;
|
|
color: white;
|
|
margin-bottom: 24px;
|
|
position: relative;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.hasil-emoji { margin-bottom: 10px; }
|
|
.hasil-emoji img { width: 64px; height: 64px; object-fit: contain; }
|
|
|
|
.hasil-title { font-size: 22px; font-weight: 800; margin-bottom: 4px; }
|
|
.hasil-subtitle { font-size: 14px; opacity: 0.85; margin-bottom: 20px; }
|
|
|
|
.hasil-exp {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 8px;
|
|
background: rgba(255,255,255,0.2);
|
|
border-radius: 99px;
|
|
padding: 8px 24px;
|
|
font-size: 20px;
|
|
font-weight: 800;
|
|
}
|
|
.hasil-exp img { width: 22px; height: 22px; object-fit: contain; }
|
|
|
|
.stat-row { display: grid; grid-template-columns: repeat(3,1fr); gap: 14px; margin-bottom: 24px; }
|
|
.stat-box { background: white; border-radius: 16px; border: 2px solid #e5e5e5; padding: 18px 14px; text-align: center; }
|
|
.stat-num { font-size: 28px; font-weight: 800; margin: 0; }
|
|
.stat-label { font-size: 12px; color: #94a3b8; margin: 4px 0 0; font-weight: 500; }
|
|
|
|
.custom-card { background: white; border-radius: 20px; border: 2px solid #e5e5e5; padding: 24px; margin-bottom: 16px; }
|
|
|
|
.section-title {
|
|
font-size: 16px;
|
|
font-weight: 700;
|
|
color: #1e293b;
|
|
margin-bottom: 16px;
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 8px;
|
|
}
|
|
.section-title img { width: 20px; height: 20px; object-fit: contain; }
|
|
|
|
.soal-review { border: 2px solid #e2e8f0; border-radius: 14px; padding: 18px; margin-bottom: 12px; }
|
|
.soal-review.benar { border-color: #22c55e; background: #f0fdf4; }
|
|
.soal-review.salah { border-color: #ef4444; background: #fef2f2; }
|
|
|
|
.review-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
|
|
.review-number { font-size: 12px; font-weight: 700; color: #64748b; }
|
|
|
|
.review-status {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 4px;
|
|
font-size: 12px;
|
|
font-weight: 700;
|
|
padding: 3px 10px;
|
|
border-radius: 99px;
|
|
}
|
|
.review-status img { width: 13px; height: 13px; object-fit: contain; }
|
|
.review-status.benar { background: #dcfce7; color: #16a34a; }
|
|
.review-status.salah { background: #fee2e2; color: #dc2626; }
|
|
|
|
.review-pertanyaan { font-size: 14px; font-weight: 600; color: #1e293b; margin-bottom: 12px; line-height: 1.6; }
|
|
|
|
.opsi-review {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 10px;
|
|
padding: 8px 12px;
|
|
border-radius: 10px;
|
|
font-size: 13px;
|
|
margin-bottom: 6px;
|
|
background: #f8fafc;
|
|
}
|
|
.opsi-review.jawaban-benar { background: #dcfce7; font-weight: 700; color: #15803d; }
|
|
.opsi-review.salah-dipilih { background: #fee2e2; color: #991b1b; font-weight: 700; }
|
|
|
|
.opsi-circle {
|
|
width: 26px; height: 26px;
|
|
border-radius: 50%;
|
|
background: #e2e8f0;
|
|
display: flex; align-items: center; justify-content: center;
|
|
font-size: 11px; font-weight: 700; flex-shrink: 0;
|
|
}
|
|
.opsi-review.jawaban-benar .opsi-circle { background: #22c55e; color: white; }
|
|
.opsi-review.salah-dipilih .opsi-circle { background: #ef4444; color: white; }
|
|
|
|
.opsi-tag {
|
|
margin-left: auto;
|
|
font-size: 12px;
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 4px;
|
|
flex-shrink: 0;
|
|
white-space: nowrap;
|
|
}
|
|
.opsi-tag img { width: 13px; height: 13px; object-fit: contain; }
|
|
|
|
.btn-back {
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
gap: 8px;
|
|
background: linear-gradient(135deg, #667eea, #764ba2);
|
|
color: white;
|
|
border-radius: 12px;
|
|
padding: 12px;
|
|
font-size: 14px;
|
|
font-weight: 600;
|
|
text-decoration: none;
|
|
margin-top: 20px;
|
|
}
|
|
.btn-back:hover { opacity: 0.9; color: white; }
|
|
|
|
/* ── Modal Badge ─────────────────────────────────────────── */
|
|
.badge-modal-overlay {
|
|
display: none;
|
|
position: fixed;
|
|
inset: 0;
|
|
background: rgba(0,0,0,0.55);
|
|
z-index: 9999;
|
|
align-items: center;
|
|
justify-content: center;
|
|
backdrop-filter: blur(3px);
|
|
}
|
|
|
|
.badge-modal-overlay.active {
|
|
display: flex;
|
|
}
|
|
|
|
.badge-modal {
|
|
background: white;
|
|
border-radius: 24px;
|
|
padding: 36px 28px 28px;
|
|
max-width: 380px;
|
|
width: 90%;
|
|
text-align: center;
|
|
animation: popIn 0.35s cubic-bezier(0.34,1.56,0.64,1);
|
|
position: relative;
|
|
}
|
|
|
|
@keyframes popIn {
|
|
from { transform: scale(0.7); opacity: 0; }
|
|
to { transform: scale(1); opacity: 1; }
|
|
}
|
|
|
|
.badge-modal-label {
|
|
font-size: 12px;
|
|
font-weight: 700;
|
|
color: #7c3aed;
|
|
text-transform: uppercase;
|
|
letter-spacing: 1px;
|
|
margin-bottom: 20px;
|
|
}
|
|
|
|
.badge-modal-list {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 20px;
|
|
margin-bottom: 24px;
|
|
}
|
|
|
|
.badge-modal-item {
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
text-align: center;
|
|
}
|
|
|
|
.badge-modal-icon {
|
|
width: 100%;
|
|
max-width: 220px;
|
|
height: auto;
|
|
object-fit: contain;
|
|
margin-bottom: 14px;
|
|
}
|
|
|
|
.badge-modal-info-nama {
|
|
font-size: 16px;
|
|
font-weight: 800;
|
|
color: #1e293b;
|
|
margin-bottom: 4px;
|
|
}
|
|
|
|
.badge-modal-info-desc {
|
|
font-size: 13px;
|
|
color: #64748b;
|
|
}
|
|
|
|
.badge-modal-btn {
|
|
background: linear-gradient(135deg, #667eea, #764ba2);
|
|
color: white;
|
|
border: none;
|
|
border-radius: 12px;
|
|
padding: 12px 32px;
|
|
font-size: 14px;
|
|
font-weight: 700;
|
|
font-family: 'Poppins', sans-serif;
|
|
cursor: pointer;
|
|
width: 100%;
|
|
transition: opacity 0.2s;
|
|
}
|
|
|
|
.badge-modal-btn:hover { opacity: 0.9; }
|
|
|
|
</style>
|
|
@endpush
|
|
|
|
@section('content')
|
|
|
|
@php
|
|
if ($persentase >= 80) {
|
|
$emojiSrc = asset('images/icon/siswac/confetti.png');
|
|
$emojiAlt = 'Selamat, hasil luar biasa!';
|
|
} elseif ($persentase >= 60) {
|
|
$emojiSrc = asset('images/icon/siswac/sip.png');
|
|
$emojiAlt = 'Bagus, terus tingkatkan!';
|
|
} else {
|
|
$emojiSrc = asset('images/icon/siswac/muscle.png');
|
|
$emojiAlt = 'Semangat, jangan menyerah!';
|
|
}
|
|
|
|
$pesan = $persentase >= 80
|
|
? 'Luar biasa! Kamu menguasai materi ini!'
|
|
: ($persentase >= 60 ? 'Bagus! Terus tingkatkan kemampuanmu!' : 'Jangan menyerah! Terus semangat belajar!');
|
|
@endphp
|
|
|
|
{{-- ── Pop-up Modal Badge Baru ── --}}
|
|
@if(isset($badgeBaru) && $badgeBaru->isNotEmpty())
|
|
<div class="badge-modal-overlay active" id="badgeModal">
|
|
<div class="badge-modal">
|
|
<div class="badge-modal-label">Badge Baru Diraih!</div>
|
|
|
|
<div class="badge-modal-list">
|
|
@foreach($badgeBaru as $b)
|
|
<div class="badge-modal-item">
|
|
<img
|
|
src="{{ asset($b->icon_badge) }}"
|
|
alt="{{ $b->nama_badge }}"
|
|
class="badge-modal-icon"
|
|
>
|
|
<div class="badge-modal-info-nama">{{ $b->nama_badge }}</div>
|
|
<div class="badge-modal-info-desc">{{ $b->deskripsi }}</div>
|
|
</div>
|
|
@endforeach
|
|
</div>
|
|
|
|
<button class="badge-modal-btn" onclick="document.getElementById('badgeModal').classList.remove('active')">
|
|
Sip, lanjut! 🚀
|
|
</button>
|
|
</div>
|
|
</div>
|
|
@endif
|
|
|
|
<div class="hasil-wrapper">
|
|
|
|
<div class="hasil-hero">
|
|
<div class="hasil-emoji">
|
|
<img src="{{ $emojiSrc }}" alt="{{ $emojiAlt }}">
|
|
</div>
|
|
<div class="hasil-title">{{ $challenge->judul_challenge }}</div>
|
|
<div class="hasil-subtitle">{{ $pesan }}</div>
|
|
<div class="hasil-exp">
|
|
<img src="{{ asset('images/icon/siswac/star.png') }}" alt="Ikon bintang EXP">
|
|
+{{ $peserta->exp }} EXP didapat!
|
|
</div>
|
|
</div>
|
|
|
|
<div class="stat-row">
|
|
<div class="stat-box">
|
|
<p class="stat-num" style="color:#22c55e">{{ $benar }}</p>
|
|
<p class="stat-label">Jawaban Benar</p>
|
|
</div>
|
|
<div class="stat-box">
|
|
<p class="stat-num" style="color:#ef4444">{{ $salah }}</p>
|
|
<p class="stat-label">Jawaban Salah</p>
|
|
</div>
|
|
<div class="stat-box">
|
|
<p class="stat-num" style="color:#667eea">{{ $persentase }}%</p>
|
|
<p class="stat-label">Skor</p>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="custom-card">
|
|
<p class="section-title">
|
|
<img src="{{ asset('images/icon/siswac/buku1.png') }}" alt="Ikon buku">
|
|
Pembahasan Jawaban
|
|
</p>
|
|
|
|
@foreach($challenge->soal as $i => $soal)
|
|
@php
|
|
$jwbSiswa = strtoupper($jawabanSiswa[$soal->id_soal] ?? '');
|
|
$jwbBenar = strtoupper($soal->jawaban_benar);
|
|
$isBenar = $jwbSiswa === $jwbBenar;
|
|
@endphp
|
|
<div class="soal-review {{ $isBenar ? 'benar' : 'salah' }}">
|
|
<div class="review-header">
|
|
<span class="review-number">Soal {{ $i + 1 }}</span>
|
|
<span class="review-status {{ $isBenar ? 'benar' : 'salah' }}">
|
|
@if($isBenar)
|
|
<img src="{{ asset('images/icon/siswac/v.png') }}" alt="Centang benar"> Benar
|
|
@else
|
|
<img src="{{ asset('images/icon/siswac/x.png') }}" alt="Tanda salah"> Salah
|
|
@endif
|
|
</span>
|
|
</div>
|
|
|
|
<p class="review-pertanyaan">{{ $soal->pertanyaan }}</p>
|
|
|
|
@foreach(['A','B','C','D'] as $opsi)
|
|
@php
|
|
$key = 'opsi_' . strtolower($opsi);
|
|
$isDipilih = $jwbSiswa === $opsi;
|
|
$isJwbBenar = $jwbBenar === $opsi;
|
|
$cls = $isJwbBenar ? 'jawaban-benar' : ($isDipilih ? 'salah-dipilih' : '');
|
|
@endphp
|
|
<div class="opsi-review {{ $cls }}">
|
|
<span class="opsi-circle">{{ $opsi }}</span>
|
|
<span>{{ $soal->$key }}</span>
|
|
@if($isJwbBenar)
|
|
<span class="opsi-tag">
|
|
<img src="{{ asset('images/icon/siswac/v.png') }}" alt="Centang benar"> Jawaban benar
|
|
</span>
|
|
@elseif($isDipilih)
|
|
<span class="opsi-tag">← Jawabanmu</span>
|
|
@endif
|
|
</div>
|
|
@endforeach
|
|
</div>
|
|
@endforeach
|
|
</div>
|
|
|
|
<a href="{{ route('siswa.challenge.index') }}" class="btn-back">
|
|
← Kembali ke Daftar Challenge
|
|
</a>
|
|
</div>
|
|
|
|
@endsection |