diff --git a/app/Filament/Resources/DivisionResource.php b/app/Filament/Resources/DivisionResource.php index 8faf67d..5ddb5f3 100644 --- a/app/Filament/Resources/DivisionResource.php +++ b/app/Filament/Resources/DivisionResource.php @@ -90,7 +90,7 @@ class DivisionResource extends Resource Tabs\Tab::make('Контент') ->icon('heroicon-o-document-text') ->schema([ - ContentBuilderItem::getItem('content') + ContentBuilderItem::getItem('description') ]), ]), ]), diff --git a/app/Filament/Resources/DivisionResource/Pages/CreateDivision.php b/app/Filament/Resources/DivisionResource/Pages/CreateDivision.php index 6f9ad6b..f034e2f 100644 --- a/app/Filament/Resources/DivisionResource/Pages/CreateDivision.php +++ b/app/Filament/Resources/DivisionResource/Pages/CreateDivision.php @@ -38,32 +38,6 @@ class CreateDivision extends CreateRecord return strtolower($result); } - private function getFirstBlockByName(string $name, array $content) : array|null - { - $data = null; - foreach ($content as $block) { - $data = ($block['type'] === $name) ? $block : null; - break; - } - return $data; - } - - private function getBlockBySeoActiveState(string $name, array $content) : array|null - { - $data = []; - foreach ($content as $block) { - if ($block['type'] === $name) { - $data[] = $block; - } - } - $block = null; - foreach ($data as $item) { - if ($item['data']['seo_active'] === true) { - $block = $item; - } - } - return $block; - } private function getDataFromBlocks($block) : string { diff --git a/app/Http/Middleware/EnsureUserIsSuperadmin.php b/app/Http/Middleware/EnsureUserIsSuperadmin.php index 12ce0dd..19f922b 100644 --- a/app/Http/Middleware/EnsureUserIsSuperadmin.php +++ b/app/Http/Middleware/EnsureUserIsSuperadmin.php @@ -2,9 +2,10 @@ namespace App\Http\Middleware; +use App\Ship\Requests\Request; use Closure; -use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; +use Inertia\Inertia; use Symfony\Component\HttpFoundation\Response; class EnsureUserIsSuperadmin @@ -16,9 +17,10 @@ class EnsureUserIsSuperadmin */ public function handle(Request $request, Closure $next) { - // Проверяем, что пользователь аутентифицирован и имеет роль superadmin if (!Auth::check() || !Auth::user()->hasRole('super_admin')) { - return response('Access denied. You do not have permission to access this route.', 403); + return Inertia::render('Error', ['status' => 403]) + ->toResponse($request) + ->setStatusCode(403); } return $next($request); diff --git a/app/Models/Division.php b/app/Models/Division.php index 1a7f423..fca6cd0 100644 --- a/app/Models/Division.php +++ b/app/Models/Division.php @@ -2,10 +2,11 @@ namespace App\Models; +use App\Services\App\Seo\SeoDescriptionInterface; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; -class Division extends Model +class Division extends Model implements SeoDescriptionInterface { use HasFactory; @@ -24,4 +25,9 @@ class Division extends Model { return $this->belongsToMany(User::class, 'division_user')->withPivot(['administrativePosition', 'sort', 'service_email', 'service_phone', 'cabinet']); } + + public function getSeoDescription(): array + { + return $this->description; + } } diff --git a/resources/js/componentss/shared/paginate/BasicPagination.vue b/resources/js/componentss/shared/paginate/BasicPagination.vue index 83dbe11..2d07239 100644 --- a/resources/js/componentss/shared/paginate/BasicPagination.vue +++ b/resources/js/componentss/shared/paginate/BasicPagination.vue @@ -7,11 +7,27 @@ Previous +
- {{ link.label }} + + + + +
+ Next @@ -39,6 +55,20 @@ export default { link.label !== 'pagination.previous' && link.label !== 'pagination.next' ); + }, + getMobilePageLinks(pagination) { + const allLinks = this.getPageLinks(pagination); + const activeIndex = allLinks.findIndex(link => link.active); + + + + // Возвращаем только активную страницу и соседние + if (activeIndex === -1) return allLinks; + + const start = Math.max(0, activeIndex - 1); + const end = Math.min(allLinks.length - 1, activeIndex + 1); + + return allLinks.slice(start, end + 1); } } }; diff --git a/resources/js/ssr.js b/resources/js/ssr.js index a9ad15d..42ff7dd 100644 --- a/resources/js/ssr.js +++ b/resources/js/ssr.js @@ -1,12 +1,10 @@ import '../css/app.css'; - import { createInertiaApp } from '@inertiajs/vue3' import createServer from '@inertiajs/vue3/server' import { renderToString } from '@vue/server-renderer' import { createSSRApp, h } from 'vue' import { ZiggyVue } from '../../vendor/tightenco/ziggy/dist/vue.m'; - createServer(page => createInertiaApp({ page, @@ -16,9 +14,14 @@ createServer(page => return pages[`./Pages/${name}.vue`]() }, setup({ App, props, plugin }) { - return createSSRApp({ + const ssrApp = createSSRApp({ render: () => h(App, props), - }) + }); + + ssrApp.config.errorHandler = () => null; + ssrApp.config.warnHandler = () => null; + + return ssrApp .use(plugin) .use(ZiggyVue, { ...page.props.ziggy, @@ -26,4 +29,4 @@ createServer(page => }); }, }), -) \ No newline at end of file +); \ No newline at end of file diff --git a/resources/views/app.blade.php b/resources/views/app.blade.php index 4c4b9a1..fda2d3e 100644 --- a/resources/views/app.blade.php +++ b/resources/views/app.blade.php @@ -2,7 +2,7 @@ - + {{-- {{ config('app.name', 'Laravel') }}--}}