From 8b2f9e99f0366785d6bc9e94747e8270d418f34e Mon Sep 17 00:00:00 2001 From: F4ilji Date: Sun, 27 Jul 2025 21:33:00 +0500 Subject: [PATCH] add 'info' field as an array in DirectionStudy model; update DirectionStudyResource to include tabs for main information and admission details; modify Show.vue to display direction study information; enhance PageItemBlock.vue for better breadcrumb display --- .../Education/Models/DirectionStudy.php | 1 + .../Resources/DirectionStudyResource.php | 104 +++++++++++------- ...info_column_to_direction_studies_table.php | 28 +++++ resources/js/Pages/Client/Programs/Show.vue | 6 +- .../pageBuilder/blocks/PageItemBlock.vue | 79 +++++++------ 5 files changed, 134 insertions(+), 84 deletions(-) create mode 100644 database/migrations/2025_07_27_193618_add_info_column_to_direction_studies_table.php diff --git a/app/Containers/Education/Models/DirectionStudy.php b/app/Containers/Education/Models/DirectionStudy.php index fcc264d..ee48147 100644 --- a/app/Containers/Education/Models/DirectionStudy.php +++ b/app/Containers/Education/Models/DirectionStudy.php @@ -17,6 +17,7 @@ class DirectionStudy extends Model protected $casts = [ 'lvl_edu' => LevelEducational::class, + 'info' => 'array', ]; public function programs(): HasMany diff --git a/app/Filament/Resources/DirectionStudyResource.php b/app/Filament/Resources/DirectionStudyResource.php index 8977a39..528b77e 100644 --- a/app/Filament/Resources/DirectionStudyResource.php +++ b/app/Filament/Resources/DirectionStudyResource.php @@ -2,14 +2,25 @@ namespace App\Filament\Resources; +use App\Containers\Article\Enums\PostStatus; +use App\Containers\Article\Models\Category; use App\Containers\Education\Models\DirectionStudy; +use App\Containers\Widget\Models\Slider; +use App\Filament\Components\Forms\ItemForm\Pages\ContentBuilderItem; use App\Filament\Resources\DirectionStudyResource\Pages; use App\Ship\Enums\Education\LevelEducational; use Filament\Forms; +use Filament\Forms\Components\ColorPicker; +use Filament\Forms\Components\DateTimePicker; +use Filament\Forms\Components\FileUpload; use Filament\Forms\Components\Grid; 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\Components\ToggleButtons; use Filament\Forms\Form; use Filament\Resources\Resource; use Filament\Tables; @@ -36,50 +47,65 @@ class DirectionStudyResource extends Resource ->description('Заполните основные данные о направлении подготовки') ->collapsible() ->schema([ - Grid::make(2) - ->schema([ - TextInput::make('name') - ->label('Название направления') - ->required() - ->maxLength(255) - ->placeholder('Например: Информатика и вычислительная техника') - ->live(onBlur: true) - ->afterStateUpdated(function (string $operation, ?string $state, Forms\Set $set) { - $set('slug', Str::slug($state)); - }) - ->helperText('Полное название направления подготовки'), + Tabs::make('Tabs') + ->tabs([ + Tabs\Tab::make('Основная информация') + ->icon('heroicon-o-information-circle') + ->schema([ + Grid::make(2) + ->schema([ + TextInput::make('name') + ->label('Название направления') + ->required() + ->maxLength(255) + ->placeholder('Например: Информатика и вычислительная техника') + ->live(onBlur: true) + ->afterStateUpdated(function (string $operation, ?string $state, Forms\Set $set) { + $set('slug', Str::slug($state)); + }) + ->helperText('Полное название направления подготовки'), - TextInput::make('uuid') - ->label('uuid') - ->required() - ->maxLength(255) - ->unique(ignoreRecord: true) - ->helperText('UUID'), + TextInput::make('uuid') + ->label('uuid') + ->required() + ->maxLength(255) + ->unique(ignoreRecord: true) + ->helperText('UUID'), - TextInput::make('slug') - ->label('URL-идентификатор') - ->required() - ->readOnly() - ->maxLength(255) - ->unique(ignoreRecord: true) - ->helperText('Человеко-понятный URL для направления'), + TextInput::make('slug') + ->label('URL-идентификатор') + ->required() + ->readOnly() + ->maxLength(255) + ->unique(ignoreRecord: true) + ->helperText('Человеко-понятный URL для направления'), - TextInput::make('code') - ->label('Код направления') - ->required() - ->maxLength(50) - ->placeholder('Например: 09.03.01') - ->helperText('Код направления по ФГОС'), + TextInput::make('code') + ->label('Код направления') + ->required() + ->maxLength(50) + ->placeholder('Например: 09.03.01') + ->helperText('Код направления по ФГОС'), - Select::make('lvl_edu') - ->label('Уровень образования') - ->options(LevelEducational::class) - ->required() - ->native(false) - ->placeholder('Выберите уровень') - ->helperText('Выберите уровень образовательной программы'), - ]), + Select::make('lvl_edu') + ->label('Уровень образования') + ->options(LevelEducational::class) + ->required() + ->native(false) + ->placeholder('Выберите уровень') + ->helperText('Выберите уровень образовательной программы'), + ]), + ]), + Tabs\Tab::make('Информация для направления') + ->icon('heroicon-o-document-text') + ->schema([ + ContentBuilderItem::getItem('info') + ->required() + ->helperText('Создайте содержимое новости используя конструктор'), + ]), + ]) + ->persistTabInQueryString(), ]), ]); } diff --git a/database/migrations/2025_07_27_193618_add_info_column_to_direction_studies_table.php b/database/migrations/2025_07_27_193618_add_info_column_to_direction_studies_table.php new file mode 100644 index 0000000..73122e0 --- /dev/null +++ b/database/migrations/2025_07_27_193618_add_info_column_to_direction_studies_table.php @@ -0,0 +1,28 @@ +text('info')->nullable()->after('lvl_edu'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('direction_studies', function (Blueprint $table) { + $table->dropColumn('info'); + }); + } +}; diff --git a/resources/js/Pages/Client/Programs/Show.vue b/resources/js/Pages/Client/Programs/Show.vue index 662ca9b..22bec99 100644 --- a/resources/js/Pages/Client/Programs/Show.vue +++ b/resources/js/Pages/Client/Programs/Show.vue @@ -214,7 +214,7 @@ export default { -
+
diff --git a/resources/js/componentss/shared/builder/pageBuilder/blocks/PageItemBlock.vue b/resources/js/componentss/shared/builder/pageBuilder/blocks/PageItemBlock.vue index 0d71cce..ff4ac95 100644 --- a/resources/js/componentss/shared/builder/pageBuilder/blocks/PageItemBlock.vue +++ b/resources/js/componentss/shared/builder/pageBuilder/blocks/PageItemBlock.vue @@ -12,48 +12,43 @@
-
- - -
-
- - - -
-
    -
  1. - - {{ breadcrumbs.mainSection }} - - - - -
  2. -
  3. - - {{ breadcrumbs.subSection }} - - - - -
  4. -
  5. - - {{ breadcrumbs.page }} - -
  6. -
-

- {{ page.title }} -

-
-
-
-
- -
+
+ +
+
+
+ +

+ {{ page.title }} +

+
+
+
+
+