|
3 | 3 | namespace TheThunderTurner\FilamentLatex\Resources;
|
4 | 4 |
|
5 | 5 | use Filament\Forms\Components\DateTimePicker;
|
| 6 | +use Filament\Forms\Components\Group; |
6 | 7 | use Filament\Forms\Components\Section;
|
7 | 8 | use Filament\Forms\Components\Select;
|
8 | 9 | use Filament\Forms\Components\TextInput;
|
@@ -49,34 +50,45 @@ public static function form(Form $form): Form
|
49 | 50 |
|
50 | 51 | return $form
|
51 | 52 | ->schema([
|
52 |
| - Section::make() |
| 53 | + Group::make() |
53 | 54 | ->schema([
|
54 |
| - TextInput::make('name') |
55 |
| - ->label(__('filament-latex::filament-latex.field.name')) |
56 |
| - ->translateLabel() |
57 |
| - ->required(), |
58 |
| - DateTimePicker::make('deadline') |
59 |
| - ->label(__('filament-latex::filament-latex.field.deadline')) |
60 |
| - ->required() |
61 |
| - ->native(false) |
62 |
| - ->placeholder('DD-MM-YYYY HH:MM') |
63 |
| - ->suffixIcon('heroicon-m-calendar') |
64 |
| - ->format('Y-m-d H:i:s') |
65 |
| - ->displayFormat('d-m-Y H:i'), |
66 |
| - Select::make('author_id') |
67 |
| - ->label(__('filament-latex::filament-latex.field.author_id')) |
68 |
| - ->default(fn () => Auth::id()) |
69 |
| - ->options(fn () => $userModel::all()->pluck('name', 'id')) |
70 |
| - ->disabled() |
71 |
| - ->dehydrated() |
72 |
| - ->required(), |
73 |
| - Select::make('collaborators_id') |
74 |
| - ->label(__('filament-latex::filament-latex.field.collaborators_id')) |
75 |
| - ->multiple() |
76 |
| - ->options(fn () => $userModel::all()->pluck('name', 'id')) |
77 |
| - ->searchable(), |
78 |
| - ])->columns(2), |
79 |
| - ]); |
| 55 | + Section::make([ |
| 56 | + TextInput::make('name') |
| 57 | + ->label(__('filament-latex::filament-latex.field.name')) |
| 58 | + ->translateLabel() |
| 59 | + ->required(), |
| 60 | + Select::make('author_id') |
| 61 | + ->label(__('filament-latex::filament-latex.field.author_id')) |
| 62 | + ->default(fn () => Auth::id()) |
| 63 | + ->options(fn () => $userModel::all()->pluck('name', 'id')) |
| 64 | + ->disabled() |
| 65 | + ->dehydrated() |
| 66 | + ->required(), |
| 67 | + ])->columns(2), |
| 68 | + ]) |
| 69 | + ->columnSpan(['lg' => 2]), |
| 70 | + |
| 71 | + Group::make() |
| 72 | + ->schema([ |
| 73 | + Section::make([ |
| 74 | + DateTimePicker::make('deadline') |
| 75 | + ->label(__('filament-latex::filament-latex.field.deadline')) |
| 76 | + ->required() |
| 77 | + ->native(false) |
| 78 | + ->placeholder('DD-MM-YYYY HH:MM') |
| 79 | + ->suffixIcon('heroicon-m-calendar') |
| 80 | + ->format('Y-m-d H:i:s') |
| 81 | + ->displayFormat('d-m-Y H:i'), |
| 82 | + Select::make('collaborators_id') |
| 83 | + ->label(__('filament-latex::filament-latex.field.collaborators_id')) |
| 84 | + ->multiple() |
| 85 | + ->options(fn () => $userModel::all()->pluck('name', 'id')) |
| 86 | + ->searchable(), |
| 87 | + ]), |
| 88 | + ]) |
| 89 | + ->columnSpan(['lg' => 1]), |
| 90 | + ]) |
| 91 | + ->columns(3); |
80 | 92 | }
|
81 | 93 |
|
82 | 94 | public static function table(Table $table): Table
|
@@ -121,6 +133,7 @@ public static function table(Table $table): Table
|
121 | 133 | ->label(__('filament-latex::filament-latex.column.collaborators'))
|
122 | 134 | ->visible(! config('filament-latex.avatar-columns'))
|
123 | 135 | ->badge()
|
| 136 | + ->limit(15) |
124 | 137 | ->color('info')
|
125 | 138 | ->getStateUsing(function ($record) use ($userModel) {
|
126 | 139 | return $userModel::whereIn('id', $record->collaborators_id)->pluck('name')->toArray();
|
|
0 commit comments