work on pay visa master action

This commit is contained in:
2025-11-13 22:00:23 +05:00
parent 3ea35f6bca
commit 54e11dcbb4
3 changed files with 71 additions and 22 deletions

View File

@@ -0,0 +1,30 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('visa_master_settings', function (Blueprint $table) {
$table->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');
}
};

View File

@@ -4,7 +4,11 @@ namespace App\Modules\VisaMasterPaymentOrder\Filament\Actions;
use App\Modules\CurrencyRate\Models\CurrencyRate; use App\Modules\CurrencyRate\Models\CurrencyRate;
use App\Modules\VisaMasterPaymentOrder\Models\VisaMasterPaymentOrder; use App\Modules\VisaMasterPaymentOrder\Models\VisaMasterPaymentOrder;
use App\Modules\VisaMasterPaymentOrder\Models\VisaMasterSettings;
use Filament\Actions\Action; use Filament\Actions\Action;
use Filament\Forms\Components\TextInput;
use Filament\Infolists\Components\TextEntry;
use Filament\Schemas\Components\Section;
class PayVisaMasterPaymentAction class PayVisaMasterPaymentAction
{ {
@@ -17,32 +21,37 @@ class PayVisaMasterPaymentAction
->schema(function () { ->schema(function () {
$usd_to_tmt = floatval(CurrencyRate::where('currency_from', 'USD')->where('currency_to', 'TMT')->first('value')?->value); $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) { if (! $usd_to_tmt || ! $payment_warning_text) {
// return []; 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 [ return [
// Section::make('Customer Information') Section::make('Customer Information')
// ->schema([ ->schema([
// TextEntry::make('1 USD = $usd_to_tmt TMT') TextEntry::make('usd_to_tmt')
// ->extraAttributes(['class' => 'uppercase tracking-wide font-bold text-xs']) ->extraAttributes(['class' => 'uppercase tracking-wide font-bold text-xs'])
// ->label(__('1 USD = $usd_to_tmt TMT')), ->label(sprintf('1 USD = %s TMT', $usd_to_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') TextEntry::make('bank_fee')
// ->fullWidth() ->extraAttributes(['class' => 'uppercase tracking-wide font-bold text-xs'])
// ->readonly() ->label(sprintf('Bankyň tutumy: %s TMT', $bank_fee)),
// ->default(today()->translatedFormat('F')),
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') // Text::make(sprintf('%s (%s)', __('Töleg möçberi'), __('TMT')), 'payment_amount')
// ->fullWidth() // ->fullWidth()

View File

@@ -0,0 +1,10 @@
<?php
namespace App\Modules\VisaMasterPaymentOrder\Models;
use Illuminate\Database\Eloquent\Model;
class VisaMasterSettings extends Model
{
protected $table = 'visa_master_settings';
}