116 lines
4.6 KiB
PHP
116 lines
4.6 KiB
PHP
<?php
|
||
|
||
namespace App\Filament\Admin\Resources\CareerApplications\Tables;
|
||
|
||
use Filament\Actions\Action;
|
||
use Filament\Actions\DeleteAction;
|
||
use Filament\Actions\BulkActionGroup;
|
||
use Filament\Actions\DeleteBulkAction;
|
||
use Filament\Tables\Columns\TextColumn;
|
||
use Filament\Tables\Filters\SelectFilter;
|
||
use Filament\Tables\Table;
|
||
use Illuminate\Support\Facades\Storage;
|
||
|
||
class CareerApplicationsTable
|
||
{
|
||
public static function configure(Table $table): Table
|
||
{
|
||
return $table
|
||
->columns([
|
||
TextColumn::make('name')
|
||
->label(__('career.name'))
|
||
->searchable()
|
||
->sortable(),
|
||
|
||
TextColumn::make('email')
|
||
->label(__('career.email'))
|
||
->searchable()
|
||
->sortable(),
|
||
|
||
TextColumn::make('phone')
|
||
->label(__('career.phone'))
|
||
->searchable(),
|
||
|
||
TextColumn::make('type')
|
||
->label(__('career.type'))
|
||
->badge()
|
||
->color(fn (string $state): string => match ($state) {
|
||
'job' => 'success',
|
||
'internship' => 'warning',
|
||
default => 'gray',
|
||
})
|
||
->formatStateUsing(fn (string $state): string => __("career.{$state}")),
|
||
|
||
TextColumn::make('status')
|
||
->label(__('career.status'))
|
||
->badge()
|
||
->color(fn (string $state): string => match ($state) {
|
||
'pending' => 'gray',
|
||
'reviewed' => 'info',
|
||
'rejected' => 'danger',
|
||
'accepted' => 'success',
|
||
default => 'gray',
|
||
}),
|
||
|
||
TextColumn::make('git_knowledge')
|
||
->label(__('career.git_knowledge'))
|
||
->badge()
|
||
->color(fn ($state) => $state ? 'success' : 'danger')
|
||
->formatStateUsing(fn ($state) => $state ? 'Evet' : 'Hayır'),
|
||
|
||
TextColumn::make('ai_usage')
|
||
->label(__('career.ai_usage'))
|
||
->badge()
|
||
->color(fn ($state) => $state ? 'success' : 'danger')
|
||
->formatStateUsing(fn ($state) => $state ? 'Evet' : 'Hayır'),
|
||
|
||
TextColumn::make('created_at')
|
||
->label(__('career.created_at'))
|
||
->dateTime('d.m.Y H:i')
|
||
->sortable(),
|
||
])
|
||
->filters([
|
||
SelectFilter::make('status')
|
||
->label(__('career.status'))
|
||
->options([
|
||
'pending' => 'Pending',
|
||
'reviewed' => 'Reviewed',
|
||
'rejected' => 'Rejected',
|
||
'accepted' => 'Accepted',
|
||
]),
|
||
SelectFilter::make('type')
|
||
->label(__('career.type'))
|
||
->options([
|
||
'job' => __('career.job'),
|
||
'internship' => __('career.internship'),
|
||
]),
|
||
])
|
||
->actions([
|
||
Action::make('download_cv')
|
||
->label(__('career.download_cv'))
|
||
->icon('heroicon-o-arrow-down-tray')
|
||
->url(fn ($record) => Storage::disk('public')->url($record->cv_path))
|
||
->openUrlInNewTab(),
|
||
Action::make('download_nda')
|
||
->label(__('career.nda'))
|
||
->icon('heroicon-o-shield-check')
|
||
->url(fn ($record) => $record->nda_path ? Storage::disk('public')->url($record->nda_path) : null)
|
||
->visible(fn ($record) => $record->nda_path !== null)
|
||
->openUrlInNewTab(),
|
||
Action::make('download_contract')
|
||
->label(__('career.contract'))
|
||
->icon('heroicon-o-document-text')
|
||
->url(fn ($record) => $record->contract_path ? Storage::disk('public')->url($record->contract_path) : null)
|
||
->visible(fn ($record) => $record->contract_path !== null)
|
||
->openUrlInNewTab(),
|
||
DeleteAction::make(),
|
||
])
|
||
->bulkActions([
|
||
BulkActionGroup::make([
|
||
DeleteBulkAction::make(),
|
||
]),
|
||
])
|
||
->defaultSort('created_at', 'desc');
|
||
}
|
||
}
|