feat(backup): implement proprietary encrypted .kmh format, dual backup selection (pilih vs semua), and clean minimalist UI
This commit is contained in:
@@ -4,265 +4,173 @@
|
||||
|
||||
@section('content')
|
||||
<div class="space-y-6">
|
||||
<!-- Header Halaman -->
|
||||
<div class="flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4">
|
||||
<!-- Header Halaman (Clean Minimalist) -->
|
||||
<div class="flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4 pb-2 border-b border-slate-100">
|
||||
<div>
|
||||
<h1 class="text-2xl font-black text-slate-800 tracking-tight flex items-center gap-2.5">
|
||||
<span class="w-2.5 h-7 rounded-full bg-indigo-600 inline-block"></span>
|
||||
<span>Backup & Restore Sistem</span>
|
||||
<h1 class="text-xl font-bold text-slate-900 tracking-tight">
|
||||
Backup & Restore Sistem
|
||||
</h1>
|
||||
<p class="text-xs text-slate-500 mt-1">
|
||||
Pencadangan database MySQL dan file media sistem secara berkala untuk perlindungan data dan pemulihan bencana (<em>disaster recovery</em>).
|
||||
<p class="text-xs text-slate-500 mt-0.5">
|
||||
Pencadangan terenkripsi berformat <code>.kmh</code> khusus untuk sistem RKM-KMH. File tidak dapat dibaca oleh sistem luar.
|
||||
</p>
|
||||
</div>
|
||||
<div class="flex items-center gap-2.5 flex-wrap">
|
||||
<div class="flex items-center gap-2.5">
|
||||
<button type="button"
|
||||
onclick="openUploadBackupModal()"
|
||||
class="px-4 py-2.5 rounded-xl border border-slate-200 bg-white hover:bg-slate-50 text-slate-700 font-bold text-xs transition flex items-center gap-2 shadow-2xs">
|
||||
<i class="fa-solid fa-cloud-arrow-up text-indigo-600"></i>
|
||||
<span>Unggah File Backup</span>
|
||||
class="px-3.5 py-2 rounded-xl border border-slate-200 bg-white hover:bg-slate-50 text-slate-700 text-xs font-semibold transition shadow-2xs">
|
||||
Unggah File .kmh
|
||||
</button>
|
||||
<button type="button"
|
||||
onclick="openCreateBackupModal()"
|
||||
class="px-4 py-2.5 rounded-xl bg-indigo-600 hover:bg-indigo-700 text-white font-bold text-xs transition flex items-center gap-2 shadow-sm shadow-indigo-600/20">
|
||||
<i class="fa-solid fa-database text-xs"></i>
|
||||
<span>Buat Backup Baru</span>
|
||||
class="px-4 py-2 rounded-xl bg-indigo-600 hover:bg-indigo-700 text-white text-xs font-semibold transition shadow-xs">
|
||||
Buat Backup Baru
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Alert Notifikasi Flash -->
|
||||
@if(session('success'))
|
||||
<div class="p-4 bg-emerald-50 border border-emerald-200 rounded-2xl flex items-center justify-between text-emerald-800 text-xs font-semibold animate-scale-in">
|
||||
<div class="flex items-center gap-2.5">
|
||||
<i class="fa-solid fa-circle-check text-emerald-600 text-base flex-shrink-0"></i>
|
||||
<span>{{ session('success') }}</span>
|
||||
</div>
|
||||
<button type="button" onclick="this.parentElement.remove()" class="text-emerald-500 hover:text-emerald-700 p-1">
|
||||
<i class="fa-solid fa-xmark"></i>
|
||||
</button>
|
||||
<div class="p-3.5 bg-emerald-50 border border-emerald-200 rounded-xl flex items-center justify-between text-emerald-900 text-xs font-medium">
|
||||
<span>{{ session('success') }}</span>
|
||||
<button type="button" onclick="this.parentElement.remove()" class="text-emerald-500 hover:text-emerald-700 ml-3 text-sm">×</button>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@if(session('error'))
|
||||
<div class="p-4 bg-rose-50 border border-rose-200 rounded-2xl flex items-center justify-between text-rose-800 text-xs font-semibold animate-scale-in">
|
||||
<div class="flex items-center gap-2.5">
|
||||
<i class="fa-solid fa-triangle-exclamation text-rose-600 text-base flex-shrink-0"></i>
|
||||
<span>{{ session('error') }}</span>
|
||||
</div>
|
||||
<button type="button" onclick="this.parentElement.remove()" class="text-rose-500 hover:text-rose-700 p-1">
|
||||
<i class="fa-solid fa-xmark"></i>
|
||||
</button>
|
||||
<div class="p-3.5 bg-rose-50 border border-rose-200 rounded-xl flex items-center justify-between text-rose-900 text-xs font-medium">
|
||||
<span>{{ session('error') }}</span>
|
||||
<button type="button" onclick="this.parentElement.remove()" class="text-rose-500 hover:text-rose-700 ml-3 text-sm">×</button>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<!-- Kartu Metrik Ringkasan Backup & Database -->
|
||||
<div class="grid grid-cols-2 lg:grid-cols-4 gap-3 sm:gap-4">
|
||||
<!-- Total File Backup -->
|
||||
<div class="bg-white rounded-2xl border border-slate-200/80 p-4 shadow-2xs relative overflow-hidden group hover:border-indigo-300 transition">
|
||||
<div class="flex items-center justify-between">
|
||||
<span class="text-[11px] font-bold text-slate-400 uppercase tracking-wider block">Total File Backup</span>
|
||||
<span class="w-8 h-8 rounded-xl bg-indigo-50 text-indigo-600 flex items-center justify-center text-xs">
|
||||
<i class="fa-solid fa-server"></i>
|
||||
</span>
|
||||
<!-- Ringkasan Metrik (Clean & Tanpa Ikon Berlebihan) -->
|
||||
<div class="grid grid-cols-1 sm:grid-cols-3 gap-4">
|
||||
<div class="bg-white rounded-2xl border border-slate-200/80 p-4 shadow-2xs">
|
||||
<span class="text-[11px] font-semibold text-slate-400 uppercase tracking-wider block">Total File Backup</span>
|
||||
<div class="flex items-baseline gap-2 mt-1.5">
|
||||
<span class="text-2xl font-bold text-slate-900">{{ number_format($stats['total_backups']) }}</span>
|
||||
<span class="text-xs text-slate-500 font-medium">file (.kmh)</span>
|
||||
</div>
|
||||
<span class="text-xl sm:text-2xl font-black text-slate-900 mt-2 block">{{ number_format($stats['total_backups']) }}</span>
|
||||
<span class="text-[10px] text-slate-400 font-medium block mt-1">Arsip tersimpan di server</span>
|
||||
<span class="text-[11px] text-slate-400 block mt-1">Total kapasitas: {{ $stats['total_size_human'] }}</span>
|
||||
</div>
|
||||
|
||||
<!-- Total Ukuran Storage -->
|
||||
<div class="bg-white rounded-2xl border border-slate-200/80 p-4 shadow-2xs relative overflow-hidden group hover:border-indigo-300 transition">
|
||||
<div class="flex items-center justify-between">
|
||||
<span class="text-[11px] font-bold text-slate-400 uppercase tracking-wider block">Ukuran Arsip</span>
|
||||
<span class="w-8 h-8 rounded-xl bg-emerald-50 text-emerald-600 flex items-center justify-center text-xs">
|
||||
<i class="fa-solid fa-hard-drive"></i>
|
||||
<div class="bg-white rounded-2xl border border-slate-200/80 p-4 shadow-2xs">
|
||||
<span class="text-[11px] font-semibold text-slate-400 uppercase tracking-wider block">Backup Terakhir</span>
|
||||
<div class="mt-1.5">
|
||||
<span class="text-sm font-bold text-slate-900 block truncate">
|
||||
{{ $stats['last_backup']['created_at_human'] ?? 'Belum ada backup' }}
|
||||
</span>
|
||||
<span class="text-[11px] text-slate-400 block mt-1 truncate font-mono">
|
||||
{{ $stats['last_backup']['filename'] ?? '-' }}
|
||||
</span>
|
||||
</div>
|
||||
<span class="text-xl sm:text-2xl font-black text-slate-900 mt-2 block">{{ $stats['total_size_human'] }}</span>
|
||||
<span class="text-[10px] text-slate-400 font-medium block mt-1">Kapasitas folder storage/app/backups</span>
|
||||
</div>
|
||||
|
||||
<!-- Backup Terakhir -->
|
||||
<div class="bg-white rounded-2xl border border-slate-200/80 p-4 shadow-2xs relative overflow-hidden group hover:border-indigo-300 transition">
|
||||
<div class="flex items-center justify-between">
|
||||
<span class="text-[11px] font-bold text-slate-400 uppercase tracking-wider block">Backup Terakhir</span>
|
||||
<span class="w-8 h-8 rounded-xl bg-amber-50 text-amber-600 flex items-center justify-center text-xs">
|
||||
<i class="fa-solid fa-clock-rotate-left"></i>
|
||||
</span>
|
||||
<div class="bg-white rounded-2xl border border-slate-200/80 p-4 shadow-2xs">
|
||||
<span class="text-[11px] font-semibold text-slate-400 uppercase tracking-wider block">Database Aktif</span>
|
||||
<div class="flex items-baseline gap-2 mt-1.5">
|
||||
<span class="text-base font-bold text-slate-900 font-mono">{{ $stats['database_name'] }}</span>
|
||||
<span class="text-xs text-slate-500">({{ $stats['table_count'] }} Tabel)</span>
|
||||
</div>
|
||||
<span class="text-sm sm:text-base font-bold text-slate-900 mt-2 block truncate" title="{{ $stats['last_backup']['created_at_human'] ?? '-' }}">
|
||||
{{ $stats['last_backup']['created_at_human'] ?? 'Belum ada backup' }}
|
||||
</span>
|
||||
<span class="text-[10px] text-slate-400 font-medium block mt-1 truncate" title="{{ $stats['last_backup']['filename'] ?? '-' }}">
|
||||
{{ $stats['last_backup']['filename'] ?? 'Klik Buat Backup Baru' }}
|
||||
</span>
|
||||
<span class="text-[11px] text-slate-400 block mt-1">Estimasi data: {{ $stats['estimated_db_size_human'] }}</span>
|
||||
</div>
|
||||
|
||||
<!-- Info Database Aktif -->
|
||||
<div class="bg-white rounded-2xl border border-slate-200/80 p-4 shadow-2xs relative overflow-hidden group hover:border-indigo-300 transition">
|
||||
<div class="flex items-center justify-between">
|
||||
<span class="text-[11px] font-bold text-slate-400 uppercase tracking-wider block">Database Aktif</span>
|
||||
<span class="w-8 h-8 rounded-xl bg-purple-50 text-purple-600 flex items-center justify-center text-xs">
|
||||
<i class="fa-solid fa-database"></i>
|
||||
</span>
|
||||
</div>
|
||||
<span class="text-sm sm:text-base font-bold text-slate-900 mt-2 block truncate">
|
||||
{{ $stats['database_name'] }}
|
||||
</span>
|
||||
<span class="text-[10px] text-slate-400 font-medium block mt-1">
|
||||
{{ $stats['table_count'] }} Tabel • Estimasi {{ $stats['estimated_db_size_human'] }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Banner Panduan Praktik Terbaik Backup -->
|
||||
<div class="bg-gradient-to-r from-indigo-50/80 via-slate-50 to-emerald-50/60 border border-indigo-100 rounded-2xl p-4 sm:p-5 flex flex-col md:flex-row items-start md:items-center justify-between gap-4">
|
||||
<div class="flex items-start gap-3.5">
|
||||
<div class="w-10 h-10 rounded-2xl bg-indigo-600 text-white flex items-center justify-center text-base flex-shrink-0 shadow-sm shadow-indigo-600/20">
|
||||
<i class="fa-solid fa-shield-halved"></i>
|
||||
</div>
|
||||
<div class="space-y-0.5">
|
||||
<h4 class="text-xs font-bold text-slate-800 flex items-center gap-2">
|
||||
<span>Panduan Keamanan & Pemulihan Sistem</span>
|
||||
<span class="px-2 py-0.5 rounded-md bg-indigo-100 text-indigo-700 text-[10px] font-bold">Rekomendasi</span>
|
||||
</h4>
|
||||
<p class="text-[11px] text-slate-600 leading-relaxed max-w-3xl">
|
||||
Disarankan untuk mengunduh arsip backup secara teratur ke perangkat fisik atau penyimpanan cloud terpisah. Sebelum melakukan pembaruan besar atau perubahan skema data, buat selalu backup terbaru sebagai cadangan darurat.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<button type="button"
|
||||
onclick="openCreateBackupModal()"
|
||||
class="px-3.5 py-2 rounded-xl bg-white border border-indigo-200 text-indigo-700 hover:bg-indigo-50 font-bold text-xs transition flex items-center gap-1.5 flex-shrink-0 shadow-2xs">
|
||||
<i class="fa-solid fa-circle-plus text-indigo-600"></i>
|
||||
<span>Cadangkan Sekarang</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- Tabel Daftar File Backup -->
|
||||
<div class="bg-white border border-slate-200/80 rounded-2xl shadow-sm overflow-hidden">
|
||||
<div class="p-4 sm:px-6 border-b border-slate-100 flex items-center justify-between gap-4 flex-wrap">
|
||||
<div>
|
||||
<h3 class="text-sm font-bold text-slate-900 flex items-center gap-2">
|
||||
<i class="fa-solid fa-folder-open text-indigo-600"></i>
|
||||
<span>Daftar Arsip Backup Tersimpan</span>
|
||||
</h3>
|
||||
<p class="text-[11px] text-slate-400 mt-0.5">Seluruh file tersimpan secara aman di direktori lokal server <code>storage/app/backups/</code></p>
|
||||
</div>
|
||||
<div class="text-[11px] font-bold text-slate-500 bg-slate-50 border border-slate-200 px-3 py-1 rounded-xl">
|
||||
<span>{{ count($backups) }} File Tersedia</span>
|
||||
</div>
|
||||
<div class="bg-white border border-slate-200/80 rounded-2xl shadow-2xs overflow-hidden">
|
||||
<div class="px-5 py-3.5 border-b border-slate-100 flex items-center justify-between">
|
||||
<h2 class="text-xs font-bold uppercase tracking-wider text-slate-600">
|
||||
Daftar Arsip Backup
|
||||
</h2>
|
||||
<span class="text-[11px] text-slate-400 font-mono">
|
||||
storage/app/backups/
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="overflow-x-auto">
|
||||
<table class="w-full text-left text-xs">
|
||||
<thead>
|
||||
<tr class="bg-slate-50/80 border-b border-slate-100 text-slate-500 font-bold uppercase tracking-wider text-[11px]">
|
||||
<th class="py-3 px-4 sm:px-6">Nama File Backup</th>
|
||||
<th class="py-3 px-4">Jenis Backup</th>
|
||||
<th class="py-3 px-4">Ukuran File</th>
|
||||
<tr class="bg-slate-50/70 border-b border-slate-100 text-slate-400 font-bold uppercase tracking-wider text-[10px]">
|
||||
<th class="py-3 px-5">Nama File</th>
|
||||
<th class="py-3 px-4">Tipe Backup</th>
|
||||
<th class="py-3 px-4">Ukuran</th>
|
||||
<th class="py-3 px-4">Tanggal Dibuat</th>
|
||||
<th class="py-3 px-4 sm:px-6 text-center">Aksi & Pemulihan</th>
|
||||
<th class="py-3 px-5 text-right">Aksi</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="divide-y divide-slate-100 font-medium">
|
||||
@forelse($backups as $b)
|
||||
@php
|
||||
$isFull = ($b['type'] === 'full');
|
||||
$isFull = ($b['type'] === 'semua');
|
||||
@endphp
|
||||
<tr class="hover:bg-slate-50/70 transition">
|
||||
<tr class="hover:bg-slate-50/50 transition">
|
||||
<!-- Nama File -->
|
||||
<td class="py-3.5 px-4 sm:px-6">
|
||||
<div class="flex items-center gap-3">
|
||||
<div class="w-9 h-9 rounded-xl flex items-center justify-center text-sm flex-shrink-0 {{ $isFull ? 'bg-amber-50 text-amber-600 border border-amber-200' : 'bg-indigo-50 text-indigo-600 border border-indigo-200' }}">
|
||||
@if($isFull)
|
||||
<i class="fa-solid fa-file-zipper"></i>
|
||||
@else
|
||||
<i class="fa-solid fa-file-code"></i>
|
||||
@endif
|
||||
</div>
|
||||
<div class="min-w-0">
|
||||
<p class="font-bold text-slate-900 text-xs font-mono truncate" title="{{ $b['filename'] }}">
|
||||
{{ $b['filename'] }}
|
||||
</p>
|
||||
<p class="text-[10px] text-slate-400 mt-0.5">
|
||||
{{ $isFull ? 'Arsip ZIP (Database + Media Upload)' : 'File Skrip SQL Murni' }}
|
||||
</p>
|
||||
</div>
|
||||
<td class="py-3 px-5">
|
||||
<div class="flex items-center gap-2">
|
||||
<span class="font-mono font-semibold text-slate-800 text-xs">
|
||||
{{ $b['filename'] }}
|
||||
</span>
|
||||
@if($b['is_kmh'])
|
||||
<span class="px-1.5 py-0.2 rounded text-[9px] font-bold bg-indigo-50 text-indigo-700 border border-indigo-200">
|
||||
.kmh
|
||||
</span>
|
||||
@endif
|
||||
</div>
|
||||
</td>
|
||||
|
||||
<!-- Jenis Backup -->
|
||||
<td class="py-3.5 px-4 whitespace-nowrap">
|
||||
<!-- Tipe Backup -->
|
||||
<td class="py-3 px-4 whitespace-nowrap">
|
||||
@if($isFull)
|
||||
<span class="inline-flex items-center gap-1.5 px-2.5 py-1 rounded-lg text-[10px] font-bold bg-amber-50 text-amber-800 border border-amber-200">
|
||||
<i class="fa-solid fa-box-archive text-[9px]"></i>
|
||||
<span>Full Backup + Media</span>
|
||||
<span class="inline-block px-2 py-0.5 rounded text-[11px] font-semibold bg-emerald-50 text-emerald-800 border border-emerald-200">
|
||||
Backup Semua
|
||||
</span>
|
||||
@else
|
||||
<span class="inline-flex items-center gap-1.5 px-2.5 py-1 rounded-lg text-[10px] font-bold bg-indigo-50 text-indigo-700 border border-indigo-200">
|
||||
<i class="fa-solid fa-database text-[9px]"></i>
|
||||
<span>Database SQL</span>
|
||||
<span class="inline-block px-2 py-0.5 rounded text-[11px] font-semibold bg-slate-100 text-slate-700 border border-slate-200">
|
||||
Pilih Backup
|
||||
</span>
|
||||
@endif
|
||||
</td>
|
||||
|
||||
<!-- Ukuran File -->
|
||||
<td class="py-3.5 px-4 whitespace-nowrap font-mono text-slate-700 font-semibold text-xs">
|
||||
<td class="py-3 px-4 whitespace-nowrap font-mono text-slate-600">
|
||||
{{ $b['size_human'] }}
|
||||
</td>
|
||||
|
||||
<!-- Tanggal Dibuat -->
|
||||
<td class="py-3.5 px-4 whitespace-nowrap">
|
||||
<span class="text-slate-800 font-semibold block text-xs">{{ $b['created_at_human'] }}</span>
|
||||
<span class="text-[10px] text-slate-400">{{ $b['created_at']->diffForHumans() }}</span>
|
||||
<td class="py-3 px-4 whitespace-nowrap text-slate-600">
|
||||
<span>{{ $b['created_at_human'] }}</span>
|
||||
</td>
|
||||
|
||||
<!-- Aksi -->
|
||||
<td class="py-3.5 px-4 sm:px-6 text-center whitespace-nowrap">
|
||||
<div class="inline-flex items-center gap-2">
|
||||
<!-- Unduh -->
|
||||
<!-- Aksi (Clean text buttons) -->
|
||||
<td class="py-3 px-5 text-right whitespace-nowrap">
|
||||
<div class="inline-flex items-center gap-1.5">
|
||||
<a href="{{ route('admin.backups.download', $b['filename']) }}"
|
||||
class="px-2.5 py-1.5 rounded-xl bg-slate-100 hover:bg-indigo-50 text-slate-700 hover:text-indigo-700 text-xs font-bold transition flex items-center gap-1.5 border border-slate-200 hover:border-indigo-200"
|
||||
title="Unduh file backup ke komputer lokal">
|
||||
<i class="fa-solid fa-download text-[11px]"></i>
|
||||
<span class="hidden sm:inline">Unduh</span>
|
||||
class="px-2.5 py-1 rounded-lg border border-slate-200 bg-white hover:bg-slate-50 text-slate-700 font-semibold text-[11px] transition">
|
||||
Unduh
|
||||
</a>
|
||||
|
||||
<!-- Pulihkan / Restore -->
|
||||
<button type="button"
|
||||
onclick="openRestoreModal('{{ $b['filename'] }}', '{{ $b['type_label'] }}', '{{ $b['size_human'] }}')"
|
||||
class="px-2.5 py-1.5 rounded-xl bg-amber-50 hover:bg-amber-100 text-amber-800 hover:text-amber-900 text-xs font-bold transition flex items-center gap-1.5 border border-amber-200"
|
||||
title="Pulihkan database & data sistem dari backup ini">
|
||||
<i class="fa-solid fa-rotate-left text-[11px]"></i>
|
||||
<span>Pulihkan</span>
|
||||
class="px-2.5 py-1 rounded-lg border border-amber-300 bg-amber-50 hover:bg-amber-100 text-amber-900 font-semibold text-[11px] transition">
|
||||
Pulihkan
|
||||
</button>
|
||||
|
||||
<!-- Hapus -->
|
||||
<button type="button"
|
||||
onclick="openDeleteBackupModal('{{ $b['filename'] }}')"
|
||||
class="w-8 h-8 rounded-xl bg-slate-100 hover:bg-rose-50 text-slate-400 hover:text-rose-600 flex items-center justify-center transition border border-transparent hover:border-rose-200"
|
||||
title="Hapus file backup ini dari server">
|
||||
<i class="fa-solid fa-trash-can text-xs"></i>
|
||||
class="px-2.5 py-1 rounded-lg border border-rose-200 bg-white hover:bg-rose-50 text-rose-700 font-semibold text-[11px] transition">
|
||||
Hapus
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@empty
|
||||
<tr>
|
||||
<td colspan="5" class="py-12 px-4 text-center">
|
||||
<div class="w-14 h-14 rounded-2xl bg-indigo-50 text-indigo-600 flex items-center justify-center text-2xl mx-auto mb-3">
|
||||
<i class="fa-solid fa-database"></i>
|
||||
</div>
|
||||
<h4 class="text-sm font-bold text-slate-800">Belum Ada File Backup Tersimpan</h4>
|
||||
<p class="text-xs text-slate-400 mt-1 max-w-sm mx-auto">
|
||||
Amankan data sistem Anda dengan membuat cadangan database pertama sekarang.
|
||||
</p>
|
||||
<td colspan="5" class="py-10 text-center">
|
||||
<p class="text-xs text-slate-500 font-medium">Belum ada file backup yang tersimpan di server.</p>
|
||||
<button type="button"
|
||||
onclick="openCreateBackupModal()"
|
||||
class="mt-4 px-4 py-2 bg-indigo-600 hover:bg-indigo-700 text-white rounded-xl text-xs font-bold shadow-sm transition inline-flex items-center gap-2">
|
||||
<i class="fa-solid fa-circle-plus"></i>
|
||||
<span>Buat Backup Baru</span>
|
||||
class="mt-2.5 px-3.5 py-1.5 bg-indigo-600 hover:bg-indigo-700 text-white rounded-xl text-xs font-semibold transition">
|
||||
Buat Backup Pertama
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -274,70 +182,132 @@
|
||||
</div>
|
||||
|
||||
<!-- ========================================================================= -->
|
||||
<!-- MODAL: BUAT BACKUP BARU -->
|
||||
<!-- MODAL: BUAT BACKUP (2 PILIHAN: PILIH BACKUP / BACKUP SEMUA) -->
|
||||
<!-- ========================================================================= -->
|
||||
<div id="createBackupModal" data-backdrop="static" class="fixed inset-0 z-50 hidden bg-slate-900/60 backdrop-blur-sm flex items-center justify-center p-4 overflow-y-auto">
|
||||
<div class="bg-white rounded-3xl max-w-md w-full shadow-2xl overflow-hidden animate-scale-in border border-slate-100">
|
||||
<div class="px-6 py-4.5 border-b border-slate-100 flex items-center justify-between">
|
||||
<h3 class="text-base font-bold text-slate-800 flex items-center gap-2">
|
||||
<i class="fa-solid fa-database text-indigo-600"></i>
|
||||
<span>Buat Backup Baru</span>
|
||||
</h3>
|
||||
<button type="button" onclick="closeCreateBackupModal()" class="text-slate-400 hover:text-slate-600 p-1">
|
||||
<i class="fa-solid fa-xmark text-lg"></i>
|
||||
</button>
|
||||
<div id="createBackupModal" data-backdrop="static" class="fixed inset-0 z-50 hidden bg-slate-900/50 backdrop-blur-xs flex items-center justify-center p-4 overflow-y-auto">
|
||||
<div class="bg-white rounded-2xl max-w-2xl w-full shadow-xl overflow-hidden animate-scale-in border border-slate-100 flex flex-col max-h-[92vh]">
|
||||
<!-- Header Modal -->
|
||||
<div class="px-5 py-4 border-b border-slate-100 flex items-center justify-between flex-shrink-0">
|
||||
<div>
|
||||
<h3 class="text-base font-bold text-slate-900">Buat Backup Baru</h3>
|
||||
<p class="text-xs text-slate-400 mt-0.5">Pilih mode pencadangan terenkripsi berformat .kmh.</p>
|
||||
</div>
|
||||
<button type="button" onclick="closeCreateBackupModal()" class="text-slate-400 hover:text-slate-600 text-lg p-1">×</button>
|
||||
</div>
|
||||
|
||||
<form id="createBackupForm" method="POST" action="{{ route('admin.backups.store') }}" onsubmit="handleBackupSubmit(this)" class="p-6 space-y-4">
|
||||
<form id="createBackupForm" method="POST" action="{{ route('admin.backups.store') }}" onsubmit="handleBackupSubmit(this)" class="flex flex-col flex-1 min-h-0">
|
||||
@csrf
|
||||
|
||||
<p class="text-xs text-slate-500 leading-relaxed">
|
||||
Pilih cakupan data yang ingin dicadangkan. Proses ini akan berjalan di latar belakang dan menyimpan file hasil cadangan di server.
|
||||
</p>
|
||||
<div class="p-5 space-y-4 overflow-y-auto flex-1">
|
||||
<!-- Dua Pilihan Utama -->
|
||||
<div class="grid grid-cols-1 sm:grid-cols-2 gap-3">
|
||||
<!-- Opsi 1: Pilih Backup (Tabel Tertentu) -->
|
||||
<label id="scopeCardPilihan" class="p-4 rounded-xl border-2 border-indigo-600 bg-indigo-50/30 cursor-pointer transition block">
|
||||
<div class="flex items-start gap-2.5">
|
||||
<input type="radio"
|
||||
name="backup_scope"
|
||||
value="pilihan"
|
||||
id="radioScopePilihan"
|
||||
checked
|
||||
onchange="toggleBackupScopeUI('pilihan')"
|
||||
class="mt-0.5 text-indigo-600 focus:ring-indigo-500">
|
||||
<div>
|
||||
<span class="block text-xs font-bold text-slate-900">Pilih Backup</span>
|
||||
<span class="block text-[11px] text-slate-500 mt-0.5 leading-relaxed">
|
||||
Pilih tabel atau modul data tertentu yang ingin dicadangkan sesuai kebutuhan.
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</label>
|
||||
|
||||
<!-- Pilihan Jenis Backup -->
|
||||
<div class="space-y-3">
|
||||
<!-- Opsi 1: Database Saja -->
|
||||
<label class="block p-4 rounded-2xl border-2 border-indigo-600 bg-indigo-50/40 cursor-pointer transition relative has-[:checked]:border-indigo-600 has-[:checked]:bg-indigo-50/40">
|
||||
<div class="flex items-start gap-3">
|
||||
<input type="radio" name="type" value="database" checked class="mt-0.5 text-indigo-600 focus:ring-indigo-500">
|
||||
<div class="flex-1">
|
||||
<span class="block text-xs font-bold text-slate-900">Database Saja (.sql)</span>
|
||||
<span class="block text-[11px] text-slate-500 mt-0.5 leading-relaxed">
|
||||
Mencadangkan seluruh 29 tabel aktif MySQL dan data operasional. Proses sangat cepat dan ukuran file ringan (~500 KB).
|
||||
</span>
|
||||
<span class="inline-block mt-2 px-2 py-0.5 rounded-md bg-emerald-100 text-emerald-800 font-bold text-[10px]">
|
||||
Direkomendasikan Rutin
|
||||
</span>
|
||||
<!-- Opsi 2: Backup Semua -->
|
||||
<label id="scopeCardSemua" class="p-4 rounded-xl border-2 border-slate-200 hover:border-slate-300 bg-white cursor-pointer transition block">
|
||||
<div class="flex items-start gap-2.5">
|
||||
<input type="radio"
|
||||
name="backup_scope"
|
||||
value="semua"
|
||||
id="radioScopeSemua"
|
||||
onchange="toggleBackupScopeUI('semua')"
|
||||
class="mt-0.5 text-indigo-600 focus:ring-indigo-500">
|
||||
<div>
|
||||
<span class="block text-xs font-bold text-slate-900">Backup Semua</span>
|
||||
<span class="block text-[11px] text-slate-500 mt-0.5 leading-relaxed">
|
||||
Cadangkan seluruh tabel database (29 tabel) + seluruh file media upload.
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<!-- Bagian Detail Checklist untuk "Pilih Backup" -->
|
||||
<div id="pilihanTableSection" class="space-y-3 pt-2">
|
||||
<div class="flex items-center justify-between pb-1 border-b border-slate-100">
|
||||
<div>
|
||||
<span class="text-xs font-bold text-slate-800">Daftar Tabel yang Dicadangkan</span>
|
||||
<span class="text-[11px] text-slate-400 block">Centang tabel yang ingin dimasukkan ke dalam file .kmh</span>
|
||||
</div>
|
||||
<div class="flex items-center gap-2">
|
||||
<button type="button" onclick="selectAllTables(true)" class="text-[11px] text-indigo-600 hover:underline font-semibold">
|
||||
Pilih Semua
|
||||
</button>
|
||||
<span class="text-slate-300">•</span>
|
||||
<button type="button" onclick="selectAllTables(false)" class="text-[11px] text-slate-500 hover:underline font-semibold">
|
||||
Batal Pilih
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</label>
|
||||
|
||||
<!-- Opsi 2: Full Backup -->
|
||||
<label class="block p-4 rounded-2xl border-2 border-slate-200 hover:border-slate-300 bg-white cursor-pointer transition relative has-[:checked]:border-indigo-600 has-[:checked]:bg-indigo-50/40">
|
||||
<div class="flex items-start gap-3">
|
||||
<input type="radio" name="type" value="full" class="mt-0.5 text-indigo-600 focus:ring-indigo-500">
|
||||
<div class="flex-1">
|
||||
<span class="block text-xs font-bold text-slate-900">Full Backup Lengkap (.zip)</span>
|
||||
<span class="block text-[11px] text-slate-500 mt-0.5 leading-relaxed">
|
||||
Mencadangkan Database SQL + seluruh berkas media upload di <code>storage/app/public</code> (foto karyawan, foto kendaraan, SIMPER).
|
||||
</span>
|
||||
<span class="inline-block mt-2 px-2 py-0.5 rounded-md bg-slate-100 text-slate-600 font-bold text-[10px]">
|
||||
Menyeluruh & Total
|
||||
</span>
|
||||
</div>
|
||||
<!-- Kelompok Modul Tabel -->
|
||||
<div class="space-y-3 max-h-64 overflow-y-auto pr-1">
|
||||
@foreach($tableGroups as $groupKey => $group)
|
||||
@if(!empty($group['tables']))
|
||||
<div class="border border-slate-200/80 rounded-xl p-3 bg-slate-50/50">
|
||||
<div class="flex items-center justify-between mb-1.5">
|
||||
<span class="text-xs font-bold text-slate-800">{{ $group['name'] }}</span>
|
||||
<span class="text-[10px] text-slate-400">{{ count($group['tables']) }} Tabel</span>
|
||||
</div>
|
||||
<div class="grid grid-cols-1 sm:grid-cols-2 gap-1.5">
|
||||
@foreach($group['tables'] as $tbl)
|
||||
<label class="flex items-center gap-2 text-xs text-slate-700 cursor-pointer select-none py-0.5 hover:text-slate-900">
|
||||
<input type="checkbox"
|
||||
name="selected_tables[]"
|
||||
value="{{ $tbl }}"
|
||||
checked
|
||||
class="rounded border-slate-300 text-indigo-600 focus:ring-indigo-500 table-checkbox">
|
||||
<span class="font-mono text-[11px]">{{ $tbl }}</span>
|
||||
</label>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
@endforeach
|
||||
</div>
|
||||
</label>
|
||||
|
||||
<!-- Opsi Sertakan Media untuk Pilih Backup -->
|
||||
<label class="flex items-center gap-2 text-xs text-slate-700 cursor-pointer pt-2 select-none border-t border-slate-100">
|
||||
<input type="checkbox" name="include_media" value="1" class="rounded border-slate-300 text-indigo-600 focus:ring-indigo-500">
|
||||
<span class="text-xs font-medium">Sertakan juga berkas media upload di <code>storage/app/public</code></span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<!-- Bagian Penjelasan Ringkas untuk "Backup Semua" -->
|
||||
<div id="semuaTableSection" class="hidden p-4 rounded-xl bg-slate-50 border border-slate-200 text-xs text-slate-600 space-y-1 leading-relaxed">
|
||||
<p class="font-bold text-slate-800">Cakupan Backup Semua:</p>
|
||||
<ul class="list-disc list-inside text-[11px] space-y-0.5 text-slate-600 pl-1">
|
||||
<li>Seluruh tabel dan struktur database MySQL sistem RKM-KMH.</li>
|
||||
<li>Seluruh file media upload (foto profil karyawan, foto armada kendaraan, stiker izin SIMPER).</li>
|
||||
<li>Dikompresi dan dienkripsi AES-256-CBC ke dalam format tunggal <strong>.kmh</strong>.</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Tombol Footer -->
|
||||
<div class="pt-4 border-t border-slate-100 flex items-center justify-end gap-2.5">
|
||||
<button type="button" onclick="closeCreateBackupModal()" class="px-4 py-2.5 bg-slate-100 hover:bg-slate-200 text-slate-600 rounded-xl text-xs font-bold transition">
|
||||
<!-- Footer Modal -->
|
||||
<div class="px-5 py-3.5 bg-slate-50 border-t border-slate-100 flex items-center justify-end gap-2.5 flex-shrink-0">
|
||||
<button type="button" onclick="closeCreateBackupModal()" class="px-3.5 py-2 rounded-xl border border-slate-200 bg-white text-slate-600 font-semibold text-xs transition">
|
||||
Batal
|
||||
</button>
|
||||
<button type="submit" id="createBackupSubmitBtn" class="px-5 py-2.5 bg-indigo-600 hover:bg-indigo-700 text-white rounded-xl text-xs font-bold shadow-sm transition flex items-center gap-2">
|
||||
<i class="fa-solid fa-play text-[10px]"></i>
|
||||
<span id="createBackupBtnText">Mulai Pencadangan</span>
|
||||
<button type="submit" id="createBackupSubmitBtn" class="px-4 py-2 rounded-xl bg-indigo-600 hover:bg-indigo-700 text-white font-semibold text-xs transition shadow-xs">
|
||||
<span id="createBackupBtnText">Mulai Pencadangan (.kmh)</span>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
@@ -345,52 +315,40 @@
|
||||
</div>
|
||||
|
||||
<!-- ========================================================================= -->
|
||||
<!-- MODAL: UNGGAH FILE BACKUP -->
|
||||
<!-- MODAL: UNGGAH FILE BACKUP (.KMH) -->
|
||||
<!-- ========================================================================= -->
|
||||
<div id="uploadBackupModal" data-backdrop="static" class="fixed inset-0 z-50 hidden bg-slate-900/60 backdrop-blur-sm flex items-center justify-center p-4 overflow-y-auto">
|
||||
<div class="bg-white rounded-3xl max-w-md w-full shadow-2xl overflow-hidden animate-scale-in border border-slate-100">
|
||||
<div class="px-6 py-4.5 border-b border-slate-100 flex items-center justify-between">
|
||||
<h3 class="text-base font-bold text-slate-800 flex items-center gap-2">
|
||||
<i class="fa-solid fa-cloud-arrow-up text-indigo-600"></i>
|
||||
<span>Unggah File Backup</span>
|
||||
</h3>
|
||||
<button type="button" onclick="closeUploadBackupModal()" class="text-slate-400 hover:text-slate-600 p-1">
|
||||
<i class="fa-solid fa-xmark text-lg"></i>
|
||||
</button>
|
||||
<div id="uploadBackupModal" data-backdrop="static" class="fixed inset-0 z-50 hidden bg-slate-900/50 backdrop-blur-xs flex items-center justify-center p-4">
|
||||
<div class="bg-white rounded-2xl max-w-md w-full shadow-xl overflow-hidden animate-scale-in border border-slate-100">
|
||||
<div class="px-5 py-4 border-b border-slate-100 flex items-center justify-between">
|
||||
<h3 class="text-base font-bold text-slate-900">Unggah File Backup (.kmh)</h3>
|
||||
<button type="button" onclick="closeUploadBackupModal()" class="text-slate-400 hover:text-slate-600 text-lg p-1">×</button>
|
||||
</div>
|
||||
|
||||
<form id="uploadBackupForm" method="POST" action="{{ route('admin.backups.upload') }}" enctype="multipart/form-data" class="p-6 space-y-4">
|
||||
<form id="uploadBackupForm" method="POST" action="{{ route('admin.backups.upload') }}" enctype="multipart/form-data" class="p-5 space-y-4">
|
||||
@csrf
|
||||
|
||||
<!-- Upload Drop Area -->
|
||||
<div>
|
||||
<label class="block text-xs font-bold text-slate-700 mb-2">Pilih File Arsip Backup <span class="text-rose-500">*</span></label>
|
||||
<div class="border-2 border-dashed border-slate-300 hover:border-indigo-500 rounded-2xl p-6 text-center bg-slate-50/60 hover:bg-white transition cursor-pointer relative"
|
||||
<label class="block text-xs font-semibold text-slate-700 mb-2">Pilih File .kmh</label>
|
||||
<div class="border-2 border-dashed border-slate-300 hover:border-indigo-500 rounded-xl p-5 text-center bg-slate-50 hover:bg-white transition cursor-pointer"
|
||||
onclick="document.getElementById('backupFileInput').click()">
|
||||
<i class="fa-solid fa-file-arrow-up text-3xl text-indigo-600 mb-2 block"></i>
|
||||
<p class="text-xs font-bold text-slate-800" id="uploadFileName">Klik untuk memilih file backup</p>
|
||||
<p class="text-[11px] text-slate-400 mt-1">Mendukung format SQL (.sql), Arsip ZIP (.zip), atau Gzip (.sql.gz)</p>
|
||||
<p class="text-xs font-bold text-slate-800" id="uploadFileName">Klik untuk memilih file</p>
|
||||
<p class="text-[11px] text-slate-400 mt-1">Format arsip terenkripsi: .kmh (Maks. 200 MB)</p>
|
||||
<input type="file"
|
||||
name="backup_file"
|
||||
id="backupFileInput"
|
||||
accept=".sql,.zip,.gz"
|
||||
accept=".kmh,.sql,.zip"
|
||||
required
|
||||
class="hidden"
|
||||
onchange="handleUploadFileChange(this)">
|
||||
</div>
|
||||
<p class="text-[10px] text-slate-400 mt-1.5 flex items-center gap-1">
|
||||
<i class="fa-solid fa-circle-info text-indigo-600"></i>
|
||||
<span>Ukuran maksimal yang diizinkan hingga 200 MB.</span>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="pt-4 border-t border-slate-100 flex items-center justify-end gap-2.5">
|
||||
<button type="button" onclick="closeUploadBackupModal()" class="px-4 py-2.5 bg-slate-100 hover:bg-slate-200 text-slate-600 rounded-xl text-xs font-bold transition">
|
||||
<div class="pt-3 border-t border-slate-100 flex items-center justify-end gap-2.5">
|
||||
<button type="button" onclick="closeUploadBackupModal()" class="px-3.5 py-2 rounded-xl border border-slate-200 bg-white text-slate-600 font-semibold text-xs transition">
|
||||
Batal
|
||||
</button>
|
||||
<button type="submit" class="px-5 py-2.5 bg-indigo-600 hover:bg-indigo-700 text-white rounded-xl text-xs font-bold shadow-sm transition flex items-center gap-2">
|
||||
<i class="fa-solid fa-upload text-xs"></i>
|
||||
<span>Unggah ke Server</span>
|
||||
<button type="submit" class="px-4 py-2 rounded-xl bg-indigo-600 hover:bg-indigo-700 text-white font-semibold text-xs transition shadow-xs">
|
||||
Unggah File
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
@@ -400,70 +358,46 @@
|
||||
<!-- ========================================================================= -->
|
||||
<!-- MODAL: KONFIRMASI PEMULIHAN (RESTORE) -->
|
||||
<!-- ========================================================================= -->
|
||||
<div id="restoreModal" data-backdrop="static" class="fixed inset-0 z-50 hidden bg-slate-900/60 backdrop-blur-sm flex items-center justify-center p-4 overflow-y-auto">
|
||||
<div class="bg-white rounded-3xl max-w-lg w-full shadow-2xl overflow-hidden animate-scale-in border border-slate-100">
|
||||
<!-- Header Bahaya -->
|
||||
<div class="px-6 py-4.5 bg-amber-50/80 border-b border-amber-100 flex items-center justify-between">
|
||||
<h3 class="text-base font-bold text-amber-900 flex items-center gap-2">
|
||||
<i class="fa-solid fa-triangle-exclamation text-amber-600"></i>
|
||||
<span>Konfirmasi Pemulihan Sistem (Restore)</span>
|
||||
</h3>
|
||||
<button type="button" onclick="closeRestoreModal()" class="text-slate-400 hover:text-slate-600 p-1">
|
||||
<i class="fa-solid fa-xmark text-lg"></i>
|
||||
</button>
|
||||
<div id="restoreModal" data-backdrop="static" class="fixed inset-0 z-50 hidden bg-slate-900/50 backdrop-blur-xs flex items-center justify-center p-4">
|
||||
<div class="bg-white rounded-2xl max-w-md w-full shadow-xl overflow-hidden animate-scale-in border border-slate-100">
|
||||
<div class="px-5 py-4 bg-amber-50/70 border-b border-amber-100 flex items-center justify-between">
|
||||
<h3 class="text-base font-bold text-amber-900">Konfirmasi Pemulihan Sistem</h3>
|
||||
<button type="button" onclick="closeRestoreModal()" class="text-slate-400 hover:text-slate-600 text-lg p-1">×</button>
|
||||
</div>
|
||||
|
||||
<form id="restoreForm" method="POST" action="" onsubmit="handleRestoreSubmit(this)" class="p-6 space-y-4">
|
||||
<form id="restoreForm" method="POST" action="" onsubmit="handleRestoreSubmit(this)" class="p-5 space-y-4">
|
||||
@csrf
|
||||
|
||||
<!-- Warning Card -->
|
||||
<div class="p-4 rounded-2xl bg-rose-50 border border-rose-200 text-xs text-rose-900 space-y-1.5">
|
||||
<p class="font-black text-rose-950 flex items-center gap-2">
|
||||
<i class="fa-solid fa-circle-exclamation text-rose-600 text-sm"></i>
|
||||
<span>PERINGATAN KRITIKAL: TINDAKAN INI AKAN MENIMPA DATA</span>
|
||||
</p>
|
||||
<p class="text-[11px] leading-relaxed text-rose-800">
|
||||
Proses pemulihan akan menimpa (overwrite) seluruh database saat ini dengan isi arsip backup yang dipilih. Data yang dibuat setelah tanggal backup ini akan tergantikan.
|
||||
</p>
|
||||
<div class="p-3 rounded-xl bg-rose-50 border border-rose-200 text-xs text-rose-900 leading-relaxed">
|
||||
<strong>Peringatan:</strong> Proses ini akan menimpa data di database saat ini dengan isi arsip backup yang dipilih.
|
||||
</div>
|
||||
|
||||
<!-- Rincian Target File Backup -->
|
||||
<div class="bg-slate-50 rounded-2xl p-3.5 border border-slate-200/80 text-xs space-y-1">
|
||||
<div class="bg-slate-50 p-3 rounded-xl border border-slate-200 text-xs space-y-1 font-mono">
|
||||
<div class="flex justify-between">
|
||||
<span class="text-slate-400 text-[11px]">Nama Arsip:</span>
|
||||
<span id="restoreTargetFilename" class="font-bold font-mono text-slate-800"></span>
|
||||
</div>
|
||||
<div class="flex justify-between">
|
||||
<span class="text-slate-400 text-[11px]">Tipe & Ukuran:</span>
|
||||
<span id="restoreTargetMeta" class="font-semibold text-slate-700"></span>
|
||||
<span class="text-slate-400">File:</span>
|
||||
<span id="restoreTargetFilename" class="font-bold text-slate-800"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Input Verifikasi Keamanan -->
|
||||
<div>
|
||||
<label class="block text-xs font-bold text-slate-800 mb-1">
|
||||
Konfirmasi Keamanan <span class="text-rose-500">*</span>
|
||||
<label class="block text-xs font-semibold text-slate-800 mb-1">
|
||||
Ketik kata <span class="font-mono font-bold text-slate-900 bg-slate-100 px-1 py-0.5 rounded">PULIHKAN</span> atau masukkan password Anda:
|
||||
</label>
|
||||
<p class="text-[11px] text-slate-500 mb-2 leading-relaxed">
|
||||
Untuk melanjutkan, ketik kata <strong class="text-slate-900 font-mono bg-slate-100 px-1.5 py-0.5 rounded border border-slate-200">PULIHKAN</strong> pada kolom di bawah atau masukkan password akun Super Admin Anda:
|
||||
</p>
|
||||
<input type="text"
|
||||
name="confirmation"
|
||||
id="restoreConfirmationInput"
|
||||
placeholder="Ketik PULIHKAN atau password akun Anda..."
|
||||
placeholder="PULIHKAN atau password..."
|
||||
required
|
||||
autocomplete="off"
|
||||
class="w-full text-xs px-3.5 py-2.5 rounded-xl border border-slate-200 bg-white text-slate-800 font-bold focus:outline-none focus:border-amber-500 focus:ring-2 focus:ring-amber-500/10">
|
||||
class="w-full text-xs px-3 py-2 rounded-xl border border-slate-200 focus:outline-none focus:border-amber-500 font-semibold">
|
||||
</div>
|
||||
|
||||
<!-- Tombol Footer -->
|
||||
<div class="pt-4 border-t border-slate-100 flex items-center justify-end gap-2.5">
|
||||
<button type="button" onclick="closeRestoreModal()" class="px-4 py-2.5 bg-slate-100 hover:bg-slate-200 text-slate-600 rounded-xl text-xs font-bold transition">
|
||||
<div class="pt-3 border-t border-slate-100 flex items-center justify-end gap-2.5">
|
||||
<button type="button" onclick="closeRestoreModal()" class="px-3.5 py-2 rounded-xl border border-slate-200 bg-white text-slate-600 font-semibold text-xs transition">
|
||||
Batal
|
||||
</button>
|
||||
<button type="submit" id="restoreSubmitBtn" class="px-5 py-2.5 bg-amber-600 hover:bg-amber-700 text-white rounded-xl text-xs font-bold shadow-sm transition flex items-center gap-2">
|
||||
<i class="fa-solid fa-rotate-left text-xs"></i>
|
||||
<span id="restoreBtnText">Ya, Pulihkan Sistem Sekarang</span>
|
||||
<button type="submit" id="restoreSubmitBtn" class="px-4 py-2 rounded-xl bg-amber-600 hover:bg-amber-700 text-white font-semibold text-xs transition shadow-xs">
|
||||
<span id="restoreBtnText">Ya, Pulihkan Sistem</span>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
@@ -471,35 +405,63 @@
|
||||
</div>
|
||||
|
||||
<!-- ========================================================================= -->
|
||||
<!-- MODAL: KONFIRMASI HAPUS BACKUP -->
|
||||
<!-- MODAL: KONFIRMASI HAPUS -->
|
||||
<!-- ========================================================================= -->
|
||||
<div id="deleteBackupModal" data-backdrop="static" class="fixed inset-0 z-50 hidden bg-slate-900/60 backdrop-blur-sm flex items-center justify-center p-4">
|
||||
<div class="bg-white rounded-3xl max-w-sm w-full p-6 shadow-2xl overflow-hidden animate-scale-in border border-slate-100 text-center">
|
||||
<div class="w-12 h-12 rounded-2xl bg-rose-50 text-rose-600 flex items-center justify-center text-xl mx-auto mb-3">
|
||||
<i class="fa-solid fa-trash-can"></i>
|
||||
</div>
|
||||
<h3 class="text-base font-bold text-slate-900">Hapus File Backup?</h3>
|
||||
<p class="text-xs text-slate-500 mt-1.5 leading-relaxed">
|
||||
Apakah Anda yakin ingin menghapus file backup <span id="deleteBackupFilename" class="font-mono font-bold text-slate-800"></span> dari server? File yang dihapus tidak dapat dipulihkan kembali.
|
||||
<div id="deleteBackupModal" data-backdrop="static" class="fixed inset-0 z-50 hidden bg-slate-900/50 backdrop-blur-xs flex items-center justify-center p-4">
|
||||
<div class="bg-white rounded-2xl max-w-sm w-full p-5 shadow-xl border border-slate-100 text-center">
|
||||
<h3 class="text-sm font-bold text-slate-900">Hapus File Backup?</h3>
|
||||
<p class="text-xs text-slate-500 mt-1">
|
||||
File <span id="deleteBackupFilename" class="font-mono font-semibold text-slate-800"></span> akan dihapus permanen dari server.
|
||||
</p>
|
||||
|
||||
<form id="deleteBackupForm" method="POST" action="" class="mt-6 flex items-center justify-center gap-2.5">
|
||||
<form id="deleteBackupForm" method="POST" action="" class="mt-5 flex items-center justify-center gap-2">
|
||||
@csrf
|
||||
@method('DELETE')
|
||||
<button type="button" onclick="closeDeleteBackupModal()" class="flex-1 px-4 py-2.5 bg-slate-100 hover:bg-slate-200 text-slate-700 rounded-xl text-xs font-bold transition">
|
||||
<button type="button" onclick="closeDeleteBackupModal()" class="flex-1 px-3 py-2 bg-slate-100 hover:bg-slate-200 text-slate-700 rounded-xl text-xs font-semibold transition">
|
||||
Batal
|
||||
</button>
|
||||
<button type="submit" class="flex-1 px-4 py-2.5 bg-rose-600 hover:bg-rose-700 text-white rounded-xl text-xs font-bold shadow-sm transition">
|
||||
Hapus File
|
||||
<button type="submit" class="flex-1 px-3 py-2 bg-rose-600 hover:bg-rose-700 text-white rounded-xl text-xs font-semibold transition">
|
||||
Hapus
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- ========================================================================= -->
|
||||
<!-- JAVASCRIPT HELPER MODAL & INTERAKSI -->
|
||||
<!-- JAVASCRIPT LOGIC INTERAKTIF -->
|
||||
<!-- ========================================================================= -->
|
||||
<script>
|
||||
function toggleBackupScopeUI(scope) {
|
||||
const cardPilihan = document.getElementById('scopeCardPilihan');
|
||||
const cardSemua = document.getElementById('scopeCardSemua');
|
||||
const sectionPilihan = document.getElementById('pilihanTableSection');
|
||||
const sectionSemua = document.getElementById('semuaTableSection');
|
||||
|
||||
if (scope === 'pilihan') {
|
||||
cardPilihan.classList.add('border-indigo-600', 'bg-indigo-50/30');
|
||||
cardPilihan.classList.remove('border-slate-200', 'bg-white');
|
||||
cardSemua.classList.remove('border-indigo-600', 'bg-indigo-50/30');
|
||||
cardSemua.classList.add('border-slate-200', 'bg-white');
|
||||
|
||||
sectionPilihan.classList.remove('hidden');
|
||||
sectionSemua.classList.add('hidden');
|
||||
} else {
|
||||
cardSemua.classList.add('border-indigo-600', 'bg-indigo-50/30');
|
||||
cardSemua.classList.remove('border-slate-200', 'bg-white');
|
||||
cardPilihan.classList.remove('border-indigo-600', 'bg-indigo-50/30');
|
||||
cardPilihan.classList.add('border-slate-200', 'bg-white');
|
||||
|
||||
sectionPilihan.classList.add('hidden');
|
||||
sectionSemua.classList.remove('hidden');
|
||||
}
|
||||
}
|
||||
|
||||
function selectAllTables(checked) {
|
||||
document.querySelectorAll('.table-checkbox').forEach(cb => {
|
||||
cb.checked = checked;
|
||||
});
|
||||
}
|
||||
|
||||
function openCreateBackupModal() {
|
||||
document.getElementById('createBackupModal').classList.remove('hidden');
|
||||
document.documentElement.classList.add('modal-open');
|
||||
@@ -517,9 +479,7 @@
|
||||
btn.disabled = true;
|
||||
btn.classList.add('opacity-75', 'cursor-not-allowed');
|
||||
}
|
||||
if (text) {
|
||||
text.textContent = 'Memproses Pencadangan...';
|
||||
}
|
||||
if (text) text.textContent = 'Memproses Arsip .kmh...';
|
||||
}
|
||||
|
||||
function openUploadBackupModal() {
|
||||
@@ -542,7 +502,6 @@
|
||||
function openRestoreModal(filename, typeLabel, sizeHuman) {
|
||||
document.getElementById('restoreForm').action = `/admin/backups/${encodeURIComponent(filename)}/restore`;
|
||||
document.getElementById('restoreTargetFilename').textContent = filename;
|
||||
document.getElementById('restoreTargetMeta').textContent = `${typeLabel} (${sizeHuman})`;
|
||||
document.getElementById('restoreConfirmationInput').value = '';
|
||||
document.getElementById('restoreModal').classList.remove('hidden');
|
||||
document.documentElement.classList.add('modal-open');
|
||||
@@ -560,9 +519,7 @@
|
||||
btn.disabled = true;
|
||||
btn.classList.add('opacity-75', 'cursor-not-allowed');
|
||||
}
|
||||
if (text) {
|
||||
text.textContent = 'Memulihkan Sistem (Mohon Tunggu)...';
|
||||
}
|
||||
if (text) text.textContent = 'Memulihkan Sistem...';
|
||||
}
|
||||
|
||||
function openDeleteBackupModal(filename) {
|
||||
|
||||
Reference in New Issue
Block a user