Add refund action to booking list/detail with full-refund toggle

- New RefundBookingTableAction on the booking list row and detail page,
  refunding a Confirmed booking directly via RefundBookingAction — no need
  to hunt up its Payment on the Refunds resource first.
- Payment::refundableBalance() extracted from RefundBookingAction's private
  balance check so both refund forms can display and cap against it.
- RefundBookingAction::resolveRefundablePayment() made public for the same
  reason (round-trip leg resolution reused by the UI).
- Both refund forms (ProcessRefundAction and the new booking action) gain a
  "Full refund" toggle, on by default, which refunds the payment's whole
  remaining balance without requiring a manually typed amount. Turning it
  off reveals an amount field capped at the refundable balance.
This commit is contained in:
Nyan Lin Paing
2026-08-30 14:46:26 +07:00
parent a905320d50
commit 231f5679ef
9 changed files with 368 additions and 15 deletions
@@ -7,6 +7,7 @@ use Modules\Booking\Filament\Resources\Bookings\Actions\AssignDriverTableAction;
use Modules\Booking\Filament\Resources\Bookings\Actions\CancelBookingTableAction;
use Modules\Booking\Filament\Resources\Bookings\Actions\SetRemarkTableAction;
use Modules\Booking\Filament\Resources\Bookings\BookingResource;
use Modules\Payment\Filament\Actions\RefundBookingTableAction;
class ViewBooking extends ViewRecord
{
@@ -18,6 +19,7 @@ class ViewBooking extends ViewRecord
AssignDriverTableAction::make(),
SetRemarkTableAction::make(),
CancelBookingTableAction::make(),
RefundBookingTableAction::make(),
];
}
}
@@ -20,6 +20,7 @@ use Modules\Booking\Filament\Resources\Bookings\Actions\RestoreBookingTableActio
use Modules\Booking\Filament\Resources\Bookings\Actions\SetRemarkTableAction;
use Modules\Booking\Models\Booking;
use Modules\Catalog\Models\EvCompany;
use Modules\Payment\Filament\Actions\RefundBookingTableAction;
use Modules\Routing\Models\EvRoute;
class BookingsTable
@@ -148,6 +149,7 @@ class BookingsTable
AssignDriverTableAction::make(),
SetRemarkTableAction::make(),
CancelBookingTableAction::make(),
RefundBookingTableAction::make(),
DeleteBookingTableAction::make(),
RestoreBookingTableAction::make(),
]);