@php
$webUser = \Illuminate\Support\Facades\Auth::guard('web')->user();
$activeLogId = session('activeProfileId');
$adminLogPermissions = [];
if ($webUser && $activeLogId) {
$logPrefix = 'Admin\\' . $activeLogId . '\\';
$logScopedRoles = $webUser->roles->filter(fn($r) => str_starts_with($r->name, $logPrefix));
foreach ($logScopedRoles as $logScopedRole) {
$logRoleName = str_replace($logPrefix, '', $logScopedRole->name);
$logAdminRole = \App\Models\AdminRole::where('name', $logRoleName)->first();
if ($logAdminRole) {
$adminLogPermissions = array_merge($adminLogPermissions, $logAdminRole->permissions ?? []);
}
}
}
@endphp
@if (in_array('view search-metrics', $adminLogPermissions) && timebank_config('search_optimization.search_analytics_enabled'))
@endif
@if (in_array('view application-log', $adminLogPermissions))
@endif
@if (in_array('view inactive-profiles-log', $adminLogPermissions))
@endif
@if (in_array('view search-reindex-log', $adminLogPermissions))
@endif