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
3 Replies
Hitesh Makwana
Hitesh MakwanaOP10h ago
Here What I exactly want that I have my addresses with relation to customer In Quotation Form I want to give manual enter address as well and also user can select address from customer's address When user click on search icon user will see modal with list of customer's address from the customer's address listed in table with an action button "use address" I want to use all record to fill in the forms I mention all codes above
Hitesh Makwana
Hitesh MakwanaOP10h ago
GitHub
demo/app/Forms/Components/AddressForm.php at main · filamentphp/demo
Source code for the demo.filamentphp.com website. Contribute to filamentphp/demo development by creating an account on GitHub.
Want results from more Discord servers?
Add your server