diff --git a/app/Modules/VisaMasterPaymentOrder/Database/Migrations/2025_11_13_215431_create_visa_master_settings_table.php b/app/Modules/VisaMasterPaymentOrder/Database/Migrations/2025_11_13_215431_create_visa_master_settings_table.php new file mode 100644 index 0000000..0b63bca --- /dev/null +++ b/app/Modules/VisaMasterPaymentOrder/Database/Migrations/2025_11_13_215431_create_visa_master_settings_table.php @@ -0,0 +1,30 @@ +id(); + $table->string('name')->unique(); + $table->string('display_name'); + $table->text('value'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('visa_master_settings'); + } +}; diff --git a/app/Modules/VisaMasterPaymentOrder/Filament/Actions/PayVisaMasterPaymentAction.php b/app/Modules/VisaMasterPaymentOrder/Filament/Actions/PayVisaMasterPaymentAction.php index f8a6687..7433ddf 100644 --- a/app/Modules/VisaMasterPaymentOrder/Filament/Actions/PayVisaMasterPaymentAction.php +++ b/app/Modules/VisaMasterPaymentOrder/Filament/Actions/PayVisaMasterPaymentAction.php @@ -4,7 +4,11 @@ namespace App\Modules\VisaMasterPaymentOrder\Filament\Actions; use App\Modules\CurrencyRate\Models\CurrencyRate; use App\Modules\VisaMasterPaymentOrder\Models\VisaMasterPaymentOrder; +use App\Modules\VisaMasterPaymentOrder\Models\VisaMasterSettings; use Filament\Actions\Action; +use Filament\Forms\Components\TextInput; +use Filament\Infolists\Components\TextEntry; +use Filament\Schemas\Components\Section; class PayVisaMasterPaymentAction { @@ -17,32 +21,37 @@ class PayVisaMasterPaymentAction ->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(); + $payment_warning_text = VisaMasterSettings::where('name', 'payment_warning_text')->first(); - // if (! $usd_to_tmt || ! $payment_warning_text) { - // return []; - // } + if (! $usd_to_tmt || ! $payment_warning_text) { + return []; + } - // $max_value = number_format($usd_to_tmt * 250, 2); + $bank_fee = 20; + $gbus_fee = 3; + $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')), - // ]) + return [ + Section::make('Customer Information') + ->schema([ + TextEntry::make('usd_to_tmt') + ->extraAttributes(['class' => 'uppercase tracking-wide font-bold text-xs']) + ->label(sprintf('1 USD = %s TMT', $usd_to_tmt)), - // Text::make(__('Töleg aý'), 'month') - // ->fullWidth() - // ->readonly() - // ->default(today()->translatedFormat('F')), + TextEntry::make('bank_fee') + ->extraAttributes(['class' => 'uppercase tracking-wide font-bold text-xs']) + ->label(sprintf('Bankyň tutumy: %s TMT', $bank_fee)), + + TextEntry::make('gbus_fee') + ->extraAttributes(['class' => 'uppercase tracking-wide font-bold text-xs']) + ->label(sprintf('GBÜS tutumy: %s TMT', $gbus_fee)), + ]), + + TextInput::make(__('Töleg aý'), 'month') + ->fullWidth() + ->readonly() + ->default(today()->translatedFormat('F')), + ]; // Text::make(sprintf('%s (%s)', __('Töleg möçberi'), __('TMT')), 'payment_amount') // ->fullWidth() diff --git a/app/Modules/VisaMasterPaymentOrder/Models/VisaMasterSettings.php b/app/Modules/VisaMasterPaymentOrder/Models/VisaMasterSettings.php new file mode 100644 index 0000000..d9035ab --- /dev/null +++ b/app/Modules/VisaMasterPaymentOrder/Models/VisaMasterSettings.php @@ -0,0 +1,10 @@ +