Skip to content

Commit

Permalink
Merge pull request #12 from rmsramos/develop
Browse files Browse the repository at this point in the history
form refactoring
  • Loading branch information
rmsramos authored May 15, 2024
2 parents 2a646e8 + 0d49c39 commit b180225
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/Resources/ActivitylogResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
namespace Rmsramos\Activitylog\Resources;

use Filament\Forms\Components\DatePicker;
use Filament\Forms\Components\Group;
use Filament\Forms\Components\KeyValue;
use Filament\Forms\Components\Placeholder;
use Filament\Forms\Components\Section;
use Filament\Forms\Components\Split;
use Filament\Forms\Components\Textarea;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Form;
Expand Down Expand Up @@ -76,7 +76,7 @@ public static function form(Form $form): Form
{
return $form
->schema([
Group::make([
Split::make([
Section::make([
TextInput::make('causer_id')
->afterStateHydrated(function ($component, ?Model $record) {
Expand All @@ -96,10 +96,7 @@ public static function form(Form $form): Form
->label(__('activitylog::forms.fields.description.label'))
->rows(2)
->columnSpan('full'),
])
->columns(2),
])->columnSpan(['sm' => 3]),
Group::make([
]),
Section::make([
Placeholder::make('log_name')
->content(function (?Model $record): string {
Expand All @@ -121,8 +118,9 @@ public static function form(Form $form): Form
/** @var Activity&ActivityModel $record */
return $record->created_at ? "{$record->created_at->format(config('activitylog.datetime_format', 'd/m/Y H:i:s'))}" : '-';
}),
]),
]),
])->grow(false),
])->from('md'),

Section::make()
->columns()
->visible(fn ($record) => $record->properties?->count() > 0)
Expand Down Expand Up @@ -152,7 +150,7 @@ public static function form(Form $form): Form

return $schema;
}),
])->columns(['sm' => 4, 'lg' => null]);
])->columns(1);
}

public static function table(Table $table): Table
Expand Down

0 comments on commit b180225

Please sign in to comment.