mailwolt/app/Livewire/Ui/System/Modal/BackupRestoreConfirmModal.php

36 lines
971 B
PHP

<?php
namespace App\Livewire\Ui\System\Modal;
use App\Models\BackupJob;
use LivewireUI\Modal\ModalComponent;
class BackupRestoreConfirmModal extends ModalComponent
{
public int $jobId;
public string $filename = '';
public string $startedAt = '';
public static function modalMaxWidth(): string { return 'sm'; }
public function mount(int $jobId): void
{
$job = BackupJob::findOrFail($jobId);
$this->jobId = $job->id;
$this->filename = $job->artifact_path ? basename($job->artifact_path) : '—';
$this->startedAt = $job->started_at?->format('d.m.Y H:i') ?? '—';
}
public function confirm(): void
{
$this->closeModal();
// Trigger restore in the parent list component via event
$this->dispatch('backup:do-restore', jobId: $this->jobId);
}
public function render()
{
return view('livewire.ui.system.modal.backup-restore-confirm-modal');
}
}