Hitesh Makwana
Hitesh Makwana
FFilament
Created by Hitesh Makwana on 12/20/2024 in #❓┊help
Help me to select address from address list in modal
I have created
class AddressForm extends Field
class AddressForm extends Field
in this Created an action
Forms\Components\TextInput::make("name")
->label("Name / Company Name")
->maxLength(50)
->suffixAction(
Action::make('select_address')
->icon('heroicon-o-magnifying-glass')
->action(function (callable $get) {
$customer_id = $get('../customer_id');
if (!$customer_id) {
Notification::make()
->danger()
->title('Please select customer First')
->send();

return;
}
})
->modalContent(function (callable $get) {
$customer_id = $get('../customer_id');
return view('filament.addresses.view', compact('customer_id'));
})
->modalSubmitAction(false)
->modalWidth('7xl')
)->inlineSuffix(),
Forms\Components\TextInput::make("name")
->label("Name / Company Name")
->maxLength(50)
->suffixAction(
Action::make('select_address')
->icon('heroicon-o-magnifying-glass')
->action(function (callable $get) {
$customer_id = $get('../customer_id');
if (!$customer_id) {
Notification::make()
->danger()
->title('Please select customer First')
->send();

return;
}
})
->modalContent(function (callable $get) {
$customer_id = $get('../customer_id');
return view('filament.addresses.view', compact('customer_id'));
})
->modalSubmitAction(false)
->modalWidth('7xl')
)->inlineSuffix(),
my view blade file
@php
$widgetData = [
'inModal' => true,
'customer_id' => $customer_id,
];
@endphp

<x-filament-widgets::widgets :widgets="[\App\Filament\Widgets\AddressListWidget::class]" :columns="1" :data="$widgetData" />
@php
$widgetData = [
'inModal' => true,
'customer_id' => $customer_id,
];
@endphp

<x-filament-widgets::widgets :widgets="[\App\Filament\Widgets\AddressListWidget::class]" :columns="1" :data="$widgetData" />
Created Table widget with
protected function getTableActions(): array
{
return [
Tables\Actions\Action::make('select')
->label('Select')
->action(function ($record) {
$this->emit('addressSelected', $record);
})
->icon('heroicon-o-check'),
];
}
protected function getTableActions(): array
{
return [
Tables\Actions\Action::make('select')
->label('Select')
->action(function ($record) {
$this->emit('addressSelected', $record);
})
->icon('heroicon-o-check'),
];
}
Please Help me to use record to address form
7 replies