diff --git a/app/Filament/Dashboard/Resources/SampleLocationResource.php b/app/Filament/Dashboard/Resources/SampleLocationResource.php new file mode 100644 index 00000000..433b9b82 --- /dev/null +++ b/app/Filament/Dashboard/Resources/SampleLocationResource.php @@ -0,0 +1,108 @@ +schema([ + Forms\Components\TextInput::make('name') + ->required() + ->maxLength(255), + Forms\Components\TextInput::make('iri') + ->maxLength(255), + Forms\Components\Select::make('organism_id') + ->relationship('organisms', 'name') + ->searchable() + ->required(), + Forms\Components\TextInput::make('collection_ids') + ->maxLength(255), + Forms\Components\TextInput::make('molecule_count') + ->numeric(), + // Forms\Components\TextInput::make('slug') + // ->maxLength(255), + ]); + } + + public static function table(Table $table): Table + { + return $table + ->columns([ + Tables\Columns\TextColumn::make('name') + ->searchable(), + Tables\Columns\TextColumn::make('iri') + ->searchable(), + Tables\Columns\TextColumn::make('organism_id') + ->numeric() + ->sortable(), + Tables\Columns\TextColumn::make('created_at') + ->dateTime() + ->sortable() + ->toggleable(isToggledHiddenByDefault: true), + Tables\Columns\TextColumn::make('updated_at') + ->dateTime() + ->sortable() + ->toggleable(isToggledHiddenByDefault: true), + Tables\Columns\TextColumn::make('collection_ids') + ->searchable(), + Tables\Columns\TextColumn::make('molecule_count') + ->numeric() + ->sortable(), + Tables\Columns\TextColumn::make('slug') + ->searchable(), + ]) + ->filters([ + // + ]) + ->actions([ + Tables\Actions\ViewAction::make(), + Tables\Actions\EditAction::make(), + ]) + ->bulkActions([ + Tables\Actions\BulkActionGroup::make([ + Tables\Actions\DeleteBulkAction::make(), + ]), + ]); + } + + public static function getRelations(): array + { + return [ + MoleculesRelationManager::class, + AuditsRelationManager::class, + ]; + } + + public static function getPages(): array + { + return [ + 'index' => Pages\ListSampleLocations::route('/'), + 'create' => Pages\CreateSampleLocation::route('/create'), + 'view' => Pages\ViewSampleLocation::route('/{record}'), + 'edit' => Pages\EditSampleLocation::route('/{record}/edit'), + ]; + } +} diff --git a/app/Filament/Dashboard/Resources/SampleLocationResource/Pages/CreateSampleLocation.php b/app/Filament/Dashboard/Resources/SampleLocationResource/Pages/CreateSampleLocation.php new file mode 100644 index 00000000..f84915ac --- /dev/null +++ b/app/Filament/Dashboard/Resources/SampleLocationResource/Pages/CreateSampleLocation.php @@ -0,0 +1,12 @@ +