30 lines
921 B
PHP
30 lines
921 B
PHP
<?php
|
|
|
|
namespace App\Filament\Resources\PurchaseResource\Pages;
|
|
|
|
use App\Filament\Resources\PurchaseResource;
|
|
use Filament\Actions;
|
|
use Filament\Resources\Pages\ViewRecord;
|
|
|
|
class ViewPurchase extends ViewRecord
|
|
{
|
|
protected static string $resource = PurchaseResource::class;
|
|
|
|
protected function getHeaderActions(): array
|
|
{
|
|
return [
|
|
Actions\EditAction::make(),
|
|
Actions\DeleteAction::make(),
|
|
Actions\Action::make('refund')
|
|
->label('Refund')
|
|
->color('danger')
|
|
->icon('heroicon-o-arrow-uturn-left')
|
|
->requiresConfirmation()
|
|
->visible(fn ($record): bool => !$record->refunded)
|
|
->action(function ($record) {
|
|
$record->update(['refunded' => true]);
|
|
// TODO: Call Stripe/PayPal API for actual refund
|
|
}),
|
|
];
|
|
}
|
|
} |