sweetplum
sweetplum
FFilament
Created by sweetplum on 12/27/2023 in #❓┊help
what UI Kit (framework) does Filament use?
I saw Dan mentioned that Filament (V2) was built with a tailwind UI kit in one of his tutorials, but can't recall what it is. Is it still true for V3? want to try it with other parts of the same site to be consistent.
5 replies
FFilament
Created by sweetplum on 11/29/2023 in #❓┊help
$set another form field, but the new value of that field is not showing in $data array
On the edit form, there is one reactive field. when this field is changed by user, it will $set other several fields' value. On UI, I do see values of those fields are changed. but when dd($data) in mutateFormDataBeforeSave(array $data) those fields are not presented. Here is the partial form:
Forms\Components\TextInput::make('summary_data.total_remittances')
->label('Minus: remittances')
->numeric()
->live()
->default(0.00)
->afterStateUpdated(function( Forms\Set $set, Forms\Get $get, $state){
$difference = (float)$get('summary_data.total_deductions_reported') - (float)$state;
$set('summary_data.difference', $difference);
})
->prefix('82'),
Forms\Components\TextInput::make('summary_data.difference')
->label('Difference')
->numeric()
->disabled()
->default(0.00),
Forms\Components\TextInput::make('summary_data.total_remittances')
->label('Minus: remittances')
->numeric()
->live()
->default(0.00)
->afterStateUpdated(function( Forms\Set $set, Forms\Get $get, $state){
$difference = (float)$get('summary_data.total_deductions_reported') - (float)$state;
$set('summary_data.difference', $difference);
})
->prefix('82'),
Forms\Components\TextInput::make('summary_data.difference')
->label('Difference')
->numeric()
->disabled()
->default(0.00),
. so in the $data, I can see $data['summary_data']['total_remittances'], but there is no$data['summary_data'] ['difference']. thus it failed to save the new value for ['difference']. Is there anything wrong with the above code? thx!
2 replies
FFilament
Created by sweetplum on 11/20/2023 in #❓┊help
adding table filter in action->url()
On a ViewRecord page, I have an action button to open url to another resouce's ListRecord page but with a particular table filter preset. I did like the following:
Action::make('orders')
->url(function(Customer $record){
return OrderResource::getUrl('index', [
'tableFilters[customer_id][value]' => $record->id
]);
})
->label('Your Orders')
->openUrlInNewTab(),
Action::make('orders')
->url(function(Customer $record){
return OrderResource::getUrl('index', [
'tableFilters[customer_id][value]' => $record->id
]);
})
->label('Your Orders')
->openUrlInNewTab(),
. It works. Is there a better or proper way to achieve it? Thanks.
3 replies
FFilament
Created by sweetplum on 11/16/2023 in #❓┊help
how to load relationship() on Forms\Components\Fieldset conditionally?
The form uses Forms\Components\Fieldset::relationship('primaryAddress') to load a related 'address' record of an user. but sometimes the user may not have the related address yet. In this case, it shows Target [Illuminate\Database\Eloquent\Model] is not instantiable. error. Is there an way to load the related 'address' record condtionally? I tried
->relationship('primaryAddress', function(Component $livewire) {
return (bool) $livewire->record->primaryAddress;
})
->relationship('primaryAddress', function(Component $livewire) {
return (bool) $livewire->record->primaryAddress;
})
, but I still get the error. thank you for your insights.
2 replies
FFilament
Created by sweetplum on 11/14/2023 in #❓┊help
Do not save or exclude Fieldset->relationship() when saving a form?
I have a long form() in one resource page. I used Fieldset->relationship() to load a related rocord and added a custom action so users can update the related record in a modal. Since it is a part of the long form, when the form is 'saved', Filament tries to save the related record as well. How can I exclude the related record when saving the form as the users can update/edit the related record in a modal? I tried to handleRecordUpdat on the edit page, which doesn't seem to work. Thanks in advance.
2 replies
FFilament
Created by sweetplum on 10/23/2023 in #❓┊help
How to refresh related record on a resource page?
on my resource page, I use Fieldset compnent to load a relationship. I can click an action button 'update' to open a modal form to update the related record. I do this way so I can call an existing form schema to populate the modal form so I don't need to repeat all those form fields in the modal->form(). but I couldn't figure out how to refresh the main form with updated related record. Ideally it should only refresh the related record section. but if is not doable, refresh the entire page is also acceptable. any suggestions? thanks.
2 replies
FFilament
Created by sweetplum on 10/14/2023 in #❓┊help
different data source for Table Builder?
I want to use the Table Builder on a livewire page. From the docs, I need to use query() or relationship() on the $table. but my data is not from Models, but rather a large array dynamically generated from the previous operation. Is it possible?
4 replies
FFilament
Created by sweetplum on 9/29/2023 in #❓┊help
`make:filament-theme` won't create theme other than 'admin'?
No description
3 replies