wip
This commit is contained in:
@@ -10,6 +10,17 @@ class CreateCardOrder extends CreateRecord
|
||||
{
|
||||
protected static string $resource = CardOrderResource::class;
|
||||
|
||||
/**
|
||||
* @return array<Action | ActionGroup>
|
||||
*/
|
||||
protected function getFormActions(): array
|
||||
{
|
||||
return [
|
||||
$this->getCreateFormAction(),
|
||||
$this->getCancelFormAction(),
|
||||
];
|
||||
}
|
||||
|
||||
protected function getRedirectUrl(): string
|
||||
{
|
||||
$defaultUrl = $this->getResource()::getUrl('index');
|
||||
@@ -17,11 +28,11 @@ class CreateCardOrder extends CreateRecord
|
||||
/** @var \App\Modules\CardOrder\Models\CardOrder */
|
||||
$record = $this->record;
|
||||
|
||||
$OnlinePayment = CardOrderRepository::make()
|
||||
$onlinePayment = CardOrderRepository::make()
|
||||
->createOnlinePaymentOrder($record);
|
||||
|
||||
return $OnlinePayment->successful()
|
||||
? $OnlinePayment->paymentLink()
|
||||
return $onlinePayment->successful()
|
||||
? $onlinePayment->paymentLink()
|
||||
: $defaultUrl;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,13 +2,17 @@
|
||||
|
||||
namespace App\Filament\Clusters\Cards\CardOrders\Tables;
|
||||
|
||||
use App\Modules\CardOrder\Models\CardOrder;
|
||||
use App\Modules\CardOrder\Repositories\CardOrderRepository;
|
||||
use App\Modules\OrderStatus\Repositories\OrderStatusRepository;
|
||||
use App\Modules\Region\Repositories\RegionRepository;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Actions\ForceDeleteBulkAction;
|
||||
use Filament\Actions\RestoreBulkAction;
|
||||
use Filament\Notifications\Notification;
|
||||
use Filament\Tables\Columns\IconColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Filters\TrashedFilter;
|
||||
@@ -81,6 +85,29 @@ class CardOrdersTable
|
||||
TrashedFilter::make(),
|
||||
])
|
||||
->recordActions([
|
||||
Action::make('card_order_pay')
|
||||
->label(__('Pay'))
|
||||
->icon('heroicon-o-credit-card')
|
||||
->requiresConfirmation()
|
||||
->action(function (CardOrder $record) {
|
||||
$onlinePayment = CardOrderRepository::make()
|
||||
->createOnlinePaymentOrder($record);
|
||||
|
||||
if ($onlinePayment->successful()) {
|
||||
Notification::make()
|
||||
->success()
|
||||
->title('Sending')
|
||||
->send();
|
||||
|
||||
return redirect()->away($onlinePayment->paymentLink());
|
||||
}
|
||||
|
||||
Notification::make()
|
||||
->danger()
|
||||
->title('Could not send')
|
||||
->send();
|
||||
}),
|
||||
|
||||
EditAction::make(),
|
||||
])
|
||||
->toolbarActions([
|
||||
|
||||
@@ -29,6 +29,8 @@ class WorkPanelProvider extends PanelProvider
|
||||
{
|
||||
public function panel(Panel $panel): Panel
|
||||
{
|
||||
// #content\.form-actions > div
|
||||
|
||||
return $panel
|
||||
->default()
|
||||
->id('work')
|
||||
|
||||
Reference in New Issue
Block a user