@extends('layouts.app')
@section('title','Database Backup')
@section('content')
<div class="page-head"><div><h1>Database backup</h1><p>Create recoverable database snapshots and retain a checksum-backed history.</p></div><form method="POST" action="{{ route('backups.store') }}">@csrf<button class="btn btn-primary btn-dense" onclick="this.disabled=true;this.form.submit()"><i class="bi bi-database-down me-1"></i>Create backup</button></form></div>
<div class="alert alert-warning border-0 small"><i class="bi bi-shield-exclamation me-1"></i>Application backups should also be copied to encrypted off-site storage. Files and uploaded documents require a separate filesystem backup.</div>
<div class="card-erp"><div class="table-responsive"><table class="table table-dense"><thead><tr><th>Created</th><th>Filename</th><th>Size</th><th>Checksum</th><th>Status</th><th>Created by</th><th></th></tr></thead><tbody>@forelse($backups as $b)<tr><td>{{ $b->created_at->format('d M Y H:i') }}</td><td class="fw-bold">{{ $b->filename }}</td><td>{{ number_format($b->size/1024,1) }} KB</td><td><code>{{ substr($b->checksum,0,18) }}…</code></td><td><span class="badge status-{{ $b->status==='completed'?'finalized':'cancelled' }}">{{ strtoupper($b->status) }}</span></td><td>{{ $b->createdBy?->name }}</td><td class="text-end"><a class="btn btn-light border btn-dense" href="{{ route('backups.download',$b) }}"><i class="bi bi-download"></i>Download</a></td></tr>@empty<tr><td colspan="7" class="text-center text-muted py-5">No backups created yet.</td></tr>@endforelse</tbody></table></div>@if($backups->hasPages())<div class="card-erp-body border-top">{{ $backups->links() }}</div>@endif</div>
@endsection
