feat: add graduation archive and public document services

This commit is contained in:
2026-04-14 13:51:39 +00:00
parent d77ad72bcc
commit 58c9b47dc0
30 changed files with 2513 additions and 295 deletions
@@ -0,0 +1,99 @@
<x-master-page title="Sinkron Database" description="Kelola token integrasi read-only untuk aplikasi eksternal seperti aplikasi ujian.">
<div class="space-y-6">
<x-master-card title="Generate Token Sinkronisasi" subtitle="Token ini nantinya dipakai aplikasi ujian untuk mengambil data akademik secara aman tanpa membuka akses database langsung.">
@if ($plainToken)
<div class="mb-6 rounded-2xl border border-emerald-200 bg-emerald-50 px-4 py-4 text-sm text-emerald-700">
<p class="font-semibold">Token baru berhasil dibuat.</p>
<p class="mt-1">Salin sekarang dan simpan baik-baik. Token plain hanya ditampilkan sekali.</p>
<div class="mt-3 rounded-xl border border-emerald-200 bg-white px-4 py-3 font-mono text-xs text-slate-700 break-all">{{ $plainToken }}</div>
</div>
@endif
<form method="POST" action="{{ route('settings.sync-tokens.store') }}" class="space-y-6">
@csrf
<div class="grid grid-cols-1 gap-6 lg:grid-cols-2">
<div>
<label for="name" class="mb-2 block text-sm font-medium text-slate-700">Nama Token</label>
<input id="name" name="name" type="text" value="{{ old('name') }}" class="h-12 w-full rounded-2xl border border-slate-200 bg-white px-4 text-sm text-slate-700 focus:border-indigo-300 focus:outline-none focus:ring-4 focus:ring-indigo-100" placeholder="Contoh: Sinkron Aplikasi Ujian" required>
<x-input-error :messages="$errors->get('name')" class="mt-2" />
</div>
</div>
<div>
<p class="mb-3 text-sm font-medium text-slate-700">Hak Akses Data</p>
<div class="grid grid-cols-1 gap-3 sm:grid-cols-2 xl:grid-cols-4">
@foreach ([
'academic_years' => 'Tahun Ajaran',
'departments' => 'Jurusan',
'classes' => 'Kelas',
'students' => 'Siswa',
] as $value => $label)
<label class="flex items-center gap-3 rounded-2xl border border-slate-200 bg-slate-50 px-4 py-3 text-sm text-slate-700">
<input type="checkbox" name="abilities[]" value="{{ $value }}" class="rounded border-slate-300 text-indigo-600 focus:ring-indigo-500" @checked(collect(old('abilities', ['academic_years', 'departments', 'classes', 'students']))->contains($value))>
<span>{{ $label }}</span>
</label>
@endforeach
</div>
</div>
<div class="flex flex-wrap items-center gap-3">
<button type="submit" class="inline-flex items-center rounded-2xl bg-indigo-600 px-5 py-3 text-sm font-semibold text-white shadow-lg shadow-indigo-200 transition hover:bg-indigo-700">
Generate Token
</button>
</div>
</form>
</x-master-card>
<x-master-card title="Daftar Token Sinkronisasi" subtitle="Token yang sudah dibuat untuk integrasi eksternal. Token yang direvoke tidak boleh dipakai lagi.">
<div class="overflow-x-auto">
<table class="min-w-full divide-y divide-slate-200 text-sm">
<thead class="bg-slate-50 text-left text-slate-500">
<tr>
<th class="px-4 py-3 font-semibold">Nama</th>
<th class="px-4 py-3 font-semibold">Hak Akses</th>
<th class="px-4 py-3 font-semibold">Dibuat Oleh</th>
<th class="px-4 py-3 font-semibold">Terakhir Dipakai</th>
<th class="px-4 py-3 font-semibold">Status</th>
<th class="px-4 py-3 font-semibold text-right">Aksi</th>
</tr>
</thead>
<tbody class="divide-y divide-slate-100 bg-white">
@forelse ($tokens as $token)
<tr>
<td class="px-4 py-3 font-medium text-slate-900">{{ $token->name }}</td>
<td class="px-4 py-3 text-slate-600">{{ collect($token->abilities ?? [])->join(', ') ?: '-' }}</td>
<td class="px-4 py-3 text-slate-600">{{ $token->creator?->name ?? '-' }}</td>
<td class="px-4 py-3 text-slate-600">{{ $token->last_used_at?->format('d M Y H:i') ?? 'Belum pernah' }}</td>
<td class="px-4 py-3">
@if ($token->revoked_at)
<span class="inline-flex rounded-full bg-rose-100 px-3 py-1 text-xs font-semibold text-rose-700">Nonaktif</span>
@else
<span class="inline-flex rounded-full bg-emerald-100 px-3 py-1 text-xs font-semibold text-emerald-700">Aktif</span>
@endif
</td>
<td class="px-4 py-3 text-right">
@if (! $token->revoked_at)
<form method="POST" action="{{ route('settings.sync-tokens.revoke', $token) }}" onsubmit="return confirm('Nonaktifkan token ini?')" class="inline-flex">
@csrf
@method('PATCH')
<button type="submit" class="inline-flex items-center rounded-xl border border-rose-200 bg-rose-50 px-3 py-2 text-xs font-semibold text-rose-700 transition hover:bg-rose-100">
Revoke
</button>
</form>
@else
<span class="text-xs text-slate-400">Sudah direvoke</span>
@endif
</td>
</tr>
@empty
<tr>
<td colspan="6" class="px-4 py-10 text-center text-slate-500">Belum ada token sinkronisasi.</td>
</tr>
@endforelse
</tbody>
</table>
</div>
</x-master-card>
</div>
</x-master-page>