124 lines
4.0 KiB
PHP
124 lines
4.0 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Resources;
|
|
|
|
use App\Filament\Resources\InternshipResource\Pages;
|
|
use App\Filament\Resources\InternshipResource\RelationManagers;
|
|
use App\Models\Internship;
|
|
use Filament\Forms;
|
|
use Filament\Forms\Components\Repeater;
|
|
use Filament\Forms\Components\Textarea;
|
|
use Filament\Forms\Components\TextInput;
|
|
use Filament\Forms\Form;
|
|
use Filament\Resources\Resource;
|
|
use Filament\Tables;
|
|
use Filament\Tables\Table;
|
|
|
|
class InternshipResource extends Resource
|
|
{
|
|
protected static ?string $model = Internship::class;
|
|
|
|
protected static ?string $navigationGroup = 'Careers';
|
|
|
|
protected static ?string $navigationIcon = 'heroicon-o-academic-cap';
|
|
|
|
public static function form(Form $form): Form
|
|
{
|
|
return $form
|
|
->schema([
|
|
TextInput::make('title')
|
|
->required()
|
|
->maxLength(255),
|
|
|
|
TextInput::make('location')
|
|
->required()
|
|
->maxLength(255),
|
|
|
|
Textarea::make('title_description')
|
|
->label('Description (show on modal)')
|
|
->required()
|
|
->maxLength(65535)
|
|
->columnSpan('full'),
|
|
|
|
TextInput::make('salary_per_month')
|
|
->required()
|
|
->numeric()
|
|
->label('Salary per month')
|
|
->maxLength(255),
|
|
Forms\Components\Select::make('salary_currency')
|
|
->options(getCurrencies())
|
|
->required()
|
|
->label('Salary currency')
|
|
->searchable()
|
|
->default('USD'),
|
|
|
|
Repeater::make('bullets')
|
|
->schema([
|
|
TextInput::make('bullet')
|
|
->required()
|
|
->maxLength(255),
|
|
])
|
|
->minItems(1)
|
|
->defaultItems(1)
|
|
->columnSpan('full'),
|
|
]);
|
|
}
|
|
|
|
public static function table(Table $table): Table
|
|
{
|
|
return $table
|
|
->columns([
|
|
Tables\Columns\TextColumn::make('title')
|
|
->searchable(),
|
|
Tables\Columns\TextColumn::make('title_description')
|
|
->searchable()
|
|
->toggleable(isToggledHiddenByDefault: true),
|
|
Tables\Columns\TextColumn::make('salary_per_month')
|
|
->searchable()
|
|
->toggleable(isToggledHiddenByDefault: true),
|
|
Tables\Columns\TextColumn::make('salary_currency')
|
|
->searchable()
|
|
->toggleable(isToggledHiddenByDefault: true),
|
|
Tables\Columns\TextColumn::make('location')
|
|
->searchable(),
|
|
Tables\Columns\TextColumn::make('salary')
|
|
->searchable(),
|
|
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(),
|
|
])
|
|
->bulkActions([
|
|
Tables\Actions\BulkActionGroup::make([
|
|
Tables\Actions\DeleteBulkAction::make(),
|
|
]),
|
|
]);
|
|
}
|
|
|
|
public static function getRelations(): array
|
|
{
|
|
return [
|
|
RelationManagers\ApplicationsRelationManager::class,
|
|
];
|
|
}
|
|
|
|
public static function getPages(): array
|
|
{
|
|
return [
|
|
'index' => Pages\ListInternships::route('/'),
|
|
'create' => Pages\CreateInternship::route('/create'),
|
|
'edit' => Pages\EditInternship::route('/{record}/edit'),
|
|
];
|
|
}
|
|
}
|