Completed Wizard step

We are are building a very custom import of an XLSX file which is not possible with a pre-built Import action. In the first step, the file gets selected and uploaded. In the second step, the file gets imported. As a result in the 3rd step, I want to show a last step with the output of the import. E.g. how many rows have been imported, how many have some data missing, etc. Any idea on how I could achieve that "completed" step in the Wizard?
Solution:
Here's my final schema. I used afterValidation in the end. ``` ->schema([ Wizard::make([...
Jump to solution
5 Replies
toeknee
toeknee4mo ago
Yes, use afterStateUpdated in step 2 to upload, and step 3 should be complete which loads the results in with a custom livewire view or table of the imported records.
Andreas Pattynama
Andreas PattynamaOP4mo ago
@toeknee thank you for the tip, I'm doing it similarly now:
Wizard\Step::make('Importieren')
->afterValidation(function () {
$this->import();
})
->schema([]),
Wizard\Step::make('Importieren')
->afterValidation(function () {
$this->import();
})
->schema([]),
How would I load a custom view for a complete step?
toeknee
toeknee4mo ago
ViewField::make()
Andreas Pattynama
Andreas PattynamaOP4mo ago
worked like a charm. Thank you!
Solution
Andreas Pattynama
Here's my final schema. I used afterValidation in the end.
->schema([
Wizard::make([
Wizard\Step::make('Datei importieren')
->afterValidation(function () {
$this->import();
})
->schema([
FileUpload::make('file')
->disk('local')
->label('')
->directory('credit-imports')
->visibility('private')
->required(),
]),
Wizard\Step::make('Status')
->schema([
ViewField::make('status')->view(
'filament.pages.upload-credits-status'
)->viewData([
'importOutcome' => $this->importOutcome,
]),
])
])
])
->schema([
Wizard::make([
Wizard\Step::make('Datei importieren')
->afterValidation(function () {
$this->import();
})
->schema([
FileUpload::make('file')
->disk('local')
->label('')
->directory('credit-imports')
->visibility('private')
->required(),
]),
Wizard\Step::make('Status')
->schema([
ViewField::make('status')->view(
'filament.pages.upload-credits-status'
)->viewData([
'importOutcome' => $this->importOutcome,
]),
])
])
])
Want results from more Discord servers?
Add your server