adding UserDetailObserver and reorderable records feature
This commit is contained in:
@@ -58,6 +58,9 @@ class ClientDepartmentController extends Controller
|
|||||||
->where('is_active', true)
|
->where('is_active', true)
|
||||||
->with([
|
->with([
|
||||||
'faculty',
|
'faculty',
|
||||||
|
'workers' => fn ($query) => $query->orderBy('sort', 'asc'),
|
||||||
|
'teachers' => fn ($query) => $query->orderBy('sort', 'asc'),
|
||||||
|
'programs' => fn ($query) => $query->orderBy('sort', 'asc'),
|
||||||
'workers.userDetail',
|
'workers.userDetail',
|
||||||
'teachers.userDetail',
|
'teachers.userDetail',
|
||||||
'programs.directionStudy',
|
'programs.directionStudy',
|
||||||
|
|||||||
@@ -38,7 +38,15 @@ class ClientDivisionController extends Controller
|
|||||||
});
|
});
|
||||||
|
|
||||||
$divisionData = Cache::remember(CacheKeys::DIVISION_PREFIX->value . $slug, now()->addDay(), function () use ($slug) {
|
$divisionData = Cache::remember(CacheKeys::DIVISION_PREFIX->value . $slug, now()->addDay(), function () use ($slug) {
|
||||||
return Division::with(['workers.userDetail', 'seo'])->where('is_active', true)->where('slug', $slug)->firstOrFail();
|
return Division::query()
|
||||||
|
->with([
|
||||||
|
'workers' => fn ($query) => $query->orderBy('sort', 'asc'),
|
||||||
|
'workers.userDetail',
|
||||||
|
'seo'
|
||||||
|
])
|
||||||
|
->where('is_active', true)
|
||||||
|
->where('slug', $slug)
|
||||||
|
->firstOrFail();
|
||||||
});
|
});
|
||||||
|
|
||||||
$seo = $this->seoPageProvider->getSeoForModel($divisionData);
|
$seo = $this->seoPageProvider->getSeoForModel($divisionData);
|
||||||
|
|||||||
@@ -61,7 +61,11 @@ class ClientFacultyController extends Controller
|
|||||||
function () use ($slug) {
|
function () use ($slug) {
|
||||||
return Faculty::where('slug', $slug)
|
return Faculty::where('slug', $slug)
|
||||||
->where('is_active', true)
|
->where('is_active', true)
|
||||||
->with(['departments.faculty', 'workers', 'seo'])
|
->with(['departments.faculty',
|
||||||
|
'workers' => fn ($query) => $query->orderBy('sort', 'asc'),
|
||||||
|
'workers.userDetail',
|
||||||
|
'seo'
|
||||||
|
])
|
||||||
->firstOrFail();
|
->firstOrFail();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -0,0 +1,56 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Containers\User\Observers;
|
||||||
|
|
||||||
|
use App\Containers\User\Models\UserDetail;
|
||||||
|
use App\Services\App\Cache\UserCacheService;
|
||||||
|
|
||||||
|
class UserDetailObserver
|
||||||
|
{
|
||||||
|
private UserCacheService $userCacheService;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->userCacheService = app(UserCacheService::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle the User "created" event.
|
||||||
|
*/
|
||||||
|
public function created(UserDetail $user): void
|
||||||
|
{
|
||||||
|
$this->userCacheService->clearAllCacheByModel();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle the User "updated" event.
|
||||||
|
*/
|
||||||
|
public function updated(UserDetail $user): void
|
||||||
|
{
|
||||||
|
$this->userCacheService->clearAllCacheByModel();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle the User "deleted" event.
|
||||||
|
*/
|
||||||
|
public function deleted(UserDetail $user): void
|
||||||
|
{
|
||||||
|
$this->userCacheService->clearAllCacheByModel();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle the User "restored" event.
|
||||||
|
*/
|
||||||
|
public function restored(UserDetail $user): void
|
||||||
|
{
|
||||||
|
$this->userCacheService->clearAllCacheByModel();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle the User "force deleted" event.
|
||||||
|
*/
|
||||||
|
public function forceDeleted(UserDetail $user): void
|
||||||
|
{
|
||||||
|
$this->userCacheService->clearAllCacheByModel();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -103,4 +103,9 @@ class ProgramsRelationManager extends RelationManager
|
|||||||
->deferLoading()
|
->deferLoading()
|
||||||
->persistFiltersInSession();
|
->persistFiltersInSession();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function canReorder(): bool
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+7
-1
@@ -166,7 +166,13 @@ class TeachersRelationManager extends RelationManager
|
|||||||
AttachAction::make()
|
AttachAction::make()
|
||||||
->label('Добавить преподавателя'),
|
->label('Добавить преподавателя'),
|
||||||
])
|
])
|
||||||
->defaultSort('name')
|
->defaultSort('sort')
|
||||||
|
->reorderable('sort')
|
||||||
->deferLoading();
|
->deferLoading();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function canReorder(): bool
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+7
-1
@@ -166,7 +166,13 @@ class WorkersRelationManager extends RelationManager
|
|||||||
AttachAction::make()
|
AttachAction::make()
|
||||||
->label('Добавить сотрудника'),
|
->label('Добавить сотрудника'),
|
||||||
])
|
])
|
||||||
->defaultSort('name')
|
->reorderable('sort')
|
||||||
|
->defaultSort('sort')
|
||||||
->deferLoading();
|
->deferLoading();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function canReorder(): bool
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -181,4 +181,9 @@ class WorkersRelationManager extends RelationManager
|
|||||||
->paginated([10, 25, 50, 100])
|
->paginated([10, 25, 50, 100])
|
||||||
->striped();
|
->striped();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function canReorder(): bool
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+14
-10
@@ -50,6 +50,7 @@ class WorkersRelationManager extends RelationManager
|
|||||||
->maxLength(10)
|
->maxLength(10)
|
||||||
->placeholder('Например: 305а')
|
->placeholder('Например: 305а')
|
||||||
->helperText('Номер кабинета для приема'),
|
->helperText('Номер кабинета для приема'),
|
||||||
|
|
||||||
])
|
])
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
@@ -57,9 +58,9 @@ class WorkersRelationManager extends RelationManager
|
|||||||
public function table(Table $table): Table
|
public function table(Table $table): Table
|
||||||
{
|
{
|
||||||
return $table
|
return $table
|
||||||
->recordTitleAttribute('name')
|
|
||||||
->reorderable('sort')
|
->reorderable('sort')
|
||||||
->defaultSort('sort')
|
->defaultSort('sort')
|
||||||
|
->recordTitleAttribute('name')
|
||||||
->columns([
|
->columns([
|
||||||
Tables\Columns\TextColumn::make('name')
|
Tables\Columns\TextColumn::make('name')
|
||||||
->label('ФИО')
|
->label('ФИО')
|
||||||
@@ -75,23 +76,21 @@ class WorkersRelationManager extends RelationManager
|
|||||||
Tables\Columns\TextColumn::make('service_email')
|
Tables\Columns\TextColumn::make('service_email')
|
||||||
->label('Почта')
|
->label('Почта')
|
||||||
->searchable()
|
->searchable()
|
||||||
->icon('heroicon-o-envelope')
|
->icon('heroicon-o-envelope'),
|
||||||
->toggleable(isToggledHiddenByDefault: true),
|
|
||||||
|
|
||||||
Tables\Columns\TextColumn::make('service_phone')
|
Tables\Columns\TextColumn::make('service_phone')
|
||||||
->label('Телефон')
|
->label('Телефон')
|
||||||
->searchable()
|
->searchable()
|
||||||
->icon('heroicon-o-phone')
|
->icon('heroicon-o-phone'),
|
||||||
->toggleable(isToggledHiddenByDefault: true),
|
|
||||||
|
|
||||||
Tables\Columns\TextColumn::make('cabinet')
|
Tables\Columns\TextColumn::make('cabinet')
|
||||||
->label('Кабинет')
|
->label('Кабинет')
|
||||||
->searchable()
|
->searchable()
|
||||||
->icon('heroicon-o-home-modern')
|
->icon('heroicon-o-home-modern'),
|
||||||
->toggleable(isToggledHiddenByDefault: false),
|
// Tables\Columns\TextColumn::make('sort')
|
||||||
])
|
// ->label('Сортировка')
|
||||||
->filters([
|
// ->toggleable(isToggledHiddenByDefault: false),
|
||||||
//
|
|
||||||
])
|
])
|
||||||
->headerActions([
|
->headerActions([
|
||||||
AttachAction::make()
|
AttachAction::make()
|
||||||
@@ -165,4 +164,9 @@ class WorkersRelationManager extends RelationManager
|
|||||||
->emptyStateDescription('Добавьте сотрудников, используя кнопку выше')
|
->emptyStateDescription('Добавьте сотрудников, используя кнопку выше')
|
||||||
->emptyStateIcon('heroicon-o-user-group');
|
->emptyStateIcon('heroicon-o-user-group');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function canReorder(): bool
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -18,6 +18,8 @@ use App\Containers\InstituteStructure\Models\Faculty;
|
|||||||
use App\Containers\Schedule\Models\Schedule;
|
use App\Containers\Schedule\Models\Schedule;
|
||||||
use App\Containers\Science\Models\AcademicJournal;
|
use App\Containers\Science\Models\AcademicJournal;
|
||||||
use App\Containers\User\Models\User;
|
use App\Containers\User\Models\User;
|
||||||
|
use App\Containers\User\Models\UserDetail;
|
||||||
|
use App\Containers\User\Observers\UserDetailObserver;
|
||||||
use App\Containers\Widget\Models\ContactWidget;
|
use App\Containers\Widget\Models\ContactWidget;
|
||||||
use App\Containers\Widget\Models\PageReferenceList;
|
use App\Containers\Widget\Models\PageReferenceList;
|
||||||
use App\Containers\Widget\Models\Slide;
|
use App\Containers\Widget\Models\Slide;
|
||||||
@@ -90,6 +92,7 @@ class AppServiceProvider extends ServiceProvider
|
|||||||
Event::observe(EventObserver::class);
|
Event::observe(EventObserver::class);
|
||||||
Faculty::observe(FacultyObserver::class);
|
Faculty::observe(FacultyObserver::class);
|
||||||
User::observe(UserObserver::class);
|
User::observe(UserObserver::class);
|
||||||
|
UserDetail::observe(UserDetailObserver::class);
|
||||||
EducationalProgram::observe(EducationalProgramObserver::class);
|
EducationalProgram::observe(EducationalProgramObserver::class);
|
||||||
Schedule::observe(ScheduleObserver::class);
|
Schedule::observe(ScheduleObserver::class);
|
||||||
ContactWidget::observe(ContactWidgetObserver::class);
|
ContactWidget::observe(ContactWidgetObserver::class);
|
||||||
|
|||||||
@@ -85,20 +85,19 @@
|
|||||||
<BasicTitle :header="department.data.title" />
|
<BasicTitle :header="department.data.title" />
|
||||||
|
|
||||||
<div id="page-area" class="space-y-5 md:space-y-5">
|
<div id="page-area" class="space-y-5 md:space-y-5">
|
||||||
<h2 id="workers" class="font-bold text-xl">Сотрудники кафедры</h2>
|
<h2 v-if="department.data.workers.length > 0" :id="'anchor-link-' + generateSlug('Сотрудники кафедры')" class="font-bold text-xl">Сотрудники кафедры</h2>
|
||||||
|
|
||||||
<template v-for="worker in department.data.workers">
|
<template v-for="worker in department.data.workers">
|
||||||
<DepartmentWorkerCard :worker="worker" />
|
<DepartmentWorkerCard :worker="worker" />
|
||||||
</template>
|
</template>
|
||||||
<h2 id="teachers" class="font-bold text-xl">Преподаватели кафедры</h2>
|
|
||||||
|
<h2 v-if="department.data.teachers.length > 0" :id="'anchor-link-' + generateSlug('Преподаватели кафедры')" class="font-bold text-xl">Преподаватели кафедры</h2>
|
||||||
<template v-for="teacher in department.data.teachers">
|
<template v-for="teacher in department.data.teachers">
|
||||||
<DepartmentTeacherCard :teacher="teacher" />
|
<DepartmentTeacherCard :teacher="teacher" />
|
||||||
</template>
|
</template>
|
||||||
<h2 id="external-teachers" class="font-bold text-xl">Внешние совместители</h2>
|
|
||||||
|
|
||||||
<h2 id="programs" class="font-bold text-xl">Программы</h2>
|
|
||||||
|
|
||||||
|
<!-- <h2 id="external-teachers" class="font-bold text-xl">Внешние совместители</h2>-->
|
||||||
|
|
||||||
|
<h2 v-if="directions" :id="'anchor-link-' + generateSlug('Программы')" class="font-bold text-xl">Программы</h2>
|
||||||
|
|
||||||
<div class="hs-accordion-group">
|
<div class="hs-accordion-group">
|
||||||
<div v-for="(direction, index) in directions" class="hs-accordion hs-accordion-active:bg-gray-100 rounded-xl px-4 py-6" id="hs-basic-with-title-and-arrow-stretched-heading-three">
|
<div v-for="(direction, index) in directions" class="hs-accordion hs-accordion-active:bg-gray-100 rounded-xl px-4 py-6" id="hs-basic-with-title-and-arrow-stretched-heading-three">
|
||||||
@@ -119,7 +118,7 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h2 id="description" class="font-bold text-xl">Описание</h2>
|
<h2 v-if="department.data.content.length > 0" :id="'anchor-link-' + generateSlug('Описание')" class="font-bold text-xl">Описание</h2>
|
||||||
|
|
||||||
|
|
||||||
<div class="space-y-3 md:space-y-4">
|
<div class="space-y-3 md:space-y-4">
|
||||||
@@ -173,7 +172,8 @@ export default {
|
|||||||
return {
|
return {
|
||||||
scrollTop: false,
|
scrollTop: false,
|
||||||
currentNavSection: null,
|
currentNavSection: null,
|
||||||
}
|
headerNavs: []
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
@@ -245,10 +245,18 @@ export default {
|
|||||||
scrollToTop() {
|
scrollToTop() {
|
||||||
window.scrollTo(0, 0)
|
window.scrollTo(0, 0)
|
||||||
},
|
},
|
||||||
|
extractH2Headers() {
|
||||||
|
const h2Elements = document.querySelectorAll('h2'); // выбираем все h2 на странице
|
||||||
|
this.headerNavs = Array.from(h2Elements).map(h2 => ({
|
||||||
|
id: h2.id, // id заголовка
|
||||||
|
text: h2.textContent // содержимое заголовка
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
this.extractH2Headers()
|
||||||
window.addEventListener("scroll", this.onScroll)
|
window.addEventListener("scroll", this.onScroll)
|
||||||
|
|
||||||
// this.editorImages = this.blocksWithSlideNumber.filter(block => block.type === 'image').map(block => block.data.file.url);
|
// this.editorImages = this.blocksWithSlideNumber.filter(block => block.type === 'image').map(block => block.data.file.url);
|
||||||
@@ -297,73 +305,4 @@ export default {
|
|||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|
||||||
|
|
||||||
.paragraph-container a {
|
|
||||||
@apply text-primary;
|
|
||||||
@apply underline;
|
|
||||||
}
|
|
||||||
|
|
||||||
.paragraph-container p {
|
|
||||||
@apply mb-2
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@keyframes fade {
|
|
||||||
from {
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
to {
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.fade-enter-active,
|
|
||||||
.fade-leave-active {
|
|
||||||
transition: all 0.3s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
.fade-enter-from,
|
|
||||||
.fade-leave-to {
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes grow-progress {
|
|
||||||
from { transform: scaleX(0); }
|
|
||||||
to { transform: scaleX(1); }
|
|
||||||
}
|
|
||||||
|
|
||||||
#progress {
|
|
||||||
height: 2px;
|
|
||||||
background: #26ACB8;
|
|
||||||
z-index: 10000;
|
|
||||||
|
|
||||||
transform-origin: 0 50%;
|
|
||||||
animation: grow-progress auto linear;
|
|
||||||
animation-timeline: scroll();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
.active {
|
|
||||||
color: blue !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.example-initial-animation {
|
|
||||||
animation: initial-animation 2s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes initial-animation {
|
|
||||||
0% {
|
|
||||||
transform: rotate(0deg);
|
|
||||||
}
|
|
||||||
|
|
||||||
50% {
|
|
||||||
transform: rotate(360deg);
|
|
||||||
}
|
|
||||||
|
|
||||||
100% {
|
|
||||||
transform: rotate(0deg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -72,16 +72,18 @@
|
|||||||
|
|
||||||
<div id="page-area" class="space-y-5 md:space-y-5">
|
<div id="page-area" class="space-y-5 md:space-y-5">
|
||||||
|
|
||||||
<h2 v-if="division.data.workers.length > 0" id="persons" class="font-bold text-xl">Состав</h2>
|
<h2 v-if="division.data.workers.length > 0" :id="'anchor-link-' + generateSlug('Состав')" class="font-bold text-xl">Состав</h2>
|
||||||
<template v-for="worker in division.data.workers">
|
<template v-for="worker in division.data.workers">
|
||||||
<DivisionWorkerCard :worker="worker" />
|
<DivisionWorkerCard :worker="worker" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<h2 v-if="division.data.description.length > 0" id="description" class="font-bold text-xl">Описание</h2>
|
<h2 :id="'anchor-link-' + generateSlug('Описание')" v-if="division.data.description.length > 0" class="font-bold text-xl">Описание</h2>
|
||||||
|
|
||||||
<Builder :blocks="division.data.description" />
|
<div class="space-y-3 md:space-y-4">
|
||||||
|
<Builder :blocks="division.data.description" />
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -118,7 +120,8 @@ export default {
|
|||||||
return {
|
return {
|
||||||
scrollTop: false,
|
scrollTop: false,
|
||||||
currentNavSection: null,
|
currentNavSection: null,
|
||||||
}
|
headerNavs: []
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
@@ -203,11 +206,20 @@ export default {
|
|||||||
break; // Выходим из цикла, если нашли видимый заголовок
|
break; // Выходим из цикла, если нашли видимый заголовок
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
extractH2Headers() {
|
||||||
|
const h2Elements = document.querySelectorAll('h2'); // выбираем все h2 на странице
|
||||||
|
this.headerNavs = Array.from(h2Elements).map(h2 => ({
|
||||||
|
id: h2.id, // id заголовка
|
||||||
|
text: h2.textContent // содержимое заголовка
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
this.extractH2Headers()
|
||||||
|
|
||||||
window.addEventListener("scroll", this.handleScroll);
|
window.addEventListener("scroll", this.handleScroll);
|
||||||
|
|
||||||
window.addEventListener("scroll", this.onScroll)
|
window.addEventListener("scroll", this.onScroll)
|
||||||
@@ -225,73 +237,4 @@ export default {
|
|||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|
||||||
|
|
||||||
.paragraph-container a {
|
|
||||||
@apply text-primary;
|
|
||||||
@apply underline;
|
|
||||||
}
|
|
||||||
|
|
||||||
.paragraph-container p {
|
|
||||||
@apply mb-2
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@keyframes fade {
|
|
||||||
from {
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
to {
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.fade-enter-active,
|
|
||||||
.fade-leave-active {
|
|
||||||
transition: all 0.3s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
.fade-enter-from,
|
|
||||||
.fade-leave-to {
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes grow-progress {
|
|
||||||
from { transform: scaleX(0); }
|
|
||||||
to { transform: scaleX(1); }
|
|
||||||
}
|
|
||||||
|
|
||||||
#progress {
|
|
||||||
height: 2px;
|
|
||||||
background: #26ACB8;
|
|
||||||
z-index: 10000;
|
|
||||||
|
|
||||||
transform-origin: 0 50%;
|
|
||||||
animation: grow-progress auto linear;
|
|
||||||
animation-timeline: scroll();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
.active {
|
|
||||||
color: blue !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.example-initial-animation {
|
|
||||||
animation: initial-animation 2s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes initial-animation {
|
|
||||||
0% {
|
|
||||||
transform: rotate(0deg);
|
|
||||||
}
|
|
||||||
|
|
||||||
50% {
|
|
||||||
transform: rotate(360deg);
|
|
||||||
}
|
|
||||||
|
|
||||||
100% {
|
|
||||||
transform: rotate(0deg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -27,37 +27,7 @@
|
|||||||
</nav>
|
</nav>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<nav class="order-last hidden w-56 shrink-0 lg:block">
|
<NavigateLinks :header-navs="headerNavs" />
|
||||||
<div class="sticky top-[110px] h-[calc(100vh-110px)]">
|
|
||||||
<div class="text-gray-1000 mb-2 text-md font-medium">На этой странице</div>
|
|
||||||
<ul class="max-h-[70vh] space-y-1.5 overflow-hidden py-2 text-sm">
|
|
||||||
<li class="anchor-li">
|
|
||||||
<a :class="{ 'translate-x-2 text-primary-light' : currentNavSection === 'persons', 'bg-transperant text-gray-600 hover:text-gray-900' : currentNavSection !== 'persons' }"
|
|
||||||
class="duration-150 block py-1 px-2 leading-[1.6] rounded-md"
|
|
||||||
href="#persons">Состав</a>
|
|
||||||
</li>
|
|
||||||
<li class="anchor-li">
|
|
||||||
<a :class="{ 'translate-x-2 text-primary-light' : currentNavSection === 'department', 'bg-transperant text-gray-600 hover:text-gray-900' : currentNavSection !== 'department' }"
|
|
||||||
class="duration-150 block py-1 px-2 leading-[1.6] rounded-md"
|
|
||||||
href="#department">Кафедры факультета</a>
|
|
||||||
</li>
|
|
||||||
<li class="anchor-li">
|
|
||||||
<a :class="{ 'translate-x-2 text-primary-light' : currentNavSection === 'description', 'bg-transperant text-gray-600 hover:text-gray-900' : currentNavSection !== 'description' }"
|
|
||||||
class="duration-150 block py-1 px-2 leading-[1.6] rounded-md"
|
|
||||||
href="#description">Описание</a>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<transition name="fade">
|
|
||||||
<li class="anchor-li flex items-center py-2 border-t" v-if="scrollTop" @click.prevent="scrollToTop">
|
|
||||||
<button class="bg-transperant text-gray-600 cursor-pointer hover:text-gray-900 duration-300 block px-2 leading-[1.6] rounded-md">К началу</button>
|
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-[17px] text-gray-600">
|
|
||||||
<path stroke-linecap="round" stroke-linejoin="round" d="M15 11.25l-3-3m0 0l-3 3m3-3v7.5M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
|
|
||||||
</svg>
|
|
||||||
</li>
|
|
||||||
</transition>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</nav>
|
|
||||||
|
|
||||||
<article class="w-full min-w-0 mt-1 max-w-6xl px-1 md:px-6" style="">
|
<article class="w-full min-w-0 mt-1 max-w-6xl px-1 md:px-6" style="">
|
||||||
<div class="space-y-5 md:space-y-5">
|
<div class="space-y-5 md:space-y-5">
|
||||||
@@ -77,25 +47,15 @@
|
|||||||
|
|
||||||
<div id="page-area" class="space-y-5 md:space-y-5">
|
<div id="page-area" class="space-y-5 md:space-y-5">
|
||||||
|
|
||||||
<h2 id="persons" class="font-bold text-xl">Состав</h2>
|
<h2 :id="'anchor-link-' + generateSlug('Состав')" v-if="faculty.data.workers.length > 0" class="font-bold text-xl">Состав</h2>
|
||||||
|
|
||||||
|
|
||||||
<template v-for="worker in faculty.data.workers">
|
<template v-for="worker in faculty.data.workers">
|
||||||
<FacultyWorkerCard :worker="worker" />
|
<FacultyWorkerCard :worker="worker" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
||||||
<!-- End FAQ -->
|
<h2 :id="'anchor-link-' + generateSlug('Кафедры факультета')" v-if="faculty.data.departments.length > 0" class="font-bold text-xl">Кафедры факультета</h2>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<h2 id="department" class="font-bold text-xl">Кафедры факультета</h2>
|
|
||||||
|
|
||||||
<!-- Card Section -->
|
|
||||||
<!-- Grid -->
|
|
||||||
<div class="grid sm:grid-cols-2 md:grid-cols-2 xl:grid-cols-2 gap-3 sm:gap-6">
|
<div class="grid sm:grid-cols-2 md:grid-cols-2 xl:grid-cols-2 gap-3 sm:gap-6">
|
||||||
<template v-for="department in faculty.data.departments">
|
<template v-for="department in faculty.data.departments">
|
||||||
|
|
||||||
<Link :href="route('client.department.show', { facultySlug: faculty.data.slug, departmentSlug: department.slug })" class="flex justify-center items-center bg-white border shadow-sm rounded-xl hover:shadow-md focus:outline-none focus:shadow-md transition">
|
<Link :href="route('client.department.show', { facultySlug: faculty.data.slug, departmentSlug: department.slug })" class="flex justify-center items-center bg-white border shadow-sm rounded-xl hover:shadow-md focus:outline-none focus:shadow-md transition">
|
||||||
<div class="p-4 md:p-5">
|
<div class="p-4 md:p-5">
|
||||||
<div class="flex justify-between items-center gap-x-3">
|
<div class="flex justify-between items-center gap-x-3">
|
||||||
@@ -111,11 +71,9 @@
|
|||||||
</div>
|
</div>
|
||||||
</Link>
|
</Link>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h2 id="description" class="font-bold text-xl">Описание</h2>
|
<h2 v-if="faculty.data.content.length > 0" :id="'anchor-link-' + generateSlug('Описание')" class="font-bold text-xl">Описание</h2>
|
||||||
|
|
||||||
|
|
||||||
<div class="space-y-3 md:space-y-4">
|
<div class="space-y-3 md:space-y-4">
|
||||||
<Builder :blocks="faculty.data.content "/>
|
<Builder :blocks="faculty.data.content "/>
|
||||||
@@ -159,6 +117,7 @@ import BasicListFilter from "@/componentss/shared/filter/BasicListFilter.vue";
|
|||||||
import EventListSearch from "@/componentss/features/events/components/EventListSearch.vue";
|
import EventListSearch from "@/componentss/features/events/components/EventListSearch.vue";
|
||||||
import SortingByFilter from "@/componentss/shared/filter/filters/SortingByFilter.vue";
|
import SortingByFilter from "@/componentss/shared/filter/filters/SortingByFilter.vue";
|
||||||
import NavigateVisor from "@/componentss/shared/visor/NavigateVisor.vue";
|
import NavigateVisor from "@/componentss/shared/visor/NavigateVisor.vue";
|
||||||
|
import NavigateLinks from "@/componentss/shared/navigate/NavigateLinks.vue";
|
||||||
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@@ -167,7 +126,8 @@ export default {
|
|||||||
return {
|
return {
|
||||||
scrollTop: false,
|
scrollTop: false,
|
||||||
currentNavSection: null,
|
currentNavSection: null,
|
||||||
}
|
headerNavs: []
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
@@ -183,6 +143,7 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
components: {
|
components: {
|
||||||
|
NavigateLinks,
|
||||||
NavigateVisor,
|
NavigateVisor,
|
||||||
SortingByFilter,
|
SortingByFilter,
|
||||||
EventListSearch,
|
EventListSearch,
|
||||||
@@ -232,11 +193,20 @@ export default {
|
|||||||
scrollToTop() {
|
scrollToTop() {
|
||||||
window.scrollTo(0, 0)
|
window.scrollTo(0, 0)
|
||||||
},
|
},
|
||||||
|
extractH2Headers() {
|
||||||
|
const h2Elements = document.querySelectorAll('h2'); // выбираем все h2 на странице
|
||||||
|
this.headerNavs = Array.from(h2Elements).map(h2 => ({
|
||||||
|
id: h2.id, // id заголовка
|
||||||
|
text: h2.textContent // содержимое заголовка
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
window.addEventListener("scroll", this.onScroll)
|
this.extractH2Headers();
|
||||||
|
|
||||||
|
window.addEventListener("scroll", this.onScroll)
|
||||||
|
|
||||||
window.addEventListener("scroll", () => {
|
window.addEventListener("scroll", () => {
|
||||||
const headings = document.querySelectorAll('h2');
|
const headings = document.querySelectorAll('h2');
|
||||||
@@ -282,64 +252,4 @@ export default {
|
|||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@keyframes fade {
|
|
||||||
from {
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
to {
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.fade-enter-active,
|
|
||||||
.fade-leave-active {
|
|
||||||
transition: all 0.3s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
.fade-enter-from,
|
|
||||||
.fade-leave-to {
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes grow-progress {
|
|
||||||
from { transform: scaleX(0); }
|
|
||||||
to { transform: scaleX(1); }
|
|
||||||
}
|
|
||||||
|
|
||||||
#progress {
|
|
||||||
height: 2px;
|
|
||||||
background: #26ACB8;
|
|
||||||
z-index: 10000;
|
|
||||||
|
|
||||||
transform-origin: 0 50%;
|
|
||||||
animation: grow-progress auto linear;
|
|
||||||
animation-timeline: scroll();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
.active {
|
|
||||||
color: blue !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.example-initial-animation {
|
|
||||||
animation: initial-animation 2s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes initial-animation {
|
|
||||||
0% {
|
|
||||||
transform: rotate(0deg);
|
|
||||||
}
|
|
||||||
|
|
||||||
50% {
|
|
||||||
transform: rotate(360deg);
|
|
||||||
}
|
|
||||||
|
|
||||||
100% {
|
|
||||||
transform: rotate(0deg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
<!-- NavLink.vue -->
|
<!-- NavLink.vue -->
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<h2 :id="generateSlug(title)" class="mb-3 font-medium text-gray-800 dark:text-neutral-200">
|
<h2 :id="'anchor-link-' + generateSlug(title)" class="mb-3 font-medium text-gray-800 dark:text-neutral-200">
|
||||||
{{ title }}
|
{{ title }}
|
||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user