base commit
This commit is contained in:
90
app/Filament/Resources/Employees/Schemas/EmployeeForm.php
Normal file
90
app/Filament/Resources/Employees/Schemas/EmployeeForm.php
Normal file
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Employees\Schemas;
|
||||
|
||||
use App\Enums\EmploymentStatus;
|
||||
use App\Enums\Gender;
|
||||
use App\Filament\Support\HrForm;
|
||||
use Filament\Forms\Components\DatePicker;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Schemas\Components\Tabs;
|
||||
use Filament\Schemas\Components\Tabs\Tab;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class EmployeeForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
Tabs::make('Employee')
|
||||
->tabs([
|
||||
Tab::make('Personal')
|
||||
->schema([
|
||||
HrForm::fileUpload('profile_photo_path')
|
||||
->label('Photo')
|
||||
->image()
|
||||
->avatar()
|
||||
->imageEditor(),
|
||||
TextInput::make('employee_number')
|
||||
->required()
|
||||
->maxLength(50)
|
||||
->unique(ignoreRecord: true),
|
||||
TextInput::make('full_name')
|
||||
->required()
|
||||
->maxLength(255),
|
||||
TextInput::make('national_id')
|
||||
->label('National ID')
|
||||
->maxLength(50),
|
||||
Select::make('gender')
|
||||
->options(Gender::class)
|
||||
->required()
|
||||
->native(false),
|
||||
DatePicker::make('birth_date')
|
||||
->required(),
|
||||
TextInput::make('phone')
|
||||
->tel()
|
||||
->default(config('hr.default_phone'))
|
||||
->required(),
|
||||
Textarea::make('address')
|
||||
->rows(3)
|
||||
->columnSpanFull(),
|
||||
])
|
||||
->columns(2),
|
||||
Tab::make('Employment')
|
||||
->schema([
|
||||
Select::make('department_id')
|
||||
->relationship('department', 'name')
|
||||
->searchable()
|
||||
->preload()
|
||||
->required(),
|
||||
Select::make('position_id')
|
||||
->relationship('position', 'name')
|
||||
->searchable()
|
||||
->preload()
|
||||
->required(),
|
||||
Select::make('shift_id')
|
||||
->relationship('shift', 'name')
|
||||
->searchable()
|
||||
->preload()
|
||||
->required(),
|
||||
Select::make('employment_status')
|
||||
->options(EmploymentStatus::class)
|
||||
->default(EmploymentStatus::Active)
|
||||
->required()
|
||||
->native(false),
|
||||
DatePicker::make('hire_date')
|
||||
->required(),
|
||||
DatePicker::make('termination_date'),
|
||||
Textarea::make('notes')
|
||||
->rows(4)
|
||||
->columnSpanFull(),
|
||||
])
|
||||
->columns(2),
|
||||
])
|
||||
->columnSpanFull(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user