|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Filament\Resources\CustomerResource\RelationManagers;
|
|
|
|
|
|
|
|
use Filament\Forms\Components\TextInput;
|
|
|
|
use Filament\Forms\Form;
|
|
|
|
use Filament\Resources\RelationManagers\RelationManager;
|
|
|
|
use Filament\Tables;
|
|
|
|
use Filament\Tables\Columns\TextColumn;
|
|
|
|
use Filament\Tables\Table;
|
|
|
|
|
|
|
|
class ContactsRelationManager extends RelationManager
|
|
|
|
{
|
|
|
|
protected static string $relationship = 'contacts';
|
|
|
|
|
|
|
|
public function form(Form $form): Form
|
|
|
|
{
|
|
|
|
return $form
|
|
|
|
->schema([
|
|
|
|
TextInput::make('first_name'),
|
|
|
|
TextInput::make('last_name'),
|
|
|
|
TextInput::make('email'),
|
|
|
|
TextInput::make('phone'),
|
|
|
|
TextInput::make('notes'),
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function table(Table $table): Table
|
|
|
|
{
|
|
|
|
return $table
|
|
|
|
->recordTitleAttribute('id')
|
|
|
|
->columns([
|
|
|
|
TextColumn::make('full_name'),
|
|
|
|
TextColumn::make('email'),
|
|
|
|
TextColumn::make('phone'),
|
|
|
|
TextColumn::make('notes'),
|
|
|
|
])
|
|
|
|
->filters([
|
|
|
|
//
|
|
|
|
])
|
|
|
|
->headerActions([
|
|
|
|
Tables\Actions\CreateAction::make(),
|
|
|
|
])
|
|
|
|
->actions([
|
|
|
|
Tables\Actions\EditAction::make(),
|
|
|
|
Tables\Actions\DeleteAction::make(),
|
|
|
|
])
|
|
|
|
->bulkActions([
|
|
|
|
// Tables\Actions\BulkActionGroup::make([
|
|
|
|
// Tables\Actions\DeleteBulkAction::make(),
|
|
|
|
// ]),
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
}
|