diff --git a/app/Containers/InstituteStructure/UI/WEB/Controllers/ClientDepartmentController.php b/app/Containers/InstituteStructure/UI/WEB/Controllers/ClientDepartmentController.php index 102061c..3cd9a60 100644 --- a/app/Containers/InstituteStructure/UI/WEB/Controllers/ClientDepartmentController.php +++ b/app/Containers/InstituteStructure/UI/WEB/Controllers/ClientDepartmentController.php @@ -58,6 +58,9 @@ class ClientDepartmentController extends Controller ->where('is_active', true) ->with([ 'faculty', + 'workers' => fn ($query) => $query->orderBy('sort', 'asc'), + 'teachers' => fn ($query) => $query->orderBy('sort', 'asc'), + 'programs' => fn ($query) => $query->orderBy('sort', 'asc'), 'workers.userDetail', 'teachers.userDetail', 'programs.directionStudy', diff --git a/app/Containers/InstituteStructure/UI/WEB/Controllers/ClientDivisionController.php b/app/Containers/InstituteStructure/UI/WEB/Controllers/ClientDivisionController.php index 35873c0..f3c914a 100644 --- a/app/Containers/InstituteStructure/UI/WEB/Controllers/ClientDivisionController.php +++ b/app/Containers/InstituteStructure/UI/WEB/Controllers/ClientDivisionController.php @@ -38,7 +38,15 @@ class ClientDivisionController extends Controller }); $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); diff --git a/app/Containers/InstituteStructure/UI/WEB/Controllers/ClientFacultyController.php b/app/Containers/InstituteStructure/UI/WEB/Controllers/ClientFacultyController.php index f6481e3..49bf64a 100644 --- a/app/Containers/InstituteStructure/UI/WEB/Controllers/ClientFacultyController.php +++ b/app/Containers/InstituteStructure/UI/WEB/Controllers/ClientFacultyController.php @@ -61,7 +61,11 @@ class ClientFacultyController extends Controller function () use ($slug) { return Faculty::where('slug', $slug) ->where('is_active', true) - ->with(['departments.faculty', 'workers', 'seo']) + ->with(['departments.faculty', + 'workers' => fn ($query) => $query->orderBy('sort', 'asc'), + 'workers.userDetail', + 'seo' + ]) ->firstOrFail(); } ); diff --git a/app/Containers/User/Observers/UserDetailObserver.php b/app/Containers/User/Observers/UserDetailObserver.php new file mode 100644 index 0000000..24375ea --- /dev/null +++ b/app/Containers/User/Observers/UserDetailObserver.php @@ -0,0 +1,56 @@ +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(); + } +} diff --git a/app/Filament/Resources/DepartmentResource/RelationManagers/ProgramsRelationManager.php b/app/Filament/Resources/DepartmentResource/RelationManagers/ProgramsRelationManager.php index 0d4d345..75804fc 100644 --- a/app/Filament/Resources/DepartmentResource/RelationManagers/ProgramsRelationManager.php +++ b/app/Filament/Resources/DepartmentResource/RelationManagers/ProgramsRelationManager.php @@ -103,4 +103,9 @@ class ProgramsRelationManager extends RelationManager ->deferLoading() ->persistFiltersInSession(); } + + protected function canReorder(): bool + { + return true; + } } \ No newline at end of file diff --git a/app/Filament/Resources/DepartmentResource/RelationManagers/TeachersRelationManager.php b/app/Filament/Resources/DepartmentResource/RelationManagers/TeachersRelationManager.php index cc7dbe6..d512b54 100644 --- a/app/Filament/Resources/DepartmentResource/RelationManagers/TeachersRelationManager.php +++ b/app/Filament/Resources/DepartmentResource/RelationManagers/TeachersRelationManager.php @@ -166,7 +166,13 @@ class TeachersRelationManager extends RelationManager AttachAction::make() ->label('Добавить преподавателя'), ]) - ->defaultSort('name') + ->defaultSort('sort') + ->reorderable('sort') ->deferLoading(); } + + protected function canReorder(): bool + { + return true; + } } \ No newline at end of file diff --git a/app/Filament/Resources/DepartmentResource/RelationManagers/WorkersRelationManager.php b/app/Filament/Resources/DepartmentResource/RelationManagers/WorkersRelationManager.php index a206657..8347851 100644 --- a/app/Filament/Resources/DepartmentResource/RelationManagers/WorkersRelationManager.php +++ b/app/Filament/Resources/DepartmentResource/RelationManagers/WorkersRelationManager.php @@ -166,7 +166,13 @@ class WorkersRelationManager extends RelationManager AttachAction::make() ->label('Добавить сотрудника'), ]) - ->defaultSort('name') + ->reorderable('sort') + ->defaultSort('sort') ->deferLoading(); } + + protected function canReorder(): bool + { + return true; + } } \ No newline at end of file diff --git a/app/Filament/Resources/DivisionResource/RelationManagers/WorkersRelationManager.php b/app/Filament/Resources/DivisionResource/RelationManagers/WorkersRelationManager.php index d5e9232..835b987 100644 --- a/app/Filament/Resources/DivisionResource/RelationManagers/WorkersRelationManager.php +++ b/app/Filament/Resources/DivisionResource/RelationManagers/WorkersRelationManager.php @@ -181,4 +181,9 @@ class WorkersRelationManager extends RelationManager ->paginated([10, 25, 50, 100]) ->striped(); } + + protected function canReorder(): bool + { + return true; + } } \ No newline at end of file diff --git a/app/Filament/Resources/FacultyResource/RelationManagers/WorkersRelationManager.php b/app/Filament/Resources/FacultyResource/RelationManagers/WorkersRelationManager.php index ccde7cb..dc9fb1e 100644 --- a/app/Filament/Resources/FacultyResource/RelationManagers/WorkersRelationManager.php +++ b/app/Filament/Resources/FacultyResource/RelationManagers/WorkersRelationManager.php @@ -50,6 +50,7 @@ class WorkersRelationManager extends RelationManager ->maxLength(10) ->placeholder('Например: 305а') ->helperText('Номер кабинета для приема'), + ]) ]); } @@ -57,9 +58,9 @@ class WorkersRelationManager extends RelationManager public function table(Table $table): Table { return $table - ->recordTitleAttribute('name') ->reorderable('sort') ->defaultSort('sort') + ->recordTitleAttribute('name') ->columns([ Tables\Columns\TextColumn::make('name') ->label('ФИО') @@ -75,23 +76,21 @@ class WorkersRelationManager extends RelationManager Tables\Columns\TextColumn::make('service_email') ->label('Почта') ->searchable() - ->icon('heroicon-o-envelope') - ->toggleable(isToggledHiddenByDefault: true), + ->icon('heroicon-o-envelope'), Tables\Columns\TextColumn::make('service_phone') ->label('Телефон') ->searchable() - ->icon('heroicon-o-phone') - ->toggleable(isToggledHiddenByDefault: true), + ->icon('heroicon-o-phone'), Tables\Columns\TextColumn::make('cabinet') ->label('Кабинет') ->searchable() - ->icon('heroicon-o-home-modern') - ->toggleable(isToggledHiddenByDefault: false), - ]) - ->filters([ - // + ->icon('heroicon-o-home-modern'), +// Tables\Columns\TextColumn::make('sort') +// ->label('Сортировка') +// ->toggleable(isToggledHiddenByDefault: false), + ]) ->headerActions([ AttachAction::make() @@ -165,4 +164,9 @@ class WorkersRelationManager extends RelationManager ->emptyStateDescription('Добавьте сотрудников, используя кнопку выше') ->emptyStateIcon('heroicon-o-user-group'); } + + protected function canReorder(): bool + { + return true; + } } \ No newline at end of file diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 37f0d4d..da78d87 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -18,6 +18,8 @@ use App\Containers\InstituteStructure\Models\Faculty; use App\Containers\Schedule\Models\Schedule; use App\Containers\Science\Models\AcademicJournal; 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\PageReferenceList; use App\Containers\Widget\Models\Slide; @@ -90,6 +92,7 @@ class AppServiceProvider extends ServiceProvider Event::observe(EventObserver::class); Faculty::observe(FacultyObserver::class); User::observe(UserObserver::class); + UserDetail::observe(UserDetailObserver::class); EducationalProgram::observe(EducationalProgramObserver::class); Schedule::observe(ScheduleObserver::class); ContactWidget::observe(ContactWidgetObserver::class); diff --git a/resources/js/Pages/Client/Departments/Show.vue b/resources/js/Pages/Client/Departments/Show.vue index 1592760..9211859 100644 --- a/resources/js/Pages/Client/Departments/Show.vue +++ b/resources/js/Pages/Client/Departments/Show.vue @@ -85,20 +85,19 @@
-

Сотрудники кафедры

- +

Сотрудники кафедры

-

Преподаватели кафедры

+ +

Преподаватели кафедры

-

Внешние совместители

- -

Программы

+ +

Программы

@@ -119,7 +118,7 @@
-

Описание

+

Описание

@@ -173,7 +172,8 @@ export default { return { scrollTop: false, currentNavSection: null, - } + headerNavs: [] + } }, props: { @@ -245,10 +245,18 @@ export default { scrollToTop() { 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() { + this.extractH2Headers() window.addEventListener("scroll", this.onScroll) // this.editorImages = this.blocksWithSlideNumber.filter(block => block.type === 'image').map(block => block.data.file.url); @@ -297,73 +305,4 @@ export default { diff --git a/resources/js/Pages/Client/Divisions/Show.vue b/resources/js/Pages/Client/Divisions/Show.vue index 175e4fc..e4df401 100644 --- a/resources/js/Pages/Client/Divisions/Show.vue +++ b/resources/js/Pages/Client/Divisions/Show.vue @@ -72,16 +72,18 @@
-

Состав

+

Состав

-

Описание

+

Описание

- +
+ +
@@ -118,7 +120,8 @@ export default { return { scrollTop: false, currentNavSection: null, - } + headerNavs: [] + } }, props: { @@ -203,11 +206,20 @@ export default { break; // Выходим из цикла, если нашли видимый заголовок } } + }, + extractH2Headers() { + const h2Elements = document.querySelectorAll('h2'); // выбираем все h2 на странице + this.headerNavs = Array.from(h2Elements).map(h2 => ({ + id: h2.id, // id заголовка + text: h2.textContent // содержимое заголовка + })); } }, mounted() { + this.extractH2Headers() + window.addEventListener("scroll", this.handleScroll); window.addEventListener("scroll", this.onScroll) @@ -225,73 +237,4 @@ export default { diff --git a/resources/js/Pages/Client/Faculties/Show.vue b/resources/js/Pages/Client/Faculties/Show.vue index 7eb0172..b228b4b 100644 --- a/resources/js/Pages/Client/Faculties/Show.vue +++ b/resources/js/Pages/Client/Faculties/Show.vue @@ -27,37 +27,7 @@
- +
@@ -77,25 +47,15 @@
-

Состав

- - +

Состав

- - - - -

Кафедры факультета

- - - +

Кафедры факультета

-
-

Описание

- +

Описание

@@ -159,6 +117,7 @@ import BasicListFilter from "@/componentss/shared/filter/BasicListFilter.vue"; import EventListSearch from "@/componentss/features/events/components/EventListSearch.vue"; import SortingByFilter from "@/componentss/shared/filter/filters/SortingByFilter.vue"; import NavigateVisor from "@/componentss/shared/visor/NavigateVisor.vue"; +import NavigateLinks from "@/componentss/shared/navigate/NavigateLinks.vue"; export default { @@ -167,7 +126,8 @@ export default { return { scrollTop: false, currentNavSection: null, - } + headerNavs: [] + } }, props: { @@ -183,6 +143,7 @@ export default { }, components: { + NavigateLinks, NavigateVisor, SortingByFilter, EventListSearch, @@ -232,11 +193,20 @@ export default { scrollToTop() { 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() { - window.addEventListener("scroll", this.onScroll) + this.extractH2Headers(); + + window.addEventListener("scroll", this.onScroll) window.addEventListener("scroll", () => { const headings = document.querySelectorAll('h2'); @@ -282,64 +252,4 @@ export default { diff --git a/resources/js/componentss/features/persons/components/sections/blocks/EducationBlock.vue b/resources/js/componentss/features/persons/components/sections/blocks/EducationBlock.vue index 1343f2c..39d2f62 100644 --- a/resources/js/componentss/features/persons/components/sections/blocks/EducationBlock.vue +++ b/resources/js/componentss/features/persons/components/sections/blocks/EducationBlock.vue @@ -1,7 +1,7 @@