56 lines
2.0 KiB
PHP
56 lines
2.0 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Resources\Customers\Schemas;
|
|
|
|
use Filament\Forms\Components\Select;
|
|
use Filament\Forms\Components\Textarea;
|
|
use Filament\Forms\Components\TextInput;
|
|
use Filament\Schemas\Components\Section;
|
|
use Filament\Schemas\Schema;
|
|
|
|
class CustomerForm
|
|
{
|
|
public static function configure(Schema $schema): Schema
|
|
{
|
|
return $schema
|
|
->components([
|
|
Section::make(__('app.customer_information'))
|
|
->schema([
|
|
TextInput::make('name')
|
|
->label(__('app.name'))
|
|
->required()
|
|
->maxLength(255),
|
|
TextInput::make('email')
|
|
->label(__('app.email'))
|
|
->email()
|
|
->maxLength(255),
|
|
TextInput::make('phone')
|
|
->label(__('app.phone'))
|
|
->tel()
|
|
->maxLength(255),
|
|
Textarea::make('address')
|
|
->label(__('app.address'))
|
|
->columnSpanFull(),
|
|
Select::make('status')
|
|
->options([
|
|
'active' => __('app.status_active'),
|
|
'inactive' => __('app.status_inactive'),
|
|
])
|
|
->default('active')
|
|
->required(),
|
|
])
|
|
->columns(2),
|
|
|
|
Section::make(__('app.owned_products'))
|
|
->schema([
|
|
Select::make('products')
|
|
->label(__('app.resource_products'))
|
|
->relationship('products', 'name')
|
|
->multiple()
|
|
->preload()
|
|
->columnSpanFull(),
|
|
]),
|
|
]);
|
|
}
|
|
}
|