syed_eer
I'm trying to show repeaters conditionally using checkbox, it works but not as required?
In my filament v3 project, I'm trying to show repeaters conditionally using checkbox which is for the available customers. something like
Section::make('Item Pricing / Linking')->label('Item Pricing / Linking')
->schema([
Checkbox::make('show_all')
->label('Show All')
->live()->afterStateUpdated(function ($state, callable $set) {
if ($state) {
$customers = Customer::all()->toArray();
$set('prices', collect($customers)
->map(fn ($customer) => [
'customer_id' => $customer['id'],
'customer_barcode' => '',
'customer_ref' => '',
'price' => '',
'is_linked' => true, ])->toArray());
} else {
$set('prices', []);
}
}),
Repeater::make('prices')
->relationship('prices')
->schema([
Select::make('customer_id')
->relationship('customer', 'name')
->label('Customer Name'),
TextInput::make('customer_barcode')
->label('Customer Barcode')
->required(),
TextInput::make('customer_ref')
->label('Customer Reference')
->required(),
TextInput::make('price')
->numeric()
->label('Price')
->required(),
Toggle::make('is_linked')
->label('Linked')
->default(true),
])->columns(2)
->live()
->collapsed(false)
->createItemButtonLabel('Add Customer'),
])->columns(1),
it works but not as required. On page load it show blank repeater and when checkbox is checked it shows perfectly as needed. However, when I unchecked this checkbox it hides the whole repeater and I dont want it like that, I want it to be back in the on page load state with one black repeater.
is it possible to achieve? Please help me!2 replies
Can I make getTab() in 2 lines?
Hello all,
In my Filament project, I have 6 to 8 different types of payments represented by filter tabs in the getTabs() function. Currently, these tabs are displayed in a single line, making the interface look congested. Is there a way to arrange these tabs in multiple lines or columns for a cleaner layout? Thanks in advance for your time and help.
@Dennis Koch
11 replies
Filament v3 has active tab filters, can I have the same in v2 also?
I was just checking v3 demo and found this feature of an active tab for the status column very interesting. Can I have this feature in v2 also? Thank you for the reply in advance.
4 replies
Text or TextInput fiedl can be dynamically populated?
In my filament project, I've created the student form which has details about fee_plan and entered some
data as well. Now, I'm preparing a form for fee payment, here I can select students from dropdown field
and when I select a student I want fee_plan to be automatically populated next to a student name as a
text or uneditable textinput field. Is this possible to achieve? Thanks for your help in advance.
This is the code
This is the code
Select::make('fee_plan_id')//states
->label('Student Fee Plan')
->options(function (Get $get){
$students = Student::find($get('student_id'));
if(!$students){
return FeePlan::all()->pluck('name', 'id');
}
dd($students->fee_plan->name);
return $students->fee_plan->name;
}),
46 replies