fix(departments): fix contact info editing, cache invalidation, and pivot data display

- User model: add missing pivot columns (service_email, service_phone, cabinet, sort) to departments_work() and departments_teach() withPivot
- ListDepartmentWorkersAction/TeachersAction: fix where() to wherePivot() for position filters
- Dashboard Workers/Teachers Index.vue: display validation errors in add/edit modals
- Dashboard Workers/Teachers Index.vue: add links to client person pages
- DepartmentCacheService: clear person_* cache when department data changes
- Filament WorkersRelationManager/TeachersRelationManager: fix pivot columns in table (pivot.position etc), add cache clearing on edit/detach/bulk actions
This commit is contained in:
F4ilji
2026-09-18 01:32:27 +05:00
parent e0e80fc430
commit bf77cb634c
8 changed files with 73 additions and 20 deletions
@@ -70,18 +70,18 @@ class WorkersRelationManager extends RelationManager
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('position')
Tables\Columns\TextColumn::make('pivot.position')
->label('Должность')
->searchable()
->sortable()
->wrap(),
Tables\Columns\TextColumn::make('service_email')
Tables\Columns\TextColumn::make('pivot.service_email')
->label('Почта')
->searchable()
->toggleable(isToggledHiddenByDefault: true),
Tables\Columns\TextColumn::make('cabinet')
Tables\Columns\TextColumn::make('pivot.cabinet')
->label('Кабинет')
->sortable()
->toggleable(),
@@ -144,14 +144,20 @@ class WorkersRelationManager extends RelationManager
->actions([
Tables\Actions\EditAction::make()
->iconButton()
->tooltip('Редактировать'),
->tooltip('Редактировать')
->before(function () {
app(DepartmentCacheService::class)->clearAllCacheByModel();
}),
Tables\Actions\DetachAction::make()
->iconButton()
->tooltip('Убрать с кафедры')
->modalHeading('Удаление связи')
->modalSubmitActionLabel('Убрать')
->modalDescription('Вы уверены, что хотите убрать этого сотрудника с кафедры?'),
->modalDescription('Вы уверены, что хотите убрать этого сотрудника с кафедры?')
->before(function () {
app(DepartmentCacheService::class)->clearAllCacheByModel();
}),
])
->bulkActions([
Tables\Actions\BulkActionGroup::make([
@@ -159,7 +165,10 @@ class WorkersRelationManager extends RelationManager
->label('Убрать выбранных')
->modalHeading('Удаление связей')
->modalSubmitActionLabel('Убрать')
->modalDescription('Вы уверены, что хотите убрать выбранных сотрудников с кафедры?'),
->modalDescription('Вы уверены, что хотите убрать выбранных сотрудников с кафедры?')
->before(function () {
app(DepartmentCacheService::class)->clearAllCacheByModel();
}),
]),
])
->emptyStateActions([