From 0da1efe5c3b22073dcf904b6d8397a530f7ad835 Mon Sep 17 00:00:00 2001 From: Nurmuhammet Allanov Date: Mon, 10 Nov 2025 19:18:53 +0500 Subject: [PATCH] wip --- .../Schemas/VisaMasterPaymentOrderForm.php | 200 +++++++++--------- .../VisaMasterPaymentOrderResource.php | 3 +- .../Traits/UserAdjustments.php | 8 + ...reate_visa_master_payment_orders_table.php | 5 + lang/tk.json | 8 +- 5 files changed, 119 insertions(+), 105 deletions(-) diff --git a/app/Filament/Clusters/VisaMasterPayments/Resources/VisaMasterPaymentOrders/Schemas/VisaMasterPaymentOrderForm.php b/app/Filament/Clusters/VisaMasterPayments/Resources/VisaMasterPaymentOrders/Schemas/VisaMasterPaymentOrderForm.php index 96e31bf..e2e5479 100644 --- a/app/Filament/Clusters/VisaMasterPayments/Resources/VisaMasterPaymentOrders/Schemas/VisaMasterPaymentOrderForm.php +++ b/app/Filament/Clusters/VisaMasterPayments/Resources/VisaMasterPaymentOrders/Schemas/VisaMasterPaymentOrderForm.php @@ -4,7 +4,9 @@ namespace App\Filament\Clusters\VisaMasterPayments\Resources\VisaMasterPaymentOr use App\Modules\FilamentPermission\Repositories\FilamentPermissionRepository; use App\Modules\OrderStatus\Repositories\OrderStatusRepository; +use App\Modules\PhoneNumberVerification\Rules\PhoneNumberVerificationRule; use App\Modules\Region\Repositories\RegionRepository; +use App\Modules\TurkmenPassport\Repositories\TurkmenPassportRepository; use App\Modules\VisaMasterPaymentOrder\Models\VisaMasterPaymentOrder; use Filament\Forms\Components\FileUpload; use Filament\Forms\Components\Hidden; @@ -15,6 +17,7 @@ use Filament\Forms\Components\Textarea; use Filament\Forms\Components\TextInput; use Filament\Forms\Components\Toggle; use Filament\Schemas\Components\Fieldset; +use Filament\Schemas\Components\FusedGroup; use Filament\Schemas\Components\Section; use Filament\Schemas\Components\Wizard; use Filament\Schemas\Components\Wizard\Step; @@ -57,123 +60,118 @@ class VisaMasterPaymentOrderForm ]), Wizard::make([ - Step::make(__('Order type and bank')) + // Step::make(__('Order type and bank')) + // ->schema([ + // Fieldset::make(__('Order type')) + // ->schema([ + // Select::make('type') + // ->label(__('Type')) + // ->options(VisaMasterPaymentOrder::applicationTypes()) + // ->native(false) + // ->required(), + // ]), + + // Fieldset::make(__('Location')) + // ->schema([ + // Select::make('region') + // ->label(__('Region')) + // ->options(RegionRepository::values()) + // ->live() + // ->afterStateUpdated(fn (callable $set) => $set('branch_id', null)) + // ->required(), + + // Select::make('branch_id') + // ->label(__('Branch')) + // ->relationship('branch', 'name', function ($query, callable $get) { + // $query->orderByTranslation('name'); + + // $region = $get('region'); + // if ($region) { + // $query->where('region', $region); + // } + // }) + // ->required(), + // ]), + // ]), + Step::make(__('Payment sender data')) + ->columns(8) ->schema([ - Fieldset::make(__('Order type')) - ->schema([ - Select::make('type') - ->label(__('Type')) - ->options(VisaMasterPaymentOrder::applicationTypes()) - ->native(false) - ->required(), - ]), + TextInput::make('sender_full_name') + ->label(__('Name, Surname, Patronic name')) + ->columnSpan(4) + ->default(user()->fullName()) + ->required(), - Fieldset::make(__('Location')) - ->schema([ - Select::make('region') - ->label(__('Region')) - ->options(RegionRepository::values()) - ->live() - ->afterStateUpdated(fn (callable $set) => $set('branch_id', null)) - ->required(), + FusedGroup::make([ + Select::make('sender_passport_serie') + ->label(__('Passport serie')) + ->options(TurkmenPassportRepository::values()) + ->native(false) + ->required() + ->columnSpan(1) + ->default(user()->getOption('passport_serie')), - Select::make('branch_id') - ->label(__('Branch')) - ->relationship('branch', 'name', function ($query, callable $get) { - $query->orderByTranslation('name'); - - $region = $get('region'); - if ($region) { - $query->where('region', $region); - } - }) - ->required(), - ]), - ]), - Step::make(__('Personal information')) - ->columns(2) - ->schema([ - TextInput::make('passport_name') - ->label(__('Name')) - ->required() - ->maxLength(255), - - TextInput::make('passport_surname') - ->label(__('Surname')) - ->required() - ->maxLength(255), + TextInput::make('sender_passport_number') + ->label(__('Passport number')) + ->required() + ->columnSpan(1) + ->mask('999999') + ->default(user()->getOption('passport_id')), + ]) + ->columnSpan(2) + ->label(__('Passport serie and number')) + ->columns(2), TextInput::make('phone') ->label(__('Phone')) ->required() - ->tel(), - - TextInput::make('email') - ->label(__('Email')) - ->email(), - - Select::make('region') - ->label(__('Region')) - ->options(RegionRepository::values()) - ->native(false) - ->required(), - - Textarea::make('address') - ->label(__('Address')) - ->columnSpanFull(), - ]), - - Step::make(__('Sender information')) - ->schema([ - TextInput::make('sender_full_name') - ->label(__('Sender full name')) - ->required(), - - TextInput::make('sender_passport_serie') - ->label(__('Sender passport serie')) - ->required(), - - TextInput::make('sender_passport_number') - ->label(__('Sender passport number')) - ->required(), + ->mask('99 99 99 99') + ->prefix('+993') + ->rules([ + new PhoneNumberVerificationRule, + ]) + ->columnSpan(2) + ->default(user()->phone), TextInput::make('sender_deposit_account') - ->label(__('Sender deposit account')) + ->label(__('Deposit account')) + ->columnSpan(4) + ->required(), + + TextInput::make('address') + ->label(__('Address')) + ->columnSpan(4) ->required(), ]), - Step::make(__('JSON data')) + Step::make(__('Payee information')) + ->columns(8) ->schema([ - KeyValue::make('sender_datas') - ->label(__('Sender data')), + TextInput::make('reciever_full_name') + ->label(__('Name, Surname, Patronic name')) + ->columnSpan(5) + ->required(), - KeyValue::make('payment_reciever') - ->label(__('Payment receiver')), + FusedGroup::make([ + Select::make('reciever_passport_serie') + ->label(__('Passport serie')) + ->options(TurkmenPassportRepository::values()) + ->native(false) + ->required() + ->columnSpan(1), + + TextInput::make('reciever_passport_number') + ->label(__('Passport number')) + ->required() + ->columnSpan(1) + ->mask('999999'), + ]) + ->columnSpan(3) + ->label(__('Passport serie and number')) + ->columns(2), ]), - Step::make(__('Receiver documents')) - ->schema( - collect(VisaMasterPaymentOrder::reciverFiles()) - ->map(function (array $file) { - return FileUpload::make('documents.'.$file['code']) - ->label($file['name']) - ->required($file['required']); - }) - ->toArray() - ), - - Step::make(__('Sender documents')) - ->schema( - collect(VisaMasterPaymentOrder::senderFiles()) - ->map(function (array $file) { - return FileUpload::make('documents.sender.'.$file['code']) - ->label($file['name']) - ->required($file['required']); - }) - ->toArray() - ), - - ])->columnSpanFull(), + ])->columnSpanFull()->skippable(), ]); } } diff --git a/app/Filament/Clusters/VisaMasterPayments/Resources/VisaMasterPaymentOrders/VisaMasterPaymentOrderResource.php b/app/Filament/Clusters/VisaMasterPayments/Resources/VisaMasterPaymentOrders/VisaMasterPaymentOrderResource.php index 1c4776b..3754b28 100644 --- a/app/Filament/Clusters/VisaMasterPayments/Resources/VisaMasterPaymentOrders/VisaMasterPaymentOrderResource.php +++ b/app/Filament/Clusters/VisaMasterPayments/Resources/VisaMasterPaymentOrders/VisaMasterPaymentOrderResource.php @@ -14,7 +14,6 @@ use App\Modules\VisaMasterPaymentOrder\Models\VisaMasterPaymentOrder; use BackedEnum; use Filament\Resources\Resource; use Filament\Schemas\Schema; -use Filament\Support\Icons\Heroicon; use Filament\Tables\Table; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\SoftDeletingScope; @@ -29,6 +28,8 @@ class VisaMasterPaymentOrderResource extends Resource protected static ?string $recordTitleAttribute = 'id'; + protected static string|BackedEnum|null $navigationIcon = 'icon-visa-plain'; + public static function getNavigationGroup(): ?string { return __('Visa/Master payments'); diff --git a/app/Modules/UserAdjustments/Traits/UserAdjustments.php b/app/Modules/UserAdjustments/Traits/UserAdjustments.php index 6bad5e6..ae57592 100644 --- a/app/Modules/UserAdjustments/Traits/UserAdjustments.php +++ b/app/Modules/UserAdjustments/Traits/UserAdjustments.php @@ -83,4 +83,12 @@ trait UserAdjustments { return $this->hasMany(UserBranch::class); } + + /** + * Full name + */ + public function fullName(): string + { + return sprintf('%s %s', $this->first_name, $this->last_name); + } } diff --git a/app/Modules/VisaMasterPaymentOrder/Database/Migrations/2025_11_07_011931_create_visa_master_payment_orders_table.php b/app/Modules/VisaMasterPaymentOrder/Database/Migrations/2025_11_07_011931_create_visa_master_payment_orders_table.php index fc2d7c5..64ab0c8 100644 --- a/app/Modules/VisaMasterPaymentOrder/Database/Migrations/2025_11_07_011931_create_visa_master_payment_orders_table.php +++ b/app/Modules/VisaMasterPaymentOrder/Database/Migrations/2025_11_07_011931_create_visa_master_payment_orders_table.php @@ -41,6 +41,11 @@ return new class extends Migration $table->string('sender_passport_number')->nullable(); $table->string('sender_deposit_account')->nullable(); + $table->string('reciever_full_name')->nullable(); + $table->string('reciever_passport_serie')->nullable(); + $table->string('reciever_passport_number')->nullable(); + $table->string('reciever_deposit_account')->nullable(); + $table->boolean('paid')->default(true); $table->softDeletes(); diff --git a/lang/tk.json b/lang/tk.json index bf09c73..e04bfc6 100644 --- a/lang/tk.json +++ b/lang/tk.json @@ -572,9 +572,8 @@ "Please, now verify your phone number to continue": "Dowam etmek üçin telefon belgiňizi tassyklaň", "Swift payments": "Swift tölegler", "Swift payment": "Swift töleg", - "International payments": "Halkara tölegler", "Visa, Master, Sber, WU": "Visa, Master, Sber, WU", - "Visa/Master payment": "Visa/Master tölegler", + "Visa/Master payment": "Visa/Master töleg", "Visa/Master payments": "Visa/Master tölegleri", "For students": "Talyplar üçin", "Application type": "Ýüztutmanyň görnüşi", @@ -700,5 +699,8 @@ "Order type and bank": "Ýüztutmanyň görnüşi we bank", "Order type": "Ýüztutmanyň görnüşi", "Type": "Görnüş", - "International payments": "Halkara tölegler" + "International payments": "Halkara tölegler", + "Order details": "Sargyt barada", + "Name, Surname, Patronic name": "Ady, Familiýasy, Atasynyň ady", + "Deposit account": "Goýum hasaby" }