Noxo
Noxo
FFilament
Created by Noxo on 8/6/2024 in #❓┊help
The huge form is too slow
yes these are instances (eloquent). I couldn't figure out what the problem was. The solution is this: I created a custom page for the resource and added all the fields there. This way I was able to do it without using closure. now it works fast there.
19 replies
FFilament
Created by Noxo on 8/6/2024 in #❓┊help
The huge form is too slow
No description
19 replies
FFilament
Created by Noxo on 8/6/2024 in #❓┊help
The huge form is too slow
No description
19 replies
FFilament
Created by Noxo on 8/6/2024 in #❓┊help
The huge form is too slow
No description
19 replies
FFilament
Created by Noxo on 8/6/2024 in #❓┊help
The huge form is too slow
it seems that the problem is not in the closure, but in FieldData::from (Spatie\LaravelData). when I remove it, everything works fast. but why then does it work quickly without closure which I showed in the video.. im completely confused 🫤
19 replies
FFilament
Created by Noxo on 8/6/2024 in #❓┊help
The huge form is too slow
I found the problem. It's because I pass the function in which the tabs are built. When I removed the function, the saving speed became instant. But now the problem is that I need to somehow get the $record variable 😤
19 replies
FFilament
Created by Noxo on 8/6/2024 in #❓┊help
The huge form is too slow
there are no select fields. only text, checkbox and radio. I will try to delete parts to find out what the problem is
19 replies
FFilament
Created by Noxo on 8/6/2024 in #❓┊help
The huge form is too slow
No description
19 replies
FFilament
Created by Noxo on 8/6/2024 in #❓┊help
The huge form is too slow
No description
19 replies
FFilament
Created by Noxo on 7/29/2024 in #❓┊help
Dynamic form - CheckboxList issue
No description
19 replies
FFilament
Created by Noxo on 7/29/2024 in #❓┊help
Dynamic form - CheckboxList issue
the sorter doesn't work for me either
19 replies
FFilament
Created by Noxo on 7/29/2024 in #❓┊help
Dynamic form - CheckboxList issue
here is the code to reproduce it. could you try it on your side? https://gist.github.com/aqjw/98515c86bb9c4c360a73533cb0f27c32#file-form-php
19 replies
FFilament
Created by Noxo on 7/29/2024 in #❓┊help
Dynamic form - CheckboxList issue
the state path is always the same
19 replies
FFilament
Created by Noxo on 7/29/2024 in #❓┊help
Dynamic form - CheckboxList issue
No description
19 replies
FFilament
Created by Noxo on 7/29/2024 in #❓┊help
Dynamic form - CheckboxList issue
No description
19 replies
FFilament
Created by Noxo on 7/29/2024 in #❓┊help
Dynamic form - CheckboxList issue
No description
19 replies
FFilament
Created by Noxo on 7/29/2024 in #❓┊help
Dynamic form - CheckboxList issue
// TemplateQuestionnaireForm.php

class TemplateQuestionnaireForm
{
public static function getScheme(Template $template)
{
return $template
->fields()
->active()
->get()
->map(fn ($field) => match ($field->type) {
TemplateFieldType::Checkbox => Forms\Components\CheckboxList::make($field->id)
->label($field->label)
->default($field->default)
->options($field->options)
->extraAttributes([
'class' => 'flex flex-wrap gap-2'
]),

TemplateFieldType::Text,
TemplateFieldType::Number => Forms\Components\TextInput::make($field->id)
->numeric(TemplateFieldType::Number->is($field->type))
->label($field->label)
->default($field->default)
->maxLength(255),
})
// ->dd()
->toArray();
}
}
// TemplateQuestionnaireForm.php

class TemplateQuestionnaireForm
{
public static function getScheme(Template $template)
{
return $template
->fields()
->active()
->get()
->map(fn ($field) => match ($field->type) {
TemplateFieldType::Checkbox => Forms\Components\CheckboxList::make($field->id)
->label($field->label)
->default($field->default)
->options($field->options)
->extraAttributes([
'class' => 'flex flex-wrap gap-2'
]),

TemplateFieldType::Text,
TemplateFieldType::Number => Forms\Components\TextInput::make($field->id)
->numeric(TemplateFieldType::Number->is($field->type))
->label($field->label)
->default($field->default)
->maxLength(255),
})
// ->dd()
->toArray();
}
}
19 replies
FFilament
Created by Noxo on 7/29/2024 in #❓┊help
Dynamic form - CheckboxList issue
// resource -> form

Forms\Components\Tabs::make('Tabs')->tabs([
Forms\Components\Tabs\Tab::make('Processors')->schema([
Forms\Components\Select::make('processors')
->hiddenLabel()
->relationship('processors', 'name', modifyQueryUsing: fn ($query) => $query->active())
->searchable()
->multiple()
->live()
->preload(),
])->columns(2),
]),

Forms\Components\Tabs::make('ProcessorTabs')->tabs(function (callable $get) {
$processorIds = (array) $get('processors');
$processors = Processor::whereIn('id', $processorIds)->active()->get();
$tabs = [];

foreach ($processors as $processor) {
$processorId = $processor->id;

$tabs[] = Forms\Components\Tabs\Tab::make("processor.{$processorId}")
->label($processor->name)
->icon('heroicon-m-building-office-2')
->schema([
Forms\Components\Tabs::make('InnerProcessorTabs')->tabs(
$processor->templates()->active()->get()->map(
fn ($template) => Forms\Components\Tabs\Tab::make("processor.{$processorId}.{$template->id}")
->label($template->name)
->icon('heroicon-m-document-text')
->columns(2)
->statePath("questionnaire_data.{$processorId}.{$template->id}")
->schema(TemplateQuestionnaireForm::getScheme($template)),
)->toArray(),
),
]);
}

return $tabs;
})
// resource -> form

Forms\Components\Tabs::make('Tabs')->tabs([
Forms\Components\Tabs\Tab::make('Processors')->schema([
Forms\Components\Select::make('processors')
->hiddenLabel()
->relationship('processors', 'name', modifyQueryUsing: fn ($query) => $query->active())
->searchable()
->multiple()
->live()
->preload(),
])->columns(2),
]),

Forms\Components\Tabs::make('ProcessorTabs')->tabs(function (callable $get) {
$processorIds = (array) $get('processors');
$processors = Processor::whereIn('id', $processorIds)->active()->get();
$tabs = [];

foreach ($processors as $processor) {
$processorId = $processor->id;

$tabs[] = Forms\Components\Tabs\Tab::make("processor.{$processorId}")
->label($processor->name)
->icon('heroicon-m-building-office-2')
->schema([
Forms\Components\Tabs::make('InnerProcessorTabs')->tabs(
$processor->templates()->active()->get()->map(
fn ($template) => Forms\Components\Tabs\Tab::make("processor.{$processorId}.{$template->id}")
->label($template->name)
->icon('heroicon-m-document-text')
->columns(2)
->statePath("questionnaire_data.{$processorId}.{$template->id}")
->schema(TemplateQuestionnaireForm::getScheme($template)),
)->toArray(),
),
]);
}

return $tabs;
})
19 replies
FFilament
Created by Noxo on 9/22/2023 in #❓┊help
afterCreate - hook
you can set after inside getHeaderActions method on the List page
6 replies
FFilament
Created by Noxo on 3/3/2024 in #❓┊help
Pagination inside modal
4 replies