Skip to content

Commit

Permalink
Fix styling
Browse files Browse the repository at this point in the history
  • Loading branch information
marcogermani87 authored and github-actions[bot] committed Nov 3, 2024
1 parent 3d183d4 commit 0766b7e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 19 deletions.
38 changes: 19 additions & 19 deletions src/Filament/Resources/EmailResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public static function form(Form $form): Form
->label(__('filament-email::filament-email.created_at')),
])->columns(4),
Fieldset::make('attachments')
->hidden(fn(): bool => !config('filament-email.store_attachments'))
->hidden(fn (): bool => ! config('filament-email.store_attachments'))
->label(__('filament-email::filament-email.attachments'))
->schema([
View::make('filament-email::attachments')
Expand Down Expand Up @@ -151,7 +151,7 @@ public static function table(Table $table): Table
->icon('heroicon-o-eye')
->iconSize(IconSize::Medium)
->modalFooterActions(
fn($action): array => [
fn ($action): array => [
$action->getModalCancelAction(),
])
->fillForm(function ($record) {
Expand Down Expand Up @@ -208,29 +208,29 @@ public static function table(Table $table): Table
->nestedRecursiveRules([
'email',
])
->default(fn($record): array => !empty($record->to) ? explode(',', $record->to) : [])
->default(fn ($record): array => ! empty($record->to) ? explode(',', $record->to) : [])
->required(),
TagsInput::make('cc')
->label(__('filament-email::filament-email.cc'))
->placeholder(__('filament-email::filament-email.insert_multiple_email_placelholder'))
->nestedRecursiveRules([
'email',
])
->default(fn($record): array => !empty($record->cc) ? explode(',', $record->cc) : []),
->default(fn ($record): array => ! empty($record->cc) ? explode(',', $record->cc) : []),
TagsInput::make('bcc')
->label(__('filament-email::filament-email.bcc'))
->placeholder(__('filament-email::filament-email.insert_multiple_email_placelholder'))
->nestedRecursiveRules([
'email',
])
->default(fn($record): array => !empty($record->bcc) ? explode(',', $record->bcc) : []),
->default(fn ($record): array => ! empty($record->bcc) ? explode(',', $record->bcc) : []),
Toggle::make('attachments')
->label(__('filament-email::filament-email.add_attachments'))
->onColor('success')
->offColor('danger')
->inline(false)
->disabled(fn($record): bool => empty($record->attachments))
->default(fn($record): bool => !empty($record->attachments))
->disabled(fn ($record): bool => empty($record->attachments))
->default(fn ($record): bool => ! empty($record->attachments))
->required(),
])
->action(function (Email $record, array $data) {
Expand All @@ -257,10 +257,10 @@ public static function table(Table $table): Table
])
->columns([
TextColumn::make('from')
->prefix(__('filament-email::filament-email.from') . ': ')
->suffix(fn(Email $record): string => !empty($record->attachments) ? ' (' . trans_choice('filament-email::filament-email.attachments_number', count($record->attachments)) . ')' : '')
->prefix(__('filament-email::filament-email.from').': ')
->suffix(fn (Email $record): string => ! empty($record->attachments) ? ' ('.trans_choice('filament-email::filament-email.attachments_number', count($record->attachments)).')' : '')
->label(__('filament-email::filament-email.header'))
->description(fn(Email $record): string => Str::limit(__('filament-email::filament-email.to') . ': ' . $record->to, 40))
->description(fn (Email $record): string => Str::limit(__('filament-email::filament-email.to').': '.$record->to, 40))
->searchable(),
TextColumn::make('subject')
->label(__('filament-email::filament-email.subject'))
Expand Down Expand Up @@ -339,9 +339,9 @@ public static function table(Table $table): Table
foreach ($data as $field => $value) {
if ($data[$field] ?? null) {
if ($field === 'attachments') {
$indicators[$field] = __('filament-email::filament-email.' . $field) . ": " . ($value === 'yes' ? __('filament-email::filament-email.yes') : __('filament-email::filament-email.no'));
$indicators[$field] = __('filament-email::filament-email.'.$field).': '.($value === 'yes' ? __('filament-email::filament-email.yes') : __('filament-email::filament-email.no'));
} else {
$indicators[$field] = __('filament-email::filament-email.' . $field) . ": $value";
$indicators[$field] = __('filament-email::filament-email.'.$field).": $value";
}
}
}
Expand All @@ -352,24 +352,24 @@ public static function table(Table $table): Table
return $query
->when(
$data['from'],
fn(Builder $query, $value): Builder => $query->where('from', 'like', "%$value%"),
fn (Builder $query, $value): Builder => $query->where('from', 'like', "%$value%"),
)
->when(
$data['to'],
fn(Builder $query, $value): Builder => $query->where('to', 'like', "%$value%"),
fn (Builder $query, $value): Builder => $query->where('to', 'like', "%$value%"),
)
->when(
$data['cc'],
fn(Builder $query, $value): Builder => $query->where('cc', 'like', "%$value%"),
fn (Builder $query, $value): Builder => $query->where('cc', 'like', "%$value%"),
)
->when(
$data['bcc'],
fn(Builder $query, $value): Builder => $query->where('bcc', 'like', "%$value%"),
fn (Builder $query, $value): Builder => $query->where('bcc', 'like', "%$value%"),
)
->when(
$data['attachments'],
//JSON_LENGTH
fn(Builder $query, $value): Builder => $query->where(DB::raw('JSON_LENGTH(attachments)'), $value === 'yes' ? '>' : '=', 0),
fn (Builder $query, $value): Builder => $query->where(DB::raw('JSON_LENGTH(attachments)'), $value === 'yes' ? '>' : '=', 0),
)
->when(
$data['created_at'],
Expand All @@ -392,7 +392,7 @@ function (Builder $query, $value): Builder {
->paginationPageOptions(function (Table $table) {
$options = config('filament-email.pagination_page_options');

return !empty($options) && is_array($options) ? $options : $table->getPaginationPageOptions();
return ! empty($options) && is_array($options) ? $options : $table->getPaginationPageOptions();
});
}

Expand All @@ -408,7 +408,7 @@ public static function canAccess(): bool
{
$roles = config('filament-email.can_access.role', []);

if (method_exists(filament()->auth()->user(), 'hasRole') && !empty($roles)) {
if (method_exists(filament()->auth()->user(), 'hasRole') && ! empty($roles)) {
return filament()->auth()->user()->hasRole($roles);
}

Expand Down
1 change: 1 addition & 0 deletions src/Providers/EmailMessageServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Illuminate\Support\Facades\Event;
use Illuminate\Support\ServiceProvider;
use RickDBCN\FilamentEmail\Listeners\FilamentEmailLogger;

class EmailMessageServiceProvider extends ServiceProvider
{
public function boot(): void
Expand Down

0 comments on commit 0766b7e

Please sign in to comment.