simedkom/app/Filament/Resources/Manage/Contacts/Infolists/ContactInfolist.php

81 lines
3.6 KiB
PHP

<?php
namespace App\Filament\Resources\Manage\Contacts\Infolists;
use App\Enums\NotifStyle;
use App\Filament\Support\CheerfulNotification;
use App\Models\Contact;
use Filament\Infolists\Components\TextEntry;
use Filament\Schemas\Components\Grid;
use Filament\Schemas\Components\Section;
use Filament\Schemas\Schema;
class ContactInfolist
{
public static function configure(Schema $schema): Schema
{
return $schema
->schema([
Section::make(fn () => CheerfulNotification::getByKey('contact.sender_info_title'))
->description(fn () => CheerfulNotification::getByKey('contact.sender_info_desc'))
->icon(fn () => CheerfulNotification::getNotifStyle() === NotifStyle::CHEERFUL ? 'heroicon-o-user' : null)
->schema([
Grid::make(4)
->schema([
TextEntry::make('name')
->label('Nama Pengirim')
->icon('heroicon-o-user'),
TextEntry::make('email')
->label('Alamat Surel')
->icon('heroicon-o-envelope'),
TextEntry::make('subject')
->label('Subyek Pesan')
->icon('heroicon-o-tag'),
TextEntry::make('created_at')
->label('Diterima Pada')
->date('l, d F Y H:i')
->icon('heroicon-o-calendar'),
]),
])
->columnSpanFull(),
Section::make(fn () => CheerfulNotification::getByKey('contact.message_content_title'))
->description(fn () => CheerfulNotification::getByKey('contact.message_content_desc'))
->icon(fn () => CheerfulNotification::getNotifStyle() === NotifStyle::CHEERFUL ? 'heroicon-o-chat-bubble-left-right' : null)
->schema([
TextEntry::make('message')
->label('Konten Pesan')
->columnSpanFull(),
])
->columnSpanFull(),
Section::make(fn () => CheerfulNotification::getByKey('contact.reply_history_title'))
->description(fn () => CheerfulNotification::getByKey('contact.reply_history_desc'))
->icon(fn () => CheerfulNotification::getNotifStyle() === NotifStyle::CHEERFUL ? 'heroicon-o-paper-airplane' : null)
->schema([
TextEntry::make('repliedBy.name')
->label('Dibalas Oleh')
->placeholder('Belum dibalas')
->icon('heroicon-o-user-circle'),
TextEntry::make('replied_at')
->label('Waktu Balasan')
->date('l, d F Y H:i')
->placeholder('Belum dibalas')
->icon('heroicon-o-clock'),
TextEntry::make('reply_message')
->label('Isi Balasan')
->placeholder('Belum dibalas')
->columnSpanFull(),
])
->columnSpanFull()
->visible(fn (Contact $record): bool => $record->replied_at !== null),
])
->columns(2);
}
}