Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion resources/views/mails/preview.blade.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="w-full h-screen">
<iframe
src="{{ route('filament.' . Filament\Facades\Filament::getCurrentPanel()->getId() . '.mails.preview', ['tenant' => Filament\Facades\Filament::getTenant(), 'mail' => $mail->id]) }}"
class="w-full h-full max-w-full" style="width: 100vw; height: 100vh; border: none;">
class="w-full h-full max-w-full" style="width: 100%; height: 100vh; border: none;">
</iframe>
</div>
26 changes: 12 additions & 14 deletions src/Resources/MailResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,22 +95,22 @@ public static function infolist(Schema $schema): Schema
->label(__('Subject')),
TextEntry::make('from')
->label(__('From'))
->getStateUsing(fn (Mail $record) => self::formatMailState($record->from)),
->formatStateUsing(fn (Mail $record) => self::formatMailState($record->from)),
TextEntry::make('to')
->label(__('Recipient(s)'))
->getStateUsing(fn (Mail $record) => self::formatMailState($record->to)),
->formatStateUsing(fn (Mail $record) => self::formatMailState($record->to)),
TextEntry::make('cc')
->label(__('CC'))
->default('-')
->getStateUsing(fn (Mail $record) => self::formatMailState($record->cc ?? [])),
->formatStateUsing(fn (Mail $record) => self::formatMailState($record->cc ?? [])),
TextEntry::make('bcc')
->label(__('BCC'))
->default('-')
->getStateUsing(fn (Mail $record) => self::formatMailState($record->bcc ?? [])),
->formatStateUsing(fn (Mail $record) => self::formatMailState($record->bcc ?? [])),
TextEntry::make('reply_to')
->default('-')
->label(__('Reply To'))
->getStateUsing(fn (Mail $record) => self::formatMailState($record->reply_to ?? [])),
->formatStateUsing(fn (Mail $record) => self::formatMailState($record->reply_to ?? [])),
]),
]),
Tab::make(__('Statistics'))
Expand Down Expand Up @@ -244,14 +244,12 @@ public static function infolist(Schema $schema): Schema
Tab::make('Preview')
->extraAttributes(['class' => 'w-full max-w-full'])
->schema([
TextEntry::make('html')
ViewEntry::make('html')
->hiddenLabel()
->label(__('HTML Content'))
->extraAttributes(['class' => 'overflow-x-auto'])
->formatStateUsing(fn (string $state, Mail $record): View => view(
'filament-mails::mails.preview',
['html' => $state, 'mail' => $record],
)),
->view('filament-mails::mails.preview')
->viewData(fn (string $state, Mail $record) => ['html' => $state, 'mail' => $record]),
]),
Tab::make('HTML')
->schema([
Expand Down Expand Up @@ -307,7 +305,7 @@ public static function infolist(Schema $schema): Schema
->label(__('Mime Type')),
ViewEntry::make('uuid')
->label(__('Download'))
->getStateUsing(fn ($record) => $record)
->formatStateUsing(fn ($record) => $record)
->view('filament-mails::mails.download'),
]),
]),
Expand Down Expand Up @@ -349,12 +347,12 @@ public static function table(Table $table): Table
->label('')
->alignLeft()
->searchable(false)
->getStateUsing(fn (Mail $record) => $record->attachments->count() > 0)
->icon(fn (string $state): string => $state ? 'heroicon-o-paper-clip' : ''),
->getStateUsing(fn (Mail $record) => $record->attachments->count() > 0 ? true : null)
->icon('heroicon-o-paper-clip'),
TextColumn::make('to')
->label(__('Recipient(s)'))
->limit(50)
->getStateUsing(fn (Mail $record) => self::formatMailState(emails: $record->to, mailOnly: true))
->formatStateUsing(fn (Mail $record) => self::formatMailState(emails: $record->to, mailOnly: true))
->sortable()
->searchable(),
TextColumn::make('opens')
Expand Down
Loading