Azorky
Azorky
FFilament
Created by Azorky on 1/23/2025 in #❓┊help
Hidden fields not dehydrating
This is it, thank you so much
8 replies
FFilament
Created by Azorky on 1/23/2025 in #❓┊help
Hidden fields not dehydrating
I tried using it without the fieldset, but that gives me the same result
8 replies
FFilament
Created by Azorky on 1/23/2025 in #❓┊help
Hidden fields not dehydrating
This is getJournalSelectField for example:
Forms\Components\Select::make('journal_id')
->label(__('resources/journals.label'))
->visible(fn (Get $get) => (isset(Filament::getTenant()->accountingIntegration) && $get('show_gl_account_field')))
->relationship('journal', 'id', fn (Builder $query) => $query->where('type', JournalType::PURCHASE))
->saveRelationshipsUsing(function ($record, $state) {
dd($record, $state); // Not triggered when saving & field is hidden
$record->journal_id = $state;
$record->save();
})
->getOptionLabelFromRecordUsing(fn (Journal $record) => $record->name)
->dehydrateStateUsing(fn (string $state): string => dd($state)) // Not triggered when saving & field is hidden
->searchable()
->dehydrated()
->preload()
->default(fn () => Filament::getTenant()->settings()->get('purchase_invoice.default_journal_id')),
Forms\Components\Select::make('journal_id')
->label(__('resources/journals.label'))
->visible(fn (Get $get) => (isset(Filament::getTenant()->accountingIntegration) && $get('show_gl_account_field')))
->relationship('journal', 'id', fn (Builder $query) => $query->where('type', JournalType::PURCHASE))
->saveRelationshipsUsing(function ($record, $state) {
dd($record, $state); // Not triggered when saving & field is hidden
$record->journal_id = $state;
$record->save();
})
->getOptionLabelFromRecordUsing(fn (Journal $record) => $record->name)
->dehydrateStateUsing(fn (string $state): string => dd($state)) // Not triggered when saving & field is hidden
->searchable()
->dehydrated()
->preload()
->default(fn () => Filament::getTenant()->settings()->get('purchase_invoice.default_journal_id')),
8 replies
FFilament
Created by Azorky on 1/23/2025 in #❓┊help
Hidden fields not dehydrating
->saveRelationshipUsing is also not triggered when the fields are hidden
8 replies
FFilament
Created by Azorky on 1/23/2025 in #❓┊help
Hidden fields not dehydrating
No description
8 replies
FFilament
Created by Azorky on 12/11/2024 in #❓┊help
Lazy load tab
I was wrong, it is not working
4 replies
FFilament
Created by Azorky on 12/11/2024 in #❓┊help
Lazy load tab
I managed to solve it like this:
Tabs\Tab::make('companyweb')
->label(__('integrations.companyweb.label'))
->icon('icon-companyweb')
->schema(fn (Customer $customer) => [
Livewire::make(CompanywebLoader::class, ['customerId' => $customer->id]),
])
Tabs\Tab::make('companyweb')
->label(__('integrations.companyweb.label'))
->icon('icon-companyweb')
->schema(fn (Customer $customer) => [
Livewire::make(CompanywebLoader::class, ['customerId' => $customer->id]),
])
companyweb-loader.blade.php
<div>
<livewire:integrations.companyweb.companyweb-overview lazy :customerId="$customerId" />
</div>
<div>
<livewire:integrations.companyweb.companyweb-overview lazy :customerId="$customerId" />
</div>
CompanywebOverview.php (The actual class I want lazy loaded)
class CompanywebOverview extends Component
{
public ?int $customerId;

public function render()
{
Log::debug('render companyweb overview');
Log::debug($this->customerId);

return view('livewire.integrations.companyweb.companyweb-overview');
}
}
class CompanywebOverview extends Component
{
public ?int $customerId;

public function render()
{
Log::debug('render companyweb overview');
Log::debug($this->customerId);

return view('livewire.integrations.companyweb.companyweb-overview');
}
}
I will now create an infolist in this custom livewire component. Although this is a 'solution', I don't think it's optimal. Instead having a ->lazy() on tabs would be pretty cool
4 replies
FFilament
Created by Azorky on 11/21/2024 in #❓┊help
Mount action from resource
I solved the issue. This code needed to be present on the Create and Edit pages, not on the resource itself
5 replies
FFilament
Created by MacTavish on 11/20/2024 in #❓┊help
Open Modal after Action Execution to show the result
5 replies
FFilament
Created by Azorky on 11/21/2024 in #❓┊help
Mount action from resource
use Filament\Actions\Action as ActionsAction;

public function changeLineItemGlAccountAction(): ActionsAction
{
return ActionsAction::make('changeLineItemGlAccount')
->requiresConfirmation()
->modalHeading(__('resources/gl-accounts.change_all_lines'))
->modalDescription(__('resources/gl-accounts.change_all_lines_description'))
->modalCancelActionLabel(__('general.no'))
->modalSubmitActionLabel(__('general.yes'))
->action(function () {
$glAccountId = $this->data['gl_account_id'];

foreach ($this->data['lineItems'] as &$lineItem) {
$lineItem['gl_account_id'] = $glAccountId;
}
});
}
use Filament\Actions\Action as ActionsAction;

public function changeLineItemGlAccountAction(): ActionsAction
{
return ActionsAction::make('changeLineItemGlAccount')
->requiresConfirmation()
->modalHeading(__('resources/gl-accounts.change_all_lines'))
->modalDescription(__('resources/gl-accounts.change_all_lines_description'))
->modalCancelActionLabel(__('general.no'))
->modalSubmitActionLabel(__('general.yes'))
->action(function () {
$glAccountId = $this->data['gl_account_id'];

foreach ($this->data['lineItems'] as &$lineItem) {
$lineItem['gl_account_id'] = $glAccountId;
}
});
}
This function is present in the resource
5 replies
FFilament
Created by Azorky on 9/13/2024 in #❓┊help
Cannot login with session domain set
Clearing the cookies fixed this
4 replies
FFilament
Created by Azorky on 9/13/2024 in #❓┊help
Cannot login with session domain set
No description
4 replies
FFilament
Created by Azorky on 8/15/2024 in #❓┊help
Can't login anymore
I don't know what it could be
11 replies
FFilament
Created by Azorky on 8/15/2024 in #❓┊help
Can't login anymore
Yeah it only occured on localhost when the language was on english, very strange
11 replies
FFilament
Created by Azorky on 8/15/2024 in #❓┊help
Can't login anymore
When setting a SESSION_DOMAIN I was getting like an infinite loop of the page has expired alert
11 replies
FFilament
Created by Azorky on 8/15/2024 in #❓┊help
Can't login anymore
My collegue had the same issue so I don't think it's the encryption key
11 replies
FFilament
Created by Azorky on 8/15/2024 in #❓┊help
Can't login anymore
The encryption key was not changed and I tried with a newly generated one, but it had the same result
11 replies
FFilament
Created by Azorky on 8/15/2024 in #❓┊help
Can't login anymore
No description
11 replies
FFilament
Created by Azorky on 4/5/2024 in #❓┊help
Async notifications
The OCR takes 5 seconds or so, so ideally I want the user to upload something, see some kind of notification, and 5 sec later his whole form is filled in. Is that possible with a queue, to fill in the form from a job?
9 replies
FFilament
Created by Azorky on 4/5/2024 in #❓┊help
Async notifications
Thanks for the quick response!
9 replies