materi & tugas updated
This commit is contained in:
parent
ce2ca560f9
commit
005a42fc38
|
|
@ -97,4 +97,105 @@ public function storeTugas(Request $request)
|
||||||
return redirect()->route('guru.mapel.index')
|
return redirect()->route('guru.mapel.index')
|
||||||
->with('success', 'Tugas berhasil dibuat!');
|
->with('success', 'Tugas berhasil dibuat!');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* History semua materi yang dibuat guru ini
|
||||||
|
*/
|
||||||
|
public function historyMateri()
|
||||||
|
{
|
||||||
|
$guru = Auth::guard('guru')->user();
|
||||||
|
|
||||||
|
// Ambil id_mengajar milik guru ini
|
||||||
|
$idMengajars = Mengajar::where('id_guru', $guru->id_guru)
|
||||||
|
->pluck('id_mengajar');
|
||||||
|
|
||||||
|
$materiList = Materi::with(['mengajar.mapel', 'mengajar.kelas'])
|
||||||
|
->whereIn('id_mengajar', $idMengajars)
|
||||||
|
->orderBy('created_at', 'desc')
|
||||||
|
->paginate(15);
|
||||||
|
|
||||||
|
return view('guru.materi.history', compact('materiList'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hapus materi
|
||||||
|
*/
|
||||||
|
public function destroyMateri($id)
|
||||||
|
{
|
||||||
|
$guru = Auth::guard('guru')->user();
|
||||||
|
|
||||||
|
$idMengajars = Mengajar::where('id_guru', $guru->id_guru)->pluck('id_mengajar');
|
||||||
|
|
||||||
|
$materi = Materi::whereIn('id_mengajar', $idMengajars)
|
||||||
|
->where('id_materi', $id)
|
||||||
|
->firstOrFail();
|
||||||
|
|
||||||
|
// Hapus file jika ada
|
||||||
|
if ($materi->lampiran_materi && \Storage::disk('public')->exists($materi->lampiran_materi)) {
|
||||||
|
\Storage::disk('public')->delete($materi->lampiran_materi);
|
||||||
|
}
|
||||||
|
|
||||||
|
$materi->delete();
|
||||||
|
|
||||||
|
return redirect()->route('guru.materi.history')
|
||||||
|
->with('success', 'Materi berhasil dihapus.');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* History semua tugas yang dibuat guru ini
|
||||||
|
*/
|
||||||
|
public function historyTugas()
|
||||||
|
{
|
||||||
|
$guru = Auth::guard('guru')->user();
|
||||||
|
|
||||||
|
$idMengajars = Mengajar::where('id_guru', $guru->id_guru)
|
||||||
|
->pluck('id_mengajar');
|
||||||
|
|
||||||
|
$tugasList = Tugas::with(['mengajar.mapel', 'mengajar.kelas', 'pengumpulanTugas'])
|
||||||
|
->whereIn('id_mengajar', $idMengajars)
|
||||||
|
->orderBy('created_at', 'desc')
|
||||||
|
->paginate(15);
|
||||||
|
|
||||||
|
return view('guru.tugas.history', compact('tugasList'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Detail tugas + daftar pengumpulan siswa
|
||||||
|
*/
|
||||||
|
public function detailTugas($id)
|
||||||
|
{
|
||||||
|
$guru = Auth::guard('guru')->user();
|
||||||
|
|
||||||
|
$idMengajars = Mengajar::where('id_guru', $guru->id_guru)->pluck('id_mengajar');
|
||||||
|
|
||||||
|
$tugas = Tugas::with([
|
||||||
|
'mengajar.mapel',
|
||||||
|
'mengajar.kelas',
|
||||||
|
'pengumpulanTugas.siswa',
|
||||||
|
])
|
||||||
|
->whereIn('id_mengajar', $idMengajars)
|
||||||
|
->where('id_tugas', $id)
|
||||||
|
->firstOrFail();
|
||||||
|
|
||||||
|
return view('guru.tugas.detail', compact('tugas'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hapus tugas
|
||||||
|
*/
|
||||||
|
public function destroyTugas($id)
|
||||||
|
{
|
||||||
|
$guru = Auth::guard('guru')->user();
|
||||||
|
|
||||||
|
$idMengajars = Mengajar::where('id_guru', $guru->id_guru)->pluck('id_mengajar');
|
||||||
|
|
||||||
|
$tugas = Tugas::whereIn('id_mengajar', $idMengajars)
|
||||||
|
->where('id_tugas', $id)
|
||||||
|
->firstOrFail();
|
||||||
|
|
||||||
|
$tugas->delete();
|
||||||
|
|
||||||
|
return redirect()->route('guru.tugas.history')
|
||||||
|
->with('success', 'Tugas berhasil dihapus.');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -15,7 +15,7 @@ class PengumpulanTugas extends Model
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'id_tugas',
|
'id_tugas',
|
||||||
'is_siswa',
|
'id_siswa',
|
||||||
'lampiran_tugas',
|
'lampiran_tugas',
|
||||||
'tanggal_submit',
|
'tanggal_submit',
|
||||||
'exp',
|
'exp',
|
||||||
|
|
|
||||||
|
|
@ -121,7 +121,17 @@
|
||||||
|
|
||||||
.file-preview.show { display: flex; }
|
.file-preview.show { display: flex; }
|
||||||
|
|
||||||
.alert-success-custom {
|
.btn-history-materi {
|
||||||
|
background: #8b5cf6;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
.btn-history-materi:hover { background: #7c3aed; color: white; }
|
||||||
|
|
||||||
|
.btn-history-tugas {
|
||||||
|
background: #14b8a6;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
.btn-history-tugas:hover { background: #0d9488; color: white; }
|
||||||
background: #dcfce7;
|
background: #dcfce7;
|
||||||
color: #166534;
|
color: #166534;
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
|
|
@ -192,21 +202,33 @@
|
||||||
|
|
||||||
{{-- AKSI --}}
|
{{-- AKSI --}}
|
||||||
<td>
|
<td>
|
||||||
<button class="action-btn btn-materi"
|
<div class="d-flex flex-wrap gap-1 justify-content-center">
|
||||||
onclick="openMateriModal(
|
<button class="action-btn btn-materi"
|
||||||
'{{ addslashes(optional($mapel)->nama_mapel) }}',
|
onclick="openMateriModal(
|
||||||
{{ $mengajarOptions->toJson() }}
|
'{{ addslashes(optional($mapel)->nama_mapel) }}',
|
||||||
)">
|
{{ $mengajarOptions->toJson() }}
|
||||||
📄 Upload Materi
|
)">
|
||||||
</button>
|
📄 Upload Materi
|
||||||
|
</button>
|
||||||
|
|
||||||
<button class="action-btn btn-tugas mt-1"
|
<button class="action-btn btn-tugas"
|
||||||
onclick="openTugasModal(
|
onclick="openTugasModal(
|
||||||
'{{ addslashes(optional($mapel)->nama_mapel) }}',
|
'{{ addslashes(optional($mapel)->nama_mapel) }}',
|
||||||
{{ $mengajarOptions->toJson() }}
|
{{ $mengajarOptions->toJson() }}
|
||||||
)">
|
)">
|
||||||
📋 Buat Tugas
|
📋 Buat Tugas
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
|
<a href="{{ route('guru.materi.history', ['id_mapel' => $idMapel]) }}"
|
||||||
|
class="action-btn btn-history-materi">
|
||||||
|
🗂️ History Materi
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<a href="{{ route('guru.tugas.history', ['id_mapel' => $idMapel]) }}"
|
||||||
|
class="action-btn btn-history-tugas">
|
||||||
|
📑 History Tugas
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@empty
|
@empty
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,203 @@
|
||||||
|
@extends('guru.layouts.app')
|
||||||
|
|
||||||
|
@section('title', 'History Materi')
|
||||||
|
|
||||||
|
@push('styles')
|
||||||
|
<style>
|
||||||
|
.page-title {
|
||||||
|
font-size: 28px;
|
||||||
|
font-weight: 800;
|
||||||
|
margin-bottom: 6px;
|
||||||
|
margin-top: -20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.back-link {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
color: #2b8ef3;
|
||||||
|
font-weight: 600;
|
||||||
|
font-size: 14px;
|
||||||
|
text-decoration: none;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.back-link:hover { text-decoration: underline; }
|
||||||
|
|
||||||
|
.custom-card {
|
||||||
|
background: white;
|
||||||
|
border-radius: 20px;
|
||||||
|
border: 2px solid #e5e5e5;
|
||||||
|
padding: 25px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-header { background: #a5e6ba; }
|
||||||
|
|
||||||
|
.mapel-badge {
|
||||||
|
display: inline-block;
|
||||||
|
background: #e6f0ff;
|
||||||
|
color: #1d4ed8;
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 600;
|
||||||
|
padding: 3px 10px;
|
||||||
|
border-radius: 99px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.kelas-badge {
|
||||||
|
display: inline-block;
|
||||||
|
background: #f0fdf4;
|
||||||
|
color: #166534;
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 600;
|
||||||
|
padding: 3px 10px;
|
||||||
|
border-radius: 99px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-icon { font-size: 20px; }
|
||||||
|
|
||||||
|
.btn-hapus {
|
||||||
|
background: #fee2e2;
|
||||||
|
color: #ef4444;
|
||||||
|
border: none;
|
||||||
|
border-radius: 8px;
|
||||||
|
padding: 5px 12px;
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 600;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: background 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-hapus:hover { background: #fca5a5; }
|
||||||
|
|
||||||
|
.btn-unduh {
|
||||||
|
background: #e6f0ff;
|
||||||
|
color: #2b8ef3;
|
||||||
|
border: none;
|
||||||
|
border-radius: 8px;
|
||||||
|
padding: 5px 12px;
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 600;
|
||||||
|
text-decoration: none;
|
||||||
|
transition: background 0.2s;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-unduh:hover { background: #bfdbfe; color: #1d4ed8; }
|
||||||
|
|
||||||
|
.alert-success-custom {
|
||||||
|
background: #dcfce7;
|
||||||
|
color: #166534;
|
||||||
|
border-radius: 10px;
|
||||||
|
padding: 12px 16px;
|
||||||
|
margin-bottom: 16px;
|
||||||
|
font-weight: 500;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-state {
|
||||||
|
text-align: center;
|
||||||
|
padding: 50px 20px;
|
||||||
|
color: #94a3b8;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
@endpush
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
|
||||||
|
<a href="{{ route('guru.mapel.index') }}" class="back-link">← Kembali ke Mata Pelajaran</a>
|
||||||
|
|
||||||
|
<h3 class="page-title">🗂️ History Materi</h3>
|
||||||
|
<p style="color:#64748b;font-size:14px;margin-bottom:20px">
|
||||||
|
Semua materi yang pernah Anda upload.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
@if(session('success'))
|
||||||
|
<div class="alert-success-custom">✅ {{ session('success') }}</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
<div class="custom-card">
|
||||||
|
@if($materiList->isEmpty())
|
||||||
|
<div class="empty-state">
|
||||||
|
<div style="font-size:48px;margin-bottom:12px">📭</div>
|
||||||
|
<p>Belum ada materi yang diupload.</p>
|
||||||
|
</div>
|
||||||
|
@else
|
||||||
|
<table class="table align-middle">
|
||||||
|
<thead class="table-header text-center">
|
||||||
|
<tr>
|
||||||
|
<th>No</th>
|
||||||
|
<th>Judul Materi</th>
|
||||||
|
<th>Mata Pelajaran</th>
|
||||||
|
<th>Kelas</th>
|
||||||
|
<th>Tanggal Upload</th>
|
||||||
|
<th>File</th>
|
||||||
|
<th>Aksi</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach($materiList as $i => $materi)
|
||||||
|
<tr>
|
||||||
|
<td class="text-center">{{ $materiList->firstItem() + $i }}</td>
|
||||||
|
<td>
|
||||||
|
<div style="font-weight:600;color:#1e293b">{{ $materi->judul_materi }}</div>
|
||||||
|
@if($materi->deskripsi)
|
||||||
|
<div style="font-size:12px;color:#94a3b8;margin-top:2px">
|
||||||
|
{{ Str::limit($materi->deskripsi, 60) }}
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
</td>
|
||||||
|
<td class="text-center">
|
||||||
|
<span class="mapel-badge">
|
||||||
|
{{ optional(optional($materi->mengajar)->mapel)->nama_mapel ?? '-' }}
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
|
<td class="text-center">
|
||||||
|
<span class="kelas-badge">
|
||||||
|
{{ optional(optional($materi->mengajar)->kelas)->tingkat }}
|
||||||
|
{{ optional(optional($materi->mengajar)->kelas)->nama_kelas ?? '-' }}
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
|
<td class="text-center" style="font-size:13px;color:#64748b">
|
||||||
|
{{ \Carbon\Carbon::parse($materi->tanggal_upload)->format('d M Y, H:i') }}
|
||||||
|
</td>
|
||||||
|
<td class="text-center">
|
||||||
|
@if($materi->lampiran_materi)
|
||||||
|
@php
|
||||||
|
$ext = strtolower(pathinfo($materi->lampiran_materi, PATHINFO_EXTENSION));
|
||||||
|
$icon = match(true) {
|
||||||
|
in_array($ext, ['pdf']) => '📄',
|
||||||
|
in_array($ext, ['doc','docx']) => '📝',
|
||||||
|
in_array($ext, ['ppt','pptx']) => '📊',
|
||||||
|
in_array($ext, ['jpg','jpeg','png']) => '🖼️',
|
||||||
|
default => '📎',
|
||||||
|
};
|
||||||
|
@endphp
|
||||||
|
<a href="{{ asset('storage/' . $materi->lampiran_materi) }}"
|
||||||
|
target="_blank" class="btn-unduh">
|
||||||
|
{{ $icon }} Unduh
|
||||||
|
</a>
|
||||||
|
@else
|
||||||
|
<span style="font-size:12px;color:#94a3b8">Tidak ada file</span>
|
||||||
|
@endif
|
||||||
|
</td>
|
||||||
|
<td class="text-center">
|
||||||
|
<form action="{{ route('guru.materi.destroy', $materi->id_materi) }}"
|
||||||
|
method="POST"
|
||||||
|
onsubmit="return confirm('Yakin hapus materi ini?')">
|
||||||
|
@csrf
|
||||||
|
@method('DELETE')
|
||||||
|
<button type="submit" class="btn-hapus">🗑️ Hapus</button>
|
||||||
|
</form>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<div class="d-flex justify-content-end mt-3">
|
||||||
|
{{ $materiList->links() }}
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@endsection
|
||||||
|
|
@ -0,0 +1,279 @@
|
||||||
|
@extends('guru.layouts.app')
|
||||||
|
|
||||||
|
@section('title', 'Detail Tugas')
|
||||||
|
|
||||||
|
@push('styles')
|
||||||
|
<style>
|
||||||
|
.page-title {
|
||||||
|
font-size: 26px;
|
||||||
|
font-weight: 800;
|
||||||
|
margin-bottom: 6px;
|
||||||
|
margin-top: -20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.back-link {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
color: #2b8ef3;
|
||||||
|
font-weight: 600;
|
||||||
|
font-size: 14px;
|
||||||
|
text-decoration: none;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.back-link:hover { text-decoration: underline; }
|
||||||
|
|
||||||
|
.info-card {
|
||||||
|
background: white;
|
||||||
|
border-radius: 20px;
|
||||||
|
border: 2px solid #e5e5e5;
|
||||||
|
padding: 24px 28px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
border-left: 5px solid #f97316;
|
||||||
|
}
|
||||||
|
|
||||||
|
.info-title {
|
||||||
|
font-size: 20px;
|
||||||
|
font-weight: 700;
|
||||||
|
color: #1e293b;
|
||||||
|
margin: 0 0 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.info-meta {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 10px;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.meta-chip {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
background: #f1f5f9;
|
||||||
|
color: #475569;
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 500;
|
||||||
|
padding: 5px 12px;
|
||||||
|
border-radius: 99px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.meta-chip.orange { background: #fff7ed; color: #ea580c; }
|
||||||
|
.meta-chip.green { background: #f0fdf4; color: #16a34a; }
|
||||||
|
.meta-chip.red { background: #fef2f2; color: #dc2626; }
|
||||||
|
|
||||||
|
.keterangan-box {
|
||||||
|
background: #f8fafc;
|
||||||
|
border-radius: 10px;
|
||||||
|
padding: 14px 16px;
|
||||||
|
font-size: 14px;
|
||||||
|
color: #475569;
|
||||||
|
line-height: 1.7;
|
||||||
|
border: 1px solid #e2e8f0;
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-card {
|
||||||
|
background: white;
|
||||||
|
border-radius: 20px;
|
||||||
|
border: 2px solid #e5e5e5;
|
||||||
|
padding: 25px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section-title {
|
||||||
|
font-size: 17px;
|
||||||
|
font-weight: 700;
|
||||||
|
color: #1e293b;
|
||||||
|
margin-bottom: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-header { background: #a5e6ba; }
|
||||||
|
|
||||||
|
.status-badge {
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 700;
|
||||||
|
padding: 3px 10px;
|
||||||
|
border-radius: 99px;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-dikumpulkan { background: #dcfce7; color: #16a34a; }
|
||||||
|
.status-terlambat { background: #fff7ed; color: #ea580c; }
|
||||||
|
.status-belum { background: #f1f5f9; color: #64748b; }
|
||||||
|
|
||||||
|
.btn-unduh {
|
||||||
|
background: #e6f0ff;
|
||||||
|
color: #2b8ef3;
|
||||||
|
border: none;
|
||||||
|
border-radius: 8px;
|
||||||
|
padding: 5px 12px;
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 600;
|
||||||
|
text-decoration: none;
|
||||||
|
display: inline-block;
|
||||||
|
transition: background 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-unduh:hover { background: #bfdbfe; color: #1d4ed8; }
|
||||||
|
|
||||||
|
.stat-row {
|
||||||
|
display: flex;
|
||||||
|
gap: 16px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stat-box {
|
||||||
|
flex: 1;
|
||||||
|
background: #f8fafc;
|
||||||
|
border-radius: 14px;
|
||||||
|
padding: 16px 20px;
|
||||||
|
text-align: center;
|
||||||
|
border: 1px solid #e2e8f0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stat-num {
|
||||||
|
font-size: 28px;
|
||||||
|
font-weight: 800;
|
||||||
|
color: #1e293b;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stat-label {
|
||||||
|
font-size: 12px;
|
||||||
|
color: #94a3b8;
|
||||||
|
margin: 4px 0 0;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-state {
|
||||||
|
text-align: center;
|
||||||
|
padding: 40px 20px;
|
||||||
|
color: #94a3b8;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
@endpush
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
|
||||||
|
<a href="{{ route('guru.tugas.history') }}" class="back-link">← Kembali ke History Tugas</a>
|
||||||
|
|
||||||
|
{{-- INFO TUGAS --}}
|
||||||
|
@php
|
||||||
|
$isLewat = \Carbon\Carbon::parse($tugas->deadline)->isPast();
|
||||||
|
$jumlahKumpul = $tugas->pengumpulanTugas->where('status', 'dikumpulkan')->count();
|
||||||
|
$jumlahLambat = $tugas->pengumpulanTugas->where('status', 'terlambat')->count();
|
||||||
|
$totalKumpul = $tugas->pengumpulanTugas->count();
|
||||||
|
@endphp
|
||||||
|
|
||||||
|
<div class="info-card">
|
||||||
|
<h2 class="info-title">{{ $tugas->judul_tugas }}</h2>
|
||||||
|
|
||||||
|
<div class="info-meta">
|
||||||
|
<span class="meta-chip">
|
||||||
|
📚 {{ optional(optional($tugas->mengajar)->mapel)->nama_mapel ?? '-' }}
|
||||||
|
</span>
|
||||||
|
<span class="meta-chip">
|
||||||
|
🏫 {{ optional(optional($tugas->mengajar)->kelas)->tingkat }}
|
||||||
|
{{ optional(optional($tugas->mengajar)->kelas)->nama_kelas ?? '-' }}
|
||||||
|
</span>
|
||||||
|
<span class="meta-chip {{ $isLewat ? 'red' : 'green' }}">
|
||||||
|
⏰ Deadline: {{ \Carbon\Carbon::parse($tugas->deadline)->format('d M Y, H:i') }}
|
||||||
|
— {{ $isLewat ? 'Sudah lewat' : 'Masih aktif' }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@if($tugas->keterangan)
|
||||||
|
<div class="keterangan-box">
|
||||||
|
{!! nl2br(e($tugas->keterangan)) !!}
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- STATISTIK --}}
|
||||||
|
<div class="stat-row">
|
||||||
|
<div class="stat-box">
|
||||||
|
<p class="stat-num" style="color:#22c55e">{{ $jumlahKumpul }}</p>
|
||||||
|
<p class="stat-label">Tepat Waktu</p>
|
||||||
|
</div>
|
||||||
|
<div class="stat-box">
|
||||||
|
<p class="stat-num" style="color:#f97316">{{ $jumlahLambat }}</p>
|
||||||
|
<p class="stat-label">Terlambat</p>
|
||||||
|
</div>
|
||||||
|
<div class="stat-box">
|
||||||
|
<p class="stat-num" style="color:#2b8ef3">{{ $totalKumpul }}</p>
|
||||||
|
<p class="stat-label">Total Pengumpulan</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- DAFTAR PENGUMPULAN --}}
|
||||||
|
<div class="custom-card">
|
||||||
|
<p class="section-title">📥 Daftar Pengumpulan Siswa</p>
|
||||||
|
|
||||||
|
@if($tugas->pengumpulanTugas->isEmpty())
|
||||||
|
<div class="empty-state">
|
||||||
|
<div style="font-size:40px;margin-bottom:10px">📭</div>
|
||||||
|
<p>Belum ada siswa yang mengumpulkan tugas ini.</p>
|
||||||
|
</div>
|
||||||
|
@else
|
||||||
|
<table class="table align-middle">
|
||||||
|
<thead class="table-header text-center">
|
||||||
|
<tr>
|
||||||
|
<th>No</th>
|
||||||
|
<th>Nama Siswa</th>
|
||||||
|
<th>NISN</th>
|
||||||
|
<th>Waktu Submit</th>
|
||||||
|
<th>Status</th>
|
||||||
|
<th>EXP</th>
|
||||||
|
<th>File</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach($tugas->pengumpulanTugas as $i => $kumpul)
|
||||||
|
<tr>
|
||||||
|
<td class="text-center">{{ $i + 1 }}</td>
|
||||||
|
<td style="font-weight:600">
|
||||||
|
{{ optional($kumpul->siswa)->nama ?? '-' }}
|
||||||
|
</td>
|
||||||
|
<td class="text-center" style="font-size:13px;color:#64748b">
|
||||||
|
{{ optional($kumpul->siswa)->nisn ?? '-' }}
|
||||||
|
</td>
|
||||||
|
<td class="text-center" style="font-size:13px;color:#64748b">
|
||||||
|
{{ \Carbon\Carbon::parse($kumpul->tanggal_submit)->format('d M Y, H:i') }}
|
||||||
|
</td>
|
||||||
|
<td class="text-center">
|
||||||
|
<span class="status-badge status-{{ $kumpul->status }}">
|
||||||
|
@if($kumpul->status === 'dikumpulkan') ✅ Tepat Waktu
|
||||||
|
@elseif($kumpul->status === 'terlambat') ⏰ Terlambat
|
||||||
|
@else ❌ Belum
|
||||||
|
@endif
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
|
<td class="text-center">
|
||||||
|
@if($kumpul->exp > 0)
|
||||||
|
<span style="background:#fef9c3;color:#b45309;font-size:12px;
|
||||||
|
font-weight:700;padding:3px 10px;border-radius:99px">
|
||||||
|
⭐ {{ $kumpul->exp }} EXP
|
||||||
|
</span>
|
||||||
|
@else
|
||||||
|
<span style="font-size:12px;color:#94a3b8">Belum dinilai</span>
|
||||||
|
@endif
|
||||||
|
</td>
|
||||||
|
<td class="text-center">
|
||||||
|
@if($kumpul->lampiran_tugas)
|
||||||
|
<a href="{{ asset('storage/' . $kumpul->lampiran_tugas) }}"
|
||||||
|
target="_blank" class="btn-unduh">
|
||||||
|
📎 Unduh
|
||||||
|
</a>
|
||||||
|
@else
|
||||||
|
<span style="font-size:12px;color:#94a3b8">-</span>
|
||||||
|
@endif
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@endsection
|
||||||
|
|
@ -0,0 +1,217 @@
|
||||||
|
@extends('guru.layouts.app')
|
||||||
|
|
||||||
|
@section('title', 'History Tugas')
|
||||||
|
|
||||||
|
@push('styles')
|
||||||
|
<style>
|
||||||
|
.page-title {
|
||||||
|
font-size: 28px;
|
||||||
|
font-weight: 800;
|
||||||
|
margin-bottom: 6px;
|
||||||
|
margin-top: -20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.back-link {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
color: #2b8ef3;
|
||||||
|
font-weight: 600;
|
||||||
|
font-size: 14px;
|
||||||
|
text-decoration: none;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.back-link:hover { text-decoration: underline; }
|
||||||
|
|
||||||
|
.custom-card {
|
||||||
|
background: white;
|
||||||
|
border-radius: 20px;
|
||||||
|
border: 2px solid #e5e5e5;
|
||||||
|
padding: 25px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-header { background: #a5e6ba; }
|
||||||
|
|
||||||
|
.mapel-badge {
|
||||||
|
display: inline-block;
|
||||||
|
background: #e6f0ff;
|
||||||
|
color: #1d4ed8;
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 600;
|
||||||
|
padding: 3px 10px;
|
||||||
|
border-radius: 99px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.kelas-badge {
|
||||||
|
display: inline-block;
|
||||||
|
background: #f0fdf4;
|
||||||
|
color: #166534;
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 600;
|
||||||
|
padding: 3px 10px;
|
||||||
|
border-radius: 99px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.deadline-badge {
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 600;
|
||||||
|
padding: 3px 10px;
|
||||||
|
border-radius: 99px;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.deadline-lewat { background: #fee2e2; color: #ef4444; }
|
||||||
|
.deadline-aktif { background: #dcfce7; color: #16a34a; }
|
||||||
|
|
||||||
|
.submit-count {
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 700;
|
||||||
|
color: #f97316;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-detail {
|
||||||
|
background: #f97316;
|
||||||
|
color: white;
|
||||||
|
border: none;
|
||||||
|
border-radius: 8px;
|
||||||
|
padding: 5px 14px;
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 600;
|
||||||
|
text-decoration: none;
|
||||||
|
display: inline-block;
|
||||||
|
transition: background 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-detail:hover { background: #ea6c0a; color: white; }
|
||||||
|
|
||||||
|
.btn-hapus {
|
||||||
|
background: #fee2e2;
|
||||||
|
color: #ef4444;
|
||||||
|
border: none;
|
||||||
|
border-radius: 8px;
|
||||||
|
padding: 5px 12px;
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 600;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: background 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-hapus:hover { background: #fca5a5; }
|
||||||
|
|
||||||
|
.alert-success-custom {
|
||||||
|
background: #dcfce7;
|
||||||
|
color: #166534;
|
||||||
|
border-radius: 10px;
|
||||||
|
padding: 12px 16px;
|
||||||
|
margin-bottom: 16px;
|
||||||
|
font-weight: 500;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-state {
|
||||||
|
text-align: center;
|
||||||
|
padding: 50px 20px;
|
||||||
|
color: #94a3b8;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
@endpush
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
|
||||||
|
<a href="{{ route('guru.mapel.index') }}" class="back-link">← Kembali ke Mata Pelajaran</a>
|
||||||
|
|
||||||
|
<h3 class="page-title">📑 History Tugas</h3>
|
||||||
|
<p style="color:#64748b;font-size:14px;margin-bottom:20px">
|
||||||
|
Semua tugas yang pernah Anda buat.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
@if(session('success'))
|
||||||
|
<div class="alert-success-custom">✅ {{ session('success') }}</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
<div class="custom-card">
|
||||||
|
@if($tugasList->isEmpty())
|
||||||
|
<div class="empty-state">
|
||||||
|
<div style="font-size:48px;margin-bottom:12px">📭</div>
|
||||||
|
<p>Belum ada tugas yang dibuat.</p>
|
||||||
|
</div>
|
||||||
|
@else
|
||||||
|
<table class="table align-middle">
|
||||||
|
<thead class="table-header text-center">
|
||||||
|
<tr>
|
||||||
|
<th>No</th>
|
||||||
|
<th>Judul Tugas</th>
|
||||||
|
<th>Mata Pelajaran</th>
|
||||||
|
<th>Kelas</th>
|
||||||
|
<th>Deadline</th>
|
||||||
|
<th>Pengumpulan</th>
|
||||||
|
<th>Aksi</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach($tugasList as $i => $tugas)
|
||||||
|
@php
|
||||||
|
$isLewat = \Carbon\Carbon::parse($tugas->deadline)->isPast();
|
||||||
|
$jumlahKumpul = $tugas->pengumpulanTugas->count();
|
||||||
|
@endphp
|
||||||
|
<tr>
|
||||||
|
<td class="text-center">{{ $tugasList->firstItem() + $i }}</td>
|
||||||
|
<td>
|
||||||
|
<div style="font-weight:600;color:#1e293b">{{ $tugas->judul_tugas }}</div>
|
||||||
|
@if($tugas->keterangan)
|
||||||
|
<div style="font-size:12px;color:#94a3b8;margin-top:2px">
|
||||||
|
{{ Str::limit($tugas->keterangan, 60) }}
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
</td>
|
||||||
|
<td class="text-center">
|
||||||
|
<span class="mapel-badge">
|
||||||
|
{{ optional(optional($tugas->mengajar)->mapel)->nama_mapel ?? '-' }}
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
|
<td class="text-center">
|
||||||
|
<span class="kelas-badge">
|
||||||
|
{{ optional(optional($tugas->mengajar)->kelas)->tingkat }}
|
||||||
|
{{ optional(optional($tugas->mengajar)->kelas)->nama_kelas ?? '-' }}
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
|
<td class="text-center">
|
||||||
|
<span class="deadline-badge {{ $isLewat ? 'deadline-lewat' : 'deadline-aktif' }}">
|
||||||
|
{{ $isLewat ? '⏰ Lewat' : '✅ Aktif' }}
|
||||||
|
</span>
|
||||||
|
<div style="font-size:12px;color:#64748b;margin-top:4px">
|
||||||
|
{{ \Carbon\Carbon::parse($tugas->deadline)->format('d M Y, H:i') }}
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td class="text-center">
|
||||||
|
<span class="submit-count">{{ $jumlahKumpul }}</span>
|
||||||
|
<span style="font-size:12px;color:#64748b"> pengumpulan</span>
|
||||||
|
</td>
|
||||||
|
<td class="text-center">
|
||||||
|
<div class="d-flex gap-1 justify-content-center">
|
||||||
|
<a href="{{ route('guru.tugas.detail', $tugas->id_tugas) }}"
|
||||||
|
class="btn-detail">
|
||||||
|
👁️ Detail
|
||||||
|
</a>
|
||||||
|
<form action="{{ route('guru.tugas.destroy', $tugas->id_tugas) }}"
|
||||||
|
method="POST"
|
||||||
|
onsubmit="return confirm('Yakin hapus tugas ini? Semua pengumpulan juga akan terhapus.')">
|
||||||
|
@csrf
|
||||||
|
@method('DELETE')
|
||||||
|
<button type="submit" class="btn-hapus">🗑️</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<div class="d-flex justify-content-end mt-3">
|
||||||
|
{{ $tugasList->links() }}
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@endsection
|
||||||
|
|
@ -30,6 +30,8 @@
|
||||||
use App\Http\Controllers\Siswa\DashboardController as SiswaDashboardController;
|
use App\Http\Controllers\Siswa\DashboardController as SiswaDashboardController;
|
||||||
use App\Http\Controllers\Siswa\MateriController as SiswaMateriController;
|
use App\Http\Controllers\Siswa\MateriController as SiswaMateriController;
|
||||||
use App\Http\Controllers\Siswa\TugasController as SiswaTugasController;
|
use App\Http\Controllers\Siswa\TugasController as SiswaTugasController;
|
||||||
|
use App\Http\Controllers\Siswa\ChallengeController as SiswaChallengeController;
|
||||||
|
use App\Http\Controllers\Siswa\LeaderboardController as SiswaLeaderboardController;
|
||||||
|
|
||||||
// ====================
|
// ====================
|
||||||
// LANDING PAGE
|
// LANDING PAGE
|
||||||
|
|
@ -131,13 +133,12 @@
|
||||||
Route::get('/leaderboard', [GuruLeaderboardController::class, 'index'])
|
Route::get('/leaderboard', [GuruLeaderboardController::class, 'index'])
|
||||||
->name('leaderboard.index');
|
->name('leaderboard.index');
|
||||||
|
|
||||||
Route::get('/materi/{id_mapel}/create', function ($id_mapel) {
|
Route::get('/materi/history', [GuruMapelController::class, 'historyMateri'])->name('materi.history');
|
||||||
return "Form Upload Materi untuk Mapel: " . $id_mapel;
|
Route::delete('/materi/{id}', [GuruMapelController::class, 'destroyMateri'])->name('materi.destroy');
|
||||||
})->name('materi.create');
|
|
||||||
|
|
||||||
Route::get('/tugas/{id_mapel}/create', function ($id_mapel) {
|
Route::get('/tugas/history', [GuruMapelController::class, 'historyTugas'])->name('tugas.history');
|
||||||
return "Form Buat Tugas untuk Mapel: " . $id_mapel;
|
Route::get('/tugas/{id}/detail', [GuruMapelController::class, 'detailTugas'])->name('tugas.detail');
|
||||||
})->name('tugas.create');
|
Route::delete('/tugas/{id}', [GuruMapelController::class, 'destroyTugas'])->name('tugas.destroy');
|
||||||
|
|
||||||
|
|
||||||
// Profil (Edit)
|
// Profil (Edit)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue