Improve document type cleanup and student import reliability
This commit is contained in:
@@ -31,7 +31,13 @@
|
||||
{{ $documentType->max_file_size_kb ? number_format($documentType->max_file_size_kb / 1024, 2) . ' MB' : 'Default 5 MB' }}
|
||||
</td>
|
||||
<td class="px-6 py-4">
|
||||
<span class="rounded-full bg-indigo-100 px-3 py-1 text-xs font-semibold text-indigo-700">Dokumen: {{ $documentType->student_documents_count }}</span>
|
||||
<div class="flex flex-col gap-1">
|
||||
<span class="rounded-full bg-indigo-100 px-3 py-1 text-xs font-semibold text-indigo-700">Aktif: {{ $documentType->student_documents_count }}</span>
|
||||
@php($trashedDocumentsCount = $documentType->student_documents_with_trashed_count - $documentType->student_documents_count)
|
||||
@if ($trashedDocumentsCount > 0)
|
||||
<span class="rounded-full bg-amber-100 px-3 py-1 text-xs font-semibold text-amber-700">Arsip: {{ $trashedDocumentsCount }}</span>
|
||||
@endif
|
||||
</div>
|
||||
</td>
|
||||
<td class="px-6 py-4">
|
||||
@if ($documentType->is_required)
|
||||
@@ -50,16 +56,24 @@
|
||||
<td class="px-6 py-4">
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
<a href="{{ route('document-types.edit', $documentType) }}" class="rounded-xl border border-slate-200 px-3 py-2 text-xs font-semibold text-slate-700 transition hover:bg-slate-50">Edit</a>
|
||||
@if ($documentType->student_documents_count === 0)
|
||||
@php($trashedDocumentsCount = $documentType->student_documents_with_trashed_count - $documentType->student_documents_count)
|
||||
@if ($documentType->student_documents_count === 0 && $trashedDocumentsCount === 0)
|
||||
<form action="{{ route('document-types.destroy', $documentType) }}" method="POST" class="delete-form" data-entity="jenis dokumen {{ $documentType->name }}">
|
||||
@csrf
|
||||
@method('DELETE')
|
||||
<button type="submit" class="rounded-xl border border-rose-200 px-3 py-2 text-xs font-semibold text-rose-600 transition hover:bg-rose-50">Hapus</button>
|
||||
</form>
|
||||
@else
|
||||
<button type="button" disabled class="cursor-not-allowed rounded-xl border border-slate-200 bg-slate-100 px-3 py-2 text-xs font-semibold text-slate-400" title="Tidak bisa dihapus karena masih dipakai data dokumen siswa">
|
||||
@elseif ($documentType->student_documents_count > 0)
|
||||
<button type="button" disabled class="cursor-not-allowed rounded-xl border border-slate-200 bg-slate-100 px-3 py-2 text-xs font-semibold text-slate-400" title="Tidak bisa dihapus karena masih dipakai data dokumen siswa aktif">
|
||||
Dipakai
|
||||
</button>
|
||||
@else
|
||||
<form action="{{ route('document-types.purge-archived-documents', $documentType) }}" method="POST" class="delete-form" data-entity="arsip dokumen untuk jenis dokumen {{ $documentType->name }}" data-confirm-title="Bersihkan arsip dokumen?" data-confirm-text="Arsip dokumen siswa yang terkait akan dihapus permanen, lalu jenis dokumen ini ikut dihapus. Tindakan ini tidak bisa dibatalkan.">
|
||||
@csrf
|
||||
<button type="submit" class="rounded-xl border border-amber-200 bg-amber-50 px-3 py-2 text-xs font-semibold text-amber-700 transition hover:bg-amber-100">
|
||||
Bersihkan Arsip
|
||||
</button>
|
||||
</form>
|
||||
@endif
|
||||
</div>
|
||||
</td>
|
||||
|
||||
Reference in New Issue
Block a user