Add restore button for soft-deleted WOs in admin diagnostic

Soft-deleted WOs (WO-26-0005..0008) are missing from admin view.
A new restore action lets the admin recover them without CLI access.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-09-06 11:32:14 +00:00
parent 8e32444a13
commit 5fa55f4bff
@@ -65,6 +65,29 @@ class ListWorkOrders extends ListRecords
->modalSubmitAction(false)
->modalCancelActionLabel('Închide');
// Restore button — only if there are soft-deleted WOs in this tenant
if ($deletedTenant > 0) {
$actions[] = Actions\Action::make('restore_deleted_wos')
->label("Restaurează {$deletedTenant} fișe șterse")
->color('success')
->icon('heroicon-o-arrow-uturn-left')
->requiresConfirmation()
->modalHeading('Restaurează fișe șterse')
->modalDescription("Există {$deletedTenant} fișe soft-șterse în această companie. Vrei să le restaurezi?")
->modalSubmitActionLabel('Da, restaurează-le')
->action(function () use ($tenantId) {
$restored = DB::table('work_orders')
->where('company_id', $tenantId)
->whereNotNull('deleted_at')
->update(['deleted_at' => null]);
Notification::make()
->title("{$restored} fișe restaurate cu succes")
->success()
->send();
});
}
// Recover button — only if there are orphaned active WOs
if ($otherActive > 0) {
$actions[] = Actions\Action::make('recover_wos')