schema([ Forms\Components\TextInput::make('uuid')->label('UUID')->required()->maxLength(36), Forms\Components\TextInput::make('title')->label('Título')->required()->maxLength(255), Forms\Components\TextInput::make('slug')->required()->maxLength(255), Forms\Components\TextInput::make('category')->label('Categoría')->required(), Forms\Components\TextInput::make('excerpt')->label('Resumen')->maxLength(255)->default(null), Forms\Components\Textarea::make('description')->label('Descripción')->columnSpanFull(), Forms\Components\TextInput::make('location_label')->label('Ubicación')->maxLength(255)->default(null), Forms\Components\TextInput::make('lat')->numeric()->default(null), Forms\Components\TextInput::make('lng')->numeric()->default(null), Forms\Components\TextInput::make('price_from')->label('Precio desde')->numeric()->default(null), Forms\Components\TextInput::make('duration_minutes')->label('Duración')->numeric()->default(null), Forms\Components\FileUpload::make('image_url')->label('Imagen')->image(), Forms\Components\TextInput::make('status')->label('Estado')->required(), Forms\Components\Toggle::make('is_featured')->label('Destacada')->required(), Forms\Components\TextInput::make('priority_score')->label('Prioridad')->required()->numeric()->default(0), Forms\Components\Toggle::make('available_now')->label('Disponible ahora')->required(), ]); } public static function table(Table $table): Table { return $table ->defaultSort('priority_score', 'desc') ->columns([ Tables\Columns\TextColumn::make('title') ->label('Oferta') ->searchable() ->weight('semibold') ->description(fn (Offer $record): string => $record->excerpt ?: ($record->location_label ?: 'Sin resumen')), Tables\Columns\TextColumn::make('category') ->label('Categoría') ->badge() ->formatStateUsing(fn (?string $state): string => ucfirst($state ?: 'general')) ->color('warning'), Tables\Columns\TextColumn::make('location_label') ->label('Ubicación') ->badge() ->toggleable(), Tables\Columns\TextColumn::make('price_from') ->label('Desde') ->money('EUR') ->sortable(), Tables\Columns\TextColumn::make('duration_minutes') ->label('Duración') ->suffix(' min') ->sortable(), Tables\Columns\TextColumn::make('status') ->label('Estado') ->badge() ->color(fn (?string $state): string => match ($state) { 'active' => 'success', 'draft' => 'warning', 'archived' => 'gray', default => 'primary', }), Tables\Columns\IconColumn::make('available_now') ->label('Ahora') ->boolean(), Tables\Columns\IconColumn::make('is_featured') ->label('Destacada') ->boolean(), Tables\Columns\TextColumn::make('priority_score') ->label('Prioridad') ->badge() ->sortable(), Tables\Columns\TextColumn::make('created_at') ->label('Creada') ->since() ->sortable(), ]) ->actions([ Tables\Actions\EditAction::make(), ]) ->bulkActions([ Tables\Actions\BulkActionGroup::make([ Tables\Actions\DeleteBulkAction::make(), ]), ]); } public static function getRelations(): array { return []; } public static function getPages(): array { return [ 'index' => Pages\ListOffers::route('/'), 'create' => Pages\CreateOffer::route('/create'), 'edit' => Pages\EditOffer::route('/{record}/edit'), ]; } }