Compare commits
3 Commits
94badf95b8
...
de63b29a45
| Author | SHA1 | Date | |
|---|---|---|---|
| de63b29a45 | |||
| e8595117ee | |||
| 92b067b939 |
@@ -3,6 +3,7 @@
|
|||||||
namespace App\Filament\Clusters\Cards\CardOrders\Pages;
|
namespace App\Filament\Clusters\Cards\CardOrders\Pages;
|
||||||
|
|
||||||
use App\Filament\Clusters\Cards\CardOrders\CardOrderResource;
|
use App\Filament\Clusters\Cards\CardOrders\CardOrderResource;
|
||||||
|
use Filament\Actions\Action;
|
||||||
use Filament\Actions\DeleteAction;
|
use Filament\Actions\DeleteAction;
|
||||||
use Filament\Actions\ForceDeleteAction;
|
use Filament\Actions\ForceDeleteAction;
|
||||||
use Filament\Actions\RestoreAction;
|
use Filament\Actions\RestoreAction;
|
||||||
@@ -15,6 +16,11 @@ class EditCardOrder extends EditRecord
|
|||||||
protected function getHeaderActions(): array
|
protected function getHeaderActions(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
Action::make('save_top')
|
||||||
|
->label(__('filament-panels::resources/pages/edit-record.form.actions.save.label'))
|
||||||
|
->submit(null)
|
||||||
|
->action('save'),
|
||||||
|
|
||||||
DeleteAction::make(),
|
DeleteAction::make(),
|
||||||
ForceDeleteAction::make(),
|
ForceDeleteAction::make(),
|
||||||
RestoreAction::make(),
|
RestoreAction::make(),
|
||||||
|
|||||||
@@ -2,17 +2,15 @@
|
|||||||
|
|
||||||
namespace App\Filament\Clusters\Cards\CardOrders\Tables;
|
namespace App\Filament\Clusters\Cards\CardOrders\Tables;
|
||||||
|
|
||||||
|
use App\Modules\CardOrder\Filament\Actions\PayCardOrderAction;
|
||||||
use App\Modules\CardOrder\Models\CardOrder;
|
use App\Modules\CardOrder\Models\CardOrder;
|
||||||
use App\Modules\CardOrder\Repositories\CardOrderRepository;
|
|
||||||
use App\Modules\OrderStatus\Repositories\OrderStatusRepository;
|
use App\Modules\OrderStatus\Repositories\OrderStatusRepository;
|
||||||
use App\Modules\Region\Repositories\RegionRepository;
|
use App\Modules\Region\Repositories\RegionRepository;
|
||||||
use Filament\Actions\Action;
|
|
||||||
use Filament\Actions\BulkActionGroup;
|
use Filament\Actions\BulkActionGroup;
|
||||||
use Filament\Actions\DeleteBulkAction;
|
use Filament\Actions\DeleteBulkAction;
|
||||||
use Filament\Actions\EditAction;
|
use Filament\Actions\EditAction;
|
||||||
use Filament\Actions\ForceDeleteBulkAction;
|
use Filament\Actions\ForceDeleteBulkAction;
|
||||||
use Filament\Actions\RestoreBulkAction;
|
use Filament\Actions\RestoreBulkAction;
|
||||||
use Filament\Notifications\Notification;
|
|
||||||
use Filament\Tables\Columns\IconColumn;
|
use Filament\Tables\Columns\IconColumn;
|
||||||
use Filament\Tables\Columns\TextColumn;
|
use Filament\Tables\Columns\TextColumn;
|
||||||
use Filament\Tables\Filters\TrashedFilter;
|
use Filament\Tables\Filters\TrashedFilter;
|
||||||
@@ -85,28 +83,8 @@ class CardOrdersTable
|
|||||||
TrashedFilter::make(),
|
TrashedFilter::make(),
|
||||||
])
|
])
|
||||||
->recordActions([
|
->recordActions([
|
||||||
Action::make('card_order_pay')
|
PayCardOrderAction::make()
|
||||||
->label(__('Pay'))
|
->hidden(fn (CardOrder $record) => $record->paid),
|
||||||
->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(),
|
EditAction::make(),
|
||||||
])
|
])
|
||||||
|
|||||||
@@ -5,17 +5,15 @@ namespace App\Filament\Clusters\Cards\Cards;
|
|||||||
use App\Filament\Clusters\Cards\Cards\Pages\ManageCards;
|
use App\Filament\Clusters\Cards\Cards\Pages\ManageCards;
|
||||||
use App\Filament\Clusters\Cards\CardsCluster;
|
use App\Filament\Clusters\Cards\CardsCluster;
|
||||||
use App\Modules\AppHelpers\Repositories\DateHelper;
|
use App\Modules\AppHelpers\Repositories\DateHelper;
|
||||||
|
use App\Modules\Card\Filament\Actions\CheckCardBalanceAction;
|
||||||
|
use App\Modules\Card\Filament\Actions\DownloadCardRequisteAction;
|
||||||
|
use App\Modules\Card\Filament\Actions\DownloadCardTransactionAction;
|
||||||
use App\Modules\Card\Models\Card;
|
use App\Modules\Card\Models\Card;
|
||||||
use App\Modules\CardBalance\Repositories\CardBalanceRepository;
|
|
||||||
use App\Modules\CardRequisite\Repositories\CardRequisiteRepository;
|
|
||||||
use App\Modules\CardTransaction\Repositories\CardTransactionRepository;
|
|
||||||
use BackedEnum;
|
use BackedEnum;
|
||||||
use Filament\Actions\Action;
|
|
||||||
use Filament\Actions\BulkActionGroup;
|
use Filament\Actions\BulkActionGroup;
|
||||||
use Filament\Actions\DeleteAction;
|
use Filament\Actions\DeleteAction;
|
||||||
use Filament\Actions\DeleteBulkAction;
|
use Filament\Actions\DeleteBulkAction;
|
||||||
use Filament\Actions\EditAction;
|
use Filament\Actions\EditAction;
|
||||||
use Filament\Forms\Components\DatePicker;
|
|
||||||
use Filament\Forms\Components\Hidden;
|
use Filament\Forms\Components\Hidden;
|
||||||
use Filament\Forms\Components\Select;
|
use Filament\Forms\Components\Select;
|
||||||
use Filament\Forms\Components\TextInput;
|
use Filament\Forms\Components\TextInput;
|
||||||
@@ -24,9 +22,7 @@ use Filament\Schemas\Schema;
|
|||||||
use Filament\Support\Icons\Heroicon;
|
use Filament\Support\Icons\Heroicon;
|
||||||
use Filament\Tables\Columns\TextColumn;
|
use Filament\Tables\Columns\TextColumn;
|
||||||
use Filament\Tables\Table;
|
use Filament\Tables\Table;
|
||||||
use Illuminate\Contracts\View\View;
|
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Livewire\Component;
|
|
||||||
|
|
||||||
class CardResource extends Resource
|
class CardResource extends Resource
|
||||||
{
|
{
|
||||||
@@ -127,42 +123,9 @@ class CardResource extends Resource
|
|||||||
//
|
//
|
||||||
])
|
])
|
||||||
->recordActions([
|
->recordActions([
|
||||||
Action::make('card_balance')
|
CheckCardBalanceAction::make(),
|
||||||
->label(__('Card balance'))
|
DownloadCardTransactionAction::make(),
|
||||||
->icon('heroicon-o-credit-card')
|
DownloadCardRequisteAction::make(),
|
||||||
->requiresConfirmation(false)
|
|
||||||
->modal()
|
|
||||||
->modalContent(fn (Card $record): View => CardBalanceRepository::make()->showCardBalance($record))
|
|
||||||
->modalFooterActions([]),
|
|
||||||
|
|
||||||
Action::make('card_transactions')
|
|
||||||
->label(__('Card transactions'))
|
|
||||||
->icon('heroicon-o-arrows-right-left')
|
|
||||||
->requiresConfirmation()
|
|
||||||
->modalIcon('heroicon-m-arrows-right-left')
|
|
||||||
->schema([
|
|
||||||
DatePicker::make('start_date')
|
|
||||||
->label(__('Start date'))
|
|
||||||
->native(false)
|
|
||||||
->required()
|
|
||||||
->beforeOrEqual('today'),
|
|
||||||
|
|
||||||
DatePicker::make('end_date')
|
|
||||||
->label(__('End date'))
|
|
||||||
->native(false)
|
|
||||||
->required()
|
|
||||||
->beforeOrEqual('today'),
|
|
||||||
])
|
|
||||||
->action(
|
|
||||||
fn (array $data, Card $record, Component $livewire) => CardTransactionRepository::make()->downloadCardTransaction($data, $record, $livewire)
|
|
||||||
),
|
|
||||||
|
|
||||||
Action::make('card_requisite')
|
|
||||||
->label(__('Card requisite'))
|
|
||||||
->icon('heroicon-o-document-text')
|
|
||||||
->requiresConfirmation()
|
|
||||||
->modalIcon('heroicon-o-document-text')
|
|
||||||
->action(fn (Card $record) => CardRequisiteRepository::make()->downloadCardRequisite($record)),
|
|
||||||
|
|
||||||
EditAction::make()
|
EditAction::make()
|
||||||
->label(''),
|
->label(''),
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ use Filament\Schemas\Components\Section;
|
|||||||
use Filament\Schemas\Components\Wizard;
|
use Filament\Schemas\Components\Wizard;
|
||||||
use Filament\Schemas\Components\Wizard\Step;
|
use Filament\Schemas\Components\Wizard\Step;
|
||||||
use Filament\Schemas\Schema;
|
use Filament\Schemas\Schema;
|
||||||
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
@@ -84,7 +85,7 @@ class LoanOrderForm
|
|||||||
->schema([
|
->schema([
|
||||||
Select::make('loan_type')
|
Select::make('loan_type')
|
||||||
->label(__('Loan type'))
|
->label(__('Loan type'))
|
||||||
->relationship('loanType', 'name')
|
->relationship('loanType', 'name', fn (Builder $query) => $query->orderByTranslation('name'))
|
||||||
->required(),
|
->required(),
|
||||||
|
|
||||||
TextInput::make('loan_amount')
|
TextInput::make('loan_amount')
|
||||||
@@ -109,6 +110,8 @@ class LoanOrderForm
|
|||||||
Select::make('branch_id')
|
Select::make('branch_id')
|
||||||
->label(__('Branch'))
|
->label(__('Branch'))
|
||||||
->relationship('branch', 'name', function ($query, callable $get) {
|
->relationship('branch', 'name', function ($query, callable $get) {
|
||||||
|
$query->orderByTranslation('name');
|
||||||
|
|
||||||
$region = $get('region');
|
$region = $get('region');
|
||||||
if ($region) {
|
if ($region) {
|
||||||
$query->where('region', $region);
|
$query->where('region', $region);
|
||||||
@@ -125,18 +128,21 @@ class LoanOrderForm
|
|||||||
->columnSpan(2)
|
->columnSpan(2)
|
||||||
->required()
|
->required()
|
||||||
->maxLength(255)
|
->maxLength(255)
|
||||||
->autocomplete(Str::random(10)),
|
->autocomplete(Str::random(10))
|
||||||
|
->default(user()->first_name),
|
||||||
|
|
||||||
TextInput::make('customer_surname')
|
TextInput::make('customer_surname')
|
||||||
->label(__('Surname'))
|
->label(__('Surname'))
|
||||||
->columnSpan(2)
|
->columnSpan(2)
|
||||||
->required()
|
->required()
|
||||||
->maxLength(255),
|
->maxLength(255)
|
||||||
|
->default(user()->last_name),
|
||||||
|
|
||||||
TextInput::make('customer_patronic_name')
|
TextInput::make('customer_patronic_name')
|
||||||
->label(__('Patronic name'))
|
->label(__('Patronic name'))
|
||||||
->columnSpan(2)
|
->columnSpan(2)
|
||||||
->maxLength(255),
|
->maxLength(255)
|
||||||
|
->default(user()->getOption('patronic_name')),
|
||||||
|
|
||||||
DatePicker::make('born_at')
|
DatePicker::make('born_at')
|
||||||
->displayFormat('d.m.Y')
|
->displayFormat('d.m.Y')
|
||||||
@@ -144,7 +150,8 @@ class LoanOrderForm
|
|||||||
->native(false)
|
->native(false)
|
||||||
->columnSpan(2)
|
->columnSpan(2)
|
||||||
->required()
|
->required()
|
||||||
->beforeOrEqual('today'),
|
->beforeOrEqual('today')
|
||||||
|
->default(user()->getOption('born_at')),
|
||||||
|
|
||||||
FusedGroup::make([
|
FusedGroup::make([
|
||||||
Select::make('passport_serie')
|
Select::make('passport_serie')
|
||||||
@@ -152,13 +159,15 @@ class LoanOrderForm
|
|||||||
->options(TurkmenPassportRepository::values())
|
->options(TurkmenPassportRepository::values())
|
||||||
->native(false)
|
->native(false)
|
||||||
->required()
|
->required()
|
||||||
->columnSpan(1),
|
->columnSpan(1)
|
||||||
|
->default(user()->getOption('passport_serie')),
|
||||||
|
|
||||||
TextInput::make('passport_id')
|
TextInput::make('passport_id')
|
||||||
->label(__('Passport number'))
|
->label(__('Passport number'))
|
||||||
->required()
|
->required()
|
||||||
->columnSpan(1)
|
->columnSpan(1)
|
||||||
->mask('999999'),
|
->mask('999999')
|
||||||
|
->default(user()->getOption('passport_id')),
|
||||||
])
|
])
|
||||||
->columnSpan(3)
|
->columnSpan(3)
|
||||||
->label(__('Passport serie and number'))
|
->label(__('Passport serie and number'))
|
||||||
@@ -171,37 +180,43 @@ class LoanOrderForm
|
|||||||
->native(false)
|
->native(false)
|
||||||
->closeOnDateSelection()
|
->closeOnDateSelection()
|
||||||
->beforeOrEqual('today')
|
->beforeOrEqual('today')
|
||||||
->required(),
|
->required()
|
||||||
|
->default(user()->getOption('passport_given_at')),
|
||||||
|
|
||||||
TextInput::make('born_place')
|
TextInput::make('born_place')
|
||||||
->columnSpan(3)
|
->columnSpan(3)
|
||||||
->label(__('Born place (passport)'))
|
->label(__('Born place (passport)'))
|
||||||
->maxLength(255)
|
->maxLength(255)
|
||||||
->required(),
|
->required()
|
||||||
|
->default(user()->getOption('born_place')),
|
||||||
|
|
||||||
TextInput::make('passport_given_by')
|
TextInput::make('passport_given_by')
|
||||||
->label(__('Passport given by'))
|
->label(__('Passport given by'))
|
||||||
->columnSpan(4)
|
->columnSpan(4)
|
||||||
->maxLength(255)
|
->maxLength(255)
|
||||||
->required(),
|
->required()
|
||||||
|
->default(user()->getOption('passport_given_by')),
|
||||||
|
|
||||||
TextInput::make('passport_address')
|
TextInput::make('passport_address')
|
||||||
->columnSpan(4)
|
->columnSpan(4)
|
||||||
->label(__('Proscription for home'))
|
->label(__('Proscription for home'))
|
||||||
->maxLength(255)
|
->maxLength(255)
|
||||||
->required(),
|
->required()
|
||||||
|
->default(user()->getOption('passport_address')),
|
||||||
|
|
||||||
TextInput::make('real_address')
|
TextInput::make('real_address')
|
||||||
->label(__('Current home address'))
|
->label(__('Current home address'))
|
||||||
->columnSpan(4)
|
->columnSpan(4)
|
||||||
->maxLength(255)
|
->maxLength(255)
|
||||||
->required(),
|
->required()
|
||||||
|
->default(user()->getOption('real_address')),
|
||||||
|
|
||||||
TextInput::make('email')
|
TextInput::make('email')
|
||||||
->label(__('Email'))
|
->label(__('Email'))
|
||||||
->email()
|
->email()
|
||||||
->maxLength(255)
|
->maxLength(255)
|
||||||
->columnSpan(2),
|
->columnSpan(2)
|
||||||
|
->default(user()->getOption('email')),
|
||||||
|
|
||||||
TextInput::make('phone')
|
TextInput::make('phone')
|
||||||
->label(__('Phone'))
|
->label(__('Phone'))
|
||||||
@@ -211,7 +226,8 @@ class LoanOrderForm
|
|||||||
->rules([
|
->rules([
|
||||||
new PhoneNumberVerificationRule,
|
new PhoneNumberVerificationRule,
|
||||||
])
|
])
|
||||||
->columnSpan(2),
|
->columnSpan(2)
|
||||||
|
->default(user()->phone),
|
||||||
|
|
||||||
TextInput::make('phone_additional')
|
TextInput::make('phone_additional')
|
||||||
->label(__('Additional phone'))
|
->label(__('Additional phone'))
|
||||||
@@ -281,12 +297,14 @@ class LoanOrderForm
|
|||||||
->options(RegionRepository::values())
|
->options(RegionRepository::values())
|
||||||
->columnSpan(1)
|
->columnSpan(1)
|
||||||
->live()
|
->live()
|
||||||
->afterStateUpdated(fn (callable $set) => $set('branch_id', null))
|
->afterStateUpdated(fn (callable $set) => $set('work_province_id', null))
|
||||||
->required(),
|
->required(),
|
||||||
|
|
||||||
Select::make('work_province_id')
|
Select::make('work_province_id')
|
||||||
->label(__('Work province'))
|
->label(__('Work province'))
|
||||||
->relationship('workProvince', 'name', function ($query, callable $get) {
|
->relationship('workProvince', 'name', function ($query, callable $get) {
|
||||||
|
$query->orderByTranslation('name');
|
||||||
|
|
||||||
$region = $get('work_region');
|
$region = $get('work_region');
|
||||||
if ($region) {
|
if ($region) {
|
||||||
$query->where('region', $region);
|
$query->where('region', $region);
|
||||||
|
|||||||
@@ -23,17 +23,17 @@ class LoanOrdersTable
|
|||||||
->sortable(),
|
->sortable(),
|
||||||
|
|
||||||
TextColumn::make('loanType.name')
|
TextColumn::make('loanType.name')
|
||||||
->label('Тип кредита')
|
->label(__('Loan type'))
|
||||||
->sortable()
|
->sortable()
|
||||||
->searchable(),
|
->searchable(),
|
||||||
|
|
||||||
TextColumn::make('region')
|
TextColumn::make('region')
|
||||||
->label('Регион')
|
->label(__('Region'))
|
||||||
->sortable()
|
->sortable()
|
||||||
->searchable(),
|
->searchable(),
|
||||||
|
|
||||||
TextColumn::make('branch.name')
|
TextColumn::make('branch.name')
|
||||||
->label('Филиал')
|
->label(__('Branch'))
|
||||||
->sortable()
|
->sortable()
|
||||||
->searchable(),
|
->searchable(),
|
||||||
|
|
||||||
|
|||||||
22
app/Modules/Card/Filament/Actions/CheckCardBalanceAction.php
Normal file
22
app/Modules/Card/Filament/Actions/CheckCardBalanceAction.php
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Modules\Card\Filament\Actions;
|
||||||
|
|
||||||
|
use App\Modules\Card\Models\Card;
|
||||||
|
use App\Modules\CardBalance\Repositories\CardBalanceRepository;
|
||||||
|
use Filament\Actions\Action;
|
||||||
|
use Illuminate\Contracts\View\View;
|
||||||
|
|
||||||
|
class CheckCardBalanceAction
|
||||||
|
{
|
||||||
|
public static function make(): Action
|
||||||
|
{
|
||||||
|
return Action::make('card_balance')
|
||||||
|
->label(__('Card balance'))
|
||||||
|
->icon('heroicon-o-credit-card')
|
||||||
|
->requiresConfirmation(false)
|
||||||
|
->modal()
|
||||||
|
->modalContent(fn (Card $record): View => CardBalanceRepository::make()->showCardBalance($record))
|
||||||
|
->modalFooterActions([]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Modules\Card\Filament\Actions;
|
||||||
|
|
||||||
|
use App\Modules\Card\Models\Card;
|
||||||
|
use App\Modules\CardRequisite\Repositories\CardRequisiteRepository;
|
||||||
|
use Filament\Actions\Action;
|
||||||
|
|
||||||
|
class DownloadCardRequisteAction
|
||||||
|
{
|
||||||
|
public static function make(): Action
|
||||||
|
{
|
||||||
|
return Action::make('card_requisite')
|
||||||
|
->label(__('Card requisite'))
|
||||||
|
->icon('heroicon-o-document-text')
|
||||||
|
->requiresConfirmation()
|
||||||
|
->modalIcon('heroicon-o-document-text')
|
||||||
|
->action(fn (Card $record) => CardRequisiteRepository::make()->downloadCardRequisite($record));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Modules\Card\Filament\Actions;
|
||||||
|
|
||||||
|
use App\Modules\Card\Models\Card;
|
||||||
|
use App\Modules\CardTransaction\Repositories\CardTransactionRepository;
|
||||||
|
use Filament\Actions\Action;
|
||||||
|
use Filament\Forms\Components\DatePicker;
|
||||||
|
use Livewire\Component;
|
||||||
|
|
||||||
|
class DownloadCardTransactionAction
|
||||||
|
{
|
||||||
|
public static function make(): Action
|
||||||
|
{
|
||||||
|
return Action::make('card_transactions')
|
||||||
|
->label(__('Card transactions'))
|
||||||
|
->icon('heroicon-o-arrows-right-left')
|
||||||
|
->requiresConfirmation()
|
||||||
|
->modalIcon('heroicon-m-arrows-right-left')
|
||||||
|
->schema([
|
||||||
|
DatePicker::make('start_date')
|
||||||
|
->label(__('Start date'))
|
||||||
|
->native(false)
|
||||||
|
->required()
|
||||||
|
->beforeOrEqual('today'),
|
||||||
|
|
||||||
|
DatePicker::make('end_date')
|
||||||
|
->label(__('End date'))
|
||||||
|
->native(false)
|
||||||
|
->required()
|
||||||
|
->beforeOrEqual('today'),
|
||||||
|
])
|
||||||
|
->action(
|
||||||
|
fn (array $data, Card $record, Component $livewire) => CardTransactionRepository::make()->downloadCardTransaction($data, $record, $livewire)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Modules\CardOrder\Filament\Actions;
|
||||||
|
|
||||||
|
use App\Modules\CardOrder\Models\CardOrder;
|
||||||
|
use App\Modules\CardOrder\Repositories\CardOrderRepository;
|
||||||
|
use Filament\Actions\Action;
|
||||||
|
use Filament\Notifications\Notification;
|
||||||
|
|
||||||
|
class PayCardOrderAction
|
||||||
|
{
|
||||||
|
public static function make(): Action
|
||||||
|
{
|
||||||
|
return 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();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user