Вот что у меня пока есть:
Код: Выделить всё
public static function form(Form $form): Form
{
return $form
->schema([
Wizard::make([
Wizard\Step::make('Wihtdrawal')
->icon('heroicon-o-currency-dollar')
->completedIcon('heroicon-s-currency-dollar')
->description('Transaction details')
->columns(2)
->schema([
Forms\Components\TextInput::make('amount')
->required()
->numeric()
->minValue(1)
->mask(RawJs::make('$money($input)'))
->stripCharacters(',')
->prefix('KM'),
Forms\Components\Select::make('store_id')
->label('Office')
->searchable()
->required()
->options(Auth::user()->currentCompany->stores()->where('status', true)->pluck('name', 'id')),
])->afterValidation(function (Forms\Get $get, Forms\Set $set) {
$currency = Currency::where('code', 'BAM')->first();
$store = Store::find($get('store_id'));
$set('store_name', $store->name);
$set('withdrawal_currency', $currency->code);
$set('withdrawal_amount', $get('amount'));
$formatter = new \NumberFormatter('en', \NumberFormatter::SPELLOUT);
$set('withdrawal_amount_text', $formatter->format(str_replace(',', '', $get('amount'))));
}),
Wizard\Step::make('Overview')
->icon('heroicon-o-check-circle')
->completedIcon('heroicon-c-check-circle')
->description('Confirm transaction')
->schema([
Forms\Components\Fieldset::make('Deposit')
->columns(3)
->schema([
Placeholder::make('review_store_name')
->label('Office')
->content(fn(Get $get): string => $get('store_name') ?? ''),
Placeholder::make('review_withdrawal_amount')
->label('Amount')
->content(fn(Get $get): string => $get('withdrawal_amount') ?? ''),
Placeholder::make('review_withdrawal_currency')
->label('Currency')
->content(fn(Get $get): string => $get('withdrawal_currency') ?? ''),
Placeholder::make('review_withdrawal_amount_text')
->label('Text amount')
->content(fn(Get $get): string => $get('withdrawal_amount_text') ?? ''),
])->columns(2),
]),
])
->skippable(false)
->columnSpanFull()
->submitAction(new HtmlString(Blade::render(
Подробнее здесь: [url]https://stackoverflow.com/questions/78866901/how-to-render-a-confirmation-modal-before-submitting-wizard-form-filamentphp[/url]