74 lines
2.3 KiB
PHP
74 lines
2.3 KiB
PHP
<x-app-layout>
|
|
<x-slot name="header">
|
|
@if (session('login-success-data'))
|
|
{{ __('messages.login_success', session('login-success-data')) }}
|
|
@else
|
|
{{ __('Main page') }}
|
|
@endif
|
|
</x-slot>
|
|
|
|
@if (session('unauthorizedAction'))
|
|
<div class="alert alert-danger">
|
|
<livewire:notify-unauthorized-action>
|
|
</div>
|
|
@endif
|
|
|
|
{{-- Show the secondary / success / info / error /alert notification session messages --}}
|
|
@if (session('notification'))
|
|
<livewire:notification>
|
|
@endif
|
|
|
|
{{-- Show the notification message that the email address has been verified --}}
|
|
@if (session('email-verified'))
|
|
<livewire:notify-email-verified>
|
|
@endif
|
|
|
|
|
|
|
|
@if (session('results'))
|
|
@livewire('search.show', ['results' => session('results')])
|
|
@endif
|
|
|
|
|
|
|
|
|
|
<div class="py-0 md:py-3">
|
|
<div class="mx-auto max-w-7xl sm:px-6 lg:px-8">
|
|
|
|
<div class="overflow-hidden bg-theme-background shadow-xl sm:rounded-lg">
|
|
<livewire:main-page>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
@php
|
|
$canManageMaintenance = false;
|
|
if (getActiveProfileType() === 'Admin') {
|
|
$webUser = \Illuminate\Support\Facades\Auth::guard('web')->user();
|
|
$activeId = session('activeProfileId');
|
|
if ($webUser && $activeId) {
|
|
$prefix = 'Admin\\' . $activeId . '\\';
|
|
$scopedRoles = $webUser->roles->filter(fn($r) => str_starts_with($r->name, $prefix));
|
|
foreach ($scopedRoles as $scopedRole) {
|
|
$roleName = str_replace($prefix, '', $scopedRole->name);
|
|
$adminRole = \App\Models\AdminRole::where('name', $roleName)->first();
|
|
if ($adminRole && in_array('manage maintenance', $adminRole->permissions ?? [])) {
|
|
$canManageMaintenance = true;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@endphp
|
|
@if($canManageMaintenance)
|
|
<div class="py-6">
|
|
<div class="mx-auto max-w-7xl sm:px-6 lg:px-8">
|
|
|
|
<div class="overflow-hidden bg-theme-background shadow-xl sm:rounded-lg">
|
|
<livewire:admin.maintenance-mode>
|
|
</div>
|
|
</div>
|
|
@endif
|
|
</x-app-layout>
|