first commit
This commit is contained in:
@@ -0,0 +1,297 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources;
|
||||
|
||||
use App\Filament\Resources\AcademicJournalResource\Pages;
|
||||
use App\Filament\Resources\AcademicJournalResource\RelationManagers;
|
||||
use App\Filament\Resources\AcademicJournalResource\RelationManagers\JournalsRelationManager;
|
||||
use App\Models\AcademicJournal;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Components\Builder;
|
||||
use Filament\Forms\Components\FileUpload;
|
||||
use Filament\Forms\Components\Hidden;
|
||||
use Filament\Forms\Components\RichEditor;
|
||||
use Filament\Forms\Components\Tabs;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
use Illuminate\Support\Str;
|
||||
use Mohamedsabil83\FilamentFormsTinyeditor\Components\TinyEditor;
|
||||
|
||||
class AcademicJournalResource extends Resource
|
||||
{
|
||||
|
||||
protected static ?string $navigationGroup = 'Наука';
|
||||
|
||||
public static ?string $label = 'Журнал';
|
||||
|
||||
protected static ?string $pluralLabel = 'Научные журналы';
|
||||
|
||||
protected static ?string $model = AcademicJournal::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-beaker';
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
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));
|
||||
}),
|
||||
TextInput::make('slug')->label('Slug')->unique(ignoreRecord: true)->readOnly()->required(),
|
||||
]),
|
||||
]),
|
||||
Tabs::make('Tabs')
|
||||
->tabs([
|
||||
Tabs\Tab::make('Основная информация журнала')
|
||||
->schema([
|
||||
Builder::make('main_info')->label('')->blocks([
|
||||
Builder\Block::make('heading')->label('Заголовок')
|
||||
->schema([
|
||||
TextInput::make('id')->hidden()->integer()->default(rand(2335235,324634264263426)),
|
||||
TextInput::make('content')
|
||||
->label('')
|
||||
->live(onBlur: true)
|
||||
->afterStateUpdated(function (string $operation, string $state, Forms\Set $set, $get) {
|
||||
}),
|
||||
]),
|
||||
Builder\Block::make('paragraph')
|
||||
->schema([
|
||||
RichEditor::make('content')
|
||||
->toolbarButtons([
|
||||
'blockquote',
|
||||
'bold',
|
||||
'bulletList',
|
||||
'italic',
|
||||
'link',
|
||||
'orderedList',
|
||||
'redo',
|
||||
'strike',
|
||||
'underline',
|
||||
'undo',
|
||||
])
|
||||
->label('')
|
||||
->required(),
|
||||
]),
|
||||
Builder\Block::make('image')
|
||||
->schema([
|
||||
FileUpload::make('url')
|
||||
->label('Изображение(-я)')
|
||||
->image()
|
||||
->multiple()
|
||||
->reorderable()
|
||||
->maxFiles(5)
|
||||
->disk('public')
|
||||
->directory('images')
|
||||
->imageEditor()
|
||||
->required(),
|
||||
TextInput::make('alt')
|
||||
->label('Описание')
|
||||
->placeholder('Необязяательно')
|
||||
])->label('Изображение(-я)'),
|
||||
Builder\Block::make('video')
|
||||
->schema([
|
||||
Hidden::make('mime'),
|
||||
|
||||
TextInput::make('title')
|
||||
->required()
|
||||
->maxLength(255)
|
||||
->autofocus(),
|
||||
|
||||
FileUpload::make('path')
|
||||
->required()
|
||||
->acceptedFileTypes(['video/mp4','video/ogg','video/webm'])
|
||||
->maxSize(512000)
|
||||
->disk('videos')
|
||||
->visibility('public')
|
||||
->afterStateUpdated(fn (callable $set, $state) => $set('mime', $state?->getMimeType())),
|
||||
]),
|
||||
Builder\Block::make('files')
|
||||
->schema([
|
||||
TextInput::make('title')
|
||||
->required()
|
||||
->maxLength(255)
|
||||
->autofocus(),
|
||||
FileUpload::make('path')
|
||||
->required()
|
||||
->acceptedFileTypes([
|
||||
'application/pdf',
|
||||
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
||||
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
||||
'application/vnd.openxmlformats-officedocument.presentationml.presentation',
|
||||
'application/zip'
|
||||
])
|
||||
->maxSize(512000)
|
||||
->disk('public')
|
||||
->directory('files')
|
||||
->downloadable()
|
||||
->visibility('public')
|
||||
])
|
||||
])
|
||||
->collapsed()
|
||||
->blockNumbers(false)
|
||||
->collapsible()
|
||||
->addActionLabel('Добавить новый блок'),
|
||||
]),
|
||||
Tabs\Tab::make('Редакция')
|
||||
->schema([
|
||||
Forms\Components\Section::make('Главный редактор')->schema([
|
||||
Forms\Components\Repeater::make('chief_editor')->schema([
|
||||
TextInput::make('name')->label('Имя'),
|
||||
TextInput::make('academicTitle')->label('Ученная степень'),
|
||||
TextInput::make('position')->label('Должность'),
|
||||
TextInput::make('institution')->label('Учереждение'),
|
||||
])->maxItems(1),
|
||||
]),
|
||||
Forms\Components\Section::make('Редакторы')->schema([
|
||||
Forms\Components\Repeater::make('editors')->schema([
|
||||
TextInput::make('name')->label('Имя'),
|
||||
TextInput::make('academicTitle')->label('Ученная степень'),
|
||||
TextInput::make('position')->label('Должность'),
|
||||
TextInput::make('institution')->label('Учереждение'),
|
||||
])
|
||||
->collapsed()
|
||||
->collapsible()
|
||||
->label('')
|
||||
->addActionLabel('Добавить редактора'),
|
||||
|
||||
]),
|
||||
]),
|
||||
Tabs\Tab::make('Информация для авторов')
|
||||
->schema([
|
||||
Builder::make('for_authors')->label('')->blocks([
|
||||
Builder\Block::make('heading')->label('Заголовок')
|
||||
->schema([
|
||||
TextInput::make('id')->hidden()->integer()->default(rand(2335235,324634264263426)),
|
||||
TextInput::make('content')
|
||||
->label('')
|
||||
->live(onBlur: true)
|
||||
->afterStateUpdated(function (string $operation, string $state, Forms\Set $set, $get) {
|
||||
}),
|
||||
]),
|
||||
Builder\Block::make('paragraph')
|
||||
->schema([
|
||||
RichEditor::make('content')
|
||||
->toolbarButtons([
|
||||
'blockquote',
|
||||
'bold',
|
||||
'bulletList',
|
||||
'italic',
|
||||
'link',
|
||||
'orderedList',
|
||||
'redo',
|
||||
'strike',
|
||||
'underline',
|
||||
'undo',
|
||||
])
|
||||
->label('')
|
||||
->required()
|
||||
]),
|
||||
Builder\Block::make('image')
|
||||
->schema([
|
||||
FileUpload::make('url')
|
||||
->label('Изображение(-я)')
|
||||
->image()
|
||||
->multiple()
|
||||
->reorderable()
|
||||
->maxFiles(5)
|
||||
->disk('public')
|
||||
->directory('images')
|
||||
->imageEditor()
|
||||
->required(),
|
||||
TextInput::make('alt')
|
||||
->label('Описание')
|
||||
->placeholder('Необязяательно')
|
||||
])->label('Изображение(-я)'),
|
||||
Builder\Block::make('video')
|
||||
->schema([
|
||||
Hidden::make('mime'),
|
||||
|
||||
TextInput::make('title')
|
||||
->required()
|
||||
->maxLength(255)
|
||||
->autofocus(),
|
||||
|
||||
FileUpload::make('path')
|
||||
->required()
|
||||
->acceptedFileTypes(['video/mp4','video/ogg','video/webm'])
|
||||
->maxSize(512000)
|
||||
->disk('videos')
|
||||
->visibility('public')
|
||||
->afterStateUpdated(fn (callable $set, $state) => $set('mime', $state?->getMimeType())),
|
||||
]),
|
||||
Builder\Block::make('files')
|
||||
->schema([
|
||||
TextInput::make('title')
|
||||
->required()
|
||||
->maxLength(255)
|
||||
->autofocus(),
|
||||
FileUpload::make('path')
|
||||
->required()
|
||||
->acceptedFileTypes([
|
||||
'application/pdf',
|
||||
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
||||
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
||||
'application/vnd.openxmlformats-officedocument.presentationml.presentation',
|
||||
'application/zip'
|
||||
])
|
||||
->maxSize(512000)
|
||||
->disk('public')
|
||||
->directory('files')
|
||||
->downloadable()
|
||||
->visibility('public')
|
||||
])
|
||||
])
|
||||
->collapsed()
|
||||
->blockNumbers(false)
|
||||
->collapsible()
|
||||
->addActionLabel('Добавить новый блок'),
|
||||
]),
|
||||
])->columnSpanFull()
|
||||
|
||||
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
//
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\EditAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
JournalsRelationManager::class
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ListAcademicJournals::route('/'),
|
||||
'create' => Pages\CreateAcademicJournal::route('/create'),
|
||||
'edit' => Pages\EditAcademicJournal::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\AcademicJournalResource\Pages;
|
||||
|
||||
use App\Filament\Resources\AcademicJournalResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateAcademicJournal extends CreateRecord
|
||||
{
|
||||
protected static string $resource = AcademicJournalResource::class;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\AcademicJournalResource\Pages;
|
||||
|
||||
use App\Filament\Resources\AcademicJournalResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditAcademicJournal extends EditRecord
|
||||
{
|
||||
protected static string $resource = AcademicJournalResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\AcademicJournalResource\Pages;
|
||||
|
||||
use App\Filament\Resources\AcademicJournalResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListAcademicJournals extends ListRecords
|
||||
{
|
||||
protected static string $resource = AcademicJournalResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
+70
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\AcademicJournalResource\RelationManagers;
|
||||
|
||||
use App\Models\AcademicJournal;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Components\FileUpload;
|
||||
use Filament\Forms\Components\Toggle;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\RelationManagers\RelationManager;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
|
||||
class JournalsRelationManager extends RelationManager
|
||||
{
|
||||
protected static string $relationship = 'journals';
|
||||
|
||||
public function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('title')->required(),
|
||||
FileUpload::make('path_file')
|
||||
->required()
|
||||
->acceptedFileTypes([
|
||||
'application/pdf',
|
||||
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
||||
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
||||
'application/vnd.openxmlformats-officedocument.presentationml.presentation',
|
||||
'application/zip'
|
||||
])
|
||||
->maxSize(512000)
|
||||
->disk('public')
|
||||
->directory('files')
|
||||
->downloadable()
|
||||
->visibility('public'),
|
||||
Forms\Components\TextInput::make('year_publication')->integer(),
|
||||
Toggle::make('is_active')->default(true)->label('Активный выпуск')->inline(false),
|
||||
]);
|
||||
}
|
||||
|
||||
public function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->defaultGroup('year_publication')
|
||||
->reorderable('sort')
|
||||
->defaultSort('sort')
|
||||
->recordTitleAttribute('title')
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('title'),
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->headerActions([
|
||||
Tables\Actions\CreateAction::make(),
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\EditAction::make(),
|
||||
Tables\Actions\DeleteAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources;
|
||||
|
||||
use App\Filament\Resources\AdditionalEducationCategoryResource\Pages;
|
||||
use App\Filament\Resources\AdditionalEducationCategoryResource\RelationManagers;
|
||||
use App\Models\AdditionalEducationCategory;
|
||||
use App\Models\DirectionAdditionalEducation;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
|
||||
class AdditionalEducationCategoryResource extends Resource
|
||||
{
|
||||
protected static ?string $model = AdditionalEducationCategory::class;
|
||||
|
||||
protected static ?string $navigationGroup = 'Образование';
|
||||
|
||||
public static ?string $label = 'Категория';
|
||||
protected static ?string $pluralLabel = 'Категории дополнительного образования';
|
||||
protected static ?string $navigationParentItem = 'Дополнительное Образование';
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Forms\Components\Grid::make('2')->schema([
|
||||
Forms\Components\TextInput::make('title')->required(),
|
||||
Forms\Components\Select::make('dir_addit_educat_id')->required()
|
||||
->options(DirectionAdditionalEducation::where('is_active', true)->pluck('title', 'id'))
|
||||
]),
|
||||
Forms\Components\Toggle::make('is_active')->columnSpanFull()->inline(false)->default(true),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
//
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\EditAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ListAdditionalEducationCategories::route('/'),
|
||||
'create' => Pages\CreateAdditionalEducationCategory::route('/create'),
|
||||
'edit' => Pages\EditAdditionalEducationCategory::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\AdditionalEducationCategoryResource\Pages;
|
||||
|
||||
use App\Filament\Resources\AdditionalEducationCategoryResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateAdditionalEducationCategory extends CreateRecord
|
||||
{
|
||||
protected static string $resource = AdditionalEducationCategoryResource::class;
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\AdditionalEducationCategoryResource\Pages;
|
||||
|
||||
use App\Filament\Resources\AdditionalEducationCategoryResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditAdditionalEducationCategory extends EditRecord
|
||||
{
|
||||
protected static string $resource = AdditionalEducationCategoryResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\AdditionalEducationCategoryResource\Pages;
|
||||
|
||||
use App\Filament\Resources\AdditionalEducationCategoryResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListAdditionalEducationCategories extends ListRecords
|
||||
{
|
||||
protected static string $resource = AdditionalEducationCategoryResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,456 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources;
|
||||
|
||||
use App\Enums\FormEducation;
|
||||
use App\Enums\LevelEducational;
|
||||
use App\Enums\PostStatus;
|
||||
use App\Filament\Resources\AdditionalEducationResource\Pages;
|
||||
use App\Filament\Resources\AdditionalEducationResource\RelationManagers;
|
||||
use App\Models\AdditionalEducation;
|
||||
use App\Models\AdditionalEducationCategory;
|
||||
use App\Models\Category;
|
||||
use App\Models\DirectionAdditionalEducation;
|
||||
use App\Models\Page;
|
||||
use App\Models\Post;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Components\Builder;
|
||||
use Filament\Forms\Components\FileUpload;
|
||||
use Filament\Forms\Components\Hidden;
|
||||
use Filament\Forms\Components\RichEditor;
|
||||
use Filament\Forms\Components\Section;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\SpatieTagsInput;
|
||||
use Filament\Forms\Components\Tabs;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
use Illuminate\Support\Str;
|
||||
use Mohamedsabil83\FilamentFormsTinyeditor\Components\TinyEditor;
|
||||
|
||||
class AdditionalEducationResource extends Resource
|
||||
{
|
||||
protected static ?string $model = AdditionalEducation::class;
|
||||
|
||||
protected static ?string $navigationGroup = 'Образование';
|
||||
|
||||
public static ?string $label = 'Дополнительное образование';
|
||||
protected static ?string $pluralLabel = 'Дополнительное образование';
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-academic-cap';
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Tabs::make('Tabs')
|
||||
->tabs([
|
||||
Tabs\Tab::make('Основная информация')
|
||||
->schema([
|
||||
Forms\Components\Grid::make('2')->schema([
|
||||
Forms\Components\TextInput::make('title')->required(),
|
||||
Forms\Components\Select::make('category_id')->required()
|
||||
->options(AdditionalEducationCategory::where('is_active', true)->pluck('title', 'id'))
|
||||
]),
|
||||
Forms\Components\TextInput::make('target_group')->required()->columnSpanFull(),
|
||||
Forms\Components\TextInput::make('qualification')->required()->columnSpanFull(),
|
||||
Forms\Components\Grid::make('2')->schema([
|
||||
Forms\Components\TextInput::make('price')->required()->integer(),
|
||||
Forms\Components\TextInput::make('learning_time')->required()->integer(),
|
||||
]),
|
||||
Forms\Components\Select::make('form_education')->required()->options(FormEducation::class),
|
||||
Forms\Components\Toggle::make('is_active')->columnSpanFull()->inline(false)->default(true),
|
||||
]),
|
||||
Tabs\Tab::make('Контент')
|
||||
->schema([
|
||||
\Filament\Forms\Components\Builder::make('content')->label('')->blocks([
|
||||
Builder\Block::make('heading')->label('Заголовок')
|
||||
->schema([
|
||||
TextInput::make('id')->hidden()->integer()->default(rand(2335235,324634264263426)),
|
||||
TextInput::make('content')
|
||||
->label('')
|
||||
->live(onBlur: true)
|
||||
->afterStateUpdated(function (string $operation, string $state, Forms\Set $set, $get) {
|
||||
}),
|
||||
]),
|
||||
Builder\Block::make('paragraph')->label('Текст')
|
||||
->schema([
|
||||
RichEditor::make('content')
|
||||
->toolbarButtons([
|
||||
'blockquote',
|
||||
'bold',
|
||||
'bulletList',
|
||||
'italic',
|
||||
'link',
|
||||
'orderedList',
|
||||
'redo',
|
||||
'strike',
|
||||
'underline',
|
||||
'undo',
|
||||
])
|
||||
->label(''),
|
||||
]),
|
||||
Builder\Block::make('files')->label('Файлы')
|
||||
->schema([
|
||||
Forms\Components\Repeater::make('file')->schema([
|
||||
TextInput::make('title')
|
||||
->required()
|
||||
->maxLength(255)
|
||||
->autofocus(),
|
||||
FileUpload::make('path')
|
||||
->required()
|
||||
->acceptedFileTypes([
|
||||
'application/pdf',
|
||||
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
||||
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
||||
'application/vnd.openxmlformats-officedocument.presentationml.presentation',
|
||||
'application/zip'
|
||||
])
|
||||
->maxSize(512000)
|
||||
->disk('public')
|
||||
->directory('files')
|
||||
->downloadable()
|
||||
->visibility('public')
|
||||
]),
|
||||
]),
|
||||
Builder\Block::make('person')->label('Персона')
|
||||
->schema([
|
||||
TextInput::make('name')
|
||||
->label('Имя')
|
||||
->required()
|
||||
->maxLength(255),
|
||||
FileUpload::make('photo')
|
||||
->label('Фотография')
|
||||
->image()
|
||||
->disk('public')
|
||||
->directory('images')
|
||||
->imageEditor(),
|
||||
Forms\Components\Repeater::make('info')->schema([
|
||||
Forms\Components\Grid::make(2)->schema([
|
||||
TextInput::make('column')
|
||||
->required()
|
||||
->maxLength(255),
|
||||
TextInput::make('content')
|
||||
->required()
|
||||
->maxLength(255),
|
||||
]),
|
||||
])->minItems(1),
|
||||
]),
|
||||
Builder\Block::make('stepper')->label('Этапы')
|
||||
->schema([
|
||||
TextInput::make('step_name')
|
||||
->label('Название шага')
|
||||
->required()
|
||||
->maxLength(255),
|
||||
Forms\Components\Repeater::make('steps')->schema([
|
||||
TextInput::make('title')
|
||||
->required()
|
||||
->live()
|
||||
->maxLength(255)->columnSpanFull(),
|
||||
RichEditor::make('content')->required(),
|
||||
])
|
||||
->itemLabel(fn (array $state): ?string => $state['title'] ?? null)
|
||||
->minItems(1)
|
||||
->collapsible()
|
||||
->collapsed()
|
||||
|
||||
|
||||
]),
|
||||
Builder\Block::make('tabs')->label('Вкладки')
|
||||
->schema([
|
||||
Forms\Components\Repeater::make('tab')->schema([
|
||||
TextInput::make('title')
|
||||
->required()
|
||||
->maxLength(255)->columnSpanFull(),
|
||||
\Filament\Forms\Components\Builder::make('content')->label('')->blocks([
|
||||
Builder\Block::make('heading')->label('Заголовок')
|
||||
->schema([
|
||||
TextInput::make('id')->hidden()->integer()->default(rand(2335235,324634264263426)),
|
||||
TextInput::make('content')
|
||||
->label('')
|
||||
->live(onBlur: true)
|
||||
->afterStateUpdated(function (string $operation, string $state, Forms\Set $set, $get) {
|
||||
}),
|
||||
]),
|
||||
Builder\Block::make('paragraph')
|
||||
->schema([
|
||||
RichEditor::make('content')
|
||||
->toolbarButtons([
|
||||
'blockquote',
|
||||
'bold',
|
||||
'bulletList',
|
||||
'italic',
|
||||
'link',
|
||||
'orderedList',
|
||||
'redo',
|
||||
'strike',
|
||||
'underline',
|
||||
'undo',
|
||||
])
|
||||
->label(''),
|
||||
])->label('Текст'),
|
||||
Builder\Block::make('files')
|
||||
->schema([
|
||||
Forms\Components\Repeater::make('file')->schema([
|
||||
TextInput::make('title')
|
||||
->required()
|
||||
->maxLength(255)
|
||||
->autofocus(),
|
||||
FileUpload::make('path')
|
||||
->required()
|
||||
->acceptedFileTypes([
|
||||
'application/pdf',
|
||||
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
||||
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
||||
'application/vnd.openxmlformats-officedocument.presentationml.presentation',
|
||||
'application/zip'
|
||||
])
|
||||
->maxSize(512000)
|
||||
->disk('public')
|
||||
->directory('files')
|
||||
->downloadable()
|
||||
->visibility('public')
|
||||
]),
|
||||
]),
|
||||
Builder\Block::make('person')
|
||||
->schema([
|
||||
TextInput::make('name')
|
||||
->label('Имя')
|
||||
->required()
|
||||
->maxLength(255),
|
||||
FileUpload::make('photo')
|
||||
->label('Фотография')
|
||||
->image()
|
||||
->disk('public')
|
||||
->directory('images')
|
||||
->imageEditor(),
|
||||
Forms\Components\Repeater::make('info')->schema([
|
||||
Forms\Components\Grid::make(2)->schema([
|
||||
TextInput::make('column')
|
||||
->required()
|
||||
->maxLength(255),
|
||||
TextInput::make('content')
|
||||
->required()
|
||||
->maxLength(255),
|
||||
]),
|
||||
])->minItems(1),
|
||||
]),
|
||||
Builder\Block::make('stepper')
|
||||
->schema([
|
||||
TextInput::make('step_name')
|
||||
->label('Название шага')
|
||||
->required()
|
||||
->maxLength(255),
|
||||
Forms\Components\Repeater::make('steps')->schema([
|
||||
TextInput::make('title')
|
||||
->required()
|
||||
->maxLength(255)->columnSpanFull(),
|
||||
RichEditor::make('content')->required(),
|
||||
])->minItems(1),
|
||||
]),
|
||||
Builder\Block::make('images')
|
||||
->schema([
|
||||
FileUpload::make('url')
|
||||
->label('Изображение(-я)')
|
||||
->image()
|
||||
->multiple()
|
||||
->reorderable()
|
||||
->maxFiles(5)
|
||||
->disk('public')
|
||||
->directory('images')
|
||||
->imageEditor()
|
||||
->required(),
|
||||
TextInput::make('alt')
|
||||
->label('Описание')
|
||||
->placeholder('Необязяательно')
|
||||
])->label('Слайдер изображений'),
|
||||
Builder\Block::make('image')
|
||||
->schema([
|
||||
FileUpload::make('url')
|
||||
->label('Изображение(-я)')
|
||||
->image()
|
||||
->multiple()
|
||||
->reorderable()
|
||||
->maxFiles(5)
|
||||
->disk('public')
|
||||
->directory('images')
|
||||
->imageEditor()
|
||||
->required(),
|
||||
TextInput::make('alt')
|
||||
->label('Описание')
|
||||
->placeholder('Необязяательно')
|
||||
])->label('Изображение'),
|
||||
Builder\Block::make('video')
|
||||
->schema([
|
||||
TextInput::make('mime')->readOnly(),
|
||||
TextInput::make('title')
|
||||
->required()
|
||||
->maxLength(255)
|
||||
->autofocus(),
|
||||
FileUpload::make('path')
|
||||
->required()
|
||||
->acceptedFileTypes([
|
||||
'video/mp4',
|
||||
'video/quicktime',
|
||||
'video/x-msvideo',
|
||||
'video/x-ms-wmv',
|
||||
'video/avi',
|
||||
'video/webm',
|
||||
'video/ogg',
|
||||
'video/3gpp',
|
||||
'video/3gpp2',
|
||||
'video/x-m4v',
|
||||
])
|
||||
->disk('public')
|
||||
->directory('videos')
|
||||
->afterStateUpdated(fn (callable $set, $state) => $set('mime', $state?->getMimeType())),
|
||||
]),
|
||||
Builder\Block::make('postsList')
|
||||
->schema([
|
||||
Forms\Components\Grid::make(2)->schema([
|
||||
TextInput::make('count')
|
||||
->label('Количество запией')
|
||||
->integer(),
|
||||
Select::make('category')
|
||||
->options(Category::all()->pluck('title', 'id'))
|
||||
]),
|
||||
])->label('Список новостей'),
|
||||
])
|
||||
->collapsed()
|
||||
->blockNumbers(false)
|
||||
->collapsible()
|
||||
->addActionLabel('Добавить новый блок'),
|
||||
])->minItems(1),
|
||||
]),
|
||||
Builder\Block::make('images')->label('Слайдер изображений')
|
||||
->schema([
|
||||
FileUpload::make('url')
|
||||
->label('Изображение(-я)')
|
||||
->image()
|
||||
->multiple()
|
||||
->reorderable()
|
||||
->maxFiles(5)
|
||||
->disk('public')
|
||||
|
||||
->directory('images')
|
||||
->imageEditor()
|
||||
->required(),
|
||||
TextInput::make('alt')
|
||||
->label('Описание')
|
||||
->placeholder('Необязяательно')
|
||||
]),
|
||||
Builder\Block::make('image')->label('Изображение')
|
||||
->schema([
|
||||
FileUpload::make('url')
|
||||
->label('Изображение(-я)')
|
||||
->image()
|
||||
->multiple()
|
||||
->reorderable()
|
||||
->maxFiles(5)
|
||||
->disk('public')
|
||||
->directory('images')
|
||||
->imageEditor()
|
||||
->required(),
|
||||
TextInput::make('alt')
|
||||
->label('Описание')
|
||||
->placeholder('Необязяательно')
|
||||
]),
|
||||
Builder\Block::make('video')->label('Видео')
|
||||
->schema([
|
||||
TextInput::make('mime')->readOnly(),
|
||||
TextInput::make('title')
|
||||
->required()
|
||||
->maxLength(255)
|
||||
->autofocus(),
|
||||
FileUpload::make('path')
|
||||
->required()
|
||||
->acceptedFileTypes([
|
||||
'video/mp4',
|
||||
'video/quicktime',
|
||||
'video/x-msvideo',
|
||||
'video/x-ms-wmv',
|
||||
'video/avi',
|
||||
'video/webm',
|
||||
'video/ogg',
|
||||
'video/3gpp',
|
||||
'video/3gpp2',
|
||||
'video/x-m4v',
|
||||
])
|
||||
->disk('public')
|
||||
->directory('videos')
|
||||
->afterStateUpdated(fn (callable $set, $state) => $set('mime', $state?->getMimeType())),
|
||||
]),
|
||||
Builder\Block::make('postsList')->label('Список новостей')
|
||||
->schema([
|
||||
Forms\Components\Grid::make(2)->schema([
|
||||
TextInput::make('count')
|
||||
->label('Количество запией')
|
||||
->integer(),
|
||||
Select::make('category')
|
||||
->options(Category::all()->pluck('title', 'id'))
|
||||
]),
|
||||
]),
|
||||
Builder\Block::make('postItem')->label('Новость')
|
||||
->schema([
|
||||
Select::make('post')
|
||||
->options(Post::query()->where('status', PostStatus::PUBLISHED)->pluck('title', 'id'))
|
||||
->searchable()
|
||||
->required(),
|
||||
]),
|
||||
Builder\Block::make('pageItem')->label('Страница')
|
||||
->schema([
|
||||
Select::make('page')
|
||||
->options(Page::query()->where('title', '!=' , null)->where('is_visible', true)->pluck('title', 'id'))
|
||||
->searchable()
|
||||
->required(),
|
||||
]),
|
||||
])
|
||||
->collapsed()
|
||||
->blockNumbers(false)
|
||||
->collapsible()
|
||||
->blockPickerColumns(3)
|
||||
->blockPickerWidth('2xl')
|
||||
->addActionLabel('Добавить новый блок'),
|
||||
]),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
//
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\EditAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ListAdditionalEducation::route('/'),
|
||||
'create' => Pages\CreateAdditionalEducation::route('/create'),
|
||||
'edit' => Pages\EditAdditionalEducation::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\AdditionalEducationResource\Pages;
|
||||
|
||||
use App\Filament\Resources\AdditionalEducationResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateAdditionalEducation extends CreateRecord
|
||||
{
|
||||
protected static string $resource = AdditionalEducationResource::class;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\AdditionalEducationResource\Pages;
|
||||
|
||||
use App\Filament\Resources\AdditionalEducationResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditAdditionalEducation extends EditRecord
|
||||
{
|
||||
protected static string $resource = AdditionalEducationResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\AdditionalEducationResource\Pages;
|
||||
|
||||
use App\Filament\Resources\AdditionalEducationResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListAdditionalEducation extends ListRecords
|
||||
{
|
||||
protected static string $resource = AdditionalEducationResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources;
|
||||
|
||||
use App\Enums\FormEducation;
|
||||
use App\Enums\LevelEducational;
|
||||
use App\Filament\Resources\AdmissionCampaignResource\Pages;
|
||||
use App\Filament\Resources\AdmissionCampaignResource\RelationManagers;
|
||||
use App\Models\AdmissionCampaign;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
|
||||
class AdmissionCampaignResource extends Resource
|
||||
{
|
||||
protected static ?string $model = AdmissionCampaign::class;
|
||||
|
||||
protected static ?string $navigationGroup = 'Образование';
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-clipboard-document-check';
|
||||
|
||||
protected static ?string $pluralLabel = 'Приемная-компания';
|
||||
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
TextInput::make('name')->label('Название')->required()->columnSpanFull(),
|
||||
Forms\Components\Select::make('academic_year')->label('Академический год')->required()
|
||||
->options(['2024' => '2024/2025', '2025' => '2025/2026']),
|
||||
Forms\Components\Select::make('status')->label('Статус')->required()
|
||||
->options(['1' => 'Активный', '2' => 'Архивный', '3' => 'Скрыт']),
|
||||
Forms\Components\Section::make()->schema([
|
||||
Forms\Components\Repeater::make('info')->schema([
|
||||
Forms\Components\Select::make('edu_name')->options(LevelEducational::class),
|
||||
])->columnSpanFull(),
|
||||
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('name'),
|
||||
Tables\Columns\TextColumn::make('academic_year'),
|
||||
Tables\Columns\TextColumn::make('status'),
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\EditAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ListAdmissionCampaigns::route('/'),
|
||||
'create' => Pages\CreateAdmissionCampaign::route('/create'),
|
||||
'edit' => Pages\EditAdmissionCampaign::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\AdmissionCampaignResource\Pages;
|
||||
|
||||
use App\Filament\Resources\AdmissionCampaignResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateAdmissionCampaign extends CreateRecord
|
||||
{
|
||||
protected static string $resource = AdmissionCampaignResource::class;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\AdmissionCampaignResource\Pages;
|
||||
|
||||
use App\Filament\Resources\AdmissionCampaignResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditAdmissionCampaign extends EditRecord
|
||||
{
|
||||
protected static string $resource = AdmissionCampaignResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\AdmissionCampaignResource\Pages;
|
||||
|
||||
use App\Filament\Resources\AdmissionCampaignResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListAdmissionCampaigns extends ListRecords
|
||||
{
|
||||
protected static string $resource = AdmissionCampaignResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources;
|
||||
|
||||
use App\Enums\EducationalProgramStatus;
|
||||
use App\Filament\Resources\AdmissionPlanResource\Pages;
|
||||
use App\Filament\Resources\AdmissionPlanResource\RelationManagers;
|
||||
use App\Filament\Resources\EducationalProgramResource\RelationManagers\AdmissionPlansRelationManager;
|
||||
use App\Models\AdmissionCampaign;
|
||||
use App\Models\AdmissionPlan;
|
||||
use App\Models\EducationalProgram;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Components\Builder;
|
||||
use Filament\Forms\Components\FileUpload;
|
||||
use Filament\Forms\Components\Hidden;
|
||||
use Filament\Forms\Components\Section;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Forms\Get;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
use Mohamedsabil83\FilamentFormsTinyeditor\Components\TinyEditor;
|
||||
|
||||
class AdmissionPlanResource extends Resource
|
||||
{
|
||||
protected static ?string $model = AdmissionPlan::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
|
||||
protected static ?string $navigationGroup = 'Образование';
|
||||
|
||||
protected static ?string $pluralLabel = 'План приема';
|
||||
|
||||
protected static ?string $navigationParentItem = 'Приемная-компания';
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Forms\Components\Select::make('educational_programs_id')
|
||||
->searchable()
|
||||
->label('Образовательная программа')
|
||||
->options(EducationalProgram::whereIn('status', [EducationalProgramStatus::PUBLISHED, EducationalProgramStatus::IN_PROGRESS])->pluck('name', 'id')),
|
||||
Forms\Components\Select::make('admission_campaigns_id')
|
||||
->label('Приемная компания')
|
||||
->options(AdmissionCampaign::all()->pluck('name', 'id')),
|
||||
Section::make('План приема')->schema([
|
||||
Forms\Components\Repeater::make('exams')->label('Вступительные испытания')->schema([
|
||||
TextInput::make('title')->label('Название-предмета'),
|
||||
Forms\Components\Select::make('type_exam')->label('Тип-ВИ')
|
||||
->options(['ege' => 'ЕГЭ', 'internal_test' => 'ВИ, проводимое организацией самостоятельно']),
|
||||
TextInput::make('min_score')->label('Минимальный-балл')->integer()
|
||||
])->live()->maxItems(2)->collapsed()->addActionLabel('Добавить вступительное испытание')->columns(3) ->itemLabel(function (Get $get) {
|
||||
static $count = 0;
|
||||
$maxCount = count($get('exams'));
|
||||
$count = ($count++ <= $maxCount) ? $count : 1;
|
||||
return "Вступительное испытание #" . $count;
|
||||
}),
|
||||
Forms\Components\Repeater::make('contests')->label('Условия поступления')->schema([
|
||||
Forms\Components\Select::make('form_education')->label('Форма образования')
|
||||
->options(['och' => 'Очная форма обучения', 'zaoch' => 'Заочная форма обучения', 'och_zaoch' => 'Очно-заочная форма обучения']),
|
||||
Forms\Components\Select::make('financing_source')->label('Источник финансирования')
|
||||
->options(['budget' => 'Бюджетное место', 'non_budget' => 'С оплатой обучения']),
|
||||
TextInput::make('budget_quantity_position')->label('Количество бюджетных мест')->integer(),
|
||||
TextInput::make('non_budget_quantity_position')->label('Количество платных мест')->integer()
|
||||
])->live()->maxItems(2)->collapsed()->addActionLabel('Добавить группу')->columns(3)
|
||||
->itemLabel(function (Get $get) {
|
||||
static $count = 0;
|
||||
$maxCount = count($get('contests'));
|
||||
$count = ($count++ <= $maxCount) ? $count : 1;
|
||||
return "Группа #" . $count;
|
||||
}),
|
||||
|
||||
]),
|
||||
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
//
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\EditAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ListAdmissionPlans::route('/'),
|
||||
'create' => Pages\CreateAdmissionPlan::route('/create'),
|
||||
'edit' => Pages\EditAdmissionPlan::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\AdmissionPlanResource\Pages;
|
||||
|
||||
use App\Filament\Resources\AdmissionPlanResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateAdmissionPlan extends CreateRecord
|
||||
{
|
||||
protected static string $resource = AdmissionPlanResource::class;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\AdmissionPlanResource\Pages;
|
||||
|
||||
use App\Filament\Resources\AdmissionPlanResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditAdmissionPlan extends EditRecord
|
||||
{
|
||||
protected static string $resource = AdmissionPlanResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\AdmissionPlanResource\Pages;
|
||||
|
||||
use App\Filament\Resources\AdmissionPlanResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListAdmissionPlans extends ListRecords
|
||||
{
|
||||
protected static string $resource = AdmissionPlanResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources;
|
||||
|
||||
use App\Filament\Resources\CategoryResource\Pages;
|
||||
use App\Filament\Resources\CategoryResource\RelationManagers;
|
||||
use App\Models\Category;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
|
||||
class CategoryResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Category::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
|
||||
protected static ?string $navigationGroup = 'Новости и мероприятия';
|
||||
|
||||
|
||||
protected static ?string $pluralLabel = 'Категории';
|
||||
protected static ?string $navigationParentItem = 'Новости';
|
||||
|
||||
protected static ?int $navigationSort = 2;
|
||||
|
||||
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('title')->required()->label('Название'),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
//
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\EditAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ListCategories::route('/'),
|
||||
'create' => Pages\CreateCategory::route('/create'),
|
||||
'edit' => Pages\EditCategory::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\CategoryResource\Pages;
|
||||
|
||||
use App\Filament\Resources\CategoryResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateCategory extends CreateRecord
|
||||
{
|
||||
protected static string $resource = CategoryResource::class;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\CategoryResource\Pages;
|
||||
|
||||
use App\Filament\Resources\CategoryResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditCategory extends EditRecord
|
||||
{
|
||||
protected static string $resource = CategoryResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\CategoryResource\Pages;
|
||||
|
||||
use App\Filament\Resources\CategoryResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListCategories extends ListRecords
|
||||
{
|
||||
protected static string $resource = CategoryResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources;
|
||||
|
||||
use App\Enums\CustomFormStatus;
|
||||
use App\Enums\PostStatus;
|
||||
use App\Filament\Components\Forms\CustomFormForm;
|
||||
use App\Filament\Exports\CustomFormExporter;
|
||||
use App\Filament\Resources\CustomFormResource\Pages;
|
||||
use App\Filament\Resources\CustomFormResource\RelationManagers;
|
||||
use App\Filament\Resources\CustomFormResource\RelationManagers\ResponsesRelationManager;
|
||||
use App\Models\Category;
|
||||
use App\Models\CustomForm;
|
||||
use App\Models\Page;
|
||||
use App\Models\Post;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Components\Builder;
|
||||
use Filament\Forms\Components\FileUpload;
|
||||
use Filament\Forms\Components\RichEditor;
|
||||
use Filament\Forms\Components\Section;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\SpatieTagsInput;
|
||||
use Filament\Forms\Components\Tabs;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\Toggle;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Forms\Get;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Str;
|
||||
use Mohamedsabil83\FilamentFormsTinyeditor\Components\TinyEditor;
|
||||
use PhpParser\Node\Stmt\Block;
|
||||
|
||||
class CustomFormResource extends Resource
|
||||
{
|
||||
|
||||
public static ?string $label = 'Форма';
|
||||
protected static ?string $pluralLabel = 'Пользовательские формы';
|
||||
|
||||
|
||||
protected static ?string $model = CustomForm::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-squares-plus';
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return CustomFormForm::getForm($form);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('title'),
|
||||
Tables\Columns\TextColumn::make('form_id'),
|
||||
Tables\Columns\TextColumn::make('status'),
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\EditAction::make(),
|
||||
])
|
||||
->headerActions([
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
ResponsesRelationManager::class
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ListCustomForms::route('/'),
|
||||
'create' => Pages\CreateCustomForm::route('/create'),
|
||||
'edit' => Pages\EditCustomForm::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\CustomFormResource\Pages;
|
||||
|
||||
use App\Filament\Resources\CustomFormResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateCustomForm extends CreateRecord
|
||||
{
|
||||
protected static string $resource = CustomFormResource::class;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\CustomFormResource\Pages;
|
||||
|
||||
use App\Filament\Exports\CustomFormExporter;
|
||||
use App\Filament\Resources\CustomFormResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditCustomForm extends EditRecord
|
||||
{
|
||||
protected static string $resource = CustomFormResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
|
||||
public function hasCombinedRelationManagerTabsWithContent(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\CustomFormResource\Pages;
|
||||
|
||||
use App\Filament\Exports\CustomFormExporter;
|
||||
use App\Filament\Resources\CustomFormResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListCustomForms extends ListRecords
|
||||
{
|
||||
protected static string $resource = CustomFormResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
+226
@@ -0,0 +1,226 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\CustomFormResource\RelationManagers;
|
||||
|
||||
use App\Filament\Exports\CustomFormExporter;
|
||||
use App\Models\CustomFormResponse;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Infolists\Components\Section;
|
||||
use Filament\Infolists\Components\TextEntry;
|
||||
use Filament\Resources\RelationManagers\RelationManager;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Columns\ViewColumn;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
use pxlrbt\FilamentExcel\Actions\Tables\ExportAction;
|
||||
use pxlrbt\FilamentExcel\Actions\Tables\ExportBulkAction;
|
||||
use pxlrbt\FilamentExcel\Columns\Column;
|
||||
use pxlrbt\FilamentExcel\Exports\ExcelExport;
|
||||
|
||||
|
||||
class ResponsesRelationManager extends RelationManager
|
||||
{
|
||||
protected static string $relationship = 'responses';
|
||||
|
||||
protected static ?string $title = 'Ответы на форму';
|
||||
|
||||
|
||||
public function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema(self::formColumns());
|
||||
}
|
||||
|
||||
public function formColumns(): array
|
||||
{
|
||||
$columns = collect($this->ownerRecord->columns);
|
||||
|
||||
return $columns
|
||||
->pluck('data.name_field', 'data.title_field')
|
||||
->map(function ($name, $label) use ($columns) {
|
||||
// Находим информацию о текущем поле по его имени
|
||||
$columnInfo = $columns->firstWhere('data.name_field', $name);
|
||||
|
||||
// Проверяем тип поля
|
||||
if ($columnInfo['type'] === 'multiple_choice') {
|
||||
$columnInfo = collect($columnInfo['data']['columns']);
|
||||
$options = $columnInfo->map(function ($column) {
|
||||
return [
|
||||
$column['name_field'] => $column['title_field']
|
||||
];
|
||||
})->reduce(function ($carry, $item) {
|
||||
return array_merge($carry, $item);
|
||||
}, []);
|
||||
return Forms\Components\CheckboxList::make('answers.' . $name)
|
||||
->options($options)
|
||||
->label($label)
|
||||
->columnSpanFull();
|
||||
}
|
||||
|
||||
if ($columnInfo['type'] === 'single_choice') {
|
||||
$columnInfo = collect($columnInfo['data']['columns']);
|
||||
$options = $columnInfo->map(function ($column) {
|
||||
return [
|
||||
$column['name_field'] => $column['title_field']
|
||||
];
|
||||
})->reduce(function ($carry, $item) {
|
||||
return array_merge($carry, $item);
|
||||
}, []);
|
||||
return Forms\Components\Radio::make('answers.' . $name)
|
||||
->options($options)
|
||||
->label($label)
|
||||
->columnSpanFull();
|
||||
}
|
||||
|
||||
|
||||
// Обработка других типов полей
|
||||
return Forms\Components\TextInput::make('answers.' . $name)
|
||||
->label($label)
|
||||
->columnSpanFull();
|
||||
})
|
||||
->values()
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function infoListColumns(): array
|
||||
{
|
||||
$columns = collect($this->ownerRecord->columns);
|
||||
|
||||
return $columns
|
||||
->pluck('data.name_field', 'data.title_field')
|
||||
->map(function ($name, $label) use ($columns) {
|
||||
// Находим информацию о текущем поле по его имени
|
||||
$columnInfo = $columns->firstWhere('data.name_field', $name);
|
||||
|
||||
|
||||
// Проверяем тип поля
|
||||
if ($columnInfo['type'] === 'multiple_choice') {
|
||||
$columnInfo = collect($columnInfo['data']['columns']);
|
||||
$options = $columnInfo->map(function ($column) {
|
||||
return [
|
||||
$column['name_field'] => $column['title_field']
|
||||
];
|
||||
})->reduce(function ($carry, $item) {
|
||||
return array_merge($carry, $item);
|
||||
}, []);
|
||||
return TextEntry::make('answers.' . $name)
|
||||
->label($label)
|
||||
->columnSpanFull();
|
||||
}
|
||||
|
||||
if ($columnInfo['type'] === 'single_choice') {
|
||||
$columnInfo = collect($columnInfo['data']['columns']);
|
||||
$options = $columnInfo->map(function ($column) {
|
||||
return $column['title_field'];
|
||||
});
|
||||
return TextEntry::make('answers.' . $name)
|
||||
->label($label)
|
||||
->columnSpanFull();
|
||||
}
|
||||
|
||||
|
||||
// Обработка других типов полей
|
||||
return TextEntry::make('answers.' . $name)
|
||||
->label($label)
|
||||
->columnSpanFull();
|
||||
})
|
||||
->values()
|
||||
->toArray();
|
||||
}
|
||||
|
||||
public function exportColumns(): array
|
||||
{
|
||||
$columns = collect($this->ownerRecord->columns);
|
||||
|
||||
$columnObjects = $columns
|
||||
->pluck('data.name_field', 'data.title_field')
|
||||
->map(function ($name, $label) use ($columns) {
|
||||
// Находим информацию о текущем поле по его имени
|
||||
$columnInfo = $columns->firstWhere('data.name_field', $name);
|
||||
// Проверяем тип поля
|
||||
if ($columnInfo['type'] === 'multiple_choice') {
|
||||
$columnInfo = collect($columnInfo['data']['columns']);
|
||||
$options = $columnInfo->map(function ($column) {
|
||||
return [
|
||||
$column['name_field'] => $column['title_field']
|
||||
];
|
||||
})->reduce(function ($carry, $item) {
|
||||
return array_merge($carry, $item);
|
||||
}, []);
|
||||
return Column::make('answers.' . $name)->heading($label)
|
||||
->formatStateUsing(function ($state) use ($options) {
|
||||
return $options[$state];
|
||||
});
|
||||
}
|
||||
|
||||
if ($columnInfo['type'] === 'single_choice') {
|
||||
$columnInfo = collect($columnInfo['data']['columns']);
|
||||
$options = $columnInfo->map(function ($column) {
|
||||
return [
|
||||
$column['name_field'] => $column['title_field']
|
||||
];
|
||||
})->reduce(function ($carry, $item) {
|
||||
return array_merge($carry, $item);
|
||||
}, []);
|
||||
return Column::make('answers.' . $name)->heading($label)
|
||||
->formatStateUsing(function ($state) use ($options) {
|
||||
return $options[$state];
|
||||
});
|
||||
}
|
||||
// Обработка других типов полей
|
||||
return Column::make('answers.' . $name)->heading($label);
|
||||
});
|
||||
|
||||
$columnObjects->prepend(Column::make('id')->heading('ID'));
|
||||
$columnObjects->push(Column::make('created_at')->heading('Время создания'));
|
||||
|
||||
|
||||
return $columnObjects->toArray();
|
||||
}
|
||||
|
||||
|
||||
// Метод для получения опций для множественного выбора
|
||||
|
||||
public function tableColumns(): array
|
||||
{
|
||||
return [
|
||||
Tables\Columns\TextColumn::make('id')->sortable(),
|
||||
Tables\Columns\ToggleColumn::make('checked')->label('Просмотрено'),
|
||||
];
|
||||
}
|
||||
|
||||
public function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->defaultSort('created_at', 'desc')
|
||||
->columns(self::tableColumns())
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->headerActions([
|
||||
ExportAction::make()->exports([
|
||||
ExcelExport::make()->withColumns(self::exportColumns()),
|
||||
]),
|
||||
Tables\Actions\CreateAction::make(),
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\ViewAction::make(),
|
||||
Tables\Actions\EditAction::make(),
|
||||
Tables\Actions\DeleteAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
ExportBulkAction::make()->exports([
|
||||
ExcelExport::make()->withColumns(self::exportColumns())
|
||||
->askForFilename()
|
||||
->askForWriterType(),
|
||||
]),
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources;
|
||||
|
||||
use App\Filament\Resources\CustomFormResponseResource\Pages;
|
||||
use App\Filament\Resources\CustomFormResponseResource\RelationManagers;
|
||||
use App\Models\CustomFormResponse;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
|
||||
class CustomFormResponseResource extends Resource
|
||||
{
|
||||
public static ?string $label = 'Форма';
|
||||
protected static ?string $pluralLabel = 'Ответы на формы';
|
||||
protected static ?string $navigationParentItem = 'Пользовательские Формы';
|
||||
|
||||
protected static ?string $model = CustomFormResponse::class;
|
||||
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\ViewAction::make(),
|
||||
Tables\Actions\EditAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ListCustomFormResponses::route('/'),
|
||||
'create' => Pages\CreateCustomFormResponse::route('/create'),
|
||||
'edit' => Pages\EditCustomFormResponse::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\CustomFormResponseResource\Pages;
|
||||
|
||||
use App\Filament\Resources\CustomFormResponseResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateCustomFormResponse extends CreateRecord
|
||||
{
|
||||
protected static string $resource = CustomFormResponseResource::class;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\CustomFormResponseResource\Pages;
|
||||
|
||||
use App\Filament\Resources\CustomFormResponseResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ViewRecord;
|
||||
|
||||
class CustomFormResponseView extends ViewRecord
|
||||
{
|
||||
protected static string $resource = CustomFormResponseResource::class;
|
||||
|
||||
protected static string $view = 'filament.resources.posts.pages.view-post';
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\CustomFormResponseResource\Pages;
|
||||
|
||||
use App\Filament\Resources\CustomFormResponseResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditCustomFormResponse extends EditRecord
|
||||
{
|
||||
protected static string $resource = CustomFormResponseResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\CustomFormResponseResource\Pages;
|
||||
|
||||
use App\Filament\Resources\CustomFormResponseResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListCustomFormResponses extends ListRecords
|
||||
{
|
||||
protected static string $resource = CustomFormResponseResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources;
|
||||
|
||||
use App\Filament\Resources\DepartmentResource\Pages;
|
||||
use App\Filament\Resources\DepartmentResource\RelationManagers;
|
||||
use App\Models\Department;
|
||||
use App\Models\Faculty;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\Toggle;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class DepartmentResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Department::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
|
||||
protected static ?string $pluralLabel = 'Кафедры';
|
||||
|
||||
public static ?string $label = 'Кафедра';
|
||||
|
||||
|
||||
protected static ?string $navigationParentItem = 'Факультеты';
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
TextInput::make('title')->label('Название кафедры')->required()
|
||||
->live(onBlur: true)
|
||||
->afterStateUpdated(function (string $operation, $state, Forms\Set $set) {
|
||||
$set('slug', Str::slug($state));
|
||||
}),
|
||||
TextInput::make('slug')->label('Slug')->unique(ignoreRecord: true)->readOnly()->required(),
|
||||
Forms\Components\Select::make('faculty_id')
|
||||
->options(Faculty::all()->pluck('title', 'id'))
|
||||
->label('Факультет')
|
||||
->required(),
|
||||
Toggle::make('is_active')->default(true)->label('Активная кафедра')->inline(false),
|
||||
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('title')->label('Название'),
|
||||
Tables\Columns\TextColumn::make('faculty.title')->label('Факультет')->words(2)
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\EditAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
RelationManagers\WorkersRelationManager::class,
|
||||
RelationManagers\TeachersRelationManager::class,
|
||||
RelationManagers\ProgramsRelationManager::class,
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ListDepartments::route('/'),
|
||||
'create' => Pages\CreateDepartment::route('/create'),
|
||||
'edit' => Pages\EditDepartment::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\DepartmentResource\Pages;
|
||||
|
||||
use App\Filament\Resources\DepartmentResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateDepartment extends CreateRecord
|
||||
{
|
||||
protected static string $resource = DepartmentResource::class;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\DepartmentResource\Pages;
|
||||
|
||||
use App\Filament\Resources\DepartmentResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditDepartment extends EditRecord
|
||||
{
|
||||
protected static string $resource = DepartmentResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
|
||||
public function hasCombinedRelationManagerTabsWithContent(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\DepartmentResource\Pages;
|
||||
|
||||
use App\Filament\Resources\DepartmentResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListDepartments extends ListRecords
|
||||
{
|
||||
protected static string $resource = DepartmentResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\DepartmentResource\RelationManagers;
|
||||
|
||||
use App\Enums\EducationalProgramStatus;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\RelationManagers\RelationManager;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Actions\AttachAction;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
|
||||
class ProgramsRelationManager extends RelationManager
|
||||
{
|
||||
protected static string $relationship = 'programs';
|
||||
|
||||
public function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('name')
|
||||
->required()
|
||||
->maxLength(255),
|
||||
]);
|
||||
}
|
||||
|
||||
public function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->recordTitleAttribute('name')
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('name'),
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->headerActions([
|
||||
AttachAction::make()
|
||||
->recordSelectOptionsQuery(fn (Builder $query) => $query->where('status', EducationalProgramStatus::PUBLISHED)),
|
||||
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\EditAction::make(),
|
||||
Tables\Actions\DeleteAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\DepartmentResource\RelationManagers;
|
||||
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\RelationManagers\RelationManager;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Actions\AttachAction;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
|
||||
class TeachersRelationManager extends RelationManager
|
||||
{
|
||||
protected static string $relationship = 'teachers';
|
||||
|
||||
protected static ?string $inverseRelationship = 'departments_teach';
|
||||
|
||||
|
||||
protected static ?string $title = 'Преподаватели кафедры';
|
||||
|
||||
|
||||
public function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('name')
|
||||
->required()
|
||||
->maxLength(255),
|
||||
]);
|
||||
}
|
||||
|
||||
public function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->recordTitleAttribute('name')
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('name'),
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->headerActions([
|
||||
AttachAction::make()
|
||||
->form(fn (AttachAction $action): array => [
|
||||
$action->getRecordSelect(),
|
||||
Forms\Components\TextInput::make('teaching_position')->label('Преподавательская должность')->required(),
|
||||
])
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\EditAction::make(),
|
||||
Tables\Actions\DeleteAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\DepartmentResource\RelationManagers;
|
||||
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\RelationManagers\RelationManager;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Actions\AttachAction;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
|
||||
class WorkersRelationManager extends RelationManager
|
||||
{
|
||||
protected static string $relationship = 'workers';
|
||||
|
||||
protected static ?string $inverseRelationship = 'departments_work';
|
||||
|
||||
protected static ?string $title = 'Сотрудники кафедры';
|
||||
|
||||
|
||||
public function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('position')->label('Должность')->required(),
|
||||
]);
|
||||
}
|
||||
|
||||
public function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->recordTitleAttribute('name')
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('name'),
|
||||
Tables\Columns\TextColumn::make('position'),
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->headerActions([
|
||||
AttachAction::make()
|
||||
->form(fn (AttachAction $action): array => [
|
||||
$action->getRecordSelect(),
|
||||
Forms\Components\TextInput::make('position')->label('Должность')->required(),
|
||||
])
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\EditAction::make(),
|
||||
Tables\Actions\DeleteAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources;
|
||||
|
||||
use App\Filament\Resources\DirectionAdditionalEducationResource\Pages;
|
||||
use App\Filament\Resources\DirectionAdditionalEducationResource\RelationManagers;
|
||||
use App\Models\DirectionAdditionalEducation;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
|
||||
class DirectionAdditionalEducationResource extends Resource
|
||||
{
|
||||
protected static ?string $model = DirectionAdditionalEducation::class;
|
||||
|
||||
protected static ?string $navigationGroup = 'Образование';
|
||||
|
||||
public static ?string $label = 'Направление';
|
||||
protected static ?string $pluralLabel = 'Направления дополнительного образования';
|
||||
protected static ?string $navigationParentItem = 'Дополнительное Образование';
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('title')->required()->columnSpanFull(),
|
||||
Forms\Components\Toggle::make('is_active')->columnSpanFull()->inline(false)->default(true),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
//
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\EditAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ListDirectionAdditionalEducation::route('/'),
|
||||
'create' => Pages\CreateDirectionAdditionalEducation::route('/create'),
|
||||
'edit' => Pages\EditDirectionAdditionalEducation::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\DirectionAdditionalEducationResource\Pages;
|
||||
|
||||
use App\Filament\Resources\DirectionAdditionalEducationResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateDirectionAdditionalEducation extends CreateRecord
|
||||
{
|
||||
protected static string $resource = DirectionAdditionalEducationResource::class;
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\DirectionAdditionalEducationResource\Pages;
|
||||
|
||||
use App\Filament\Resources\DirectionAdditionalEducationResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditDirectionAdditionalEducation extends EditRecord
|
||||
{
|
||||
protected static string $resource = DirectionAdditionalEducationResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\DirectionAdditionalEducationResource\Pages;
|
||||
|
||||
use App\Filament\Resources\DirectionAdditionalEducationResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListDirectionAdditionalEducation extends ListRecords
|
||||
{
|
||||
protected static string $resource = DirectionAdditionalEducationResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources;
|
||||
|
||||
use App\Enums\LevelEducational;
|
||||
use App\Filament\Resources\DirectionStudyResource\Pages;
|
||||
use App\Filament\Resources\DirectionStudyResource\RelationManagers;
|
||||
use App\Models\DirectionStudy;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class DirectionStudyResource extends Resource
|
||||
{
|
||||
protected static ?string $model = DirectionStudy::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
|
||||
protected static ?string $pluralLabel = 'Направление подготовки';
|
||||
|
||||
protected static ?string $navigationGroup = 'Образование';
|
||||
|
||||
|
||||
protected static ?string $navigationParentItem = 'Приемная-компания';
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
//
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('name'),
|
||||
Tables\Columns\TextColumn::make('code'),
|
||||
Tables\Columns\TextColumn::make('lvl_edu')
|
||||
->formatStateUsing(fn ($state) => $state->getLabel())
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\EditAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ListDirectionStudies::route('/'),
|
||||
'create' => Pages\CreateDirectionStudy::route('/create'),
|
||||
'edit' => Pages\EditDirectionStudy::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\DirectionStudyResource\Pages;
|
||||
|
||||
use App\Filament\Resources\DirectionStudyResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateDirectionStudy extends CreateRecord
|
||||
{
|
||||
protected static string $resource = DirectionStudyResource::class;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\DirectionStudyResource\Pages;
|
||||
|
||||
use App\Filament\Resources\DirectionStudyResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditDirectionStudy extends EditRecord
|
||||
{
|
||||
protected static string $resource = DirectionStudyResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\DirectionStudyResource\Pages;
|
||||
|
||||
use App\Filament\Resources\DirectionStudyResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListDirectionStudies extends ListRecords
|
||||
{
|
||||
protected static string $resource = DirectionStudyResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,453 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources;
|
||||
|
||||
use App\Enums\PostStatus;
|
||||
use App\Filament\Resources\DivisionResource\Pages;
|
||||
use App\Filament\Resources\DivisionResource\RelationManagers;
|
||||
use App\Models\Category;
|
||||
use App\Models\Division;
|
||||
use App\Models\Page;
|
||||
use App\Models\Post;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Components\Builder;
|
||||
use Filament\Forms\Components\FileUpload;
|
||||
use Filament\Forms\Components\Hidden;
|
||||
use Filament\Forms\Components\RichEditor;
|
||||
use Filament\Forms\Components\Section;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\Tabs;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\Toggle;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
use Illuminate\Support\Str;
|
||||
use Mohamedsabil83\FilamentFormsTinyeditor\Components\TinyEditor;
|
||||
|
||||
class DivisionResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Division::class;
|
||||
|
||||
protected static ?string $navigationGroup = 'Структура института';
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-squares-2x2';
|
||||
|
||||
public static ?string $label = 'Подразделение';
|
||||
|
||||
protected static ?string $pluralLabel = 'Подразделения института';
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Section::make()
|
||||
->schema([
|
||||
Tabs::make('Tabs')
|
||||
->tabs([
|
||||
Tabs\Tab::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));
|
||||
}),
|
||||
TextInput::make('slug')->label('Slug')->unique(ignoreRecord: true)->readOnly()->required(),
|
||||
]),
|
||||
Toggle::make('is_active')->default(true)->label('Активное подразделение')->inline(false),
|
||||
]),
|
||||
Tabs\Tab::make('Содержание')
|
||||
->schema([
|
||||
\Filament\Forms\Components\Builder::make('description')->label('')->blocks([
|
||||
Builder\Block::make('heading')->label('Заголовок')
|
||||
->schema([
|
||||
TextInput::make('id')->hidden()->integer()->default(rand(2335235,324634264263426)),
|
||||
TextInput::make('content')
|
||||
->label('')
|
||||
->live(onBlur: true)
|
||||
->afterStateUpdated(function (string $operation, string $state, Forms\Set $set, $get) {
|
||||
}),
|
||||
]),
|
||||
Builder\Block::make('paragraph')->label('Текст')
|
||||
->schema([
|
||||
RichEditor::make('content')
|
||||
->toolbarButtons([
|
||||
'blockquote',
|
||||
'bold',
|
||||
'bulletList',
|
||||
'italic',
|
||||
'link',
|
||||
'orderedList',
|
||||
'redo',
|
||||
'strike',
|
||||
'underline',
|
||||
'undo',
|
||||
])
|
||||
->label(''),
|
||||
]),
|
||||
Builder\Block::make('files')->label('Файлы')
|
||||
->schema([
|
||||
Forms\Components\Repeater::make('file')->schema([
|
||||
TextInput::make('title')
|
||||
->required()
|
||||
->maxLength(255)
|
||||
->autofocus(),
|
||||
FileUpload::make('path')
|
||||
->required()
|
||||
->acceptedFileTypes([
|
||||
'application/pdf',
|
||||
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
||||
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
||||
'application/vnd.openxmlformats-officedocument.presentationml.presentation',
|
||||
'application/zip'
|
||||
])
|
||||
->maxSize(512000)
|
||||
->disk('public')
|
||||
->directory('files')
|
||||
->downloadable()
|
||||
->visibility('public')
|
||||
]),
|
||||
]),
|
||||
Builder\Block::make('person')->label('Персона')
|
||||
->schema([
|
||||
TextInput::make('name')
|
||||
->label('Имя')
|
||||
->required()
|
||||
->maxLength(255),
|
||||
FileUpload::make('photo')
|
||||
->label('Фотография')
|
||||
->image()
|
||||
->disk('public')
|
||||
->directory('images')
|
||||
->imageEditor(),
|
||||
Forms\Components\Repeater::make('info')->schema([
|
||||
Forms\Components\Grid::make(2)->schema([
|
||||
TextInput::make('column')
|
||||
->required()
|
||||
->maxLength(255),
|
||||
TextInput::make('content')
|
||||
->required()
|
||||
->maxLength(255),
|
||||
]),
|
||||
])->minItems(1),
|
||||
]),
|
||||
Builder\Block::make('stepper')->label('Этапы')
|
||||
->schema([
|
||||
TextInput::make('step_name')
|
||||
->label('Название шага')
|
||||
->required()
|
||||
->maxLength(255),
|
||||
Forms\Components\Repeater::make('steps')->schema([
|
||||
TextInput::make('title')
|
||||
->required()
|
||||
->live()
|
||||
->maxLength(255)->columnSpanFull(),
|
||||
RichEditor::make('content')->required(),
|
||||
])
|
||||
->itemLabel(fn (array $state): ?string => $state['title'] ?? null)
|
||||
->minItems(1)
|
||||
->collapsible()
|
||||
->collapsed()
|
||||
|
||||
|
||||
]),
|
||||
Builder\Block::make('tabs')->label('Вкладки')
|
||||
->schema([
|
||||
Forms\Components\Repeater::make('tab')->schema([
|
||||
TextInput::make('title')
|
||||
->required()
|
||||
->maxLength(255)->columnSpanFull(),
|
||||
\Filament\Forms\Components\Builder::make('content')->label('')->blocks([
|
||||
Builder\Block::make('heading')->label('Заголовок')
|
||||
->schema([
|
||||
TextInput::make('id')->hidden()->integer()->default(rand(2335235,324634264263426)),
|
||||
TextInput::make('content')
|
||||
->label('')
|
||||
->live(onBlur: true)
|
||||
->afterStateUpdated(function (string $operation, string $state, Forms\Set $set, $get) {
|
||||
}),
|
||||
]),
|
||||
Builder\Block::make('paragraph')
|
||||
->schema([
|
||||
RichEditor::make('content')
|
||||
->toolbarButtons([
|
||||
'blockquote',
|
||||
'bold',
|
||||
'bulletList',
|
||||
'italic',
|
||||
'link',
|
||||
'orderedList',
|
||||
'redo',
|
||||
'strike',
|
||||
'underline',
|
||||
'undo',
|
||||
])
|
||||
->label(''),
|
||||
])->label('Текст'),
|
||||
Builder\Block::make('files')
|
||||
->schema([
|
||||
Forms\Components\Repeater::make('file')->schema([
|
||||
TextInput::make('title')
|
||||
->required()
|
||||
->maxLength(255)
|
||||
->autofocus(),
|
||||
FileUpload::make('path')
|
||||
->required()
|
||||
->acceptedFileTypes([
|
||||
'application/pdf',
|
||||
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
||||
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
||||
'application/vnd.openxmlformats-officedocument.presentationml.presentation',
|
||||
'application/zip'
|
||||
])
|
||||
->maxSize(512000)
|
||||
->disk('public')
|
||||
->directory('files')
|
||||
->downloadable()
|
||||
->visibility('public')
|
||||
]),
|
||||
]),
|
||||
Builder\Block::make('person')
|
||||
->schema([
|
||||
TextInput::make('name')
|
||||
->label('Имя')
|
||||
->required()
|
||||
->maxLength(255),
|
||||
FileUpload::make('photo')
|
||||
->label('Фотография')
|
||||
->image()
|
||||
->disk('public')
|
||||
->directory('images')
|
||||
->imageEditor(),
|
||||
Forms\Components\Repeater::make('info')->schema([
|
||||
Forms\Components\Grid::make(2)->schema([
|
||||
TextInput::make('column')
|
||||
->required()
|
||||
->maxLength(255),
|
||||
TextInput::make('content')
|
||||
->required()
|
||||
->maxLength(255),
|
||||
]),
|
||||
])->minItems(1),
|
||||
]),
|
||||
Builder\Block::make('stepper')
|
||||
->schema([
|
||||
TextInput::make('step_name')
|
||||
->label('Название шага')
|
||||
->required()
|
||||
->maxLength(255),
|
||||
Forms\Components\Repeater::make('steps')->schema([
|
||||
TextInput::make('title')
|
||||
->required()
|
||||
->maxLength(255)->columnSpanFull(),
|
||||
RichEditor::make('content')->required(),
|
||||
])->minItems(1),
|
||||
]),
|
||||
Builder\Block::make('images')
|
||||
->schema([
|
||||
FileUpload::make('url')
|
||||
->label('Изображение(-я)')
|
||||
->image()
|
||||
->multiple()
|
||||
->reorderable()
|
||||
->maxFiles(5)
|
||||
->disk('public')
|
||||
->directory('images')
|
||||
->imageEditor()
|
||||
->required(),
|
||||
TextInput::make('alt')
|
||||
->label('Описание')
|
||||
->placeholder('Необязяательно')
|
||||
])->label('Слайдер изображений'),
|
||||
Builder\Block::make('image')
|
||||
->schema([
|
||||
FileUpload::make('url')
|
||||
->label('Изображение(-я)')
|
||||
->image()
|
||||
->multiple()
|
||||
->reorderable()
|
||||
->maxFiles(5)
|
||||
->disk('public')
|
||||
->directory('images')
|
||||
->imageEditor()
|
||||
->required(),
|
||||
TextInput::make('alt')
|
||||
->label('Описание')
|
||||
->placeholder('Необязяательно')
|
||||
])->label('Изображение'),
|
||||
Builder\Block::make('video')
|
||||
->schema([
|
||||
TextInput::make('mime')->readOnly(),
|
||||
TextInput::make('title')
|
||||
->required()
|
||||
->maxLength(255)
|
||||
->autofocus(),
|
||||
FileUpload::make('path')
|
||||
->required()
|
||||
->acceptedFileTypes([
|
||||
'video/mp4',
|
||||
'video/quicktime',
|
||||
'video/x-msvideo',
|
||||
'video/x-ms-wmv',
|
||||
'video/avi',
|
||||
'video/webm',
|
||||
'video/ogg',
|
||||
'video/3gpp',
|
||||
'video/3gpp2',
|
||||
'video/x-m4v',
|
||||
])
|
||||
->disk('public')
|
||||
->directory('videos')
|
||||
->afterStateUpdated(fn (callable $set, $state) => $set('mime', $state?->getMimeType())),
|
||||
]),
|
||||
Builder\Block::make('postsList')
|
||||
->schema([
|
||||
Forms\Components\Grid::make(2)->schema([
|
||||
TextInput::make('count')
|
||||
->label('Количество запией')
|
||||
->integer(),
|
||||
Select::make('category')
|
||||
->options(Category::all()->pluck('title', 'id'))
|
||||
]),
|
||||
])->label('Список новостей'),
|
||||
])
|
||||
->collapsed()
|
||||
->blockNumbers(false)
|
||||
->collapsible()
|
||||
->addActionLabel('Добавить новый блок'),
|
||||
])->minItems(1),
|
||||
]),
|
||||
Builder\Block::make('images')->label('Слайдер изображений')
|
||||
->schema([
|
||||
FileUpload::make('url')
|
||||
->label('Изображение(-я)')
|
||||
->image()
|
||||
->multiple()
|
||||
->reorderable()
|
||||
->maxFiles(5)
|
||||
->disk('public')
|
||||
|
||||
->directory('images')
|
||||
->imageEditor()
|
||||
->required(),
|
||||
TextInput::make('alt')
|
||||
->label('Описание')
|
||||
->placeholder('Необязяательно')
|
||||
]),
|
||||
Builder\Block::make('image')->label('Изображение')
|
||||
->schema([
|
||||
FileUpload::make('url')
|
||||
->label('Изображение(-я)')
|
||||
->image()
|
||||
->multiple()
|
||||
->reorderable()
|
||||
->maxFiles(5)
|
||||
->disk('public')
|
||||
->directory('images')
|
||||
->imageEditor()
|
||||
->required(),
|
||||
TextInput::make('alt')
|
||||
->label('Описание')
|
||||
->placeholder('Необязяательно')
|
||||
]),
|
||||
Builder\Block::make('video')->label('Видео')
|
||||
->schema([
|
||||
TextInput::make('mime')->readOnly(),
|
||||
TextInput::make('title')
|
||||
->required()
|
||||
->maxLength(255)
|
||||
->autofocus(),
|
||||
FileUpload::make('path')
|
||||
->required()
|
||||
->acceptedFileTypes([
|
||||
'video/mp4',
|
||||
'video/quicktime',
|
||||
'video/x-msvideo',
|
||||
'video/x-ms-wmv',
|
||||
'video/avi',
|
||||
'video/webm',
|
||||
'video/ogg',
|
||||
'video/3gpp',
|
||||
'video/3gpp2',
|
||||
'video/x-m4v',
|
||||
])
|
||||
->disk('public')
|
||||
->directory('videos')
|
||||
->afterStateUpdated(fn (callable $set, $state) => $set('mime', $state?->getMimeType())),
|
||||
]),
|
||||
Builder\Block::make('postsList')->label('Список новостей')
|
||||
->schema([
|
||||
Forms\Components\Grid::make(2)->schema([
|
||||
TextInput::make('count')
|
||||
->label('Количество запией')
|
||||
->integer(),
|
||||
Select::make('category')
|
||||
->options(Category::all()->pluck('title', 'id'))
|
||||
]),
|
||||
]),
|
||||
Builder\Block::make('postItem')->label('Новость')
|
||||
->schema([
|
||||
Select::make('post')
|
||||
->options(Post::query()->where('status', PostStatus::PUBLISHED)->pluck('title', 'id'))
|
||||
->searchable()
|
||||
->required(),
|
||||
]),
|
||||
Builder\Block::make('pageItem')->label('Страница')
|
||||
->schema([
|
||||
Select::make('page')
|
||||
->options(Page::query()->where('title', '!=' , null)->where('is_visible', true)->pluck('title', 'id'))
|
||||
->searchable()
|
||||
->required(),
|
||||
]),
|
||||
])
|
||||
->collapsed()
|
||||
->blockNumbers(false)
|
||||
->collapsible()
|
||||
->blockPickerColumns(3)
|
||||
->blockPickerWidth('2xl')
|
||||
->addActionLabel('Добавить новый блок'),
|
||||
]),
|
||||
]),
|
||||
]),
|
||||
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('title'),
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\EditAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
RelationManagers\WorkersRelationManager::class,
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ListDivisions::route('/'),
|
||||
'create' => Pages\CreateDivision::route('/create'),
|
||||
'edit' => Pages\EditDivision::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\DivisionResource\Pages;
|
||||
|
||||
use App\Filament\Resources\DivisionResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateDivision extends CreateRecord
|
||||
{
|
||||
protected static string $resource = DivisionResource::class;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\DivisionResource\Pages;
|
||||
|
||||
use App\Filament\Resources\DivisionResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditDivision extends EditRecord
|
||||
{
|
||||
protected static string $resource = DivisionResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
|
||||
public function hasCombinedRelationManagerTabsWithContent(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\DivisionResource\Pages;
|
||||
|
||||
use App\Filament\Resources\DivisionResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListDivisions extends ListRecords
|
||||
{
|
||||
protected static string $resource = DivisionResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\DivisionResource\RelationManagers;
|
||||
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\RelationManagers\RelationManager;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Actions\AttachAction;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
|
||||
class WorkersRelationManager extends RelationManager
|
||||
{
|
||||
protected static string $relationship = 'workers';
|
||||
|
||||
protected static ?string $title = 'Сотрудники';
|
||||
|
||||
public function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('administrativePosition')->label('Должность')->required(),
|
||||
]);
|
||||
}
|
||||
|
||||
public function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->recordTitleAttribute('name')
|
||||
->reorderable('sort')
|
||||
->defaultSort('sort')
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('name'),
|
||||
Tables\Columns\TextColumn::make('administrativePosition'),
|
||||
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->headerActions([
|
||||
AttachAction::make()
|
||||
->preloadRecordSelect()
|
||||
->form(fn (AttachAction $action): array => [
|
||||
$action->getRecordSelect(),
|
||||
Forms\Components\TextInput::make('administrativePosition')->label('Должность')->required(),
|
||||
])
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\EditAction::make(),
|
||||
Tables\Actions\DetachAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources;
|
||||
|
||||
use App\Filament\Resources\EducationalGroupResource\Pages;
|
||||
use App\Filament\Resources\EducationalGroupResource\RelationManagers;
|
||||
use App\Models\EducationalGroup;
|
||||
use App\Models\Faculty;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
|
||||
class EducationalGroupResource extends Resource
|
||||
{
|
||||
protected static ?string $navigationGroup = 'Расписание и группы';
|
||||
|
||||
protected static ?string $model = EducationalGroup::class;
|
||||
|
||||
protected static ?string $pluralLabel = 'Группы';
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-user-group';
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Forms\Components\Grid::make(2)->schema([
|
||||
Forms\Components\TextInput::make('title')->label('Название группы')->required(),
|
||||
Forms\Components\Select::make('faculty_id')->label('Факультет')->required()
|
||||
->options(Faculty::all()->pluck('title', 'id'))
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('id')->label('ID'),
|
||||
Tables\Columns\TextColumn::make('title')->label('Название'),
|
||||
Tables\Columns\TextColumn::make('faculty.title')->label('Факультет'),
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\EditAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ListEducationalGroups::route('/'),
|
||||
'create' => Pages\CreateEducationalGroup::route('/create'),
|
||||
'edit' => Pages\EditEducationalGroup::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\EducationalGroupResource\Pages;
|
||||
|
||||
use App\Filament\Resources\EducationalGroupResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateEducationalGroup extends CreateRecord
|
||||
{
|
||||
protected static string $resource = EducationalGroupResource::class;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\EducationalGroupResource\Pages;
|
||||
|
||||
use App\Filament\Resources\EducationalGroupResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditEducationalGroup extends EditRecord
|
||||
{
|
||||
protected static string $resource = EducationalGroupResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\EducationalGroupResource\Pages;
|
||||
|
||||
use App\Filament\Resources\EducationalGroupResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListEducationalGroups extends ListRecords
|
||||
{
|
||||
protected static string $resource = EducationalGroupResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,277 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources;
|
||||
|
||||
use App\Enums\EducationalProgramStatus;
|
||||
use App\Enums\LevelEducational;
|
||||
use App\Filament\Resources\EducationalProgramResource\Pages;
|
||||
use App\Filament\Resources\EducationalProgramResource\RelationManagers;
|
||||
use App\Filament\Resources\EducationalProgramResource\RelationManagers\AdmissionPlansRelationManager;
|
||||
use App\Models\Category;
|
||||
use App\Models\EducationalProgram;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Components\Builder;
|
||||
use Filament\Forms\Components\FileUpload;
|
||||
use Filament\Forms\Components\Hidden;
|
||||
use Filament\Forms\Components\RichEditor;
|
||||
use Filament\Forms\Components\Section;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\SpatieTagsInput;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
use Illuminate\Support\Str;
|
||||
use Mohamedsabil83\FilamentFormsTinyeditor\Components\TinyEditor;
|
||||
|
||||
class EducationalProgramResource extends Resource
|
||||
{
|
||||
protected static ?string $model = EducationalProgram::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
|
||||
protected static ?string $navigationGroup = 'Образование';
|
||||
|
||||
|
||||
protected static ?string $pluralLabel = 'Образовательные программы';
|
||||
|
||||
protected static ?string $navigationParentItem = 'Приемная-компания';
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Section::make()
|
||||
->schema([
|
||||
TextInput::make('name')->label('Название')->required(),
|
||||
Section::make('О программе')->schema([
|
||||
Builder::make('about_program')->label('')->blocks([
|
||||
Builder\Block::make('heading')->label('Заголовок')
|
||||
->schema([
|
||||
TextInput::make('id')->hidden()->integer()->default(rand(2335235,324634264263426)),
|
||||
TextInput::make('content')
|
||||
->label('')
|
||||
->live(onBlur: true)
|
||||
->afterStateUpdated(function (string $operation, string $state, Forms\Set $set, $get) {
|
||||
}),
|
||||
]),
|
||||
Builder\Block::make('paragraph')
|
||||
->schema([
|
||||
RichEditor::make('content')
|
||||
->toolbarButtons([
|
||||
'blockquote',
|
||||
'bold',
|
||||
'bulletList',
|
||||
'italic',
|
||||
'link',
|
||||
'orderedList',
|
||||
'redo',
|
||||
'strike',
|
||||
'underline',
|
||||
'undo',
|
||||
])
|
||||
->label('')
|
||||
->required()
|
||||
]),
|
||||
Builder\Block::make('image')
|
||||
->schema([
|
||||
FileUpload::make('url')
|
||||
->label('Изображение(-я)')
|
||||
->image()
|
||||
->multiple()
|
||||
->reorderable()
|
||||
->maxFiles(5)
|
||||
->disk('public')
|
||||
->directory('images')
|
||||
->imageEditor()
|
||||
->required(),
|
||||
TextInput::make('alt')
|
||||
->label('Описание')
|
||||
->placeholder('Необязяательно')
|
||||
])->label('Изображение(-я)'),
|
||||
Builder\Block::make('video')
|
||||
->schema([
|
||||
Hidden::make('mime'),
|
||||
|
||||
TextInput::make('title')
|
||||
->required()
|
||||
->maxLength(255)
|
||||
->autofocus(),
|
||||
|
||||
FileUpload::make('path')
|
||||
->required()
|
||||
->acceptedFileTypes(['video/mp4','video/ogg','video/webm'])
|
||||
->maxSize(512000)
|
||||
->disk('videos')
|
||||
->visibility('public')
|
||||
->afterStateUpdated(fn (callable $set, $state) => $set('mime', $state?->getMimeType())),
|
||||
]),
|
||||
Builder\Block::make('files')
|
||||
->schema([
|
||||
TextInput::make('title')
|
||||
->required()
|
||||
->maxLength(255)
|
||||
->autofocus(),
|
||||
FileUpload::make('path')
|
||||
->required()
|
||||
->acceptedFileTypes([
|
||||
'application/pdf',
|
||||
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
||||
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
||||
'application/vnd.openxmlformats-officedocument.presentationml.presentation',
|
||||
'application/zip'
|
||||
])
|
||||
->maxSize(512000)
|
||||
->disk('public')
|
||||
->directory('files')
|
||||
->downloadable()
|
||||
->visibility('public')
|
||||
])
|
||||
])
|
||||
->collapsed()
|
||||
->blockNumbers(false)
|
||||
->collapsible()
|
||||
->addActionLabel('Добавить новый блок'),
|
||||
|
||||
]),
|
||||
Section::make('Особенности программы')->schema([
|
||||
Builder::make('program_features')->label('')->blocks([
|
||||
Builder\Block::make('heading')->label('Заголовок')
|
||||
->schema([
|
||||
TextInput::make('id')->hidden()->integer()->default(rand(2335235,324634264263426)),
|
||||
TextInput::make('content')
|
||||
->label('')
|
||||
->live(onBlur: true)
|
||||
->afterStateUpdated(function (string $operation, string $state, Forms\Set $set, $get) {
|
||||
}),
|
||||
]),
|
||||
Builder\Block::make('paragraph')
|
||||
->schema([
|
||||
RichEditor::make('content')
|
||||
->toolbarButtons([
|
||||
'blockquote',
|
||||
'bold',
|
||||
'bulletList',
|
||||
'italic',
|
||||
'link',
|
||||
'orderedList',
|
||||
'redo',
|
||||
'strike',
|
||||
'underline',
|
||||
'undo',
|
||||
])
|
||||
->label('')
|
||||
->required()
|
||||
]),
|
||||
Builder\Block::make('image')
|
||||
->schema([
|
||||
FileUpload::make('url')
|
||||
->label('Изображение(-я)')
|
||||
->image()
|
||||
->multiple()
|
||||
->reorderable()
|
||||
->maxFiles(5)
|
||||
->disk('public')
|
||||
->directory('images')
|
||||
->imageEditor()
|
||||
->required(),
|
||||
TextInput::make('alt')
|
||||
->label('Описание')
|
||||
->placeholder('Необязяательно')
|
||||
])->label('Изображение(-я)'),
|
||||
Builder\Block::make('video')
|
||||
->schema([
|
||||
Hidden::make('mime'),
|
||||
|
||||
TextInput::make('title')
|
||||
->required()
|
||||
->maxLength(255)
|
||||
->autofocus(),
|
||||
|
||||
FileUpload::make('path')
|
||||
->required()
|
||||
->acceptedFileTypes(['video/mp4','video/ogg','video/webm'])
|
||||
->maxSize(512000)
|
||||
->disk('videos')
|
||||
->visibility('public')
|
||||
->afterStateUpdated(fn (callable $set, $state) => $set('mime', $state?->getMimeType())),
|
||||
]),
|
||||
Builder\Block::make('files')
|
||||
->schema([
|
||||
TextInput::make('title')
|
||||
->required()
|
||||
->maxLength(255)
|
||||
->autofocus(),
|
||||
FileUpload::make('path')
|
||||
->required()
|
||||
->acceptedFileTypes([
|
||||
'application/pdf',
|
||||
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
||||
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
||||
'application/vnd.openxmlformats-officedocument.presentationml.presentation',
|
||||
'application/zip'
|
||||
])
|
||||
->maxSize(512000)
|
||||
->disk('public')
|
||||
->directory('files')
|
||||
->downloadable()
|
||||
->visibility('public')
|
||||
])
|
||||
])
|
||||
->collapsed()
|
||||
->blockNumbers(false)
|
||||
->collapsible()
|
||||
->addActionLabel('Добавить новый блок'),
|
||||
|
||||
]),
|
||||
|
||||
Select::make('lvl_edu')->options(LevelEducational::class)->label('Уровень образования')->required(),
|
||||
Select::make('status')
|
||||
->options(EducationalProgramStatus::class)
|
||||
->label('Статус программы')->required(),
|
||||
TextInput::make('lang_stud')->label('На каком языке ведется образование')->required(),
|
||||
|
||||
])
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('name'),
|
||||
Tables\Columns\TextColumn::make('code_napr'),
|
||||
Tables\Columns\TextColumn::make('directionStudy.lvl_edu')->limit(30),
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\EditAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
AdmissionPlansRelationManager::class
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ListEducationalPrograms::route('/'),
|
||||
'create' => Pages\CreateEducationalProgram::route('/create'),
|
||||
'edit' => Pages\EditEducationalProgram::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\EducationalProgramResource\Pages;
|
||||
|
||||
use App\Filament\Resources\EducationalProgramResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateEducationalProgram extends CreateRecord
|
||||
{
|
||||
protected static string $resource = EducationalProgramResource::class;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\EducationalProgramResource\Pages;
|
||||
|
||||
use App\Filament\Resources\EducationalProgramResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditEducationalProgram extends EditRecord
|
||||
{
|
||||
protected static string $resource = EducationalProgramResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\EducationalProgramResource\Pages;
|
||||
|
||||
use App\Enums\EducationalProgramStatus;
|
||||
use App\Enums\PostStatus;
|
||||
use App\Filament\Resources\EducationalProgramResource;
|
||||
use App\Models\EducationalProgram;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Components\Tab;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class ListEducationalPrograms extends ListRecords
|
||||
{
|
||||
protected static string $resource = EducationalProgramResource::class;
|
||||
|
||||
public \Illuminate\Support\Collection $programByStatuses;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->programByStatuses = EducationalProgram::select('status', DB::raw('count(*) as program_count'))
|
||||
->groupBy('status')
|
||||
->pluck('program_count', 'status');
|
||||
}
|
||||
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
];
|
||||
}
|
||||
|
||||
public function getTabs(): array
|
||||
{
|
||||
return [
|
||||
'status' => Tab::make('Опубликованные программы')->modifyQueryUsing(function (Builder $query) {
|
||||
$query->where('status', '=', EducationalProgramStatus::PUBLISHED->value);
|
||||
})->badge($this->programByStatuses[EducationalProgramStatus::PUBLISHED->value] ?? 0),
|
||||
'All' => Tab::make('Все программы'),
|
||||
];
|
||||
}
|
||||
}
|
||||
+91
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\EducationalProgramResource\RelationManagers;
|
||||
|
||||
use App\Enums\BudgetEducation;
|
||||
use App\Enums\EducationalProgramStatus;
|
||||
use App\Enums\FormEducation;
|
||||
use App\Models\AdmissionCampaign;
|
||||
use App\Models\EducationalProgram;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Components\Section;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Forms\Get;
|
||||
use Filament\Resources\RelationManagers\RelationManager;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
|
||||
class AdmissionPlansRelationManager extends RelationManager
|
||||
{
|
||||
protected static string $relationship = 'admission_plans';
|
||||
|
||||
public function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Forms\Components\Select::make('admission_campaigns_id')
|
||||
->label('Приемная компания')
|
||||
->required()
|
||||
->options(AdmissionCampaign::all()->pluck('name', 'id')),
|
||||
Section::make('План приема')->schema([
|
||||
Forms\Components\Repeater::make('exams')->label('Вступительные испытания')->schema([
|
||||
TextInput::make('title')->label('Название-предмета')->required(),
|
||||
Forms\Components\Select::make('type_exam')->label('Тип-ВИ')
|
||||
->options(['ege' => 'ЕГЭ', 'internal_test' => 'ВИ, проводимое организацией самостоятельно'])->required(),
|
||||
TextInput::make('min_score')->label('Минимальный-балл')->integer()->required()
|
||||
])->live()->maxItems(10)->collapsed()->addActionLabel('Добавить вступительное испытание')->columns(3)->required() ->itemLabel(function (Get $get) {
|
||||
static $count = 0;
|
||||
$maxCount = count($get('exams'));
|
||||
$count = ($count++ <= $maxCount) ? $count : 1;
|
||||
return "Вступительное испытание #" . $count;
|
||||
}),
|
||||
Forms\Components\Repeater::make('contests')->label('Условия поступления')->schema([
|
||||
Forms\Components\Grid::make(1)->schema([
|
||||
Forms\Components\Select::make('form_education')->label('Форма образования')
|
||||
->options(FormEducation::class)->required(),
|
||||
]),
|
||||
Forms\Components\Repeater::make('places')->schema([
|
||||
Forms\Components\Select::make('form_budget')->label('Форма финансирования')
|
||||
->options(BudgetEducation::class)->required(),
|
||||
TextInput::make('count')->label('Количество мест')->integer()->required(),
|
||||
])->columnSpanFull()->maxItems(2),
|
||||
])->live()->maxItems(3)->collapsed()->addActionLabel('Добавить группу')->columns(3)->required()
|
||||
->itemLabel(function (Get $get) {
|
||||
static $count = 0;
|
||||
$maxCount = count($get('contests'));
|
||||
$count = ($count++ <= $maxCount) ? $count : 1;
|
||||
return "Группа #" . $count;
|
||||
}),
|
||||
|
||||
]),
|
||||
|
||||
]);
|
||||
}
|
||||
|
||||
public function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->recordTitleAttribute('name')
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('admissionCampaign.name'),
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->headerActions([
|
||||
Tables\Actions\CreateAction::make(),
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\EditAction::make(),
|
||||
Tables\Actions\DeleteAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources;
|
||||
|
||||
use App\Filament\Resources\EventCategoryResource\Pages;
|
||||
use App\Filament\Resources\EventCategoryResource\RelationManagers;
|
||||
use App\Models\EventCategory;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
|
||||
class EventCategoryResource extends Resource
|
||||
{
|
||||
protected static ?string $model = EventCategory::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
|
||||
protected static ?string $navigationGroup = 'Новости и мероприятия';
|
||||
|
||||
protected static ?string $pluralLabel = 'Категории';
|
||||
|
||||
protected static ?string $navigationParentItem = 'Мероприятия';
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('title')->required()->label('Название'),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
//
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\EditAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ListEventCategories::route('/'),
|
||||
'create' => Pages\CreateEventCategory::route('/create'),
|
||||
'edit' => Pages\EditEventCategory::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\EventCategoryResource\Pages;
|
||||
|
||||
use App\Filament\Resources\EventCategoryResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateEventCategory extends CreateRecord
|
||||
{
|
||||
protected static string $resource = EventCategoryResource::class;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\EventCategoryResource\Pages;
|
||||
|
||||
use App\Filament\Resources\EventCategoryResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditEventCategory extends EditRecord
|
||||
{
|
||||
protected static string $resource = EventCategoryResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\EventCategoryResource\Pages;
|
||||
|
||||
use App\Filament\Resources\EventCategoryResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListEventCategories extends ListRecords
|
||||
{
|
||||
protected static string $resource = EventCategoryResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,216 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources;
|
||||
|
||||
use App\Filament\Resources\EventResource\Pages;
|
||||
use App\Filament\Resources\EventResource\RelationManagers;
|
||||
use App\Models\Category;
|
||||
use App\Models\EventCategory;
|
||||
use Filament\Forms\Components\Builder;
|
||||
|
||||
use App\Models\Event;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Components\DatePicker;
|
||||
use Filament\Forms\Components\DateTimePicker;
|
||||
use Filament\Forms\Components\FileUpload;
|
||||
use Filament\Forms\Components\Hidden;
|
||||
use Filament\Forms\Components\RichEditor;
|
||||
use Filament\Forms\Components\Section;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\SpatieTagsInput;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\Toggle;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
use Illuminate\Support\Str;
|
||||
use Mohamedsabil83\FilamentFormsTinyeditor\Components\TinyEditor;
|
||||
|
||||
class EventResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Event::class;
|
||||
|
||||
protected static ?string $navigationGroup = 'Новости и мероприятия';
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-calendar-days';
|
||||
|
||||
protected static ?string $pluralLabel = 'Мероприятия';
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Section::make()
|
||||
->schema([
|
||||
Forms\Components\Grid::make(2)->schema([
|
||||
TextInput::make('title')->label('Заголовок')->required()
|
||||
->live(onBlur: true)
|
||||
->afterStateUpdated(function (string $operation, $state, Forms\Set $set) {
|
||||
if ($state !== null) {
|
||||
$set('slug', Str::slug($state));
|
||||
} else {
|
||||
$set('slug', null);
|
||||
}
|
||||
}),
|
||||
TextInput::make('slug')->label('Slug (Заполнится автоматически)')->unique(ignoreRecord: true)->readOnly()->required(),
|
||||
]),
|
||||
Section::make('Контент')->schema([
|
||||
\Filament\Forms\Components\Builder::make('content')->label('')->blocks([
|
||||
Builder\Block::make('heading')->label('Заголовок')
|
||||
->schema([
|
||||
TextInput::make('id')->hidden()->integer()->default(rand(2335235,324634264263426)),
|
||||
TextInput::make('content')
|
||||
->label('')
|
||||
->live(onBlur: true)
|
||||
->afterStateUpdated(function (string $operation, string $state, Forms\Set $set, $get) {
|
||||
}),
|
||||
]),
|
||||
Builder\Block::make('paragraph')
|
||||
->schema([
|
||||
RichEditor::make('content')
|
||||
->toolbarButtons([
|
||||
'blockquote',
|
||||
'bold',
|
||||
'bulletList',
|
||||
'italic',
|
||||
'link',
|
||||
'orderedList',
|
||||
'redo',
|
||||
'strike',
|
||||
'underline',
|
||||
'undo',
|
||||
])
|
||||
->label('')
|
||||
->required()
|
||||
])->label('Текст'),
|
||||
Builder\Block::make('image')
|
||||
->schema([
|
||||
FileUpload::make('url')
|
||||
->label('Изображение(-я)')
|
||||
->image()
|
||||
->optimize('jpg')
|
||||
->resize(30)
|
||||
->multiple()
|
||||
->reorderable()
|
||||
->maxFiles(5)
|
||||
->disk('public')
|
||||
->directory('images')
|
||||
->imageEditor()
|
||||
->required(),
|
||||
TextInput::make('alt')
|
||||
->label('Описание')
|
||||
->placeholder('Необязяательно')
|
||||
])->label('Изображение(-я)'),
|
||||
Builder\Block::make('video')
|
||||
->schema([
|
||||
Hidden::make('mime'),
|
||||
|
||||
TextInput::make('title')
|
||||
->required()
|
||||
->maxLength(255)
|
||||
->autofocus(),
|
||||
|
||||
FileUpload::make('path')
|
||||
->required()
|
||||
->acceptedFileTypes(['video/mp4','video/ogg','video/webm'])
|
||||
->maxSize(512000)
|
||||
->disk('videos')
|
||||
->visibility('public')
|
||||
->afterStateUpdated(fn (callable $set, $state) => $set('mime', $state?->getMimeType())),
|
||||
]),
|
||||
Builder\Block::make('files')
|
||||
->schema([
|
||||
TextInput::make('title')
|
||||
->required()
|
||||
->maxLength(255)
|
||||
->autofocus(),
|
||||
FileUpload::make('path')
|
||||
->required()
|
||||
->acceptedFileTypes([
|
||||
'application/pdf',
|
||||
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
||||
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
||||
'application/vnd.openxmlformats-officedocument.presentationml.presentation',
|
||||
'application/zip'
|
||||
])
|
||||
->maxSize(512000)
|
||||
->disk('public')
|
||||
->directory('files')
|
||||
->downloadable()
|
||||
->visibility('public')
|
||||
])
|
||||
])
|
||||
->collapsed()
|
||||
->blockNumbers(false)
|
||||
->collapsible()
|
||||
->addActionLabel('Добавить новый блок'),
|
||||
|
||||
]),
|
||||
TextInput::make('address')->label('Адрес')->required(),
|
||||
|
||||
Forms\Components\Grid::make(2)->schema([
|
||||
Forms\Components\Grid::make(2)->schema([
|
||||
DatePicker::make('event_date_start')->label('Дата начала мероприятия')->required()->native(false)
|
||||
->minDate(now())
|
||||
->maxDate(now()->addYear()),
|
||||
Forms\Components\TimePicker::make('event_time_start')->label('Время начала мероприятия')->seconds(false)->required()->native(false),
|
||||
DatePicker::make('event_date_end')->label('Дата окончания мероприятия (Опиционально)')->native(false)
|
||||
->minDate(now())
|
||||
->maxDate(now()->addYear()),
|
||||
]),
|
||||
|
||||
Toggle::make('is_online')->default(false)->label('Онлайн мероприятие')->inline(false)
|
||||
|
||||
]),
|
||||
|
||||
Forms\Components\Grid::make(2)->schema([
|
||||
Select::make('category_id')
|
||||
->options(EventCategory::all()->pluck('title', 'id'))
|
||||
->preload()
|
||||
->label('Категория'),
|
||||
SpatieTagsInput::make('tags')->label('Тэги'),
|
||||
]),
|
||||
|
||||
])
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('title')
|
||||
->searchable(),
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\EditAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ListEvents::route('/'),
|
||||
'create' => Pages\CreateEvent::route('/create'),
|
||||
'edit' => Pages\EditEvent::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\EventResource\Pages;
|
||||
|
||||
use App\Filament\Resources\EventResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateEvent extends CreateRecord
|
||||
{
|
||||
protected static string $resource = EventResource::class;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\EventResource\Pages;
|
||||
|
||||
use App\Filament\Resources\EventResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditEvent extends EditRecord
|
||||
{
|
||||
protected static string $resource = EventResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\EventResource\Pages;
|
||||
|
||||
use App\Filament\Resources\EventResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListEvents extends ListRecords
|
||||
{
|
||||
protected static string $resource = EventResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources;
|
||||
|
||||
use App\Filament\Resources\ExternalVacancyResource\Pages;
|
||||
use App\Filament\Resources\ExternalVacancyResource\RelationManagers;
|
||||
use App\Models\ExternalVacancy;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
|
||||
class ExternalVacancyResource extends Resource
|
||||
{
|
||||
protected static ?string $model = ExternalVacancy::class;
|
||||
|
||||
protected static ?string $navigationGroup = 'Вакансии';
|
||||
|
||||
public static ?string $label = 'Вакансия для студентов';
|
||||
|
||||
protected static ?string $pluralLabel = 'Вакансии для студентов прочих организаций';
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-briefcase';
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('city')->required()->columnSpan('full')->label('Город'),
|
||||
Forms\Components\TagsInput::make('position')->label('Должность')->placeholder('')->required(),
|
||||
Forms\Components\TextInput::make('salary')->integer()->label('Зарплата')->prefix('₽'),
|
||||
Forms\Components\RichEditor::make('conditions')->label('Условия работы'),
|
||||
Forms\Components\RichEditor::make('contacts')->label('Контакты')->required(),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
//
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\EditAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ListExternalVacancies::route('/'),
|
||||
'create' => Pages\CreateExternalVacancy::route('/create'),
|
||||
'edit' => Pages\EditExternalVacancy::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\ExternalVacancyResource\Pages;
|
||||
|
||||
use App\Filament\Resources\ExternalVacancyResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateExternalVacancy extends CreateRecord
|
||||
{
|
||||
protected static string $resource = ExternalVacancyResource::class;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\ExternalVacancyResource\Pages;
|
||||
|
||||
use App\Filament\Resources\ExternalVacancyResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditExternalVacancy extends EditRecord
|
||||
{
|
||||
protected static string $resource = ExternalVacancyResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\ExternalVacancyResource\Pages;
|
||||
|
||||
use App\Filament\Resources\ExternalVacancyResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListExternalVacancies extends ListRecords
|
||||
{
|
||||
protected static string $resource = ExternalVacancyResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\FacultyRecourceResource\RelationManagers;
|
||||
|
||||
use App\Models\Faculty;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\Toggle;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\RelationManagers\RelationManager;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class DepartmentsRelationManager extends RelationManager
|
||||
{
|
||||
protected static string $relationship = 'departments';
|
||||
|
||||
protected static ?string $title = 'Кафедры';
|
||||
|
||||
|
||||
public function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
TextInput::make('title')->label('Название кафедры')->required()
|
||||
->live(onBlur: true)
|
||||
->afterStateUpdated(function (string $operation, $state, Forms\Set $set) {
|
||||
$set('slug', Str::slug($state));
|
||||
}),
|
||||
TextInput::make('slug')->label('Slug')->unique(ignoreRecord: true)->readOnly()->required(),
|
||||
Toggle::make('is_active')->default(true)->label('Активная кафедра')->inline(false),
|
||||
]);
|
||||
}
|
||||
|
||||
public function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->recordTitleAttribute('title')
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('title')->label('Заголовок'),
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->headerActions([
|
||||
Tables\Actions\CreateAction::make(),
|
||||
Tables\Actions\AssociateAction::make(),
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\EditAction::make(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources;
|
||||
|
||||
use App\Filament\Resources\FacultyRecourceResource\RelationManagers\DepartmentsRelationManager;
|
||||
use App\Filament\Resources\FacultyResource\Pages;
|
||||
use App\Filament\Resources\FacultyResource\RelationManagers;
|
||||
use App\Filament\Resources\FacultyResource\RelationManagers\WorkersRelationManager;
|
||||
use App\Models\Faculty;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\Toggle;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class FacultyResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Faculty::class;
|
||||
|
||||
protected static ?string $navigationGroup = 'Структура института';
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-building-office-2';
|
||||
|
||||
protected static ?string $pluralLabel = 'Факультеты';
|
||||
|
||||
public static ?string $label = 'Факультет';
|
||||
|
||||
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
TextInput::make('title')->label('Название факультета')->required(),
|
||||
TextInput::make('abbreviation')->label('Аббревиатура')->required()
|
||||
->live(onBlur: true)
|
||||
->afterStateUpdated(function (string $operation, $state, Forms\Set $set) {
|
||||
$set('slug', Str::slug($state));
|
||||
}),
|
||||
TextInput::make('slug')->label('Slug')->unique(ignoreRecord: true)->readOnly()->required(),
|
||||
Toggle::make('is_active')->default(true)->label('Активный факультет')->inline(false),
|
||||
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('title')->label('Название')
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\EditAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
DepartmentsRelationManager::class,
|
||||
WorkersRelationManager::class
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ListFaculties::route('/'),
|
||||
'create' => Pages\CreateFaculty::route('/create'),
|
||||
'edit' => Pages\EditFaculty::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\FacultyResource\Pages;
|
||||
|
||||
use App\Filament\Resources\FacultyResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateFaculty extends CreateRecord
|
||||
{
|
||||
protected static string $resource = FacultyResource::class;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\FacultyResource\Pages;
|
||||
|
||||
use App\Filament\Resources\FacultyResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditFaculty extends EditRecord
|
||||
{
|
||||
protected static string $resource = FacultyResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
|
||||
public function hasCombinedRelationManagerTabsWithContent(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\FacultyResource\Pages;
|
||||
|
||||
use App\Filament\Resources\FacultyResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListFaculties extends ListRecords
|
||||
{
|
||||
protected static string $resource = FacultyResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\FacultyResource\RelationManagers;
|
||||
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\RelationManagers\RelationManager;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Actions\AttachAction;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
|
||||
class WorkersRelationManager extends RelationManager
|
||||
{
|
||||
protected static string $relationship = 'workers';
|
||||
|
||||
protected static ?string $title = 'Сотрудники';
|
||||
|
||||
|
||||
public function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('position')->label('Должность')->required(),
|
||||
]);
|
||||
}
|
||||
|
||||
public function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->recordTitleAttribute('name')
|
||||
->reorderable('sort')
|
||||
->defaultSort('sort')
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('name')->label('Имя'),
|
||||
Tables\Columns\TextColumn::make('position')->label('Должность'),
|
||||
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->headerActions([
|
||||
AttachAction::make()
|
||||
->form(fn (AttachAction $action): array => [
|
||||
$action->getRecordSelect()->preload(),
|
||||
Forms\Components\TextInput::make('position')->label('Должность')->required(),
|
||||
])
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\EditAction::make(),
|
||||
Tables\Actions\DeleteAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources;
|
||||
|
||||
use App\Filament\Resources\JournalIssueResource\Pages;
|
||||
use App\Filament\Resources\JournalIssueResource\RelationManagers;
|
||||
use App\Models\AcademicJournal;
|
||||
use App\Models\JournalIssue;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Components\FileUpload;
|
||||
use Filament\Forms\Components\Toggle;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
|
||||
class JournalIssueResource extends Resource
|
||||
{
|
||||
|
||||
protected static ?string $navigationGroup = 'Наука';
|
||||
|
||||
public static ?string $label = 'Выпуск';
|
||||
protected static ?string $pluralLabel = 'Выпуск журнала';
|
||||
protected static ?string $navigationParentItem = 'Научные Журналы';
|
||||
|
||||
|
||||
protected static ?string $model = JournalIssue::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Forms\Components\Section::make()->schema([
|
||||
Forms\Components\Grid::make(2)->schema([
|
||||
Forms\Components\TextInput::make('title')->required(),
|
||||
Forms\Components\Select::make('academic_journal_id')
|
||||
->options(AcademicJournal::query()->pluck('title', 'id'))
|
||||
]),
|
||||
FileUpload::make('path_file')
|
||||
->required()
|
||||
->acceptedFileTypes([
|
||||
'application/pdf',
|
||||
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
||||
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
||||
'application/vnd.openxmlformats-officedocument.presentationml.presentation',
|
||||
'application/zip'
|
||||
])
|
||||
->maxSize(512000)
|
||||
->disk('public')
|
||||
->directory('files')
|
||||
->downloadable()
|
||||
->visibility('public'),
|
||||
Forms\Components\TextInput::make('year_publication')->integer(),
|
||||
Toggle::make('is_active')->default(true)->label('Активный выпуск')->inline(false),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
//
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\EditAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ListJournalIssues::route('/'),
|
||||
'create' => Pages\CreateJournalIssue::route('/create'),
|
||||
'edit' => Pages\EditJournalIssue::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\JournalIssueResource\Pages;
|
||||
|
||||
use App\Filament\Resources\JournalIssueResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateJournalIssue extends CreateRecord
|
||||
{
|
||||
protected static string $resource = JournalIssueResource::class;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\JournalIssueResource\Pages;
|
||||
|
||||
use App\Filament\Resources\JournalIssueResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditJournalIssue extends EditRecord
|
||||
{
|
||||
protected static string $resource = JournalIssueResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\JournalIssueResource\Pages;
|
||||
|
||||
use App\Filament\Resources\JournalIssueResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListJournalIssues extends ListRecords
|
||||
{
|
||||
protected static string $resource = JournalIssueResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,177 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources;
|
||||
|
||||
use App\Filament\Resources\LibraryNewsResource\Pages;
|
||||
use App\Filament\Resources\LibraryNewsResource\RelationManagers;
|
||||
use App\Models\LibraryNews;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Components\FileUpload;
|
||||
use Filament\Forms\Components\Hidden;
|
||||
use Filament\Forms\Components\RichEditor;
|
||||
use Filament\Forms\Components\Section;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
use Filament\Forms\Components\Builder;
|
||||
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
use Mohamedsabil83\FilamentFormsTinyeditor\Components\TinyEditor;
|
||||
|
||||
class LibraryNewsResource extends Resource
|
||||
{
|
||||
protected static ?string $model = LibraryNews::class;
|
||||
|
||||
protected static ?string $navigationGroup = 'Библиотека';
|
||||
|
||||
public static ?string $label = 'Новость';
|
||||
|
||||
protected static ?string $pluralLabel = 'Новости библиотеки';
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-newspaper';
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Forms\Components\Grid::make()->schema([
|
||||
Forms\Components\TextInput::make('title')->required()->label('Заголовок'),
|
||||
Forms\Components\TextInput::make('category')->required()->label('Категория (Необязательно)'),
|
||||
]),
|
||||
|
||||
Forms\Components\Textarea::make('preview_text')->required()->label('Текст анонса')
|
||||
->required()
|
||||
->columnSpanFull(),
|
||||
|
||||
Section::make('Контент')->schema([
|
||||
\Filament\Forms\Components\Builder::make('content')->label('')->blocks([
|
||||
Builder\Block::make('heading')->label('Заголовок')
|
||||
->schema([
|
||||
TextInput::make('id')->hidden()->integer()->default(rand(2335235,324634264263426)),
|
||||
TextInput::make('content')
|
||||
->label('')
|
||||
->live(onBlur: true)
|
||||
->afterStateUpdated(function (string $operation, string $state, Forms\Set $set, $get) {
|
||||
}),
|
||||
]),
|
||||
Builder\Block::make('paragraph')
|
||||
->schema([
|
||||
RichEditor::make('content')
|
||||
->toolbarButtons([
|
||||
'blockquote',
|
||||
'bold',
|
||||
'bulletList',
|
||||
'italic',
|
||||
'link',
|
||||
'orderedList',
|
||||
'redo',
|
||||
'strike',
|
||||
'underline',
|
||||
'undo',
|
||||
])
|
||||
->label('')
|
||||
->required()
|
||||
|
||||
]),
|
||||
Builder\Block::make('image')
|
||||
->schema([
|
||||
FileUpload::make('url')
|
||||
->label('Изображение(-я)')
|
||||
->image()
|
||||
->multiple()
|
||||
->reorderable()
|
||||
->maxFiles(5)
|
||||
->disk('public')
|
||||
->directory('images')
|
||||
->imageEditor()
|
||||
->required(),
|
||||
TextInput::make('alt')
|
||||
->label('Описание')
|
||||
->placeholder('Необязяательно')
|
||||
])->label('Изображение(-я)'),
|
||||
Builder\Block::make('video')
|
||||
->schema([
|
||||
Hidden::make('mime'),
|
||||
|
||||
TextInput::make('title')
|
||||
->required()
|
||||
->maxLength(255)
|
||||
->autofocus(),
|
||||
|
||||
FileUpload::make('path')
|
||||
->required()
|
||||
->acceptedFileTypes(['video/mp4','video/ogg','video/webm'])
|
||||
->maxSize(512000)
|
||||
->disk('videos')
|
||||
->visibility('public')
|
||||
->afterStateUpdated(fn (callable $set, $state) => $set('mime', $state?->getMimeType())),
|
||||
]),
|
||||
Builder\Block::make('files')
|
||||
->schema([
|
||||
TextInput::make('title')
|
||||
->required()
|
||||
->maxLength(255)
|
||||
->autofocus(),
|
||||
FileUpload::make('path')
|
||||
->required()
|
||||
->acceptedFileTypes([
|
||||
'application/pdf',
|
||||
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
||||
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
||||
'application/vnd.openxmlformats-officedocument.presentationml.presentation',
|
||||
'application/zip'
|
||||
])
|
||||
->maxSize(512000)
|
||||
->disk('public')
|
||||
->directory('files')
|
||||
->downloadable()
|
||||
->visibility('public')
|
||||
])
|
||||
])
|
||||
->collapsed()
|
||||
->blockNumbers(false)
|
||||
->collapsible()
|
||||
->addActionLabel('Добавить новый блок'),
|
||||
|
||||
]),
|
||||
Forms\Components\Toggle::make('is_active')->required()->label('Активная заметка')->default(true),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
//
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\EditAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ListLibraryNews::route('/'),
|
||||
'create' => Pages\CreateLibraryNews::route('/create'),
|
||||
'edit' => Pages\EditLibraryNews::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\LibraryNewsResource\Pages;
|
||||
|
||||
use App\Filament\Resources\LibraryNewsResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateLibraryNews extends CreateRecord
|
||||
{
|
||||
protected static string $resource = LibraryNewsResource::class;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\LibraryNewsResource\Pages;
|
||||
|
||||
use App\Filament\Resources\LibraryNewsResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditLibraryNews extends EditRecord
|
||||
{
|
||||
protected static string $resource = LibraryNewsResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\LibraryNewsResource\Pages;
|
||||
|
||||
use App\Filament\Resources\LibraryNewsResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListLibraryNews extends ListRecords
|
||||
{
|
||||
protected static string $resource = LibraryNewsResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources;
|
||||
|
||||
use App\Filament\Resources\MainSectionResource\Pages;
|
||||
use App\Filament\Resources\MainSectionResource\RelationManagers;
|
||||
use App\Models\MainSection;
|
||||
use App\Models\SubSection;
|
||||
use App\Services\Filament\Icon\ArrayToCollectionService;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
use Guava\FilamentIconPicker\Forms\IconPicker;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class MainSectionResource extends Resource
|
||||
{
|
||||
protected static ?string $model = MainSection::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-folder';
|
||||
|
||||
public static ?string $label = 'Главный раздел';
|
||||
public static ?string $pluralLabel = 'Главные разделы';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
protected static ?string $navigationGroup = 'Структура приложения';
|
||||
|
||||
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('title')->label('Название раздела')->required()
|
||||
->live(onBlur: true)
|
||||
->afterStateUpdated(function (string $operation, string $state, Forms\Set $set) {
|
||||
$set('slug', Str::slug($state));
|
||||
}),
|
||||
TextInput::make('slug')->label('Slug')->unique(ignoreRecord: true)->readOnly()->required(),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->reorderable('sort')
|
||||
->defaultSort('sort')
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('title')
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\EditAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
RelationManagers\SubSectionsRelationManager::class,
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ListMainSections::route('/'),
|
||||
'create' => Pages\CreateMainSection::route('/create'),
|
||||
'edit' => Pages\EditMainSection::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\MainSectionResource\Pages;
|
||||
|
||||
use App\Filament\Resources\MainSectionResource;
|
||||
use App\Models\MainSection;
|
||||
use App\Models\SubSection;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateMainSection extends CreateRecord
|
||||
{
|
||||
protected static string $resource = MainSectionResource::class;
|
||||
|
||||
protected array $subSection_ids;
|
||||
//
|
||||
// protected function mutateFormDataBeforeCreate(array $data): array
|
||||
// {
|
||||
// $this->subSection_ids = $data['subSection_ids'];
|
||||
// unset($data['subSection_ids']);
|
||||
//
|
||||
// return $data;
|
||||
// }
|
||||
|
||||
// protected function afterCreate(): void
|
||||
// {
|
||||
// SubSection::whereIn('id', $this->subSection_ids)->update(['main_section_id' => $this->record->id]);
|
||||
// $subSections = SubSection::query()->where('main_section_id', '=', $this->record->id)->get();
|
||||
//
|
||||
// foreach ($subSections as $subSection) {
|
||||
// foreach ($subSection->pages as $page) {
|
||||
// if ($page->is_registered != true && $page->is_url != true) {
|
||||
// $page->update(['path' => $page->path = $this->record->slug.'/'.$subSection->slug.'/'.$page->path]);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\MainSectionResource\Pages;
|
||||
|
||||
use App\Filament\Resources\MainSectionResource;
|
||||
use App\Models\SubSection;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditMainSection extends EditRecord
|
||||
{
|
||||
protected static string $resource = MainSectionResource::class;
|
||||
|
||||
protected array $subSection_ids = [];
|
||||
|
||||
// protected function mutateFormDataBeforeFill(array $data): array
|
||||
// {
|
||||
// $data['subSection_ids'] = SubSection::query()->where('main_section_id', '=', $this->record->id)->pluck('id');
|
||||
//
|
||||
// return $data;
|
||||
// }
|
||||
//
|
||||
// protected function mutateFormDataBeforeSave(array $data): array
|
||||
// {
|
||||
// $this->subSection_ids = $data['subSection_ids'];
|
||||
// unset($data['subSection_ids']);
|
||||
//
|
||||
// return $data;
|
||||
// }
|
||||
|
||||
protected function afterSave(): void
|
||||
{
|
||||
SubSection::query()->where('main_section_id', '=', $this->record->id)->update(['main_section_id' => NULL]);
|
||||
SubSection::whereIn('id', $this->subSection_ids)->update(['main_section_id' => $this->record->id]);
|
||||
$subSections = SubSection::query()->where('main_section_id', '=', $this->record->id)->get();
|
||||
|
||||
foreach ($subSections as $subSection) {
|
||||
foreach ($subSection->pages as $page) {
|
||||
if ($page->is_registered != true && $page->is_url != true) {
|
||||
$page->update(['path' => $page->path = $this->record->slug.'/'.$subSection->slug.'/'.$page->slug]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
|
||||
public function hasCombinedRelationManagerTabsWithContent(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\MainSectionResource\Pages;
|
||||
|
||||
use App\Filament\Resources\MainSectionResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListMainSections extends ListRecords
|
||||
{
|
||||
protected static string $resource = MainSectionResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\MainSectionResource\RelationManagers;
|
||||
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\RelationManagers\RelationManager;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class SubSectionsRelationManager extends RelationManager
|
||||
{
|
||||
protected static string $relationship = 'subSections';
|
||||
|
||||
protected static ?string $inverseRelationship = 'mainSection';
|
||||
|
||||
protected static ?string $title = 'Подразделы';
|
||||
|
||||
public function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('title')->label('Название подраздела')->required()
|
||||
->live(onBlur: true)
|
||||
->afterStateUpdated(function (string $operation, string $state, Forms\Set $set) {
|
||||
$set('slug', Str::slug($state));
|
||||
}),
|
||||
TextInput::make('slug')->label('Slug')->unique(ignoreRecord: true)->readOnly()->required(),
|
||||
]);
|
||||
}
|
||||
|
||||
public function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->recordTitleAttribute('title')
|
||||
->reorderable('sort')
|
||||
->defaultSort('sort')
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('title')->label('Заголовок подраздела'),
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->headerActions([
|
||||
Tables\Actions\CreateAction::make(),
|
||||
Tables\Actions\AssociateAction::make()
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\EditAction::make(),
|
||||
Tables\Actions\DissociateAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,170 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources;
|
||||
|
||||
use App\Filament\Resources\MainSliderResource\Pages;
|
||||
use App\Filament\Resources\MainSliderResource\RelationManagers;
|
||||
use App\Models\Event;
|
||||
use App\Models\MainSlider;
|
||||
use App\Models\Page;
|
||||
use App\Models\Post;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Components\ColorPicker;
|
||||
use Filament\Forms\Components\FileUpload;
|
||||
use Filament\Forms\Components\Toggle;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class MainSliderResource extends Resource
|
||||
{
|
||||
public static ?string $label = 'Слайдер';
|
||||
protected static ?string $pluralLabel = 'Главный слайдер';
|
||||
|
||||
protected static ?string $model = MainSlider::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-square-3-stack-3d';
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Forms\Components\Section::make('Быстрая настройка слайда')->schema([
|
||||
Forms\Components\Grid::make()->schema([
|
||||
Forms\Components\Select::make('model_select')
|
||||
->name('')
|
||||
->label('Выбор типа данных')
|
||||
->options([
|
||||
'Post' => 'Новость',
|
||||
'Page' => 'Страница',
|
||||
'Event' => 'Мероприятие',
|
||||
'Custom' => 'Кастомная ссылка',
|
||||
])
|
||||
->afterStateUpdated(function (string $operation, string|null $state, Forms\Set $set, Forms\Get $get) {
|
||||
if ($get('model_select') === 'Custom') {
|
||||
$set('model', null);
|
||||
$set('title', null);
|
||||
$set('content', null);
|
||||
$set('link', null);
|
||||
};
|
||||
})->live(onBlur: true),
|
||||
|
||||
Forms\Components\Select::make('model')
|
||||
->label('Поиск данных')
|
||||
->name('')
|
||||
->live(onBlur: true)
|
||||
->searchable()
|
||||
->live(onBlur: true)
|
||||
->afterStateUpdated(function (string $operation, string|null $state, Forms\Set $set, Forms\Get $get) {
|
||||
if ($get('model_select') === 'Post') {
|
||||
$post = Post::find($state);
|
||||
$set('title', $post->title);
|
||||
$relativeUrl = parse_url(route('client.post.show', $post->slug), PHP_URL_PATH);
|
||||
$set('link', $relativeUrl);
|
||||
};
|
||||
if ($get('model_select') === 'Page') {
|
||||
$page = Page::find($state);
|
||||
$set('title', $page->title);
|
||||
$set('link', $page->path);
|
||||
};
|
||||
if ($get('model_select') === 'Event') {
|
||||
$event = Event::find($state);
|
||||
$set('title', $event->title);
|
||||
$relativeUrl = parse_url(route('client.event.show', $event->slug), PHP_URL_PATH);
|
||||
$set('link', $relativeUrl);
|
||||
};
|
||||
|
||||
})
|
||||
->options(function (Forms\Get $get) {
|
||||
if ($get('model_select') === 'Post') {
|
||||
return Post::where('status', '=', 'published')->pluck('title', 'id');
|
||||
};
|
||||
if ($get('model_select') === 'Page') {
|
||||
return Page::where('title', '!=', null)->pluck('title', 'id');
|
||||
};
|
||||
if ($get('model_select') === 'Event') {
|
||||
return Event::all()->pluck('title', 'id');
|
||||
};
|
||||
if ($get('model_select') === 'Custom') {
|
||||
return [];
|
||||
};
|
||||
}),
|
||||
]),
|
||||
]),
|
||||
Forms\Components\Section::make('Слайдер')->schema([
|
||||
Forms\Components\TextInput::make('title')
|
||||
->label('Заголовок слайда')
|
||||
->required(),
|
||||
Forms\Components\Textarea::make('content')
|
||||
->label('Текст слайда'),
|
||||
FileUpload::make('image')
|
||||
->label('Изображение')
|
||||
->image()
|
||||
->optimize('webp')
|
||||
->resize(50)
|
||||
->disk('public')
|
||||
->directory('images')
|
||||
->imageEditor(),
|
||||
Forms\Components\Grid::make(2)->schema([
|
||||
Forms\Components\TextInput::make('link')
|
||||
->label('Ссылка кнопки')
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('link_text')
|
||||
->default('Читать')
|
||||
->label('Текст кнопки')
|
||||
->required(),
|
||||
]),
|
||||
ColorPicker::make('color_theme')
|
||||
->label('Цвет текста')
|
||||
->default('#ffffff')
|
||||
->required(),
|
||||
|
||||
Toggle::make('is_active')->default(true)->label('Активный слайдер')->inline(false),
|
||||
]),
|
||||
|
||||
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->reorderable('sort')
|
||||
->defaultSort('sort')
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('title'),
|
||||
Tables\Columns\ToggleColumn::make('is_active')
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\EditAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ListMainSliders::route('/'),
|
||||
'create' => Pages\CreateMainSlider::route('/create'),
|
||||
'edit' => Pages\EditMainSlider::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\MainSliderResource\Pages;
|
||||
|
||||
use App\Filament\Resources\MainSliderResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateMainSlider extends CreateRecord
|
||||
{
|
||||
protected static string $resource = MainSliderResource::class;
|
||||
|
||||
protected function mutateFormDataBeforeCreate(array $data): array
|
||||
{
|
||||
unset($data['model_select'], $data['model']);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\MainSliderResource\Pages;
|
||||
|
||||
use App\Filament\Resources\MainSliderResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditMainSlider extends EditRecord
|
||||
{
|
||||
protected static string $resource = MainSliderResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
|
||||
protected function mutateFormDataBeforeSave(array $data): array
|
||||
{
|
||||
unset($data['model_select'], $data['model']);
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\MainSliderResource\Pages;
|
||||
|
||||
use App\Filament\Resources\MainSliderResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListMainSliders extends ListRecords
|
||||
{
|
||||
protected static string $resource = MainSliderResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources;
|
||||
|
||||
use App\Enums\CustomFormStatus;
|
||||
use App\Enums\PostStatus;
|
||||
use App\Filament\Components\Forms\PageForm;
|
||||
use App\Filament\Resources\PageResource\Pages;
|
||||
use App\Filament\Resources\PageResource\RelationManagers\SectionRelationManager;
|
||||
use App\Helpers\ByteConverter;
|
||||
use App\Models\Category;
|
||||
use App\Models\CustomForm;
|
||||
use App\Models\MainSection;
|
||||
use App\Models\Page;
|
||||
use App\Models\Post;
|
||||
use App\Models\SubSection;
|
||||
use Filament\Forms\Components\Builder;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Components\FileUpload;
|
||||
use Filament\Forms\Components\Hidden;
|
||||
use Filament\Forms\Components\RichEditor;
|
||||
use Filament\Forms\Components\Section;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\SpatieTagsInput;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\Toggle;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Illuminate\Support\Str;
|
||||
use Livewire\Features\SupportFileUploads\TemporaryUploadedFile;
|
||||
use Mohamedsabil83\FilamentFormsTinyeditor\Components\TinyEditor;
|
||||
use Symfony\Component\Finder\Finder;
|
||||
|
||||
class PageResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Page::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-document';
|
||||
|
||||
protected static ?string $pluralLabel = 'Страницы';
|
||||
|
||||
public static ?string $label = 'Страница';
|
||||
|
||||
|
||||
protected static ?string $navigationGroup = 'Структура приложения';
|
||||
|
||||
protected static ?int $navigationSort = 3;
|
||||
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return PageForm::getForm($form);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('title')
|
||||
->searchable(),
|
||||
Tables\Columns\TextColumn::make('path')->label('Путь')
|
||||
->searchable(),
|
||||
Tables\Columns\TextColumn::make('is_registered')->getStateUsing(function ($record) {
|
||||
return ($record->is_registered) ? 'true' : 'false';
|
||||
})
|
||||
->badge()
|
||||
->color(fn (string $state): string => match ($state) {
|
||||
'false' => 'gray',
|
||||
'true' => 'success',
|
||||
})
|
||||
->label('Зарезервированная страница'),
|
||||
Tables\Columns\TextColumn::make('is_url')->getStateUsing(function ($record) {
|
||||
return ($record->is_url) ? 'true' : 'false';
|
||||
})
|
||||
->badge()
|
||||
->color(fn (string $state): string => match ($state) {
|
||||
'false' => 'gray',
|
||||
'true' => 'success',
|
||||
})
|
||||
->label('Ссылка на другой ресурс'),
|
||||
Tables\Columns\TextColumn::make('code')
|
||||
->badge()
|
||||
->color(fn (string $state): string => match ($state) {
|
||||
'200' => 'success',
|
||||
'404' => 'warning',
|
||||
'500' => 'danger',
|
||||
})
|
||||
->label('Код страницы'),
|
||||
|
||||
|
||||
])
|
||||
->filters([
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\EditAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
SectionRelationManager::class,
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ListPages::route('/'),
|
||||
'create' => Pages\CreatePage::route('/create'),
|
||||
'edit' => Pages\EditPage::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user