schema([ Forms\Components\TextInput::make('name') ->label('Nama Pengguna') ->required() ->maxLength(255), Forms\Components\TextInput::make('email') ->label('Email') ->email() ->required() ->maxLength(255), Forms\Components\TextInput::make('password') ->password() ->required(fn (string $context): bool => $context === 'create') ->dehydrateStateUsing(fn ($state) => Hash::make($state)) ->dehydrated(fn ($state) => filled($state)) ->maxLength(255), Forms\Components\Select::make('role') ->label('Role') ->relationship('roles', 'name') ->preload() ->searchable() ->required(), Forms\Components\TextInput::make('nip') ->label('NIP') ->maxLength(255), Forms\Components\Select::make('gender') ->label('Jenis Kelamin') ->options([ 'L' => 'L', 'P' => 'P', ]), Forms\Components\DatePicker::make('birth_date') ->label('Tanggal Lahir'), Forms\Components\TextInput::make('phone') ->label('Nomor Telepon') ->tel() ->maxLength(255), Forms\Components\Textarea::make('address') ->label('Alamat') ->columnSpanFull(), ]); } public static function table(Table $table): Table { return $table ->columns([ Tables\Columns\TextColumn::make('name') ->label('Nama') ->searchable(), Tables\Columns\TextColumn::make('email') ->label('Email') ->searchable(), Tables\Columns\TextColumn::make('nip') ->label('NIP') ->searchable(), Tables\Columns\TextColumn::make('gender') ->label('Jenis Kelamin') ->formatStateUsing(fn (string $state): string => ucfirst($state)), Tables\Columns\TextColumn::make('birth_date') ->label('Tanggal Lahir') ->date(), Tables\Columns\TextColumn::make('phone') ->label('Nomor Telepon') ->searchable(), Tables\Columns\TextColumn::make('roles.name') ->searchable() ->sortable(), Tables\Columns\TextColumn::make('created_at') ->dateTime() ->sortable() ->toggleable(isToggledHiddenByDefault: true), Tables\Columns\TextColumn::make('updated_at') ->dateTime() ->sortable() ->toggleable(isToggledHiddenByDefault: true), ]) ->filters([ // ]) ->actions([ Tables\Actions\EditAction::make()->visible(fn () => auth()->user()->hasRole('admin')), ]) ->bulkActions([ Tables\Actions\BulkActionGroup::make([ // Tables\Actions\DeleteBulkAction::make()->visible(fn () => auth()->user()->hasRole('admin')), ]), ]) ->emptyStateActions([ Tables\Actions\CreateAction::make(), ]); } public static function getRelations(): array { return [ // ]; } public static function getPages(): array { return [ 'index' => Pages\ListUsers::route('/'), 'create' => Pages\CreateUser::route('/create'), 'edit' => Pages\EditUser::route('/{record}/edit'), ]; } public static function getNavigationLabel(): string { return 'Pengguna'; } public static function getBreadcrumb(): string { return 'Pengguna'; } public static function getPluralModelLabel(): string { return 'Pengguna'; } }