wip
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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<string, string>
|
||||
*/
|
||||
public static function statusValues(): array
|
||||
{
|
||||
return [
|
||||
'new' => __('New'),
|
||||
'in_progress' => __('In progress'),
|
||||
'completed' => __('Completed'),
|
||||
'rejected' => __('Rejected'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user