diff --git a/app/Filament/Clusters/VisaMasterPayments/Resources/VisaMasterPaymentOrders/Schemas/VisaMasterPaymentOrderForm.php b/app/Filament/Clusters/VisaMasterPayments/Resources/VisaMasterPaymentOrders/Schemas/VisaMasterPaymentOrderForm.php index 4a7c785..96e31bf 100644 --- a/app/Filament/Clusters/VisaMasterPayments/Resources/VisaMasterPaymentOrders/Schemas/VisaMasterPaymentOrderForm.php +++ b/app/Filament/Clusters/VisaMasterPayments/Resources/VisaMasterPaymentOrders/Schemas/VisaMasterPaymentOrderForm.php @@ -2,10 +2,10 @@ namespace App\Filament\Clusters\VisaMasterPayments\Resources\VisaMasterPaymentOrders\Schemas; -use App\Modules\Filament\Traits\HasFilamentUser; +use App\Modules\FilamentPermission\Repositories\FilamentPermissionRepository; +use App\Modules\OrderStatus\Repositories\OrderStatusRepository; use App\Modules\Region\Repositories\RegionRepository; use App\Modules\VisaMasterPaymentOrder\Models\VisaMasterPaymentOrder; -use App\Modules\VisaMasterPaymentOrder\Repositories\VisaMasterPaymentOrderRepository; use Filament\Forms\Components\FileUpload; use Filament\Forms\Components\Hidden; use Filament\Forms\Components\KeyValue; @@ -14,12 +14,12 @@ use Filament\Forms\Components\Select; use Filament\Forms\Components\Textarea; use Filament\Forms\Components\TextInput; use Filament\Forms\Components\Toggle; +use Filament\Schemas\Components\Fieldset; use Filament\Schemas\Components\Section; use Filament\Schemas\Components\Wizard; use Filament\Schemas\Components\Wizard\Step; use Filament\Schemas\Schema; use Filament\Support\Icons\Heroicon; -use Illuminate\Database\Eloquent\Builder; use Illuminate\Support\Facades\Auth; class VisaMasterPaymentOrderForm @@ -33,16 +33,17 @@ class VisaMasterPaymentOrderForm Section::make(__('Order details')) ->columnSpan(4) ->columns(4) + ->disabled(fn (string $context): bool => FilamentPermissionRepository::forClients()) ->components([ Select::make('status') ->label(__('Status')) - ->options(VisaMasterPaymentOrderRepository::statusValues()) - ->default(VisaMasterPaymentOrderRepository::defaultStatus()) + ->options(OrderStatusRepository::statusValues()) + ->default(OrderStatusRepository::defaultStatus()) ->native(false) ->columnSpan(2), Toggle::make('paid') - ->label(__('Paid')) + ->label(sprintf('%s (%s)', __('Paid'), __('This month'))) ->inline(false) ->disabled(true) ->onIcon(Heroicon::CheckCircle) @@ -56,19 +57,38 @@ class VisaMasterPaymentOrderForm ]), Wizard::make([ - Step::make(__('General information')) + Step::make(__('Order type and bank')) ->schema([ - Select::make('type') - ->label(__('Type')) - ->options(VisaMasterPaymentOrder::applicationTypes()) - ->native(false) - ->required(), + Fieldset::make(__('Order type')) + ->schema([ + Select::make('type') + ->label(__('Type')) + ->options(VisaMasterPaymentOrder::applicationTypes()) + ->native(false) + ->required(), + ]), - Select::make('branch_id') - ->label(__('Branch')) - ->relationship('branch', 'name', fn (Builder $query) => $query->orderByTranslation('name')) - ->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(__('Personal information')) ->columns(2) diff --git a/app/Filament/Clusters/VisaMasterPayments/VisaMasterPaymentsCluster.php b/app/Filament/Clusters/VisaMasterPayments/VisaMasterPaymentsCluster.php index 4b8c32e..ed1d235 100644 --- a/app/Filament/Clusters/VisaMasterPayments/VisaMasterPaymentsCluster.php +++ b/app/Filament/Clusters/VisaMasterPayments/VisaMasterPaymentsCluster.php @@ -9,14 +9,12 @@ use Filament\Support\Icons\Heroicon; class VisaMasterPaymentsCluster extends Cluster { - protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedUsers; - - protected static string|BackedEnum|null $activeNavigationIcon = Heroicon::Users; + protected static string|BackedEnum|null $navigationIcon = 'icon-visa-plain'; protected static ?SubNavigationPosition $subNavigationPosition = SubNavigationPosition::Top; public static function getNavigationLabel(): string { - return __('Visa/Master payments'); + return __('International payments'); } } 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 29bd67a..2128070 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 @@ -16,6 +16,7 @@ return new class extends Migration $table->string('unique_id')->nullable()->unique(); $table->string('type')->nullable(); + $table->string('passport_name')->nullable(); $table->string('passport_surname')->nullable(); $table->string('phone')->nullable(); diff --git a/app/Modules/VisaMasterPaymentOrder/Repositories/VisaMasterPaymentOrderRepository.php b/app/Modules/VisaMasterPaymentOrder/Repositories/VisaMasterPaymentOrderRepository.php index 905842d..7884401 100644 --- a/app/Modules/VisaMasterPaymentOrder/Repositories/VisaMasterPaymentOrderRepository.php +++ b/app/Modules/VisaMasterPaymentOrder/Repositories/VisaMasterPaymentOrderRepository.php @@ -7,27 +7,4 @@ use App\Modules\Makeable; class VisaMasterPaymentOrderRepository { use Makeable; - - /** - * Default status - */ - public static function defaultStatus(): string - { - return 'new'; - } - - /** - * Status values - * - * @return array - */ - public static function statusValues(): array - { - return [ - 'new' => __('New'), - 'in_progress' => __('In progress'), - 'completed' => __('Completed'), - 'rejected' => __('Rejected'), - ]; - } } diff --git a/lang/tk.json b/lang/tk.json index a3884c9..bf09c73 100644 --- a/lang/tk.json +++ b/lang/tk.json @@ -695,5 +695,10 @@ "Married": "Öýlenen/Durmuşa çykan", "Divorced": "Aýrylşan", "Single": "Öýlenmedik/Durmuşa çykmadyk", - "By operator": "Operatordan" + "By operator": "Operatordan", + "Rejected": "Ýatyrylan", + "Order type and bank": "Ýüztutmanyň görnüşi we bank", + "Order type": "Ýüztutmanyň görnüşi", + "Type": "Görnüş", + "International payments": "Halkara tölegler" } diff --git a/resources/svg/money-glass.svg b/resources/svg/money-glass.svg new file mode 100644 index 0000000..ecb44f4 --- /dev/null +++ b/resources/svg/money-glass.svg @@ -0,0 +1,33 @@ + + money-bill + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/svg/visa-plain.svg b/resources/svg/visa-plain.svg new file mode 100644 index 0000000..4627bd5 --- /dev/null +++ b/resources/svg/visa-plain.svg @@ -0,0 +1 @@ + diff --git a/resources/svg/visa.svg b/resources/svg/visa.svg new file mode 100644 index 0000000..0179a28 --- /dev/null +++ b/resources/svg/visa.svg @@ -0,0 +1,11 @@ + + + + + + + + + + +