118 lines
4.8 KiB
PHP
118 lines
4.8 KiB
PHP
<?php
|
||
|
||
namespace App\Filament\Admin\Resources\Awards\Schemas;
|
||
|
||
use App\Filament\Admin\Resources\Components\TranslationTabs;
|
||
use Filament\Forms\Components\Checkbox;
|
||
use Filament\Forms\Components\FileUpload;
|
||
use Filament\Forms\Components\Select;
|
||
use Filament\Forms\Components\Textarea;
|
||
use Filament\Forms\Components\TextInput;
|
||
use Filament\Forms\Components\DatePicker;
|
||
use Filament\Forms\Components\Toggle;
|
||
use Filament\Schemas\Components\Section;
|
||
use Filament\Schemas\Schema;
|
||
|
||
class AwardForm
|
||
{
|
||
public static function categoryOptions(): array
|
||
{
|
||
return [
|
||
'hackathon' => __('awards.category_hackathon') ?? 'Hackathon',
|
||
'export' => __('awards.category_export') ?? 'İhracat',
|
||
'innovation' => __('awards.category_innovation') ?? 'İnovasyon',
|
||
'design' => __('awards.category_design') ?? 'Tasarım',
|
||
'general' => __('awards.category_general') ?? 'Genel',
|
||
];
|
||
}
|
||
|
||
public static function configure(Schema $schema): Schema
|
||
{
|
||
return $schema
|
||
->columns(3)
|
||
->schema([
|
||
Section::make(__('awards.content_section') ?? 'Ödül İçeriği')
|
||
->schema([
|
||
TextInput::make('title')
|
||
->label(__('awards.title_field') ?? 'Ödül Başlığı (Varsayılan)')
|
||
->required()
|
||
->maxLength(255),
|
||
|
||
TextInput::make('issuer')
|
||
->label(__('awards.issuer_field') ?? 'Ödülü Veren Kurum (Varsayılan)')
|
||
->required()
|
||
->maxLength(255),
|
||
|
||
Textarea::make('description')
|
||
->label(__('awards.description_field') ?? 'Açıklama (Varsayılan)')
|
||
->required()
|
||
->rows(5)
|
||
->columnSpanFull(),
|
||
|
||
TranslationTabs::make([
|
||
'title' => [
|
||
'type' => 'text',
|
||
'label' => __('awards.title_field') ?? 'Ödül Başlığı',
|
||
'required' => false,
|
||
'maxLength' => 255,
|
||
],
|
||
'issuer' => [
|
||
'type' => 'text',
|
||
'label' => __('awards.issuer_field') ?? 'Ödülü Veren Kurum',
|
||
'required' => false,
|
||
'maxLength' => 255,
|
||
],
|
||
'description' => [
|
||
'type' => 'textarea',
|
||
'label' => __('awards.description_field') ?? 'Açıklama',
|
||
'required' => false,
|
||
'rows' => 5,
|
||
],
|
||
]),
|
||
])
|
||
->columnSpan(2),
|
||
|
||
Section::make(__('awards.settings_section') ?? 'Ödül Ayarları')
|
||
->schema([
|
||
FileUpload::make('image')
|
||
->label(__('awards.image_field') ?? 'Ödül Görseli / Logo')
|
||
->image()
|
||
->disk('public')
|
||
->directory('awards')
|
||
->required(),
|
||
|
||
DatePicker::make('award_date')
|
||
->label(__('awards.date_field') ?? 'Ödül Tarihi')
|
||
->required(),
|
||
|
||
Select::make('category')
|
||
->label(__('awards.category_field') ?? 'Kategori')
|
||
->options(self::categoryOptions())
|
||
->default('general')
|
||
->required()
|
||
->native(false),
|
||
|
||
TextInput::make('external_link')
|
||
->label(__('awards.link_field') ?? 'Doğrulama / Haber Linki')
|
||
->url()
|
||
->maxLength(255),
|
||
|
||
TextInput::make('sort_order')
|
||
->label(__('awards.sort_order_field') ?? 'Sıralama')
|
||
->numeric()
|
||
->default(0)
|
||
->minValue(0),
|
||
|
||
Toggle::make('is_featured')
|
||
->label(__('awards.is_featured_field') ?? 'Öne Çıkarılan Ödül')
|
||
->default(false),
|
||
|
||
Toggle::make('is_active')
|
||
->label(__('awards.is_active_field') ?? 'Aktif / Görünür')
|
||
->default(true),
|
||
])
|
||
->columnSpan(1),
|
||
]);
|
||
}
|
||
}
|