92 lines
3.5 KiB
PHP
92 lines
3.5 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Resources\Monitoring\ContentRecaps\Schemas;
|
|
|
|
use App\Enums\Channel;
|
|
use App\Enums\ContentType;
|
|
use App\Enums\SocialMedia;
|
|
use Filament\Forms\Components\DatePicker;
|
|
use Filament\Forms\Components\Select;
|
|
use Filament\Forms\Components\SpatieMediaLibraryFileUpload;
|
|
use Filament\Forms\Components\TextInput;
|
|
use Filament\Schemas\Components\Grid;
|
|
use Filament\Schemas\Components\Section;
|
|
use Filament\Schemas\Schema;
|
|
|
|
class ContentRecapForm
|
|
{
|
|
public static function configure(Schema $schema): Schema
|
|
{
|
|
return $schema
|
|
->components([
|
|
Section::make([
|
|
TextInput::make('title')
|
|
->label('Judul')
|
|
->placeholder('Reels Kerja Sama DPMPTSP')
|
|
->autocomplete(false)
|
|
->autofocus()
|
|
->required()
|
|
->maxLength(255),
|
|
|
|
TextInput::make('link')
|
|
->label('Tautan')
|
|
->placeholder('https://www.pwknews.com')
|
|
->autocomplete(false)
|
|
->nullable()
|
|
->maxLength(50)
|
|
->url(),
|
|
|
|
Grid::make(2)
|
|
->schema([
|
|
Select::make('type')
|
|
->label('Tipe')
|
|
->options(ContentType::options())
|
|
->native(false)
|
|
->required()
|
|
->in(implode(',', array_column(ContentType::cases(), 'value'))),
|
|
|
|
Select::make('channel')
|
|
->label('Kanal')
|
|
->options(Channel::options())
|
|
->native(false)
|
|
->required()
|
|
->in(implode(',', array_column(Channel::cases(), 'value'))),
|
|
|
|
Select::make('social_media')
|
|
->label('Media Sosial')
|
|
->options(SocialMedia::options())
|
|
->native(false)
|
|
->required()
|
|
->in(implode(',', array_column(SocialMedia::cases(), 'value'))),
|
|
|
|
DatePicker::make('posting_date')
|
|
->label('Tanggal Posting')
|
|
->placeholder(fn () => now()->format('Y-m-d'))
|
|
->native(false)
|
|
->displayFormat('l, d F Y')
|
|
->required(),
|
|
]),
|
|
])->columnSpan(2),
|
|
|
|
Section::make([
|
|
Select::make('classification_id')
|
|
->label('Klasifikasi')
|
|
->relationship('classification', 'name', fn ($query) => $query->active())
|
|
->native(false)
|
|
->preload()
|
|
->required(),
|
|
|
|
SpatieMediaLibraryFileUpload::make('image')
|
|
->label('Gambar')
|
|
->disk(config('filesystems.default'))
|
|
->acceptedFileTypes(['images/*'])
|
|
->maxSize(1024 * 3)
|
|
->collection('content-recpaps')
|
|
->image()
|
|
->required(),
|
|
]),
|
|
])
|
|
->columns(3);
|
|
}
|
|
}
|