components([ Section::make('Akun') ->description(new HtmlString('Alamat Surel dan Nama Pengguna akan digunakan untuk masuk ke dalam sistem. Kata sandi bawaan adalah Minimal8@')) ->schema([ TextInput::make('email') ->label('Alamat Surel') ->placeholder('johndoe@example.com') ->autocomplete(false) ->required() ->maxLength(254) ->email() ->unique('users', 'email', ignoreRecord: true), TextInput::make('username') ->label('Nama Pengguna') ->placeholder('johndoe') ->autocomplete(false) ->required() ->minLength(5) ->maxLength(20) ->regex('/^[a-zA-Z0-9_.-]+$/') ->unique('users', 'username', ignoreRecord: true), ]) ->columns(2) ->hiddenOn('edit'), Section::make('Informasi Dosen') ->schema([ TextInput::make('full_name') ->label('Nama Lengkap') ->placeholder('John Doe') ->autocomplete(false) ->required() ->maxLength(100) ->minLength(3) ->autofocus() ->helperText('Masukkan nama lengkap dosen beserta gelar akademik.') ->columnSpanFull(), Grid::make(3) ->schema([ TextInput::make('lecturer_identification_number') ->label('NIDN') ->placeholder('1234567890') ->autocomplete(false) ->required() ->numeric() ->rules(['digits:10']) ->unique(ignoreRecord: true), TextInput::make('phone_number') ->label('Nomor Telepon') ->placeholder('0812 3456 78910') ->autocomplete(false) ->required() ->maxLength(20) ->minLength(10) ->rules(['regex:/^[0-9 ]+$/']) ->mask('9999 9999 99999'), Radio::make('sex') ->label('Jenis Kelamin') ->options(Sex::class) ->required() ->inline(), ]) ->columnSpanFull(), Textarea::make('address') ->label('Alamat') ->placeholder('Jl. Contoh No. 123, Kota, Provinsi') ->autocomplete(false) ->rows(3) ->nullable() ->columnSpanFull(), Grid::make(2) ->schema([ DatePicker::make('date_of_birth') ->label('Tanggal Lahir') ->placeholder('Pilih Tanggal') ->required() ->native(false) ->displayFormat('l, d F Y') ->maxDate(Carbon::now()->subYears(25)), TextInput::make('place_of_birth') ->label('Tempat Lahir') ->placeholder('Purwakarta') ->autocomplete(false) ->required() ->maxLength(50) ->minLength(3), ]) ->columnSpanFull(), ]) ->columns(2), Section::make('Mata Kuliah') ->description('Daftar mata kuliah yang diampu oleh dosen ini.') ->schema([ Select::make('courses') ->label('Mata Kuliah') ->multiple() ->relationship('courses', 'name') ->options(function () { return Course::all() ->groupBy('semester') ->mapWithKeys(function ($courses, $semester) { return [ "Semester $semester" => $courses->pluck('name', 'id')->toArray(), ]; }) ->toArray(); }) ->searchable() ->preload() ->live() ->required(), ]), ]) ->columns(1); } }