This commit is contained in:
f4ilji
2024-11-17 01:33:09 +05:00
parent 7b9dc03420
commit af69b48247
33 changed files with 367 additions and 210 deletions
@@ -11,6 +11,7 @@ use Filament\Forms\Components\TextInput;
use Filament\Forms\Form;
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;
@@ -32,18 +33,21 @@ class AdditionalEducationCategoryResource extends Resource
{
return $form
->schema([
Forms\Components\Grid::make('2')->schema([
TextInput::make('title')->label('Заголовок')->required()
->live(onBlur: true)
->afterStateUpdated(function (string $operation, string|null $state, Forms\Set $set) {
$set('slug', Str::slug($state));
$set('seo.title', $state);
}),
TextInput::make('slug')->label('Slug')->unique(ignoreRecord: true)->readOnly()->required(),
Forms\Components\Select::make('dir_addit_educat_id')->required()
->options(DirectionAdditionalEducation::where('is_active', true)->pluck('title', 'id'))
Forms\Components\Section::make()->schema([
Forms\Components\Grid::make('2')->schema([
TextInput::make('title')->label('Заголовок')->required()
->live(onBlur: true)
->afterStateUpdated(function (string $operation, string|null $state, Forms\Set $set) {
$set('slug', Str::slug($state));
$set('seo.title', $state);
}),
TextInput::make('slug')->label('Slug')->unique(ignoreRecord: true)->readOnly()->required(),
Forms\Components\Select::make('dir_addit_educat_id')->required()->label('Направление доп. образования')
->preload()
->options(DirectionAdditionalEducation::where('is_active', true)->pluck('title', 'id'))
]),
Forms\Components\Toggle::make('is_active')->label('Активно')->columnSpanFull()->inline(false)->default(true),
]),
Forms\Components\Toggle::make('is_active')->columnSpanFull()->inline(false)->default(true),
]);
}
@@ -51,7 +55,11 @@ class AdditionalEducationCategoryResource extends Resource
{
return $table
->columns([
//
TextColumn::make('id')->label('ID')->sortable(),
TextColumn::make('title')->label('Название')->sortable()->searchable(),
TextColumn::make('created_at')->label('Дата создания')->sortable(),
Tables\Columns\BadgeColumn::make('direction.title')->label('Направление')->sortable(),
Tables\Columns\ToggleColumn::make('is_active')->label('Активно')->sortable(),
])
->filters([
//