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:
@@ -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;
|
||||||
@@ -36,50 +47,65 @@ class DirectionStudyResource extends Resource
|
|||||||
->description('Заполните основные данные о направлении подготовки')
|
->description('Заполните основные данные о направлении подготовки')
|
||||||
->collapsible()
|
->collapsible()
|
||||||
->schema([
|
->schema([
|
||||||
Grid::make(2)
|
Tabs::make('Tabs')
|
||||||
->schema([
|
->tabs([
|
||||||
TextInput::make('name')
|
Tabs\Tab::make('Основная информация')
|
||||||
->label('Название направления')
|
->icon('heroicon-o-information-circle')
|
||||||
->required()
|
->schema([
|
||||||
->maxLength(255)
|
Grid::make(2)
|
||||||
->placeholder('Например: Информатика и вычислительная техника')
|
->schema([
|
||||||
->live(onBlur: true)
|
TextInput::make('name')
|
||||||
->afterStateUpdated(function (string $operation, ?string $state, Forms\Set $set) {
|
->label('Название направления')
|
||||||
$set('slug', Str::slug($state));
|
->required()
|
||||||
})
|
->maxLength(255)
|
||||||
->helperText('Полное название направления подготовки'),
|
->placeholder('Например: Информатика и вычислительная техника')
|
||||||
|
->live(onBlur: true)
|
||||||
|
->afterStateUpdated(function (string $operation, ?string $state, Forms\Set $set) {
|
||||||
|
$set('slug', Str::slug($state));
|
||||||
|
})
|
||||||
|
->helperText('Полное название направления подготовки'),
|
||||||
|
|
||||||
TextInput::make('uuid')
|
TextInput::make('uuid')
|
||||||
->label('uuid')
|
->label('uuid')
|
||||||
->required()
|
->required()
|
||||||
->maxLength(255)
|
->maxLength(255)
|
||||||
->unique(ignoreRecord: true)
|
->unique(ignoreRecord: true)
|
||||||
->helperText('UUID'),
|
->helperText('UUID'),
|
||||||
|
|
||||||
|
|
||||||
TextInput::make('slug')
|
TextInput::make('slug')
|
||||||
->label('URL-идентификатор')
|
->label('URL-идентификатор')
|
||||||
->required()
|
->required()
|
||||||
->readOnly()
|
->readOnly()
|
||||||
->maxLength(255)
|
->maxLength(255)
|
||||||
->unique(ignoreRecord: true)
|
->unique(ignoreRecord: true)
|
||||||
->helperText('Человеко-понятный URL для направления'),
|
->helperText('Человеко-понятный URL для направления'),
|
||||||
|
|
||||||
TextInput::make('code')
|
TextInput::make('code')
|
||||||
->label('Код направления')
|
->label('Код направления')
|
||||||
->required()
|
->required()
|
||||||
->maxLength(50)
|
->maxLength(50)
|
||||||
->placeholder('Например: 09.03.01')
|
->placeholder('Например: 09.03.01')
|
||||||
->helperText('Код направления по ФГОС'),
|
->helperText('Код направления по ФГОС'),
|
||||||
|
|
||||||
Select::make('lvl_edu')
|
Select::make('lvl_edu')
|
||||||
->label('Уровень образования')
|
->label('Уровень образования')
|
||||||
->options(LevelEducational::class)
|
->options(LevelEducational::class)
|
||||||
->required()
|
->required()
|
||||||
->native(false)
|
->native(false)
|
||||||
->placeholder('Выберите уровень')
|
->placeholder('Выберите уровень')
|
||||||
->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');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -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,48 +12,43 @@
|
|||||||
</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">
|
<div class="grow min-w-0">
|
||||||
<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">
|
<ol class="flex items-center whitespace-nowrap overflow-hidden hidden md:block">
|
||||||
<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" />
|
<li class="inline-flex items-center">
|
||||||
</svg>
|
<span class="flex items-center text-sm text-gray-500 hover:text-primary-hover focus:outline-none focus:text-primary truncate" href="#">
|
||||||
<div class="grow">
|
{{ breadcrumbs.mainSection }}
|
||||||
<ol class="flex items-center whitespace-nowrap">
|
</span>
|
||||||
<li class="inline-flex items-center">
|
<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">
|
||||||
<span class="flex items-center text-sm text-gray-500 hover:text-primary-hover focus:outline-none focus:text-primary" href="#">
|
<path d="m9 18 6-6-6-6"></path>
|
||||||
{{ breadcrumbs.mainSection }}
|
</svg>
|
||||||
</span>
|
</li>
|
||||||
<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">
|
<li class="inline-flex items-center">
|
||||||
<path d="m9 18 6-6-6-6"></path>
|
<span class="flex items-center text-sm text-gray-500 hover:text-primary-hover focus:outline-none focus:text-primary truncate" href="#">
|
||||||
</svg>
|
{{ breadcrumbs.subSection }}
|
||||||
</li>
|
</span>
|
||||||
<li class="inline-flex items-center">
|
<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">
|
||||||
<span class="flex items-center text-sm text-gray-500 hover:text-primary-hover focus:outline-none focus:text-primary" href="#">
|
<path d="m9 18 6-6-6-6"></path>
|
||||||
{{ breadcrumbs.subSection }}
|
</svg>
|
||||||
</span>
|
</li>
|
||||||
<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">
|
<li class="inline-flex items-center">
|
||||||
<path d="m9 18 6-6-6-6"></path>
|
<span class="flex items-center text-sm text-gray-500 hover:text-primary-hover focus:outline-none focus:text-primary truncate" href="#">
|
||||||
</svg>
|
{{ breadcrumbs.page }}
|
||||||
</li>
|
</span>
|
||||||
<li class="inline-flex items-center">
|
</li>
|
||||||
<span class="flex items-center text-sm text-gray-500 hover:text-primary-hover focus:outline-none focus:text-primary" href="#">
|
</ol>
|
||||||
{{ breadcrumbs.page }}
|
<p class="mt-1 group-hover:text-primary-hover font-semibold text-gray-700 break-words">
|
||||||
</span>
|
{{ page.title }}
|
||||||
</li>
|
</p>
|
||||||
</ol>
|
</div>
|
||||||
<h3 class="mt-1 group-hover:text-primary-hover font-semibold text-gray-700">
|
</div>
|
||||||
{{ page.title }}
|
</div>
|
||||||
</h3>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</a>
|
|
||||||
<!-- End Grid -->
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
Reference in New Issue
Block a user