wip
This commit is contained in:
@@ -3,7 +3,6 @@
|
|||||||
namespace App\Filament\Clusters\OnlinePayments\Resources\OnlinePayments;
|
namespace App\Filament\Clusters\OnlinePayments\Resources\OnlinePayments;
|
||||||
|
|
||||||
use App\Filament\Clusters\OnlinePayments\OnlinePaymentsCluster;
|
use App\Filament\Clusters\OnlinePayments\OnlinePaymentsCluster;
|
||||||
use App\Filament\Clusters\OnlinePayments\Resources\OnlinePayments\Pages\CreateOnlinePayment;
|
|
||||||
use App\Filament\Clusters\OnlinePayments\Resources\OnlinePayments\Pages\EditOnlinePayment;
|
use App\Filament\Clusters\OnlinePayments\Resources\OnlinePayments\Pages\EditOnlinePayment;
|
||||||
use App\Filament\Clusters\OnlinePayments\Resources\OnlinePayments\Pages\ListOnlinePayments;
|
use App\Filament\Clusters\OnlinePayments\Resources\OnlinePayments\Pages\ListOnlinePayments;
|
||||||
use App\Filament\Clusters\OnlinePayments\Resources\OnlinePayments\Schemas\OnlinePaymentForm;
|
use App\Filament\Clusters\OnlinePayments\Resources\OnlinePayments\Schemas\OnlinePaymentForm;
|
||||||
@@ -46,7 +45,6 @@ class OnlinePaymentResource extends Resource
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'index' => ListOnlinePayments::route('/'),
|
'index' => ListOnlinePayments::route('/'),
|
||||||
'create' => CreateOnlinePayment::route('/create'),
|
|
||||||
'edit' => EditOnlinePayment::route('/{record}/edit'),
|
'edit' => EditOnlinePayment::route('/{record}/edit'),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,11 @@
|
|||||||
|
|
||||||
namespace App\Filament\Clusters\OnlinePayments\Resources\OnlinePayments\Schemas;
|
namespace App\Filament\Clusters\OnlinePayments\Resources\OnlinePayments\Schemas;
|
||||||
|
|
||||||
|
use App\Modules\OnlinePayment\Repositories\OnlinePaymentRepository;
|
||||||
|
use Filament\Forms\Components\Select;
|
||||||
|
use Filament\Forms\Components\TextInput;
|
||||||
|
use Filament\Schemas\Components\Fieldset;
|
||||||
|
use Filament\Schemas\Components\Section;
|
||||||
use Filament\Schemas\Schema;
|
use Filament\Schemas\Schema;
|
||||||
|
|
||||||
class OnlinePaymentForm
|
class OnlinePaymentForm
|
||||||
@@ -10,7 +15,143 @@ class OnlinePaymentForm
|
|||||||
{
|
{
|
||||||
return $schema
|
return $schema
|
||||||
->components([
|
->components([
|
||||||
//
|
Section::make()
|
||||||
|
->columnSpanFull()
|
||||||
|
->columns([
|
||||||
|
'default' => 1,
|
||||||
|
'md' => 2,
|
||||||
|
'xl' => 3,
|
||||||
|
])
|
||||||
|
->schema([
|
||||||
|
// Payment Information
|
||||||
|
Fieldset::make(__('Payment Information'))
|
||||||
|
->columns([
|
||||||
|
'default' => 1,
|
||||||
|
'md' => 2,
|
||||||
|
])
|
||||||
|
->schema([
|
||||||
|
TextInput::make('amount')
|
||||||
|
->label(__('Amount'))
|
||||||
|
->required()
|
||||||
|
->numeric()
|
||||||
|
->suffix('TMT')
|
||||||
|
->rules(['required', 'numeric', 'min:0']),
|
||||||
|
|
||||||
|
TextInput::make('description')
|
||||||
|
->label(__('Description'))
|
||||||
|
->required()
|
||||||
|
->maxLength(255),
|
||||||
|
|
||||||
|
TextInput::make('orderNumber')
|
||||||
|
->label(__('Order Number'))
|
||||||
|
->maxLength(255)
|
||||||
|
->helperText(__('Leave empty to auto-generate')),
|
||||||
|
|
||||||
|
Select::make('paymentStatus')
|
||||||
|
->label(__('Payment Status'))
|
||||||
|
->options(OnlinePaymentRepository::statusValues())
|
||||||
|
->default(OnlinePaymentRepository::PENDING)
|
||||||
|
->required(),
|
||||||
|
]),
|
||||||
|
|
||||||
|
// Card Information
|
||||||
|
Fieldset::make(__('Card Information'))
|
||||||
|
->columns([
|
||||||
|
'default' => 1,
|
||||||
|
'md' => 2,
|
||||||
|
])
|
||||||
|
->schema([
|
||||||
|
TextInput::make('cardholderName')
|
||||||
|
->label(__('Cardholder Name'))
|
||||||
|
->maxLength(255),
|
||||||
|
|
||||||
|
TextInput::make('pan')
|
||||||
|
->label(__('Card Number (PAN)'))
|
||||||
|
->maxLength(255)
|
||||||
|
->mask('9999 9999 9999 9999')
|
||||||
|
->placeholder('1234 5678 9012 3456'),
|
||||||
|
|
||||||
|
TextInput::make('expiration')
|
||||||
|
->label(__('Expiration Date'))
|
||||||
|
->mask('99/99')
|
||||||
|
->placeholder('MM/YY'),
|
||||||
|
|
||||||
|
TextInput::make('approvalCode')
|
||||||
|
->label(__('Approval Code'))
|
||||||
|
->maxLength(255),
|
||||||
|
]),
|
||||||
|
|
||||||
|
// Additional Information
|
||||||
|
Fieldset::make(__('Additional Information'))
|
||||||
|
->columns([
|
||||||
|
'default' => 1,
|
||||||
|
'md' => 2,
|
||||||
|
])
|
||||||
|
->schema([
|
||||||
|
TextInput::make('booking_number')
|
||||||
|
->label(__('Booking Number'))
|
||||||
|
->maxLength(255),
|
||||||
|
|
||||||
|
TextInput::make('depositedAmount')
|
||||||
|
->label(__('Deposited Amount'))
|
||||||
|
->numeric()
|
||||||
|
->suffix('TMT'),
|
||||||
|
|
||||||
|
TextInput::make('refunded_amount')
|
||||||
|
->label(__('Refunded Amount'))
|
||||||
|
->numeric()
|
||||||
|
->suffix('TMT'),
|
||||||
|
|
||||||
|
TextInput::make('username')
|
||||||
|
->label(__('Username'))
|
||||||
|
->maxLength(255)
|
||||||
|
->helperText(__('Payment provider username')),
|
||||||
|
]),
|
||||||
|
|
||||||
|
// URLs
|
||||||
|
Fieldset::make(__('URLs'))
|
||||||
|
->columns([
|
||||||
|
'default' => 1,
|
||||||
|
'md' => 2,
|
||||||
|
])
|
||||||
|
->schema([
|
||||||
|
TextInput::make('formUrl')
|
||||||
|
->label(__('Form URL'))
|
||||||
|
->url()
|
||||||
|
->maxLength(255),
|
||||||
|
|
||||||
|
TextInput::make('successUrl')
|
||||||
|
->label(__('Success URL'))
|
||||||
|
->url()
|
||||||
|
->maxLength(255),
|
||||||
|
|
||||||
|
TextInput::make('errorUrl')
|
||||||
|
->label(__('Error URL'))
|
||||||
|
->url()
|
||||||
|
->maxLength(255),
|
||||||
|
]),
|
||||||
|
|
||||||
|
// API Information
|
||||||
|
Fieldset::make(__('API Information'))
|
||||||
|
->columns([
|
||||||
|
'default' => 1,
|
||||||
|
'md' => 2,
|
||||||
|
])
|
||||||
|
->schema([
|
||||||
|
TextInput::make('api_client')
|
||||||
|
->label(__('API Client'))
|
||||||
|
->maxLength(255),
|
||||||
|
|
||||||
|
TextInput::make('callbackStatus')
|
||||||
|
->label(__('Callback Status'))
|
||||||
|
->maxLength(255),
|
||||||
|
|
||||||
|
TextInput::make('orderId')
|
||||||
|
->label(__('Order ID'))
|
||||||
|
->maxLength(255)
|
||||||
|
->helperText(__('External order identifier')),
|
||||||
|
]),
|
||||||
|
]),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,9 +2,14 @@
|
|||||||
|
|
||||||
namespace App\Filament\Clusters\OnlinePayments\Resources\OnlinePayments\Tables;
|
namespace App\Filament\Clusters\OnlinePayments\Resources\OnlinePayments\Tables;
|
||||||
|
|
||||||
|
use App\Modules\OnlinePayment\Repositories\OnlinePaymentRepository;
|
||||||
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\Forms\Components\DatePicker;
|
||||||
|
use Filament\Tables\Columns\TextColumn;
|
||||||
|
use Filament\Tables\Filters\Filter;
|
||||||
|
use Filament\Tables\Filters\SelectFilter;
|
||||||
use Filament\Tables\Table;
|
use Filament\Tables\Table;
|
||||||
|
|
||||||
class OnlinePaymentsTable
|
class OnlinePaymentsTable
|
||||||
@@ -13,10 +18,70 @@ class OnlinePaymentsTable
|
|||||||
{
|
{
|
||||||
return $table
|
return $table
|
||||||
->columns([
|
->columns([
|
||||||
//
|
TextColumn::make('id')
|
||||||
|
->label(__('ID'))
|
||||||
|
->sortable(),
|
||||||
|
|
||||||
|
TextColumn::make('orderNumber')
|
||||||
|
->label(__('Order Number'))
|
||||||
|
->searchable()
|
||||||
|
->sortable(),
|
||||||
|
|
||||||
|
TextColumn::make('amount')
|
||||||
|
->label(__('Amount'))
|
||||||
|
->money('TMT')
|
||||||
|
->sortable(),
|
||||||
|
|
||||||
|
TextColumn::make('description')
|
||||||
|
->label(__('Description'))
|
||||||
|
->limit(50),
|
||||||
|
|
||||||
|
TextColumn::make('paymentStatus')
|
||||||
|
->label(__('Payment Status'))
|
||||||
|
->badge()
|
||||||
|
->color(fn (string $state): string => match ($state) {
|
||||||
|
OnlinePaymentRepository::PAID => 'success',
|
||||||
|
OnlinePaymentRepository::FAILED => 'danger',
|
||||||
|
default => 'warning',
|
||||||
|
})
|
||||||
|
->formatStateUsing(fn (string $state): string => OnlinePaymentRepository::statusValues()[$state] ?? $state)
|
||||||
|
->sortable(),
|
||||||
|
|
||||||
|
TextColumn::make('cardholderName')
|
||||||
|
->label(__('Cardholder Name'))
|
||||||
|
->searchable()
|
||||||
|
->sortable(),
|
||||||
|
|
||||||
|
TextColumn::make('pan')
|
||||||
|
->label(__('Card Number'))
|
||||||
|
->formatStateUsing(fn (string $state): string => $state ? '**** **** **** '.substr($state, -4) : '-')
|
||||||
|
->searchable(),
|
||||||
|
|
||||||
|
TextColumn::make('orderId')
|
||||||
|
->label(__('Order ID'))
|
||||||
|
->searchable()
|
||||||
|
->sortable(),
|
||||||
|
|
||||||
|
TextColumn::make('username')
|
||||||
|
->label(__('Username'))
|
||||||
|
->searchable()
|
||||||
|
->sortable()
|
||||||
|
->toggleable(isToggledHiddenByDefault: true),
|
||||||
|
|
||||||
|
TextColumn::make('created_at')
|
||||||
|
->label(__('Created At'))
|
||||||
|
->dateTime()
|
||||||
|
->sortable()
|
||||||
|
->toggleable(),
|
||||||
|
|
||||||
|
TextColumn::make('updated_at')
|
||||||
|
->label(__('Updated At'))
|
||||||
|
->dateTime()
|
||||||
|
->sortable()
|
||||||
|
->toggleable(isToggledHiddenByDefault: true),
|
||||||
])
|
])
|
||||||
->filters([
|
->filters([
|
||||||
//
|
|
||||||
])
|
])
|
||||||
->recordActions([
|
->recordActions([
|
||||||
EditAction::make(),
|
EditAction::make(),
|
||||||
|
|||||||
Reference in New Issue
Block a user