Version 2.0

This commit is contained in:
2026-05-12 09:23:05 +00:00
parent f2bc048219
commit f1b68e5e78
34 changed files with 564 additions and 283 deletions

View File

@@ -2,6 +2,7 @@
namespace App\Filament\Resources\Contracts\Schemas;
use App\Enums\ContractCategory;
use App\Enums\ContractStatus;
use App\Enums\ContractType;
use Filament\Forms\Components\DatePicker;
@@ -16,6 +17,36 @@ class ContractForm
{
return $schema
->components([
Section::make(__('app.contract_category_section'))
->schema([
Select::make('category')
->label(__('enums.contract_category_label'))
->options(ContractCategory::options())
->required()
->native(false)
->live(),
Select::make('type')
->label(__('enums.contract_type_label'))
->options(function ($get): array {
$category = $get('category');
if ($category === 'ownership') {
return collect(ContractType::ownershipCases())->mapWithKeys(fn ($c) => [
$c->value => $c->label(),
])->toArray();
}
if ($category === 'business') {
return collect(ContractType::businessCases())->mapWithKeys(fn ($c) => [
$c->value => $c->label(),
])->toArray();
}
return ContractType::options();
})
->required()
->native(false),
])
->columns(2),
Section::make(__('app.contract_info'))
->schema([
Select::make('product_id')
@@ -28,11 +59,6 @@ class ContractForm
->relationship('customer', 'name')
->searchable()
->required(),
Select::make('type')
->label(__('app.contract'))
->options(ContractType::options())
->required()
->native(false),
Select::make('status')
->label(__('app.status'))
->options(ContractStatus::ACTIVE->options())
@@ -50,6 +76,22 @@ class ContractForm
->maxLength(255),
])
->columns(2),
Section::make(__('app.representative_info'))
->description(__('app.representative_desc'))
->schema([
TextInput::make('representative_name')
->label(__('app.name'))
->maxLength(255),
TextInput::make('representative_phone')
->label(__('app.phone'))
->maxLength(20),
TextInput::make('representative_email')
->label(__('app.email'))
->email()
->maxLength(255),
])
->columns(3),
]);
}
}