diff --git a/app/Filament/Clusters/VisaMasterPayments/Resources/VisaMasterPaymentOrders/Pages/EditVisaMasterPaymentOrder.php b/app/Filament/Clusters/VisaMasterPayments/Resources/VisaMasterPaymentOrders/Pages/EditVisaMasterPaymentOrder.php
index 229779d..73c8742 100644
--- a/app/Filament/Clusters/VisaMasterPayments/Resources/VisaMasterPaymentOrders/Pages/EditVisaMasterPaymentOrder.php
+++ b/app/Filament/Clusters/VisaMasterPayments/Resources/VisaMasterPaymentOrders/Pages/EditVisaMasterPaymentOrder.php
@@ -3,11 +3,13 @@
namespace App\Filament\Clusters\VisaMasterPayments\Resources\VisaMasterPaymentOrders\Pages;
use App\Filament\Clusters\VisaMasterPayments\Resources\VisaMasterPaymentOrders\VisaMasterPaymentOrderResource;
+use App\Modules\VisaMasterPaymentOrder\Filament\Actions\PayVisaMasterPaymentAction;
use Filament\Actions\DeleteAction;
use Filament\Actions\ForceDeleteAction;
use Filament\Actions\RestoreAction;
use Filament\Actions\ViewAction;
use Filament\Resources\Pages\EditRecord;
+use Illuminate\Contracts\Support\Htmlable;
class EditVisaMasterPaymentOrder extends EditRecord
{
@@ -16,10 +18,15 @@ class EditVisaMasterPaymentOrder extends EditRecord
protected function getHeaderActions(): array
{
return [
- // ViewAction::make(),
+ PayVisaMasterPaymentAction::make(),
DeleteAction::make(),
ForceDeleteAction::make(),
RestoreAction::make(),
];
}
+
+ public function getTitle(): string | Htmlable
+ {
+ return __('Order details');
+ }
}
diff --git a/app/Filament/Clusters/VisaMasterPayments/Resources/VisaMasterPaymentOrders/Schemas/VisaMasterPaymentOrderForm.php b/app/Filament/Clusters/VisaMasterPayments/Resources/VisaMasterPaymentOrders/Schemas/VisaMasterPaymentOrderForm.php
index 354e018..e766e35 100644
--- a/app/Filament/Clusters/VisaMasterPayments/Resources/VisaMasterPaymentOrders/Schemas/VisaMasterPaymentOrderForm.php
+++ b/app/Filament/Clusters/VisaMasterPayments/Resources/VisaMasterPaymentOrders/Schemas/VisaMasterPaymentOrderForm.php
@@ -31,7 +31,7 @@ class VisaMasterPaymentOrderForm
->components([
Hidden::make('user_id')->default(Auth::id()),
- Section::make(__('Order details'))
+ Section::make()
->columnSpan(4)
->columns(4)
->disabled(fn (string $context): bool => FilamentPermissionRepository::forClients())
diff --git a/app/Filament/Clusters/VisaMasterPayments/Resources/VisaMasterPaymentOrders/VisaMasterPaymentOrderResource.php b/app/Filament/Clusters/VisaMasterPayments/Resources/VisaMasterPaymentOrders/VisaMasterPaymentOrderResource.php
index 1e33d64..a1867e9 100644
--- a/app/Filament/Clusters/VisaMasterPayments/Resources/VisaMasterPaymentOrders/VisaMasterPaymentOrderResource.php
+++ b/app/Filament/Clusters/VisaMasterPayments/Resources/VisaMasterPaymentOrders/VisaMasterPaymentOrderResource.php
@@ -12,6 +12,7 @@ use App\Filament\Clusters\VisaMasterPayments\Resources\VisaMasterPaymentOrders\T
use App\Filament\Clusters\VisaMasterPayments\VisaMasterPaymentsCluster;
use App\Modules\VisaMasterPaymentOrder\Models\VisaMasterPaymentOrder;
use BackedEnum;
+use Filament\Pages\Enums\SubNavigationPosition;
use Filament\Resources\Resource;
use Filament\Schemas\Schema;
use Filament\Tables\Table;
diff --git a/app/Modules/VisaMasterPaymentOrder/Filament/Actions/PayVisaMasterPaymentAction.php b/app/Modules/VisaMasterPaymentOrder/Filament/Actions/PayVisaMasterPaymentAction.php
new file mode 100644
index 0000000..a3ef979
--- /dev/null
+++ b/app/Modules/VisaMasterPaymentOrder/Filament/Actions/PayVisaMasterPaymentAction.php
@@ -0,0 +1,108 @@
+label(__('Make payment'))
+ ->icon('heroicon-o-credit-card')
+ ->modal()
+ ->schema(function () {
+ // $usd_to_tmt = floatval(CurrencyRate::where('currency_from', 'USD')->where('currency_to', 'TMT')->first('value')?->value);
+
+ // $payment_warning_text = VisaMasterSettings::where('name', 'payment_warning_text')->first();
+
+ // if (! $usd_to_tmt || ! $payment_warning_text) {
+ // return [];
+ // }
+
+ // $max_value = number_format($usd_to_tmt * 250, 2);
+
+ // return [
+ // Section::make('Customer Information')
+ // ->schema([
+ // TextEntry::make('1 USD = $usd_to_tmt TMT')
+ // ->extraAttributes(['class' => 'uppercase tracking-wide font-bold text-xs'])
+ // ->label(__('1 USD = $usd_to_tmt TMT')),
+ // TextEntry::make('Bankyň tutumy: 20 TMT')
+ // ->extraAttributes(['class' => 'uppercase tracking-wide font-bold text-xs'])
+ // ->label(__('Bankyň tutumy: 20 TMT')),
+ // TextEntry::make('GBÜS tutumy: 3 TMT')
+ // ->extraAttributes(['class' => 'uppercase tracking-wide font-bold text-xs'])
+ // ->label(__('GBÜS tutumy: 3 TMT')),
+ // ])
+
+ // Text::make(__('Töleg aý'), 'month')
+ // ->fullWidth()
+ // ->readonly()
+ // ->default(today()->translatedFormat('F')),
+
+ // Text::make(sprintf('%s (%s)', __('Töleg möçberi'), __('TMT')), 'payment_amount')
+ // ->fullWidth()
+ // ->required()
+ // ->rules('required', 'numeric', 'max:'.$max_value)
+ // ->help("Iň ýokary möçberi: {$max_value} TMT"),
+
+ // Text::make(__('USD ekwalendi'), 'usd_rate')
+ // ->fullWidth()
+ // ->readonly()
+ // ->dependsOn('payment_amount', function (Text $field, NovaRequest $request, FormData $formData) use ($usd_to_tmt) {
+ // $payment_amount = $formData->get('payment_amount');
+
+ // if ($payment_amount) {
+ // $field->setValue(number_format($payment_amount / $usd_to_tmt, 2, '.', ''));
+ // } else {
+ // $field->setValue('');
+ // }
+ // }),
+
+ // Hidden::make('usd_payment')
+ // ->dependsOn('payment_amount', function (Hidden $field, NovaRequest $request, FormData $formData) use ($usd_to_tmt) {
+ // $payment_amount = $formData->get('payment_amount');
+
+ // if ($payment_amount) {
+ // $field->setValue(number_format($payment_amount / $usd_to_tmt, 2, '.', ''));
+ // } else {
+ // $field->setValue('');
+ // }
+ // }),
+
+ // Text::make(__('Jemi (TMT)'), 'total_amount')
+ // ->fullWidth()
+ // ->readonly()
+ // ->dependsOn('payment_amount', function ($field, $request, $formData) {
+ // $payment_amount = $formData->get('payment_amount');
+
+ // if ($payment_amount) {
+ // $field->setValue(
+ // floatval(number_format($payment_amount, 2, '.', '')) + 23
+ // );
+ // } else {
+ // $field->setValue('');
+ // }
+ // }),
+
+ // Heading::make(Blade::render(<<
+ //
+ // $payment_warning_text->value
+ //
+ // HTML))->asHtml(),
+ // ];
+ })
+ ->action(function (array $data, VisaMasterPaymentOrder $record): void {
+ // $record->author()->associate($data['authorId']);
+ // $record->save();
+ })
+ ->modalFooterActions([]);
+ }
+}
\ No newline at end of file