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

This commit is contained in:
F4ilji
2025-07-27 21:33:00 +05:00
parent cb95af3c46
commit 8b2f9e99f0
5 changed files with 134 additions and 84 deletions
@@ -17,6 +17,7 @@ class DirectionStudy extends Model
protected $casts = [ protected $casts = [
'lvl_edu' => LevelEducational::class, 'lvl_edu' => LevelEducational::class,
'info' => 'array',
]; ];
public function programs(): HasMany public function programs(): HasMany
@@ -2,14 +2,25 @@
namespace App\Filament\Resources; 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\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\Filament\Resources\DirectionStudyResource\Pages;
use App\Ship\Enums\Education\LevelEducational; use App\Ship\Enums\Education\LevelEducational;
use Filament\Forms; 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\Grid;
use Filament\Forms\Components\Section; use Filament\Forms\Components\Section;
use Filament\Forms\Components\Select; use Filament\Forms\Components\Select;
use Filament\Forms\Components\SpatieTagsInput;
use Filament\Forms\Components\Tabs;
use Filament\Forms\Components\TextInput; use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Toggle;
use Filament\Forms\Components\ToggleButtons;
use Filament\Forms\Form; use Filament\Forms\Form;
use Filament\Resources\Resource; use Filament\Resources\Resource;
use Filament\Tables; use Filament\Tables;
@@ -35,6 +46,11 @@ class DirectionStudyResource extends Resource
Section::make('Основная информация') Section::make('Основная информация')
->description('Заполните основные данные о направлении подготовки') ->description('Заполните основные данные о направлении подготовки')
->collapsible() ->collapsible()
->schema([
Tabs::make('Tabs')
->tabs([
Tabs\Tab::make('Основная информация')
->icon('heroicon-o-information-circle')
->schema([ ->schema([
Grid::make(2) Grid::make(2)
->schema([ ->schema([
@@ -81,6 +97,16 @@ class DirectionStudyResource extends Resource
->helperText('Выберите уровень образовательной программы'), ->helperText('Выберите уровень образовательной программы'),
]), ]),
]), ]),
Tabs\Tab::make('Информация для направления')
->icon('heroicon-o-document-text')
->schema([
ContentBuilderItem::getItem('info')
->required()
->helperText('Создайте содержимое новости используя конструктор'),
]),
])
->persistTabInQueryString(),
]),
]); ]);
} }
@@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('direction_studies', function (Blueprint $table) {
$table->text('info')->nullable()->after('lvl_edu');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('direction_studies', function (Blueprint $table) {
$table->dropColumn('info');
});
}
};
+3 -3
View File
@@ -214,7 +214,7 @@ export default {
</div> </div>
</div> </div>
<div v-if="program.data.program_features" class="hs-accordion bg-white border -mt-px first:rounded-t-lg last:rounded-b-lg" id="hs-bordered-heading-three"> <div v-if="program.data.directionStudy.info" class="hs-accordion bg-white border -mt-px first:rounded-t-lg last:rounded-b-lg" id="hs-bordered-heading-three">
<button class="hs-accordion-toggle hs-accordion-active:text-primary inline-flex items-center gap-x-3 w-full font-semibold text-start text-gray-800 py-4 px-5 hover:text-gray-500 disabled:opacity-50 disabled:pointer-events-none" aria-controls="hs-basic-bordered-collapse-three"> <button class="hs-accordion-toggle hs-accordion-active:text-primary inline-flex items-center gap-x-3 w-full font-semibold text-start text-gray-800 py-4 px-5 hover:text-gray-500 disabled:opacity-50 disabled:pointer-events-none" aria-controls="hs-basic-bordered-collapse-three">
<svg class="hs-accordion-active:hidden block size-3.5" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> <svg class="hs-accordion-active:hidden block size-3.5" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M5 12h14"></path> <path d="M5 12h14"></path>
@@ -223,11 +223,11 @@ export default {
<svg class="hs-accordion-active:block hidden size-3.5" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> <svg class="hs-accordion-active:block hidden size-3.5" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M5 12h14"></path> <path d="M5 12h14"></path>
</svg> </svg>
Особенности программы Информация для поступающих
</button> </button>
<div id="hs-basic-bordered-collapse-three" class="hs-accordion-content hidden w-full overflow-hidden transition-[height] duration-300" aria-labelledby="hs-bordered-heading-three"> <div id="hs-basic-bordered-collapse-three" class="hs-accordion-content hidden w-full overflow-hidden transition-[height] duration-300" aria-labelledby="hs-bordered-heading-three">
<div class="pb-4 px-5"> <div class="pb-4 px-5">
<Builder :blocks="program.data.program_features" /> <Builder :blocks="program.data.directionStudy.info" />
</div> </div>
</div> </div>
</div> </div>
@@ -12,19 +12,15 @@
</div> </div>
</div> </div>
<div v-else class="w-full px-2 py-5 sm:px-3 lg:px-4 lg:py-7 mx-auto"> <div v-else class="w-full px-2 sm:px-3 lg:px-4 lg:py-4 mx-auto">
<!-- Grid -->
<a class="group flex flex-col bg-white border shadow-sm rounded-xl hover:shadow-md focus:outline-none focus:shadow-md transition" <a class="group flex flex-col bg-white border shadow-sm rounded-xl hover:shadow-md focus:outline-none focus:shadow-md transition"
:href="(page.is_url) ? page.path : route('page.view', page.path) + '/'"> :href="(page.is_url) ? page.path : route('page.view', page.path) + '/'">
<div class="p-4 md:p-5"> <div class="p-4 md:p-5">
<div class="flex items-center gap-x-5"> <div class="flex items-center gap-x-5">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="mt-1 shrink-0 size-7 text-gray-600"> <div class="grow min-w-0">
<path stroke-linecap="round" stroke-linejoin="round" d="M19.5 14.25v-2.625a3.375 3.375 0 0 0-3.375-3.375h-1.5A1.125 1.125 0 0 1 13.5 7.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H8.25m0 12.75h7.5m-7.5 3H12M10.5 2.25H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 0 0-9-9Z" /> <ol class="flex items-center whitespace-nowrap overflow-hidden hidden md:block">
</svg>
<div class="grow">
<ol class="flex items-center whitespace-nowrap">
<li class="inline-flex items-center"> <li class="inline-flex items-center">
<span class="flex items-center text-sm text-gray-500 hover:text-primary-hover focus:outline-none focus:text-primary" href="#"> <span class="flex items-center text-sm text-gray-500 hover:text-primary-hover focus:outline-none focus:text-primary truncate" href="#">
{{ breadcrumbs.mainSection }} {{ breadcrumbs.mainSection }}
</span> </span>
<svg class="shrink-0 mx-2 size-4 text-gray-400" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> <svg class="shrink-0 mx-2 size-4 text-gray-400" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
@@ -32,7 +28,7 @@
</svg> </svg>
</li> </li>
<li class="inline-flex items-center"> <li class="inline-flex items-center">
<span class="flex items-center text-sm text-gray-500 hover:text-primary-hover focus:outline-none focus:text-primary" href="#"> <span class="flex items-center text-sm text-gray-500 hover:text-primary-hover focus:outline-none focus:text-primary truncate" href="#">
{{ breadcrumbs.subSection }} {{ breadcrumbs.subSection }}
</span> </span>
<svg class="shrink-0 mx-2 size-4 text-gray-400" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> <svg class="shrink-0 mx-2 size-4 text-gray-400" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
@@ -40,19 +36,18 @@
</svg> </svg>
</li> </li>
<li class="inline-flex items-center"> <li class="inline-flex items-center">
<span class="flex items-center text-sm text-gray-500 hover:text-primary-hover focus:outline-none focus:text-primary" href="#"> <span class="flex items-center text-sm text-gray-500 hover:text-primary-hover focus:outline-none focus:text-primary truncate" href="#">
{{ breadcrumbs.page }} {{ breadcrumbs.page }}
</span> </span>
</li> </li>
</ol> </ol>
<h3 class="mt-1 group-hover:text-primary-hover font-semibold text-gray-700"> <p class="mt-1 group-hover:text-primary-hover font-semibold text-gray-700 break-words">
{{ page.title }} {{ page.title }}
</h3> </p>
</div> </div>
</div> </div>
</div> </div>
</a> </a>
<!-- End Grid -->
</div> </div>